public VTERiskAssessmentWorklistVo getVTERiskAssessmentWorklistById(InpatientEpisodeRefVo inpatEpRef) { if( inpatEpRef == null ) return null; DomainFactory factory = getDomainFactory(); InpatientEpisode doInpatientEpisode =(InpatientEpisode) factory.getDomainObject(InpatientEpisode.class, inpatEpRef.getID_InpatientEpisode()); return VTERiskAssessmentWorklistVoAssembler.create(doInpatientEpisode); }
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 getInpatientEpisodeForVTE(InpatientEpisodeRefVo inpatientEpisodeRef) { if(inpatientEpisodeRef == null) throw new CodingRuntimeException("Cannot get InpatientEpisode on null Id."); return (IVTERiskAssessment) VTERiskAssessmentWorklistVoAssembler.create((InpatientEpisode) getDomainFactory().getDomainObject(InpatientEpisode.class, inpatientEpisodeRef.getID_InpatientEpisode())); }
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; }