private TrackingForQuickRegistrationVo populateDataFromScreen(EmergencyAttendanceForPendingArrivalsVo selectedRecord) { TrackingForQuickRegistrationVo trackingToSave = new TrackingForQuickRegistrationVo(); trackingToSave.setPatient(form.getGlobalContext().Core.getPatientShort()); EmergencyAttendanceForPendingArrivalsVo emergencyAttendanceToSave = form.getLocalContext().getselectedRecord(); trackingToSave.setAttendance(emergencyAttendanceToSave); trackingToSave.setEpisode(emergencyAttendanceToSave.getEpisode()); LocationLiteVo currentLocation = (LocationLiteVo) domain.getCurrentLocation(); trackingToSave.setEDLocation(currentLocation); trackingToSave.setCurrentArea(form.getGlobalContext().Emergency.getTrackingAreaForSendToAreaVo()); TrackingAttendanceStatusVo trackingStatusToSave = populateTrackingAttendanceStatus(ims.emergency.vo.lookups.TrackingStatus.WAITING_TO_BE_TRIAGED); trackingToSave.setCurrentStatus(trackingStatusToSave); trackingToSave.setDischargeLetterStatus(DischargeLetterStatus.IN_PROGRESS);//wdev-17266 return trackingToSave; }
public Boolean isStale(TrackingForQuickRegistrationVo trackingToSave) { if (trackingToSave == null || trackingToSave.getID_Tracking() == null) { throw new CodingRuntimeException("Cannot get TrackingForQuickRegistrationVo on null Id "); } DomainFactory factory = getDomainFactory(); Tracking domainTracking = (Tracking) factory.getDomainObject(Tracking.class, trackingToSave.getID_Tracking()); if (domainTracking == null) { return true; } if (domainTracking.getVersion() > trackingToSave.getVersion_Tracking()) { return true; } return false; }
private TrackingForQuickRegistrationVo populateTracking() { TrackingForQuickRegistrationVo trackingVo = new TrackingForQuickRegistrationVo(); trackingVo.setPatient(form.getLocalContext().getpatientToSave()); trackingVo.setAttendance(new AttendanceDetailsVo()); trackingVo.setEpisode(form.getLocalContext().getemergencyEpisodeToSave()); trackingVo.setEDLocation(getLocation()); trackingVo.setCurrentArea(form.getGlobalContext().Emergency.getTrackingAreaForSendToAreaVo()); if (QuickRegistrationType.UNC_UNK_PATIENT.equals(form.cmbRegistrationType().getValue()))//WDEV-15959 { trackingVo.setIsUnknownPatient(true); } TrackingAttendanceStatusVo trStatusVo = new TrackingAttendanceStatusVo(); trStatusVo.setPatient(form.getLocalContext().getpatientToSave()); trStatusVo.setAttendance(form.getLocalContext().getcareContextToSave()); trStatusVo.setEpisode(form.getLocalContext().getepisodeToSave()); trStatusVo.setTrackingArea(form.getGlobalContext().Emergency.getTrackingAreaForSendToAreaVo()); trStatusVo.setStatusDatetime(new DateTime()); MemberOfStaffShortVo memberVo = null; if (domain.getMosUser() instanceof MemberOfStaffShortVo) { memberVo = (MemberOfStaffShortVo) domain.getMosUser(); } trStatusVo.setCreatedBy(memberVo); trStatusVo.setStatus(TrackingStatus.WAITING_TO_BE_TRIAGED); trStatusVo.setPrevStatus(null); //WDEV-16777 trackingVo.setCurrentStatus(trStatusVo); trackingVo.setDischargeLetterStatus(DischargeLetterStatus.IN_PROGRESS); //wdev-17110 return trackingVo; }
private boolean save() { TrackingForQuickRegistrationVo tracking = null; //wdev-17110 if( form.getLocalContext().getpatientToSaveIsNotNull()) { //wdev-17293 if (form.getGlobalContext().Emergency.getSelectedPatient() == null) form.getLocalContext().getpatientToSave().setIsQuickRegistrationPatient(Boolean.TRUE); else form.getLocalContext().getpatientToSave().setIsQuickRegistrationPatient(Boolean.FALSE); PatientLiteVo patient = form.getLocalContext().getpatientToSave(); String[] patientErrors = patient.validate(); if (patientErrors != null && patientErrors.length > 0) { engine.showErrors(patientErrors); return false; } } //-------------- if (!QuickRegistrationType.EXP_ARRIVAL.equals(form.cmbRegistrationType().getValue()))//WDEV-15959 { tracking = populateTracking(); String[] trackingErrors = tracking.validate(); if (trackingErrors != null && trackingErrors.length > 0) { engine.showErrors(trackingErrors); return false; } } try { domain.save(form.getLocalContext().getpatientToSave(), form.getLocalContext().getcareSpellToSave(), form.getLocalContext().getemergencyEpisodeToSave(), tracking, form.getLocalContext().getcareContextToSave(), form.getLocalContext().getemergencyAttendanceToSave()); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); return false; } form.getGlobalContext().Emergency.setSelectedPatient(null); return true; }
private boolean save() { TrackingForQuickRegistrationVo trackingToSave = populateDataFromScreen(form.getLocalContext().getselectedRecord()); EmergencyAttendanceForPendingArrivalsVo emergencyAttendanceToSave = form.getLocalContext().getselectedRecord(); DateTime dtt = new DateTime(); //wdev-17462 emergencyAttendanceToSave.setArrivalDateTime(dtt); emergencyAttendanceToSave.setRegistrationDateTime(dtt); emergencyAttendanceToSave.setExpectedArrivalDateTime(null); String[] errors = trackingToSave.validate(); if (errors != null && errors.length > 0) { engine.showErrors(errors); return false; } String[] errors1 = emergencyAttendanceToSave.validate(); if (errors1 != null && errors1.length > 0) { engine.showErrors(errors1); return false; } // Check SOE if (trackingToSave.getID_TrackingIsNotNull() && domain.isStale(trackingToSave)) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); return false; } try { form.getLocalContext().setselectedRecord(domain.save(trackingToSave, emergencyAttendanceToSave)); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); return false; } return true; }
public EmergencyAttendanceForPendingArrivalsVo save(TrackingForQuickRegistrationVo trackingToSave, EmergencyAttendanceForPendingArrivalsVo emergencyAttendanceToSave) throws StaleObjectException { if (trackingToSave == null && emergencyAttendanceToSave == null) throw new CodingRuntimeException("Cannot save null AllocatedMedic or TrackingForAllocatedMedicVo "); if (!trackingToSave.isValidated()) throw new DomainRuntimeException("TrackingForQuickRegistrationVo Not Validated."); if (!emergencyAttendanceToSave.isValidated()) throw new DomainRuntimeException("EmergencyAttendanceForPendingArrivalsVo Not Validated."); DomainFactory factory = getDomainFactory(); Tracking domainTracking = TrackingForQuickRegistrationVoAssembler.extractTracking(factory, trackingToSave); factory.save(domainTracking); EmergencyAttendance domainEmergencyAtt = EmergencyAttendanceForPendingArrivalsVoAssembler.extractEmergencyAttendance(factory, emergencyAttendanceToSave); factory.save(domainEmergencyAtt); return EmergencyAttendanceForPendingArrivalsVoAssembler.create(domainEmergencyAtt); }
private boolean save() { TrackingForQuickRegistrationVo tracking = null; //wdev-17110 if( form.getLocalContext().getpatientToSaveIsNotNull()) { //wdev-17293 if (form.getGlobalContext().Emergency.getSelectedPatient() == null) form.getLocalContext().getpatientToSave().setIsQuickRegistrationPatient(Boolean.TRUE); else form.getLocalContext().getpatientToSave().setIsQuickRegistrationPatient(Boolean.FALSE); PatientLite_IdentifiersVo patient = form.getLocalContext().getpatientToSave(); String[] patientErrors = patient.validate(); if (patientErrors != null && patientErrors.length > 0) { engine.showErrors(patientErrors); return false; } } //-------------- if (!QuickRegistrationType.EXP_ARRIVAL.equals(form.cmbRegistrationType().getValue()))//WDEV-15959 { tracking = populateTracking(); String[] trackingErrors = tracking.validate(); if (trackingErrors != null && trackingErrors.length > 0) { engine.showErrors(trackingErrors); return false; } } try { domain.save(form.getLocalContext().getpatientToSave(), form.getLocalContext().getcareSpellToSave(), form.getLocalContext().getemergencyEpisodeToSave(), tracking, form.getLocalContext().getcareContextToSave(), form.getLocalContext().getemergencyAttendanceToSave()); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); return false; } form.getGlobalContext().Emergency.setSelectedPatient(null); return true; }