private void open() { AdmissionAssessmentVo voAdmissionAssessment; voAdmissionAssessment = domain.getAdmissionAssessmentByCareContext(form.getGlobalContext().Core.getCurrentCareContext()); if (voAdmissionAssessment != null) populateForm(voAdmissionAssessment); }
private void populateForm(AdmissionAssessmentVo voAdmissionAssessment) { if(voAdmissionAssessment != null) { form.gridAssessment().getRows().clear(); form.gridCarePlans().getRows().clear(); GenForm.gridAssessmentRow row; row = form.gridAssessment().getRows().newRow(); if (voAdmissionAssessment.getDateTimeInitiated() != null) row.setColAssessmentDate(voAdmissionAssessment.getDateTimeInitiated().toString()); if (voAdmissionAssessment.getAssessmentType() != null) row.setColAssessmentType(voAdmissionAssessment.getAssessmentType().getText()); if (voAdmissionAssessment.getHcpInitiated() != null) row.setColInitiationHCP(voAdmissionAssessment.getHcpInitiated().toString()); row.setValue(voAdmissionAssessment); GenForm.gridCarePlansRow row1; AssessmentComponentCarePlans voAssessmentComponentCarePlans = null; if (voAdmissionAssessment.getComponentCarePlans() != null) { for (int i=0; i<voAdmissionAssessment.getComponentCarePlans().size(); i++) { voAssessmentComponentCarePlans = voAdmissionAssessment.getComponentCarePlans().get(i); row1 = form.gridCarePlans().getRows().newRow(); if (voAssessmentComponentCarePlans.getTitle() != null) row1.setcolTitle(voAssessmentComponentCarePlans.getTitle()); if (voAssessmentComponentCarePlans.getAssessmentComponent().getComponentType() != null) row1.setcolAssessment(voAssessmentComponentCarePlans.getAssessmentComponent().getComponentType().getText()); row1.setcolStatus(voAssessmentComponentCarePlans.getCurrentCarePlanStatus().getStatus().getText()); row1.setValue(voAssessmentComponentCarePlans); } } form.gridCarePlans().sort(2, SortOrder.ASCENDING); } }
/** * get admission assessment, which will include assessment component care plans */ public AdmissionAssessmentVo getAdmissionAssessmentByCareContext(CareContextRefVo voCareContextRef) { DomainFactory factory = getDomainFactory(); // get admission assessment String hql = " from AdmissionAssessment admAss"; hql += (" where admAss.careContext.id = " + voCareContextRef.getID_CareContext() + " and admAss.isRIE is null "); AdmissionAssessmentVo admissionAssessmentVo = null; List admAss = factory.find(hql); for (Iterator iter = admAss.iterator(); iter.hasNext();) { AdmissionAssessment domAdmissionAssess = (AdmissionAssessment) iter.next(); admissionAssessmentVo = AdmissionAssessmentVoAssembler.create(domAdmissionAssess); break; } if (admissionAssessmentVo == null) return null; // now get associated care plans //String hqlQuery = " from CarePlan cp "; String hqlQuery = "select c1_1 from CarePlan as c1_1 left join c1_1.assessmentComponent as a1_1 left join a1_1.assessment as a2_1 "; StringBuffer condStr = new StringBuffer(); ArrayList<String> markerNames = new ArrayList<String>(); ArrayList<Integer> markerValues = new ArrayList<Integer>(); if(voCareContextRef != null) { condStr.append(" c1_1.careContext.id = :care and c1_1.assessmentComponent is not null "); markerNames.add("care"); markerValues.add(voCareContextRef.getID_CareContext()); } condStr.append(" and a2_1.isRIE is null "); if (markerNames.size() > 0) hqlQuery += " where "; hqlQuery += condStr.toString(); List careplans = factory.find(hqlQuery,markerNames,markerValues); // now that we have care plans, create assessment component care plans, set in vo, and return admissionAssessmentVo.setComponentCarePlans(AssessmentComponentCarePlansAssembler.createAssessmentComponentCarePlansCollectionFromCarePlan(careplans).sort(SortOrder.ASCENDING)); return admissionAssessmentVo; }