public AdmissionType getAdmissionTypeFromInpatientEpisode(PASEventRefVo pasEventRef) { if(pasEventRef == null || pasEventRef.getID_PASEvent()==null) throw new CodingRuntimeException("Cannot get PasEvent value on null pasEventRef."); StringBuffer hql = new StringBuffer("select inpEpisode from InpatientEpisode as inpEpisode left join inpEpisode.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 (InpatientEpisodeVoAssembler.create((InpatientEpisode) list.get(0))).getAdmissionType(); } return null; }
public InpatientEpisodeVo getInpatientEpisode(PASEventRefVo pasEventRef) { if(pasEventRef == null || pasEventRef.getID_PASEvent()==null) throw new CodingRuntimeException("Cannot get PasEvent value on null pasEventRef."); StringBuffer hql = new StringBuffer("select inpEpisode from InpatientEpisode as inpEpisode left join inpEpisode.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 InpatientEpisodeVoAssembler.create((InpatientEpisode) list.get(0)); } return null; }
public ims.core.vo.InpatientEpisodeVo transferPatient(PatientRefVo patVo, HcpRefVo hcp, LocationRefVo ward,Integer stay,LocationRefVo fromWard, DateTime transferDateTime, DateTime transactionDT, LookupInstVo specialty) throws ims.domain.exceptions.DomainInterfaceException, ims.domain.exceptions.StaleObjectException { if (patVo == null) { throw new DomainRuntimeException("Patient cannot be null!"); } InpatientEpisode ipDo = getCurrentAdmission(patVo); if (ipDo == null) { //Patient is not currently an inpatient, so ignore transfer event. return null; } performTransfer(ipDo, patVo, hcp, ward,stay,fromWard,transferDateTime,transactionDT,specialty); return InpatientEpisodeVoAssembler.create(ipDo); }
public InpatientEpisodeVo getInpatientEpisode(CatsReferralRefVo referral) { if (referral == null || referral.getID_CatsReferral() == null) throw new CodingRuntimeException("Logical error - provided referral is null or has no id"); DomainFactory factory = getDomainFactory(); String hql = "from InpatientEpisode as ip where (ip.isRIE is null and ip.pasEvent.id in (select cr.careContext.pasEvent.id from CatsReferral as cr where cr.id = :refID))"; ArrayList<String> paramNames = new ArrayList<String>(); paramNames.add("refID"); ArrayList<Object> paramValues = new ArrayList<Object>(); paramValues.add(referral.getID_CatsReferral()); return InpatientEpisodeVoAssembler.create((InpatientEpisode) factory.findFirst(hql, paramNames, paramValues)); }
public InpatientEpisodeVoCollection listInPatients(LocationRefVo refVoWard, MedicRefVo refVoMedic) { DomainFactory factory = getDomainFactory(); String hql; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); hql = " from InpatientEpisode ip "; StringBuffer condStr = new StringBuffer(); String andStr = " "; if (refVoWard != null) { condStr.append(andStr + " ip.pasEvent.location.id = :ward"); markers.add("ward"); values.add(refVoWard.getID_Location()); andStr = " and "; } if (refVoMedic != null) { condStr.append(andStr + " ip.pasEvent.consultant.id = :cons"); markers.add("cons"); values.add(refVoMedic.getID_Hcp()); andStr = " and "; } if (andStr.equals(" and ")) { hql += " where "; } hql += condStr.toString(); List ips = factory.find(hql, markers, values); return InpatientEpisodeVoAssembler.createInpatientEpisodeVoCollectionFromInpatientEpisode(ips); }
public void saveInpatientEpisodes(InpatientEpisodeVoCollection collInpatientEpisodeVo, MemberOfStaffShortVo mos) throws DomainInterfaceException, StaleObjectException { for(int i=0; i<collInpatientEpisodeVo.size(); i++){ if (!collInpatientEpisodeVo.get(i).isValidated()) { throw new DomainRuntimeException("Episode VO has not been validated!"); } DomainFactory factory = getDomainFactory(); InpatientEpisode ipDo = InpatientEpisodeVoAssembler.extractInpatientEpisode(factory, collInpatientEpisodeVo.get(i)); factory.save(ipDo); saveDocumentStatus(collInpatientEpisodeVo.get(i).getPasEvent().getCspDocumentStatus(), collInpatientEpisodeVo.get(i).getPasEvent(), mos); } }
/** * listInpatients By Ward or Hospital */ public ims.core.vo.InpatientEpisodeVoCollection listInpatientsByWard(ims.core.vo.LocShortMappingsVo ward) { DomainFactory factory = getDomainFactory(); if (ward == null) throw new CodingRuntimeException("ward must be specified for listInpatients by Ward"); String hql = " from InpatientEpisode i where i.pasEvent.location.id = " + ward.getID_Location(); List lstIPEpisodes = factory.find(hql); return InpatientEpisodeVoAssembler.createInpatientEpisodeVoCollectionFromInpatientEpisode(lstIPEpisodes); }
public InpatientEpisodeVo getInpatientEpisode(PatientRefVo patrefVo) { if(patrefVo == null) return null; DomainFactory factory = getDomainFactory(); return InpatientEpisodeVoAssembler.create(getInpatientEpis(factory,patrefVo)); }
public void saveInpatientEpisode(InpatientEpisodeVo inpatEpis) throws StaleObjectException { if (inpatEpis == null) throw new CodingRuntimeException("inpatEpis is null in method saveInpatientEpisode"); if (!inpatEpis.isValidated()) throw new CodingRuntimeException("inpatEpis has not been validated in method saveInpatientEpisode"); DomainFactory factory = getDomainFactory(); factory.save(InpatientEpisodeVoAssembler.extractInpatientEpisode(factory, inpatEpis)); }
public InpatientEpisodeVo getInpatientEpisode(InpatientEpisodeRefVo iprefVo) { if (iprefVo == null) throw new CodingRuntimeException("Can not search on ipRefvo value"); DomainFactory factory = getDomainFactory(); return InpatientEpisodeVoAssembler.create((InpatientEpisode) factory.getDomainObject(InpatientEpisode.class, iprefVo.getID_InpatientEpisode())); }
public InpatientEpisodeVo getInpatientEpisode(PatientRefVo patRefVo) { DomainFactory factory = getDomainFactory(); ims.core.patient.domain.objects.Patient domPatient = (ims.core.patient.domain.objects.Patient)factory.getDomainObject(ims.core.patient.domain.objects.Patient.class, patRefVo.getID_Patient().intValue()); String hql = "from InpatientEpisode ip where ip.pasEvent.patient.id = :pat"; List<?> l = factory.find(hql, new String[] {"pat"}, new Object[] {domPatient.getId()}); if (l != null && l.size() > 0) return InpatientEpisodeVoAssembler.create((InpatientEpisode) l.get(0)); return null; }
public InpatientEpisodeVo getInpatientEpisode(PatientRefVo patient) { if(patient == null || patient.getID_Patient() == null) throw new CodingRuntimeException("Cannot get InpatientEpisode for a null Patient Id."); DomainFactory factory = getDomainFactory(); String query = "select ip from InpatientEpisode ip left join ip.pasEvent as pe left join pe.patient as p where p.id = :PatientId"; List<?> listInpatient = factory.find(query, new String[] {"PatientId"}, new Object[] {patient.getID_Patient()}); if(listInpatient != null && listInpatient.size() > 0) return InpatientEpisodeVoAssembler.create((InpatientEpisode) listInpatient.get(0)); return null; }
/** * @param clinicalContact * @return */ private InpatientEpisodeVo getCurrentInpatientEpisode(ClinicalContactShortVo voClinicalContact) { DomainFactory factory = getDomainFactory(); String hql = "from InpatientEpisode ip where ip.pasEvent = (select event.id from PASEvent as event join event.clinicalContact contact where contact.id = :clinicalContact)"; List l = factory.find(hql, new String[] {"clinicalContact"}, new Object[] {voClinicalContact.getID_ClinicalContact()}); if (l != null && l.size() > 0) { return InpatientEpisodeVoAssembler.create((InpatientEpisode)l.get(0)); } return null; }
public InpatientEpisodeVo saveInpatientBedNumber(InpatientEpisodeWithICPInfoVo ipVo) throws StaleObjectException { if(ipVo == null) throw new CodingRuntimeException("Invalid ipVo"); if(!ipVo.isValidated()) throw new CodingRuntimeException("ipVo not validated"); DomainFactory factory = getDomainFactory(); InpatientEpisode domainObject = InpatientEpisodeWithICPInfoVoAssembler.extractInpatientEpisode(factory, ipVo); factory.save(domainObject); return InpatientEpisodeVoAssembler.create(domainObject); }
public void cancelTransfer(PendingTransfersLiteVo voTransfer, LocationRefVo voCancellingFromWard) throws StaleObjectException, ForeignKeyViolationException { if (voTransfer == null || voTransfer.getID_PendingTransfers() == null) throw new CodingRuntimeException("voTransfer is null or id not provided in method cancelTransfer"); //WDEV-10421 - get the admission detail record and update its history for transfers PendingTransfers doPending = (PendingTransfers) getDomainFactory().getDomainObject(voTransfer); if (doPending == null || doPending.getVersion() > voTransfer.getVersion_PendingTransfers()) //WDEV-20326 throw new StaleObjectException(doPending, "This transfer has been processed by another user"); AdmissionDetail doAdmissionDetail = populateTransferHistory(doPending, TRANSFERCANCEL, voCancellingFromWard, voTransfer.getCancellationReasonDetails()); // WDEV-19774 - Trigger creation of A26 Cancel Pending Transfer HL7 message InpatientEpisodeVo inpatEpisodeVo = InpatientEpisodeVoAssembler.create(doPending.getInpatientEpisode()); if(inpatEpisodeVo.getPasEvent()!=null) { ADT adtimpl = (ADT) getDomainImpl(ADTImpl.class); adtimpl.triggerCancelPendingTransferEvent(inpatEpisodeVo.getPasEvent()); } //WDEV-19974 getDomainFactory().delete("from PendingTransfers p where p.id = '" + voTransfer.getID_PendingTransfers() + "'"); //WDEV-10421 if(doAdmissionDetail != null) getDomainFactory().save(doAdmissionDetail); }
public void updateAdmissionDetail(InpatientEpisodeRefVo inpatEpisodeRef, AdmissionDetailVo currentAdmission, AdmissionDetailForADTUpdateAdmissionVo admissionUpdatesVo) throws StaleObjectException { if (currentAdmission == null) throw new CodingRuntimeException("AdmissionDetailVo argument cannot be null in method updateAdmissionDetail()"); if (admissionUpdatesVo == null) throw new CodingRuntimeException("AdmissionDetailForADTUpdateAdmissionVo argument cannot be null in method updateAdmissionDetail()"); if (inpatEpisodeRef == null) throw new CodingRuntimeException("InpatientEpisodeRefVo argument cannot be null in method updateAdmissionDetail()"); ADT impl = (ADT) getDomainImpl(ADTImpl.class); DomainFactory dfact = getDomainFactory(); InpatientEpisode domainObjectInpat = (InpatientEpisode)dfact.getDomainObject(InpatientEpisode.class, inpatEpisodeRef.getID_InpatientEpisode()); if (domainObjectInpat == null) throw new StaleObjectException(domainObjectInpat); InpatientEpisodeVo inpatientRecord = InpatientEpisodeVoAssembler.create(domainObjectInpat); if (inpatientRecord != null) { inpatientRecord = updateInpatientRecord(inpatientRecord,currentAdmission,admissionUpdatesVo); String[] err = inpatientRecord.validate(); if (err != null) { throw new CodingRuntimeException("InpatientEpisodeVo object has validation errors in method updateAdmissionDetail()"); } impl.updateInpatient(inpatientRecord, null, false); if (inpatientRecord.getPasEvent()!= null) { PASEvent domainObjectPASEvent = (PASEvent)dfact.getDomainObject(PASEvent.class, inpatientRecord.getPasEvent().getID_PASEvent()); impl.triggerUpdateAdmissionEvent(new PASEventRefVo(domainObjectPASEvent.getId(), domainObjectPASEvent.getVersion()),MsgUpdateType.ADMISSION);//http://jira/browse/WDEV-22831 } } }