/** listPrescriptions */
  public ims.RefMan.vo.PrescriptionsVoCollection listPrescriptions(
      ims.RefMan.vo.CatsReferralRefVo catsRefVo) {
    if (catsRefVo == null || catsRefVo.getID_CatsReferral() == null) {
      throw new CodingRuntimeException("CatsReferralVo is null or id not provided");
    }

    DomainFactory factory = getDomainFactory();
    StringBuffer hql =
        new StringBuffer(
            "select prescriptions from ReferralOutcome as ro join ro.catsReferral as cats join ro.prescriptions as prescriptions ");

    ArrayList<String> names = new ArrayList<String>();
    ArrayList<Integer> values = new ArrayList<Integer>();

    hql.append("  where cats.id = :idCatsRefferal");
    names.add("idCatsRefferal");
    values.add(catsRefVo.getID_CatsReferral());

    List result = factory.find(hql.toString(), names, values);

    if (result != null && result.size() > 0) {
      PrescriptionsVoCollection voColl =
          PrescriptionsVoAssembler.createPrescriptionsVoCollectionFromPrescription(result);
      if (voColl != null && voColl.size() > 0) {
        voColl.sort(SortOrder.DESCENDING);
        return voColl;
      }
    }

    return null;
  }