Skip to content

Instantly share code, notes, and snippets.

@KevinMayfield
Last active December 7, 2018 16:06
Show Gist options
  • Save KevinMayfield/08324cdf9cb5c5462977ef2e681b7180 to your computer and use it in GitHub Desktop.
Save KevinMayfield/08324cdf9cb5c5462977ef2e681b7180 to your computer and use it in GitHub Desktop.
private void sendNRLS(Bundle bundle) {
for (Bundle.BundleEntryComponent entry : bundle.getEntry()) {
if (entry.getResource() instanceof DocumentReference) {
DocumentReference documentReference = (DocumentReference) entry.getResource();
documentReference.setSubject(new Reference("https://demographics.spineservices.nhs.uk/STU3/Patient/9658220169"));
documentReference.setAuthor(new ArrayList<>());
documentReference.addAuthor().setReference("https://directory.spineservices.nhs.uk/STU3/Organization/MHT01");
documentReference.setCustodian(new Reference("https://directory.spineservices.nhs.uk/STU3/Organization/MHT01"));
documentReference.setType(null);
documentReference.getType().addCoding()
.setSystem("http://snomed.info/sct")
.setDisplay("Mental Health Crisis Plan")
.setCode("736253002");
System.out.println(FhirContext.forDstu3().newJsonParser().setPrettyPrint(true).encodeResourceToString(documentReference));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment