@Override protected void onFormOpen(Object[] args) throws ims.framework.exceptions.PresentationLogicException { if (getLocation() == null) { form.setMode(FormMode.VIEW); engine.showMessage("The current location should be of type Emergency."); return; } form.getGlobalContext().Emergency.setSelectedPatient(null); form.cmbRegistrationType().setValue(QuickRegistrationType.QUICK_REG); //wdev-17136 form.dtimArrival().setValue(new DateTime());//WDEV-17249 form.setMode(FormMode.EDIT); }
@Override protected void onBtnSaveClick() throws ims.framework.exceptions.PresentationLogicException { if (QuickRegistrationType.EXP_ARRIVAL.equals(form.cmbRegistrationType().getValue()))//WDEV-15959 { if (validateSave()) { if (save()) { form.setMode(FormMode.VIEW); } } } else { if (validateSave()) { engine.open(form.getForms().Emergency.SendToAreaDialog, new Object[] {Boolean.FALSE}); //WDEV-17249 } } }
private void updateControlsState() { form.btnNew().setVisible(form.getMode().equals(FormMode.VIEW) && getLocation() != null); form.btnNew().setEnabled(form.getMode().equals(FormMode.VIEW)); //WDEV-15959 form.txtSurname().setEnabled(form.getMode().equals(FormMode.EDIT)); form.txtForename().setEnabled(form.getMode().equals(FormMode.EDIT)); form.pdtDOB().setEnabled(form.getMode().equals(FormMode.EDIT)); form.cmbGender().setEnabled(form.getMode().equals(FormMode.EDIT)); if (form.getMode().equals(FormMode.EDIT)) { //WDEV-15959 form.btnPatSearch().setVisible(form.cmbRegistrationType().getValue() != null && !QuickRegistrationType.MAJ_INCIDENT.equals(form.cmbRegistrationType().getValue()) && !QuickRegistrationType.UNC_UNK_PATIENT.equals(form.cmbRegistrationType().getValue())); //wdev-17136 // WDEV-17543 - Addition of comments is only allowed for Expected Arrivals form.txtComments().setEnabled(QuickRegistrationType.EXP_ARRIVAL.equals(form.cmbRegistrationType().getValue())); } }
@Override protected void onBtnNewClick() throws ims.framework.exceptions.PresentationLogicException { clearControls(); form.cmbRegistrationType().setValue(QuickRegistrationType.QUICK_REG); form.dtimArrival().setValue(new DateTime()); form.setMode(FormMode.EDIT); }
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 validateUIRules() { ArrayList<String> listOfErrors = new ArrayList<String>(); //WDEV-15959 if (form.cmbRegistrationType().getValue()==null) { listOfErrors.add("Registration Type is mandatory."); } if (form.txtSurname().getValue() == null) { listOfErrors.add("Surname is mandatory."); } if (form.cmbSourceOfReferral().getValue() == null) { listOfErrors.add("Source of Referral is mandatory."); } if( form.dtimInjury().getValue() != null && form.dtimInjury().getValue().isGreaterThan(new DateTime())) //wdev-17045 { listOfErrors.add("Incident Time cannot be in the future."); } if (form.dtimArrival().getValue() == null) { listOfErrors.add("Arrival Time is mandatory."); } if( form.dtimInjury().getValue() != null && form.dtimArrival().getValue() != null && form.dtimInjury().getValue().isGreaterThan(form.dtimArrival().getValue())) { listOfErrors.add("Arrival Time cannot be less than Incident Time"); } if( !QuickRegistrationType.EXP_ARRIVAL.equals(form.cmbRegistrationType().getValue()) && form.dtimArrival().getValue() != null && form.dtimArrival().getValue().isGreaterThan(new DateTime())) //wdev-17461 { listOfErrors.add("Arrival Time cannot be in the future."); } int errorCount = listOfErrors.size(); String[] result = new String[errorCount]; for (int x = 0; x < errorCount; x++) result[x] = (String) listOfErrors.get(x); if (result != null && result.length > 0) { engine.showErrors(result); return false; } return true; }
private EmergencyEpisodeForQuickRegistrationVo populateDataFromScreen() { EmergencyEpisodeForQuickRegistrationVo voEmergencyEpisode = new EmergencyEpisodeForQuickRegistrationVo(); EmergencyAttendanceForQuickRegistrationVo voEmergencyAttendance = new EmergencyAttendanceForQuickRegistrationVo(); EmergencyAttendanceForQuickRegistrationVoCollection voCollEmergencyAttendance = new EmergencyAttendanceForQuickRegistrationVoCollection(); createNewCareSpell(); // Populate EmergencyDetails voEmergencyEpisode.setInjuryDateTime(form.dtimInjury().getValue()); voEmergencyEpisode.setSourceOfReferral(form.cmbSourceOfReferral().getValue()); voEmergencyEpisode.setEpisodeOfCare(form.getLocalContext().getepisodeToSave()); voEmergencyEpisode.setPatient(form.getLocalContext().getpatientToSave()); // Populate EmergencyAttendance voEmergencyAttendance.setArrivalDateTime(form.dtimArrival().getValue()); voEmergencyAttendance.setRegistrationDateTime(form.dtimArrival().getValue()); voEmergencyAttendance.setEmergencyEpisode(voEmergencyEpisode); voEmergencyAttendance.setCareContext(form.getLocalContext().getcareContextToSave()); voEmergencyAttendance.setEpisode(voEmergencyEpisode); voEmergencyAttendance.setPatient(form.getLocalContext().getpatientToSave()); voEmergencyAttendance.setAttendanceType(AttendanceType.FIRST); voEmergencyAttendance.setAgeAtAttendance(calculateAge()); voEmergencyAttendance.setRegistrationLocation(getLocation()); voEmergencyAttendance.setComments(form.txtComments().getValue()); //wdev-17463 //wdev-16070 if( domain.getMosUser() instanceof MemberOfStaffLiteVo ) { MemberOfStaffLiteVo tempVo = (MemberOfStaffLiteVo) domain.getMosUser(); voEmergencyAttendance.setRegisteringMOS(tempVo); } //WDEV-15959 if (QuickRegistrationType.UNC_UNK_PATIENT.equals(form.cmbRegistrationType().getValue()) ) { voEmergencyAttendance.setIsUnknownPatient(true); } else if (QuickRegistrationType.QUICK_REG.equals(form.cmbRegistrationType().getValue())) { voEmergencyAttendance.setIsQuickRegistration(true); } else if (QuickRegistrationType.EXP_ARRIVAL.equals(form.cmbRegistrationType().getValue())) { voEmergencyAttendance.setExpectedArrivalDateTime(form.dtimArrival().getValue()); voEmergencyAttendance.setIsExpectedArrival(true); } else if (QuickRegistrationType.MAJ_INCIDENT.equals(form.cmbRegistrationType().getValue())) { voEmergencyAttendance.setIsMajorIncident(true); } voCollEmergencyAttendance.add(voEmergencyAttendance); voEmergencyEpisode.setEmergencyAttendances(voCollEmergencyAttendance); form.getLocalContext().setemergencyEpisodeToSave(voEmergencyEpisode); form.getLocalContext().setemergencyAttendanceToSave(voEmergencyAttendance); return voEmergencyEpisode; }
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 EmergencyEpisodeForQuickRegistrationVo populateDataFromScreen() { EmergencyEpisodeForQuickRegistrationVo voEmergencyEpisode = new EmergencyEpisodeForQuickRegistrationVo(); EmergencyAttendanceForQuickRegistrationVo voEmergencyAttendance = new EmergencyAttendanceForQuickRegistrationVo(); EmergencyAttendanceForQuickRegistrationVoCollection voCollEmergencyAttendance = new EmergencyAttendanceForQuickRegistrationVoCollection(); createNewCareSpell(); // Populate EmergencyDetails voEmergencyEpisode.setInjuryDateTime(form.dtimInjury().getValue()); voEmergencyEpisode.setSourceOfReferral(form.cmbSourceOfReferral().getValue()); voEmergencyEpisode.setEpisodeOfCare(form.getLocalContext().getepisodeToSave()); voEmergencyEpisode.setPatient(form.getLocalContext().getpatientToSave()); // Populate EmergencyAttendance voEmergencyAttendance.setArrivalDateTime(form.dtimArrival().getValue()); voEmergencyAttendance.setRegistrationDateTime(form.dtimArrival().getValue()); voEmergencyAttendance.setEndOfRegistrationDateTime(new DateTime()); //WDEV-19984 voEmergencyAttendance.setEmergencyEpisode(voEmergencyEpisode); voEmergencyAttendance.setCareContext(form.getLocalContext().getcareContextToSave()); voEmergencyAttendance.setEpisode(voEmergencyEpisode); voEmergencyAttendance.setPatient(form.getLocalContext().getpatientToSave()); voEmergencyAttendance.setAttendanceType(AttendanceType.FIRST); voEmergencyAttendance.setAgeAtAttendance(calculateAge()); voEmergencyAttendance.setRegistrationLocation(getLocation()); voEmergencyAttendance.setComments(form.txtComments().getValue()); //wdev-17463 //wdev-16070 if( domain.getMosUser() instanceof MemberOfStaffLiteVo ) { MemberOfStaffLiteVo tempVo = (MemberOfStaffLiteVo) domain.getMosUser(); voEmergencyAttendance.setRegisteringMOS(tempVo); } //WDEV-15959 if (QuickRegistrationType.UNC_UNK_PATIENT.equals(form.cmbRegistrationType().getValue()) ) { voEmergencyAttendance.setIsUnknownPatient(true); } else if (QuickRegistrationType.QUICK_REG.equals(form.cmbRegistrationType().getValue())) { voEmergencyAttendance.setIsQuickRegistration(true); } else if (QuickRegistrationType.EXP_ARRIVAL.equals(form.cmbRegistrationType().getValue())) { voEmergencyAttendance.setExpectedArrivalDateTime(form.dtimArrival().getValue()); voEmergencyAttendance.setIsExpectedArrival(true); } else if (QuickRegistrationType.MAJ_INCIDENT.equals(form.cmbRegistrationType().getValue())) { voEmergencyAttendance.setIsMajorIncident(true); } voCollEmergencyAttendance.add(voEmergencyAttendance); voEmergencyEpisode.setEmergencyAttendances(voCollEmergencyAttendance); form.getLocalContext().setemergencyEpisodeToSave(voEmergencyEpisode); form.getLocalContext().setemergencyAttendanceToSave(voEmergencyAttendance); return voEmergencyEpisode; }
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; }