use of org.hl7.fhir.r5.model.Composition.SectionComponent in project org.hl7.fhir.core by hapifhir.
the class CCDAConverter method processSocialHistorySection.
protected SectionComponent processSocialHistorySection(Element section) throws Exception {
ListResource list = new ListResource();
for (Element entry : cda.getChildren(section, "entry")) {
Element observation = cda.getlastChild(entry);
if (cda.hasTemplateId(observation, "2.16.840.1.113883.10.20.22.4.38")) {
processSocialObservation(list, observation, SocialHistoryType.SocialHistory);
} else if (cda.hasTemplateId(observation, "2.16.840.1.113883.10.20.15.3.8")) {
processSocialObservation(list, observation, SocialHistoryType.Pregnancy);
} else if (cda.hasTemplateId(observation, "2.16.840.1.113883.10.20.22.4.78")) {
processSocialObservation(list, observation, SocialHistoryType.SmokingStatus);
} else if (cda.hasTemplateId(observation, "2.16.840.1.113883.10.20.22.4.85")) {
processSocialObservation(list, observation, SocialHistoryType.TobaccoUse);
} else
throw new Exception("Unhandled Section template ids: " + cda.showTemplateIds(observation));
}
// todo: text
SectionComponent s = new Composition.SectionComponent();
s.setCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code")));
// todo: check subject
s.addEntry(Factory.makeReference(addReference(list, "Procedures", makeUUIDReference())));
return s;
}
use of org.hl7.fhir.r5.model.Composition.SectionComponent in project org.hl7.fhir.core by hapifhir.
the class CCDAConverter method processProceduresSection.
protected SectionComponent processProceduresSection(Element section) throws Exception {
ListResource list = new ListResource();
for (Element entry : cda.getChildren(section, "entry")) {
Element procedure = cda.getlastChild(entry);
if (cda.hasTemplateId(procedure, "2.16.840.1.113883.10.20.22.4.14")) {
processProcedure(list, procedure, ProcedureType.Procedure);
} else if (cda.hasTemplateId(procedure, "2.16.840.1.113883.10.20.22.4.13")) {
processProcedure(list, procedure, ProcedureType.Observation);
} else if (cda.hasTemplateId(procedure, "2.16.840.1.113883.10.20.22.4.12")) {
processProcedure(list, procedure, ProcedureType.Act);
} else
throw new Exception("Unhandled Section template ids: " + cda.showTemplateIds(procedure));
}
// todo: text
SectionComponent s = new Composition.SectionComponent();
s.setCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code")));
// todo: check subject
s.addEntry(Factory.makeReference(addReference(list, "Procedures", makeUUIDReference())));
return s;
}
use of org.hl7.fhir.r5.model.Composition.SectionComponent in project org.hl7.fhir.core by hapifhir.
the class CCDAConverter method processVitalSignsSection.
protected SectionComponent processVitalSignsSection(Element section) throws Exception {
ListResource list = new ListResource();
for (Element entry : cda.getChildren(section, "entry")) {
Element organizer = cda.getlastChild(entry);
if (cda.hasTemplateId(organizer, "2.16.840.1.113883.10.20.22.4.26")) {
processVitalSignsOrganizer(list, organizer);
} else
throw new Exception("Unhandled Section template ids: " + cda.showTemplateIds(organizer));
}
// todo: text
SectionComponent s = new Composition.SectionComponent();
s.setCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code")));
// todo: check subject
s.addEntry(Factory.makeReference(addReference(list, "Vital Signs", makeUUIDReference())));
return s;
}
use of org.hl7.fhir.r5.model.Composition.SectionComponent in project org.hl7.fhir.core by hapifhir.
the class CCDAConverter method processAdverseReactionsSection.
protected SectionComponent processAdverseReactionsSection(Element section) throws Exception {
ListResource list = new ListResource();
for (Element entry : cda.getChildren(section, "entry")) {
Element concern = cda.getChild(entry, "act");
if (cda.hasTemplateId(concern, "2.16.840.1.113883.10.20.22.4.30")) {
processAllergyProblemAct(list, concern);
} else
throw new Exception("Unhandled Section template ids: " + cda.showTemplateIds(concern));
}
// todo: text
SectionComponent s = new Composition.SectionComponent();
s.setCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code")));
// todo: check subject
s.addEntry(Factory.makeReference(addReference(list, "Allergies, Adverse Reactions, Alerts", makeUUIDReference())));
return s;
}
use of org.hl7.fhir.r5.model.Composition.SectionComponent 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;
}
Aggregations