Пример #1
0
  public void evaluate(
      LoggedInInfo loggedInInfo,
      Denominator deno,
      Numerator numer,
      List<KeyValue> additionalFields) {
    denominator = deno;
    numerator = numer;
    List demoList = deno.getDenominatorList();
    denominatorCount = demoList.size();
    setReportResultList(new ArrayList<Hashtable<String, Object>>());
    for (int i = 0; i < demoList.size(); i++) {
      String demo = (String) demoList.get(i);
      boolean bool = numer.evaluate(loggedInInfo, demo);
      // Object obj = numer.getOutputValues();  // PROBLEM IS THAT THIS WILL ALWAYS HAVE A VALUE
      Hashtable<String, Object> h = new Hashtable<String, Object>();
      h.put("_demographic_no", demo);
      h.put("_report_result", new Boolean(bool));

      if (additionalFields != null) {
        for (KeyValue field : additionalFields) {
          String key = (String) field.getKey();
          String val = (String) field.getValue();

          EctMeasurementsDataBeanHandler ect =
              new EctMeasurementsDataBeanHandler(Integer.valueOf(demo), val);
          Collection<EctMeasurementsDataBean> v = ect.getMeasurementsDataVector();
          // Execute for the value and attach it to the key in the hashtable
          // Object obj =
          if (v.iterator().hasNext()) {
            h.put(key, v.iterator().next());
          }
        }
      }

      getReportResultList().add(h);
      //            if (obj != null){
      //                getReportResultList().add(obj);
      //            }
      if (bool) {
        numeratorCount++;
      }
    }
  }
Пример #2
0
  private String letterProcessing(
      PreventionReportDisplay prd, String measurementType, Date asofDate, Date prevDate) {
    if (prd != null) {
      boolean inclUpToDate = false;
      if (prd.state.equals("Up to date")) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(asofDate);
        cal.add(Calendar.YEAR, -2);
        Date dueDate = cal.getTime();
        cal.add(Calendar.MONTH, -6);
        Date cutoffDate = cal.getTime();

        if ((dueDate.after(prevDate) && cutoffDate.before(prevDate))
            || cutoffDate.after(prevDate)) {
          inclUpToDate = true;
        }
      }

      if (prd.state.equals("No Info")
          || prd.state.equals("due")
          || prd.state.equals("Overdue")
          || inclUpToDate) {

        // Get LAST contact method
        EctMeasurementsDataBeanHandler measurementDataHandler =
            new EctMeasurementsDataBeanHandler(prd.demographicNo, measurementType);
        log.debug("getting followup data for " + prd.demographicNo);

        Collection<EctMeasurementsDataBean> followupData =
            measurementDataHandler.getMeasurementsDataVector();
        // NO Contact

        if (followupData.size() == 0) {
          prd.nextSuggestedProcedure = this.LETTER1;
          return this.LETTER1;
        } else { // There has been contact

          Calendar oneyear = Calendar.getInstance();
          oneyear.setTime(asofDate);
          oneyear.add(Calendar.YEAR, -1);

          Calendar onemonth = Calendar.getInstance();
          onemonth.setTime(asofDate);
          onemonth.add(Calendar.MONTH, -1);

          Date observationDate = null;
          int count = 0;
          int index = 0;
          EctMeasurementsDataBean measurementData = null;

          @SuppressWarnings("unchecked")
          Iterator<EctMeasurementsDataBean> iterator = followupData.iterator();

          while (iterator.hasNext()) {
            measurementData = iterator.next();
            observationDate = measurementData.getDateObservedAsDate();

            if (index == 0) {
              log.debug("fluData " + measurementData.getDataField());
              log.debug(
                  "lastFollowup "
                      + measurementData.getDateObservedAsDate()
                      + " last procedure "
                      + measurementData.getDateObservedAsDate());
              log.debug("toString: " + measurementData.toString());
              prd.lastFollowup = observationDate;
              prd.lastFollupProcedure = measurementData.getDataField();

              if (measurementData.getDateObservedAsDate().before(oneyear.getTime())) {
                prd.nextSuggestedProcedure = this.LETTER1;
                return this.LETTER1;
              }

              if (prd.lastFollupProcedure.equals(this.PHONE1)) {
                prd.nextSuggestedProcedure = "----";
                return "----";
              }
            }

            log.debug(
                prd.demographicNo
                    + " obs"
                    + observationDate
                    + String.valueOf(observationDate.before(onemonth.getTime()))
                    + " OneYear "
                    + oneyear.getTime()
                    + " "
                    + String.valueOf(observationDate.after(oneyear.getTime())));
            if (observationDate.before(onemonth.getTime())
                && observationDate.after(oneyear.getTime())) {
              ++count;
            } else if (count > 1 && observationDate.after(oneyear.getTime())) {
              ++count;
            }

            ++index;
          }

          switch (count) {
            case 0:
              prd.nextSuggestedProcedure = this.LETTER1;
              break;
            case 1:
              prd.nextSuggestedProcedure = this.LETTER2;
              break;
            case 2:
              prd.nextSuggestedProcedure = this.PHONE1;
              break;
            default:
              prd.nextSuggestedProcedure = "----";
          }

          return prd.nextSuggestedProcedure;

          /*                      if ( measurementData.getDateObservedAsDate().before(onemonth.getTime())){
                                        if (prd.lastFollupProcedure.equals(this.LETTER1)){
                                              prd.nextSuggestedProcedure = this.LETTER2;
                                              return this.LETTER2;
                                        }else if(prd.lastFollupProcedure.equals(this.LETTER2)){
                                              prd.nextSuggestedProcedure = this.PHONE1;
                                              return this.PHONE1;
                                        }else{
                                            prd.nextSuggestedProcedure = "----";
                                            return "----";
                                        }

                                    }else if(prd.lastFollupProcedure.equals(this.LETTER2)){
                                        prd.nextSuggestedProcedure = this.PHONE1;
                                        return this.PHONE1;
                                    }else{
                                        prd.nextSuggestedProcedure = "----";
                                        return "----";
                                    }

          */

        }

      } else if (prd.state.equals("Refused")) { // Not sure what to do about refused
        // prd.lastDate = "-----";
        prd.nextSuggestedProcedure = "----";
        // prd.numMonths ;
      } else if (prd.state.equals("Ineligible")) {
        // Do nothing
        prd.nextSuggestedProcedure = "----";
      } else if (prd.state.equals("Pending")) {
        prd.nextSuggestedProcedure = this.CALLFU;
      } else if (prd.state.equals("Up to date")) {
        // Do nothing
        prd.nextSuggestedProcedure = "----";
      } else {
        log.debug("NOT SURE WHAT HAPPEND IN THE LETTER PROCESSING");
      }
    }
    return null;
  }