/** Populates ArrayList with labs attached to a consultation request */ public ArrayList<LabResultData> populatePathnetResultsData( String demographicNo, String consultationId, boolean attached) { ArrayList<LabResultData> labResults = new ArrayList<LabResultData>(); ArrayList<LabResultData> attachedLabs = new ArrayList<LabResultData>(); try { ConsultDocsDao dao = SpringUtils.getBean(ConsultDocsDao.class); for (Object[] o : dao.findDocs(ConversionUtils.fromIntString(consultationId))) { ConsultDocs c = (ConsultDocs) o[0]; LabResultData lbData = new LabResultData(LabResultData.EXCELLERIS); lbData.labPatientId = "" + c.getDocumentNo(); attachedLabs.add(lbData); } LabResultData lbData = new LabResultData(LabResultData.EXCELLERIS); LabResultData.CompareId c = lbData.getComparatorId(); Hl7MessageDao hmDao = SpringUtils.getBean(Hl7MessageDao.class); for (Object[] o : hmDao.findByDemographicAndLabType(ConversionUtils.fromIntString(demographicNo), "BCP")) { Hl7Message m = (Hl7Message) o[0]; PatientLabRouting r = (PatientLabRouting) o[1]; lbData.labType = LabResultData.EXCELLERIS; lbData.segmentID = "" + m.getId(); lbData.labPatientId = "" + r.getId(); lbData.dateTime = findPathnetObservationDate(lbData.segmentID); lbData.discipline = findPathnetDisipline(lbData.segmentID); if (attached && Collections.binarySearch(attachedLabs, lbData, c) >= 0) labResults.add(lbData); else if (!attached && Collections.binarySearch(attachedLabs, lbData, c) < 0) labResults.add(lbData); lbData = new LabResultData(LabResultData.EXCELLERIS); } } catch (Exception e) { logger.error("exception in CMLPopulate:", e); } return labResults; }
public ArrayList<LabResultData> populatePathnetResultsData( String providerNo, String demographicNo, String patientFirstName, String patientLastName, String patientHealthNumber, String status) { if (providerNo == null) { providerNo = ""; } if (patientFirstName == null) { patientFirstName = ""; } if (patientLastName == null) { patientLastName = ""; } if (patientHealthNumber == null) { patientHealthNumber = ""; } if (status == null) { status = ""; } ArrayList<LabResultData> labResults = new ArrayList<LabResultData>(); try { Hl7MshDao dao = SpringUtils.getBean(Hl7MshDao.class); List<Object[]> pathnetResultsData; if (demographicNo == null) { pathnetResultsData = dao.findPathnetResultsDataByPatientNameHinStatusAndProvider( patientLastName + "%^" + patientFirstName + "%", "%" + patientHealthNumber + "%", "%" + status + "%", providerNo.equals("") ? "%" : providerNo, "BCP"); } else { pathnetResultsData = dao.findPathnetResultsDeomgraphicNo( ConversionUtils.fromIntString(demographicNo), "BCP"); } for (Object[] o : pathnetResultsData) { Hl7Msh msh = (Hl7Msh) o[0]; Hl7Pid pid = (Hl7Pid) o[1]; Hl7Orc orc = (Hl7Orc) o[2]; ProviderLabRoutingModel p = (ProviderLabRoutingModel) o[4]; Long stat = (Long) o[5]; LabResultData lbData = new LabResultData(LabResultData.EXCELLERIS); lbData.labType = LabResultData.EXCELLERIS; lbData.segmentID = "" + pid.getMessageId(); if (demographicNo == null && !providerNo.equals("0")) { lbData.acknowledgedStatus = p.getStatus(); } else { lbData.acknowledgedStatus = "U"; } lbData.accessionNumber = justGetAccessionNumber(orc.getFillerOrderNumber()); lbData.healthNumber = pid.getExternalId(); lbData.patientName = pid.getPatientName(); if (lbData.patientName != null) { lbData.patientName = lbData.patientName.replaceAll("\\^", " "); } lbData.sex = pid.getSex(); lbData.resultStatus = "0"; // TODO // solve lbData.resultStatus.add(oscar.Misc.getString(rs,"abnormalFlag")); lbData.dateTime = ConversionUtils.toTimestampString(msh.getDateTime()); // priority lbData.priority = "----"; lbData.requestingClient = justGetDocName(orc.getOrderingProvider()); lbData.reportStatus = "" + stat; if (lbData.reportStatus != null && lbData.reportStatus.equals("F")) { lbData.finalRes = true; } else { lbData.finalRes = false; } labResults.add(lbData); } } catch (Exception e) { logger.error("exception in pathnetPopulate", e); } return labResults; }