@Override protected void onBtnArrivePatientClick() throws ims.framework.exceptions.PresentationLogicException { EmergencyAttendanceForPendingArrivalsVo record = form.grdResults().getSelectedRow().getValue(); // Check SOE on selection if (record.getID_EmergencyAttendanceIsNotNull() && domain.isStaleEmergencyAttendance(record)) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); return; } //WDEV-17413 form.getGlobalContext().Core.setPatientShort(domain.getPatientShort(record.getPatient())); form.getGlobalContext().Core.setCurrentCareContext(domain.getCareContext(record.getCareContext()));//WDEV-17396 Object mos = domain.getMosUser(); if (mos == null) { engine.showMessage("Current User is not a Member of Staff!"); return; } engine.open(form.getForms().Emergency.SendToAreaDialog, new Object[] {Boolean.FALSE}); //WDEV-17276 }
private void addRow(EmergencyAttendanceForPendingArrivalsVo pendingArrival) { if (pendingArrival == null) return; grdResultsRow row = form.grdResults().getRows().newRow(); row.setcolSurname(pendingArrival.getPatient().getName().getSurname()); row.setcolForename(pendingArrival.getPatient().getName().getForename()); row.setcolSourceOfReferral(pendingArrival.getEpisode().getSourceOfReferral().toString()); row.setcolExpectedArrivalTime(pendingArrival.getArrivalDateTime()!=null ? pendingArrival.getArrivalDateTime().toString():""); row.setcolInjuryTime(pendingArrival.getEpisode()!=null && pendingArrival.getEpisode().getInjuryDateTime()!=null ? pendingArrival.getEpisode().getInjuryDateTime().toString():""); row.setcolComments(pendingArrival.getComments()); row.setTooltipForcolComments(pendingArrival.getComments()); row.setValue(pendingArrival); }
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; }
private TrackingAttendanceStatusVo populateTrackingAttendanceStatus(TrackingStatus status) { TrackingAttendanceStatusVo trackingAttStatus = new TrackingAttendanceStatusVo(); EmergencyAttendanceForPendingArrivalsVo tempRecord = form.getLocalContext().getselectedRecord(); trackingAttStatus.setPatient(form.getGlobalContext().Core.getPatientShort()); trackingAttStatus.setEpisode(tempRecord.getEpisode().getEpisodeOfCare()); trackingAttStatus.setAttendance(form.getGlobalContext().Core.getCurrentCareContext()); trackingAttStatus.setTrackingArea(form.getGlobalContext().Emergency.getTrackingAreaForSendToAreaVo()); trackingAttStatus.setStatusDatetime(new DateTime()); Object mos = domain.getMosUser(); if (mos instanceof MemberOfStaffLiteVo) { trackingAttStatus.setCreatedBy((MemberOfStaffLiteVo) mos); } trackingAttStatus.setStatus(status); trackingAttStatus.setPrevStatus(null); //WDEV-16777 return trackingAttStatus; }
public Boolean isStaleEmergencyAttendance(EmergencyAttendanceForPendingArrivalsVo emergencyAtt) { if (emergencyAtt == null || emergencyAtt.getID_EmergencyAttendance() == null) { throw new CodingRuntimeException("Cannot get EmergencyAttendanceForPendingArrivalsVo on null Id "); } DomainFactory factory = getDomainFactory(); EmergencyAttendance domainEmergencyAtt = (EmergencyAttendance) factory.getDomainObject(EmergencyAttendance.class, emergencyAtt.getID_EmergencyAttendance()); if (domainEmergencyAtt == null) { return true; } if (domainEmergencyAtt.getVersion() > emergencyAtt.getVersion_EmergencyAttendance()) { return true; } return false; }
@Override protected void onBtnRemovePatientClick() throws ims.framework.exceptions.PresentationLogicException { EmergencyAttendanceForPendingArrivalsVo record = form.grdResults().getSelectedRow().getValue(); if (record == null) return; // Check SOE on selection if (record.getID_EmergencyAttendanceIsNotNull() && domain.isStaleEmergencyAttendance(record)) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); return; } String comment = "Patient Removed from Arrival List - DNA"; try { domain.markAsRie(form.getLocalContext().getselectedRecord(), engine.getFormName(), form.getLocalContext().getselectedRecord().getPatient().getID_Patient(), null, form.getLocalContext().getselectedRecord().getCareContext().getID_CareContext(), comment); } catch (StaleObjectException e) { e.printStackTrace(); } doSearch(); }
@Override protected void onMessageBoxClosed(int messageBoxId, DialogResult result) throws PresentationLogicException { if (DialogResult.YES.equals(result)) { EmergencyAttendanceForPendingArrivalsVo record = form.grdResults().getSelectedRow().getValue(); if (record == null) return; // Check SOE on selection if (record.getID_EmergencyAttendanceIsNotNull() && domain.isStaleEmergencyAttendance(record)) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); return; } String comment = "Patient Removed from Arrival List - DNA"; try { domain.markAsRie(form.getLocalContext().getselectedRecord(), engine.getFormName(), form.getLocalContext().getselectedRecord().getPatient().getID_Patient(), null, form.getLocalContext().getselectedRecord().getCareContext().getID_CareContext(), comment); } catch (StaleObjectException e) { e.printStackTrace(); } } doSearch(); }
private void updateControlsState() { form.btnArrivePatient().setEnabled(form.grdResults().getValue() instanceof EmergencyAttendanceForPendingArrivalsVo); form.btnRemovePatient().setEnabled(form.grdResults().getValue() instanceof EmergencyAttendanceForPendingArrivalsVo); }
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); }