public static ArrayList<LabelValueBean> constructEformList() {
    ArrayList<LabelValueBean> results = new ArrayList<LabelValueBean>();

    EFormDao eFormDao = (EFormDao) SpringUtils.getBean("EFormDao");
    List<EForm> forms = eFormDao.findAll(true);
    Collections.sort(forms, EForm.FORM_NAME_COMPARATOR);

    for (EForm form : forms) {
      results.add(new LabelValueBean(form.getFormName(), String.valueOf(form.getId())));
    }

    return results;
  }
示例#2
0
  /**
   * get eform in group by group name
   *
   * @param groupName
   * @return list of EForms
   */
  public List<EForm> getEfromInGroupByGroupName(LoggedInInfo loggedInInfo, String groupName) {
    List<EForm> results = eformDao.getEfromInGroupByGroupName(groupName);
    if (results.size() > 0) {
      String resultIds = EForm.getIdsAsStringList(results);
      LogAction.addLogSynchronous(
          loggedInInfo, "FormsManager.getEfromInGroupByGroupName", "ids returned=" + resultIds);
    }

    return (results);
  }
示例#3
0
  /**
   * Finds all eforms based on the status.
   *
   * @param status Status to be used when looking up forms.
   * @param sortOrder Order how records should be sorted. Providing no sort order delegates to the
   *     default sorting order of the persistence provider
   * @return Returns the list of all forms with the specified status.
   */
  public List<EForm> findByStatus(
      LoggedInInfo loggedInInfo, boolean status, EFormSortOrder sortOrder) {
    List<EForm> results = eformDao.findByStatus(status, sortOrder);

    if (results.size() > 0) {
      String resultIds = EForm.getIdsAsStringList(results);
      LogAction.addLogSynchronous(
          loggedInInfo, "FormsManager.findByStatus", "ids returned=" + resultIds);
    }

    return (results);
  }
示例#4
0
  public void updateBorn() {
    String rourkeFormName =
        oscarProperties.getProperty("born18m_eform_rourke", "Rourke Baby Record");
    String nddsFormName =
        oscarProperties.getProperty(
            "born18m_eform_ndds", "Nipissing District Developmental Screen");
    String rpt18mFormName =
        oscarProperties.getProperty(
            "born18m_eform_report18m", "Summary Report: 18-month Well Baby Visit");

    EForm rourkeForm = eformDao.findByName(rourkeFormName);
    EForm nddsForm = eformDao.findByName(nddsFormName);
    EForm rpt18mForm = eformDao.findByName(rpt18mFormName);

    List<Integer> rourkeFormDemoList = new ArrayList<Integer>();
    List<Integer> nddsFormDemoList = new ArrayList<Integer>();
    List<Integer> rpt18mFormDemoList = new ArrayList<Integer>();

    if (rourkeForm == null) logger.error(rourkeFormName + " form not found!");
    else buildDemoNos(rourkeForm, rourkeFormDemoList);
    if (nddsForm == null) logger.error(nddsFormName + " form not found!");
    else buildDemoNos(nddsForm, nddsFormDemoList);
    if (rpt18mForm == null) logger.error(rpt18mFormName + " form not found!");
    else buildDemoNos(rpt18mForm, rpt18mFormDemoList);

    HashMap<Integer, Integer> rourkeFormDemoFdids = new HashMap<Integer, Integer>();
    HashMap<Integer, Integer> nddsFormDemoFdids = new HashMap<Integer, Integer>();
    HashMap<Integer, Integer> rpt18mFormDemoFdids = new HashMap<Integer, Integer>();

    for (Integer demoNo : rourkeFormDemoList) {
      Integer fdid = checkRourkeDone(rourkeFormName, demoNo);
      if (fdid != null) rourkeFormDemoFdids.put(demoNo, fdid);
    }
    for (Integer demoNo : nddsFormDemoList) {
      Integer fdid = checkNddsDone(nddsFormName, demoNo);
      if (fdid != null) nddsFormDemoFdids.put(demoNo, fdid);
    }
    for (Integer demoNo : rpt18mFormDemoList) {
      Integer fdid = checkReport18mDone(rpt18mFormName, demoNo);
      if (fdid != null) rpt18mFormDemoFdids.put(demoNo, fdid);
    }

    // Upload to BORN repository
    for (Integer demoNo : rourkeFormDemoFdids.keySet()) {
      uploadToBorn(
          demoNo,
          rourkeFormDemoFdids.get(demoNo),
          nddsFormDemoFdids.get(demoNo),
          rpt18mFormDemoFdids.get(demoNo));
      nddsFormDemoFdids.remove(demoNo);
      rpt18mFormDemoFdids.remove(demoNo);
    }
    for (Integer demoNo : nddsFormDemoFdids.keySet()) {
      uploadToBorn(demoNo, null, nddsFormDemoFdids.get(demoNo), rpt18mFormDemoFdids.get(demoNo));
      rpt18mFormDemoFdids.remove(demoNo);
    }
    for (Integer demoNo : rpt18mFormDemoFdids.keySet()) {
      if (hasFormUploaded(rourkeFormName, demoNo) && hasFormUploaded(nddsFormName, demoNo)) {
        uploadToBorn(demoNo, null, null, rpt18mFormDemoFdids.get(demoNo));
      }
    }
  }