public String findPathnetObservationDate(String labId) {
   Hl7PidDao dao = SpringUtils.getBean(Hl7PidDao.class);
   Date date = dao.findObservationDateByMessageId(ConversionUtils.fromIntString(labId));
   if (date != null) {
     return ConversionUtils.toDateString(date);
   }
   return "";
 }
Exemple #2
0
  public void populateLab(String labid) {
    labID = labid;

    CommonLabResultData data = new CommonLabResultData();
    this.multiLabId = data.getMatchingLabs(labid, "CML");

    LabPatientPhysicianInfoDao dao = SpringUtils.getBean(LabPatientPhysicianInfoDao.class);

    LabPatientPhysicianInfo l = dao.find(ConversionUtils.fromIntString(labid));
    if (l != null) {
      this.labReportInfoId = ConversionUtils.toIntString(l.getLabReportInfoId());
      this.accessionNum = l.getAccessionNum();
      this.physicianAccountNum = l.getPhysicianAccountNum();
      this.serviceDate = l.getServiceDate();
      this.pFirstName = l.getPatientFirstName();
      this.pLastName = l.getPatientLastName();
      this.pSex = l.getPatientSex();
      this.pHealthNum = l.getPatientHin();
      this.pDOB = l.getPatientDob();
      this.status = l.getLabStatus();
      this.docNum = l.getDocNum();
      this.docName = l.getDocName();
      this.docAddr1 = l.getDocAddress1();
      this.docAddr2 = l.getDocAddress2();
      this.docAddr3 = l.getDocAddress3();
      this.docPostal = l.getDocPostal();
      this.docRoute = l.getDocRoute();
      this.comment1 = l.getComment1();
      this.comment2 = l.getComment2();
      this.pPhone = l.getPatientPhone();
      this.docPhone = l.getDocPhone();
      this.collectionDate = l.getCollectionDate();
    }

    if (labReportInfoId != null) {
      log.debug(" filling labReport Info");
      populateLabReportInfo(labReportInfoId);
    }

    if (labid != null) {
      log.debug("Filling lab Result DAta");
      this.labResults = populateLabResultData(labid);
    }

    if (labid != null) {
      populateDemoNo(labid);
    }
  }
 public String findPathnetStatus(String labId) {
   Hl7ObrDao dao = SpringUtils.getBean(Hl7ObrDao.class);
   for (Object[] o : dao.findMinResultStatusByMessageId(ConversionUtils.fromIntString(labId))) {
     return String.valueOf(o[0]);
   }
   return "";
 }
 public int markListAsBilled(List<String> list) { // TODO: Should be set form CONST var
   Query query =
       entityManager.createQuery(
           "UPDATE Billingmaster b set b.billingstatus = 'B' where b.billingmasterNo in (:billingNumbers)");
   query.setParameter("billingNumbers", ConversionUtils.toIntList(list));
   return query.executeUpdate();
 }
  public String findPathnetOrderingProvider(String labId) {
    Hl7OrcDao dao = SpringUtils.getBean(Hl7OrcDao.class);
    for (Object[] o : dao.findOrcAndPidByMessageId(ConversionUtils.fromIntString(labId))) {
      Hl7Orc orc = (Hl7Orc) o[0];
      return justGetDocName(orc.getOrderingProvider());
    }

    return "";
  }
  public String getMatchingLabs(String labId) {
    String ret = "";
    String accessionNum = "";
    String labDate = "";
    int monthsBetween = 0;

    try {
      Hl7OrcDao orcDao = SpringUtils.getBean(Hl7OrcDao.class);

      // find the accession number
      for (Object[] o :
          orcDao.findFillerAndStatusChageByMessageId(ConversionUtils.fromIntString(labDate))) {
        String fillerOrderNumber = String.valueOf(o[0]);
        Date date = (Date) o[1];
        accessionNum = justGetAccessionNumber(fillerOrderNumber);
        labDate = ConversionUtils.toDateString(date);
      }

      Hl7PidDao pidDao = SpringUtils.getBean(Hl7PidDao.class);

      for (Object[] o : pidDao.findByFillerOrderNumber("%" + accessionNum + "%")) {
        String messageId = String.valueOf(o[0]);
        Date resultsReportStatusChange = (Date) o[1];

        Date dateA = resultsReportStatusChange;
        Date dateB = UtilDateUtilities.StringToDate(labDate, "yyyy-MM-dd HH:mm:ss");
        if (dateA.before(dateB)) {
          monthsBetween = UtilDateUtilities.getNumMonths(dateA, dateB);
        } else {
          monthsBetween = UtilDateUtilities.getNumMonths(dateB, dateA);
        }

        if (monthsBetween < 4) {

          if (ret.equals("")) ret = messageId;
          else ret = ret + "," + messageId;
        }
      }
    } catch (Exception e) {
      logger.error("exception in PathnetResultsData", e);
      return labId;
    }
    return ret;
  }
