Search in sources :

Example 11 with Address

use of com.adobe.target.delivery.v1.model.Address in project summary-care-record-api by NHSDigital.

the class OrganisationMapper method mapOrganization.

public Organization mapOrganization(Node organisation) {
    var org = new Organization();
    org.setId(randomUUID());
    xmlUtils.getOptionalValueByXPath(organisation, ORG_CODE_XPATH).ifPresent(it -> org.addType(new CodeableConcept(new Coding().setCode(it))));
    xmlUtils.detachOptionalNodeByXPath(organisation, ORG_NAME_XPATH).ifPresent(name -> org.setName(name.getTextContent()));
    xmlUtils.detachOptionalNodeByXPath(organisation, ADDRESS_XPATH).ifPresent(node -> org.addAddress(new Address().setText(node.getTextContent())));
    xmlUtils.detachOptionalNodeByXPath(organisation, TELECOM_XPATH).ifPresent(telecom -> org.addTelecom(telecomMapper.mapTelecom(telecom)));
    return org;
}
Also used : Organization(org.hl7.fhir.r4.model.Organization) Address(org.hl7.fhir.r4.model.Address) Coding(org.hl7.fhir.r4.model.Coding) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 12 with Address

use of com.adobe.target.delivery.v1.model.Address in project openmrs-module-fhir2 by openmrs.

the class LocationAddressTranslatorImplTest method shouldTranslateLocationPostalCodeToAddressCode.

@Test
public void shouldTranslateLocationPostalCodeToAddressCode() {
    omrsLocation.setPostalCode(POSTAL_CODE);
    org.hl7.fhir.r4.model.Address address = translator.toFhirResource(omrsLocation);
    assertThat(address, notNullValue());
    assertThat(address.getPostalCode(), notNullValue());
    assertThat(address.getPostalCode(), equalTo(POSTAL_CODE));
}
Also used : Address(org.hl7.fhir.r4.model.Address) Test(org.junit.Test)

Example 13 with Address

use of com.adobe.target.delivery.v1.model.Address in project openmrs-module-fhir2 by openmrs.

the class LocationAddressTranslatorImplTest method shouldTranslateAddressPostalCodeToLocationPostalCode.

@Test
public void shouldTranslateAddressPostalCodeToLocationPostalCode() {
    org.hl7.fhir.r4.model.Address address = new Address();
    address.setPostalCode(POSTAL_CODE);
    omrsLocation = translator.toOpenmrsType(new Location(), address);
    assertThat(omrsLocation, notNullValue());
    assertThat(omrsLocation.getPostalCode(), notNullValue());
    assertThat(omrsLocation.getPostalCode(), equalTo(POSTAL_CODE));
}
Also used : Address(org.hl7.fhir.r4.model.Address) Address(org.hl7.fhir.r4.model.Address) Location(org.openmrs.Location) Test(org.junit.Test)

Example 14 with Address

use of com.adobe.target.delivery.v1.model.Address in project openmrs-module-fhir2 by openmrs.

the class LocationAddressTranslatorImplTest method shouldTranslateAddressCountryToLocationCountry.

@Test
public void shouldTranslateAddressCountryToLocationCountry() {
    org.hl7.fhir.r4.model.Address address = new Address();
    address.setCountry(COUNTRY);
    omrsLocation = translator.toOpenmrsType(new Location(), address);
    assertThat(omrsLocation, notNullValue());
    assertThat(omrsLocation.getCountry(), notNullValue());
    assertThat(omrsLocation.getCountry(), equalTo(COUNTRY));
}
Also used : Address(org.hl7.fhir.r4.model.Address) Address(org.hl7.fhir.r4.model.Address) Location(org.openmrs.Location) Test(org.junit.Test)

Example 15 with Address

use of com.adobe.target.delivery.v1.model.Address in project openmrs-module-fhir2 by openmrs.

the class LocationAddressTranslatorImplTest method shouldTranslateLocationProvinceToAddressProvince.

@Test
public void shouldTranslateLocationProvinceToAddressProvince() {
    omrsLocation.setStateProvince(STATE_PROVINCE);
    org.hl7.fhir.r4.model.Address address = translator.toFhirResource(omrsLocation);
    assertThat(address, notNullValue());
    assertThat(address.getState(), notNullValue());
    assertThat(address.getState(), equalTo(STATE_PROVINCE));
}
Also used : Address(org.hl7.fhir.r4.model.Address) Test(org.junit.Test)

Aggregations

Address (org.hl7.fhir.r4.model.Address)75 Test (org.junit.Test)35 Address (org.hl7.fhir.dstu3.model.Address)22 PersonAddress (org.openmrs.PersonAddress)21 HumanName (org.hl7.fhir.r4.model.HumanName)20 Patient (org.hl7.fhir.r4.model.Patient)18 ArrayList (java.util.ArrayList)17 Identifier (org.hl7.fhir.r4.model.Identifier)17 ContactPoint (org.hl7.fhir.r4.model.ContactPoint)16 Test (org.junit.jupiter.api.Test)13 Organization (org.hl7.fhir.r4.model.Organization)12 Address (com.amazonaws.services.ec2.model.Address)7 HumanName (org.hl7.fhir.dstu3.model.HumanName)7 PatientCommunicationComponent (org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent)7 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 DescribeAddressesResult (com.amazonaws.services.ec2.model.DescribeAddressesResult)5 HashSet (java.util.HashSet)5 Coding (org.hl7.fhir.r4.model.Coding)5 StringType (org.hl7.fhir.r4.model.StringType)5 Before (org.junit.Before)5