/** * lists Skin Assessments */ public SkinAssessmentCollection listSkinAssessment(CareContextRefVo voCurrentCareContext) { if ((voCurrentCareContext == null) || (voCurrentCareContext.getID_CareContext() == null)) return null; DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from SkinAssessment sa "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; hql.append(andStr + " sa.careContext.id = :rcc"); markers.add("rcc"); values.add(voCurrentCareContext.getID_CareContext()); andStr = " and "; if (markers.size() > 0) query += " where "; query += hql.toString(); List skinAssList = factory.find(query, markers, values); return SkinAssessmentAssembler.createSkinAssessmentCollectionFromSkinAssessment(skinAssList).sort(); }
/** * save record */ public AssessmentHeaderInfo saveRecord(SkinAssessment skinAssessment, AssessmentHeaderInfo assessment, AssessmentComponent component) throws StaleObjectException { if(!skinAssessment.isValidated()) throw new DomainRuntimeException("This Skin Assessment has not been validated"); DomainFactory factory = getDomainFactory(); ims.nursing.assessmenttools.domain.objects.SkinAssessment domSkinAssess = SkinAssessmentAssembler.extractSkinAssessment(factory, skinAssessment); try { if(domSkinAssess == null) throw new DomainException("No Skin Assessment"); if (assessment != null) { String[] arrErrors = component.validate(); if(arrErrors != null) throw new DomainRuntimeException("Validation Errors"); return (saveAssessmentComponent(assessment, component)); } else { factory.save(domSkinAssess); SkinAssessment voSkin = SkinAssessmentAssembler.create(domSkinAssess); return null; } } catch (DomainException e) { throw new DomainRuntimeException("DomainException occurred saving Skin Assessment.\r\n" + e.getMessage(), e); } }
/** * gets last Skin Assessment */ public SkinAssessment getLastSkinAssessmentByCareContext(CareContextRefVo voCurrentCareContext) { if(voCurrentCareContext == null && voCurrentCareContext.getID_CareContextIsNotNull()) throw new CodingRuntimeException("Current Care Context not available."); DomainFactory factory = getDomainFactory(); String filter = " from SkinAssessment sa "; StringBuffer filterString = new StringBuffer(); ArrayList markerNames = new ArrayList(); ArrayList markerValues = new ArrayList(); filterString.append(" where sa.careContext.id = :rcc"); markerNames.add("rcc"); markerValues.add(voCurrentCareContext.getID_CareContext()); filter += filterString.toString(); filter += " order by sa.dateTimeInitiated desc"; java.util.List skinAssess = factory.find(filter, markerNames, markerValues); SkinAssessmentCollection voSkinAssessColl = SkinAssessmentAssembler.createSkinAssessmentCollectionFromSkinAssessment(skinAssess).sort(SortOrder.DESCENDING); if(voSkinAssessColl.size() > 0) return voSkinAssessColl.get(0); return null; }
public SkinAssessment getLastSkinAssessmentByPatient(Integer idPatient) { if(idPatient == null) throw new CodingRuntimeException("Patient context not available."); DomainFactory factory = getDomainFactory(); String filter = " from SkinAssessment sa "; StringBuffer filterString = new StringBuffer(); ArrayList markerNames = new ArrayList(); ArrayList markerValues = new ArrayList(); filterString.append(" where sa.careContext.episodeOfCare.careSpell.patient.id = :idPat"); markerNames.add("idPat"); markerValues.add(idPatient); filter += filterString.toString(); java.util.List skinAssess = factory.find(filter, markerNames, markerValues); if (skinAssess != null && skinAssess.size() > 0) { SkinAssessmentCollection voSkinAssessColl = SkinAssessmentAssembler.createSkinAssessmentCollectionFromSkinAssessment(skinAssess).sort(SortOrder.DESCENDING); if(voSkinAssessColl!=null && voSkinAssessColl.size()>0) return voSkinAssessColl.get(0); } return null; }