Search in sources :

Example 1 with POCDMT000002UK01StructuredBody

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

the class StructuredBodyUtilTest method shouldReturnStructuredBody.

@Test
public void shouldReturnStructuredBody() {
    POCDMT000002UK01StructuredBody structuredBody = StructuredBodyUtil.getStructuredBody(clinicalDocument);
    assertThat(structuredBody).isNotEqualTo(null);
}
Also used : POCDMT000002UK01StructuredBody(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01StructuredBody) Test(org.junit.jupiter.api.Test)

Example 2 with POCDMT000002UK01StructuredBody

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

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

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

the class ConsentMapper method mapConsent.

public Consent mapConsent(POCDMT000002UK01ClinicalDocument1 clinicalDocument, Encounter encounter) {
    Consent consent = new Consent();
    consent.setIdElement(resourceUtil.newRandomUuid());
    if (clinicalDocument.isSetSetId()) {
        Identifier docIdentifier = new Identifier();
        docIdentifier.setUse(Identifier.IdentifierUse.USUAL);
        docIdentifier.setValue(clinicalDocument.getSetId().getRoot());
        consent.setIdentifier(docIdentifier);
    }
    consent.setLanguage(encounter.getLanguage());
    consent.setStatus(Consent.ConsentState.ACTIVE).setPeriod(encounter.getPeriod()).setPatient(encounter.getSubject()).addConsentingParty(encounter.getSubject()).addOrganization(encounter.getServiceProvider()).setData(List.of(new ConsentDataComponent().setMeaning(ConsentDataMeaning.RELATED).setReference(resourceUtil.createReference(encounter)))).setPolicyRule(OPT_OUT_URI);
    extractAuthCodesFromDoc(consent, clinicalDocument);
    POCDMT000002UK01StructuredBody structuredBody = getStructuredBody(clinicalDocument);
    if (structuredBody != null) {
        extractDataPeriodFromDoc(consent, structuredBody);
        extractConsentSource(consent, structuredBody);
        extractTextBody(consent, structuredBody);
    }
    return consent;
}
Also used : POCDMT000002UK01StructuredBody(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01StructuredBody) Identifier(org.hl7.fhir.dstu3.model.Identifier) Consent(org.hl7.fhir.dstu3.model.Consent) POCDMT000002UK01Consent(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Consent) ConsentDataComponent(org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent)

Example 5 with POCDMT000002UK01StructuredBody

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

the class ObservationMapperTest method setUp.

@BeforeEach
public void setUp() {
    POCDMT000002UK01Component2 component2 = mock(POCDMT000002UK01Component2.class);
    when(component2.isSetStructuredBody()).thenReturn(true);
    POCDMT000002UK01StructuredBody structuredBody = mock(POCDMT000002UK01StructuredBody.class);
    POCDMT000002UK01Component3 component3 = mock(POCDMT000002UK01Component3.class);
    POCDMT000002UK01Section section = mock(POCDMT000002UK01Section.class);
    POCDMT000002UK01Component5 component5 = mock(POCDMT000002UK01Component5.class);
    POCDMT000002UK01Section innerSection = mock(POCDMT000002UK01Section.class);
    StrucDocText text = mock(StrucDocText.class);
    StrucDocContent contentItem = mock(StrucDocContent.class);
    StrucDocContent[] content = new StrucDocContent[] { contentItem };
    when(text.getContentArray()).thenReturn(content);
    when(innerSection.getText()).thenReturn(text);
    ST title = mock(ST.class);
    when(nodeUtil.getNodeValueString(title)).thenReturn("Patient's Reported Condition");
    when(nodeUtil.getNodeValueString(contentItem)).thenReturn(OBSERVATION_VALUE);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    when(resourceUtil.createReference(encounter)).thenReturn(new Reference(encounter));
    when(innerSection.getTitle()).thenReturn(title);
    when(component5.getSection()).thenReturn(innerSection);
    POCDMT000002UK01Component5[] components5 = new POCDMT000002UK01Component5[] { component5 };
    when(section.getComponentArray()).thenReturn(components5);
    when(component3.getSection()).thenReturn(section);
    POCDMT000002UK01Component3[] components3 = new POCDMT000002UK01Component3[] { component3 };
    when(structuredBody.getComponentArray()).thenReturn(components3);
    when(component2.getStructuredBody()).thenReturn(structuredBody);
    when(clinicalDocument.getComponent()).thenReturn(component2);
    when(encounter.getSubject()).thenReturn(subject);
}
Also used : POCDMT000002UK01StructuredBody(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01StructuredBody) ST(uk.nhs.connect.iucds.cda.ucr.ST) POCDMT000002UK01Section(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section) Reference(org.hl7.fhir.dstu3.model.Reference) StrucDocContent(uk.nhs.connect.iucds.cda.ucr.StrucDocContent) IdType(org.hl7.fhir.dstu3.model.IdType) POCDMT000002UK01Component2(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component2) POCDMT000002UK01Component3(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3) StrucDocText(uk.nhs.connect.iucds.cda.ucr.StrucDocText) POCDMT000002UK01Component5(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

POCDMT000002UK01StructuredBody (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01StructuredBody)8 POCDMT000002UK01Component3 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3)6 BeforeEach (org.junit.jupiter.api.BeforeEach)4 POCDMT000002UK01Component2 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component2)4 POCDMT000002UK01Section (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section)4 IdType (org.hl7.fhir.dstu3.model.IdType)3 Reference (org.hl7.fhir.dstu3.model.Reference)3 POCDMT000002UK01Component5 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5)2 ST (uk.nhs.connect.iucds.cda.ucr.ST)2 Consent (org.hl7.fhir.dstu3.model.Consent)1 ConsentDataComponent (org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent)1 Identifier (org.hl7.fhir.dstu3.model.Identifier)1 Patient (org.hl7.fhir.dstu3.model.Patient)1 Test (org.junit.jupiter.api.Test)1 Node (org.w3c.dom.Node)1 POCDMT000002UK01Authorization (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Authorization)1 POCDMT000002UK01ClinicalDocument1 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ClinicalDocument1)1 POCDMT000002UK01Consent (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Consent)1 POCDMT000002UK01Entry (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Entry)1 StrucDocContent (uk.nhs.connect.iucds.cda.ucr.StrucDocContent)1