use of ca.uhn.fhir.rest.gclient.TokenClientParam in project loinc2hpo by monarch-initiative.
the class ObservationDownloader method retrieveObservation.
static List<Observation> retrieveObservation(String loincCode) {
List<Observation> results = new ArrayList<>();
Bundle bundle = client.search().forResource(Observation.class).where(new TokenClientParam("code").exactly().systemAndCode(LOINC_SYSTEM, loincCode)).prettyPrint().returnBundle(Bundle.class).execute();
while (true) {
for (Bundle.BundleEntryComponent bundleEntryComponent : bundle.getEntry()) {
Observation observation = (Observation) bundleEntryComponent.getResource();
results.add(observation);
}
if (bundle.getLink(IBaseBundle.LINK_NEXT) != null) {
bundle = client.loadPage().next(bundle).execute();
} else {
break;
}
}
return results;
}
Aggregations