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();
  }
  /** list By ClinicalContact */
  public GaitShortVoCollection listByCareContext(CareContextLiteVo voCareContext) {
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer();
    String query = "from Gait ga ";
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();
    String andStr = " ";

    if (voCareContext.getEpisodeOfCareIsNotNull()) {
      hql.append(andStr + " ga.clinicalContact.careContext.id = :cc");
      markers.add("cc");
      values.add(voCareContext.getID_CareContext());
      andStr = " and ";
    }

    if (markers.size() > 0) query += " where ";
    query += hql.toString();

    java.util.List gaitList = factory.find(query, markers, values);
    GaitShortVoCollection voGaitParColl =
        GaitShortVoAssembler.createGaitShortVoCollectionFromGait(gaitList);
    if (voGaitParColl.size() > 0) return voGaitParColl;
    else return null;
  }