use of org.hl7.fhir.r4b.model.Composition in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeCompositionCompositionEventComponent.
protected void composeCompositionCompositionEventComponent(Complex parent, String parentType, String name, Composition.CompositionEventComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "event", name, element, index);
for (int i = 0; i < element.getCode().size(); i++) composeCodeableConcept(t, "Composition", "code", element.getCode().get(i), i);
if (element.hasPeriod())
composePeriod(t, "Composition", "period", element.getPeriod(), -1);
for (int i = 0; i < element.getDetail().size(); i++) composeReference(t, "Composition", "detail", element.getDetail().get(i), i);
}
use of org.hl7.fhir.r4b.model.Composition in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeCompositionCompositionAttesterComponent.
protected void composeCompositionCompositionAttesterComponent(Complex parent, String parentType, String name, Composition.CompositionAttesterComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "attester", name, element, index);
for (int i = 0; i < element.getMode().size(); i++) composeEnum(t, "Composition", "mode", element.getMode().get(i), i);
if (element.hasTimeElement())
composeDateTime(t, "Composition", "time", element.getTimeElement(), -1);
if (element.hasParty())
composeReference(t, "Composition", "party", element.getParty(), -1);
}
use of org.hl7.fhir.r4b.model.Composition in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeComposition.
protected void composeComposition(Complex parent, String parentType, String name, Composition element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Composition", name, element, index);
if (element.hasIdentifier())
composeIdentifier(t, "Composition", "identifier", element.getIdentifier(), -1);
if (element.hasDateElement())
composeDateTime(t, "Composition", "date", element.getDateElement(), -1);
if (element.hasType())
composeCodeableConcept(t, "Composition", "type", element.getType(), -1);
if (element.hasClass_())
composeCodeableConcept(t, "Composition", "class", element.getClass_(), -1);
if (element.hasTitleElement())
composeString(t, "Composition", "title", element.getTitleElement(), -1);
if (element.hasStatusElement())
composeEnum(t, "Composition", "status", element.getStatusElement(), -1);
if (element.hasConfidentialityElement())
composeCode(t, "Composition", "confidentiality", element.getConfidentialityElement(), -1);
if (element.hasSubject())
composeReference(t, "Composition", "subject", element.getSubject(), -1);
for (int i = 0; i < element.getAuthor().size(); i++) composeReference(t, "Composition", "author", element.getAuthor().get(i), i);
for (int i = 0; i < element.getAttester().size(); i++) composeCompositionCompositionAttesterComponent(t, "Composition", "attester", element.getAttester().get(i), i);
if (element.hasCustodian())
composeReference(t, "Composition", "custodian", element.getCustodian(), -1);
for (int i = 0; i < element.getEvent().size(); i++) composeCompositionCompositionEventComponent(t, "Composition", "event", element.getEvent().get(i), i);
if (element.hasEncounter())
composeReference(t, "Composition", "encounter", element.getEncounter(), -1);
for (int i = 0; i < element.getSection().size(); i++) composeCompositionSectionComponent(t, "Composition", "section", element.getSection().get(i), i);
}
use of org.hl7.fhir.r4b.model.Composition 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.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.r4b.model.Composition in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method renderBundle.
public XhtmlNode renderBundle(Bundle b) throws FHIRException {
if (b.getType() == BundleType.DOCUMENT) {
if (!b.hasEntry() || !(b.getEntryFirstRep().hasResource() && b.getEntryFirstRep().getResource() instanceof Composition))
throw new FHIRException("Invalid document - first entry is not a Composition");
Composition dr = (Composition) b.getEntryFirstRep().getResource();
return dr.getText().getDiv();
} else {
XhtmlNode root = new XhtmlNode(NodeType.Element, "div");
root.para().addText("Bundle " + b.getId() + " of type " + b.getType().toCode());
int i = 0;
for (BundleEntryComponent be : b.getEntry()) {
root.hr();
root.para().addText("Entry " + Integer.toString(i) + (be.hasFullUrl() ? "Full URL = " + be.getFullUrl() : ""));
if (be.hasRequest())
renderRequest(root, be.getRequest());
if (be.hasSearch())
renderSearch(root, be.getSearch());
if (be.hasResponse())
renderResponse(root, be.getResponse());
if (be.hasResource()) {
root.para().addText("Resource " + be.getResource().fhirType() + ":");
if (be.hasResource() && be.getResource() instanceof DomainResource) {
DomainResource dr = (DomainResource) be.getResource();
if (dr.getText().hasDiv())
root.blockquote().getChildNodes().addAll(dr.getText().getDiv().getChildNodes());
}
}
}
return root;
}
}
Aggregations