use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project openmrs-module-fhir2 by openmrs.
the class ServiceRequestFhirResourceProviderIntegrationTest method shouldSearchForExistingServiceRequestsAsXML.
@Test
public void shouldSearchForExistingServiceRequestsAsXML() throws Exception {
MockHttpServletResponse response = get("/ServiceRequest").accept(FhirMediaTypes.XML).go();
assertThat(response, isOk());
assertThat(response.getContentType(), is(FhirMediaTypes.XML.toString()));
assertThat(response.getContentAsString(), notNullValue());
Bundle results = readBundleResponse(response);
assertThat(results, notNullValue());
assertThat(results.getType(), equalTo(Bundle.BundleType.SEARCHSET));
assertThat(results.hasEntry(), is(true));
List<Bundle.BundleEntryComponent> entries = results.getEntry();
assertThat(entries, everyItem(hasProperty("fullUrl", startsWith("http://localhost/ws/fhir2/R4/ServiceRequest/"))));
assertThat(entries, everyItem(hasResource(instanceOf(ServiceRequest.class))));
assertThat(entries, everyItem(hasResource(validResource())));
response = get("/ServiceRequest?patient.identifier=101-6&encounter=y403fafb-e5e4-42d0-9d11-4f52e89d123r").accept(FhirMediaTypes.XML).go();
assertThat(response, isOk());
assertThat(response.getContentType(), is(FhirMediaTypes.XML.toString()));
assertThat(response.getContentAsString(), notNullValue());
results = readBundleResponse(response);
assertThat(results, notNullValue());
assertThat(results.getType(), equalTo(Bundle.BundleType.SEARCHSET));
assertThat(results.hasEntry(), is(true));
entries = results.getEntry();
assertThat(entries, everyItem(hasResource(hasProperty("subject", hasProperty("reference", endsWith(PATIENT_UUID))))));
assertThat(entries, everyItem(hasResource(hasProperty("encounter", hasProperty("reference", endsWith(ENCOUNTER_UUID))))));
assertThat(entries, everyItem(hasResource(validResource())));
}
use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project openmrs-module-fhir2 by openmrs.
the class ServiceRequestFhirResourceProviderIntegrationTest method shouldSearchForExistingServiceRequestsAsJson.
@Test
public void shouldSearchForExistingServiceRequestsAsJson() throws Exception {
MockHttpServletResponse response = get("/ServiceRequest").accept(FhirMediaTypes.JSON).go();
assertThat(response, isOk());
assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString()));
assertThat(response.getContentAsString(), notNullValue());
Bundle results = readBundleResponse(response);
assertThat(results, notNullValue());
assertThat(results.getType(), equalTo(Bundle.BundleType.SEARCHSET));
assertThat(results.hasEntry(), is(true));
List<Bundle.BundleEntryComponent> entries = results.getEntry();
assertThat(entries, everyItem(hasProperty("fullUrl", startsWith("http://localhost/ws/fhir2/R4/ServiceRequest/"))));
assertThat(entries, everyItem(hasResource(instanceOf(ServiceRequest.class))));
assertThat(entries, everyItem(hasResource(validResource())));
response = get("/ServiceRequest?patient.identifier=101-6&encounter=y403fafb-e5e4-42d0-9d11-4f52e89d123r").accept(FhirMediaTypes.JSON).go();
assertThat(response, isOk());
assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString()));
assertThat(response.getContentAsString(), notNullValue());
results = readBundleResponse(response);
assertThat(results, notNullValue());
assertThat(results.getType(), equalTo(Bundle.BundleType.SEARCHSET));
assertThat(results.hasEntry(), is(true));
entries = results.getEntry();
assertThat(entries, everyItem(hasResource(hasProperty("subject", hasProperty("reference", endsWith(PATIENT_UUID))))));
assertThat(entries, everyItem(hasResource(hasProperty("encounter", hasProperty("reference", endsWith(ENCOUNTER_UUID))))));
assertThat(entries, everyItem(hasResource(validResource())));
}
use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method generateDocumentNarrative.
public XhtmlNode generateDocumentNarrative(Bundle feed) {
/*
When the document is presented for human consumption, applications must present the collated narrative portions of the following resources in order:
* The Composition resource
* The Subject resource
* Resources referenced in the section.content
*/
XhtmlNode root = new XhtmlNode(NodeType.Element, "div");
Composition comp = (Composition) feed.getEntry().get(0).getResource();
root.getChildNodes().add(comp.getText().getDiv());
Resource subject = ResourceUtilities.getById(feed, null, comp.getSubject().getReference());
if (subject != null && subject instanceof DomainResource) {
root.addTag("hr");
root.getChildNodes().add(((DomainResource) subject).getText().getDiv());
}
List<SectionComponent> sections = comp.getSection();
renderSections(feed, root, sections, 1);
return root;
}
use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeDocumentManifest.
protected void composeDocumentManifest(Complex parent, String parentType, String name, DocumentManifest element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "DocumentManifest", name, element, index);
if (element.hasMasterIdentifier())
composeIdentifier(t, "DocumentManifest", "masterIdentifier", element.getMasterIdentifier(), -1);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "DocumentManifest", "identifier", element.getIdentifier().get(i), i);
if (element.hasSubject())
composeReference(t, "DocumentManifest", "subject", element.getSubject(), -1);
for (int i = 0; i < element.getRecipient().size(); i++) composeReference(t, "DocumentManifest", "recipient", element.getRecipient().get(i), i);
if (element.hasType())
composeCodeableConcept(t, "DocumentManifest", "type", element.getType(), -1);
for (int i = 0; i < element.getAuthor().size(); i++) composeReference(t, "DocumentManifest", "author", element.getAuthor().get(i), i);
if (element.hasCreatedElement())
composeDateTime(t, "DocumentManifest", "created", element.getCreatedElement(), -1);
if (element.hasSourceElement())
composeUri(t, "DocumentManifest", "source", element.getSourceElement(), -1);
if (element.hasStatusElement())
composeEnum(t, "DocumentManifest", "status", element.getStatusElement(), -1);
if (element.hasDescriptionElement())
composeString(t, "DocumentManifest", "description", element.getDescriptionElement(), -1);
for (int i = 0; i < element.getContent().size(); i++) composeDocumentManifestDocumentManifestContentComponent(t, "DocumentManifest", "content", element.getContent().get(i), i);
for (int i = 0; i < element.getRelated().size(); i++) composeDocumentManifestDocumentManifestRelatedComponent(t, "DocumentManifest", "related", element.getRelated().get(i), i);
}
use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeAccount.
protected void composeAccount(Complex parent, String parentType, String name, Account element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Account", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Account", "identifier", element.getIdentifier().get(i), i);
if (element.hasNameElement())
composeString(t, "Account", "name", element.getNameElement(), -1);
if (element.hasType())
composeCodeableConcept(t, "Account", "type", element.getType(), -1);
if (element.hasStatusElement())
composeEnum(t, "Account", "status", element.getStatusElement(), -1);
if (element.hasActivePeriod())
composePeriod(t, "Account", "activePeriod", element.getActivePeriod(), -1);
if (element.hasCurrency())
composeCoding(t, "Account", "currency", element.getCurrency(), -1);
if (element.hasBalance())
composeQuantity(t, "Account", "balance", element.getBalance(), -1);
if (element.hasCoveragePeriod())
composePeriod(t, "Account", "coveragePeriod", element.getCoveragePeriod(), -1);
if (element.hasSubject())
composeReference(t, "Account", "subject", element.getSubject(), -1);
if (element.hasOwner())
composeReference(t, "Account", "owner", element.getOwner(), -1);
if (element.hasDescriptionElement())
composeString(t, "Account", "description", element.getDescriptionElement(), -1);
}
Aggregations