public InpatientEpisodeForVTERiskAsessmentVo getInpatientEpisodes( PASEventRefVo pasRefVo) { if(pasRefVo == null ) throw new CodingRuntimeException("Pas Event not provided"); DomainFactory factory = getDomainFactory(); List inpat = factory.find("select i1_1 from InpatientEpisode as i1_1 left join i1_1.pasEvent as p1_1 where p1_1.id =:idPasEvent", new String[] {"idPasEvent"}, new Object[] {pasRefVo.getID_PASEvent()}); if( inpat != null && inpat.size() > 0) { InpatientEpisodeForVTERiskAsessmentVoCollection tempColl = InpatientEpisodeForVTERiskAsessmentVoAssembler.createInpatientEpisodeForVTERiskAsessmentVoCollectionFromInpatientEpisode(inpat).sort(SortOrder.DESCENDING); if(tempColl != null && tempColl.size() > 0) return tempColl.get(0); } return null; }
public InpatientEpisodeForVTERiskAsessmentVo getInpatEpisodeForVTERiskAssessment( InpatientEpisodeRefVo inpatEpRef) { if( inpatEpRef == null ) return null; DomainFactory factory = getDomainFactory(); InpatientEpisode doInpatientEpisode =(InpatientEpisode) factory.getDomainObject(InpatientEpisode.class, inpatEpRef.getID_InpatientEpisode()); return InpatientEpisodeForVTERiskAsessmentVoAssembler.create(doInpatientEpisode); }
public InpatientEpisodeForVTERiskAsessmentVo saveInpatientEpisode(InpatientEpisodeForVTERiskAsessmentVo inpatientEpisode) throws StaleObjectException, UniqueKeyViolationException { if (inpatientEpisode == null) { throw new DomainRuntimeException("Inpatient Episode cannot be null"); } DomainFactory factory = getDomainFactory(); InpatientEpisode doInpatientEpisode = InpatientEpisodeForVTERiskAsessmentVoAssembler.extractInpatientEpisode(factory, inpatientEpisode); factory.save(doInpatientEpisode); return InpatientEpisodeForVTERiskAsessmentVoAssembler.create(doInpatientEpisode); }
/** * A list of all the occupied beds and associated inpatients across a ward */ public WardDataViewVoCollection listInpatientsInBedsByWard(LocationRefVo ward) { if (ward == null || ward.getID_Location() == null) throw new CodingRuntimeException("ward is null or id not provided in method listInpatientsInBedsByWard"); WardDataViewVoCollection voCollWdv = new WardDataViewVoCollection(); String hql = "select bed, pat, bay, pe,inpatEpis from BedSpaceState as bedSpaceState left join bedSpaceState.bedSpace as bed left join bedSpaceState.currentBedStatus as currentStatus left join bedSpaceState.inpatientEpisode as inpatEpis left join inpatEpis.pasEvent as pe left join pe.patient as pat left join bedSpaceState.bay as bay " + "where (bedSpaceState.ward.id = :wardId and bedSpaceState.inpatientEpisode is not null and currentStatus.bedStatus = :occupied)"; List wdvList = getDomainFactory().find(hql, new String[]{"wardId","occupied"}, new Object[]{ward.getID_Location(), getDomLookup(BedStatus.OCCUPIED)}); if(wdvList != null && wdvList.size() > 0) { Iterator it = wdvList.iterator(); while(it.hasNext()) { Object[] item = (Object[])it.next(); BedSpace doBed = (BedSpace) item[0]; Patient doPat = (Patient) item[1]; Location doBay = (Location) item[2]; PASEvent doPe = (PASEvent) item[3]; InpatientEpisode doInpat = (InpatientEpisode) item[4]; //wdev-14784 WardDataViewVo voWardDv = new WardDataViewVo(); voWardDv.setBed(BedSpaceVoAssembler.create(doBed)); voWardDv.setBay(LocationLiteVoAssembler.create(doBay)); voWardDv.setPatient(PatientShortAssembler.create(doPat)); voWardDv.getPatient().setHasAlerts(doPat.getPatientAlerts() != null && doPat.getPatientAlerts().size() > 0 ? true : false); voWardDv.setInpatEpisode(InpatientEpisodeForVTERiskAsessmentVoAssembler.create(doInpat)); //wdev-14784 //wdev-11083 Iterator<ims.core.clinical.domain.objects.PatientAlert> patAlert = doPat.getPatientAlerts().iterator(); boolean flagHasAlerts = false; while(patAlert != null && patAlert.hasNext()) { if(Boolean.TRUE.equals(patAlert.next().isIsCurrentlyActiveAlert())) { flagHasAlerts = true; break; } } voWardDv.getPatient().setHasActiveAlerts(flagHasAlerts); //end wdev-11083 voWardDv.setPasEvent(PasEventADTVoAssembler.create(doPe)); voCollWdv.add(voWardDv); } } voCollWdv.sort(); return voCollWdv; }
public InpatientEpisodeForVTERiskAsessmentVo getVteStatus(Integer pasId) { if (pasId == null) throw new CodingRuntimeException("Cannot get VTE Status on null pasEvent ID"); DomainFactory factory = getDomainFactory(); String hql = "select inp from InpatientEpisode as inp left join inp.pasEvent as pasEv where pasEv.id = :pasID"; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); markers.add("pasID"); values.add(pasId); List<?> list = factory.find(hql.toString(), markers, values); if (list == null || list.size() == 0) return null; return InpatientEpisodeForVTERiskAsessmentVoAssembler.createInpatientEpisodeForVTERiskAsessmentVoCollectionFromInpatientEpisode(list).get(0); }
/** * A list of all the occupied beds and associated inpatients across a ward */ public WardDataViewVoCollection listInpatientsInBedsByWard(LocationRefVo ward) { if (ward == null || ward.getID_Location() == null) throw new CodingRuntimeException("ward is null or id not provided in method listInpatientsInBedsByWard"); WardDataViewVoCollection voCollWdv = new WardDataViewVoCollection(); String hql = "select bed, pat, bay, pe,inpatEpis from BedSpaceState as bedSpaceState left join bedSpaceState.bedSpace as bed left join bedSpaceState.currentBedStatus as currentStatus left join bedSpaceState.inpatientEpisode as inpatEpis left join inpatEpis.pasEvent as pe left join pe.patient as pat left join bedSpaceState.bay as bay " + "where (bedSpaceState.ward.id = :wardId and bedSpaceState.inpatientEpisode is not null and currentStatus.bedStatus = :occupied)"; List wdvList = getDomainFactory().find(hql, new String[]{"wardId","occupied"}, new Object[]{ward.getID_Location(), getDomLookup(BedStatus.OCCUPIED)}); if(wdvList != null && wdvList.size() > 0) { Iterator it = wdvList.iterator(); while(it.hasNext()) { Object[] item = (Object[])it.next(); BedSpace doBed = (BedSpace) item[0]; Patient doPat = (Patient) item[1]; Location doBay = (Location) item[2]; PASEvent doPe = (PASEvent) item[3]; InpatientEpisode doInpat = (InpatientEpisode) item[4]; //wdev-14784 WardDataViewVo voWardDv = new WardDataViewVo(); voWardDv.setBed(BedSpaceVoAssembler.create(doBed)); voWardDv.setBay(LocationLiteVoAssembler.create(doBay)); voWardDv.setPatient(PatientLite_IdentifiersVoAssembler.create(doPat)); voWardDv.getPatient().setHasAlerts(doPat.getPatientAlerts() != null && doPat.getPatientAlerts().size() > 0 ? true : false); voWardDv.setInpatEpisode(InpatientEpisodeForVTERiskAsessmentVoAssembler.create(doInpat)); //wdev-14784 //wdev-11083 Iterator<ims.core.clinical.domain.objects.PatientAlert> patAlert = doPat.getPatientAlerts().iterator(); boolean flagHasAlerts = false; while(patAlert != null && patAlert.hasNext()) { if(Boolean.TRUE.equals(patAlert.next().isIsCurrentlyActiveAlert())) { flagHasAlerts = true; break; } } voWardDv.getPatient().setHasAlerts(flagHasAlerts); //end wdev-11083 voWardDv.setPasEvent(PasEventADTVoAssembler.create(doPe)); voCollWdv.add(voWardDv); } } voCollWdv.sort(); return voCollWdv; }
public InpatientEpisodeForVTERiskAsessmentVo getInpatientEpisode(PatientRefVo patient) { if (patient == null) throw new DomainRuntimeException("Cannot get Patient on null Id."); DomainFactory factory = getDomainFactory(); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); String hql = " select ip from InpatientEpisode as ip left join ip.pasEvent as pasEvent left join pasEvent.patient as patient where patient.id = :patientId"; markers.add("patientId"); values.add(patient.getID_Patient()); List<?> list = factory.find(hql, markers, values); if (list != null && list.size() > 0) return InpatientEpisodeForVTERiskAsessmentVoAssembler.createInpatientEpisodeForVTERiskAsessmentVoCollectionFromInpatientEpisode(list).get(0); return null; }
public InpatientEpisodeForVTERiskAsessmentVo getInpatientEpisodeForRecord(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 inpatEp from InpatientEpisode as inpatEp left join inpatEp.pasEvent as pasEv left join pasEv.patient as pat left join inpatEp.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 InpatientEpisodeForVTERiskAsessmentVoAssembler.createInpatientEpisodeForVTERiskAsessmentVoCollectionFromInpatientEpisode(list).get(0); return null; }