@Test public void testFetchPatientVitals() { try { when(this.mockJMeadowsClient.getPatientVitals(any(JMeadowsQuery.class))).thenReturn(createTestData()); 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(2)); List<Vitals> testDataList = createTestData(); for(int i = 0; i < vistaDataChunkList.size(); i++) { VistaDataChunk vistaDataChunk = vistaDataChunkList.get(i); assertThat(JMeadowsVitalService.DOMAIN_VITAL, is(vistaDataChunk.getDomain())); assertThat(2, is(vistaDataChunk.getItemCount())); assertThat(i+1, is(vistaDataChunk.getItemIndex())); assertThat(vistaId, is(vistaDataChunk.getParams().get("vistaId"))); assertThat(dfn, is(vistaDataChunk.getParams().get("patientDfn"))); assertThat(vistaId, is(vistaDataChunk.getSystemId())); assertThat(dfn, is(vistaDataChunk.getLocalPatientId())); assertThat(icn, is(vistaDataChunk.getPatientIcn())); assertThat("DOD;" + edipi, is(vistaDataChunk.getPatientId())); assertThat("vrpcb: assertThat(VistaDataChunk.NEW_OR_UPDATE, is(vistaDataChunk.getType())); Map<String,Object> jsonMap = vistaDataChunk.getJsonMap(); Vitals testVital = testDataList.get(i); assertThat("Vital Sign", is(jsonMap.get("kind"))); assertThat("DOD", is(jsonMap.get("facilityCode"))); assertThat("DOD", is(jsonMap.get("facilityName"))); assertThat("urn:va:vital:DOD:"+edipi+":"+testVital.getCdrEventId(), is(jsonMap.get("uid"))); assertThat(testVital.getVitalType(), is(jsonMap.get("typeName"))); assertThat(testVital.getRate(), is(jsonMap.get("result"))); assertThat(testVital.getUnits(), is(jsonMap.get("units"))); List<Map<String, Object>> codes = (List<Map<String, Object>>)jsonMap.get("codes"); assertThat(JLVTerminologySystem.LOINC.getUrn(), is(codes.get(0).get("system"))); } } 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; }