@Test public void testNullAndEmptyVitalList() { try { when(this.mockJMeadowsClient.getPatientVitals(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 = jMeadowsVitalService.fetchDodPatientVitals(query, patientIds); assertNotNull(vistaDataChunkList); assertThat(vistaDataChunkList.size(), is(0)); when(this.mockJMeadowsClient.getPatientVitals(any(JMeadowsQuery.class))).thenReturn(new ArrayList<Vitals>()); assertNotNull(vistaDataChunkList); assertThat(vistaDataChunkList.size(), is(0)); } catch (JMeadowsException_Exception e) { fail(e.getMessage()); } }
@Override public List<VistaDataChunk> fetchDodPatientVitals(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsVitalService.fetchDodPatientVitals - Entering method..."); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaVitalChunk = new ArrayList<VistaDataChunk>(); List<Vitals> oaVital = jMeadowsClient.getPatientVitals(query); LOG.debug("JMeadowsVitalService.fetchDodPatientVitals: " + ((oaVital == null)? "NO" : ""+oaVital.size()) + " results retrieved from JMeadows."); if ((oaVital != null) && (oaVital.size() > 0)) { oaVital = (List<Vitals>) filterOnSourceProtocol(oaVital, SOURCE_PROTOCOL_DODADAPTER); int iNumVitals = calculateNumVitals(oaVital); int iCurVitalIdx = 1; for (Vitals oVital : oaVital) { LOG.debug("JMeadowsVitalService.fetchDodPatientVitals: Found DoD Vital - Processing it... idx: " + iCurVitalIdx); if (StringUtils.isBlank(oVital.getVitalType()) || StringUtils.isBlank(oVital.getRate())) { LOG.debug("skip not enough vital chunk data"); }else { VistaDataChunk oVitalChunk = transformVitalChunk(oVital, patientIds, iNumVitals, iCurVitalIdx); if (oVitalChunk != null) { oaVitalChunk.add(oVitalChunk); iCurVitalIdx++; } } } } return oaVitalChunk; }
JMeadowsVitalService implements IJMeadowsVitalService { @Override public List<VistaDataChunk> fetchDodPatientVitals(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsVitalService.fetchDodPatientVitals - Entering method..."); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaVitalChunk = new ArrayList<VistaDataChunk>(); List<Vitals> oaVital = jMeadowsClient.getPatientVitals(query); LOG.debug("JMeadowsVitalService.fetchDodPatientVitals: " + ((oaVital == null)? "NO" : ""+oaVital.size()) + " results retrieved from JMeadows."); if ((oaVital != null) && (oaVital.size() > 0)) { oaVital = (List<Vitals>) filterOnSourceProtocol(oaVital, SOURCE_PROTOCOL_DODADAPTER); int iNumVitals = calculateNumVitals(oaVital); int iCurVitalIdx = 1; for (Vitals oVital : oaVital) { LOG.debug("JMeadowsVitalService.fetchDodPatientVitals: Found DoD Vital - Processing it... idx: " + iCurVitalIdx); if (StringUtils.isBlank(oVital.getVitalType()) || StringUtils.isBlank(oVital.getRate())) { LOG.debug("skip not enough vital chunk data"); }else { VistaDataChunk oVitalChunk = transformVitalChunk(oVital, patientIds, iNumVitals, iCurVitalIdx); if (oVitalChunk != null) { oaVitalChunk.add(oVitalChunk); iCurVitalIdx++; } } } } return oaVitalChunk; } }
JMeadowsVitalService implements IJMeadowsVitalService { @Override public List<VistaDataChunk> fetchDodPatientVitals(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsVitalService.fetchDodPatientVitals - Entering method..."); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaVitalChunk = new ArrayList<VistaDataChunk>(); List<Vitals> oaVital = jMeadowsClient.getPatientVitals(query); LOG.debug("JMeadowsVitalService.fetchDodPatientVitals: " + ((oaVital == null)? "NO" : ""+oaVital.size()) + " results retrieved from JMeadows."); if ((oaVital != null) && (oaVital.size() > 0)) { oaVital = (List<Vitals>) filterOnSourceProtocol(oaVital, SOURCE_PROTOCOL_DODADAPTER); int iNumVitals = calculateNumVitals(oaVital); int iCurVitalIdx = 1; for (Vitals oVital : oaVital) { LOG.debug("JMeadowsVitalService.fetchDodPatientVitals: Found DoD Vital - Processing it... idx: " + iCurVitalIdx); if (StringUtils.isBlank(oVital.getVitalType()) || StringUtils.isBlank(oVital.getRate())) { LOG.debug("skip not enough vital chunk data"); }else { VistaDataChunk oVitalChunk = transformVitalChunk(oVital, patientIds, iNumVitals, iCurVitalIdx); if (oVitalChunk != null) { oaVitalChunk.add(oVitalChunk); iCurVitalIdx++; } } } } return oaVitalChunk; } @Autowired  JMeadowsVitalService(JMeadowsConfiguration jMeadowsConfiguration); }
JMeadowsVitalService implements IJMeadowsVitalService { @Override public List<VistaDataChunk> fetchDodPatientVitals(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsVitalService.fetchDodPatientVitals - Entering method..."); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaVitalChunk = new ArrayList<VistaDataChunk>(); List<Vitals> oaVital = jMeadowsClient.getPatientVitals(query); LOG.debug("JMeadowsVitalService.fetchDodPatientVitals: " + ((oaVital == null)? "NO" : ""+oaVital.size()) + " results retrieved from JMeadows."); if ((oaVital != null) && (oaVital.size() > 0)) { oaVital = (List<Vitals>) filterOnSourceProtocol(oaVital, SOURCE_PROTOCOL_DODADAPTER); int iNumVitals = calculateNumVitals(oaVital); int iCurVitalIdx = 1; for (Vitals oVital : oaVital) { LOG.debug("JMeadowsVitalService.fetchDodPatientVitals: Found DoD Vital - Processing it... idx: " + iCurVitalIdx); if (StringUtils.isBlank(oVital.getVitalType()) || StringUtils.isBlank(oVital.getRate())) { LOG.debug("skip not enough vital chunk data"); }else { VistaDataChunk oVitalChunk = transformVitalChunk(oVital, patientIds, iNumVitals, iCurVitalIdx); if (oVitalChunk != null) { oaVitalChunk.add(oVitalChunk); iCurVitalIdx++; } } } } return oaVitalChunk; } @Autowired  JMeadowsVitalService(JMeadowsConfiguration jMeadowsConfiguration); void setJMeadowsClient(JMeadowsData jMeadowsClient); @Override List<VistaDataChunk> fetchDodPatientVitals(JMeadowsQuery query, PatientIds patientIds); }
JMeadowsVitalService implements IJMeadowsVitalService { @Override public List<VistaDataChunk> fetchDodPatientVitals(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsVitalService.fetchDodPatientVitals - Entering method..."); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaVitalChunk = new ArrayList<VistaDataChunk>(); List<Vitals> oaVital = jMeadowsClient.getPatientVitals(query); LOG.debug("JMeadowsVitalService.fetchDodPatientVitals: " + ((oaVital == null)? "NO" : ""+oaVital.size()) + " results retrieved from JMeadows."); if ((oaVital != null) && (oaVital.size() > 0)) { oaVital = (List<Vitals>) filterOnSourceProtocol(oaVital, SOURCE_PROTOCOL_DODADAPTER); int iNumVitals = calculateNumVitals(oaVital); int iCurVitalIdx = 1; for (Vitals oVital : oaVital) { LOG.debug("JMeadowsVitalService.fetchDodPatientVitals: Found DoD Vital - Processing it... idx: " + iCurVitalIdx); if (StringUtils.isBlank(oVital.getVitalType()) || StringUtils.isBlank(oVital.getRate())) { LOG.debug("skip not enough vital chunk data"); }else { VistaDataChunk oVitalChunk = transformVitalChunk(oVital, patientIds, iNumVitals, iCurVitalIdx); if (oVitalChunk != null) { oaVitalChunk.add(oVitalChunk); iCurVitalIdx++; } } } } return oaVitalChunk; } @Autowired  JMeadowsVitalService(JMeadowsConfiguration jMeadowsConfiguration); void setJMeadowsClient(JMeadowsData jMeadowsClient); @Override List<VistaDataChunk> fetchDodPatientVitals(JMeadowsQuery query, PatientIds patientIds); static final String DOMAIN_VITAL; }