Search in sources :

Example 1 with POCDMT000002UK01Section

use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section in project integration-adaptor-111 by nhsconnect.

the class ConsentMapper method extractTextBody.

private void extractTextBody(Consent consent, POCDMT000002UK01StructuredBody structuredBody) {
    List<POCDMT000002UK01Section> sections = getSectionsOfType(structuredBody);
    for (POCDMT000002UK01Section section : sections) {
        Narrative narrative = new Narrative();
        narrative.setStatus(GENERATED);
        if (section.isSetText()) {
            narrative.setDivAsString(Arrays.asList(DIV_START, section.getText().xmlText(), DIV_END).stream().collect(Collectors.joining()));
            consent.setText(narrative);
        }
    }
}
Also used : POCDMT000002UK01Section(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section) Narrative(org.hl7.fhir.dstu3.model.Narrative)

Example 2 with POCDMT000002UK01Section

use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section in project integration-adaptor-111 by nhsconnect.

the class ConsentMapper method extractConsentSource.

private void extractConsentSource(Consent consent, POCDMT000002UK01StructuredBody structuredBody) {
    List<POCDMT000002UK01Section> sections = getSectionsOfType(structuredBody);
    sections.stream().filter(POCDMT000002UK01Section::isSetId).forEach(section -> consent.setSource(new Identifier().setValue(section.getId().getRoot())));
}
Also used : Identifier(org.hl7.fhir.dstu3.model.Identifier) POCDMT000002UK01Section(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section)

Example 3 with POCDMT000002UK01Section

use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section in project integration-adaptor-111 by nhsconnect.

the class ObservationMapper method mapObservations.

public List<Observation> mapObservations(POCDMT000002UK01ClinicalDocument1 clinicalDocument, Encounter encounter) {
    List<Observation> observations = new ArrayList<>();
    POCDMT000002UK01Component2 component = clinicalDocument.getComponent();
    if (component.isSetStructuredBody()) {
        POCDMT000002UK01Component3[] components = component.getStructuredBody().getComponentArray();
        for (POCDMT000002UK01Component3 component3 : components) {
            POCDMT000002UK01Section section = component3.getSection();
            for (POCDMT000002UK01Component5 component5 : section.getComponentArray()) {
                ST title = component5.getSection().getTitle();
                if (nodeUtil.getNodeValueString(title).matches(PATIENTS_CONDITION_REGEXP)) {
                    StrucDocContent[] contentArray = component5.getSection().getText().getContentArray();
                    List<String> sectionText = stream(contentArray).map(it -> nodeUtil.getNodeValueString(it)).collect(toList());
                    observations.add(createObservation(encounter, sectionText));
                }
            }
        }
    }
    return observations;
}
Also used : ST(uk.nhs.connect.iucds.cda.ucr.ST) Strings.join(org.apache.logging.log4j.util.Strings.join) Coding(org.hl7.fhir.dstu3.model.Coding) NodeUtil(uk.nhs.adaptors.oneoneone.cda.report.util.NodeUtil) POCDMT000002UK01Section(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section) StrucDocContent(uk.nhs.connect.iucds.cda.ucr.StrucDocContent) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept) FINAL(org.hl7.fhir.dstu3.model.Observation.ObservationStatus.FINAL) Observation(org.hl7.fhir.dstu3.model.Observation) ArrayList(java.util.ArrayList) Encounter(org.hl7.fhir.dstu3.model.Encounter) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) Component(org.springframework.stereotype.Component) POCDMT000002UK01Component2(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component2) ResourceUtil(uk.nhs.adaptors.oneoneone.cda.report.util.ResourceUtil) POCDMT000002UK01ClinicalDocument1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ClinicalDocument1) POCDMT000002UK01Component3(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3) POCDMT000002UK01Component5(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5) StringType(org.hl7.fhir.dstu3.model.StringType) AllArgsConstructor(lombok.AllArgsConstructor) Arrays.stream(java.util.Arrays.stream) ST(uk.nhs.connect.iucds.cda.ucr.ST) POCDMT000002UK01Section(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section) ArrayList(java.util.ArrayList) StrucDocContent(uk.nhs.connect.iucds.cda.ucr.StrucDocContent) POCDMT000002UK01Component2(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component2) POCDMT000002UK01Component3(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3) Observation(org.hl7.fhir.dstu3.model.Observation) POCDMT000002UK01Component5(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5)

