Search in sources :

Example 1 with POCDMT000002UK01Entry

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

the class ConsentMapper method extractDataPeriodFromDoc.

private void extractDataPeriodFromDoc(Consent consent, POCDMT000002UK01StructuredBody structuredBody) {
    List<POCDMT000002UK01Entry> permissionEntries = getEntriesOfType(structuredBody);
    if (permissionEntries.isEmpty()) {
        return;
    }
    for (POCDMT000002UK01Entry permissionEntry : permissionEntries) {
        Period dataPeriod = getDataPeriod(permissionEntry);
        if (dataPeriod == null) {
            continue;
        }
        consent.setDataPeriod(dataPeriod);
    }
}
Also used : POCDMT000002UK01Entry(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Entry) Period(org.hl7.fhir.dstu3.model.Period)

Example 2 with POCDMT000002UK01Entry

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

Example 3 with POCDMT000002UK01Entry

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

the class AppointmentMapperTest method mockEntry.

private POCDMT000002UK01Entry mockEntry() {
    POCDMT000002UK01Entry entry = mock(POCDMT000002UK01Entry.class);
    POCDMT000002UK01Encounter encounter = mock(POCDMT000002UK01Encounter.class);
    POCDMT000002UK01Participant2 participant = mock(POCDMT000002UK01Participant2.class);
    POCDMT000002UK01ParticipantRole participantRole = mock(POCDMT000002UK01ParticipantRole.class);
    when(entry.getEncounter()).thenReturn(encounter);
    when(encounter.getParticipantArray()).thenReturn(new POCDMT000002UK01Participant2[] { participant });
    when(participant.getParticipantRole()).thenReturn(participantRole);
    when(entry.isSetEncounter()).thenReturn(true);
    when(encounter.isSetCode()).thenReturn(true);
    CDNPfITCDAUrl cdnPfITCDAUrl = mock(CDNPfITCDAUrl.class);
    when(encounter.getCode()).thenReturn(cdnPfITCDAUrl);
    when(cdnPfITCDAUrl.getDisplayName()).thenReturn(REASON);
    return entry;
}
Also used : POCDMT000002UK01Entry(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Entry) POCDMT000002UK01Participant2(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Participant2) CDNPfITCDAUrl(uk.nhs.connect.iucds.cda.ucr.CDNPfITCDAUrl) POCDMT000002UK01Encounter(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Encounter) POCDMT000002UK01ParticipantRole(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ParticipantRole)

Example 4 with POCDMT000002UK01Entry

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

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

the class AppointmentServiceTest method mockAppointmentEntry.

private void mockAppointmentEntry(POCDMT000002UK01Section section) {
    TemplateContent templateContent = mock(TemplateContent.class);
    POCDMT000002UK01Entry sectionEntry = mock(POCDMT000002UK01Entry.class);
    when(section.getEntryArray()).thenReturn(new POCDMT000002UK01Entry[] { sectionEntry });
    when(sectionEntry.isSetContentId()).thenReturn(true);
    when(sectionEntry.getContentId()).thenReturn(templateContent);
    when(templateContent.getRoot()).thenReturn(NPFIT_CDA_CONTENT);
    when(templateContent.getExtension()).thenReturn(APPOINTMENT_REFERENCE);
}
Also used : POCDMT000002UK01Entry(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Entry) TemplateContent(uk.nhs.connect.npfit.hl7.localisation.TemplateContent)

Aggregations

POCDMT000002UK01Entry (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Entry)8 POCDMT000002UK01Component3 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3)4 IdType (org.hl7.fhir.dstu3.model.IdType)3 POCDMT000002UK01Section (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section)3 Reference (org.hl7.fhir.dstu3.model.Reference)2 POCDMT000002UK01Component5 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5)2 POCDMT000002UK01Encounter (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Encounter)2 Appointment (org.hl7.fhir.dstu3.model.Appointment)1 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)1 Condition (org.hl7.fhir.dstu3.model.Condition)1 Period (org.hl7.fhir.dstu3.model.Period)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Test (org.junit.jupiter.api.Test)1 CDNPfITCDAUrl (uk.nhs.connect.iucds.cda.ucr.CDNPfITCDAUrl)1 POCDMT000002UK01Participant2 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Participant2)1 POCDMT000002UK01ParticipantRole (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ParticipantRole)1 POCDMT000002UK01StructuredBody (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01StructuredBody)1 TemplateContent (uk.nhs.connect.npfit.hl7.localisation.TemplateContent)1