Skip to content

Instantly share code, notes, and snippets.

@KevinMayfield
Created June 22, 2017 14:14
Show Gist options
  • Save KevinMayfield/007335b96834d986c18a778cd9b28bbd to your computer and use it in GitHub Desktop.
Save KevinMayfield/007335b96834d986c18a778cd9b28bbd to your computer and use it in GitHub Desktop.
public static void searchNHSNumber()
{
FhirContext ctx = FhirContext.forDstu2();
IParser parser = ctx.newXmlParser();
// Create a client and post the transaction to the server
IGenericClient client = ctx.newRestfulGenericClient("http://127.0.0.1:8181/Dstu2/");
System.out.println("GET http://127.0.0.1:8181/Dstu2/Patient?identifier=https://fhir.nhs.uk/Id/nhs-number|9876543210");
Bundle results = client
.search()
.forResource(Patient.class)
.where(Patient.IDENTIFIER.exactly().systemAndCode(CareConnectSystem.SystemNHSNumber,"9876543210"))
.returnBundle(ca.uhn.fhir.model.dstu2.resource.Bundle.class)
.execute();
System.out.println(parser.setPrettyPrint(true).encodeResourceToString(results));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment