Search in sources :

Example 6 with TEL

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

the class LocationMapperTest method prepareIntendedRecipientMocks.

private POCDMT000002UK01IntendedRecipient prepareIntendedRecipientMocks() {
    POCDMT000002UK01IntendedRecipient itkIntendedRecipient = mock(POCDMT000002UK01IntendedRecipient.class);
    AD itkAddress = mock(AD.class);
    TEL itkTelecom = mock(TEL.class);
    when(itkIntendedRecipient.sizeOfAddrArray()).thenReturn(new AD[] { itkAddress }.length);
    when(addressMapper.mapAddress(any())).thenReturn(address);
    when(itkIntendedRecipient.getTelecomArray()).thenReturn(new TEL[] { itkTelecom });
    when(contactPointMapper.mapContactPoint(any())).thenReturn(contactPoint);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    return itkIntendedRecipient;
}
Also used : AD(uk.nhs.connect.iucds.cda.ucr.AD) POCDMT000002UK01IntendedRecipient(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01IntendedRecipient) TEL(uk.nhs.connect.iucds.cda.ucr.TEL) IdType(org.hl7.fhir.dstu3.model.IdType)

Example 7 with TEL

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

the class PatientMapperTest method mockContactPoint.

private void mockContactPoint(POCDMT000002UK01PatientRole patientRole) {
    when(patientRole.sizeOfTelecomArray()).thenReturn(1);
    TEL itkTelecom = mock(TEL.class);
    when(patientRole.getTelecomArray()).thenReturn(Arrays.array(itkTelecom));
    when(contactPointMapper.mapContactPoint(any())).thenReturn(contactPoint);
}
Also used : TEL(uk.nhs.connect.iucds.cda.ucr.TEL)

Example 8 with TEL

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

the class RelatedPersonMapper method createEmergencyContactRelatedPerson.

public RelatedPerson createEmergencyContactRelatedPerson(POCDMT000002UK01ClinicalDocument1 clinicalDocument, Encounter encounter) {
    RelatedPerson relatedPerson = new RelatedPerson();
    TEL[] telecomArray = Optional.ofNullable(clinicalDocument).map(document -> document.getRecordTargetArray(0)).map(POCDMT000002UK01RecordTarget::getPatientRole).map(POCDMT000002UK01PatientRole::getTelecomArray).orElse(null);
    if (getEmergencyTelecom(telecomArray).isPresent()) {
        relatedPerson.setIdElement(resourceUtil.newRandomUuid());
        relatedPerson.setPatient(encounter.getSubject());
        relatedPerson.setTelecom(getTelecomFromITK(new TEL[] { getEmergencyTelecom(telecomArray).get() }));
        markEmergencyContact(telecomArray, relatedPerson);
        return relatedPerson;
    }
    return null;
}
Also used : CollectionUtils.isEmpty(org.springframework.util.CollectionUtils.isEmpty) Coding(org.hl7.fhir.dstu3.model.Coding) POCDMT000002UK01RecordTarget(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01RecordTarget) DateUtil(uk.nhs.adaptors.oneoneone.cda.report.util.DateUtil) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept) POCDMT000002UK01RelatedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01RelatedEntity) Period(org.hl7.fhir.dstu3.model.Period) POCDMT000002UK01ClinicalDocument1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ClinicalDocument1) PN(uk.nhs.connect.iucds.cda.ucr.PN) TEL(uk.nhs.connect.iucds.cda.ucr.TEL) POCDMT000002UK01PatientRole(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01PatientRole) Address(org.hl7.fhir.dstu3.model.Address) AD(uk.nhs.connect.iucds.cda.ucr.AD) CE(uk.nhs.connect.iucds.cda.ucr.CE) POCDMT000002UK01Person(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Person) Collections.emptyList(java.util.Collections.emptyList) RelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson) IVLTS(uk.nhs.connect.iucds.cda.ucr.IVLTS) Collectors(java.util.stream.Collectors) Encounter(org.hl7.fhir.dstu3.model.Encounter) List(java.util.List) Component(org.springframework.stereotype.Component) UNKNOWN(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.UNKNOWN) ResourceUtil(uk.nhs.adaptors.oneoneone.cda.report.util.ResourceUtil) Optional(java.util.Optional) POCDMT000002UK01Informant12(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Informant12) AllArgsConstructor(lombok.AllArgsConstructor) Arrays.stream(java.util.Arrays.stream) HumanName(org.hl7.fhir.dstu3.model.HumanName) ContactPoint(org.hl7.fhir.dstu3.model.ContactPoint) POCDMT000002UK01RecordTarget(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01RecordTarget) TEL(uk.nhs.connect.iucds.cda.ucr.TEL) RelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson)

