/** * Lists all careplans for the given Episode with the filter of 0 = Active, 1 = All */ public CarePlanOverviewCollection listCarePlans(CareContextRefVo voCurrentCareContext, CarePlanStatus currentStatus, Boolean bCarePlansFromOtherContexts) throws DomainInterfaceException { if(voCurrentCareContext == null && voCurrentCareContext.getID_CareContextIsNotNull()) throw new CodingRuntimeException("Current Care Context not available."); DomainFactory factory = getDomainFactory(); String hqlQuery = " from CarePlan cp "; StringBuffer condStr = new StringBuffer(); ArrayList<String> markerNames = new ArrayList<String>(); ArrayList<Integer> markerValues = new ArrayList<Integer>(); CarePlanOverviewCollection voColl = null; condStr.append(" where "); if(voCurrentCareContext != null) { if(!bCarePlansFromOtherContexts) condStr.append(" cp.careContext.id = :rcc"); else{ condStr.append(" cp.careContext.episodeOfCare.careSpell.patient.id = :patientId and cp.careContext.id != :rcc"); markerNames.add("patientId"); markerValues.add(getPatientId(voCurrentCareContext)); } markerNames.add("rcc"); markerValues.add(voCurrentCareContext.getID_CareContext()); } if(currentStatus != null) { if(currentStatus.getStatus() != null) { if(currentStatus != null) condStr.append(" and "); condStr.append(" cp.currentCarePlanStatus.status.id = :status"); markerNames.add("status"); markerValues.add(new Integer(currentStatus.getStatus().getId())); } } hqlQuery += condStr.toString(); List careplans = factory.find(hqlQuery,markerNames,markerValues); if(careplans != null) voColl = (CarePlanOverviewAssembler.createCarePlanOverviewCollectionFromCarePlan(careplans)); if(voColl != null) voColl.sort(SortOrder.ASCENDING); return voColl; }
public CarePlanOverviewCollection listCarePlansForReview(CareContextShortVo careContextShortVo, CarePlanStatus activeFilter) { DomainFactory factory = getDomainFactory(); String hqlQuery = " from CarePlan cp "; StringBuffer condStr = new StringBuffer(); ArrayList<String> markerNames = new ArrayList<String>(); ArrayList<Integer> markerValues = new ArrayList<Integer>(); CarePlanOverviewCollection voColl = null; condStr.append(" where "); if(careContextShortVo != null) { condStr.append(" cp.careContext.id = :careContext"); markerNames.add("careContext"); markerValues.add(careContextShortVo.getID_CareContext()); } if(activeFilter != null) { if(activeFilter.getStatus() != null) { if(activeFilter != null) condStr.append(" and "); condStr.append(" cp.currentCarePlanStatus.status.id = :status"); markerNames.add("status"); markerValues.add(new Integer(activeFilter.getStatus().getId())); } } hqlQuery += condStr.toString(); List careplans = factory.find(hqlQuery,markerNames,markerValues); if(careplans != null) voColl = (CarePlanOverviewAssembler.createCarePlanOverviewCollectionFromCarePlan(careplans)); if(voColl != null) voColl.sort(SortOrder.ASCENDING); return voColl; }