Search in sources :

Example 1 with POCDMT000002UK01Component3

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

the class AppointmentServiceTest method setUp.

@BeforeEach
public void setUp() {
    clinicalDocument1 = mock(POCDMT000002UK01ClinicalDocument1.class);
    POCDMT000002UK01Component2 component2 = mock(POCDMT000002UK01Component2.class);
    POCDMT000002UK01StructuredBody structuredBody = mock(POCDMT000002UK01StructuredBody.class);
    POCDMT000002UK01Component3 component3 = mock(POCDMT000002UK01Component3.class);
    section = mock(POCDMT000002UK01Section.class);
    patient = mock(Reference.class);
    when(clinicalDocument1.getComponent()).thenReturn(component2);
    when(component2.getStructuredBody()).thenReturn(structuredBody);
    when(structuredBody.getComponentArray()).thenReturn(new POCDMT000002UK01Component3[] { component3 });
    when(component3.getSection()).thenReturn(section);
}
Also used : POCDMT000002UK01Component2(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component2) POCDMT000002UK01StructuredBody(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01StructuredBody) POCDMT000002UK01Component3(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3) POCDMT000002UK01Section(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section) Reference(org.hl7.fhir.dstu3.model.Reference) POCDMT000002UK01ClinicalDocument1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ClinicalDocument1) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with POCDMT000002UK01Component3

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

the class CompositionMapper method mapComposition.

public Composition mapComposition(POCDMT000002UK01ClinicalDocument1 clinicalDocument, Encounter encounter, List<CarePlan> carePlans, List<QuestionnaireResponse> questionnaireResponseList, ReferralRequest referralRequest, List<PractitionerRole> practitionerRoles) {
    Composition composition = new Composition();
    composition.setIdElement(resourceUtil.newRandomUuid());
    Identifier docIdentifier = new Identifier();
    docIdentifier.setUse(USUAL);
    docIdentifier.setValue(clinicalDocument.getSetId().getRoot());
    composition.setTitle(COMPOSITION_TITLE).setType(createCodeableConcept()).setStatus(FINAL).setEncounter(resourceUtil.createReference(encounter)).setSubject(encounter.getSubject()).setDateElement(DateUtil.parse(clinicalDocument.getEffectiveTime().getValue())).setIdentifier(docIdentifier);
    if (clinicalDocument.getConfidentialityCode().isSetCode()) {
        composition.setConfidentiality(Composition.DocumentConfidentiality.valueOf(clinicalDocument.getConfidentialityCode().getCode()));
    }
    if (isNotEmpty(clinicalDocument.getRelatedDocumentArray()) && clinicalDocument.getRelatedDocumentArray(0).getParentDocument().getIdArray(0).isSetRoot()) {
        Identifier relatedDocIdentifier = new Identifier();
        relatedDocIdentifier.setUse(USUAL);
        relatedDocIdentifier.setValue(clinicalDocument.getRelatedDocumentArray(0).getParentDocument().getIdArray(0).getRoot());
        composition.addRelatesTo().setCode(Composition.DocumentRelationshipType.REPLACES).setTarget(relatedDocIdentifier);
    }
    practitionerRoles.stream().forEach(it -> composition.addAuthor(it.getPractitioner()));
    if (clinicalDocument.getComponent().isSetStructuredBody()) {
        for (POCDMT000002UK01Component3 component3 : clinicalDocument.getComponent().getStructuredBody().getComponentArray()) {
            SectionComponent sectionComponent = new SectionComponent();
            addSectionChildren(sectionComponent, component3.getSection());
            composition.addSection(sectionComponent);
        }
    }
    for (CarePlan carePlan : carePlans) {
        composition.addSection(buildSectionComponentFromResource(carePlan));
    }
    if (!referralRequest.isEmpty()) {
        composition.addSection(buildSectionComponentFromResource(referralRequest));
    }
    if (questionnaireResponseList != null) {
        addPathwaysToSection(composition, questionnaireResponseList);
    }
    return composition;
}
Also used : Composition(org.hl7.fhir.dstu3.model.Composition) CarePlan(org.hl7.fhir.dstu3.model.CarePlan) Identifier(org.hl7.fhir.dstu3.model.Identifier) POCDMT000002UK01Component3(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3) SectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent)

