Search in sources :

Example 56 with Address

use of org.hl7.fhir.r4b.model.Address in project integration-adaptor-111 by nhsconnect.

the class PractitionerMapperTest method shouldMapPractitionerFromAssignedEntity.

@Test
public void shouldMapPractitionerFromAssignedEntity() {
    POCDMT000002UK01AssignedEntity assignedEntity = POCDMT000002UK01AssignedEntity.Factory.newInstance();
    assignedEntity.setAssignedPerson(createPerson());
    assignedEntity.setTelecomArray(createTelecomArray());
    assignedEntity.setAddrArray(createAddrArray());
    when(humanNameMapper.mapHumanName(ArgumentMatchers.any())).thenReturn(humanName);
    when(contactPointMapper.mapContactPoint(ArgumentMatchers.any())).thenReturn(contactPoint);
    when(addressMapper.mapAddress(ArgumentMatchers.any())).thenReturn(address);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    Practitioner practitioner = practitionerMapper.mapPractitioner(assignedEntity);
    assertThat(practitioner.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
    assertThat(practitioner.getActive()).isEqualTo(true);
    assertThat(practitioner.getNameFirstRep()).isEqualTo(humanName);
    assertThat(practitioner.getTelecomFirstRep()).isEqualTo(contactPoint);
    assertThat(practitioner.getAddressFirstRep()).isEqualTo(address);
}
Also used : Practitioner(org.hl7.fhir.dstu3.model.Practitioner) POCDMT000002UK01AssignedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedEntity) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test)

Example 57 with Address

use of org.hl7.fhir.r4b.model.Address in project integration-adaptor-111 by nhsconnect.

the class PractitionerMapperTest method shouldMapPractitionerForAssignedAuthor.

@Test
public void shouldMapPractitionerForAssignedAuthor() {
    POCDMT000002UK01AssignedAuthor associatedEntity = POCDMT000002UK01AssignedAuthor.Factory.newInstance();
    associatedEntity.setAssignedPerson(createPerson());
    associatedEntity.setTelecomArray(createTelecomArray());
    associatedEntity.setAddrArray(createAddrArray());
    when(humanNameMapper.mapHumanName(ArgumentMatchers.any())).thenReturn(humanName);
    when(contactPointMapper.mapContactPoint(ArgumentMatchers.any())).thenReturn(contactPoint);
    when(addressMapper.mapAddress(ArgumentMatchers.any())).thenReturn(address);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    Practitioner practitioner = practitionerMapper.mapPractitioner(associatedEntity);
    assertThat(practitioner.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
    assertThat(practitioner.getActive()).isEqualTo(true);
    assertThat(practitioner.getNameFirstRep()).isEqualTo(humanName);
    assertThat(practitioner.getTelecomFirstRep()).isEqualTo(contactPoint);
    assertThat(practitioner.getAddressFirstRep()).isEqualTo(address);
}
Also used : POCDMT000002UK01AssignedAuthor(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedAuthor) Practitioner(org.hl7.fhir.dstu3.model.Practitioner) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test)

Example 58 with Address

use of org.hl7.fhir.r4b.model.Address in project integration-adaptor-111 by nhsconnect.

the class MessageHeaderServiceTest method shouldCreateMessageHeader.

@Test
public void shouldCreateMessageHeader() {
    ItkReportHeader itkReportHeader = new ItkReportHeader();
    itkReportHeader.setSpecKey(SPECIFICATION_KEY);
    itkReportHeader.setSpecVal(SPECIFICATION_VALUE);
    itkReportHeader.setAddressList(Arrays.asList(ADDRESS));
    MessageHeader messageHeader = messageHeaderService.createMessageHeader(itkReportHeader, MESSAGEID, EFFECTIVE_TIME);
    assertThat(messageHeader.getId()).isEqualTo(MESSAGEID);
    Coding event = messageHeader.getEvent();
    assertThat(event.getSystem()).isEqualTo(MessageHeaderEvent.SYSTEM);
    assertThat(event.getCode()).isEqualTo(DISCHARGE_DETAILS.getCode());
    assertThat(event.getDisplay()).isEqualTo(DISCHARGE_DETAILS.getDisplay());
    MessageSourceComponent source = messageHeader.getSource();
    assertThat(source.getName()).isEqualTo(MESSAGE_SOURCE_NAME);
    assertThat(source.getEndpoint()).isEqualTo(ENDPOINT);
    assertThat(messageHeader.getReason().getCodingFirstRep().getSystem()).isEqualTo(SPECIFICATION_KEY);
    assertThat(messageHeader.getReason().getCodingFirstRep().getCode()).isEqualTo(SPECIFICATION_VALUE);
    assertThat(messageHeader.getDestinationFirstRep().getEndpoint()).isEqualTo(ADDRESS);
    assertThat(messageHeader.getTimestampElement()).isEqualToComparingFieldByField(DateUtil.parseToInstantType(EFFECTIVE_TIME));
}
Also used : Coding(org.hl7.fhir.dstu3.model.Coding) ItkReportHeader(uk.nhs.adaptors.oneoneone.cda.report.controller.utils.ItkReportHeader) MessageSourceComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent) MessageHeader(org.hl7.fhir.dstu3.model.MessageHeader) Test(org.junit.jupiter.api.Test)

