notInListQuery += "&location=" + params.get("location");
}
if (params.get("containsOrderType") != null) {
notInListQuery += "&containsOrderType=" + params.get("containsOrderType");
}
PatientList inList = new PatientList();
inList.setSearchQuery(inListQuery);
inList = service.savePatientList(inList);
PatientList notInList = new PatientList();
notInList.setSearchQuery(notInListQuery);
notInList = service.savePatientList(notInList);
String finalQuery = ("?encounterType=" + params.get("encounterType") + "&inList=" + inList.getUuid() + "¬InList=" + notInList
.getUuid());
PatientList patientList = new PatientList();
patientList.setSearchQuery(finalQuery);
SimpleObject obj = new SimpleObject();
obj.add("uuid", patientList.getUuid());
obj.add("name", patientList.getName());
obj.add("description", patientList.getDescription());
obj.add("searchQuery", patientList.getSearchQuery());
ArrayList patients = new ArrayList();
List<Patient> patientsInPatientList = service.getPatientsInPatientList(patientList);
List<Encounter> encountersInPatientList = service.getEncountersInPatientList(patientList);
for (Patient p : patientsInPatientList) {