@Test public void testNullAndEmptyLabList() { try { when(this.mockJMeadowsClient.getPatientLabResults(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 = jMeadowsLabService.fetchDodPatientLabs(query, patientIds); assertNotNull(vistaDataChunkList); assertThat(vistaDataChunkList.size(), is(0)); when(this.mockJMeadowsClient.getPatientLabResults(any(JMeadowsQuery.class))).thenReturn(new ArrayList<LabResult>()); assertNotNull(vistaDataChunkList); assertThat(vistaDataChunkList.size(), is(0)); } catch (JMeadowsException_Exception e) { fail(e.getMessage()); } }
public List<VistaDataChunk> fetchDodPatientLabs(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsLabService.fetchDodPatientLabs - Entering method..."); List<VistaDataChunk> oaLabChunk = new ArrayList<VistaDataChunk>(); List<LabResult> oaLabResults = jMeadowsClient.getPatientLabResults(query); LOG.debug("JMeadowsLabService.fetchDodPatientLabs: " + ((oaLabResults == null)? "NO" : ""+oaLabResults.size()) + " Labs retrieved from JMeadows."); if ((oaLabResults != null) && (oaLabResults.size() > 0)) { oaLabResults = (List<LabResult>) filterOnSourceProtocol(oaLabResults, SOURCE_PROTOCOL_DODADAPTER); int iNumLabs = calculateNumLabs(oaLabResults); int iCurLabIdx = 1; for(LabResult oLab : oaLabResults) { LOG.debug("JMeadowsLabService.fetchDodPatientLabs: Found DoD LabResult - Processing it... idx: " + iCurLabIdx); VistaDataChunk[] oLabChunk = transformLabChunk(oLab, patientIds, iNumLabs, iCurLabIdx); if (oLabChunk != null) { oaLabChunk.add(oLabChunk[0]); String accession = oLab.getAccession(); if (accession != null && !accession.toUpperCase().contains("^CH")) { oaLabChunk.add(oLabChunk[1]); } iCurLabIdx++; } } } return oaLabChunk; }
JMeadowsLabService implements IJMeadowsLabService { public List<VistaDataChunk> fetchDodPatientLabs(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsLabService.fetchDodPatientLabs - Entering method..."); List<VistaDataChunk> oaLabChunk = new ArrayList<VistaDataChunk>(); List<LabResult> oaLabResults = jMeadowsClient.getPatientLabResults(query); LOG.debug("JMeadowsLabService.fetchDodPatientLabs: " + ((oaLabResults == null)? "NO" : ""+oaLabResults.size()) + " Labs retrieved from JMeadows."); if ((oaLabResults != null) && (oaLabResults.size() > 0)) { oaLabResults = (List<LabResult>) filterOnSourceProtocol(oaLabResults, SOURCE_PROTOCOL_DODADAPTER); int iNumLabs = calculateNumLabs(oaLabResults); int iCurLabIdx = 1; for(LabResult oLab : oaLabResults) { LOG.debug("JMeadowsLabService.fetchDodPatientLabs: Found DoD LabResult - Processing it... idx: " + iCurLabIdx); VistaDataChunk[] oLabChunk = transformLabChunk(oLab, patientIds, iNumLabs, iCurLabIdx); if (oLabChunk != null) { oaLabChunk.add(oLabChunk[0]); String accession = oLab.getAccession(); if (accession != null && !accession.toUpperCase().contains("^CH")) { oaLabChunk.add(oLabChunk[1]); } iCurLabIdx++; } } } return oaLabChunk; } }
JMeadowsLabService implements IJMeadowsLabService { public List<VistaDataChunk> fetchDodPatientLabs(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsLabService.fetchDodPatientLabs - Entering method..."); List<VistaDataChunk> oaLabChunk = new ArrayList<VistaDataChunk>(); List<LabResult> oaLabResults = jMeadowsClient.getPatientLabResults(query); LOG.debug("JMeadowsLabService.fetchDodPatientLabs: " + ((oaLabResults == null)? "NO" : ""+oaLabResults.size()) + " Labs retrieved from JMeadows."); if ((oaLabResults != null) && (oaLabResults.size() > 0)) { oaLabResults = (List<LabResult>) filterOnSourceProtocol(oaLabResults, SOURCE_PROTOCOL_DODADAPTER); int iNumLabs = calculateNumLabs(oaLabResults); int iCurLabIdx = 1; for(LabResult oLab : oaLabResults) { LOG.debug("JMeadowsLabService.fetchDodPatientLabs: Found DoD LabResult - Processing it... idx: " + iCurLabIdx); VistaDataChunk[] oLabChunk = transformLabChunk(oLab, patientIds, iNumLabs, iCurLabIdx); if (oLabChunk != null) { oaLabChunk.add(oLabChunk[0]); String accession = oLab.getAccession(); if (accession != null && !accession.toUpperCase().contains("^CH")) { oaLabChunk.add(oLabChunk[1]); } iCurLabIdx++; } } } return oaLabChunk; } @Autowired  JMeadowsLabService(JMeadowsConfiguration jMeadowsConfiguration); }
JMeadowsLabService implements IJMeadowsLabService { public List<VistaDataChunk> fetchDodPatientLabs(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsLabService.fetchDodPatientLabs - Entering method..."); List<VistaDataChunk> oaLabChunk = new ArrayList<VistaDataChunk>(); List<LabResult> oaLabResults = jMeadowsClient.getPatientLabResults(query); LOG.debug("JMeadowsLabService.fetchDodPatientLabs: " + ((oaLabResults == null)? "NO" : ""+oaLabResults.size()) + " Labs retrieved from JMeadows."); if ((oaLabResults != null) && (oaLabResults.size() > 0)) { oaLabResults = (List<LabResult>) filterOnSourceProtocol(oaLabResults, SOURCE_PROTOCOL_DODADAPTER); int iNumLabs = calculateNumLabs(oaLabResults); int iCurLabIdx = 1; for(LabResult oLab : oaLabResults) { LOG.debug("JMeadowsLabService.fetchDodPatientLabs: Found DoD LabResult - Processing it... idx: " + iCurLabIdx); VistaDataChunk[] oLabChunk = transformLabChunk(oLab, patientIds, iNumLabs, iCurLabIdx); if (oLabChunk != null) { oaLabChunk.add(oLabChunk[0]); String accession = oLab.getAccession(); if (accession != null && !accession.toUpperCase().contains("^CH")) { oaLabChunk.add(oLabChunk[1]); } iCurLabIdx++; } } } return oaLabChunk; } @Autowired  JMeadowsLabService(JMeadowsConfiguration jMeadowsConfiguration); void setJMeadowsClient(JMeadowsData jMeadowsClient); List<VistaDataChunk> fetchDodPatientLabs(JMeadowsQuery query, PatientIds patientIds); }
JMeadowsLabService implements IJMeadowsLabService { public List<VistaDataChunk> fetchDodPatientLabs(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsLabService.fetchDodPatientLabs - Entering method..."); List<VistaDataChunk> oaLabChunk = new ArrayList<VistaDataChunk>(); List<LabResult> oaLabResults = jMeadowsClient.getPatientLabResults(query); LOG.debug("JMeadowsLabService.fetchDodPatientLabs: " + ((oaLabResults == null)? "NO" : ""+oaLabResults.size()) + " Labs retrieved from JMeadows."); if ((oaLabResults != null) && (oaLabResults.size() > 0)) { oaLabResults = (List<LabResult>) filterOnSourceProtocol(oaLabResults, SOURCE_PROTOCOL_DODADAPTER); int iNumLabs = calculateNumLabs(oaLabResults); int iCurLabIdx = 1; for(LabResult oLab : oaLabResults) { LOG.debug("JMeadowsLabService.fetchDodPatientLabs: Found DoD LabResult - Processing it... idx: " + iCurLabIdx); VistaDataChunk[] oLabChunk = transformLabChunk(oLab, patientIds, iNumLabs, iCurLabIdx); if (oLabChunk != null) { oaLabChunk.add(oLabChunk[0]); String accession = oLab.getAccession(); if (accession != null && !accession.toUpperCase().contains("^CH")) { oaLabChunk.add(oLabChunk[1]); } iCurLabIdx++; } } } return oaLabChunk; } @Autowired  JMeadowsLabService(JMeadowsConfiguration jMeadowsConfiguration); void setJMeadowsClient(JMeadowsData jMeadowsClient); List<VistaDataChunk> fetchDodPatientLabs(JMeadowsQuery query, PatientIds patientIds); static final String DOMAIN_LAB; static final String DOMAIN_DOCUMENT; }