use of ca.uhn.fhir.rest.gclient.StringClientParam in project loinc2hpo by monarch-initiative.
the class ObservationDownloader method retrievePatient.
static List<Patient> retrievePatient(String given, String family) {
List<Patient> patients = new ArrayList<>();
Bundle bundle = client.search().forResource(Patient.class).where(new StringClientParam("given").matches().value(given)).where(new StringClientParam("family").matches().value(family)).prettyPrint().returnBundle(Bundle.class).execute();
while (true) {
for (Bundle.BundleEntryComponent bundleEntryComponent : bundle.getEntry()) {
Patient patient = (Patient) bundleEntryComponent.getResource();
patients.add(patient);
}
if (bundle.getLink(IBaseBundle.LINK_NEXT) != null) {
bundle = client.loadPage().next(bundle).execute();
} else {
break;
}
}
return patients;
}
Aggregations