public AssessmentHeaderInfo getAssessmentHeaderInfoByCareContext(CareContextRefVo voCareContextRef) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from AdmissionAssessment t "; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Integer> values = new ArrayList<Integer>(); String andStr = " "; if (voCareContextRef != null) { hql.append(andStr + " t.careContext.id = :care"); markers.add("care"); values.add(voCareContextRef.getID_CareContext()); andStr = " and "; hql.append(andStr + " t.isRIE is null"); } if (markers.size() > 0) query += " where "; query += hql.toString(); List headerInfoList = factory.find(query, markers, values); if (headerInfoList != null && headerInfoList.size() > 0) { AssessmentHeaderInfo voAssmnt = AssessmentHeaderInfoAssembler.create((AdmissionAssessment) headerInfoList.get(0)); return voAssmnt; } else return null; }
public void completeComponent(ims.nursing.vo.AssessmentComponent component, AssessmentHeaderInfo assessment) throws StaleObjectException { DomainFactory factory = getDomainFactory(); // Update the VO with the completed information AssessmentComponent comp = (AssessmentComponent) factory.getDomainObject(AssessmentComponent.class, component.getID_AssessmentComponent()); comp.setIsComplete(new Boolean(true)); try { factory.save(comp); // We need to know whether to complete the actual assessment itself // too at this stage, call the // method in AssessmentComponentImpl to check whether it is required // We need to specify one component explicitly as // AssessmentComponent is not a class in it's own right AdmissionAssessment assmnt = AssessmentHeaderInfoAssembler.extractAdmissionAssessment(factory, assessment); if (assmnt.isAssessmentCompleted()) { assmnt.setDateTimeComplete(new java.util.Date()); assmnt.setHCPComplete(HcpAssembler.extractHcp(factory, (ims.core.vo.Hcp) getHcpUser())); assmnt.setAssessmentStatus(factory.getLookupInstance(AssessmentStatus.TYPE_ID, AssessmentStatus.COMPLETE.getID())); factory.save(assmnt); } } catch (DomainException e) { throw new DomainRuntimeException("DomainException occurred completing assessment component.\r\n" + e.getMessage(), e); } }
public AssessmentHeaderInfo getAssessment(CareContextRefVo careContextVo) { if (careContextVo == null || careContextVo.getID_CareContext()==null) throw new DomainRuntimeException("Invalid CareContextRefVo provided"); String hql = "select aa from AdmissionAssessment as aa where (aa.careContext.id = :id and aa.isRIE is null )"; List<?> list = getDomainFactory().find(hql,"id",careContextVo.getID_CareContext()); if (list == null || list.size() == 0 ) return null; return AssessmentHeaderInfoAssembler.create((AdmissionAssessment) list.get(0)); }