Search in sources :

Example 1 with POCDMT000002UK01ParticipantRole

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

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

the class AppointmentMapper method getAppointmentParticipantComponents.

private List<AppointmentParticipantComponent> getAppointmentParticipantComponents(POCDMT000002UK01Encounter itkEncounter) {
    List<AppointmentParticipantComponent> appointmentParticipantComponents = new ArrayList<>();
    POCDMT000002UK01Participant2[] participants = itkEncounter.getParticipantArray();
    for (POCDMT000002UK01Participant2 participant2 : participants) {
        POCDMT000002UK01ParticipantRole role = participant2.getParticipantRole();
        Location location = locationMapper.mapRoleToLocation(role);
        AppointmentParticipantComponent appointmentParticipantComponent = new AppointmentParticipantComponent();
        appointmentParticipantComponent.setActor(resourceUtil.createReference(location));
        appointmentParticipantComponent.setActorTarget(location);
        appointmentParticipantComponent.setRequired(REQUIRED);
        appointmentParticipantComponent.setStatus(ACCEPTED);
        appointmentParticipantComponents.add(appointmentParticipantComponent);
    }
    return appointmentParticipantComponents;
}
Also used : AppointmentParticipantComponent(org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent) POCDMT000002UK01Participant2(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Participant2) ArrayList(java.util.ArrayList) POCDMT000002UK01ParticipantRole(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ParticipantRole) Location(org.hl7.fhir.dstu3.model.Location)

Example 3 with POCDMT000002UK01ParticipantRole

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

the class LocationMapperTest method shouldMapRoleToLocation.

@Test
public void shouldMapRoleToLocation() {
    POCDMT000002UK01ParticipantRole participantRole = mock(POCDMT000002UK01ParticipantRole.class);
    POCDMT000002UK01PlayingEntity playingEntity = mock(POCDMT000002UK01PlayingEntity.class);
    AD itkAddress = mock(AD.class);
    PN personName = mock(PN.class);
    when(participantRole.sizeOfAddrArray()).thenReturn(1);
    when(participantRole.isSetPlayingEntity()).thenReturn(true);
    when(participantRole.getAddrArray(anyInt())).thenReturn(itkAddress);
    when(participantRole.getPlayingEntity()).thenReturn(playingEntity);
    when(playingEntity.getNameArray(anyInt())).thenReturn(personName);
    when(humanNameMapper.mapHumanName(isA(PN.class))).thenReturn(humanName);
    when(addressMapper.mapAddress(isA(AD.class))).thenReturn(address);
    when(humanName.getText()).thenReturn(NAME);
    when(nodeUtil.getNodeValueString(playingEntity.getDesc())).thenReturn(DESCRIPTION);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    Location location = locationMapper.mapRoleToLocation(participantRole);
    assertThat(location.getAddress()).isEqualTo(address);
    assertThat(location.getName()).isEqualTo(NAME);
    assertThat(location.getDescription()).isEqualTo(DESCRIPTION);
    assertThat(location.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
}
Also used : AD(uk.nhs.connect.iucds.cda.ucr.AD) PN(uk.nhs.connect.iucds.cda.ucr.PN) POCDMT000002UK01ParticipantRole(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ParticipantRole) POCDMT000002UK01PlayingEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01PlayingEntity) IdType(org.hl7.fhir.dstu3.model.IdType) Location(org.hl7.fhir.dstu3.model.Location) Test(org.junit.jupiter.api.Test)

Aggregations

POCDMT000002UK01ParticipantRole (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ParticipantRole)3 Location (org.hl7.fhir.dstu3.model.Location)2 POCDMT000002UK01Participant2 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Participant2)2 ArrayList (java.util.ArrayList)1 AppointmentParticipantComponent (org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent)1 IdType (org.hl7.fhir.dstu3.model.IdType)1 Test (org.junit.jupiter.api.Test)1 AD (uk.nhs.connect.iucds.cda.ucr.AD)1 CDNPfITCDAUrl (uk.nhs.connect.iucds.cda.ucr.CDNPfITCDAUrl)1 PN (uk.nhs.connect.iucds.cda.ucr.PN)1 POCDMT000002UK01Encounter (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Encounter)1 POCDMT000002UK01Entry (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Entry)1 POCDMT000002UK01PlayingEntity (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01PlayingEntity)1