public DischargedEpisodeForVTERiskAssessmentWorklistVo getDischargeEpisode(PASEventRefVo pasEvent) { if(pasEvent == null ) throw new CodingRuntimeException("Pas Event not provided"); DomainFactory factory = getDomainFactory(); List<?> dis = factory.find("select dis from DischargedEpisode as dis left join dis.pasEvent as pas where pas.id =:idPasEvent", new String[] {"idPasEvent"}, new Object[] {pasEvent.getID_PASEvent()}); if( dis != null && dis.size() > 0) { DischargedEpisodeForVTERiskAssessmentWorklistVoCollection tempColl = DischargedEpisodeForVTERiskAssessmentWorklistVoAssembler.createDischargedEpisodeForVTERiskAssessmentWorklistVoCollectionFromDischargedEpisode(dis).sort(SortOrder.DESCENDING); if(tempColl != null && tempColl.size() > 0) return tempColl.get(0); } return null; }
public DischargedEpisodeForVTERiskAssessmentWorklistVo getDischargedEpisodeForVTERiskAssessmentWorklistVo(DischargedEpisodeRefVo dischargeepisodeRef) { if( dischargeepisodeRef == null) throw new CodingRuntimeException("DischargeEpisode cannot be null"); DomainFactory factory = getDomainFactory(); DischargedEpisode doDischargedEpisode = (DischargedEpisode) factory.getDomainObject(DischargedEpisode.class, dischargeepisodeRef.getID_DischargedEpisode()); return DischargedEpisodeForVTERiskAssessmentWorklistVoAssembler.create(doDischargedEpisode); }
public DischargedEpisodeForVTERiskAssessmentWorklistVo saveDischargeEpisode(DischargedEpisodeForVTERiskAssessmentWorklistVo discharge) throws StaleObjectException, UniqueKeyViolationException { if(discharge == null) throw new CodingRuntimeException("Cannot save a null Discharge Episode."); if(!discharge.isValidated()) throw new CodingRuntimeException("Discharge Episode is not validated."); DomainFactory factory = getDomainFactory(); DischargedEpisode doDischarge = DischargedEpisodeForVTERiskAssessmentWorklistVoAssembler.extractDischargedEpisode(factory, discharge); factory.save(doDischarge); return DischargedEpisodeForVTERiskAssessmentWorklistVoAssembler.create(doDischarge); }
public DischargedEpisodeForVTERiskAssessmentWorklistVo getDischargedEpisodeForVTERiskAssessmentWorklistVo(DischargedEpisodeRefVo dischargeRef) { if( dischargeRef == null) throw new CodingRuntimeException("DischargeEpisode cannot be null"); DomainFactory factory = getDomainFactory(); DischargedEpisode doDischargedEpisode = (DischargedEpisode) factory.getDomainObject(DischargedEpisode.class, dischargeRef.getID_DischargedEpisode()); return DischargedEpisodeForVTERiskAssessmentWorklistVoAssembler.create(doDischargedEpisode); }
public IVTERiskAssessment saveEpisode(IVTERiskAssessment vteRiskAssessment) throws StaleObjectException { if(vteRiskAssessment == null) throw new CodingRuntimeException("Cannot save a null Episode."); DomainFactory factory = getDomainFactory(); // Try to see if an Inpatient Episode is found for the PasEvent String queryInpatient = "SELECT inpEp FROM InpatientEpisode AS inpEp LEFT JOIN inpEp.pasEvent AS pasEv WHERE pasEv.id = :PAS_ID"; InpatientEpisode inpEpisode = (InpatientEpisode) factory.findFirst(queryInpatient, "PAS_ID", vteRiskAssessment.getPasEvent().getID_PASEvent()); if (inpEpisode != null) { inpEpisode.setVTEAssessmentStatus(null); factory.save(inpEpisode); return VTERiskAssessmentWorklistVoAssembler.create(inpEpisode); } // If no Inpatient Episode is found, try to find a Discharged Episode for the PasEvent String queryDischarge = "SELECT disEp FROM DischargedEpisode AS disEp LEFT JOIN disEp.pasEvent AS pasEv WHERE pasEv.id = :PAS_ID"; DischargedEpisode disEpisode = (DischargedEpisode) factory.findFirst(queryDischarge, "PAS_ID", vteRiskAssessment.getPasEvent().getID_PASEvent()); if (disEpisode != null) { disEpisode.setVTEAssessmentStatus(null); factory.save(disEpisode); return DischargedEpisodeForVTERiskAssessmentWorklistVoAssembler.create(disEpisode); } return null; }
public IVTERiskAssessment saveEpisode(IVTERiskAssessment vteRiskAssessment, VTERemoveDeclineReasonVo removedReason) throws StaleObjectException { if(vteRiskAssessment == null) throw new CodingRuntimeException("Cannot save a null Episode."); DomainFactory factory = getDomainFactory(); // Try to see if an Inpatient Episode is found for the PasEvent String queryInpatient = "SELECT inpEp FROM InpatientEpisode AS inpEp LEFT JOIN inpEp.pasEvent AS pasEv WHERE pasEv.id = :PAS_ID"; InpatientEpisode inpEpisode = (InpatientEpisode) factory.findFirst(queryInpatient, "PAS_ID", vteRiskAssessment.getPasEvent().getID_PASEvent()); if (inpEpisode != null) { inpEpisode.setVTEAssessmentStatus(getDomLookup(VTEAsessmentStatus.COMPLETED)); if (removedReason != null && removedReason.getReason() != null) inpEpisode.setVTEAssessmentStatusReason(getDomLookup(removedReason.getReason())); factory.save(inpEpisode); return VTERiskAssessmentWorklistVoAssembler.create(inpEpisode); } // If no Inpatient Episode is found, try to find a Discharged Episode for the PasEvent String queryDischarge = "SELECT disEp FROM DischargedEpisode AS disEp LEFT JOIN disEp.pasEvent AS pasEv WHERE pasEv.id = :PAS_ID"; DischargedEpisode disEpisode = (DischargedEpisode) factory.findFirst(queryDischarge, "PAS_ID", vteRiskAssessment.getPasEvent().getID_PASEvent()); if (disEpisode != null) { disEpisode.setVTEAssessmentStatus(getDomLookup(VTEAsessmentStatus.COMPLETED)); if (removedReason != null && removedReason.getReason() != null) disEpisode.setVTEAssessmentStatusReason(getDomLookup(removedReason.getReason())); factory.save(disEpisode); return DischargedEpisodeForVTERiskAssessmentWorklistVoAssembler.create(disEpisode); } return null; }
public WasVTERiskAssessmentStatusChangedVo wasStatusChanged(IVTERiskAssessment episode, VTEAsessmentStatus currentStatus) { if(episode == null || episode.getId() == null) throw new CodingRuntimeException("Cannot check the status for a null Episode ID."); DomainFactory factory = getDomainFactory(); String query = null;//WDEV-15414 List<?> list = null;//WDEV-15414 //WDEV-15414 if(episode instanceof VTERiskAssessmentWorklistVo) { query = "select ie from InpatientEpisode as ie where ie.id = :EpisodeId"; } //WDEV-15414 else if(episode instanceof DischargedEpisodeForVTERiskAssessmentWorklistVo) { query = "select de from DischargedEpisode as de where de.id = :EpisodeId"; } list = factory.find(query, new String[] {"EpisodeId"}, new Object[] {episode.getId()});//WDEV-15414 IVTERiskAssessment currentEpisode = null; if(list != null && list.size() > 0) { if(episode instanceof VTERiskAssessmentWorklistVo) { currentEpisode = VTERiskAssessmentWorklistVoAssembler.create((InpatientEpisode) list.get(0)); } else if(episode instanceof DischargedEpisodeForVTERiskAssessmentWorklistVo) { currentEpisode = DischargedEpisodeForVTERiskAssessmentWorklistVoAssembler.create((DischargedEpisode) list.get(0)); } } if(currentEpisode == null || currentStatus == null) return null; WasVTERiskAssessmentStatusChangedVo wasChanged = new WasVTERiskAssessmentStatusChangedVo(); if(currentStatus.equals(currentEpisode.getVTEAssessmentStatus())) { wasChanged.setWasStatusChanged(false); wasChanged.setVTEStatus(null); } else { wasChanged.setWasStatusChanged(true); wasChanged.setVTEStatus(currentEpisode.getVTEAssessmentStatus()); } return wasChanged; }
public DischargedEpisodeForVTERiskAssessmentWorklistVo getDischargedEpisodeForRecord(VTERiskAssessmentRefVo vteAssessmentRef, PatientRefVo patientRef) { if (patientRef == null || vteAssessmentRef == null) return null; DomainFactory factory = getDomainFactory(); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); String hql = " select dischargeEp from DischargedEpisode as dischargeEp left join dischargeEp.pasEvent as pasEv left join pasEv.patient as pat left join dischargeEp.vTERiskAssessment as vte where pat.id = :patientID and vte.id = :vteID"; markers.add("patientID"); values.add(patientRef.getID_Patient()); markers.add("vteID"); values.add(vteAssessmentRef.getID_VTERiskAssessment()); List<?> list = factory.find(hql, markers, values); if (list != null && list.size() > 0) return DischargedEpisodeForVTERiskAssessmentWorklistVoAssembler.createDischargedEpisodeForVTERiskAssessmentWorklistVoCollectionFromDischargedEpisode(list).get(0); return null; }