コード例 #1
0
  @RequestMapping("/pregnancy-observ-reconciliation.report")
  public ModelAndView getPregnancyObservReconciliation() {
    ModelAndView mv = new ModelAndView("pregnancyObservReconciliation");
    Collection<PregObservReconciliationBean> beans = new ArrayList<PregObservReconciliationBean>();

    PregObservReconciliationBean bean = new PregObservReconciliationBean();
    bean.setCurrentDate(calendarUtil.formatDate(Calendar.getInstance()));

    // grab all Pregnancy Observations
    List<PregnancyObservation> list =
        genericDao.findListByProperty(
            PregnancyObservation.class, "status", properties.getDataStatusPendingCode());
    Collections.sort(list, new PregnancyObservationComparator());

    for (PregnancyObservation item : list) {

      if (item.getExpectedDeliveryDate().before(Calendar.getInstance())) {
        bean.setDate(calendarUtil.formatDate(item.getRecordedDate()));
        bean.setIndivId(item.getMother().getExtId());
        beans.add(bean);
      }
    }

    if (list.size() == 0) {
      bean.setDate("");
      bean.setIndivId("");
      beans.add(bean);
    }

    mv.addObject("theData", beans);
    return mv;
  }
コード例 #2
0
 public boolean checkDuplicatePregnancyObservation(Individual mother) {
   List<PregnancyObservation> list =
       genericDao.findListByProperty(PregnancyObservation.class, "mother", mother);
   for (PregnancyObservation item : list) {
     if (item.getStatus().equals(siteProperties.getDataStatusPendingCode())) return false;
   }
   return true;
 }
コード例 #3
0
  /**
   * Lookup and copy all memberships from one individual to another individual
   *
   * @param primary the individual who will receive the copied events
   * @param toMergeFrom the individual to lookup events on
   * @return a copy of any membership events from the toMergeFrom individual
   */
  private List<Membership> getMembershipEvents(Individual primary, Individual toMergeFrom) {
    List<Membership> events = new ArrayList<Membership>();

    List<Membership> memberships =
        genericDao.findListByProperty(Membership.class, "individual", toMergeFrom);

    for (Membership mem : memberships) {
      Membership membership = copyMembership(primary, mem);
      events.add(membership);
    }

    return events;
  }
コード例 #4
0
  @Transactional(rollbackFor = Exception.class)
  public void closePregnancyObservation(Individual mother) {
    List<PregnancyObservation> obs =
        genericDao.findListByProperty(PregnancyObservation.class, "mother", mother);

    for (PregnancyObservation ob : obs) {
      if (ob.getStatus().equals(siteProperties.getDataStatusPendingCode())) {
        // found the corresponding pregnancy observation
        // now close it
        ob.setStatus(siteProperties.getDataStatusClosedCode());
        genericDao.update(ob);
        break;
      }
    }
  }
コード例 #5
0
  /**
   * Lookup and copy all in migration events from one individual to another
   *
   * @param primary the individual who will receive the copied events
   * @param toMergeFrom the individual to lookup events on
   * @return a copy of any in migrations from the toMergeFrom individual
   */
  private List<InMigration> getInMigrationEvents(Individual primary, Individual toMergeFrom) {

    List<InMigration> events = new ArrayList<InMigration>();

    // first attempt to merge any in migration events
    List<InMigration> inMigrations =
        genericDao.findListByProperty(InMigration.class, "individual", toMergeFrom);

    for (InMigration inMig : inMigrations) {
      // make a copy of the in migration & residency
      InMigration inMigNew = copyInMigration(primary, inMig);
      Residency residencyNew = copyResidency(primary, inMig.getResidency());
      inMigNew.setResidency(residencyNew);
      events.add(inMigNew);
    }

    return events;
  }
コード例 #6
0
 public List<PregnancyObservation> getPregnancyObservationByIndividual(Individual individual) {
   return genericDao.findListByProperty(PregnancyObservation.class, "mother", individual, true);
 }
コード例 #7
0
 public List<PregnancyOutcome> getPregnancyOutcomesByIndividual(Individual individual) {
   return genericDao.findListByProperty(PregnancyOutcome.class, "mother", individual, true);
 }