use of com.walmartlabs.concord.runtime.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;
}
use of com.walmartlabs.concord.runtime.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;
}
use of com.walmartlabs.concord.runtime.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());
}
}
}
}
use of com.walmartlabs.concord.runtime.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);
}
use of com.walmartlabs.concord.runtime.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);
}
}
}
}
Aggregations