public TrackingLiteVo getTrackingLiteVo(TrackingRefVo trackingRef) { if( trackingRef == null) throw new CodingRuntimeException("Tracking cannot be null"); DomainFactory factory = getDomainFactory(); String hsql = "from Tracking as t1_1 where (t1_1.id = :idTracking) "; List trackings = factory.find(hsql, new String[] {"idTracking"}, new Object[] { trackingRef.getID_Tracking()}); if( trackings != null && trackings.size() > 0) { TrackingLiteVoCollection tempColl = TrackingLiteVoAssembler.createTrackingLiteVoCollectionFromTracking(trackings); if( tempColl != null && tempColl.size() > 0) { return tempColl.get(0); } } return null; }
protected void onFormOpen(Object[] args) throws ims.framework.exceptions.PresentationLogicException { initialize(); //initializeCubiclesRoomsBedsCombo(); //wdev-16011 open(); //wdev-17430 if( form.recbrAllocateCubicle().getValue() == null || form.getLocalContext().getCurrentTracking().getCurrentCubicle()==null) //WDEV-20720 newInstanceNewClick(); else { if( form.getGlobalContext().Emergency.getTracking() != null) { TrackingLiteVo tempLiteVo = domain.getTrackingLiteVo(form.getGlobalContext().Emergency.getTracking()); if( tempLiteVo != null && tempLiteVo.getCurrentAreaIsNotNull() ) { if( !Boolean.TRUE.equals(domain.isAllocateCubicleForCurrentTrackingArea(tempLiteVo.getCurrentArea(),form.getGlobalContext().Core.getCurrentCareContext()))) { newInstanceNewClick(); } } } } //------------ }
private TrackingLiteVo dischargePatient(TrackingLiteVo trackingRecord, TrackingStatusWorkflowVo trackingWorkflowStatusConfiguration, Boolean continueDisplay) { if(trackingRecord != null) { if(trackingRecord.getAttendance() != null) { trackingRecord.getAttendance().setDischargeDateTime(new DateTime()); trackingRecord.getAttendance().setOutcome(trackingWorkflowStatusConfiguration.getDischargeOutcome()); if(trackingRecord.getAttendance().getCareContext() != null) { trackingRecord.getAttendance().getCareContext().setEndDateTime(new DateTime()); } } trackingRecord.setIsDischarged(true); trackingRecord.setDisplayInED(continueDisplay); trackingRecord.setCurrentStatus(createTrackingStatus(TrackingStatus.DISCHARGED, trackingWorkflowStatusConfiguration.getTrackingStatus())); trackingRecord.setCurrentArea(null); } return trackingRecord; }
protected void onBtnAmbulanceDetailsClick() throws PresentationLogicException { // Get values to be saved AmbulanceDetailsVo ambulanceDetails = new AmbulanceDetailsVo(); TrackingLiteVo tracking = form.getLocalContext().getTracking(); ambulanceDetails.setAmbulanceArrivalDateTime(tracking.getAttendance().getAmbulanceArrivalDateTime()); ambulanceDetails.setAmbulanceJobNo(tracking.getAttendance().getAmbulanceJobNo()); ambulanceDetails.setAmbulanceHandoverDateTime(tracking.getAttendance().getAmbulanceHandoverDateTime()); ambulanceDetails.setAmbulanceDelayReason(tracking.getAttendance().getAmbulanceDelayReason()); form.getGlobalContext().Emergency.setAmbulanceDetails(ambulanceDetails); engine.open(form.getForms().Emergency.AmbulanceDetails); }
protected void onFormOpen(Object[] args) throws ims.framework.exceptions.PresentationLogicException { initialize(); if( form.getGlobalContext().Emergency.getTracking() != null) form.getLocalContext().setCurrentTracking(domain.getTracking(form.getGlobalContext().Emergency.getTracking())); //initializeCubiclesRoomsBedsCombo(); //wdev-16011 open(); //wdev-17430 if( form.recbrAllocateCubicle().getValue() == null) newInstanceNewClick(); else { if( form.getGlobalContext().Emergency.getTracking() != null) { TrackingLiteVo tempLiteVo = domain.getTrackingLiteVo(form.getGlobalContext().Emergency.getTracking()); if( tempLiteVo != null && tempLiteVo.getCurrentAreaIsNotNull() ) { if( !Boolean.TRUE.equals(domain.isAllocateCubicleForCurrentTrackingArea(tempLiteVo.getCurrentArea()))) { newInstanceNewClick(); } } } } //------------ }
protected void onBtnOKClick() throws ims.framework.exceptions.PresentationLogicException { if(checkIfanAreaisSelected() == false) { engine.showMessage("Please select an Area."); return; } if( form.getLocalContext().getAttendaceDetailsOrOtherIsNotNull() && Boolean.TRUE.equals(form.getLocalContext().getAttendaceDetailsOrOther())) //wdev-14567 { TrackingLiteVo trackLiteVo = form.getLocalContext().getTracking(); if( trackLiteVo != null) { trackLiteVo.setLastMovementDateTime(new DateTime()); trackLiteVo.setCurrentArea(gettrackingArea()); } TrackingMovementTimesVo trackMovVo = new TrackingMovementTimesVo(); trackMovVo.setPatient(form.getGlobalContext().Core.getPatientShort()); trackMovVo.setEpisode(form.getGlobalContext().Core.getEpisodeofCareShort()); trackMovVo.setAttendance(form.getGlobalContext().Core.getCurrentCareContext()); trackMovVo.setAreaMovedTo(gettrackingArea()); trackMovVo.setMovedDateTime(new DateTime()); trackMovVo.setMovedBy((MemberOfStaffLiteVo) domain.getMosUser()); try { domain.saveTrackingAndTrackingMovementTimes(trackLiteVo, trackMovVo); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); } } else form.getGlobalContext().Emergency.setTrackingAreaForSendToAreaVo(gettrackingArea()); engine.close(DialogResult.OK); }
public TrackingLiteVo getTrackingLiteVo(TrackingRefVo trackingRef) { if( trackingRef == null) throw new CodingRuntimeException("Tracking not provided"); DomainFactory factory = getDomainFactory(); ims.emergency.domain.objects.Tracking doTracking = (ims.emergency.domain.objects.Tracking) factory.getDomainObject(ims.emergency.domain.objects.Tracking.class, trackingRef.getID_Tracking()); return TrackingLiteVoAssembler.create(doTracking); }
private void createNewCareContext(TrackingLiteVo trackingRecord) { EpisodeofCareVo episodeOfCare = domain.getEpisodeOfCare(form.getGlobalContext().Core.getEpisodeofCareShort().getID_EpisodeOfCare()); form.getLocalContext().setlcCurrentEpisodeOfCare(episodeOfCare); CareContextVo voCareContext = new CareContextVo(); voCareContext.setContext(trackingRecord.getAttendance().getCareContext().getContext()); voCareContext.setStartDateTime(new DateTime()); voCareContext.setEpisodeOfCare(episodeOfCare); form.getLocalContext().setlcCurrentCareContext(voCareContext); }
public TrackingLiteVo saveTrackingAndTrackingMovementTimes( TrackingLiteVo record, TrackingMovementTimesVo trackingMovementTimes) throws StaleObjectException // WDEV-18278 { if( record == null || trackingMovementTimes == null) throw new DomainRuntimeException(" Tracking or TrackingMovementTimes are not validated."); DomainFactory factory = getDomainFactory(); Tracking doTracking = TrackingLiteVoAssembler.extractTracking(factory, record); factory.save(doTracking); TrackingMovementTimes doTrackingMovementTimes = TrackingMovementTimesVoAssembler.extractTrackingMovementTimes(factory, trackingMovementTimes); factory.save(doTrackingMovementTimes); return TrackingLiteVoAssembler.create(doTracking); }
private boolean save() { if( form.getLocalContext().getAttendaceDetailsOrOtherIsNotNull() && Boolean.TRUE.equals(form.getLocalContext().getAttendaceDetailsOrOther())) //wdev-14567 { TrackingLiteVo trackLiteVo = form.getLocalContext().getTracking(); TrackingAreaVo selectedTrackingArea = getTrackingAreaWithCubicle(); if( trackLiteVo != null) { trackLiteVo.setLastMovementDateTime(new DateTime()); if (trackLiteVo.getCurrentAreaIsNotNull())//WDEV-19031 - in case the patient got discharged, do not set the Current area trackLiteVo.setCurrentArea(selectedTrackingArea); if (form.cmbCubicleRoom().getValue() != null) { CubicleAllocationVo record = new CubicleAllocationVo(); record.setAllocatedBy((MemberOfStaffLiteVo) domain.getMosUser()); record.setAllocatedCubicleDateTime(new DateTime()); record.setAttendance(form.getGlobalContext().Core.getCurrentCareContext()); record.setCubicleRoomBed(form.cmbCubicleRoom().getValue()); record.setEpisode(form.getGlobalContext().Core.getEpisodeofCareShort()); record.setPatient(form.getGlobalContext().Core.getPatientShort()); record.setTrackingArea(domain.getTrackingAreaLite(selectedTrackingArea)); trackLiteVo.setCurrentCubicle(record); } else trackLiteVo.setCurrentCubicle(null); } TrackingMovementTimesVo trackMovVo = new TrackingMovementTimesVo(); trackMovVo.setPatient(form.getGlobalContext().Core.getPatientShort()); trackMovVo.setEpisode(form.getGlobalContext().Core.getEpisodeofCareShort()); trackMovVo.setAttendance(form.getGlobalContext().Core.getCurrentCareContext()); trackMovVo.setAreaMovedTo(selectedTrackingArea); trackMovVo.setMovedDateTime(new DateTime()); trackMovVo.setMovedBy((MemberOfStaffLiteVo) domain.getMosUser()); CareContextVo newCareContext = form.getLocalContext().getlcCurrentCareContext(); if (newCareContext != null) { String[] errors = newCareContext.validate(); if (errors != null && errors.length > 0) { engine.showErrors(errors); return false; } } try { domain.saveTrackingAndTrackingMovementTimes(trackLiteVo, trackMovVo, form.getLocalContext().getlcCurrentPartialAdmission(), form.getLocalContext().getlcTriggePreAdmissionToPAS(), form.getLocalContext().getlcCurrentEpisodeOfCare(), newCareContext); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); engine.close(DialogResult.CANCEL); //WDEV-19188 return false; } } else form.getGlobalContext().Emergency.setTrackingAreaForSendToAreaVo(getTrackingAreaWithCubicle()); if (Boolean.TRUE.equals(form.dtimEndTriage().isVisible())) form.getGlobalContext().Emergency.setTriageCompletedDateTime(form.dtimEndTriage().getValue()); return true; }
private TrackingLiteVo applyAssociatedTrackingWorkflow(TrackingAreaVo trackingArea) { TrackingLiteVo trackingRecord = (TrackingLiteVo) form.getLocalContext().getTracking().clone(); if (trackingRecord == null) return null; TrackingStatusWorkflowVo trackingWorkflowStatusConfiguration = domain.getTrackingWorkflowConfig(trackingArea.getWorkflowConfig()); trackingRecord.setCurrentStatus(createTrackingStatus(trackingWorkflowStatusConfiguration.getTrackingStatus(), trackingRecord!=null && trackingRecord.getCurrentStatus()!=null ? trackingRecord.getCurrentStatus().getStatus() : null)); if (trackingWorkflowStatusConfiguration != null && Boolean.TRUE.equals(trackingWorkflowStatusConfiguration.getRecordsConclusionDateTime()) && trackingRecord != null && trackingRecord.getAttendance() != null && trackingRecord.getAttendance().getConclusionDateTime() == null) { trackingRecord.getAttendance().setConclusionDateTime(new DateTime()); } if (trackingWorkflowStatusConfiguration != null && Boolean.TRUE.equals(trackingWorkflowStatusConfiguration.getTriggersPreAdmissionPas())) { form.getLocalContext().setlcTriggePreAdmissionToPAS(true); CurrentPartialAdmissionForSendToAreaVo partialAdmission = null; // cancel the previous partial admission and set Tracking.CurrentPartialAdmission to null if (trackingRecord != null && trackingRecord.getCurrentPartialAdmissionIsNotNull() && AllocationStatus.ACTIVE.equals(trackingRecord.getCurrentPartialAdmission().getAllocatedStatus())) { partialAdmission = (CurrentPartialAdmissionForSendToAreaVo) trackingRecord.getCurrentPartialAdmission().clone(); partialAdmission.setAllocatedStatus(AllocationStatus.CANCELLED_ADMISSION); form.getLocalContext().setlcCurrentPartialAdmission(partialAdmission); trackingRecord.setCurrentPartialAdmission(null); } } if (trackingWorkflowStatusConfiguration != null && Boolean.TRUE.equals(trackingWorkflowStatusConfiguration.getRecordsEdAttendanceDeparture()) && trackingRecord != null && trackingRecord.getAttendance() != null) { Boolean continueDisplay = trackingWorkflowStatusConfiguration.getContinueDisplayInTracking(); trackingRecord = dischargePatient(trackingRecord, trackingWorkflowStatusConfiguration, continueDisplay); if(Boolean.TRUE.equals(trackingWorkflowStatusConfiguration.getCreateNewCareContext())) { createNewCareContext(trackingRecord); } } return trackingRecord; }
public TrackingLiteVo saveTrackingAndTrackingMovementTimes( TrackingLiteVo record, TrackingMovementTimesVo trackingMovementTimes, CurrentPartialAdmissionForSendToAreaVo partialAdmission, Boolean trigersPreAdmissiontoPAS, EpisodeofCareVo epOfCare, CareContextVo careContext) throws StaleObjectException // WDEV-18278 { if( record == null || trackingMovementTimes == null) throw new DomainRuntimeException(" Tracking or TrackingMovementTimes are not validated."); DomainFactory factory = getDomainFactory(); Tracking doTracking = TrackingLiteVoAssembler.extractTracking(factory, record); factory.save(doTracking); TrackingMovementTimes doTrackingMovementTimes = TrackingMovementTimesVoAssembler.extractTrackingMovementTimes(factory, trackingMovementTimes); factory.save(doTrackingMovementTimes); if (Boolean.TRUE.equals(trigersPreAdmissiontoPAS)) { if (partialAdmission != null) { EDPartialAdmission doPartialAdmission = CurrentPartialAdmissionForSendToAreaVoAssembler.extractEDPartialAdmission(factory, partialAdmission); factory.save(doPartialAdmission); } if (record != null) { EDPartialAdmissionDialog dom = (EDPartialAdmissionDialog) getDomainImpl(EDPartialAdmissionDialogImpl.class); try { dom.triggerCancelPartialAdmission(record.getAttendance(), record.getCurrentPartialAdmission()); } catch (DomainInterfaceException e) { e.printStackTrace(); } } } if (careContext != null && epOfCare != null) { CareContext doCare = CareContextVoAssembler.extractCareContext(factory,careContext); factory.save(doCare); EpisodeofCareVo lastEpofcare = getEpisodeOfCare(epOfCare.getID_EpisodeOfCare()); EpisodeOfCare doEpisode = EpisodeofCareVoAssembler.extractEpisodeOfCare(factory, lastEpofcare); doEpisode.getCareContexts().add(doCare); factory.save(doEpisode); } return TrackingLiteVoAssembler.create(doTracking); }