@Test public void testNullAndEmptyLabList() { try { when(this.mockJMeadowsClient.getPatientDemographics(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 = jMeadowsDemographicsService.fetchDodPatientDemographics(query, patientIds); assertNotNull(vistaDataChunkList); assertThat(vistaDataChunkList.size(), is(0)); when(this.mockJMeadowsClient.getPatientDemographics(any(JMeadowsQuery.class))).thenReturn(new ArrayList<PatientDemographics>()); assertNotNull(vistaDataChunkList); assertThat(vistaDataChunkList.size(), is(0)); } catch (JMeadowsException_Exception e) { fail(e.getMessage()); } }
public List<VistaDataChunk> fetchDodPatientDemographics(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsDemographicsService.fetchDodPatientDemographics - Entering method..."); List<VistaDataChunk> oaDemographicsChunk = new ArrayList<VistaDataChunk>(); List<PatientDemographics> oaDemographicsResults = jMeadowsClient.getPatientDemographics(query); LOG.debug("JMeadowsDemographicsService.fetchPatientDemographicsResults: " + ((oaDemographicsResults == null)? "NO" : ""+oaDemographicsResults.size()) + " Patients retrieved from JMeadows."); if ((oaDemographicsResults != null) && (oaDemographicsResults.size() > 0)) { int iNumLabs = calculateNumDemographics(oaDemographicsResults); int iCurDemIdx = 1; for(PatientDemographics oDemographics : oaDemographicsResults) { if(oDemographics.getSite() != null) { Site s = oDemographics.getSite(); if(!s.getMoniker().equals(DOD_STATUS_REPORT_FLAG)) { LOG.debug("JMeadowsDemographicsService.fetchPatientDemographics: Found DoD Demographics - Processing it... idx: " + iCurDemIdx); VistaDataChunk oDemographicsChunk = transformDemographicsChunk(oDemographics, patientIds, iNumLabs, iCurDemIdx); if (oDemographicsChunk != null) { oaDemographicsChunk.add(oDemographicsChunk); iCurDemIdx++; } } } } } return oaDemographicsChunk; }
JMeadowsDemographicsService implements IJMeadowsDemographicsService { public List<VistaDataChunk> fetchDodPatientDemographics(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsDemographicsService.fetchDodPatientDemographics - Entering method..."); List<VistaDataChunk> oaDemographicsChunk = new ArrayList<VistaDataChunk>(); List<PatientDemographics> oaDemographicsResults = jMeadowsClient.getPatientDemographics(query); LOG.debug("JMeadowsDemographicsService.fetchPatientDemographicsResults: " + ((oaDemographicsResults == null)? "NO" : ""+oaDemographicsResults.size()) + " Patients retrieved from JMeadows."); if ((oaDemographicsResults != null) && (oaDemographicsResults.size() > 0)) { int iNumLabs = calculateNumDemographics(oaDemographicsResults); int iCurDemIdx = 1; for(PatientDemographics oDemographics : oaDemographicsResults) { if(oDemographics.getSite() != null) { Site s = oDemographics.getSite(); if(!s.getMoniker().equals(DOD_STATUS_REPORT_FLAG)) { LOG.debug("JMeadowsDemographicsService.fetchPatientDemographics: Found DoD Demographics - Processing it... idx: " + iCurDemIdx); VistaDataChunk oDemographicsChunk = transformDemographicsChunk(oDemographics, patientIds, iNumLabs, iCurDemIdx); if (oDemographicsChunk != null) { oaDemographicsChunk.add(oDemographicsChunk); iCurDemIdx++; } } } } } return oaDemographicsChunk; } }
JMeadowsDemographicsService implements IJMeadowsDemographicsService { public List<VistaDataChunk> fetchDodPatientDemographics(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsDemographicsService.fetchDodPatientDemographics - Entering method..."); List<VistaDataChunk> oaDemographicsChunk = new ArrayList<VistaDataChunk>(); List<PatientDemographics> oaDemographicsResults = jMeadowsClient.getPatientDemographics(query); LOG.debug("JMeadowsDemographicsService.fetchPatientDemographicsResults: " + ((oaDemographicsResults == null)? "NO" : ""+oaDemographicsResults.size()) + " Patients retrieved from JMeadows."); if ((oaDemographicsResults != null) && (oaDemographicsResults.size() > 0)) { int iNumLabs = calculateNumDemographics(oaDemographicsResults); int iCurDemIdx = 1; for(PatientDemographics oDemographics : oaDemographicsResults) { if(oDemographics.getSite() != null) { Site s = oDemographics.getSite(); if(!s.getMoniker().equals(DOD_STATUS_REPORT_FLAG)) { LOG.debug("JMeadowsDemographicsService.fetchPatientDemographics: Found DoD Demographics - Processing it... idx: " + iCurDemIdx); VistaDataChunk oDemographicsChunk = transformDemographicsChunk(oDemographics, patientIds, iNumLabs, iCurDemIdx); if (oDemographicsChunk != null) { oaDemographicsChunk.add(oDemographicsChunk); iCurDemIdx++; } } } } } return oaDemographicsChunk; } @Autowired  JMeadowsDemographicsService(JMeadowsConfiguration jMeadowsConfiguration); }
JMeadowsDemographicsService implements IJMeadowsDemographicsService { public List<VistaDataChunk> fetchDodPatientDemographics(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsDemographicsService.fetchDodPatientDemographics - Entering method..."); List<VistaDataChunk> oaDemographicsChunk = new ArrayList<VistaDataChunk>(); List<PatientDemographics> oaDemographicsResults = jMeadowsClient.getPatientDemographics(query); LOG.debug("JMeadowsDemographicsService.fetchPatientDemographicsResults: " + ((oaDemographicsResults == null)? "NO" : ""+oaDemographicsResults.size()) + " Patients retrieved from JMeadows."); if ((oaDemographicsResults != null) && (oaDemographicsResults.size() > 0)) { int iNumLabs = calculateNumDemographics(oaDemographicsResults); int iCurDemIdx = 1; for(PatientDemographics oDemographics : oaDemographicsResults) { if(oDemographics.getSite() != null) { Site s = oDemographics.getSite(); if(!s.getMoniker().equals(DOD_STATUS_REPORT_FLAG)) { LOG.debug("JMeadowsDemographicsService.fetchPatientDemographics: Found DoD Demographics - Processing it... idx: " + iCurDemIdx); VistaDataChunk oDemographicsChunk = transformDemographicsChunk(oDemographics, patientIds, iNumLabs, iCurDemIdx); if (oDemographicsChunk != null) { oaDemographicsChunk.add(oDemographicsChunk); iCurDemIdx++; } } } } } return oaDemographicsChunk; } @Autowired  JMeadowsDemographicsService(JMeadowsConfiguration jMeadowsConfiguration); void setJMeadowsClient(JMeadowsData jMeadowsClient); List<VistaDataChunk> fetchDodPatientDemographics(JMeadowsQuery query, PatientIds patientIds); }
JMeadowsDemographicsService implements IJMeadowsDemographicsService { public List<VistaDataChunk> fetchDodPatientDemographics(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsDemographicsService.fetchDodPatientDemographics - Entering method..."); List<VistaDataChunk> oaDemographicsChunk = new ArrayList<VistaDataChunk>(); List<PatientDemographics> oaDemographicsResults = jMeadowsClient.getPatientDemographics(query); LOG.debug("JMeadowsDemographicsService.fetchPatientDemographicsResults: " + ((oaDemographicsResults == null)? "NO" : ""+oaDemographicsResults.size()) + " Patients retrieved from JMeadows."); if ((oaDemographicsResults != null) && (oaDemographicsResults.size() > 0)) { int iNumLabs = calculateNumDemographics(oaDemographicsResults); int iCurDemIdx = 1; for(PatientDemographics oDemographics : oaDemographicsResults) { if(oDemographics.getSite() != null) { Site s = oDemographics.getSite(); if(!s.getMoniker().equals(DOD_STATUS_REPORT_FLAG)) { LOG.debug("JMeadowsDemographicsService.fetchPatientDemographics: Found DoD Demographics - Processing it... idx: " + iCurDemIdx); VistaDataChunk oDemographicsChunk = transformDemographicsChunk(oDemographics, patientIds, iNumLabs, iCurDemIdx); if (oDemographicsChunk != null) { oaDemographicsChunk.add(oDemographicsChunk); iCurDemIdx++; } } } } } return oaDemographicsChunk; } @Autowired  JMeadowsDemographicsService(JMeadowsConfiguration jMeadowsConfiguration); void setJMeadowsClient(JMeadowsData jMeadowsClient); List<VistaDataChunk> fetchDodPatientDemographics(JMeadowsQuery query, PatientIds patientIds); static final String DOMAIN_DEMOGRAPHICS; }