private boolean save() { EmergencyAttendanceForObsPatientAssessmentVo emergAttObsPatAssessmentTosave=populateDataFromScreen(form.getLocalContext().getcurrentObsPatAssessment()); String[] errors = emergAttObsPatAssessmentTosave.validate(getUIErrors()); if(errors != null) { engine.showErrors("Validation Errors", errors); return false; } try { form.getLocalContext().setcurrentEmergencyAttendance(domain.save(emergAttObsPatAssessmentTosave)); } catch (StaleObjectException e) { engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); return false; } return true; }
public ims.emergency.vo.EmergencyAttendanceForObsPatientAssessmentVo save(ims.emergency.vo.EmergencyAttendanceForObsPatientAssessmentVo emergencyAttForObsPatAssessmentToSave) throws ims.domain.exceptions.StaleObjectException { if (emergencyAttForObsPatAssessmentToSave == null) throw new CodingRuntimeException("Cannot save null emergencyAttForObsPatAssessmentToSave "); if (!emergencyAttForObsPatAssessmentToSave.isValidated()) { throw new DomainRuntimeException("emergencyAttForObsPatAssessmentToSave has not been validated"); } DomainFactory factory = getDomainFactory(); EmergencyAttendance doEmergencyAttForPatAssessment = EmergencyAttendanceForObsPatientAssessmentVoAssembler.extractEmergencyAttendance(factory, emergencyAttForObsPatAssessmentToSave); factory.save(doEmergencyAttForPatAssessment); return EmergencyAttendanceForObsPatientAssessmentVoAssembler.create(doEmergencyAttForPatAssessment); }
public EmergencyAttendanceForObsPatientAssessmentVo getEmergencyAttendance(CareContextRefVo careContextRef) { if (careContextRef == null || careContextRef.getID_CareContext() == null) { throw new CodingRuntimeException("Cannot get PatientAssessment on null Id for CareContext "); } DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); hql.append("from EmergencyAttendance as emergAtt where emergAtt.careContext.id = :careContextID "); List<?> list = factory.find(hql.toString(), new String[] { "careContextID" }, new Object[] { careContextRef.getID_CareContext() }); if (list == null || list.size() == 0) return null; return EmergencyAttendanceForObsPatientAssessmentVoAssembler.create((EmergencyAttendance) list.get(0)); }
private EmergencyAttendanceForObsPatientAssessmentVo populateDataFromScreen(PatientAssessmentVo voPatientAssessment) { boolean isAssessmentCompleted = form.cmbStatus().getValue() != null && form.cmbStatus().getValue().equals(PatientAssessmentStatusReason.COMPLETED); if (voPatientAssessment==null) voPatientAssessment=new PatientAssessmentVo(); else voPatientAssessment=(PatientAssessmentVo)voPatientAssessment.clone(); EmergencyAttendanceForObsPatientAssessmentVo emergencyAttToSave = form.getLocalContext().getcurrentEmergencyAttendance(); voPatientAssessment = form.ccAssessment().getPatientAssessment(); voPatientAssessment.setStatus(form.cmbStatus().getValue()); voPatientAssessment.setStatusReason(form.cmbReason().getValue()); voPatientAssessment.setAuthoringInformation(form.customControlAuthoring().getValue()); //Completed Assessment if(isAssessmentCompleted) { AuthoringInformationVo completedData = form.customControlCompleted().getValue(); if(completedData != null) { voPatientAssessment.setCompletedDateTime(completedData.getAuthoringDateTime()); voPatientAssessment.setCompletedHCP(completedData.getAuthoringHcp()); } } else //WDEV-17342 { voPatientAssessment.setCompletedDateTime(null); voPatientAssessment.setCompletedHCP(null); } if(voPatientAssessment.getPatient() == null) voPatientAssessment.setPatient(form.getGlobalContext().Core.getPatientShort()); if(voPatientAssessment.getEpisodeOfCare() == null) voPatientAssessment.setEpisodeOfCare(form.getGlobalContext().Core.getEpisodeofCareShort()); if (voPatientAssessment.getCareContext() == null) voPatientAssessment.setCareContext(form.getGlobalContext().Core.getCurrentCareContext()); emergencyAttToSave.setObsPatientAssessment(voPatientAssessment); return emergencyAttToSave; }