@Test public void testNullAndEmptyPatientEncounterList() { try { when(this.mockJMeadowsClient.getPatientEncounters(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 = jMeadowsEncounterService.fetchDodPatientEncounters(query, patientIds); assertNotNull(vistaDataChunkList); assertThat(vistaDataChunkList.size(), is(0)); when(this.mockJMeadowsClient.getPatientEncounters(any(JMeadowsQuery.class))).thenReturn(new ArrayList<PatientEncounter>()); assertNotNull(vistaDataChunkList); assertThat(vistaDataChunkList.size(), is(0)); } catch (JMeadowsException_Exception e) { fail(e.getMessage()); } }
@Override public List<VistaDataChunk> fetchDodPatientEncounters(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsEncounterService.fetchDodPatientEncounters - Entering method..."); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaEncounterChunk = new ArrayList<VistaDataChunk>(); List<PatientEncounter> oaPatientEncounter = jMeadowsClient.getPatientEncounters(query); LOG.debug("JMeadowsEncounterService.fetchDodPatientEncounters: " + ((oaPatientEncounter == null) ? "NO" : "" + oaPatientEncounter.size()) + " results retrieved from JMeadows."); if ((oaPatientEncounter != null) && (oaPatientEncounter.size() > 0)) { oaPatientEncounter = (List<PatientEncounter>) filterOnSourceProtocol(oaPatientEncounter, SOURCE_PROTOCOL_DODADAPTER); int iNumEncounters = calculateNumEncounters(oaPatientEncounter); int iCurEncounterIdx = 1; for (PatientEncounter oPatientEncounter : oaPatientEncounter) { LOG.debug("JMeadowsEncounterService.fetchDodPatientEncounters: Found DoD Encounter - Processing it... idx: " + iCurEncounterIdx); VistaDataChunk oEncounterChunk = transformPatientEncounterChunk(oPatientEncounter, patientIds, iNumEncounters, iCurEncounterIdx); if (oEncounterChunk != null) { oaEncounterChunk.add(oEncounterChunk); iCurEncounterIdx++; } } } return oaEncounterChunk; }
JMeadowsEncounterService implements IJMeadowsEncounterService { @Override public List<VistaDataChunk> fetchDodPatientEncounters(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsEncounterService.fetchDodPatientEncounters - Entering method..."); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaEncounterChunk = new ArrayList<VistaDataChunk>(); List<PatientEncounter> oaPatientEncounter = jMeadowsClient.getPatientEncounters(query); LOG.debug("JMeadowsEncounterService.fetchDodPatientEncounters: " + ((oaPatientEncounter == null) ? "NO" : "" + oaPatientEncounter.size()) + " results retrieved from JMeadows."); if ((oaPatientEncounter != null) && (oaPatientEncounter.size() > 0)) { oaPatientEncounter = (List<PatientEncounter>) filterOnSourceProtocol(oaPatientEncounter, SOURCE_PROTOCOL_DODADAPTER); int iNumEncounters = calculateNumEncounters(oaPatientEncounter); int iCurEncounterIdx = 1; for (PatientEncounter oPatientEncounter : oaPatientEncounter) { LOG.debug("JMeadowsEncounterService.fetchDodPatientEncounters: Found DoD Encounter - Processing it... idx: " + iCurEncounterIdx); VistaDataChunk oEncounterChunk = transformPatientEncounterChunk(oPatientEncounter, patientIds, iNumEncounters, iCurEncounterIdx); if (oEncounterChunk != null) { oaEncounterChunk.add(oEncounterChunk); iCurEncounterIdx++; } } } return oaEncounterChunk; } }
JMeadowsEncounterService implements IJMeadowsEncounterService { @Override public List<VistaDataChunk> fetchDodPatientEncounters(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsEncounterService.fetchDodPatientEncounters - Entering method..."); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaEncounterChunk = new ArrayList<VistaDataChunk>(); List<PatientEncounter> oaPatientEncounter = jMeadowsClient.getPatientEncounters(query); LOG.debug("JMeadowsEncounterService.fetchDodPatientEncounters: " + ((oaPatientEncounter == null) ? "NO" : "" + oaPatientEncounter.size()) + " results retrieved from JMeadows."); if ((oaPatientEncounter != null) && (oaPatientEncounter.size() > 0)) { oaPatientEncounter = (List<PatientEncounter>) filterOnSourceProtocol(oaPatientEncounter, SOURCE_PROTOCOL_DODADAPTER); int iNumEncounters = calculateNumEncounters(oaPatientEncounter); int iCurEncounterIdx = 1; for (PatientEncounter oPatientEncounter : oaPatientEncounter) { LOG.debug("JMeadowsEncounterService.fetchDodPatientEncounters: Found DoD Encounter - Processing it... idx: " + iCurEncounterIdx); VistaDataChunk oEncounterChunk = transformPatientEncounterChunk(oPatientEncounter, patientIds, iNumEncounters, iCurEncounterIdx); if (oEncounterChunk != null) { oaEncounterChunk.add(oEncounterChunk); iCurEncounterIdx++; } } } return oaEncounterChunk; } @Autowired  JMeadowsEncounterService(JMeadowsConfiguration jMeadowsConfiguration); }
JMeadowsEncounterService implements IJMeadowsEncounterService { @Override public List<VistaDataChunk> fetchDodPatientEncounters(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsEncounterService.fetchDodPatientEncounters - Entering method..."); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaEncounterChunk = new ArrayList<VistaDataChunk>(); List<PatientEncounter> oaPatientEncounter = jMeadowsClient.getPatientEncounters(query); LOG.debug("JMeadowsEncounterService.fetchDodPatientEncounters: " + ((oaPatientEncounter == null) ? "NO" : "" + oaPatientEncounter.size()) + " results retrieved from JMeadows."); if ((oaPatientEncounter != null) && (oaPatientEncounter.size() > 0)) { oaPatientEncounter = (List<PatientEncounter>) filterOnSourceProtocol(oaPatientEncounter, SOURCE_PROTOCOL_DODADAPTER); int iNumEncounters = calculateNumEncounters(oaPatientEncounter); int iCurEncounterIdx = 1; for (PatientEncounter oPatientEncounter : oaPatientEncounter) { LOG.debug("JMeadowsEncounterService.fetchDodPatientEncounters: Found DoD Encounter - Processing it... idx: " + iCurEncounterIdx); VistaDataChunk oEncounterChunk = transformPatientEncounterChunk(oPatientEncounter, patientIds, iNumEncounters, iCurEncounterIdx); if (oEncounterChunk != null) { oaEncounterChunk.add(oEncounterChunk); iCurEncounterIdx++; } } } return oaEncounterChunk; } @Autowired  JMeadowsEncounterService(JMeadowsConfiguration jMeadowsConfiguration); void setJMeadowsClient(JMeadowsData jMeadowsClient); @Override List<VistaDataChunk> fetchDodPatientEncounters(JMeadowsQuery query,
			PatientIds patientIds); }
JMeadowsEncounterService implements IJMeadowsEncounterService { @Override public List<VistaDataChunk> fetchDodPatientEncounters(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsEncounterService.fetchDodPatientEncounters - Entering method..."); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaEncounterChunk = new ArrayList<VistaDataChunk>(); List<PatientEncounter> oaPatientEncounter = jMeadowsClient.getPatientEncounters(query); LOG.debug("JMeadowsEncounterService.fetchDodPatientEncounters: " + ((oaPatientEncounter == null) ? "NO" : "" + oaPatientEncounter.size()) + " results retrieved from JMeadows."); if ((oaPatientEncounter != null) && (oaPatientEncounter.size() > 0)) { oaPatientEncounter = (List<PatientEncounter>) filterOnSourceProtocol(oaPatientEncounter, SOURCE_PROTOCOL_DODADAPTER); int iNumEncounters = calculateNumEncounters(oaPatientEncounter); int iCurEncounterIdx = 1; for (PatientEncounter oPatientEncounter : oaPatientEncounter) { LOG.debug("JMeadowsEncounterService.fetchDodPatientEncounters: Found DoD Encounter - Processing it... idx: " + iCurEncounterIdx); VistaDataChunk oEncounterChunk = transformPatientEncounterChunk(oPatientEncounter, patientIds, iNumEncounters, iCurEncounterIdx); if (oEncounterChunk != null) { oaEncounterChunk.add(oEncounterChunk); iCurEncounterIdx++; } } } return oaEncounterChunk; } @Autowired  JMeadowsEncounterService(JMeadowsConfiguration jMeadowsConfiguration); void setJMeadowsClient(JMeadowsData jMeadowsClient); @Override List<VistaDataChunk> fetchDodPatientEncounters(JMeadowsQuery query,
			PatientIds patientIds); static final String DOMAIN_ENCOUNTER_VISIST; }