use of org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent in project loinc2hpo by monarch-initiative.
the class ObservationDownloader method find20CompleteRecordOfEachType.
static void find20CompleteRecordOfEachType() {
int i = 0;
Bundle bundle = client.search().forResource(Observation.class).prettyPrint().returnBundle(Bundle.class).execute();
while (true) {
for (Bundle.BundleEntryComponent bundleEntryComponent : bundle.getEntry()) {
Observation observation = (Observation) bundleEntryComponent.getResource();
if (isComplte(observation)) {
String completeRecord = jsonParser.encodeResourceToString(observation);
i++;
System.out.println(i + ". Find a complete record: \n" + completeRecord);
}
;
}
if (bundle.getLink(IBaseBundle.LINK_NEXT) != null) {
bundle = client.loadPage().next(bundle).execute();
} else {
break;
}
}
}
use of org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent in project gpconnect-demonstrator by nhsconnect.
the class PopulateSlotBundle method addOrganisation.
/**
* Add OrganizationResource to Bundle
*
* @param organization OrganizationDetails object to add to bundle
* @param bundle Bundle Resource to add organisation to
*/
private void addOrganisation(OrganizationDetails organization, Bundle bundle) {
BundleEntryComponent organizationEntry = new BundleEntryComponent();
Long organizationId = organization.getId();
OrganizationDetails organizationDetails = organizationSearch.findOrganizationDetails(organizationId);
Organization organizationResource = organizationResourceProvider.convertOrganizationDetailsToOrganization(organizationDetails);
organizationEntry.setResource(organizationResource);
// #202 use full urls
// #215 full url removed completely
// organizationEntry.setFullUrl(serverBaseUrl + "Organization/" + organization.getId());
bundle.addEntry(organizationEntry);
}
use of org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent in project gpconnect-demonstrator by nhsconnect.
the class PopulateMedicationBundle method addMedicationBundleEntries.
public Bundle addMedicationBundleEntries(Bundle structuredBundle, PatientDetails patientDetails, Boolean includePrescriptionIssues, Period medicationPeriod, Set<String> practitionerIds, Set<String> orgIds) {
BundleEntryComponent listEntry = new BundleEntryComponent();
List<MedicationStatementDetail> medicationStatements = findMedicationStatements(Long.valueOf(patientDetails.getId()), medicationPeriod);
structuredBundle.addEntry(listEntry.setResource(createListEntry(medicationStatements, patientDetails.getNhsNumber())));
medicationStatements.forEach(medicationStatement -> {
createBundleEntries(medicationStatement, includePrescriptionIssues, patientDetails, practitionerIds, orgIds).forEach(bundleEntry -> structuredBundle.addEntry(bundleEntry));
});
return structuredBundle;
}
use of org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent 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;
}
use of org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent 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