public AdmissionType getAdmissionTypeFromDischargedEpisode(PASEventRefVo pasEventRef) { if(pasEventRef == null || pasEventRef.getID_PASEvent()==null) throw new CodingRuntimeException("Cannot get PasEvent value on null pasEventRef."); StringBuffer hql = new StringBuffer("select dischEpisode from DischargedEpisode as dischEpisode left join dischEpisode.pasEvent as pasEvent where pasEvent.id= :pasEventID "); DomainFactory factory = getDomainFactory(); List<?> list = factory.find(hql.toString(), new String[] {"pasEventID"}, new Object[] {pasEventRef.getID_PASEvent()}); if (list!=null && list.size()>0) { return (DischargedEpisodeVoAssembler.create((DischargedEpisode) list.get(0))).getAdmissionType(); } return null; }
public DischargedEpisodeVo getDischargeEpisodeByAdmissionDetail(AdmissionDetailRefVo admDetRef) { if( admDetRef == null ) throw new CodingRuntimeException("AdmissionDetailRefVo is null"); DomainFactory factory = getDomainFactory(); String hql = " select d1_1 from DischargedEpisode as d1_1 left join d1_1.admissionDetail as a1_1 where (d1_1.admissionDetail.id = :idAdmissionDet ) order by d1_1.systemInformation.creationDateTime desc "; List<?> lst = factory.find(hql,new String[]{"idAdmissionDet"},new Object[]{admDetRef.getID_AdmissionDetail()}); if (lst != null && lst.size() > 0) { DischargedEpisodeVoCollection tempColl = DischargedEpisodeVoAssembler.createDischargedEpisodeVoCollectionFromDischargedEpisode(lst) ; if(tempColl != null && tempColl.size() > 0) { return tempColl.get(0); } } return null; }
public DischargedEpisodeVo getDischargedEpisodeDetails(CareContextRefVo ccRefVo, PatientRefVo voPatRefVo) { DomainFactory factory = getDomainFactory(); CareContextVo voCC = CareContextVoAssembler.create((CareContext)factory.getDomainObject(CareContext.class, ccRefVo.getID_CareContext())); if (voCC.getPasEvent() == null) { return null; } String hql = "from DischargedEpisode de " + " where de.pasEvent.patient.id = :patId " + " and de.pasEvent.id = :eventId "; ArrayList<String> labels = new ArrayList<String>(); labels.add("patId"); labels.add("eventId"); ArrayList<Object> values = new ArrayList<Object>(); values.add(voPatRefVo.getID_Patient()); values.add(voCC.getPasEvent().getID_PASEvent()); List<?> l = factory.find(hql, labels, values); if (l != null && l.size() > 0) { if (l.size() > 1) throw new DomainRuntimeException("Duplicate data found for Patient and PasEvent"); DischargedEpisodeVoCollection voColl = DischargedEpisodeVoAssembler.createDischargedEpisodeVoCollectionFromDischargedEpisode(l); return voColl.get(0); } return null; }
public void saveDischargeEpisodes(DischargedEpisodeVoCollection collDischargedEpisodeVo, MemberOfStaffShortVo mos) throws DomainInterfaceException, StaleObjectException { for(int i=0; i<collDischargedEpisodeVo.size(); i++){ if (!collDischargedEpisodeVo.get(i).isValidated()) { throw new DomainRuntimeException("Episode VO has not been validated!"); } DomainFactory factory = getDomainFactory(); DischargedEpisode diDo = DischargedEpisodeVoAssembler.extractDischargedEpisode(factory, collDischargedEpisodeVo.get(i)); factory.save(diDo); saveDocumentStatus(collDischargedEpisodeVo.get(i).getPasEvent().getCspDocumentStatus(), collDischargedEpisodeVo.get(i).getPasEvent(), mos); } }
private DischargedEpisode getCurrentDischargeRecord(DomainFactory factory, PatientShort patVo, DischargedEpisodeVo dischEpisVo) { ims.core.patient.domain.objects.Patient domPatient = (ims.core.patient.domain.objects.Patient)factory.getDomainObject(ims.core.patient.domain.objects.Patient.class, patVo.getID_Patient().intValue()); DischargedEpisode disEpisBo = DischargedEpisodeVoAssembler.extractDischargedEpisode(factory, dischEpisVo); PASEvent peDo = disEpisBo.getPasEvent(); String hql = "from DischargedEpisode de " + " where de.pasEvent.patient = :pat " + " and de.pasEvent.pasEventId = :eventId "; ArrayList<String> labels = new ArrayList<String>(); labels.add("pat"); labels.add("eventId"); ArrayList<Object> values = new ArrayList<Object>(); values.add(domPatient); values.add(peDo.getPasEventId()); if (disEpisBo.getDischargeDateTime() != null) { hql +=" and de.dischargeDateTime = :disDate"; labels.add("disDate"); values.add(disEpisBo.getDischargeDateTime()); } List<?> l = factory.find(hql, labels, values); if (l != null && l.size() > 0) { if (l.size() > 1) throw new DomainRuntimeException("Duplicate data found for Patient, PasEvent and DateTime"); return (DischargedEpisode) l.get(0); } return null; }
public DischargedEpisodeVo getDischargeEpisodeById(DischargedEpisodeRefVo dischargeEpisodeRef) { if( dischargeEpisodeRef == null) throw new CodingRuntimeException("This DischargedEpisodeRefVo is null"); DomainFactory factory = getDomainFactory(); DischargedEpisode doDischargedEpisode = (DischargedEpisode) factory.getDomainObject(DischargedEpisode.class, dischargeEpisodeRef.getID_DischargedEpisode()); return DischargedEpisodeVoAssembler.create(doDischargedEpisode); }
public DischargeAndPASEventForReferralCodingVoCollection listPASEvents(CatsReferralRefVo voCatsReferralRef) { if (ConfigFlag.DOM.REFERRAL_CODING_SOURCE.getValue().equals(REFERRAL_CODING_SOURCE_DISCHARGE)) { DomainFactory factory = getDomainFactory(); String hql = "SELECT dspw from DischargeSummaryPacuAndWard dspw where dspw.catsReferral.id = :catsId"; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); markers.add("catsId"); values.add(voCatsReferralRef.getID_CatsReferral()); return DischargeAndPASEventForReferralCodingVoAssembler.createDischargeAndPASEventForReferralCodingVoCollectionFromDischargeSummaryPacuAndWard(factory.find(hql,markers,values)).sort(); } else if (ConfigFlag.DOM.REFERRAL_CODING_SOURCE.getValue().equals(REFERRAL_CODING_SOURCE_ADMISSIONS)) { String query = "SELECT de FROM CatsReferral AS ref LEFT JOIN ref.admissions AS adm, DischargedEpisode AS de RIGHT JOIN de.admissionDetail AS addet WHERE addet.id = adm.id AND ref.id = :CATS_ID AND de is not null"; DischargedEpisodeVoCollection dischargedEpisodes = DischargedEpisodeVoAssembler.createDischargedEpisodeVoCollectionFromDischargedEpisode(getDomainFactory().find(query, "CATS_ID", voCatsReferralRef.getID_CatsReferral())); DischargeAndPASEventForReferralCodingVoCollection results = new DischargeAndPASEventForReferralCodingVoCollection(); for (DischargedEpisodeVo episode : dischargedEpisodes) { DischargeAndPASEventForReferralCodingVo result = new DischargeAndPASEventForReferralCodingVo(); result.setCatsReferral(voCatsReferralRef); result.setDischargeEpisode(episode); // result.setDischargeDateTime(episode.getDischargeDateTime()); results.add(result); } return results; } return null; }
public DischargedEpisodeVo getDischargedEpisode(DischargedEpisodeRefVo dischargedEpisodeRef) { if (dischargedEpisodeRef == null || !dischargedEpisodeRef.getID_DischargedEpisodeIsNotNull()) return null; return DischargedEpisodeVoAssembler.create((DischargedEpisode) getDomainFactory().getDomainObject(DischargedEpisode.class, dischargedEpisodeRef.getID_DischargedEpisode())); }
public DischargeAndPASEventForReferralCodingVoCollection listPASEvents(CatsReferralRefVo voCatsReferralRef) { if (ConfigFlag.DOM.REFERRAL_CODING_SOURCE.getValue().equals(REFERRAL_CODING_SOURCE_DISCHARGE)) { DomainFactory factory = getDomainFactory(); String hql = "SELECT dspw from DischargeSummaryPacuAndWard dspw where dspw.catsReferral.id = :catsId"; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); markers.add("catsId"); values.add(voCatsReferralRef.getID_CatsReferral()); return DischargeAndPASEventForReferralCodingVoAssembler.createDischargeAndPASEventForReferralCodingVoCollectionFromDischargeSummaryPacuAndWard(factory.find(hql, markers, values)).sort(); } else if (ConfigFlag.DOM.REFERRAL_CODING_SOURCE.getValue().equals(REFERRAL_CODING_SOURCE_ADMISSIONS)) { String query = "SELECT de FROM CatsReferral AS ref LEFT JOIN ref.admissions AS adm, DischargedEpisode AS de RIGHT JOIN de.admissionDetail AS addet WHERE addet.id = adm.id AND ref.id = :CATS_ID AND de is not null"; DischargedEpisodeVoCollection dischargedEpisodes = DischargedEpisodeVoAssembler.createDischargedEpisodeVoCollectionFromDischargedEpisode(getDomainFactory().find(query, "CATS_ID", voCatsReferralRef.getID_CatsReferral())); DischargeAndPASEventForReferralCodingVoCollection results = new DischargeAndPASEventForReferralCodingVoCollection(); for (DischargedEpisodeVo episode : dischargedEpisodes) { DischargeAndPASEventForReferralCodingVo result = new DischargeAndPASEventForReferralCodingVo(); result.setCatsReferral(voCatsReferralRef); result.setDischargeEpisode(episode); result.setDischargeDateTime(episode.getDischargeDateTime()); results.add(result); } return results; } return null; }
public DischargedEpisodeVo getCurrentDischarge(PatientShort patVo, DischargedEpisodeVo dischEpisVo) { DomainFactory factory = getDomainFactory(); DischargedEpisode domDischarge = getCurrentDischargeRecord(factory, patVo, dischEpisVo); return (DischargedEpisodeVoAssembler.create(domDischarge)); }