private BodySystemCollection getSystemsForCreation(SystemReviewVoCollection currentActiveNotes, SystemReviewForPresentingProblemConfigVo systemsReviewForproblem) { if (systemsReviewForproblem == null) return null; BodySystemCollection systemCollection = systemsReviewForproblem.getSystem(); if (currentActiveNotes == null) { return systemsReviewForproblem.getSystem(); } if (systemsReviewForproblem.getSystem() != null && systemsReviewForproblem.getSystem().size() > 0 && currentActiveNotes.size() > 0) { for (int i = 0; i < currentActiveNotes.size(); i++) { if (systemsReviewForproblem.getSystem().contains(currentActiveNotes.get(i).getSystems())) { systemCollection.remove(currentActiveNotes.get(i).getSystems()); } } } return systemCollection; }
private void updateControlsState() { //WDEV-17337 SystemReviewVoCollection currentActiveNotes =null; if (form.getLocalContext().getCareContextRef()!=null) currentActiveNotes= domain.getAllActiveSystemNotes(form.getLocalContext().getCareContextRef()); Boolean isEnable = Boolean.TRUE.equals(form.getLocalContext().getisEnabled()); //WDEV-17118 form.btnNew().setEnabled(form.getMode().equals(FormMode.VIEW) && isEnable && checkIsEnabled(currentActiveNotes)); form.btnNew().setText(currentActiveNotes != null ? "Edit review" :"New review"); form.btnCorrect().setEnabled(form.getMode().equals(FormMode.VIEW) && form.getLocalContext().getSelectedSystemReviewIsNotNull() && (! Boolean.TRUE.equals(form.getLocalContext().getSelectedSystemReview().getIsCorrected())) && isEnable); form.btnRie().setEnabled(form.getMode().equals(FormMode.VIEW) && form.getLocalContext().getSelectedSystemReviewIsNotNull() && isEnable); }
private String[] validateUiRules(SystemReviewVoCollection records, Boolean isStale) { ArrayList<String> listOfErrors = new ArrayList<String>(); if (records.size() == 0 && !isStale) { listOfErrors.add("Please complete at least one note."); } int errorCount = listOfErrors.size(); String[] result = new String[errorCount]; for (int x = 0; x < errorCount; x++) result[x] = (String) listOfErrors.get(x); return result; }
private void open() { clear(); SystemReviewVoCollection tempColl = domain.listSystemReview(form.getLocalContext().getCareContextRef()); if( tempColl != null && tempColl.size() > 0) { populateGrid(tempColl); } if( form.getLocalContext().getSelectedSystemReviewIsNotNull()) { form.getLocalContext().setSelectedSystemReview(domain.getSystemReview(form.getLocalContext().getSelectedSystemReview())); form.grdSystemReview().setValue(form.getLocalContext().getSelectedSystemReview()); } }
protected void onBtnNewClick() throws ims.framework.exceptions.PresentationLogicException { //form.getGlobalContext().Emergency.setAddEditForSystemsReviewDlg(Boolean.FALSE); //WDEV-17118 SystemReviewVoCollection currentActiveNotes = domain.getAllActiveSystemNotes(form.getLocalContext().getCareContextRef()); SystemReviewForPresentingProblemConfigVo systemsReviewForproblem = domain.getSystemReviewForPresentingProblem(form.getLocalContext().getClinicalProblemRef()); BodySystemCollection newSystems = getSystemsForCreation(currentActiveNotes, systemsReviewForproblem); SystemReviewVoCollection newSystemReviewColl = new SystemReviewVoCollection(); for (int i = 0; i < newSystems.size(); i++) { SystemReviewVo tempVo = new SystemReviewVo(); tempVo.setPatient(form.getLocalContext().getPatientRef()); tempVo.setAttendance(form.getLocalContext().getCareContextRef()); tempVo.setEpisode(form.getLocalContext().getEpisodeOfCareRef()); tempVo.setSystems(newSystems.get(i)); newSystemReviewColl.add(tempVo); } //engine.open(form.getForms().Emergency.SystemsReviewDialog, new Object[]{tempVo, form.getLocalContext().getClinicalProblemRef()}); if (newSystemReviewColl.size() == 0) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); updateControlsState(); return; } form.getGlobalContext().Emergency.setSystemReviewCollection(newSystemReviewColl); engine.open(form.getForms().Emergency.SystemReviewNotesDialog); }
public void saveSystemsReview(ims.emergency.vo.SystemReviewVoCollection systems) throws ims.domain.exceptions.StaleObjectException { if(systems == null) throw new CodingRuntimeException("SystemReviewVo not provided"); DomainFactory factory = getDomainFactory(); for (int i = 0; i < systems.size(); i++) { SystemsReview doSystemReview = SystemReviewVoAssembler.extractSystemsReview(factory, systems.get(i)); factory.save(doSystemReview); } }
private Boolean checkIsEnabled(SystemReviewVoCollection currentActiveNotes) { SystemReviewForPresentingProblemConfigVo systemsReviewForProblem = null; Boolean isOk = Boolean.FALSE; if (form.getLocalContext().getClinicalProblemRef() != null) { systemsReviewForProblem = domain.getSystemReviewForPresentingProblem(form.getLocalContext().getClinicalProblemRef()); } if (currentActiveNotes == null && systemsReviewForProblem != null && systemsReviewForProblem.getSystem() != null && systemsReviewForProblem.getSystem().size() > 0) { isOk = Boolean.TRUE; } else if (currentActiveNotes != null && systemsReviewForProblem != null && systemsReviewForProblem.getSystem() != null) { if (currentActiveNotes.size() != systemsReviewForProblem.getSystem().size() && systemsReviewForProblem.getSystem().size() > currentActiveNotes.size()) { isOk = Boolean.TRUE; } else { BodySystemCollection clone = (BodySystemCollection) systemsReviewForProblem.getSystem().clone(); for (int x = 0; x < currentActiveNotes.size(); x++) { for (int y = 0; y < systemsReviewForProblem.getSystem().size(); y++) { if (currentActiveNotes.get(x).getSystems().equals(systemsReviewForProblem.getSystem().get(y))) { clone.remove(systemsReviewForProblem.getSystem().get(y)); } } } isOk = (clone.size() > 0); } } return isOk; }
private void save() { SystemReviewVoCollection records = populateDataFromScreen(); SystemReviewVoCollection activeNotes = new SystemReviewVoCollection(); if (form.getGlobalContext().Emergency.getSystemReviewCollection().size() > 0) { activeNotes = domain.getAllActiveSystemNotes(form.getGlobalContext().Emergency.getSystemReviewCollection().get(0).getAttendance()); } Boolean isStale = false; //check if another user has already saved one of the notes you want to save and throw stale if (activeNotes != null) { for (int a = 0; a < activeNotes.size(); a++) { for (int b = 0; b < records.size(); b++) { if (activeNotes.get(a).getSystems() != null && records.get(b).getSystems() != null && activeNotes.get(a).getSystems().equals(records.get(b).getSystems())) { records.remove(records.get(b)); isStale = Boolean.TRUE; } } } } String[] errors = records.validate(); if (errors == null) // if there are no errors, check at least one note is completed { errors = validateUiRules(records, isStale); } if (errors != null && errors.length > 0) { engine.showErrors(errors); return; } try { domain.saveSystemsReview(records); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); } if (isStale) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); } engine.close(DialogResult.OK); }
public ims.emergency.vo.SystemReviewVoCollection listSystemReview(ims.core.admin.vo.CareContextRefVo attendance) { if( attendance == null ) return null; DomainFactory factory = getDomainFactory(); String hsql = "select s1_1 from SystemsReview as s1_1 left join s1_1.attendance as c1_1 where (c1_1.id = :idcareContext) order by s1_1.systemInformation.creationDateTime desc "; List systemrev = factory.find(hsql, new String[] {"idcareContext"}, new Object[] {attendance.getID_CareContext()}); if( systemrev != null && systemrev.size() > 0) return SystemReviewVoAssembler.createSystemReviewVoCollectionFromSystemsReview(systemrev); return null; }
public SystemReviewVoCollection getAllActiveSystemNotes(CareContextRefVo attendance) { DomainFactory factory = getDomainFactory(); String hsql = "select sys from SystemsReview as sys left join sys.attendance as att where (att.id = :idcareContext) and (sys.isRIE is null or sys.isRIE = 0) and (sys.isCorrected is null or sys.isCorrected = 0)"; List systemrev = factory.find(hsql, new String[] {"idcareContext"}, new Object[] {attendance.getID_CareContext()}); if(systemrev != null && systemrev.size() > 0) return SystemReviewVoAssembler.createSystemReviewVoCollectionFromSystemsReview(systemrev); return null; }