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 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; }
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); }