Search in sources :

Example 56 with Location

use of com.google.api.services.actions_fulfillment.v2.model.Location in project integration-adaptor-111 by nhsconnect.

the class LocationMapper method mapRecipientToLocation.

public Location mapRecipientToLocation(POCDMT000002UK01IntendedRecipient intendedRecipient, Organization organization) {
    Location location = new Location();
    if (intendedRecipient.sizeOfAddrArray() > 0) {
        location.setAddress(addressMapper.mapAddress(intendedRecipient.getAddrArray(0)));
    }
    location.setTelecom(Arrays.stream(intendedRecipient.getTelecomArray()).map(contactPointMapper::mapContactPoint).collect(Collectors.toList()));
    if (!organization.isEmpty()) {
        location.setManagingOrganization(resourceUtil.createReference(organization));
        location.setManagingOrganizationTarget(organization);
    }
    if (location.isEmpty()) {
        return null;
    }
    location.setIdElement(resourceUtil.newRandomUuid());
    return location;
}
Also used : POCDMT000002UK01Location(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Location) Location(org.hl7.fhir.dstu3.model.Location)

Example 57 with Location

use of com.google.api.services.actions_fulfillment.v2.model.Location in project integration-adaptor-111 by nhsconnect.

the class CarePlanMapper method createCarePlanFromSection.

public CarePlan createCarePlanFromSection(POCDMT000002UK01Section cpSection, Encounter encounter, Condition condition) {
    CarePlan carePlan = new CarePlan();
    carePlan.setIdElement(resourceUtil.newRandomUuid());
    carePlan.setIntent(PLAN).setSubject(encounter.getSubject()).setSubjectTarget(encounter.getSubjectTarget()).setStatus(COMPLETED).setContextTarget(encounter).setContext(resourceUtil.createReference(encounter)).setPeriod(encounter.getPeriod()).addAddresses(resourceUtil.createReference(condition));
    if (cpSection.isSetLanguageCode()) {
        carePlan.setLanguage(nodeUtil.getNodeValueString(cpSection.getLanguageCode()));
    }
    if (cpSection.isSetTitle()) {
        carePlan.setTitle(nodeUtil.getNodeValueString(cpSection.getTitle()));
    }
    if (cpSection.getText().sizeOfContentArray() > 0) {
        String cpTextContent = nodeUtil.getNodeValueString(cpSection.getText().getContentArray(0));
        carePlan.setDescription(cpTextContent);
    }
    if (encounter.hasLocation()) {
        List<Reference> authorList = new ArrayList<>();
        for (Encounter.EncounterLocationComponent author : encounter.getLocation()) {
            if (author.hasLocation()) {
                Location location = (Location) author.getLocation().getResource();
                if (location.hasManagingOrganization()) {
                    authorList.add(location.getManagingOrganization());
                }
            }
        }
        carePlan.setAuthor(authorList);
    }
    return carePlan;
}
Also used : CarePlan(org.hl7.fhir.dstu3.model.CarePlan) Reference(org.hl7.fhir.dstu3.model.Reference) ArrayList(java.util.ArrayList) Encounter(org.hl7.fhir.dstu3.model.Encounter) Location(org.hl7.fhir.dstu3.model.Location)

Example 58 with Location

use of com.google.api.services.actions_fulfillment.v2.model.Location in project integration-adaptor-111 by nhsconnect.

the class EncounterReportBundleService method addLocation.

private void addLocation(Bundle bundle, Encounter encounter) {
    List<Encounter.EncounterLocationComponent> locationComponents = encounter.getLocation();
    for (Encounter.EncounterLocationComponent component : locationComponents) {
        if (component.hasLocation()) {
            Location location = component.getLocationTarget();
            addEntry(bundle, location);
            if (location.hasManagingOrganization()) {
                addOrganization(bundle, location.getManagingOrganizationTarget());
            }
        }
    }
}
Also used : Encounter(org.hl7.fhir.dstu3.model.Encounter) Location(org.hl7.fhir.dstu3.model.Location)

Example 59 with Location

use of com.google.api.services.actions_fulfillment.v2.model.Location 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)

Example 60 with Location

use of com.google.api.services.actions_fulfillment.v2.model.Location in project geoprism-registry by terraframe.

the class BasicFhirDataPopulator method populate.

@Override
public void populate(Business row, Facility facility) {
    Organization org = facility.getOrganization();
    org.addAlias(row.getValue(DefaultAttribute.DISPLAY_LABEL.getName() + ListTypeVersion.DEFAULT_LOCALE));
    Location location = facility.getLocation();
    location.setMode(LocationMode.INSTANCE);
    location.setStatus(LocationStatus.ACTIVE);
    location.addAlias(row.getValue(DefaultAttribute.DISPLAY_LABEL.getName() + ListTypeVersion.DEFAULT_LOCALE));
    Collection<Locale> locales = LocalizationFacade.getInstalledLocales();
    for (Locale locale : locales) {
        String attributeName = DefaultAttribute.DISPLAY_LABEL.getName() + locale.toString();
        if (row.hasAttribute(attributeName)) {
            String value = row.getValue(attributeName);
            if (value != null) {
                org.addAlias(value);
                location.addAlias(value);
            }
        }
    }
}
Also used : Locale(java.util.Locale) Organization(org.hl7.fhir.r4.model.Organization) Location(org.hl7.fhir.r4.model.Location)

Aggregations

Test (org.junit.Test)120 Location (org.hl7.fhir.r4.model.Location)93 Location (org.hl7.fhir.dstu3.model.Location)66 IBundleProvider (ca.uhn.fhir.rest.api.server.IBundleProvider)59 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)42 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)30 SearchParameterMap (org.openmrs.module.fhir2.api.search.param.SearchParameterMap)27 BaseFhirProvenanceResourceTest (org.openmrs.module.fhir2.providers.BaseFhirProvenanceResourceTest)21 StringAndListParam (ca.uhn.fhir.rest.param.StringAndListParam)20 StringOrListParam (ca.uhn.fhir.rest.param.StringOrListParam)20 StringParam (ca.uhn.fhir.rest.param.StringParam)20 ReferenceAndListParam (ca.uhn.fhir.rest.param.ReferenceAndListParam)16 ReferenceOrListParam (ca.uhn.fhir.rest.param.ReferenceOrListParam)16 ReferenceParam (ca.uhn.fhir.rest.param.ReferenceParam)16 MockIBundleProvider (org.openmrs.module.fhir2.providers.r4.MockIBundleProvider)16 TokenAndListParam (ca.uhn.fhir.rest.param.TokenAndListParam)13 Test (org.junit.jupiter.api.Test)13 ArrayList (java.util.ArrayList)11 HashSet (java.util.HashSet)11 TokenParam (ca.uhn.fhir.rest.param.TokenParam)10