Example 59 with Address

use of org.hl7.fhir.r4b.model.Address in project integration-adaptor-111 by nhsconnect.

the class LocationMapperTest method shouldMapHealthcareFacilityToLocation.

@Test
public void shouldMapHealthcareFacilityToLocation() {
    String locationName = "Moving castle";
    AD itkAddress = mock(AD.class);
    when(nodeUtil.getAllText(any())).thenReturn(locationName);
    when(clinicalDocument.getComponentOf().getEncompassingEncounter().getLocation().getHealthCareFacility().getLocation().getAddr()).thenReturn(itkAddress);
    when(addressMapper.mapAddress(eq(itkAddress))).thenReturn(address);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    Encounter.EncounterLocationComponent locationComponent = locationMapper.mapHealthcareFacilityToLocationComponent(clinicalDocument);
    assertThat(locationComponent.getLocationTarget().getIdElement().getValue()).isEqualTo(RANDOM_UUID);
    assertThat(locationComponent.getLocationTarget().getAddress()).isEqualTo(address);
    assertThat(locationComponent.getLocationTarget().getName()).isEqualTo(locationName);
    assertThat(locationComponent.getStatus()).isEqualTo(Encounter.EncounterLocationStatus.COMPLETED);
}
Also used : AD(uk.nhs.connect.iucds.cda.ucr.AD) Encounter(org.hl7.fhir.dstu3.model.Encounter) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test)

Example 60 with Address

use of org.hl7.fhir.r4b.model.Address in project integration-adaptor-111 by nhsconnect.

the class LocationMapperTest method shouldMapRecipientToLocation.

@Test
public void shouldMapRecipientToLocation() {
    POCDMT000002UK01IntendedRecipient itkIntendedRecipient = prepareIntendedRecipientMocks();
    Location referenceRecipientToLocation = locationMapper.mapRecipientToLocation(itkIntendedRecipient, organization);
    assertThat(referenceRecipientToLocation.getId()).isEqualTo(RANDOM_UUID);
    assertThat(referenceRecipientToLocation.getAddress()).isEqualTo(address);
    assertThat(referenceRecipientToLocation.getTelecom()).isEqualTo(List.of(contactPoint));
    assertThat(referenceRecipientToLocation.getManagingOrganization()).isNotNull();
    assertThat(referenceRecipientToLocation.getManagingOrganizationTarget()).isEqualTo(organization);
    assertThat(referenceRecipientToLocation.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
}
Also used : POCDMT000002UK01IntendedRecipient(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01IntendedRecipient) Location(org.hl7.fhir.dstu3.model.Location) Test(org.junit.jupiter.api.Test)

Aggregations

Address (org.hl7.fhir.r4.model.Address)75 Test (org.junit.Test)47 Patient (org.hl7.fhir.r4.model.Patient)30 Test (org.junit.jupiter.api.Test)30 PersonAddress (org.openmrs.PersonAddress)27 HumanName (org.hl7.fhir.r4.model.HumanName)24 Identifier (org.hl7.fhir.r4.model.Identifier)23 ArrayList (java.util.ArrayList)22 Address (org.hl7.fhir.dstu3.model.Address)22 Path (javax.ws.rs.Path)20 Produces (javax.ws.rs.Produces)20 NotImplementedException (org.apache.commons.lang3.NotImplementedException)19 ContactPoint (org.hl7.fhir.r4.model.ContactPoint)19 Location (org.hl7.fhir.r4.model.Location)13 Organization (org.hl7.fhir.r4.model.Organization)13 InputStream (java.io.InputStream)12 IdType (org.hl7.fhir.dstu3.model.IdType)12 Patient (org.hl7.fhir.dstu3.model.Patient)12 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)12 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)12