@Test public void getPatient() { Patient patient = emr.getPatient("3"); Assert.assertNotNull(patient); System.out.println(patient.getFirstName()); System.out.println(patient.getLastName()); System.out.println(patient.getDob()); }
public Patient getPatient(String patientId) { if(patientCache.containsKey(patientId)) { return patientCache.get(patientId); } PreparedStatementData psd = new PreparedStatementData(1); psd.setQueryStr(GET_PATIENT); psd.addParameter(0, PreparedStatementData.ParameterType.STRING, patientId); try { String[][] rs = DBUtil.doQuery(psd, dataSource); if (rs == null || rs.length == 0) { return null; } else { for (String[] r : rs) { Patient pt = new Patient(); pt.setPatientId(r[0]); pt.setFirstName(r[1]); pt.setLastName(r[2]); pt.setSsn(r[3]); pt.setDob(Date.valueOf(r[4])); pt.setSex(r[5]); pt.setRace(r[6]); pt.setReligion(r[7]); pt.setOccupation(r[8]); try { pt.setHouseNumber(Integer.parseInt(r[9])); } catch (NumberFormatException e) { e.printStackTrace(); } pt.setStreet(r[10]); pt.setCity(r[11]); pt.setState(r[12]); try { pt.setZip(Integer.parseInt(r[13])); } catch (NumberFormatException e) { e.printStackTrace(); } pt.setContactNumber(r[14]); patientCache.put(patientId, pt); return pt; } } } catch (SQLException e) { throw new RuntimeException(e); } return null; }
EMR { public Patient getPatient(String patientId) { if(patientCache.containsKey(patientId)) { return patientCache.get(patientId); } PreparedStatementData psd = new PreparedStatementData(1); psd.setQueryStr(GET_PATIENT); psd.addParameter(0, PreparedStatementData.ParameterType.STRING, patientId); try { String[][] rs = DBUtil.doQuery(psd, dataSource); if (rs == null || rs.length == 0) { return null; } else { for (String[] r : rs) { Patient pt = new Patient(); pt.setPatientId(r[0]); pt.setFirstName(r[1]); pt.setLastName(r[2]); pt.setSsn(r[3]); pt.setDob(Date.valueOf(r[4])); pt.setSex(r[5]); pt.setRace(r[6]); pt.setReligion(r[7]); pt.setOccupation(r[8]); try { pt.setHouseNumber(Integer.parseInt(r[9])); } catch (NumberFormatException e) { e.printStackTrace(); } pt.setStreet(r[10]); pt.setCity(r[11]); pt.setState(r[12]); try { pt.setZip(Integer.parseInt(r[13])); } catch (NumberFormatException e) { e.printStackTrace(); } pt.setContactNumber(r[14]); patientCache.put(patientId, pt); return pt; } } } catch (SQLException e) { throw new RuntimeException(e); } return null; } }
EMR { public Patient getPatient(String patientId) { if(patientCache.containsKey(patientId)) { return patientCache.get(patientId); } PreparedStatementData psd = new PreparedStatementData(1); psd.setQueryStr(GET_PATIENT); psd.addParameter(0, PreparedStatementData.ParameterType.STRING, patientId); try { String[][] rs = DBUtil.doQuery(psd, dataSource); if (rs == null || rs.length == 0) { return null; } else { for (String[] r : rs) { Patient pt = new Patient(); pt.setPatientId(r[0]); pt.setFirstName(r[1]); pt.setLastName(r[2]); pt.setSsn(r[3]); pt.setDob(Date.valueOf(r[4])); pt.setSex(r[5]); pt.setRace(r[6]); pt.setReligion(r[7]); pt.setOccupation(r[8]); try { pt.setHouseNumber(Integer.parseInt(r[9])); } catch (NumberFormatException e) { e.printStackTrace(); } pt.setStreet(r[10]); pt.setCity(r[11]); pt.setState(r[12]); try { pt.setZip(Integer.parseInt(r[13])); } catch (NumberFormatException e) { e.printStackTrace(); } pt.setContactNumber(r[14]); patientCache.put(patientId, pt); return pt; } } } catch (SQLException e) { throw new RuntimeException(e); } return null; } EMR(); }
EMR { public Patient getPatient(String patientId) { if(patientCache.containsKey(patientId)) { return patientCache.get(patientId); } PreparedStatementData psd = new PreparedStatementData(1); psd.setQueryStr(GET_PATIENT); psd.addParameter(0, PreparedStatementData.ParameterType.STRING, patientId); try { String[][] rs = DBUtil.doQuery(psd, dataSource); if (rs == null || rs.length == 0) { return null; } else { for (String[] r : rs) { Patient pt = new Patient(); pt.setPatientId(r[0]); pt.setFirstName(r[1]); pt.setLastName(r[2]); pt.setSsn(r[3]); pt.setDob(Date.valueOf(r[4])); pt.setSex(r[5]); pt.setRace(r[6]); pt.setReligion(r[7]); pt.setOccupation(r[8]); try { pt.setHouseNumber(Integer.parseInt(r[9])); } catch (NumberFormatException e) { e.printStackTrace(); } pt.setStreet(r[10]); pt.setCity(r[11]); pt.setState(r[12]); try { pt.setZip(Integer.parseInt(r[13])); } catch (NumberFormatException e) { e.printStackTrace(); } pt.setContactNumber(r[14]); patientCache.put(patientId, pt); return pt; } } } catch (SQLException e) { throw new RuntimeException(e); } return null; } EMR(); List<Appointment> getPatientAppointments(String patientId); Patient getPatient(String patientId); Provider getProvider(String providerId); int storeAuditLog(AuditLogRecord auditLogRecord); }
EMR { public Patient getPatient(String patientId) { if(patientCache.containsKey(patientId)) { return patientCache.get(patientId); } PreparedStatementData psd = new PreparedStatementData(1); psd.setQueryStr(GET_PATIENT); psd.addParameter(0, PreparedStatementData.ParameterType.STRING, patientId); try { String[][] rs = DBUtil.doQuery(psd, dataSource); if (rs == null || rs.length == 0) { return null; } else { for (String[] r : rs) { Patient pt = new Patient(); pt.setPatientId(r[0]); pt.setFirstName(r[1]); pt.setLastName(r[2]); pt.setSsn(r[3]); pt.setDob(Date.valueOf(r[4])); pt.setSex(r[5]); pt.setRace(r[6]); pt.setReligion(r[7]); pt.setOccupation(r[8]); try { pt.setHouseNumber(Integer.parseInt(r[9])); } catch (NumberFormatException e) { e.printStackTrace(); } pt.setStreet(r[10]); pt.setCity(r[11]); pt.setState(r[12]); try { pt.setZip(Integer.parseInt(r[13])); } catch (NumberFormatException e) { e.printStackTrace(); } pt.setContactNumber(r[14]); patientCache.put(patientId, pt); return pt; } } } catch (SQLException e) { throw new RuntimeException(e); } return null; } EMR(); List<Appointment> getPatientAppointments(String patientId); Patient getPatient(String patientId); Provider getProvider(String providerId); int storeAuditLog(AuditLogRecord auditLogRecord);  }