Created
June 18, 2017 07:40
-
-
Save KevinMayfield/b71d1318d5fddf5012b334c74d25f561 to your computer and use it in GitHub Desktop.
Patient Search gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a FHIR Context | |
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?birthdate=1998-03-19&given=bernie&family=kanfeld"); | |
Bundle results = client | |
.search() | |
.forResource(Patient.class) | |
.where(Patient.FAMILY.matches().value("kanfeld")) | |
.and(Patient.GIVEN.matches().value("bernie")) | |
.and(Patient.BIRTHDATE.exactly().day("1998-03-19")) | |
.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