private void populateConsultantTransferTabFromData() { form.lyrDetail().tabTransfer().lyrTransfer().tabConsultant().lblCurrentCons().setValue(""); BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState(); if(voBedSpaceState != null) { if(voBedSpaceState.getInpatientEpisodeIsNotNull() && voBedSpaceState.getInpatientEpisode().getPasEventIsNotNull() && voBedSpaceState.getInpatientEpisode().getPasEvent().getConsultantIsNotNull()) form.lyrDetail().tabTransfer().lyrTransfer().tabConsultant().lblCurrentCons().setValue(voBedSpaceState.getInpatientEpisode().getPasEvent().getConsultant().getIMosName()); } else if (form.getGlobalContext().Core.getSelectedWaitingAreaPatientIsNotNull()) { InPatientEpisodeADTVo voEpisode = domain.getInpatientEpisode(form.getGlobalContext().Core.getSelectedWaitingAreaPatient()); if (voEpisode != null && voEpisode.getPasEventIsNotNull() && voEpisode.getPasEvent().getConsultantIsNotNull()) //WDEV-16004 form.lyrDetail().tabTransfer().lyrTransfer().tabConsultant().lblCurrentCons().setValue(voEpisode.getPasEvent().getConsultant().getIMosName()); } form.lyrDetail().tabTransfer().lyrTransfer().tabConsultant().ccConsultantAccepting().initialize(MosType.MEDIC); form.lyrDetail().tabTransfer().lyrTransfer().tabConsultant().ccConsultantAccepting().isRequired(true); form.lyrDetail().tabTransfer().lyrTransfer().tabConsultant().dtimConsultantTransfer().setValue(new DateTime()); }
private String getPatientIdValue(InPatientEpisodeADTVo inpatientEpisode, PatIdType type) { if(inpatientEpisode == null) return null; if(inpatientEpisode.getPasEvent() != null && inpatientEpisode.getPasEvent().getPatient() != null && inpatientEpisode.getPasEvent().getPatient().getIdentifiers() != null) { Iterator it = inpatientEpisode.getPasEvent().getPatient().getIdentifiers().iterator(); while(it.hasNext()) { ims.core.vo.PatientId patId = (ims.core.vo.PatientId) it.next(); if(patId.getType().getId() == getDomLookup(type).getId()) return patId.getValue(); } } return null; }
private InPatientEpisodeADTVo populateEpisodeDataFromScreen(InPatientEpisodeADTVo voEpisode) { if (voEpisode == null) throw new CodingRuntimeException("voEpisode is null in method populateEpisodeDataFromTransferInTab"); if (voEpisode.getPasEventIsNotNull()) { if (form.ccConsultant().getValue() instanceof MedicVo) { voEpisode.getPasEvent().setConsultant((MedicVo)form.ccConsultant().getValue()); } voEpisode.getPasEvent().setService(form.qmbService().getValue()); voEpisode.getPasEvent().setSpecialty(form.cmbSpecialty().getValue()); voEpisode.getPasEvent().setLocation(form.getLocalContext().getSelectedPendingTransfer().getDestinationWard()); } //WDEV-20134 InPatientEpisodeADTVo voEpisodeToSave = addNewWardStayAndUpdateCurrent(voEpisode); voEpisodeToSave.setEstDischargeDate(form.dtimEstDischarge().getValue()); voEpisodeToSave.setWardType(form.cmbWardType().getValue()); voEpisode.setBed(null); //WDEV-20291 transfer no bed return voEpisodeToSave; }
private HomeLeaveVo getLatestClosedHomeLeaveForEpisode(InpatientEpisode doInpat) { if (doInpat.getHomeLeaves() == null || doInpat.getHomeLeaves().size() == 0) return null; InPatientEpisodeADTVo voEpisode = InPatientEpisodeADTVoAssembler.create(doInpat); if (voEpisode != null) { for (int i=voEpisode.getHomeLeaves().size()-1;i>=0;i--) { if (voEpisode.getHomeLeaves().get(i).getDateReturnedFromHomeLeave() == null) voEpisode.getHomeLeaves().remove(i); } voEpisode.getHomeLeaves().sort(HomeLeaveVo.getDateOnHomeLeaveComparator(SortOrder.DESCENDING)); if (voEpisode.getHomeLeaves().size() > 0 && voEpisode.getHomeLeaves().get(0) != null) return voEpisode.getHomeLeaves().get(0); } return null; }
private WardStayVo getLastClosedWardStay(InPatientEpisodeADTVo inpatientEpisode) { if (inpatientEpisode == null || inpatientEpisode.getWardStays() == null || inpatientEpisode.getWardStays().size() ==0) return null; WardStayVoCollection wardStaysColl = inpatientEpisode.getWardStays(); for (int i=wardStaysColl.size()-1;i>=0;i--) { if (wardStaysColl.get(i) != null && wardStaysColl.get(i).getTransferOutDateTime() == null) { wardStaysColl.remove(i); } } if (wardStaysColl.size() > 0) { wardStaysColl.sort(WardStayVo.getWardStayVoIdComparator(SortOrder.DESCENDING)); return wardStaysColl.get(0); } return null; }
private InPatientEpisodeADTVo populateHomeLeaveInfo(InPatientEpisodeADTVo voEpisode) { if (voEpisode == null) throw new CodingRuntimeException("voEpisode is null in method populateHomeLeaveInfo"); return voEpisode; }
private InPatientEpisodeADTVo populateEpisodeDataFromTransferInTab(InPatientEpisodeADTVo voEpisode) { if (voEpisode == null) throw new CodingRuntimeException("voEpisode is null in method populateEpisodeDataFromTransferInTab"); if (voEpisode.getPasEventIsNotNull()) { voEpisode.getPasEvent().setConsultant(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().ccInConsultant().getValue()); if(ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("CCO")) { voEpisode.getPasEvent().setSpecialty(domain.getCCOSpecialtyMappingFromPASSpecialty(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbCCOInSpecialty().getValue())); voEpisode.getPasEvent().setPASSpecialty(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbCCOInSpecialty().getValue()); } else voEpisode.getPasEvent().setSpecialty(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbInSpecialty().getValue()); if (form.lyrDetail().tabTransfer().lyrTransfer().tabIn().grdTransferIn().getValue() != null) voEpisode.getPasEvent().setLocation(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().grdTransferIn().getValue().getDestinationWard()); } WardStayVo voWardStay = new WardStayVo(); voWardStay.setTransferDateTime(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().dtimTransfer().getValue()); voWardStay.setBedSpace(form.getGlobalContext().Core.getSelectedBedSpaceState().getBedSpace()); if (form.lyrDetail().tabTransfer().lyrTransfer().tabIn().grdTransferIn().getValue() != null) voWardStay.setWard(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().grdTransferIn().getValue().getDestinationWard()); voWardStay.setWardType(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbWardType().getValue()); if (voEpisode.getWardStays() == null) voEpisode.setWardStays(new WardStayVoCollection()); voEpisode.getWardStays().add(voWardStay); voEpisode.setEstDischargeDate(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().dteDischarge().getValue()); voEpisode.setWardType(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbWardType().getValue()); return voEpisode; }
/** * @method addConsultantStayIfNeeded * @comment does InpatientAssembler call also - MUST BE CALLED * */ private InpatientEpisode addConsultantStayIfNeeded(InPatientEpisodeADTVo inpatientEpisode) { if(inpatientEpisode == null) throw new CodingRuntimeException("inpatientEpisode is null in method addConsultantStayIfNeeded"); DomainFactory factory = getDomainFactory(); Medic doExistingCons = null; if(inpatientEpisode.getPasEventIsNotNull() && inpatientEpisode.getPasEvent().getBoId() != null) { PASEvent doExistingPe = (PASEvent)factory.getDomainObject(PASEvent.class, inpatientEpisode.getPasEvent().getBoId()); doExistingCons = doExistingPe != null ? doExistingPe.getConsultant() : null; } InpatientEpisode doInpat = InPatientEpisodeADTVoAssembler.extractInpatientEpisode(factory, inpatientEpisode); if(inpatientEpisode.getPasEventIsNotNull() && inpatientEpisode.getPasEvent().getConsultantIsNotNull()) { if(doExistingCons != null) { if(!doInpat.getPasEvent().getConsultant().equals(doExistingCons)) { ConsultantStay doConsStay = new ConsultantStay(); doConsStay.setConsultant(doInpat.getPasEvent().getConsultant()); doConsStay.setTransferDateTime(getMostRecentWardStayTransferDate(doInpat)); doInpat.getConsultantStays().add(doConsStay); } } } return doInpat; }
public InPatientEpisodeADTVo getInpatientEpisode(InpatientEpisodeRefVo inpatientEpisode) { if(inpatientEpisode == null || inpatientEpisode.getID_InpatientEpisode() == null) throw new CodingRuntimeException("inpatientEpisode is null or id not provided for getInpatientEpisode"); return InPatientEpisodeADTVoAssembler.create( (InpatientEpisode) getDomainFactory().getDomainObject(inpatientEpisode)); }
private void copyHomeleaveToDto(Homeleave homeLeaveRec, HomeLeaveVo voHomeLeave, InPatientEpisodeADTVo inpatientEpisode) { HomeleaveRecord hlRec = homeLeaveRec.DataCollection.get(0); hlRec.Pkey = getPatientIdValue(inpatientEpisode, PatIdType.PKEY); hlRec.Hospnum = getPatientIdValue(inpatientEpisode, PatIdType.HOSPNUM); InpatientEpisode doInpat = InPatientEpisodeADTVoAssembler.extractInpatientEpisode(getDomainFactory(), inpatientEpisode); hlRec.Rescode = doInpat.getPasEvent() != null && doInpat.getPasEvent().getLocation() != null ? doInpat.getPasEvent().getLocation().getExtCode(TaxonomyType.PAS.getID()) : null; hlRec.Mors = DTOHelper.getPasMapping(doInpat.getWardType()); hlRec.Leavedt = voHomeLeave.getDateOnHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateOnHomeLeave().getDate()) : ""; hlRec.Leavetm = voHomeLeave.getTimeOnHomeLeaveIsNotNull() ? voHomeLeave.getTimeOnHomeLeave().toString(TimeFormat.FLAT4) : ""; hlRec.Exdt = voHomeLeave.getExpectedDateOfReturnIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getExpectedDateOfReturn().getDate()) : ""; hlRec.Extm = voHomeLeave.getExpectedTimeOfReturnIsNotNull() ? voHomeLeave.getExpectedTimeOfReturn().toString(TimeFormat.FLAT4) : ""; if(hlRec.Mors.equals("M")) { if(doInpat.getPasEvent().getPatient().getSex() != null) { if(doInpat.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.MALE))) hlRec.Btyp = "M"; else if(doInpat.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.FEMALE))) hlRec.Btyp = "F"; else //defaulting Male for unknown sex hlRec.Btyp = "M"; } else //defaulting Male for unknown sex hlRec.Btyp = "M"; } else if(hlRec.Mors.equals("S")) hlRec.Btyp = "S"; hlRec.Hlfl = "Y"; //"Y" on an insert hlRec.Webadt = "Y"; }
private HomeLeaveVo getLatestClosedHomeLeaveForEpisode(InPatientEpisodeADTVo voEpisode) { if (voEpisode.getHomeLeaves() == null || voEpisode.getHomeLeaves().size() == 0) return null; for (int i=voEpisode.getHomeLeaves().size()-1;i>=0;i--) { if (voEpisode.getHomeLeaves().get(i).getDateReturnedFromHomeLeave() == null) voEpisode.getHomeLeaves().remove(i); } voEpisode.getHomeLeaves().sort(HomeLeaveVo.getDateOnHomeLeaveComparator(SortOrder.DESCENDING)); if (voEpisode.getHomeLeaves().size() > 0 && voEpisode.getHomeLeaves().get(0) != null) return voEpisode.getHomeLeaves().get(0); return null; }
private InPatientEpisodeADTVo populateEpisodeDataFromTransferInTab(InPatientEpisodeADTVo voEpisode) { if (voEpisode == null) throw new CodingRuntimeException("voEpisode is null in method populateEpisodeDataFromTransferInTab"); if (voEpisode.getPasEventIsNotNull()) { if (form.lyrDetail().tabTransfer().lyrTransfer().tabIn().ccInConsultant().getValue() instanceof MedicVo) voEpisode.getPasEvent().setConsultant((MedicVo) form.lyrDetail().tabTransfer().lyrTransfer().tabIn().ccInConsultant().getValue()); if(ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("CCO")) { voEpisode.getPasEvent().setSpecialty(domain.getCCOSpecialtyMappingFromPASSpecialty(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbCCOInSpecialty().getValue())); voEpisode.getPasEvent().setPASSpecialty(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbCCOInSpecialty().getValue()); } else voEpisode.getPasEvent().setSpecialty(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbInSpecialty().getValue()); if (form.lyrDetail().tabTransfer().lyrTransfer().tabIn().grdTransferIn().getValue() != null) { voEpisode.getPasEvent().setLocation(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().grdTransferIn().getValue().getDestinationWard()); voEpisode.getPasEvent().setService(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().qmbInService().getValue()); } } //WDEV-20134 InPatientEpisodeADTVo voEpisodeToSave = addNewWardStayAndUpdateCurrent(voEpisode); voEpisodeToSave.setEstDischargeDate(ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("MAXIMS") ? form.lyrDetail().tabTransfer().lyrTransfer().tabIn().dtimEstDischarge().getValue() : (form.lyrDetail().tabTransfer().lyrTransfer().tabIn().dteDischarge().getValue() != null ? new DateTime (form.lyrDetail().tabTransfer().lyrTransfer().tabIn().dteDischarge().getValue(), new Time(0,0)) : null)); voEpisodeToSave.setWardType(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbWardType().getValue()); return voEpisodeToSave; ////WDEV-20134 -- ends here }
private void populateConsultantTransferTabFromData() { form.lyrDetail().tabTransfer().lyrTransfer().tabConsultant().lblCurrentCons().setValue(""); BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState(); if(voBedSpaceState != null) { if(voBedSpaceState.getInpatientEpisodeIsNotNull() && voBedSpaceState.getInpatientEpisode().getPasEventIsNotNull() && voBedSpaceState.getInpatientEpisode().getPasEvent().getConsultantIsNotNull()) form.lyrDetail().tabTransfer().lyrTransfer().tabConsultant().lblCurrentCons().setValue(voBedSpaceState.getInpatientEpisode().getPasEvent().getConsultant().getIMosName()); ConsultantStayMinVo currentConsultantStay = domain.getCurrentConsultantStay(voBedSpaceState.getInpatientEpisode()); if (currentConsultantStay != null) { form.lyrDetail().tabTransfer().lyrTransfer().tabConsultant().cmbPatientCategoryConsultant().setValue(currentConsultantStay.getPatientStatus()); } } else if (form.getGlobalContext().Core.getSelectedWaitingAreaPatientIsNotNull()) { InPatientEpisodeADTVo voEpisode = domain.getInpatientEpisode(form.getGlobalContext().Core.getSelectedWaitingAreaPatient()); if (voEpisode != null && voEpisode.getPasEventIsNotNull() && voEpisode.getPasEvent().getConsultantIsNotNull()) //WDEV-16004 form.lyrDetail().tabTransfer().lyrTransfer().tabConsultant().lblCurrentCons().setValue(voEpisode.getPasEvent().getConsultant().getIMosName()); } populateSpecialtyForService(form.lyrDetail().tabTransfer().lyrTransfer().tabConsultant().qmbConsultantService().getValue()); if (form.lyrDetail().tabTransfer().lyrTransfer().tabConsultant().qmbConsultantService().getValue() == null || !ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("MAXIMS")) { form.lyrDetail().tabTransfer().lyrTransfer().tabConsultant().ccConsultantAccepting().initialize(MosType.MEDIC); } else if (form.lyrDetail().tabTransfer().lyrTransfer().tabConsultant().qmbConsultantService().getValue() != null) { form.lyrDetail().tabTransfer().lyrTransfer().tabConsultant().ccConsultantAccepting().initializeResponsibleHcp(MosType.MEDIC, null, form.lyrDetail().tabTransfer().lyrTransfer().tabOut().qmbOutService().getValue(), null); } form.lyrDetail().tabTransfer().lyrTransfer().tabConsultant().ccConsultantAccepting().isRequired(true); form.lyrDetail().tabTransfer().lyrTransfer().tabConsultant().dtimConsultantTransfer().setValue(new DateTime()); }
private HomeLeaveVo getLatestOngoingHomeLeave(InPatientEpisodeADTVo voEpisode) { if (voEpisode == null || voEpisode.getHomeLeaves() == null) return null; for (int i=voEpisode.getHomeLeaves().size()-1;i>=0;i--) { if (voEpisode.getHomeLeaves().get(i).getDateReturnedFromHomeLeave() != null) voEpisode.getHomeLeaves().remove(i); } voEpisode.getHomeLeaves().sort(HomeLeaveVo.getDateOnHomeLeaveComparator(SortOrder.DESCENDING)); if (voEpisode.getHomeLeaves().size() > 0 && voEpisode.getHomeLeaves().get(0) != null) return voEpisode.getHomeLeaves().get(0); return null; }
private InPatientEpisodeADTVo addNewWardStayAndUpdateCurrent(InPatientEpisodeADTVo voEpisode) { if (voEpisode == null) return null; //update of Current Ward Stay WardStayVo currentWardStayRecordVo = getCurrentWardStayRecord(voEpisode.getWardStays()); if (currentWardStayRecordVo != null) { currentWardStayRecordVo.setTransferOutDateTime(form.dtimTransferAccept().getValue()); voEpisode.getWardStays().set(voEpisode.getWardStays().indexOf(currentWardStayRecordVo), currentWardStayRecordVo); } //new Ward Stay Created on Accepting Transfer WardStayVo voWardStay = new WardStayVo(); voWardStay.setService(form.qmbService().getValue()); voWardStay.setTransferDateTime(form.dtimTransferAccept().getValue()); voWardStay.setBedSpace(null); voWardStay.setBay(null); voWardStay.setPatientStatus(form.cmbPatientStatus().getValue()); //WDEV-20223 voWardStay.setWard(form.getLocalContext().getSelectedPendingTransfer().getDestinationWard()); voWardStay.setWardType(form.cmbWardType().getValue()); voWardStay.setTransferReason(form.cmbTransfReason().getValue()); voWardStay.setTransferComment(form.txtTransfComment().getValue()); if (voEpisode.getWardStays() == null) voEpisode.setWardStays(new WardStayVoCollection()); voEpisode.getWardStays().add(voWardStay); return voEpisode; }
/** * @param patientStatus * @method addConsultantStayIfNeeded * @comment does InpatientAssembler call also - MUST BE CALLED * */ private InpatientEpisode addConsultantStayIfNeeded(InPatientEpisodeADTVo inpatientEpisode, PatientStatus patientStatus) { if(inpatientEpisode == null) throw new CodingRuntimeException("inpatientEpisode is null in method addConsultantStayIfNeeded"); DomainFactory factory = getDomainFactory(); Medic doExistingCons = null; LookupInstance doExistingSpecialty = null; Service doExistingService = null; if (inpatientEpisode.getPasEventIsNotNull() && inpatientEpisode.getPasEvent().getBoId() != null) { PASEvent doExistingPe = (PASEvent)factory.getDomainObject(PASEvent.class, inpatientEpisode.getPasEvent().getBoId()); doExistingCons = doExistingPe != null ? doExistingPe.getConsultant() : null; doExistingService = doExistingPe != null ? doExistingPe.getService() : null; doExistingSpecialty = doExistingPe != null ? doExistingPe.getSpecialty() : null; } InpatientEpisode doInpat = InPatientEpisodeADTVoAssembler.extractInpatientEpisode(factory, inpatientEpisode); //WDEV-22892 if (inpatientEpisode.getPasEventIsNotNull()) { boolean consultantHasChanged = inpatientEpisode.getPasEvent().getConsultantIsNotNull() && doExistingCons != null && !doInpat.getPasEvent().getConsultant().equals(doExistingCons); boolean serviceChanged = inpatientEpisode.getPasEvent().getService() != null && !inpatientEpisode.getPasEvent().getService().equals(doExistingService); boolean specialtyChanged = inpatientEpisode.getPasEvent().getSpecialty() != null && !inpatientEpisode.getPasEvent().getSpecialty().equals(doExistingSpecialty); if (consultantHasChanged || (serviceChanged && consultantHasChanged) || (specialtyChanged && consultantHasChanged)) { addConsultantStay(doInpat,patientStatus); } } return doInpat; }
public ims.core.vo.CareContextShortVo saveTransferIn(ims.core.vo.BedSpaceStateLiteVo voOldBedSpaceStateLite, ims.core.vo.InPatientEpisodeADTVo voInpatientEpisode, ims.core.vo.PendingTransfersLiteVo voPending, ims.core.vo.HomeLeaveVo voHL ,PatientCaseNoteTransferVoCollection collPatientCaseNoteTransfer) throws ims.domain.exceptions.DomainInterfaceException, ims.domain.exceptions.StaleObjectException { PendingTransfersLiteVo transferVo = getPendingTransfer(voPending); if (transferVo == null || (transferVo.getVersion_PendingTransfers() > voPending.getVersion_PendingTransfers())) throw new DomainInterfaceException("This transfer has been already processed"); BedInfoDialog impl = (BedInfoDialog) getDomainImpl(BedInfoDialogImpl.class); return impl.saveTransferIn(voOldBedSpaceStateLite, voInpatientEpisode, voPending, voHL, null, null, collPatientCaseNoteTransfer); }
public InPatientEpisodeADTVo getInpatientEpisodeADT(InpatientEpisodeRefVo inpatientEpisodeRef) { if (inpatientEpisodeRef == null) throw new CodingRuntimeException("Invalid argument specified."); DomainFactory factory = getDomainFactory(); InpatientEpisode inpatientEpisode = (InpatientEpisode) factory.getDomainObject(InpatientEpisode.class, inpatientEpisodeRef.getID_InpatientEpisode()); if (inpatientEpisode == null) return null; return InPatientEpisodeADTVoAssembler.create(inpatientEpisode); }
public CareContextShortVo saveHomeLeave(BedSpaceStateLiteVo voBedSpaceStateLite, InPatientEpisodeADTVo inpatientEpisode, HomeLeaveVo homeLeaveVo) throws DomainInterfaceException, StaleObjectException { if(inpatientEpisode == null) throw new CodingRuntimeException("inpatientEpisode is null in method saveTransfer"); if(!inpatientEpisode.isValidated()) throw new CodingRuntimeException("inpatientEpisode has not been validated in method saveTransfer"); if(homeLeaveVo == null) throw new CodingRuntimeException("homeLeaveVo is null in method saveHomeLeave"); DomainFactory factory = getDomainFactory(); if (Boolean.FALSE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue())) { Homeleave hlRec = (Homeleave)getDTOInstance(Homeleave.class); hlRec.DataCollection.add(); copyHomeleaveToDto(hlRec, homeLeaveVo, inpatientEpisode); //Update Home Leave on PAS Result res = hlRec.insert(); if (res != null && res.getId() < 0 ) { if (res.getId() == -5) throw new DomainInterfaceException("Error occurred saving Home Leave record to PAS " + res.getMessage()); else throw new DTODomainInterfaceException(res.getId(), "Error occurred saving Home Leave record to PAS " + res.getMessage()); } } //Save MAXIMS HomeLeave HomeLeave doHL = HomeLeaveVoAssembler.extractHomeLeave(factory, homeLeaveVo); //Save IP details InpatientEpisode doInpatEpis = InPatientEpisodeADTVoAssembler.extractInpatientEpisode(getDomainFactory(), inpatientEpisode); doInpatEpis.getHomeLeaves().add(doHL); doInpatEpis.setIsOnHomeLeave(true); doInpatEpis.setDateOnHomeLeave(homeLeaveVo.getDateOnHomeLeaveIsNotNull() ? homeLeaveVo.getDateOnHomeLeave().getDate() : null); doInpatEpis.setTimeOnHomeLeave(homeLeaveVo.getTimeOnHomeLeaveIsNotNull() ? homeLeaveVo.getTimeOnHomeLeave().toString() : null); doInpatEpis.setExpectedDateOfReturn(homeLeaveVo.getExpectedDateOfReturnIsNotNull() ? homeLeaveVo.getExpectedDateOfReturn().getDate() : null); doInpatEpis.setExpectedTimeOfReturn(homeLeaveVo.getExpectedTimeOfReturnIsNotNull() ? homeLeaveVo.getExpectedTimeOfReturn().toString() : null); doInpatEpis.setVacatedBedNumber(homeLeaveVo.getVacatedBedNumberIsNotNull() ? homeLeaveVo.getVacatedBedNumber() : ""); factory.save(doInpatEpis); //Vacate the bed. if(voBedSpaceStateLite != null) { BedSpaceState doBed = BedSpaceStateLiteVoAssembler.extractBedSpaceState(factory, voBedSpaceStateLite); factory.save(doBed); } return null; }
private InPatientEpisodeADTVo addNewWardStayAndUpdateCurrent(InPatientEpisodeADTVo voEpisode) { if (voEpisode == null) return null; //update of Current Ward Stay WardStayVo currentWardStayRecordVo = getCurrentWardStayRecord(voEpisode.getWardStays()); PendingTransfersLiteVo gridValue =(PendingTransfersLiteVo)form.lyrDetail().tabTransfer().lyrTransfer().tabIn().grdTransferIn().getValue(); if (currentWardStayRecordVo != null) { currentWardStayRecordVo.setTransferOutDateTime(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().dtimTransfer().getValue()); voEpisode.getWardStays().set(voEpisode.getWardStays().indexOf(currentWardStayRecordVo), currentWardStayRecordVo); } //new Ward Stay Created on Accepting Transfer WardStayVo voWardStay = new WardStayVo(); voWardStay.setTransferDateTime(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().dtimTransfer().getValue()); voWardStay.setBedSpace(form.getGlobalContext().Core.getSelectedBedSpaceState().getBedSpace()); voWardStay.setPatientStatus(gridValue.getPatientStatus()); //WDEV-20223 if (form.lyrDetail().tabTransfer().lyrTransfer().tabIn().grdTransferIn().getValue() != null) voWardStay.setWard(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().grdTransferIn().getValue().getDestinationWard()); voWardStay.setWardType(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbWardType().getValue()); voWardStay.setBay(form.getGlobalContext().Core.getSelectedBedSpaceState().getBay()); voWardStay.setTransferReason(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().cmbTransferReason().getValue()); voWardStay.setTransferComment(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().txtTransferComment().getValue()); voWardStay.setService(form.lyrDetail().tabTransfer().lyrTransfer().tabIn().qmbInService().getValue()); if (form.getGlobalContext().Core.getBedRuleBreachReasonIsNotNull()) { if (Boolean.TRUE.equals(form.getGlobalContext().Core.getBedRuleBreachReason().getIsPrivateBedAllocationValidated())) { voWardStay.setReasonPrivateBedAllocated(form.getGlobalContext().Core.getBedRuleBreachReason().getReasonForPrivateBedAllocation()); voWardStay.setReasonPrivateBedAllocatedComment(form.getGlobalContext().Core.getBedRuleBreachReason().getReasonForPrivateBedAllocationComment()); } if (Boolean.TRUE.equals(form.getGlobalContext().Core.getBedRuleBreachReason().getIsOohAllocationValidated())) { voWardStay.setReasonAdmittingOutsideHours(form.getGlobalContext().Core.getBedRuleBreachReason().getReasonForAdmissionOutOfOpeningHours()); voWardStay.setReasonAdmittingOutsideHoursComment(form.getGlobalContext().Core.getBedRuleBreachReason().getReasonForAdmissionOohComment()); } if (Boolean.TRUE.equals(form.getGlobalContext().Core.getBedRuleBreachReason().getIsMixingGenderBayValidated())) { voWardStay.setReasonGenderBreach(form.getGlobalContext().Core.getBedRuleBreachReason().getReasonForMixingBayGender()); voWardStay.setReasonGenderBreachComment(form.getGlobalContext().Core.getBedRuleBreachReason().getReasonForMixingBayGenderComment()); } } if (voEpisode.getWardStays() == null) voEpisode.setWardStays(new WardStayVoCollection()); voEpisode.getWardStays().add(voWardStay); return voEpisode; }
public void cancelHomeLeave(BedSpaceStateLiteVo voBedSpaceState,InpatientEpisodeLiteVo voInpat) throws StaleObjectException, DomainInterfaceException { if (voInpat == null) throw new CodingRuntimeException("InpatientEpisodeLiteVo argument cannot be null in method cancelHomeLeave()"); DomainFactory factory = getDomainFactory(); WardView impl = (WardView) getDomainImpl(WardViewImpl.class); CareContextShortVo voCareContext = impl.getCareContextForPasEvent(voInpat.getPasEvent()); InPatientEpisodeADTVo voInpatADTVo = getInpatientEpisode(voInpat); if (voInpatADTVo == null) throw new DomainInterfaceException("This patient is no longer an inpatient. The screen will be refreshed."); if (voInpatADTVo != null && voInpatADTVo.getVersion_InpatientEpisode() > voInpat.getVersion_InpatientEpisode() && !Boolean.TRUE.equals(voInpatADTVo.getIsOnHomeLeave())) throw new DomainInterfaceException("This inpatient is no longer on home leave. The screen will be refreshed."); HomeLeaveVo homeLeaveToCancel = getLatestOngoingHomeLeave(voInpatADTVo); if (homeLeaveToCancel != null) { factory.markAsRie(HomeLeave.class, homeLeaveToCancel.getID_HomeLeave(), null, voInpat.getPasEvent() != null && voInpat.getPasEvent().getPatientIsNotNull() ? voInpat.getPasEvent().getPatient().getID_Patient() : null, null, voCareContext != null ? voCareContext.getID_CareContext() : null, "Cancellation of Sending on Home Leave"); InpatientEpisode doInpatientEpisode = InPatientEpisodeADTVoAssembler.extractInpatientEpisode(factory, voInpatADTVo); doInpatientEpisode.setIsOnHomeLeave(false); doInpatientEpisode.setDateOnHomeLeave(null); doInpatientEpisode.setTimeOnHomeLeave(null); doInpatientEpisode.setExpectedDateOfReturn(null); doInpatientEpisode.setExpectedTimeOfReturn(null); if (doInpatientEpisode.getPasEvent() != null) { ADT adtimpl = (ADT) getDomainImpl(ADTImpl.class); adtimpl.triggerCancelLeaveOfAbsenceEvent(new PASEventRefVo(doInpatientEpisode.getPasEvent().getId(), doInpatientEpisode.getPasEvent().getVersion())); } factory.save(doInpatientEpisode); if (ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("MAXIMS") && voBedSpaceState != null && !Boolean.TRUE.equals(homeLeaveToCancel.getBedRetained())) { Sex tempGender = voInpat.getPasEvent() != null && voInpat.getPasEvent().getPatientIsNotNull() ? voInpat.getPasEvent().getPatient().getSex() : null; checkAndUpdateBayConfig(factory, voBedSpaceState,tempGender); } } }
public void vacateBedSpace(InPatientEpisodeADTVo voInpat, BedSpaceStateLiteVo voBedSpaceStateLite, HomeLeaveVo voCurrentHomeLeave) throws DomainInterfaceException, StaleObjectException { if (voInpat == null) throw new CodingRuntimeException("InPatientEpisodeADTVo argument cannot be null in method vacateBedSpace()"); if (voCurrentHomeLeave == null) throw new CodingRuntimeException("HomeLeaveVo argument cannot be null in method vacateBedSpace()"); DomainFactory domainFactory = getDomainFactory(); InpatientEpisode inpatientEpisodeDO = (InpatientEpisode) domainFactory.getDomainObject(InpatientEpisode.class, voInpat.getID_InpatientEpisode()); if (inpatientEpisodeDO == null || inpatientEpisodeDO.getVersion() > voInpat.getVersion_InpatientEpisode()) throw new DomainInterfaceException("The patient record was updated by another user. The screen will refresh."); if (inpatientEpisodeDO.getBed() == null) throw new DomainInterfaceException("The bed was vacated by another user. The screen will refresh."); InpatientEpisode doInpat = InPatientEpisodeADTVoAssembler.extractInpatientEpisode(domainFactory, voInpat); HomeLeave doHomeLeave = HomeLeaveVoAssembler.extractHomeLeave(domainFactory, voCurrentHomeLeave); int currentHomeLeaveIndex = -1; if (doHomeLeave != null) { currentHomeLeaveIndex = doInpat.getHomeLeaves().indexOf(doHomeLeave); if (currentHomeLeaveIndex != -1) { HomeLeave doHLForUpdate = (HomeLeave) doInpat.getHomeLeaves().get(currentHomeLeaveIndex); if (doHLForUpdate != null) { doHLForUpdate.setBedRetained(doHomeLeave.isBedRetained()); } } } else { throw new DomainInterfaceException("The home leave was cancelled by another user. The screen will refresh."); } domainFactory.save(doInpat); if (voBedSpaceStateLite != null) { BedSpaceState doBedSpaceState = BedSpaceStateLiteVoAssembler.extractBedSpaceState(domainFactory,voBedSpaceStateLite); domainFactory.save(doBedSpaceState); } updateOccupiedBedsForWardAndBay(voBedSpaceStateLite.getWard(), voBedSpaceStateLite.getBay(), null); if (ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("MAXIMS") && voBedSpaceStateLite != null ) { Sex tempGender = voInpat.getPasEvent() != null && voInpat.getPasEvent().getPatientIsNotNull() && voInpat.getPasEvent().getPatient().getSexIsNotNull() && !Sex.UNKNOWN.equals(voInpat.getPasEvent().getPatient().getSex()) ? voInpat.getPasEvent().getPatient().getSex() : null; checkAndUpdateBayConfig(domainFactory, voBedSpaceStateLite,tempGender); } }