public PlanOfCareVo savePlanOfCare(PlanOfCareVo record) throws StaleObjectException { if(record == null) { throw new DomainRuntimeException("Invalid record"); } if(!record.isValidated()) { throw new CodingRuntimeException("Record not validated"); } DomainFactory factory = getDomainFactory(); PlanOfCare domainRecord = PlanOfCareVoAssembler.extractPlanOfCare(factory, record); factory.save(domainRecord); return PlanOfCareVoAssembler.create(domainRecord); }
public PlanOfCareVo getPlanOfCare(PlanOfCareRefVo voPlanOfCareRef) { if(voPlanOfCareRef == null || voPlanOfCareRef.getID_PlanOfCare() == null) { throw new DomainRuntimeException("Invalid record"); } DomainFactory factory = getDomainFactory(); PlanOfCare domainObject = (PlanOfCare)factory.getDomainObject(voPlanOfCareRef); return PlanOfCareVoAssembler.create(domainObject); }
public IDPPItem savePatientAssessment(PatientAssessmentVo patientAssessment, PlanOfCareVoCollection planOfCareCollection) throws StaleObjectException { if (patientAssessment == null) throw new CodingRuntimeException("Cannot save null PatientAssessmentVo"); if (patientAssessment.isValidated() == false) throw new CodingRuntimeException("PatientAssessmentVo has not been validated"); if (planOfCareCollection != null && planOfCareCollection.isValidated() == false) throw new CodingRuntimeException("PlanOfCareVoCollection have not been validated"); DomainFactory factory = getDomainFactory(); PatientAssessment doPatientAssessment = PatientAssessmentVoAssembler.extractPatientAssessment(factory, patientAssessment); factory.save(doPatientAssessment); int countNewCarePlan = 0; for (int i = 0; planOfCareCollection != null && i < planOfCareCollection.size(); i++) { PlanOfCareVo voPlanOfCare = planOfCareCollection.get(i); if (voPlanOfCare.getID_PlanOfCare() == null) countNewCarePlan++; PlanOfCare doPlanOfCare = PlanOfCareVoAssembler.extractPlanOfCare(factory, voPlanOfCare); factory.save(doPlanOfCare); } PatientAssessmentVo voPatAss = PatientAssessmentVoAssembler.create(doPatientAssessment); Integer newPlanOfCares = new Integer(countNewCarePlan); DPPItem item = new DPPItem(voPatAss, newPlanOfCares); return item; }
public PlanOfCareVoCollection listPlanOfCare(CareContextRefVo careContext, AssessmentQuestionRefVoCollection assessmentQuestionRefVoColl) { if (careContext == null) throw new CodingRuntimeException("Cannot list PlanOfCareVoCollection for null Care Context"); if (assessmentQuestionRefVoColl == null || assessmentQuestionRefVoColl.size() == 0) return null; StringBuffer query = new StringBuffer("from PlanOfCare poc where "); ArrayList values = new ArrayList(); ArrayList params = new ArrayList(); query.append(" poc.status is not :status "); params.add("status"); values.add(getDomLookup(PlanOfCareStatus.RESOLVED)); if(careContext != null) { if(values.size() > 0) query.append(" and "); query.append("poc.careContext.id =:careContextID"); params.add("careContextID"); values.add(careContext.getID_CareContext()); } if(assessmentQuestionRefVoColl != null && assessmentQuestionRefVoColl.size() > 0) { if (values.size() > 0) query.append(" and "); query.append(" poc.assessmentQuestion.id in "); query.append("("); for (int i = 0; i < assessmentQuestionRefVoColl.size(); i++) { AssessmentQuestionRefVo voAssQ = assessmentQuestionRefVoColl.get(i); query.append(" :assQId" + Integer.toString(i)); if (i < (assessmentQuestionRefVoColl.size() - 1)) query.append(", "); params.add("assQId" + Integer.toString(i)); values.add(voAssQ.getID_AssessmentQuestion()); } query.append(")"); } DomainFactory factory = getDomainFactory(); List list = factory.find(query.toString(), params, values); return PlanOfCareVoAssembler.createPlanOfCareVoCollectionFromPlanOfCare(list); }