Example 9 with TEL

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

the class HealthcareServiceMapper method mapSingleHealthcareService.

private HealthcareService mapSingleHealthcareService(POCDMT000002UK01InformationRecipient informationRecipient) {
    POCDMT000002UK01IntendedRecipient intendedRecipient = informationRecipient.getIntendedRecipient();
    HealthcareService healthcareService = new HealthcareService().setActive(true);
    healthcareService.setIdElement(resourceUtil.newRandomUuid());
    Organization organization = new Organization();
    if (intendedRecipient.isSetReceivedOrganization()) {
        POCDMT000002UK01Organization receivedOrganization = intendedRecipient.getReceivedOrganization();
        organization = organizationMapper.mapOrganization(informationRecipient);
        healthcareService.setProvidedBy(resourceUtil.createReference(organization));
        healthcareService.setProvidedByTarget(organization);
        if (receivedOrganization.sizeOfNameArray() > 0) {
            ON name = receivedOrganization.getNameArray(0);
            healthcareService.setName(nodeUtil.getAllText(name.getDomNode()));
        }
    }
    Location location = locationMapper.mapRecipientToLocation(intendedRecipient, organization);
    healthcareService.addLocation(resourceUtil.createReference(location));
    if (intendedRecipient.sizeOfTelecomArray() > 0) {
        for (TEL tel : intendedRecipient.getTelecomArray()) {
            healthcareService.addTelecom(contactPointMapper.mapContactPoint(tel));
        }
    }
    return healthcareService;
}
Also used : Organization(org.hl7.fhir.dstu3.model.Organization) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) POCDMT000002UK01IntendedRecipient(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01IntendedRecipient) HealthcareService(org.hl7.fhir.dstu3.model.HealthcareService) TEL(uk.nhs.connect.iucds.cda.ucr.TEL) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) ON(uk.nhs.connect.iucds.cda.ucr.ON) Location(org.hl7.fhir.dstu3.model.Location)

Example 10 with TEL

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

the class ContactPointMapperTest method shouldMapContactPointEmail.

@Test
public void shouldMapContactPointEmail() {
    TEL tel = TEL.Factory.newInstance();
    tel.setValue(EMAIL_ADDRESS);
    tel.setUse(singletonList(USE_ITK_MOBILE));
    tel.addNewUseablePeriod();
    when(periodMapper.mapPeriod(ArgumentMatchers.any())).thenReturn(period);
    ContactPoint contactPoint = contactPointMapper.mapContactPoint(tel);
    assertThat(contactPoint.getValue()).isEqualTo(EMAIL_ADDRESS);
    assertThat(contactPoint.getUse()).isEqualTo(MOBILE);
    assertThat(contactPoint.getPeriod()).isEqualTo(period);
    assertThat(contactPoint.getSystem()).isEqualTo(EMAIL);
}
Also used : ContactPoint(org.hl7.fhir.dstu3.model.ContactPoint) TEL(uk.nhs.connect.iucds.cda.ucr.TEL) Test(org.junit.jupiter.api.Test)

Aggregations

TEL (uk.nhs.connect.iucds.cda.ucr.TEL)10 Test (org.junit.jupiter.api.Test)5 RelatedPerson (org.hl7.fhir.dstu3.model.RelatedPerson)4 ContactPoint (org.hl7.fhir.dstu3.model.ContactPoint)3 AD (uk.nhs.connect.iucds.cda.ucr.AD)3 IdType (org.hl7.fhir.dstu3.model.IdType)2 Organization (org.hl7.fhir.dstu3.model.Organization)2 CE (uk.nhs.connect.iucds.cda.ucr.CE)2 POCDMT000002UK01IntendedRecipient (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01IntendedRecipient)2 POCDMT000002UK01Organization (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization)2 Arrays.stream (java.util.Arrays.stream)1 Collections.emptyList (java.util.Collections.emptyList)1 List (java.util.List)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 AllArgsConstructor (lombok.AllArgsConstructor)1 Address (org.hl7.fhir.dstu3.model.Address)1 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)1 Coding (org.hl7.fhir.dstu3.model.Coding)1 Encounter (org.hl7.fhir.dstu3.model.Encounter)1