Search in sources :

Example 11 with SectionComponent

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;
}
Also used : Element(org.w3c.dom.Element) SectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent)

Example 12 with SectionComponent

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;
}
Also used : Element(org.w3c.dom.Element) SectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent)

Example 13 with SectionComponent

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;
}
Also used : Element(org.w3c.dom.Element) SectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent)

Example 14 with SectionComponent

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;
}
Also used : Element(org.w3c.dom.Element) SectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent)

Example 15 with SectionComponent

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;
}
Also used : Composition(org.hl7.fhir.dstu2016may.model.Composition) DomainResource(org.hl7.fhir.dstu2016may.model.DomainResource) Resource(org.hl7.fhir.dstu2016may.model.Resource) DomainResource(org.hl7.fhir.dstu2016may.model.DomainResource) SectionComponent(org.hl7.fhir.dstu2016may.model.Composition.SectionComponent) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Aggregations

SectionComponent (org.hl7.fhir.dstu3.model.Composition.SectionComponent)10 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)7 SectionComponent (org.hl7.fhir.r4.model.Composition.SectionComponent)4 Element (org.w3c.dom.Element)4 Composition (org.hl7.fhir.dstu3.model.Composition)3 Coding (org.hl7.fhir.dstu3.model.Coding)2 Narrative (org.hl7.fhir.dstu3.model.Narrative)2 ArrayList (java.util.ArrayList)1 Composition (org.hl7.fhir.dstu2.model.Composition)1 SectionComponent (org.hl7.fhir.dstu2.model.Composition.SectionComponent)1 DomainResource (org.hl7.fhir.dstu2.model.DomainResource)1 Resource (org.hl7.fhir.dstu2.model.Resource)1 Composition (org.hl7.fhir.dstu2016may.model.Composition)1 SectionComponent (org.hl7.fhir.dstu2016may.model.Composition.SectionComponent)1 DomainResource (org.hl7.fhir.dstu2016may.model.DomainResource)1 Resource (org.hl7.fhir.dstu2016may.model.Resource)1 CarePlan (org.hl7.fhir.dstu3.model.CarePlan)1 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)1 DomainResource (org.hl7.fhir.dstu3.model.DomainResource)1 Identifier (org.hl7.fhir.dstu3.model.Identifier)1