/** * Function used to perform search * Will validate search criteria, retain valid search criteria in persistent GC * perform domain search */ private void search() { // Validate search criteria String[] errors = validateSearchCriteria(); // Test validation if (errors != null && errors.length > 0) { engine.showErrors(errors); return; } // Update search criteria form.getGlobalContext().Clinical.setPatientAssessmentListAndSearchCriteriaVo(populateSearchCriteriaFromScreen()); PatientAssessmentListAndSearchCriteriaVo criteria = form.getGlobalContext().Clinical.getPatientAssessmentListAndSearchCriteriaVo(); // Perform search PatientAssessmentListVoCollection patientAssessments = domain.listPatientAssessments(form.getGlobalContext().Core.getPatientShort(), criteria.getSpecialty(), criteria.getAuthoringHCP(), criteria.getResponsibleHCP(), criteria.getAssessmentName(), criteria.getAssessesmentStatus(), criteria.getDateFrom(), criteria.getDateTo(), GroupDateEnumeration.rdoEventDate.equals(form.GroupDate().getValue())); if (patientAssessments == null || patientAssessments.size() == 0) { engine.showMessage("No results matching search criteria were found"); } // Populate patient assessments results to the grid populateAssessmentGrid(patientAssessments); }
/** * Function use to populate search controls from search criteria */ private void populateSearchControls(PatientAssessmentListAndSearchCriteriaVo searchCriteria) { // Clear search controls clearSearchControls(); // Check parameter if (searchCriteria == null) return; // Populate search controls with data form.cmbSpecialty().setValue(searchCriteria.getSpecialty()); form.ccAuthoringHCP().setValue(searchCriteria.getAuthoringHCP()); form.ccResponsibleHCP().setValue(searchCriteria.getResponsibleHCP()); form.txtAssessmentName().setValue(searchCriteria.getAssessmentName()); form.cmbAssessmentStatus().setValue(searchCriteria.getAssessesmentStatus()); form.dteFrom().setValue(searchCriteria.getDateFrom()); form.dteTo().setValue(searchCriteria.getDateTo()); // Set 'Event Date' / 'Generated Date' if (Boolean.TRUE.equals(searchCriteria.getDateSearchType())) { form.GroupDate().setValue(GroupDateEnumeration.rdoEventDate); } else { form.GroupDate().setValue(GroupDateEnumeration.rdoGeneratedDate); } }
/** * Function used to populate search criteria with values from screen */ private PatientAssessmentListAndSearchCriteriaVo populateSearchCriteriaFromScreen() { // New search criteria PatientAssessmentListAndSearchCriteriaVo searchCriteria = new PatientAssessmentListAndSearchCriteriaVo(); // Get simple values from screen searchCriteria.setSpecialty(form.cmbSpecialty().getValue()); searchCriteria.setAuthoringHCP((HcpLiteVo) form.ccAuthoringHCP().getValue()); searchCriteria.setResponsibleHCP((HcpLiteVo) form.ccResponsibleHCP().getValue()); searchCriteria.setAssessmentName(form.txtAssessmentName().getValue()); searchCriteria.setAssessesmentStatus(form.cmbAssessmentStatus().getValue()); searchCriteria.setDateFrom(form.dteFrom().getValue()); searchCriteria.setDateTo(form.dteTo().getValue()); // Determine date search type if (GroupDateEnumeration.rdoEventDate.equals(form.GroupDate().getValue())) { searchCriteria.setDateSearchType(Boolean.TRUE); } else { searchCriteria.setDateSearchType(Boolean.FALSE); } // Return search criteria return searchCriteria; }