@Test public void getPatientAppointments() { List<Appointment> appointmentList = emr.getPatientAppointments("3"); Assert.assertTrue(appointmentList.size() > 0 ); System.out.println(appointmentList.get(0).getPatientId()); System.out.println(appointmentList.get(0).getProvider()); System.out.println(appointmentList.get(0).getAccessTime()); }
public List<Appointment> getPatientAppointments(String patientId) { if(patientAppointments.containsKey(patientId)) { return patientAppointments.get(patientId); } List<Appointment> retVal = new ArrayList<>(); PreparedStatementData psd = new PreparedStatementData(1); psd.setQueryStr(GET_PATIENT_APPOINTMENTS); psd.addParameter(0, PreparedStatementData.ParameterType.STRING, patientId); try { String[][] rs = DBUtil.doQuery(psd, dataSource); if (rs == null || rs.length == 0) { return retVal; } else { for (String[] r : rs) { Appointment apt = new Appointment(); apt.setPatientId(r[0]); apt.setAccessTime(Timestamp.valueOf(r[1])); apt.setLocation(r[2]); apt.setProvider(r[3]); retVal.add(apt); } patientAppointments.put(patientId, retVal); return retVal; } } catch (SQLException e) { throw new RuntimeException(e); } }
EMR { public List<Appointment> getPatientAppointments(String patientId) { if(patientAppointments.containsKey(patientId)) { return patientAppointments.get(patientId); } List<Appointment> retVal = new ArrayList<>(); PreparedStatementData psd = new PreparedStatementData(1); psd.setQueryStr(GET_PATIENT_APPOINTMENTS); psd.addParameter(0, PreparedStatementData.ParameterType.STRING, patientId); try { String[][] rs = DBUtil.doQuery(psd, dataSource); if (rs == null || rs.length == 0) { return retVal; } else { for (String[] r : rs) { Appointment apt = new Appointment(); apt.setPatientId(r[0]); apt.setAccessTime(Timestamp.valueOf(r[1])); apt.setLocation(r[2]); apt.setProvider(r[3]); retVal.add(apt); } patientAppointments.put(patientId, retVal); return retVal; } } catch (SQLException e) { throw new RuntimeException(e); } } }
EMR { public List<Appointment> getPatientAppointments(String patientId) { if(patientAppointments.containsKey(patientId)) { return patientAppointments.get(patientId); } List<Appointment> retVal = new ArrayList<>(); PreparedStatementData psd = new PreparedStatementData(1); psd.setQueryStr(GET_PATIENT_APPOINTMENTS); psd.addParameter(0, PreparedStatementData.ParameterType.STRING, patientId); try { String[][] rs = DBUtil.doQuery(psd, dataSource); if (rs == null || rs.length == 0) { return retVal; } else { for (String[] r : rs) { Appointment apt = new Appointment(); apt.setPatientId(r[0]); apt.setAccessTime(Timestamp.valueOf(r[1])); apt.setLocation(r[2]); apt.setProvider(r[3]); retVal.add(apt); } patientAppointments.put(patientId, retVal); return retVal; } } catch (SQLException e) { throw new RuntimeException(e); } } EMR(); }
EMR { public List<Appointment> getPatientAppointments(String patientId) { if(patientAppointments.containsKey(patientId)) { return patientAppointments.get(patientId); } List<Appointment> retVal = new ArrayList<>(); PreparedStatementData psd = new PreparedStatementData(1); psd.setQueryStr(GET_PATIENT_APPOINTMENTS); psd.addParameter(0, PreparedStatementData.ParameterType.STRING, patientId); try { String[][] rs = DBUtil.doQuery(psd, dataSource); if (rs == null || rs.length == 0) { return retVal; } else { for (String[] r : rs) { Appointment apt = new Appointment(); apt.setPatientId(r[0]); apt.setAccessTime(Timestamp.valueOf(r[1])); apt.setLocation(r[2]); apt.setProvider(r[3]); retVal.add(apt); } patientAppointments.put(patientId, retVal); return retVal; } } catch (SQLException e) { throw new RuntimeException(e); } } EMR(); List<Appointment> getPatientAppointments(String patientId); Patient getPatient(String patientId); Provider getProvider(String providerId); int storeAuditLog(AuditLogRecord auditLogRecord); }
EMR { public List<Appointment> getPatientAppointments(String patientId) { if(patientAppointments.containsKey(patientId)) { return patientAppointments.get(patientId); } List<Appointment> retVal = new ArrayList<>(); PreparedStatementData psd = new PreparedStatementData(1); psd.setQueryStr(GET_PATIENT_APPOINTMENTS); psd.addParameter(0, PreparedStatementData.ParameterType.STRING, patientId); try { String[][] rs = DBUtil.doQuery(psd, dataSource); if (rs == null || rs.length == 0) { return retVal; } else { for (String[] r : rs) { Appointment apt = new Appointment(); apt.setPatientId(r[0]); apt.setAccessTime(Timestamp.valueOf(r[1])); apt.setLocation(r[2]); apt.setProvider(r[3]); retVal.add(apt); } patientAppointments.put(patientId, retVal); return retVal; } } catch (SQLException e) { throw new RuntimeException(e); } } EMR(); List<Appointment> getPatientAppointments(String patientId); Patient getPatient(String patientId); Provider getProvider(String providerId); int storeAuditLog(AuditLogRecord auditLogRecord);  }