Example 3 with POCDMT000002UK01Component3

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

the class ConsentMapperTest method setUp.

@BeforeEach
public void setUp() {
    POCDMT000002UK01Component2 component2 = mock(POCDMT000002UK01Component2.class);
    POCDMT000002UK01Component3 component3 = mock(POCDMT000002UK01Component3.class);
    POCDMT000002UK01Authorization authorization = mock(POCDMT000002UK01Authorization.class);
    POCDMT000002UK01StructuredBody structuredBody = mock(POCDMT000002UK01StructuredBody.class);
    code = CE.Factory.newInstance();
    code.setCodeSystem(ITK_SNOMED);
    code.setCode(INFORMATION_ADVICE_GIVEN);
    code.setDisplayName(CODE_DISPLAY_NAME);
    title.setLanguage(LANG);
    cs.setCode(LANG);
    when(clinicalDocument.getComponent()).thenReturn(component2);
    when(clinicalDocument.sizeOfAuthorizationArray()).thenReturn(1);
    when(clinicalDocument.getAuthorizationArray()).thenReturn(new POCDMT000002UK01Authorization[] { authorization });
    when(authorization.getConsent()).thenReturn(authConsent);
    when(authConsent.isSetCode()).thenReturn(true);
    when(authConsent.getCode()).thenReturn(code);
    when(component2.getStructuredBody()).thenReturn(structuredBody);
    when(component3.getSection()).thenReturn(section);
    when(component5.getSection()).thenReturn(section);
    when(structuredBody.getComponentArray()).thenReturn(new POCDMT000002UK01Component3[] { component3 });
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
}
Also used : POCDMT000002UK01Component2(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component2) POCDMT000002UK01StructuredBody(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01StructuredBody) POCDMT000002UK01Component3(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3) POCDMT000002UK01Authorization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Authorization) IdType(org.hl7.fhir.dstu3.model.IdType) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 4 with POCDMT000002UK01Component3

use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3 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 5 with POCDMT000002UK01Component3

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

the class EncounterMapperTest method mockEncounterTypeAndReason.

private void mockEncounterTypeAndReason() {
    String encounterText = "Encounter text";
    POCDMT000002UK01Component3[] componentArray = new POCDMT000002UK01Component3[1];
    componentArray[0] = component3;
    POCDMT000002UK01Entry[] entryArray = new POCDMT000002UK01Entry[1];
    entryArray[0] = entry;
    when(clinicalDocument.getComponent()).thenReturn(component2);
    when(component2.isSetStructuredBody()).thenReturn(true);
    when(component2.getStructuredBody()).thenReturn(structuredBody);
    when(structuredBody.getComponentArray()).thenReturn(componentArray);
    when(component3.getSection()).thenReturn(section01);
    when(section01.getEntryArray()).thenReturn(entryArray);
    when(entry.getEncounter()).thenReturn(encounter);
    when(entry.isSetEncounter()).thenReturn(true);
    when(encounter.isSetText()).thenReturn(true);
    when(encounter.getText()).thenReturn(encounterTextED);
    when(nodeUtil.getNodeValueString(any())).thenReturn(encounterText);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
}
Also used : POCDMT000002UK01Component3(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3) POCDMT000002UK01Entry(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Entry) IdType(org.hl7.fhir.dstu3.model.IdType)

Aggregations

POCDMT000002UK01Component3 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3)11 POCDMT000002UK01Section (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section)6 POCDMT000002UK01StructuredBody (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01StructuredBody)6 IdType (org.hl7.fhir.dstu3.model.IdType)5 BeforeEach (org.junit.jupiter.api.BeforeEach)5 POCDMT000002UK01Component2 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component2)5 POCDMT000002UK01Component5 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5)5 Reference (org.hl7.fhir.dstu3.model.Reference)4 POCDMT000002UK01Entry (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Entry)4 ST (uk.nhs.connect.iucds.cda.ucr.ST)3 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)2 POCDMT000002UK01ClinicalDocument1 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ClinicalDocument1)2 StrucDocContent (uk.nhs.connect.iucds.cda.ucr.StrucDocContent)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 CarePlan (org.hl7.fhir.dstu3.model.CarePlan)1