Skip to content

Instantly share code, notes, and snippets.

View KevinMayfield's full-sized avatar

Kevin Mayfield KevinMayfield

  • Leeds, West Riding, UK
View GitHub Profile
Binary binary = new Binary();
String dummyContent = "<!DOCTYPE html><html><body>SOME TEXT</body></html>";
binary.setContent (dummyContent.getBytes());
binary.setContentType("text/html");
System.out.println(FhirContext.forDstu3().newJsonParser().setPrettyPrint(true).encodeResourceToString(binary));
DocumentReference doc = new DocumentReference();
doc.setSubject(new Reference("https://demographics.spineservices.nhs.uk/STU3/Patient/9658218881"));
doc.setStatus(Enumerations.DocumentReferenceStatus.CURRENT);
doc.getType().addCoding()
.setSystem("http://snomed.info/sct")
.setCode("734163000")
.setDisplay("Care Plan");
doc.addAuthor() .setReference("https://directory.spineservices.nhs.uk/STU3/Organization/RR8").setDisplay("LEEDS TEACHING HOSPITALS NHS TRUST");
doc.setIndexed(new Date());
Binary binary = new Binary();
binary.setId(UUID.randomUUID().toString());
String dummyContent = "<!DOCTYPE html><html><body>SOME TEXT</body></html>";
binary.setContent (dummyContent.getBytes());
binary.setContentType("text/html");
System.out.println(FhirContext.forDstu3().newJsonParser().setPrettyPrint(true).encodeResourceToString(binary));
DocumentReference doc = new DocumentReference();
doc.setId(UUID.randomUUID().toString());
doc.setSubject(new Reference("https://demographics.spineservices.nhs.uk/STU3/Patient/9658220169"));
IGenericClient clientODS = ctxFHIR.newRestfulGenericClient("https://directory.spineservices.nhs.uk/STU3/");
clientODS.setEncoding(EncodingEnum.XML);
Organization organization = clientODS
.read()
.resource(Organization.class)
.withId("RR8").execute();
organization.setId(UUID.randomUUID().toString());
private DocumentReference getSimple() {
Binary binary = new Binary();
binary.setId(UUID.randomUUID().toString());
String dummyContent = "<!DOCTYPE html><html><body>SOME TEXT</body></html>";
binary.setContent (dummyContent.getBytes());
binary.setContentType("text/html");
//System.out.println(FhirContext.forDstu3().newJsonParser().setPrettyPrint(true).encodeResourceToString(binary));
DocumentReference doc = new DocumentReference();
<?xml version="1.0" encoding="ISO-8859-1"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:fhir="http://hl7.org/fhir">
<head>
<title>Patient Summary Care Record</title>
<style type="text/css">
body { color: #000000; font-size: 10pt; line-height: normal; font-family: Verdana, Arial, sans-serif; margin: 10px; }
h1 { font-size: 14pt; text-decoration: underline; font-weight: bold; color: #000000; margin-top: 25px; margin-bottom: 15px;}
h2 { font-size: 12pt; text-decoration: underline; font-weight: bold; color: #000000; margin-top: 25px; margin-bottom: 15px; }
h3 { font-size: 10pt; font-weight: bold; color: #000000; margin-top: 5px; margin-bottom: 15px; }
h4 { font-size: 10pt; font-weight: bold; text-decoration: underline; color: #000000; margin-top: 5px; margin-bottom: 15px; }
h5 { font-size: 10pt; font-weight: normal; text-decoration: underline; color: #000000; margin-top: 5px; margin-bottom: 15px; }
{
"resourceType": "Bundle",
"identifier": {
"system": "https://tools.ietf.org/html/rfc4122",
"value": "d124df3f-e966-46c7-9159-401af1974541"
},
"type": "document",
"entry": [
{
"fullUrl": "urn:uuid:37f316aa-94a7-4659-90fd-1d605095cf64",
<Observation xmlns="http://hl7.org/fhir">
<id value="178200"/>
<meta>
<lastUpdated value="2017-11-03T12:37:46.920+00:00"/>
<profile value="https://fhir.hl7.org.uk/STU3/StructureDefinition/CareConnect-Observation-1"/>
</meta>
<status value="final"/>
<category>
<coding>
<system value="http://hl7.org/fhir/observation-category"/>
This is indicative of how acute would represent their relationship with a Patient. It does relate 1:1 with HL7v2 messaging (PV1 segment)
This is a maternity episode when the child was born and represents an episode over 5 days.
Have not included Diagnosis/Condition but this would be applicable here.
This would be used for Inpatient and Outpatients (and Emergency if part of the PAS/EPR system),
other parts of the HL7v2 PV1 segment would be covered by FHIR Encounter such as admission, discharge, etc
<EpisodeOfCare xmlns="http://hl7.org/fhir">
<status value="finished"/>
<type>
<coding>