Source:
<code>public SimpleObject getNumberOfPatients( @RequestParam(required = true, value = "nextAppointmentDate") Date nextAppointmentDate, @RequestParam(value = "encounterTypeUuid", defaultValue = "") String encounterTypeUuid) { AdministrationService administrationService = Context.getAdministrationService(); SimpleObject response = new SimpleObject(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); String returnDate = formatter.format(nextAppointmentDate); String sql = "SELECT COUNT(obs.person_id) FROM obs WHERE obs.concept_id=5096 AND obs.value_datetime='" + returnDate + "' AND obs.voided = 0"; String encounterFilterWhereClause = ""; if (!StringUtils.isEmpty(encounterTypeUuid)) { String[] encounterType = encounterTypeUuid.split(","); for (String enc : encounterType) { <START> StringUtils.trimToEmpty(enc); <END> } encounterFilterWhereClause = " AND obs.encounter_id IN ( SELECT encounter.encounter_id FROM encounter INNER JOIN encounter_type ON encounter.encounter_type = encounter_type.encounter_type_id WHERE encounter_type.uuid IN('" + StringUtils.join(encounterType, "','") + "'))"; } log.debug("Checking number of appointments for " + returnDate + " for encounter types " + encounterTypeUuid); List numberOfPatients = administrationService.executeSQL(sql + encounterFilterWhereClause, true); response.add("appointmentdate", returnDate); response.add("encountertypeUuid", encounterTypeUuid); response.add("appointmentcount", ((ArrayList) numberOfPatients.get(0)).get(0)); return response; }</code><technical_language>@reagan trimming adding array trim is working I encounter type data I get records</technical_language>

Target:
public SimpleObject getNumberOfPatients( @RequestParam(required = true, value = "nextAppointmentDate") Date nextAppointmentDate, @RequestParam(value = "encounterTypeUuid", defaultValue = "") String encounterTypeUuid) { AdministrationService administrationService = Context.getAdministrationService(); SimpleObject response = new SimpleObject(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); String returnDate = formatter.format(nextAppointmentDate); String sql = "SELECT COUNT(obs.person_id) FROM obs WHERE obs.concept_id=5096 AND obs.value_datetime='" + returnDate + "' AND obs.voided = 0"; String encounterFilterWhereClause = ""; if (!StringUtils.isEmpty(encounterTypeUuid)) { String[] encounterType = encounterTypeUuid.split(","); ArrayList<String> trimmedEncounterType = new ArrayList<String>(); for (String enc : encounterType) { trimmedEncounterType.add(StringUtils.trimToEmpty(enc)); } encounterFilterWhereClause = " AND obs.encounter_id IN ( SELECT encounter.encounter_id FROM encounter INNER JOIN encounter_type ON encounter.encounter_type = encounter_type.encounter_type_id WHERE encounter_type.uuid IN('" + StringUtils.join(trimmedEncounterType, "','") + "'))"; } log.debug("Checking number of appointments for " + returnDate + " for encounter types " + encounterTypeUuid); List numberOfPatients = administrationService.executeSQL(sql + encounterFilterWhereClause, true); response.add("appointmentdate", returnDate); response.add("encountertypeUuid", encounterTypeUuid); response.add("appointmentcount", ((ArrayList) numberOfPatients.get(0)).get(0)); return response; }