Exemple #1
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;
  }
Exemple #2
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 #3
0
 public int findCMLAdnormalResults(String labId) {
   LabTestResultsDao dao = SpringUtils.getBean(LabTestResultsDao.class);
   return dao.findByAbnAndLabInfoId("A", ConversionUtils.fromIntString(labId)).size();
 }