@Override protected boolean init(MainController mainController) { super.init(mainController); EncounterSearchCriteria criteria = new EncounterSearchCriteria(); criteria.setPatient(mainController.patient); criteria.setType("H"); List<Encounter> encounters = encounterSearch.search(criteria); return populateListbox(lstInpatient, encounters); }
@Override public void buildQuery(EncounterSearchCriteria criteria, IQuery<Bundle> query) { super.buildQuery(criteria, query); if (criteria.getPatient() != null) { query.where(Encounter.PATIENT.hasId(criteria.getPatient().getId())); } if (criteria.getPeriod() != null) { Date start = criteria.getPeriod().getStart(); Date end = criteria.getPeriod().getEnd(); if (start != null) { if (end == null) { query.where(Encounter.LOCATION_PERIOD.exactly().day(start)); } else { query.where(Encounter.LOCATION_PERIOD.afterOrEquals().day(start)); query.where(Encounter.LOCATION_PERIOD.beforeOrEquals().day(end)); } } else if (end != null) { query.where(Encounter.LOCATION_PERIOD.exactly().day(end)); } } if (criteria.getType() != null) { query.where(Encounter.TYPE.exactly().code(criteria.getType())); } }