Search in sources :

Example 1 with IVLTS

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

the class ParticipantMapperTest method shouldMapParticipant.

@Test
public void shouldMapParticipant() {
    POCDMT000002UK01Participant1 encounterParticipant = mock(POCDMT000002UK01Participant1.class);
    POCDMT000002UK01AssociatedEntity associatedEntity = mock(POCDMT000002UK01AssociatedEntity.class);
    IVLTS time = mock(IVLTS.class);
    when(encounterParticipant.getTypeCode()).thenReturn("CON");
    when(encounterParticipant.getAssociatedEntity()).thenReturn(associatedEntity);
    when(encounterParticipant.isSetTime()).thenReturn(true);
    when(encounterParticipant.getTime()).thenReturn(time);
    when(periodMapper.mapPeriod(ArgumentMatchers.isA(IVLTS.class))).thenReturn(period);
    when(practitionerMapper.mapPractitioner(ArgumentMatchers.isA(POCDMT000002UK01AssociatedEntity.class))).thenReturn(practitioner);
    when(resourceUtil.createReference(practitioner)).thenReturn(new Reference(practitioner));
    Encounter.EncounterParticipantComponent participantComponent = participantMapper.mapEncounterParticipant(encounterParticipant);
    assertThat(participantComponent.getIndividualTarget()).isEqualTo(practitioner);
    assertThat(participantComponent.getPeriod()).isEqualTo(period);
    assertThat(participantComponent.getType().get(0).getText()).isEqualTo("CON");
}
Also used : IVLTS(uk.nhs.connect.iucds.cda.ucr.IVLTS) Reference(org.hl7.fhir.dstu3.model.Reference) POCDMT000002UK01Participant1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Participant1) Encounter(org.hl7.fhir.dstu3.model.Encounter) POCDMT000002UK01AssociatedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssociatedEntity) Test(org.junit.jupiter.api.Test)

Example 2 with IVLTS

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

the class ParticipantMapperTest method shouldMapEncounterRelatedPerson.

@Test
public void shouldMapEncounterRelatedPerson() {
    IVLTS time = IVLTS.Factory.newInstance();
    POCDMT000002UK01RelatedEntity relatedEntity = POCDMT000002UK01RelatedEntity.Factory.newInstance();
    relatedEntity.setEffectiveTime(time);
    POCDMT000002UK01Informant12 informant = POCDMT000002UK01Informant12.Factory.newInstance();
    informant.setTypeCode("INF");
    informant.setRelatedEntity(relatedEntity);
    Encounter encounter = new Encounter();
    RelatedPerson relatedPerson = new RelatedPerson();
    relatedPerson.setId(RELATED_PERSON_ID);
    when(relatedPersonMapper.mapRelatedPerson(informant, encounter)).thenReturn(relatedPerson);
    when(periodMapper.mapPeriod(ArgumentMatchers.isA(IVLTS.class))).thenReturn(period);
    when(resourceUtil.createReference(relatedPerson)).thenReturn(new Reference(relatedPerson));
    Encounter.EncounterParticipantComponent participantComponent = participantMapper.mapEncounterRelatedPerson(informant, encounter);
    assertThat(participantComponent.getType().get(0).getText()).isEqualTo("Informant");
    assertThat(participantComponent.getIndividualTarget().getId()).isEqualTo(RELATED_PERSON_ID);
    assertThat(participantComponent.getPeriod()).isEqualTo(period);
}
Also used : IVLTS(uk.nhs.connect.iucds.cda.ucr.IVLTS) POCDMT000002UK01Informant12(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Informant12) POCDMT000002UK01RelatedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01RelatedEntity) Reference(org.hl7.fhir.dstu3.model.Reference) Encounter(org.hl7.fhir.dstu3.model.Encounter) RelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson) Test(org.junit.jupiter.api.Test)

Example 3 with IVLTS

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

the class ConsentMapper method getDataPeriod.

