@Override protected void onImbSearchClick() throws ims.framework.exceptions.PresentationLogicException { String[] errors = validateSearchCriteria(); if (errors != null && errors.length > 0) { engine.showErrors(errors); return; } clearResultScreen(); SurgicalOPNotesFilterVo searchFilter = populateSearchDataFromScreen(); form.getGlobalContext().Clinical.setSurgicalOpNotesFilter(searchFilter); SurgicalOperationNotesListVoCollection listResults = domain.listSurgicalOpNotes(searchFilter); if (listResults == null || listResults.size() == 0) { engine.showMessage( "No results were found. Please alter your search criteria", "No results", MessageButtons.OK, MessageIcon.INFORMATION); return; } populateResultScreenFromData(listResults); if (searchFilter != null && searchFilter.getColumnSortOrder() != null) { setSortOrderForColumn( searchFilter.getColumnSortOrder().getColumnId(), searchFilter.getColumnSortOrder().getSortOrder()); } updateControlState(); }
private String[] validateSearchCriteria() { ArrayList<String> listOfErrors = new ArrayList<String>(); SurgicalOPNotesFilterVo sonf = populateSearchDataFromScreen(); if (sonf.countFieldsWithValue() == 0) { listOfErrors.add("Please fill in at least one search field"); } else { Date today = new Date(); if (today.isLessThan(sonf.getDateFrom())) { listOfErrors.add("'Date From' cannot be set to a date in the future."); // WDEV-18762 } if (today.isLessThan(sonf.getDateTo())) { listOfErrors.add("'Date To' cannot be set to a date in the future."); // WDEV-18762 } if (sonf.getDateToIsNotNull() && sonf.getDateFromIsNotNull() && sonf.getDateFrom().isGreaterThan(sonf.getDateTo())) { listOfErrors.add("'Date From' cannot be later than 'Date To'."); // WDEV-18762 } } if (listOfErrors.size() == 0) return null; String[] errors = new String[listOfErrors.size()]; errors = listOfErrors.toArray(errors); return errors; }
private void open() { if (form.getGlobalContext().Clinical.getSurgicalOpNotesFilterIsNotNull()) { populateSearchScreenFromData(form.getGlobalContext().Clinical.getSurgicalOpNotesFilter()); String[] errors = validateSearchCriteria(); if (errors == null || errors.length == 0) { populateResultScreenFromData(domain.listSurgicalOpNotes(populateSearchDataFromScreen())); SurgicalOPNotesFilterVo searchFilter = form.getGlobalContext().Clinical.getSurgicalOpNotesFilter(); if (searchFilter != null && searchFilter.getColumnSortOrder() != null) { setSortOrderForColumn( searchFilter.getColumnSortOrder().getColumnId(), searchFilter.getColumnSortOrder().getSortOrder()); } } } form.setMode(FormMode.VIEW); updateControlState(); }
private void populateSearchScreenFromData(SurgicalOPNotesFilterVo record) { clearSearchScreen(); if (record == null) return; if (record.getProcedureIsNotNull()) { form.qmbProcedure().newRow(record.getProcedure(), record.getProcedure().getProcedureName()); form.qmbProcedure().setValue(record.getProcedure()); } if (record.getDiagnosisIsNotNull()) { form.qmbDiagnosis().newRow(record.getDiagnosis(), record.getDiagnosis().getDiagnosisName()); form.qmbDiagnosis().setValue(record.getDiagnosis()); } if (record.getDiagramIsNotNull()) { form.qmbDiagram().newRow(record.getDiagram(), record.getDiagram().getName()); form.qmbDiagram().setValue(record.getDiagram()); } if (record.getHospitalIsNotNull()) { form.qmbHospital().newRow(record.getHospital(), record.getHospital().getName()); form.qmbHospital().setValue(record.getHospital()); } if (record.getOperatingSurgeonIsNotNull()) { form.qmbOpSurgeon() .newRow(record.getOperatingSurgeon(), record.getOperatingSurgeon().getIMosName()); form.qmbOpSurgeon().setValue(record.getOperatingSurgeon()); } if (record.getCompletingClinicianIsNotNull()) { form.qmbCompletingClinian() .newRow(record.getCompletingClinician(), record.getCompletingClinician().getIMosName()); form.qmbCompletingClinian().setValue(record.getCompletingClinician()); } if (record.getConsultantIsNotNull()) { form.qmbConsultant().newRow(record.getConsultant(), record.getConsultant().getIMosName()); form.qmbConsultant().setValue(record.getConsultant()); } form.cmbFollowUpOrdered().setValue(record.getFollowupOrdered()); form.dteFrom().setValue(record.getDateFrom()); form.dteTo().setValue(record.getDateTo()); }
private SurgicalOPNotesFilterVo populateSearchDataFromScreen() { SurgicalOPNotesFilterVo result; if (form.getGlobalContext().Clinical.getSurgicalOpNotesFilter() == null) result = new SurgicalOPNotesFilterVo(); else result = (SurgicalOPNotesFilterVo) form.getGlobalContext().Clinical.getSurgicalOpNotesFilter().clone(); result.setCompletingClinician(form.qmbCompletingClinian().getValue()); result.setConsultant(form.qmbConsultant().getValue()); result.setDateFrom(form.dteFrom().getValue()); result.setDateTo(form.dteTo().getValue()); result.setDiagnosis(form.qmbDiagnosis().getValue()); result.setDiagram(form.qmbDiagram().getValue()); result.setFollowupOrdered(form.cmbFollowUpOrdered().getValue()); result.setHospital(form.qmbHospital().getValue()); result.setOperatingSurgeon(form.qmbOpSurgeon().getValue()); result.setProcedure(form.qmbProcedure().getValue()); return result; }