private void listCarePlans() { form.grdCarePlans().getRows().clear(); CopyCarePlanVoCollection collCarePlans = domain.listCarePlans(form.getGlobalContext().Core.getCurrentCareContext(), null, true); populateCarePlansGrid(collCarePlans); form.grdCarePlans().sort(4, SortOrder.ASCENDING); }
private boolean currentEpisodeHaveCarePlans() { CopyCarePlanVoCollection coll = domain.listCarePlans(form.getGlobalContext().Core.getCurrentCareContext(), null, false); if (coll==null || coll.size()==0) return false; return true; }
private void populateCarePlansGrid(CopyCarePlanVoCollection collCarePlans) { if (collCarePlans == null) return; for (int i = 0; i < collCarePlans.size(); i++) { CopyCarePlanVo carePlan = collCarePlans.get(i); grdCarePlansRow row = form.grdCarePlans().getRows().newRow(); row.setcolCarePlanTitle(carePlan.getTitle()); if (carePlan != null && carePlan.getCarePlanStatusIsNotNull()) { for (int x = 0; x < carePlan.getCarePlanStatus().size(); x++) { carePlan.getCarePlanStatus().sort(SortOrder.ASCENDING); if (carePlan.getCarePlanStatus().get(x).getStatus().equals(carePlan.getCurrentCarePlanStatus().getStatus())) { if (carePlan.getCarePlanStatus().get(x).getDateTime().getDate() != null) row.setcolInitiatedOn(carePlan.getCarePlanStatus().get(x).getDateTime().getDate()); if (carePlan.getCarePlanStatus().get(x).getHCP() != null) { if (carePlan.getCarePlanStatus().get(x).getHCP().getName() != null) row.setcolInitiateBy(carePlan.getCarePlanStatus().get(x).getHCP().getName().toString()); } break; // you could have a number of actives, // i.e.active,then suspended,then active, you // want // the first active, so ASCENDING - get first // active - need break. } } } if (carePlan.getCurrentCarePlanStatus() != null && carePlan.getCurrentCarePlanStatus().getStatus().equals(carePlan.getCurrentCarePlanStatus().getStatus())) { if (carePlan.getNextEvaluationDate() != null) { row.setcolNextEvaluation(carePlan.getNextEvaluationDate()); } } if (carePlan.getCurrentCarePlanStatus() != null) { row.setcolStatus(carePlan.getCurrentCarePlanStatus().getStatus().getText()); } row.setTooltipForcolCarePlanTitle(carePlan.getTitle()); row.setValue(carePlan); } }
public CopyCarePlanVoCollection listCarePlans(CareContextRefVo voCurrentCareContext, CarePlanStatus currentStatus, Boolean bCarePlansFromOtherContexts) { if (voCurrentCareContext == null || voCurrentCareContext.getID_CareContext()==null) 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>(); CopyCarePlanVoCollection voColl = null; condStr.append(" where "); if (voCurrentCareContext != null) { if (!bCarePlansFromOtherContexts) { condStr.append(" cp.careContext.id = :rcc"); markerNames.add("rcc"); markerValues.add(voCurrentCareContext.getID_CareContext()); } else { condStr.append(" cp.careContext.episodeOfCare.careSpell.patient.id = :patientId"); markerNames.add("patientId"); markerValues.add(getPatientId(voCurrentCareContext)); } } if (currentStatus != null) { if (currentStatus.getStatus() != null) { condStr.append(" and 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 = (CopyCarePlanVoAssembler.createCopyCarePlanVoCollectionFromCarePlan(careplans)); if (voColl != null) voColl.sort(SortOrder.ASCENDING); return voColl; }