private Period getDataPeriod(POCDMT000002UK01Entry permissionEntry) {
    POCDMT000002UK01Observation observation = permissionEntry.getObservation();
    if (observation == null || !observation.isSetEffectiveTime()) {
        return null;
    }
    Period dataPeriod = new Period();
    IVLTS effectiveTime = observation.getEffectiveTime();
    if (effectiveTime.isSetLow()) {
        dataPeriod.setStartElement(DateUtil.parse(effectiveTime.getLow().getValue()));
    }
    if (effectiveTime.isSetHigh()) {
        dataPeriod.setEndElement(DateUtil.parse(effectiveTime.getHigh().getValue()));
    }
    return dataPeriod;
}
Also used : IVLTS(uk.nhs.connect.iucds.cda.ucr.IVLTS) POCDMT000002UK01Observation(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Observation) Period(org.hl7.fhir.dstu3.model.Period)

Example 4 with IVLTS

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

the class EncounterMapperTest method mockEncompassingEncounter.

private void mockEncompassingEncounter() {
    IVLTS effectiveTime = mock(IVLTS.class);
    when(component1.getEncompassingEncounter()).thenReturn(encompassingEncounter);
    when(identifier.getRoot()).thenReturn(ID_ROOT);
    when(identifier.getExtension()).thenReturn(ID_EXTENSION);
    when(encompassingEncounter.getIdArray()).thenReturn(new II[] { identifier });
    when(encompassingEncounter.getEffectiveTime()).thenReturn(effectiveTime);
}
Also used : IVLTS(uk.nhs.connect.iucds.cda.ucr.IVLTS)

Example 5 with IVLTS

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

the class LocationMapperTest method shouldMapOrganizationToLocationComponent.

@Test
public void shouldMapOrganizationToLocationComponent() {
    POCDMT000002UK01Organization itkOrganization = mock(POCDMT000002UK01Organization.class);
    POCDMT000002UK01OrganizationPartOf partOf = mock(POCDMT000002UK01OrganizationPartOf.class);
    IVLTS effectiveTime = mock(IVLTS.class);
    when(organizationMapper.mapOrganization(any(POCDMT000002UK01Organization.class))).thenReturn(organization);
    when(itkOrganization.isSetAsOrganizationPartOf()).thenReturn(true);
    when(itkOrganization.getAsOrganizationPartOf()).thenReturn(partOf);
    when(partOf.getEffectiveTime()).thenReturn(effectiveTime);
    when(periodMapper.mapPeriod(any())).thenReturn(period);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    Encounter.EncounterLocationComponent encounterLocationComponent = locationMapper.mapOrganizationToLocationComponent(itkOrganization);
    assertThat(encounterLocationComponent.getLocationTarget().getIdElement().getValue()).isEqualTo(RANDOM_UUID);
    assertThat(encounterLocationComponent.getLocationTarget().getManagingOrganizationTarget()).isEqualTo(organization);
    assertThat(encounterLocationComponent.getPeriod()).isEqualTo(period);
}
Also used : IVLTS(uk.nhs.connect.iucds.cda.ucr.IVLTS) Encounter(org.hl7.fhir.dstu3.model.Encounter) POCDMT000002UK01OrganizationPartOf(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01OrganizationPartOf) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test)

Aggregations

IVLTS (uk.nhs.connect.iucds.cda.ucr.IVLTS)7 Test (org.junit.jupiter.api.Test)4 Encounter (org.hl7.fhir.dstu3.model.Encounter)3 Period (org.hl7.fhir.dstu3.model.Period)3 Reference (org.hl7.fhir.dstu3.model.Reference)2 IdType (org.hl7.fhir.dstu3.model.IdType)1 RelatedPerson (org.hl7.fhir.dstu3.model.RelatedPerson)1 IVXBTS (uk.nhs.connect.iucds.cda.ucr.IVXBTS)1 POCDMT000002UK01AssociatedEntity (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssociatedEntity)1 POCDMT000002UK01Informant12 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Informant12)1 POCDMT000002UK01Observation (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Observation)1 POCDMT000002UK01Organization (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization)1 POCDMT000002UK01OrganizationPartOf (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01OrganizationPartOf)1 POCDMT000002UK01Participant1 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Participant1)1 POCDMT000002UK01RelatedEntity (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01RelatedEntity)1