use of uk.nhs.connect.iucds.cda.ucr.TEL in project integration-adaptor-111 by nhsconnect.
the class RelatedPersonMapperTest method shouldCreateRelatedPersonWhenPatientHasEcTelecom.
@Test
public void shouldCreateRelatedPersonWhenPatientHasEcTelecom() {
TEL[] telecomArray = createTelecomArray();
telecomArray[0].setUse(Collections.singletonList("EC"));
when(clinicalDocumentDocument.getRecordTargetArray(0)).thenReturn(recordTarget);
when(recordTarget.getPatientRole()).thenReturn(patientRole);
when(patientRole.getTelecomArray()).thenReturn(telecomArray);
when(contactPoint.getValue()).thenReturn(TELECOM_VALUE);
when(contactPointMapper.mapContactPoint(ArgumentMatchers.any())).thenReturn(contactPoint);
RelatedPerson relatedPerson = relatedPersonMapper.createEmergencyContactRelatedPerson(clinicalDocumentDocument, encounter);
assertThat(relatedPerson.hasRelationship()).isTrue();
assertThat(relatedPerson.getRelationship().getCoding().size()).isEqualTo(1);
assertThat(relatedPerson.getRelationship().getCodingFirstRep().getCode()).isEqualTo("C");
assertThat(relatedPerson.getRelationship().getCodingFirstRep().getDisplay()).isEqualTo("Emergency Contact");
assertThat(relatedPerson.getTelecom().get(0).getValue()).isEqualTo(TELECOM_VALUE);
}
use of uk.nhs.connect.iucds.cda.ucr.TEL in project integration-adaptor-111 by nhsconnect.
the class RelatedPersonMapperTest method shouldMapRelatedPersonWithTwoCodingsInRelationship.
@Test
public void shouldMapRelatedPersonWithTwoCodingsInRelationship() {
setup();
TEL[] telecomArray = createTelecomArray();
telecomArray[0].setUse(Collections.singletonList("EC"));
relatedEntity.setTelecomArray(telecomArray);
informant12.setRelatedEntity(relatedEntity);
RelatedPerson relatedPerson = relatedPersonMapper.mapRelatedPerson(informant12, encounter);
assertThat(relatedPerson.hasRelationship()).isTrue();
assertThat(relatedPerson.getRelationship().getCoding().size()).isEqualTo(2);
}
use of uk.nhs.connect.iucds.cda.ucr.TEL in project integration-adaptor-111 by nhsconnect.
the class OrganizationMapperTest method mockItkOrganization.
private POCDMT000002UK01Organization mockItkOrganization() {
POCDMT000002UK01Organization itkOrganization = mock(POCDMT000002UK01Organization.class);
AD itkAddress = mock(AD.class);
TEL itkTelecom = mock(TEL.class);
CE codeEntity = mock(CE.class);
II[] iiArray = new II[] { ii };
when(itkOrganization.getIdArray()).thenReturn(iiArray);
when(ii.isSetExtension()).thenReturn(true);
when(ii.getExtension()).thenReturn(ODS_CODE);
when(itkOrganization.sizeOfIdArray()).thenReturn(1);
when(itkOrganization.getAddrArray()).thenReturn(new AD[] { itkAddress });
when(itkOrganization.getTelecomArray()).thenReturn(new TEL[] { itkTelecom });
when(itkOrganization.isSetStandardIndustryClassCode()).thenReturn(true);
when(itkOrganization.getStandardIndustryClassCode()).thenReturn(codeEntity);
when(codeEntity.getDisplayName()).thenReturn(GP_PRACTICE);
when(contactPointMapper.mapContactPoint(any())).thenReturn(contactPoint);
when(addressMapper.mapAddress(any())).thenReturn(address);
when(nodeUtil.getNodeValueString(itkOrganization.getNameArray(0))).thenReturn(ORGANIZATION_NAME);
when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
Organization organization = organizationMapper.mapOrganization(itkOrganization);
assertThat(organization.getName()).isEqualTo(ORGANIZATION_NAME);
assertThat(organization.getAddressFirstRep()).isEqualTo(address);
assertThat(organization.getTelecomFirstRep()).isEqualTo(contactPoint);
assertThat(organization.getTypeFirstRep().getText()).isEqualTo(GP_PRACTICE);
assertThat(organization.getIdentifierFirstRep().getValue()).isEqualTo(ODS_CODE);
assertThat(organization.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
return itkOrganization;
}
use of uk.nhs.connect.iucds.cda.ucr.TEL in project integration-adaptor-111 by nhsconnect.
the class ContactPointMapperTest method shouldMapContactPointPhone.
@Test
public void shouldMapContactPointPhone() {
TEL tel = TEL.Factory.newInstance();
tel.setValue(TEL_NUMBER);
tel.setUse(singletonList(USE_ITK_HOME));
tel.addNewUseablePeriod();
when(periodMapper.mapPeriod(ArgumentMatchers.any())).thenReturn(period);
ContactPoint contactPoint = contactPointMapper.mapContactPoint(tel);
assertThat(contactPoint.getValue()).isEqualTo(TEL_NUMBER);
assertThat(contactPoint.getUse()).isEqualTo(HOME);
assertThat(contactPoint.getPeriod()).isEqualTo(period);
assertThat(contactPoint.getSystem()).isEqualTo(PHONE);
}
use of uk.nhs.connect.iucds.cda.ucr.TEL in project integration-adaptor-111 by nhsconnect.
the class RelatedPersonMapperTest method shouldNotCreateRelatedPersonWithoutEcTelecom.
@Test
public void shouldNotCreateRelatedPersonWithoutEcTelecom() {
TEL[] telecomArray = createTelecomArray();
telecomArray[0].setUse(Collections.singletonList("H"));
when(clinicalDocumentDocument.getRecordTargetArray(0)).thenReturn(recordTarget);
when(recordTarget.getPatientRole()).thenReturn(patientRole);
when(patientRole.getTelecomArray()).thenReturn(telecomArray);
RelatedPerson relatedPerson = relatedPersonMapper.createEmergencyContactRelatedPerson(clinicalDocumentDocument, encounter);
assertThat(relatedPerson).isNull();
}
Aggregations