@Test public void testGetEncountersInPatientListShouldReturnEncountersOfRequiredProvider() { PatientList p = new PatientList(); p.setCreator(new User()); p.setName("GetPatientsTestList"); p.setSearchQuery("?encounterType=61ae96f4-6afe-4351-b6f8-cd4fc383ctyr" + "&provider=3effc802-12dd-4539-87f6-4065ca8e992c"); List<Encounter> encs = s.getEncountersInPatientList(p); assertEquals(encs.size(), 1); }
@Override public List<Encounter> getEncountersInPatientList(PatientList patientList) { if (patientList.getSearchQuery() == null) { return new ArrayList<Encounter>(); } String query = patientList.getSearchQuery(); if (query.indexOf("?") == 0) { query = query.substring(1); } EncounterType encType = null; Date startDate = null; Date endDate = null; Provider provid = null; Patient patient = null; String uuid = null; List<Encounter> inListEncounters = null; List<Patient> notInListPatients = new ArrayList<Patient>(); List<Encounter> notInListEncounters = new ArrayList<Encounter>(); Location location = null; String containsOrderType = ""; String[] queryFields = query.split("&"); for (int i = 0; i < queryFields.length; i++) { if (queryFields[i].indexOf("encounterType=") != -1) { encType = Context.getEncounterService().getEncounterTypeByUuid(queryFields[i].substring(14)); } else if (queryFields[i].indexOf("location=") != -1) { location = Context.getLocationService().getLocationByUuid(queryFields[i].substring(9)); } else if (queryFields[i].indexOf("startDate=") != -1) { startDate = getDateFromString(queryFields[i].substring(10)); } else if (queryFields[i].indexOf("endDate=") != -1) { endDate = getDateFromString(queryFields[i].substring(8)); } else if (queryFields[i].indexOf("inList=") != -1) { inListEncounters = new ArrayList<Encounter>(); String[] inListUuids = queryFields[i].substring(7).split(","); for (int j = 0; j < inListUuids.length; j++) { inListEncounters.addAll(getEncountersInPatientList(getPatientListByUuid(inListUuids[j]))); } } else if (queryFields[i].indexOf("notInList=") != -1) { String[] notInListUuids = queryFields[i].substring(10).split(","); for (int k = 0; k < notInListUuids.length; k++) { notInListPatients.addAll(getPatientsInPatientList(getPatientListByUuid(notInListUuids[k]))); notInListEncounters.addAll(getEncountersInPatientList(getPatientListByUuid(notInListUuids[k]))); } } else if (queryFields[i].indexOf("provider=") != -1) { uuid = queryFields[i].substring(9); provid = Context.getProviderService().getProviderByUuid(uuid); } else if (queryFields[i].indexOf("patient=") != -1) { uuid = queryFields[i].substring(8); patient = Context.getPatientService().getPatientByUuid(uuid); } else if (queryFields[i].indexOf("containsOrderType=") != -1) { containsOrderType = queryFields[i].substring(18); } } List<EncounterType> encTypes = new ArrayList<EncounterType>(); List<Provider> provids = new ArrayList<Provider>(); List<Encounter> encs = new ArrayList<Encounter>(); encTypes.add(encType); provids.add(provid); if (inListEncounters != null) { encs = inListEncounters; Iterator<Encounter> iter = encs.iterator(); while (iter.hasNext()) { Encounter currEnc = iter.next(); if ((startDate != null && currEnc.getEncounterDatetime().before(startDate)) || (endDate != null && currEnc.getEncounterDatetime().after(endDate)) || (encType != null && !currEnc.getEncounterType().equals(encType)) || (patient != null && !currEnc.getPatient().equals(patient))) { iter.remove(); } else if (provid != null) { Iterator<Set<Provider>> providerIter = currEnc.getProvidersByRoles().values().iterator(); boolean hasProvider = false; while (providerIter.hasNext() && !hasProvider) { Set<Provider> providerEncounters = providerIter.next(); if (providerEncounters.contains(provid)) { hasProvider = true; } } if (!hasProvider) { iter.remove(); } } } } else { if (uuid != null) { encs = Context.getEncounterService().getEncounters(patient, location, startDate, endDate, null, encTypes, provids, null, null, Boolean.FALSE); } else { encs = Context.getEncounterService().getEncounters(patient, location, startDate, endDate, null, encTypes, null, null, null, Boolean.FALSE); } } if (notInListPatients != null) { Iterator<Encounter> iter = encs.iterator(); Iterator<Encounter> iter2; while (iter.hasNext()) { Encounter currEnc = iter.next(); if (notInListPatients.contains(currEnc.getPatient())) { iter2 = notInListEncounters.iterator(); boolean removed = false; while (iter2.hasNext() && !removed) { Encounter currEnc2 = iter2.next(); if (currEnc2.getPatient().equals(currEnc.getPatient()) && currEnc2.getEncounterDatetime().after(currEnc.getEncounterDatetime())) { iter.remove(); removed = true; } } } } } if (containsOrderType.equals("drugOrder")) { boolean shouldRemove; Iterator<Encounter> iter = encs.iterator(); while (iter.hasNext()) { shouldRemove = true; Encounter currEnc = iter.next(); Iterator<Order> orderIter = currEnc.getOrders().iterator(); while (orderIter.hasNext()) { Order o = orderIter.next(); if (o.isDrugOrder()) { shouldRemove = false; break; } } if (shouldRemove) { iter.remove(); } } } return encs; }
PatientListServiceImpl implements PatientListService { @Override public List<Encounter> getEncountersInPatientList(PatientList patientList) { if (patientList.getSearchQuery() == null) { return new ArrayList<Encounter>(); } String query = patientList.getSearchQuery(); if (query.indexOf("?") == 0) { query = query.substring(1); } EncounterType encType = null; Date startDate = null; Date endDate = null; Provider provid = null; Patient patient = null; String uuid = null; List<Encounter> inListEncounters = null; List<Patient> notInListPatients = new ArrayList<Patient>(); List<Encounter> notInListEncounters = new ArrayList<Encounter>(); Location location = null; String containsOrderType = ""; String[] queryFields = query.split("&"); for (int i = 0; i < queryFields.length; i++) { if (queryFields[i].indexOf("encounterType=") != -1) { encType = Context.getEncounterService().getEncounterTypeByUuid(queryFields[i].substring(14)); } else if (queryFields[i].indexOf("location=") != -1) { location = Context.getLocationService().getLocationByUuid(queryFields[i].substring(9)); } else if (queryFields[i].indexOf("startDate=") != -1) { startDate = getDateFromString(queryFields[i].substring(10)); } else if (queryFields[i].indexOf("endDate=") != -1) { endDate = getDateFromString(queryFields[i].substring(8)); } else if (queryFields[i].indexOf("inList=") != -1) { inListEncounters = new ArrayList<Encounter>(); String[] inListUuids = queryFields[i].substring(7).split(","); for (int j = 0; j < inListUuids.length; j++) { inListEncounters.addAll(getEncountersInPatientList(getPatientListByUuid(inListUuids[j]))); } } else if (queryFields[i].indexOf("notInList=") != -1) { String[] notInListUuids = queryFields[i].substring(10).split(","); for (int k = 0; k < notInListUuids.length; k++) { notInListPatients.addAll(getPatientsInPatientList(getPatientListByUuid(notInListUuids[k]))); notInListEncounters.addAll(getEncountersInPatientList(getPatientListByUuid(notInListUuids[k]))); } } else if (queryFields[i].indexOf("provider=") != -1) { uuid = queryFields[i].substring(9); provid = Context.getProviderService().getProviderByUuid(uuid); } else if (queryFields[i].indexOf("patient=") != -1) { uuid = queryFields[i].substring(8); patient = Context.getPatientService().getPatientByUuid(uuid); } else if (queryFields[i].indexOf("containsOrderType=") != -1) { containsOrderType = queryFields[i].substring(18); } } List<EncounterType> encTypes = new ArrayList<EncounterType>(); List<Provider> provids = new ArrayList<Provider>(); List<Encounter> encs = new ArrayList<Encounter>(); encTypes.add(encType); provids.add(provid); if (inListEncounters != null) { encs = inListEncounters; Iterator<Encounter> iter = encs.iterator(); while (iter.hasNext()) { Encounter currEnc = iter.next(); if ((startDate != null && currEnc.getEncounterDatetime().before(startDate)) || (endDate != null && currEnc.getEncounterDatetime().after(endDate)) || (encType != null && !currEnc.getEncounterType().equals(encType)) || (patient != null && !currEnc.getPatient().equals(patient))) { iter.remove(); } else if (provid != null) { Iterator<Set<Provider>> providerIter = currEnc.getProvidersByRoles().values().iterator(); boolean hasProvider = false; while (providerIter.hasNext() && !hasProvider) { Set<Provider> providerEncounters = providerIter.next(); if (providerEncounters.contains(provid)) { hasProvider = true; } } if (!hasProvider) { iter.remove(); } } } } else { if (uuid != null) { encs = Context.getEncounterService().getEncounters(patient, location, startDate, endDate, null, encTypes, provids, null, null, Boolean.FALSE); } else { encs = Context.getEncounterService().getEncounters(patient, location, startDate, endDate, null, encTypes, null, null, null, Boolean.FALSE); } } if (notInListPatients != null) { Iterator<Encounter> iter = encs.iterator(); Iterator<Encounter> iter2; while (iter.hasNext()) { Encounter currEnc = iter.next(); if (notInListPatients.contains(currEnc.getPatient())) { iter2 = notInListEncounters.iterator(); boolean removed = false; while (iter2.hasNext() && !removed) { Encounter currEnc2 = iter2.next(); if (currEnc2.getPatient().equals(currEnc.getPatient()) && currEnc2.getEncounterDatetime().after(currEnc.getEncounterDatetime())) { iter.remove(); removed = true; } } } } } if (containsOrderType.equals("drugOrder")) { boolean shouldRemove; Iterator<Encounter> iter = encs.iterator(); while (iter.hasNext()) { shouldRemove = true; Encounter currEnc = iter.next(); Iterator<Order> orderIter = currEnc.getOrders().iterator(); while (orderIter.hasNext()) { Order o = orderIter.next(); if (o.isDrugOrder()) { shouldRemove = false; break; } } if (shouldRemove) { iter.remove(); } } } return encs; } }
PatientListServiceImpl implements PatientListService { @Override public List<Encounter> getEncountersInPatientList(PatientList patientList) { if (patientList.getSearchQuery() == null) { return new ArrayList<Encounter>(); } String query = patientList.getSearchQuery(); if (query.indexOf("?") == 0) { query = query.substring(1); } EncounterType encType = null; Date startDate = null; Date endDate = null; Provider provid = null; Patient patient = null; String uuid = null; List<Encounter> inListEncounters = null; List<Patient> notInListPatients = new ArrayList<Patient>(); List<Encounter> notInListEncounters = new ArrayList<Encounter>(); Location location = null; String containsOrderType = ""; String[] queryFields = query.split("&"); for (int i = 0; i < queryFields.length; i++) { if (queryFields[i].indexOf("encounterType=") != -1) { encType = Context.getEncounterService().getEncounterTypeByUuid(queryFields[i].substring(14)); } else if (queryFields[i].indexOf("location=") != -1) { location = Context.getLocationService().getLocationByUuid(queryFields[i].substring(9)); } else if (queryFields[i].indexOf("startDate=") != -1) { startDate = getDateFromString(queryFields[i].substring(10)); } else if (queryFields[i].indexOf("endDate=") != -1) { endDate = getDateFromString(queryFields[i].substring(8)); } else if (queryFields[i].indexOf("inList=") != -1) { inListEncounters = new ArrayList<Encounter>(); String[] inListUuids = queryFields[i].substring(7).split(","); for (int j = 0; j < inListUuids.length; j++) { inListEncounters.addAll(getEncountersInPatientList(getPatientListByUuid(inListUuids[j]))); } } else if (queryFields[i].indexOf("notInList=") != -1) { String[] notInListUuids = queryFields[i].substring(10).split(","); for (int k = 0; k < notInListUuids.length; k++) { notInListPatients.addAll(getPatientsInPatientList(getPatientListByUuid(notInListUuids[k]))); notInListEncounters.addAll(getEncountersInPatientList(getPatientListByUuid(notInListUuids[k]))); } } else if (queryFields[i].indexOf("provider=") != -1) { uuid = queryFields[i].substring(9); provid = Context.getProviderService().getProviderByUuid(uuid); } else if (queryFields[i].indexOf("patient=") != -1) { uuid = queryFields[i].substring(8); patient = Context.getPatientService().getPatientByUuid(uuid); } else if (queryFields[i].indexOf("containsOrderType=") != -1) { containsOrderType = queryFields[i].substring(18); } } List<EncounterType> encTypes = new ArrayList<EncounterType>(); List<Provider> provids = new ArrayList<Provider>(); List<Encounter> encs = new ArrayList<Encounter>(); encTypes.add(encType); provids.add(provid); if (inListEncounters != null) { encs = inListEncounters; Iterator<Encounter> iter = encs.iterator(); while (iter.hasNext()) { Encounter currEnc = iter.next(); if ((startDate != null && currEnc.getEncounterDatetime().before(startDate)) || (endDate != null && currEnc.getEncounterDatetime().after(endDate)) || (encType != null && !currEnc.getEncounterType().equals(encType)) || (patient != null && !currEnc.getPatient().equals(patient))) { iter.remove(); } else if (provid != null) { Iterator<Set<Provider>> providerIter = currEnc.getProvidersByRoles().values().iterator(); boolean hasProvider = false; while (providerIter.hasNext() && !hasProvider) { Set<Provider> providerEncounters = providerIter.next(); if (providerEncounters.contains(provid)) { hasProvider = true; } } if (!hasProvider) { iter.remove(); } } } } else { if (uuid != null) { encs = Context.getEncounterService().getEncounters(patient, location, startDate, endDate, null, encTypes, provids, null, null, Boolean.FALSE); } else { encs = Context.getEncounterService().getEncounters(patient, location, startDate, endDate, null, encTypes, null, null, null, Boolean.FALSE); } } if (notInListPatients != null) { Iterator<Encounter> iter = encs.iterator(); Iterator<Encounter> iter2; while (iter.hasNext()) { Encounter currEnc = iter.next(); if (notInListPatients.contains(currEnc.getPatient())) { iter2 = notInListEncounters.iterator(); boolean removed = false; while (iter2.hasNext() && !removed) { Encounter currEnc2 = iter2.next(); if (currEnc2.getPatient().equals(currEnc.getPatient()) && currEnc2.getEncounterDatetime().after(currEnc.getEncounterDatetime())) { iter.remove(); removed = true; } } } } } if (containsOrderType.equals("drugOrder")) { boolean shouldRemove; Iterator<Encounter> iter = encs.iterator(); while (iter.hasNext()) { shouldRemove = true; Encounter currEnc = iter.next(); Iterator<Order> orderIter = currEnc.getOrders().iterator(); while (orderIter.hasNext()) { Order o = orderIter.next(); if (o.isDrugOrder()) { shouldRemove = false; break; } } if (shouldRemove) { iter.remove(); } } } return encs; }  }
PatientListServiceImpl implements PatientListService { @Override public List<Encounter> getEncountersInPatientList(PatientList patientList) { if (patientList.getSearchQuery() == null) { return new ArrayList<Encounter>(); } String query = patientList.getSearchQuery(); if (query.indexOf("?") == 0) { query = query.substring(1); } EncounterType encType = null; Date startDate = null; Date endDate = null; Provider provid = null; Patient patient = null; String uuid = null; List<Encounter> inListEncounters = null; List<Patient> notInListPatients = new ArrayList<Patient>(); List<Encounter> notInListEncounters = new ArrayList<Encounter>(); Location location = null; String containsOrderType = ""; String[] queryFields = query.split("&"); for (int i = 0; i < queryFields.length; i++) { if (queryFields[i].indexOf("encounterType=") != -1) { encType = Context.getEncounterService().getEncounterTypeByUuid(queryFields[i].substring(14)); } else if (queryFields[i].indexOf("location=") != -1) { location = Context.getLocationService().getLocationByUuid(queryFields[i].substring(9)); } else if (queryFields[i].indexOf("startDate=") != -1) { startDate = getDateFromString(queryFields[i].substring(10)); } else if (queryFields[i].indexOf("endDate=") != -1) { endDate = getDateFromString(queryFields[i].substring(8)); } else if (queryFields[i].indexOf("inList=") != -1) { inListEncounters = new ArrayList<Encounter>(); String[] inListUuids = queryFields[i].substring(7).split(","); for (int j = 0; j < inListUuids.length; j++) { inListEncounters.addAll(getEncountersInPatientList(getPatientListByUuid(inListUuids[j]))); } } else if (queryFields[i].indexOf("notInList=") != -1) { String[] notInListUuids = queryFields[i].substring(10).split(","); for (int k = 0; k < notInListUuids.length; k++) { notInListPatients.addAll(getPatientsInPatientList(getPatientListByUuid(notInListUuids[k]))); notInListEncounters.addAll(getEncountersInPatientList(getPatientListByUuid(notInListUuids[k]))); } } else if (queryFields[i].indexOf("provider=") != -1) { uuid = queryFields[i].substring(9); provid = Context.getProviderService().getProviderByUuid(uuid); } else if (queryFields[i].indexOf("patient=") != -1) { uuid = queryFields[i].substring(8); patient = Context.getPatientService().getPatientByUuid(uuid); } else if (queryFields[i].indexOf("containsOrderType=") != -1) { containsOrderType = queryFields[i].substring(18); } } List<EncounterType> encTypes = new ArrayList<EncounterType>(); List<Provider> provids = new ArrayList<Provider>(); List<Encounter> encs = new ArrayList<Encounter>(); encTypes.add(encType); provids.add(provid); if (inListEncounters != null) { encs = inListEncounters; Iterator<Encounter> iter = encs.iterator(); while (iter.hasNext()) { Encounter currEnc = iter.next(); if ((startDate != null && currEnc.getEncounterDatetime().before(startDate)) || (endDate != null && currEnc.getEncounterDatetime().after(endDate)) || (encType != null && !currEnc.getEncounterType().equals(encType)) || (patient != null && !currEnc.getPatient().equals(patient))) { iter.remove(); } else if (provid != null) { Iterator<Set<Provider>> providerIter = currEnc.getProvidersByRoles().values().iterator(); boolean hasProvider = false; while (providerIter.hasNext() && !hasProvider) { Set<Provider> providerEncounters = providerIter.next(); if (providerEncounters.contains(provid)) { hasProvider = true; } } if (!hasProvider) { iter.remove(); } } } } else { if (uuid != null) { encs = Context.getEncounterService().getEncounters(patient, location, startDate, endDate, null, encTypes, provids, null, null, Boolean.FALSE); } else { encs = Context.getEncounterService().getEncounters(patient, location, startDate, endDate, null, encTypes, null, null, null, Boolean.FALSE); } } if (notInListPatients != null) { Iterator<Encounter> iter = encs.iterator(); Iterator<Encounter> iter2; while (iter.hasNext()) { Encounter currEnc = iter.next(); if (notInListPatients.contains(currEnc.getPatient())) { iter2 = notInListEncounters.iterator(); boolean removed = false; while (iter2.hasNext() && !removed) { Encounter currEnc2 = iter2.next(); if (currEnc2.getPatient().equals(currEnc.getPatient()) && currEnc2.getEncounterDatetime().after(currEnc.getEncounterDatetime())) { iter.remove(); removed = true; } } } } } if (containsOrderType.equals("drugOrder")) { boolean shouldRemove; Iterator<Encounter> iter = encs.iterator(); while (iter.hasNext()) { shouldRemove = true; Encounter currEnc = iter.next(); Iterator<Order> orderIter = currEnc.getOrders().iterator(); while (orderIter.hasNext()) { Order o = orderIter.next(); if (o.isDrugOrder()) { shouldRemove = false; break; } } if (shouldRemove) { iter.remove(); } } } return encs; }  @Override void setPatientListDAO(PatientListDAO dao); @Override PatientList savePatientList(PatientList patientList); @Override PatientList getPatientList(Integer id); @Override List<PatientList> getPatientListByName(String name); @Override PatientList getPatientListByUuid(String uuid); @Override List<PatientList> getPatientListByEncounterType(EncounterType encounterType); @Override List<PatientList> getAllPatientList(boolean includeRetired); @Override List<Encounter> getEncountersInPatientList(PatientList patientList); @Override List<Patient> getPatientsInPatientList(PatientList patientList); @Override PatientList updatePatientList(PatientList patientList); @Override void deletePatientList(PatientList patientList); @Override void onStartup(); @Override void onShutdown(); }
PatientListServiceImpl implements PatientListService { @Override public List<Encounter> getEncountersInPatientList(PatientList patientList) { if (patientList.getSearchQuery() == null) { return new ArrayList<Encounter>(); } String query = patientList.getSearchQuery(); if (query.indexOf("?") == 0) { query = query.substring(1); } EncounterType encType = null; Date startDate = null; Date endDate = null; Provider provid = null; Patient patient = null; String uuid = null; List<Encounter> inListEncounters = null; List<Patient> notInListPatients = new ArrayList<Patient>(); List<Encounter> notInListEncounters = new ArrayList<Encounter>(); Location location = null; String containsOrderType = ""; String[] queryFields = query.split("&"); for (int i = 0; i < queryFields.length; i++) { if (queryFields[i].indexOf("encounterType=") != -1) { encType = Context.getEncounterService().getEncounterTypeByUuid(queryFields[i].substring(14)); } else if (queryFields[i].indexOf("location=") != -1) { location = Context.getLocationService().getLocationByUuid(queryFields[i].substring(9)); } else if (queryFields[i].indexOf("startDate=") != -1) { startDate = getDateFromString(queryFields[i].substring(10)); } else if (queryFields[i].indexOf("endDate=") != -1) { endDate = getDateFromString(queryFields[i].substring(8)); } else if (queryFields[i].indexOf("inList=") != -1) { inListEncounters = new ArrayList<Encounter>(); String[] inListUuids = queryFields[i].substring(7).split(","); for (int j = 0; j < inListUuids.length; j++) { inListEncounters.addAll(getEncountersInPatientList(getPatientListByUuid(inListUuids[j]))); } } else if (queryFields[i].indexOf("notInList=") != -1) { String[] notInListUuids = queryFields[i].substring(10).split(","); for (int k = 0; k < notInListUuids.length; k++) { notInListPatients.addAll(getPatientsInPatientList(getPatientListByUuid(notInListUuids[k]))); notInListEncounters.addAll(getEncountersInPatientList(getPatientListByUuid(notInListUuids[k]))); } } else if (queryFields[i].indexOf("provider=") != -1) { uuid = queryFields[i].substring(9); provid = Context.getProviderService().getProviderByUuid(uuid); } else if (queryFields[i].indexOf("patient=") != -1) { uuid = queryFields[i].substring(8); patient = Context.getPatientService().getPatientByUuid(uuid); } else if (queryFields[i].indexOf("containsOrderType=") != -1) { containsOrderType = queryFields[i].substring(18); } } List<EncounterType> encTypes = new ArrayList<EncounterType>(); List<Provider> provids = new ArrayList<Provider>(); List<Encounter> encs = new ArrayList<Encounter>(); encTypes.add(encType); provids.add(provid); if (inListEncounters != null) { encs = inListEncounters; Iterator<Encounter> iter = encs.iterator(); while (iter.hasNext()) { Encounter currEnc = iter.next(); if ((startDate != null && currEnc.getEncounterDatetime().before(startDate)) || (endDate != null && currEnc.getEncounterDatetime().after(endDate)) || (encType != null && !currEnc.getEncounterType().equals(encType)) || (patient != null && !currEnc.getPatient().equals(patient))) { iter.remove(); } else if (provid != null) { Iterator<Set<Provider>> providerIter = currEnc.getProvidersByRoles().values().iterator(); boolean hasProvider = false; while (providerIter.hasNext() && !hasProvider) { Set<Provider> providerEncounters = providerIter.next(); if (providerEncounters.contains(provid)) { hasProvider = true; } } if (!hasProvider) { iter.remove(); } } } } else { if (uuid != null) { encs = Context.getEncounterService().getEncounters(patient, location, startDate, endDate, null, encTypes, provids, null, null, Boolean.FALSE); } else { encs = Context.getEncounterService().getEncounters(patient, location, startDate, endDate, null, encTypes, null, null, null, Boolean.FALSE); } } if (notInListPatients != null) { Iterator<Encounter> iter = encs.iterator(); Iterator<Encounter> iter2; while (iter.hasNext()) { Encounter currEnc = iter.next(); if (notInListPatients.contains(currEnc.getPatient())) { iter2 = notInListEncounters.iterator(); boolean removed = false; while (iter2.hasNext() && !removed) { Encounter currEnc2 = iter2.next(); if (currEnc2.getPatient().equals(currEnc.getPatient()) && currEnc2.getEncounterDatetime().after(currEnc.getEncounterDatetime())) { iter.remove(); removed = true; } } } } } if (containsOrderType.equals("drugOrder")) { boolean shouldRemove; Iterator<Encounter> iter = encs.iterator(); while (iter.hasNext()) { shouldRemove = true; Encounter currEnc = iter.next(); Iterator<Order> orderIter = currEnc.getOrders().iterator(); while (orderIter.hasNext()) { Order o = orderIter.next(); if (o.isDrugOrder()) { shouldRemove = false; break; } } if (shouldRemove) { iter.remove(); } } } return encs; }  @Override void setPatientListDAO(PatientListDAO dao); @Override PatientList savePatientList(PatientList patientList); @Override PatientList getPatientList(Integer id); @Override List<PatientList> getPatientListByName(String name); @Override PatientList getPatientListByUuid(String uuid); @Override List<PatientList> getPatientListByEncounterType(EncounterType encounterType); @Override List<PatientList> getAllPatientList(boolean includeRetired); @Override List<Encounter> getEncountersInPatientList(PatientList patientList); @Override List<Patient> getPatientsInPatientList(PatientList patientList); @Override PatientList updatePatientList(PatientList patientList); @Override void deletePatientList(PatientList patientList); @Override void onStartup(); @Override void onShutdown();  }