Exemple #7
0
  @NativeSql({"hl7_pid", "hl7_link", "hl7_obr", "hl7_message"})
  public List<Object[]> findReports(
      Date start, Date end, String provider_no, String orderby, String command) {
    String select_reports_by_provider =
        "SELECT DISTINCT hl7_pid.pid_id, hl7_pid.patient_name, hl7_obr.ordering_provider, hl7_obr.result_copies_to, hl7_link.status, hl7_link.signed_on, provider.last_name, provider.first_name, hl7_message.date_time  FROM hl7_link, demographic, hl7_pid, hl7_obr, hl7_message, provider WHERE demographic.provider_no = provider.provider_no AND hl7_link.pid_id=hl7_obr.pid_id AND hl7_link.pid_id=hl7_pid.pid_id AND demographic.provider_no='@provider_no' AND hl7_message.message_id=hl7_pid.message_id AND demographic.demographic_no=hl7_link.demographic_no AND hl7_link.status!='P'";
    String select_reports_linked_to_providers =
        "SELECT DISTINCT hl7_pid.pid_id, hl7_pid.patient_name, hl7_obr.ordering_provider, hl7_obr.result_copies_to, hl7_link.status, hl7_link.signed_on, provider.last_name, provider.first_name, hl7_message.date_time  FROM hl7_link, demographic, hl7_pid, hl7_obr, hl7_message, provider WHERE demographic.provider_no = provider.provider_no AND hl7_link.pid_id=hl7_obr.pid_id AND hl7_link.pid_id=hl7_pid.pid_id AND hl7_message.message_id=hl7_pid.message_id AND demographic.demographic_no=hl7_link.demographic_no AND hl7_link.status!='P'";
    String select_unlinked_labs =
        "SELECT DISTINCT hl7_pid.pid_id, hl7_pid.patient_name, hl7_obr.ordering_provider, hl7_obr.result_copies_to, hl7_link.status, hl7_link.signed_on, hl7_message.date_time, '' as `last_name`, '' as `first_name` FROM hl7_pid left join hl7_link on hl7_link.pid_id=hl7_pid.pid_id left join hl7_obr on hl7_pid.pid_id=hl7_obr.pid_id left join hl7_message on hl7_message.message_id=hl7_pid.message_id WHERE hl7_link.status='P' OR hl7_link.status is null";
    String sqlWhere =
        (start != null
                ? " AND hl7_message.date_time >= '"
                    + ConversionUtils.toDateString(start)
                    + " 00:00:00'"
                : "")
            + (end != null
                ? " AND hl7_message.date_time <= '"
                    + ConversionUtils.toTimeString(end)
                    + " 23:59:59'"
                : "");
    String sqlOrderBy = " ORDER BY @orderby";

    String sql = null;
    if (command != null && !command.equals("")) {
      if ("-ULL".equals(provider_no)) {
        sql = select_unlinked_labs;
      } else if ("-APL".equals(provider_no)) {
        sql = select_reports_linked_to_providers;
      } else if ("-UAP".equals(provider_no)) {
        sql = select_reports_by_provider;
      } else {
        sql = select_reports_by_provider;
      }
      sql += sqlWhere + sqlOrderBy;
      sql =
          sql.replaceAll("@provider_no", provider_no.replaceAll("-UAP", ""))
              .replaceAll("@orderby", orderby);

      Query query = entityManager.createNativeQuery(sql);
      return query.getResultList();
    }

    return new ArrayList<Object[]>();
  }
