/** * lists the PainAssessment records */ public PainAssessmentCollection listPain(CareContextRefVo voCurrentCareContext) { if(voCurrentCareContext == null && voCurrentCareContext.getID_CareContextIsNotNull()) throw new CodingRuntimeException("Current Care Context not available."); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from PainAssessment p "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; hql.append(andStr + " p.careContext.id = :rcc"); markers.add("rcc"); values.add(voCurrentCareContext.getID_CareContext()); andStr = " and "; if (markers.size() > 0) query += " where "; query += hql.toString(); List procs = factory.find(query, markers, values); return PainAssessmentAssembler.createPainAssessmentCollectionFromPainAssessment(procs); }
/** * save the PainAssessment Record * @throws UniqueKeyViolationException * @throws DomainInterfaceException * **/ public AssessmentHeaderInfo saveRecord(ims.nursing.vo.PainAssessment painAssessment, AssessmentHeaderInfo assessment, AssessmentComponent component) throws StaleObjectException, UniqueKeyViolationException, DomainInterfaceException { if(painAssessment != null && !painAssessment.isValidated()) throw new DomainRuntimeException("The PainAssessment has not been validated"); if (assessment != null && component != null) { if(!assessment.isValidated()) throw new DomainRuntimeException("The AssessmentHeaderInfo has not been validated"); if(!component.isValidated()) throw new DomainRuntimeException("The AssessmentComponent has not been validated"); return (savePainAssessmentComponent(assessment, component, painAssessment.getClinicalContact())); } else { DomainFactory factory = getDomainFactory(); ims.nursing.assessmenttools.domain.objects.PainAssessment domPainAssess = PainAssessmentAssembler.extractPainAssessment(factory, painAssessment); try { factory.save(domPainAssess); ims.nursing.vo.PainAssessment voPain = PainAssessmentAssembler.create(domPainAssess); return null; } catch (DomainException e) { throw new DomainRuntimeException("DomainException occurred saving Skin Assessment.\r\n" + e.getMessage(), e); } } }
public ims.nursing.vo.PainAssessment geLastPain(CareContextRefVo voCurrentCareContext) { if(voCurrentCareContext == null && voCurrentCareContext.getID_CareContextIsNotNull()) throw new CodingRuntimeException("Current Care Context not available."); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from PainAssessment pa "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; hql.append(andStr + " pa.careContext.id = :rcc"); markers.add("rcc"); values.add(voCurrentCareContext.getID_CareContext()); andStr = " and "; if (markers.size() > 0) query += " where "; query += hql.toString(); List painAssessmentList = factory.find(query, markers, values); if (painAssessmentList != null && painAssessmentList.size() > 0) { ims.nursing.vo.PainAssessmentCollection voPainAssmntColl = PainAssessmentAssembler.createPainAssessmentCollectionFromPainAssessment(painAssessmentList); voPainAssmntColl.sort(SortOrder.DESCENDING); return voPainAssmntColl.get(0); } else { return null; } }
public ims.nursing.vo.PainAssessment getLastPainAssessmentByPatient(Integer idPatient) { if(idPatient == null) throw new CodingRuntimeException("Patient Context not available."); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from PainAssessment pa "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; hql.append(andStr + " pa.careContext.episodeOfCare.careSpell.patient.id = :idPat"); markers.add("idPat"); values.add(idPatient); andStr = " and "; if (markers.size() > 0) query += " where "; query += hql.toString(); List painAssessmentList = factory.find(query, markers, values); if (painAssessmentList != null && painAssessmentList.size() > 0) { ims.nursing.vo.PainAssessmentCollection voPainAssmntColl = PainAssessmentAssembler.createPainAssessmentCollectionFromPainAssessment(painAssessmentList).sort(SortOrder.DESCENDING); if(voPainAssmntColl!=null&&voPainAssmntColl.size()>0) return voPainAssmntColl.get(0); } return null; }