Example 4 with POCDMT000002UK01Section

use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section in project integration-adaptor-111 by nhsconnect.

the class ConditionMapper method mapCondition.

public Condition mapCondition(POCDMT000002UK01ClinicalDocument1 clinicalDocument, Encounter encounter, List<QuestionnaireResponse> questionnaireResponseList) {
    Condition condition = new Condition();
    condition.setIdElement(resourceUtil.newRandomUuid());
    condition.setClinicalStatus(Condition.ConditionClinicalStatus.ACTIVE).setVerificationStatus(Condition.ConditionVerificationStatus.UNKNOWN).setSubject(encounter.getSubject()).setContext(resourceUtil.createReference(encounter));
    if (questionnaireResponseList != null) {
        condition.setEvidence(evidenceOf(questionnaireResponseList));
    }
    addConditionReason(clinicalDocument, condition);
    if (clinicalDocument.getComponent().isSetStructuredBody()) {
        for (POCDMT000002UK01Component3 component3 : clinicalDocument.getComponent().getStructuredBody().getComponentArray()) {
            POCDMT000002UK01Section section = component3.getSection();
            for (POCDMT000002UK01Entry entry : section.getEntryArray()) {
                if (entry.isSetEncounter()) {
                    POCDMT000002UK01Encounter itkEncounter = entry.getEncounter();
                    if (itkEncounter.isSetEffectiveTime()) {
                        condition.setAssertedDateElement(DateUtil.parse(itkEncounter.getEffectiveTime().getValue()));
                    }
                    if (itkEncounter.isSetText()) {
                        condition.addCategory(new CodeableConcept().setText(nodeUtil.getAllText(itkEncounter.getText().getDomNode())));
                    }
                }
            }
            for (POCDMT000002UK01Component5 component : section.getComponentArray()) {
                if (component.getSection() != null) {
                    if (component.getSection().isSetLanguageCode()) {
                        if (component.getSection().getLanguageCode().isSetCode()) {
                            condition.setLanguage(component.getSection().getLanguageCode().getCode());
                        }
                    }
                }
            }
        }
    }
    return condition;
}
Also used : Condition(org.hl7.fhir.dstu3.model.Condition) POCDMT000002UK01Component3(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3) POCDMT000002UK01Section(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section) POCDMT000002UK01Entry(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Entry) POCDMT000002UK01Component5(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5) POCDMT000002UK01Encounter(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Encounter) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 5 with POCDMT000002UK01Section

use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section 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)

Aggregations

POCDMT000002UK01Section (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section)11 POCDMT000002UK01Component5 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5)6 POCDMT000002UK01Component3 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3)5 POCDMT000002UK01Entry (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Entry)3 POCDMT000002UK01StructuredBody (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01StructuredBody)3 ST (uk.nhs.connect.iucds.cda.ucr.ST)3 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)2 IdType (org.hl7.fhir.dstu3.model.IdType)2 Reference (org.hl7.fhir.dstu3.model.Reference)2 POCDMT000002UK01Component2 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component2)2 StrucDocContent (uk.nhs.connect.iucds.cda.ucr.StrucDocContent)2 StrucDocText (uk.nhs.connect.iucds.cda.ucr.StrucDocText)2 ArrayList (java.util.ArrayList)1 Arrays.stream (java.util.Arrays.stream)1 List (java.util.List)1 Collectors.toList (java.util.stream.Collectors.toList)1 AllArgsConstructor (lombok.AllArgsConstructor)1 Strings.join (org.apache.logging.log4j.util.Strings.join)1 Appointment (org.hl7.fhir.dstu3.model.Appointment)1 Coding (org.hl7.fhir.dstu3.model.Coding)1