Search in sources :

Example 6 with SectionComponent

use of org.hl7.fhir.dstu2016may.model.Composition.SectionComponent in project gpconnect-demonstrator by nhsconnect.

the class FhirSectionBuilder method buildFhirSection.

public static SectionComponent buildFhirSection(Page page) {
    Coding coding = new Coding().setSystem(SystemURL.VS_GPC_RECORD_SECTION).setCode(page.getCode()).setDisplay(page.getName());
    CodeableConcept codableConcept = new CodeableConcept().addCoding(coding);
    codableConcept.setText(page.getName());
    Narrative narrative = new Narrative();
    narrative.setStatus(NarrativeStatus.GENERATED);
    narrative.setDivAsString(createHtmlContent(page));
    SectionComponent sectionComponent = new SectionComponent();
    sectionComponent.setCode(codableConcept);
    sectionComponent.setTitle(page.getName()).setCode(codableConcept).setText(narrative);
    return sectionComponent;
}
Also used : Coding(org.hl7.fhir.dstu3.model.Coding) Narrative(org.hl7.fhir.dstu3.model.Narrative) SectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 7 with SectionComponent

use of org.hl7.fhir.dstu2016may.model.Composition.SectionComponent in project integration-adaptor-111 by nhsconnect.

the class CompositionMapper method addSectionChildren.

private void addSectionChildren(SectionComponent component, POCDMT000002UK01Section section) {
    for (POCDMT000002UK01Component5 component5 : section.getComponentArray()) {
        POCDMT000002UK01Section innerSection = component5.getSection();
        SectionComponent innerCompositionSection = getSectionText(innerSection);
        component.addSection(innerCompositionSection);
        if (isNotEmpty(innerSection.getComponentArray())) {
            addSectionChildren(innerCompositionSection, innerSection);
        }
    }
}
Also used : POCDMT000002UK01Section(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section) POCDMT000002UK01Component5(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5) SectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent)

Example 8 with SectionComponent

use of org.hl7.fhir.dstu2016may.model.Composition.SectionComponent in project integration-adaptor-111 by nhsconnect.

the class CompositionMapper method addPathwaysToSection.

private void addPathwaysToSection(Composition composition, List<QuestionnaireResponse> questionnaireResponseList) {
    String questionnaireResponseTitle = "QuestionnaireResponse";
    for (QuestionnaireResponse questionnaireResponse : questionnaireResponseList) {
        SectionComponent sectionComponent = new SectionComponent();
        sectionComponent.addEntry(resourceUtil.createReference(questionnaireResponse));
        sectionComponent.setTitle(questionnaireResponseTitle);
        composition.addSection(sectionComponent);
    }
}
Also used : QuestionnaireResponse(org.hl7.fhir.dstu3.model.QuestionnaireResponse) SectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent)

Example 9 with SectionComponent

use of org.hl7.fhir.dstu2016may.model.Composition.SectionComponent in project integration-adaptor-111 by nhsconnect.

the class CompositionMapperTest method shouldMapComposition.

@Test
@SuppressWarnings("MagicNumber")
public void shouldMapComposition() {
    Composition composition = compositionMapper.mapComposition(clinicalDocument, encounter, carePlans, questionnaireResponseList, referralRequest, practitionerRoles);
    Coding code = composition.getType().getCodingFirstRep();
    String questionnaireResponseTitle = "QuestionnaireResponse";
    assertThat(composition.getTitle()).isEqualTo("111 Report");
    assertThat(code.getCode()).isEqualTo("371531000");
    assertThat(code.getSystem()).isEqualTo("http://snomed.info/sct");
    assertThat(code.getDisplay()).isEqualTo("Report of clinical encounter (record artifact)");
    assertThat(composition.getStatus()).isEqualTo(FINAL);
    assertThat(composition.getConfidentiality()).isEqualTo(Composition.DocumentConfidentiality.V);
    assertThat(composition.getRelatesTo().get(0).getCode()).isEqualTo(REPLACES);
    Composition.SectionComponent sectionComponent = composition.getSection().get(0);
    assertThat(sectionComponent.getSection().size()).isEqualTo(1);
    assertThat(sectionComponent.getSection().get(0).getTitle()).isEqualTo(NESTED_SECTION_TITLE);
    assertThat(sectionComponent.getSection().get(0).getText().getStatus()).isEqualTo(GENERATED);
    assertThat(sectionComponent.getSection().get(0).getText().getDivAsString()).isEqualTo(COMPOSITION_SECTION_DIV);
    assertThat(composition.getSection().get(1).getTitle()).isEqualTo("CarePlan");
    assertThat(composition.getSection().get(2).getTitle()).isEqualTo("ReferralRequest");
    assertThat(composition.getSection().get(3).getEntry().get(0).getResource()).isEqualTo(questionnaireResponse);
    assertThat(composition.getSection().get(3).getTitle()).isEqualTo(questionnaireResponseTitle);
    assertThat(composition.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
    assertThat(composition.getDateElement().getValue()).isEqualTo(DateUtil.parse(effectiveTime.getValue()).getValue());
}
Also used : Composition(org.hl7.fhir.dstu3.model.Composition) Coding(org.hl7.fhir.dstu3.model.Coding) TestResourceUtils.readResourceAsString(uk.nhs.adaptors.TestResourceUtils.readResourceAsString) Test(org.junit.jupiter.api.Test)

Example 10 with SectionComponent

use of org.hl7.fhir.dstu2016may.model.Composition.SectionComponent in project org.hl7.fhir.core by hapifhir.

the class BundleRenderer method renderDocument.

private boolean renderDocument(XhtmlNode x, Bundle b) throws UnsupportedEncodingException, FHIRException, IOException, EOperationOutcome {
    // from the spec:
    // 
    // When the document is presented for human consumption, applications SHOULD present the collated narrative portions in order:
    // * The subject resource Narrative
    // * The Composition resource Narrative
    // * The section.text Narratives
    Composition comp = (Composition) b.getEntry().get(0).getResource();
    Resource subject = resolveReference(b, comp.getSubject());
    if (subject != null) {
        XhtmlNode nx = (subject instanceof DomainResource) ? ((DomainResource) subject).getText().getDiv() : null;
        if (nx != null) {
            x.addChildren(nx);
        } else {
            RendererFactory.factory(subject, context).render(x, subject);
        }
    }
    x.hr();
    if (comp.getText().hasDiv()) {
        x.addChildren(comp.getText().getDiv());
        x.hr();
    }
    for (SectionComponent section : comp.getSection()) {
        addSection(x, section, 2, false);
    }
    return false;
}
Also used : Composition(org.hl7.fhir.r4b.model.Composition) DomainResource(org.hl7.fhir.r4b.model.DomainResource) Resource(org.hl7.fhir.r4b.model.Resource) DomainResource(org.hl7.fhir.r4b.model.DomainResource) SectionComponent(org.hl7.fhir.r4b.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