@Test public void testNullAndEmptyMedicationList() { try { when(this.mockJMeadowsClient.getPatientMedications(any(JMeadowsQuery.class))).thenReturn(null); JMeadowsQuery query = new JMeadowsQueryBuilder() .user(user) .patient(patient) .build(); PatientIds patientIds = new PatientIds.Builder() .pid(pid) .icn(icn) .uid(uid) .edipi(edipi) .build(); List<VistaDataChunk> vistaDataChunkList = jMeadowsMedicationService.fetchDodPatientOutpatientMedications(query, patientIds); assertNotNull(vistaDataChunkList); assertThat(vistaDataChunkList.size(), is(0)); when(this.mockJMeadowsClient.getPatientMedications(any(JMeadowsQuery.class))).thenReturn(new ArrayList<Medication>()); assertNotNull(vistaDataChunkList); assertThat(vistaDataChunkList.size(), is(0)); } catch (JMeadowsException_Exception e) { fail(e.getMessage()); } }
@Override public List<VistaDataChunk> fetchDodPatientOutpatientMedications(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsMedicationService.fetchDodPatientOutpatientMedications - Entering method..."); query.setStatus("O"); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaMedChunk = new ArrayList<VistaDataChunk>(); List<Medication> oaMedication = jMeadowsClient.getPatientMedications(query); LOG.debug("JMeadowsMedicationService.fetchDodOutpatientMedications: " + ((oaMedication == null)? "NO" : ""+oaMedication.size()) + " results retrieved from JMeadows."); if ((oaMedication != null) && (oaMedication.size() > 0)) { oaMedication = (List<Medication>) filterOnSourceProtocol(oaMedication, SOURCE_PROTOCOL_DODADAPTER); int iNumMeds = calculateNumMeds(oaMedication); int iCurMedIdx = 1; for (Medication oMed : oaMedication) { LOG.debug("JMeadowsMedicationService.fetchDodPatientOutpatientMedications: Found DoD Medication - Processing it... idx: " + iCurMedIdx); VistaDataChunk oMedChunk = transformMedicationChunk(oMed, patientIds, iNumMeds, iCurMedIdx); if (oMedChunk != null) { oaMedChunk.add(oMedChunk); iCurMedIdx++; } } } return oaMedChunk; }
JMeadowsMedicationService implements IJMeadowsMedicationService { @Override public List<VistaDataChunk> fetchDodPatientOutpatientMedications(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsMedicationService.fetchDodPatientOutpatientMedications - Entering method..."); query.setStatus("O"); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaMedChunk = new ArrayList<VistaDataChunk>(); List<Medication> oaMedication = jMeadowsClient.getPatientMedications(query); LOG.debug("JMeadowsMedicationService.fetchDodOutpatientMedications: " + ((oaMedication == null)? "NO" : ""+oaMedication.size()) + " results retrieved from JMeadows."); if ((oaMedication != null) && (oaMedication.size() > 0)) { oaMedication = (List<Medication>) filterOnSourceProtocol(oaMedication, SOURCE_PROTOCOL_DODADAPTER); int iNumMeds = calculateNumMeds(oaMedication); int iCurMedIdx = 1; for (Medication oMed : oaMedication) { LOG.debug("JMeadowsMedicationService.fetchDodPatientOutpatientMedications: Found DoD Medication - Processing it... idx: " + iCurMedIdx); VistaDataChunk oMedChunk = transformMedicationChunk(oMed, patientIds, iNumMeds, iCurMedIdx); if (oMedChunk != null) { oaMedChunk.add(oMedChunk); iCurMedIdx++; } } } return oaMedChunk; } }
JMeadowsMedicationService implements IJMeadowsMedicationService { @Override public List<VistaDataChunk> fetchDodPatientOutpatientMedications(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsMedicationService.fetchDodPatientOutpatientMedications - Entering method..."); query.setStatus("O"); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaMedChunk = new ArrayList<VistaDataChunk>(); List<Medication> oaMedication = jMeadowsClient.getPatientMedications(query); LOG.debug("JMeadowsMedicationService.fetchDodOutpatientMedications: " + ((oaMedication == null)? "NO" : ""+oaMedication.size()) + " results retrieved from JMeadows."); if ((oaMedication != null) && (oaMedication.size() > 0)) { oaMedication = (List<Medication>) filterOnSourceProtocol(oaMedication, SOURCE_PROTOCOL_DODADAPTER); int iNumMeds = calculateNumMeds(oaMedication); int iCurMedIdx = 1; for (Medication oMed : oaMedication) { LOG.debug("JMeadowsMedicationService.fetchDodPatientOutpatientMedications: Found DoD Medication - Processing it... idx: " + iCurMedIdx); VistaDataChunk oMedChunk = transformMedicationChunk(oMed, patientIds, iNumMeds, iCurMedIdx); if (oMedChunk != null) { oaMedChunk.add(oMedChunk); iCurMedIdx++; } } } return oaMedChunk; } @Autowired  JMeadowsMedicationService(JMeadowsConfiguration jMeadowsConfiguration); }
JMeadowsMedicationService implements IJMeadowsMedicationService { @Override public List<VistaDataChunk> fetchDodPatientOutpatientMedications(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsMedicationService.fetchDodPatientOutpatientMedications - Entering method..."); query.setStatus("O"); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaMedChunk = new ArrayList<VistaDataChunk>(); List<Medication> oaMedication = jMeadowsClient.getPatientMedications(query); LOG.debug("JMeadowsMedicationService.fetchDodOutpatientMedications: " + ((oaMedication == null)? "NO" : ""+oaMedication.size()) + " results retrieved from JMeadows."); if ((oaMedication != null) && (oaMedication.size() > 0)) { oaMedication = (List<Medication>) filterOnSourceProtocol(oaMedication, SOURCE_PROTOCOL_DODADAPTER); int iNumMeds = calculateNumMeds(oaMedication); int iCurMedIdx = 1; for (Medication oMed : oaMedication) { LOG.debug("JMeadowsMedicationService.fetchDodPatientOutpatientMedications: Found DoD Medication - Processing it... idx: " + iCurMedIdx); VistaDataChunk oMedChunk = transformMedicationChunk(oMed, patientIds, iNumMeds, iCurMedIdx); if (oMedChunk != null) { oaMedChunk.add(oMedChunk); iCurMedIdx++; } } } return oaMedChunk; } @Autowired  JMeadowsMedicationService(JMeadowsConfiguration jMeadowsConfiguration); void setJMeadowsClient(JMeadowsData jMeadowsClient); @Override List<VistaDataChunk> fetchDodPatientOutpatientMedications(JMeadowsQuery query, PatientIds patientIds); @Override List<VistaDataChunk> fetchDodPatientInpatientMedications(JMeadowsQuery query, PatientIds patientIds); }
JMeadowsMedicationService implements IJMeadowsMedicationService { @Override public List<VistaDataChunk> fetchDodPatientOutpatientMedications(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsMedicationService.fetchDodPatientOutpatientMedications - Entering method..."); query.setStatus("O"); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaMedChunk = new ArrayList<VistaDataChunk>(); List<Medication> oaMedication = jMeadowsClient.getPatientMedications(query); LOG.debug("JMeadowsMedicationService.fetchDodOutpatientMedications: " + ((oaMedication == null)? "NO" : ""+oaMedication.size()) + " results retrieved from JMeadows."); if ((oaMedication != null) && (oaMedication.size() > 0)) { oaMedication = (List<Medication>) filterOnSourceProtocol(oaMedication, SOURCE_PROTOCOL_DODADAPTER); int iNumMeds = calculateNumMeds(oaMedication); int iCurMedIdx = 1; for (Medication oMed : oaMedication) { LOG.debug("JMeadowsMedicationService.fetchDodPatientOutpatientMedications: Found DoD Medication - Processing it... idx: " + iCurMedIdx); VistaDataChunk oMedChunk = transformMedicationChunk(oMed, patientIds, iNumMeds, iCurMedIdx); if (oMedChunk != null) { oaMedChunk.add(oMedChunk); iCurMedIdx++; } } } return oaMedChunk; } @Autowired  JMeadowsMedicationService(JMeadowsConfiguration jMeadowsConfiguration); void setJMeadowsClient(JMeadowsData jMeadowsClient); @Override List<VistaDataChunk> fetchDodPatientOutpatientMedications(JMeadowsQuery query, PatientIds patientIds); @Override List<VistaDataChunk> fetchDodPatientInpatientMedications(JMeadowsQuery query, PatientIds patientIds); static final String DOMAIN_MEDICATION; }