Exemple #8
0
 private void populateDemoNo(String labId) {
   PatientLabRoutingDao dao = SpringUtils.getBean(PatientLabRoutingDao.class);
   for (PatientLabRouting r :
       dao.findByLabNoAndLabType(ConversionUtils.fromIntString(labId), "CML")) {
     String d = r.getDemographicNo().toString();
     if (!"0".equals(d)) {
       this.demographicNo = d;
     }
   }
 }
 public boolean isLabLinkedWithPatient(String labId) {
   PatientLabRoutingDao dao = SpringUtils.getBean(PatientLabRoutingDao.class);
   for (PatientLabRouting p :
       dao.findByLabNoAndLabType(ConversionUtils.fromIntString(labId), "BCP")) {
     String demo = "" + p.getDemographicNo();
     if (demo != null && !demo.trim().equals("0")) {
       return true;
     }
   }
   return false;
 }
  /** 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;
  }
Exemple #11
0
  private void populateLabReportInfo(String labid) {
    LabReportInformationDao dao = SpringUtils.getBean(LabReportInformationDao.class);
    LabReportInformation info = dao.find(ConversionUtils.fromIntString(labid));
    if (info == null) {
      return;
    }

    this.locationId = info.getLocationId();
    this.printDate = info.getPrintDate();
    this.printTime = info.getPrintTime();
    this.totalBType = info.getTotalBType();
    this.totalCType = info.getTotalCType();
    this.totalDType = info.getTotalDType();
  }
Exemple #12
0
  public List<Validations> getValidationType(String inputType, String mInstrc) {
    List<Validations> result = new ArrayList<Validations>();

    MeasurementTypeDao dao = SpringUtils.getBean(MeasurementTypeDao.class);
    List<MeasurementType> types = dao.findByTypeAndMeasuringInstruction(inputType, mInstrc);
    if (types.isEmpty()) {
      return result;
    }

    ValidationsDao vDao = SpringUtils.getBean(ValidationsDao.class);
    for (MeasurementType type : types) {
      Validations vs = vDao.find(ConversionUtils.fromIntString(type.getValidation()));
      result.add(vs);
    }
    return result;
  }
Exemple #13
0
  public String getDiscipline(String labid) {
    String dis = "";

    LabTestResultsDao dao = SpringUtils.getBean(LabTestResultsDao.class);

    ArrayList<String> alist = new ArrayList<String>();
    int count = 0;
    for (LabTestResults r : dao.findByTitleAndLabInfoId(ConversionUtils.fromIntString(labid))) {
      if (r.getTitle() != null) {
        String title = r.getTitle();
        count += title.length();
        alist.add(title);
        log.debug("line " + title);
      }
    }

    if (alist.size() == 1) {
      dis = alist.get(0); // Only one item
    } else if (alist.size() != 0) {
      int lenAvail = 20 - (alist.size() - 1);
      if (lenAvail > count) {
        StringBuilder s = new StringBuilder();
        for (int i = 0; i < alist.size(); i++) {
          s.append(alist.get(i));
          if (i < (alist.size() - 1)) {
            s.append("/");
          }
        }
        dis = s.toString();
      } else { // need to divide up characters
        int charEach = lenAvail / alist.size();
        StringBuilder s = new StringBuilder();
        for (int i = 0; i < alist.size(); i++) {
          String str = alist.get(i);

          s.append(StringUtils.substring(str, 0, charEach));
          if (i < (alist.size() - 1)) {
            s.append("/");
          }
        }
        dis = s.toString();
      }
    }

    return dis;
  }
  public String findPathnetDisipline(String labId) {
    StringBuilder ret = new StringBuilder();
    try {
      Hl7ObrDao dao = SpringUtils.getBean(Hl7ObrDao.class);
      boolean first = true;
      for (Object[] o : dao.findByMessageId(ConversionUtils.fromIntString(labId))) {
        Hl7Obr obr = (Hl7Obr) o[1];
        if (!first) {
          ret.append("/");
        }
        ret.append(obr.getDiagnosticServiceSectId());
        first = false;
      }

    } catch (Exception e) {
      logger.error("exception in MDSResultsData", e);
    }
    return ret.toString();
  }
Exemple #15
0
  private ArrayList<LabResult> populateLabResultData(String labid) {
    ArrayList<LabResult> alist = new ArrayList<LabResult>();

    LabTestResultsDao dao = SpringUtils.getBean(LabTestResultsDao.class);
    for (LabTestResults r : dao.findByLabInfoId(ConversionUtils.fromIntString(labid))) {
      String lineType = r.getLineType();

      if (lineType == null) {
        continue;
      }

      LabResult labRes = new LabResult();

      labRes.title = r.getTitle();
      if (labRes.title == null) {
        labRes.title = "";
      }
      labRes.notUsed1 = r.getNotUsed1();
      labRes.locationId = r.getLocationId();
      labRes.last = r.getLast();

      if (lineType.equals("C")) {
        labRes.notUsed2 = r.getNotUsed2();
        labRes.testName = r.getTestName();
        labRes.abn = r.getAbn();
        if (labRes.abn != null && labRes.abn.equals("N")) {
          labRes.abn = "";
        }
        labRes.minimum = r.getMinimum();
        labRes.maximum = r.getMaximum();
        labRes.units = r.getUnits();
        labRes.result = r.getResult();
      } else if (lineType.equals("D")) {
        labRes.description = r.getDescription();
        labRes.labResult = false;
      }
      alist.add(labRes);
    }

    return alist;
  }
Exemple #16
0
  public void dbQuery() {
    try {
      batchOrder = 4 - batchCount.length();
      // check length
      checkBatchHeader();
      batchHeader = buildBatchHeader();
      htmlValue = buildHTMLContentHeader();
      // start here
      value = batchHeader;

      BillingDao dao = SpringUtils.getBean(BillingDao.class);
      BillingDetailDao bdDao = SpringUtils.getBean(BillingDetailDao.class);
      for (Billing b :
          dao.findByProviderStatusAndDates(
              providerNo, Arrays.asList(new String[] {"O", "W"}), dateRange)) {
        patientCount++;
        invNo = "" + b.getId();
        //   ohipVer = b.getorganization_spec_code");
        inPatient = "" + b.getClinicNo();
        // if there is no clinic no for a clinic, it should be an empty str
        inPatient = "0".equals(inPatient) ? "    " : inPatient;
        demoName = b.getDemographicName();
        hin = b.getHin();
        dob = b.getDob();
        visitDate = new Date(b.getVisitDate().getTime());
        visitType = b.getVisitType();
        outPatient = b.getClinicRefCode();
        specCode = b.getStatus();
        content = b.getContent();
        value += buildHeader1();
        htmlContent += printErrorPartMsg();
        // build billing detail
        invCount = 0;
        for (BillingDetail bd :
            bdDao.findByBillingNoAndStatus(ConversionUtils.fromIntString(invNo), specCode)) {
          recordCount++;
          count = 0;
          serviceCode = bd.getServiceCode();
          fee = bd.getBillingAmount();
          diagcode = bd.getDiagnosticCode();
          // changed the following line for the no need of diagcode
          diagcode = ":::".equals(diagcode) ? "   " : diagcode;
          // appt = rs2.getDate("appointment_date").toString();
          billingUnit = bd.getBillingUnit();
          count = 6 - fee.length();
          apptDate = UtilDateUtilities.DateToString(bd.getAppointmentDate(), "yyyyMMdd");
          dFee = Double.parseDouble(fee);
          bdFee = BigDecimal.valueOf(dFee).setScale(2, BigDecimal.ROUND_HALF_UP);
          BigTotal = BigTotal.add(bdFee);
          checkItem();
          value += buildItem();
          htmlContent += buildHTMLContentRecord(invCount);
          htmlContent += printErrorPartMsg();
          invCount++;
        }
        checkNoDetailRecord(invCount);
        htmlContent += printErrorPartMsg();
        if (eFlag.compareTo("1") == 0) {
          setAsBilled(invNo);
        }
      }
      hcCount = hcCount + healthcardCount;
      pCount = pCount + patientCount;
      rCount = rCount + recordCount;
      flagOrder = 4 - pCount.length();
      secondFlag = 5 - rCount.length();
      thirdFlag = 4 - hcCount.length();
      percent = BigDecimal.valueOf(0.01).setScale(2, BigDecimal.ROUND_HALF_UP);
      BigTotal = BigTotal.multiply(percent);
      value += buildTrailer();
      htmlCode = buildHTMLContentTrailer();
      // writeHtml(htmlCode);
      ohipReciprocal = String.valueOf(hcCount);
      ohipRecord = String.valueOf(rCount);
      ohipClaim = String.valueOf(pCount);
      totalAmount = BigTotal.toString();
      // }
      // dbExt.closeConnection();
    } catch (Exception e) {
      MiscUtils.getLogger().error("error", e);
    }
  }
Exemple #17
0
  public void populateMDSSegmentData(String SID) {
    this.segmentID = SID;
    String associatedOBR = "";
    String labID = "";
    int mdsOBXNum = 0;
    try {

      // Get the header info
      MdsMSHDao mshDao = SpringUtils.getBean(MdsMSHDao.class);
      for (Object[] o : mshDao.findMdsSementDataById(ConversionUtils.fromIntString(segmentID))) {
        Date dateTime = (Date) o[0];
        String controlId = (String) o[1];
        String reportFormStatus = (String) o[2];

        GregorianCalendar cal = new GregorianCalendar(Locale.ENGLISH);
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy", Locale.ENGLISH);
        cal.setTime(dateTime);

        reportDate = dateFormat.format(cal.getTime());
        reportStatus = (reportFormStatus.equals("1") ? "Final" : "Partial");
        clientNo = controlId.split("-")[0];
        accessionNo = controlId.split("-")[1];
      }

      // Get the lab ID
      MdsZLBDao zlbDao = SpringUtils.getBean(MdsZLBDao.class);
      MdsZLB zlb = zlbDao.find(ConversionUtils.fromIntString(this.segmentID));
      if (zlb != null) {
        labID = zlb.getLabId();
      }

      // Get the providers
      MdsPV1Dao pvDao = SpringUtils.getBean(MdsPV1Dao.class);
      MdsPV1 pv = pvDao.find(ConversionUtils.fromIntString(this.segmentID));
      if (pv != null) {
        providers = new ProviderData(pv.getRefDoctor(), pv.getConDoctor(), pv.getAdmDoctor());
      } else {
        providers = new ProviderData("", "", "");
      }

      // Get the lab status
      ProviderLabRoutingDao plrDao = SpringUtils.getBean(ProviderLabRoutingDao.class);
      for (Object[] o :
          plrDao.findProviderAndLabRoutingByIdAndLabType(
              ConversionUtils.fromIntString(this.segmentID), "MDS")) {
        Provider provider = (Provider) o[0];
        ProviderLabRoutingModel providerLabRouting = (ProviderLabRoutingModel) o[1];

        statusArray.add(
            new ReportStatus(
                provider.getFirstName() + " " + provider.getLastName(),
                provider.getProviderNo(),
                descriptiveStatus(providerLabRouting.getStatus()),
                providerLabRouting.getComment(),
                ConversionUtils.toDateString(providerLabRouting.getTimestamp()),
                this.segmentID));
      }

      // Get item descriptions and ranges and read into a hashtable
      Hashtable<String, Mnemonics> mnemonics = new Hashtable<String, Mnemonics>();
      MdsZMNDao zmnDao = SpringUtils.getBean(MdsZMNDao.class);
      MdsZMN zmn = zmnDao.find(ConversionUtils.fromIntString(this.segmentID));
      if (zmn != null) {
        mnemonics.put(
            zmn.getResultMnemonic(),
            new Mnemonics(zmn.getReportName(), zmn.getUnits(), zmn.getReferenceRange()));
      }

      // Process the notes
      Hashtable<Integer, ArrayList<String>> notes = new Hashtable<Integer, ArrayList<String>>();
      MdsNTEDao nteDao = SpringUtils.getBean(MdsZMNDao.class);
      MdsZMCDao zmcDao = SpringUtils.getBean(MdsZMCDao.class);
      MdsNTE nte = nteDao.find(labID);
      if (nte != null) {
        if (notes.get(nte.getAssociatedOBX()) == null) {
          notes.put(nte.getAssociatedOBX(), new ArrayList<String>());
        }
        if (nte.getSourceOfComment().equals("M")) {
          ((ArrayList<String>) notes.get(nte.getAssociatedOBX()))
              .add(new String(nte.getComment().substring(3)));
        } else {
          if (nte.getSourceOfComment().equals("MC")) {
            MdsZMC zmc =
                zmcDao.findByIdAndSetId(
                    ConversionUtils.fromIntString(this.segmentID), nte.getComment().substring(1));
            if (zmc == null) {
              zmc =
                  zmcDao.findByIdAndSetId(
                      ConversionUtils.fromIntString(this.segmentID),
                      "%" + nte.getComment().substring(1, nte.getComment().length() - 1) + "%");
            }

            if (zmc != null) {
              ((ArrayList<String>) notes.get(nte.getAssociatedOBX())).add(zmc.getMessageCodeDesc());
            }
          } else {
            logger.info(
                "Found message note in unknown format.  Format:" + nte.getSourceOfComment());
            ((ArrayList<String>) notes.get(nte.getAssociatedOBX())).add("Unknown note format!");
          }
        }
      }

      // Get the report section names
      MdsZRGDao zrgDao = SpringUtils.getBean(MdsZRGDao.class);
      for (Object[] o : zrgDao.findById(ConversionUtils.fromIntString(this.segmentID))) {
        String groupDesc = (String) o[0];
        String groupId = (String) o[1];
        Integer groupIdCount = (Integer) o[2];
        String groupHeading = (String) o[3];

        if (groupIdCount == 1 && !groupHeading.equals("")) {
          String[] rGH = {groupHeading};
          headersArray.add(new Headers(groupDesc, groupId, rGH));
        } else if (groupIdCount > 1) {
          ArrayList<String> tempArray = new ArrayList<String>();
          for (Object oo :
              zrgDao.findReportGroupHeadingsById(
                  ConversionUtils.fromIntString(this.segmentID), groupId)) {
            tempArray.add(String.valueOf(oo));
          }

          String[] reportGroupHeading = new String[tempArray.size()];
          reportGroupHeading = tempArray.toArray(reportGroupHeading);
          headersArray.add(new Headers(groupDesc, groupId, reportGroupHeading));
        } else {
          headersArray.add(new Headers(groupDesc, groupId, null));
        }
      }

      // Create the data structures for each section, grouped by OBR
      MdsOBRDao obrDao = SpringUtils.getBean(MdsOBRDao.class);
      for (int i = 0; i < headersArray.size(); i++) {
        List<String> resultCodes =
            zmnDao.findResultCodes(
                ConversionUtils.fromIntString(this.segmentID), headersArray.get(i).reportSequence);
        for (Object[] ooo :
            obrDao.findByIdAndResultCodes(
                ConversionUtils.fromIntString(this.segmentID), resultCodes)) {
          String associatedObr = (String) ooo[0];
          Date observationDateTime = (Date) ooo[1];
          (headersArray.get(i))
              .groupedReportsArray.add(
                  new GroupedReports(
                      associatedObr,
                      ConversionUtils.toTimestampString(observationDateTime),
                      resultCodes));
        }
      }

      MdsOBXDao obxDao = SpringUtils.getBean(MdsOBXDao.class);
      // Get the actual results
      Mnemonics thisOBXMnemonics = new Mnemonics();
      for (int i = 0; i < (headersArray.size()); i++) {
        for (int j = 0; j < (headersArray.get(i)).groupedReportsArray.size(); j++) {
          associatedOBR = ((headersArray.get(i)).groupedReportsArray.get(j)).associatedOBR;
          List<String> codes = ((headersArray.get(i)).groupedReportsArray.get(j)).codes;

          for (MdsOBX obx :
              obxDao.findByIdObrAndCodes(
                  ConversionUtils.fromIntString(this.segmentID), associatedOBR, codes)) {

            mdsOBXNum = obx.getObxId();
            thisOBXMnemonics.update(
                (Mnemonics)
                    mnemonics.get(
                        obx.getObservationIdentifier()
                            .substring(1, obx.getObservationIdentifier().indexOf('^'))));

            ((headersArray.get(i)).groupedReportsArray.get(j))
                .resultsArray.add(
                    new Results(
                        thisOBXMnemonics.reportName,
                        thisOBXMnemonics.referenceRange,
                        thisOBXMnemonics.units,
                        obx.getObservationValue(),
                        obx.getAbnormalFlags(),
                        obx.getObservationIdentifier(),
                        obx.getObservationResultStatus(),
                        (ArrayList<String>) notes.get(Integer.toString(mdsOBXNum)),
                        obx.getProducersId().substring(0, obx.getProducersId().indexOf('^'))));
          }
        }
      }
    } catch (Exception e) {
      logger.error("In MDS Segment Data", e);
    }
  }
Exemple #18
0
 public int findCMLAdnormalResults(String labId) {
   LabTestResultsDao dao = SpringUtils.getBean(LabTestResultsDao.class);
   return dao.findByAbnAndLabInfoId("A", ConversionUtils.fromIntString(labId)).size();
 }
 public int findNumOfFinalResults(String labId) {
   Hl7PidDao dao = SpringUtils.getBean(Hl7PidDao.class);
   return dao.findByObservationResultStatusAndMessageId("F", ConversionUtils.fromIntString(labId))
       .size();
 }
  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;
  }
 public int findPathnetAdnormalResults(String labId) {
   Hl7ObxDao dao = SpringUtils.getBean(Hl7ObxDao.class);
   return dao.findByMessageIdAndAbnormalFlags(
           ConversionUtils.fromIntString(labId), Arrays.asList(new String[] {"A", "H", "HH", "L"}))
       .size();
 }