public MiniNutritionalAssessmentCollection listAssessments(
      Date dateFrom, Date dateTo, CareContextLiteVo careContextref)
      throws DomainInterfaceException {
    DomainFactory factory = getDomainFactory();

    String filter = " from MiniNutritionalAssessment mna ";
    StringBuffer filterString = new StringBuffer();

    boolean conditionFound = false;

    ArrayList markerNames = new ArrayList();
    ArrayList markerValues = new ArrayList();

    if (dateFrom != null && dateTo != null) {
      filterString.append(
          " mna.dateTimeInitiated > :fromDate and mna.dateTimeInitiated < :toDate ");
      conditionFound = true;
      markerNames.add("fromDate");
      markerNames.add("toDate");
      markerValues.add(dateFrom.addDay(-1).getDate());
      markerValues.add(dateTo.addDay(1).getDate());
    } else if (dateFrom != null) {
      filterString.append(" mna.dateTimeInitiated > :fromDate ");
      conditionFound = true;
      markerNames.add("fromDate");

      markerValues.add(dateFrom.addDay(-1).getDate());
    }

    if (careContextref != null) {
      if (conditionFound) filterString.append(" and ");

      filterString.append(" mna.careContext.id = :careContext ");
      markerNames.add("careContext");
      markerValues.add(careContextref.getID_CareContext());
    }

    String[] names = new String[markerNames.size()];
    markerNames.toArray(names);
    filter += " where ";

    filter += filterString.toString();

    List procs = factory.find(filter, markerNames, markerValues);

    return MiniNutritionalAssessmentAssembler
        .createMiniNutritionalAssessmentCollectionFromMiniNutritionalAssessment(procs)
        .sort();
  }
예제 #2
0
  protected void onRightDateClick() throws PresentationLogicException {
    if (form.Date().getValue() != null) {
      Date date = null;
      try {
        date = new Date(form.getLocalContext().getPatientArrivalDate(), DateFormat.ISO);
      } catch (ParseException e) {
        engine.showMessage(e.getMessage());
        return;
      }
      date.addDay(1);
      EnableButtons(false);
      getAppointments(date);

      form.DateSelected().setValue(date);
      form.getLocalContext().setPatientArrivalDate(date.toString(DateFormat.ISO));
    }
  }
예제 #3
0
  protected void onLeftDateClick() throws PresentationLogicException {
    if (form.Date().getValue() != null) {
      Date date = null;
      if (form.getLocalContext().getPatientArrivalDateIsNotNull()
          && form.getLocalContext().getPatientArrivalDate().equals("") == false) {
        try {
          date = new Date(form.getLocalContext().getPatientArrivalDate(), DateFormat.ISO);
        } catch (ParseException e) {
          e.printStackTrace();
        }
      }
      date.addDay(-1);
      EnableButtons(false);
      getAppointments(date);

      form.DateSelected().setValue(date);
      form.getLocalContext().setPatientArrivalDate(date.toString(DateFormat.ISO));
    }
  }