use of org.hl7.fhir.r4.model.Organization in project geoprism-registry by terraframe.
the class MCSDFhirDataPopulator method populate.
@Override
public void populate(Business row, Facility facility) {
super.populate(row, facility);
ServerGeoObjectType type = this.getList().getGeoObjectType();
String label = type.getLabel().getValue();
String system = this.getContext().getSystem();
CodeableConcept concept = new CodeableConcept().setText(label).addCoding(new Coding(system, type.getCode(), label));
Location location = facility.getLocation();
location.addType(concept);
location.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.Location");
Organization organization = facility.getOrganization();
organization.addType(concept);
organization.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.Organization");
if (type.getGeometryType().equals(GeometryType.MULTIPOINT)) {
location.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.FacilityLocation");
location.addType(new CodeableConcept().addCoding(new Coding("urn:ietf:rfc:3986", "urn:ihe:iti:mcsd:2019:facility", "Facility")));
location.setPhysicalType(new CodeableConcept().setText("Building").addCoding(new Coding("http://terminology.hl7.org/CodeSystem/location-physical-type", "bu", "Building")));
organization.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.FacilityOrganization");
organization.addType(new CodeableConcept().addCoding(new Coding("urn:ietf:rfc:3986", "urn:ihe:iti:mcsd:2019:facility", "Facility")));
} else {
location.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.JurisdictionLocation");
location.addType(new CodeableConcept().addCoding(new Coding("urn:ietf:rfc:3986", "urn:ihe:iti:mcsd:2019:jurisdiction", "Jurisdiction")));
location.setPhysicalType(new CodeableConcept().setText("Jurisdiction").addCoding(new Coding("http://terminology.hl7.org/CodeSystem/location-physical-type", "jdn", "Jurisdiction")));
organization.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.JurisdictionsOrganization");
organization.addType(new CodeableConcept().addCoding(new Coding("urn:ietf:rfc:3986", "urn:ihe:iti:mcsd:2019:jurisdiction", "Jurisdiction")));
}
if (this.hierarchies.size() > 1) {
for (ServerHierarchyType hierarchy : this.hierarchies) {
this.addHierarchyExtension(row, facility, hierarchy);
}
} else if (this.hierarchies.size() == 1) {
this.setPartOf(row, facility, this.hierarchies.get(0));
}
}
use of org.hl7.fhir.r4.model.Organization in project geoprism-registry by terraframe.
the class TolkienFhirDataPopulator method populate.
@Override
public void populate(Business row, Facility facility) {
super.populate(row, facility);
ServerGeoObjectType type = this.getList().getGeoObjectType();
String label = type.getLabel().getValue();
String system = this.getContext().getSystem();
CodeableConcept concept = new CodeableConcept().setText(label).addCoding(new Coding(system, type.getCode(), label));
Location location = facility.getLocation();
location.addType(concept);
location.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.Location");
Organization organization = facility.getOrganization();
organization.addType(concept);
organization.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.Organization");
if (type.getGeometryType().equals(GeometryType.MULTIPOINT)) {
location.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.FacilityLocation");
location.addType(new CodeableConcept().addCoding(new Coding("urn:ietf:rfc:3986", "urn:ihe:iti:mcsd:2019:facility", "Facility")));
location.setPhysicalType(new CodeableConcept().setText("Building").addCoding(new Coding("http://terminology.hl7.org/CodeSystem/location-physical-type", "bu", "Building")));
organization.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.FacilityOrganization");
organization.addType(new CodeableConcept().addCoding(new Coding("urn:ietf:rfc:3986", "urn:ihe:iti:mcsd:2019:facility", "Facility")));
} else {
location.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.JurisdictionLocation");
location.addType(new CodeableConcept().addCoding(new Coding("urn:ietf:rfc:3986", "urn:ihe:iti:mcsd:2019:jurisdiction", "Jurisdiction")));
location.setPhysicalType(new CodeableConcept().setText("Jurisdiction").addCoding(new Coding("http://terminology.hl7.org/CodeSystem/location-physical-type", "jdn", "Jurisdiction")));
organization.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE.mCSD.JurisdictionsOrganization");
organization.addType(new CodeableConcept().addCoding(new Coding("urn:ietf:rfc:3986", "urn:ihe:iti:mcsd:2019:jurisdiction", "Jurisdiction")));
}
// if (this.hierarchies.size() > 1)
{
for (ServerHierarchyType hierarchy : this.hierarchies) {
this.addHierarchyExtension(row, facility, hierarchy);
}
}
// else if (this.hierarchies.size() == 1)
// {
// this.setPartOf(row, facility, this.hierarchies.get(0));
// }
}
use of org.hl7.fhir.r4.model.Organization in project pathling by aehrc.
the class BatchTest method batch.
@Test
void batch() throws URISyntaxException {
// Check the counts for each resource type.
for (final ResourceType resourceType : RESOURCE_TYPES) {
assertResourceCount(resourceType, expectedCounts.get(resourceType));
}
// Send a batch request with a new Patient, Practitioner and Organization resource.
final String request = getResourceAsString("requests/BatchTest/batch.Bundle.json");
final Bundle requestBundle = (Bundle) jsonParser.parseResource(request);
final String url = "http://localhost:" + port + "/fhir";
final ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, RequestEntity.put(new URI(url)).contentType(TestHelpers.FHIR_MEDIA_TYPE).accept(TestHelpers.FHIR_MEDIA_TYPE).body(request), String.class);
assertEquals(200, response.getStatusCode().value());
assertNotNull(response.getBody());
// Check the response bundle is successful and matches the requests.
final Bundle responseBundle = (Bundle) jsonParser.parseResource(response.getBody());
assertEquals(requestBundle.getEntry().size(), responseBundle.getEntry().size());
for (final BundleEntryComponent entry : responseBundle.getEntry()) {
assertTrue(entry.getResponse().getStatus().startsWith("200"));
assertNotNull(entry.getResource());
final String resourceId = entry.getResource().getIdElement().getIdPart();
final ResourceType resourceType = ResourceType.fromCode(entry.getResource().getResourceType().toString());
getResourceResult(resourceType, resourceId);
}
// Check that the new resource counts are one greater than before the operation.
for (final ResourceType resourceType : RESOURCE_TYPES) {
assertResourceCount(resourceType, expectedCounts.get(resourceType) + 1);
}
}
use of org.hl7.fhir.r4.model.Organization in project eCRNow by drajer-health.
the class FhirEicrGeneratorFromR4 method convertR4FhirBundletoCdaEicr.
public static String convertR4FhirBundletoCdaEicr(R4FhirData data) {
StringBuilder eICR = new StringBuilder();
if (data != null) {
Bundle bundle = data.getData();
if (bundle != null) {
List<BundleEntryComponent> entries = bundle.getEntry();
for (BundleEntryComponent ent : entries) {
// Populate data ..this can be moved to the APIs where the bundle is getting created.
if (ent.getResource() instanceof Patient) {
logger.info(" Bundle contains Patient ");
data.setPatient((Patient) ent.getResource());
} else if (ent.getResource() instanceof Practitioner) {
logger.info(" Bundle contains Practitioner ");
data.setPractitioner((Practitioner) ent.getResource());
} else if (ent.getResource() instanceof Encounter) {
logger.info(" Bundle contains Encounter ");
data.setEncounter((Encounter) ent.getResource());
} else if (ent.getResource() instanceof Location) {
logger.info(" Bundle contains Location ");
data.setLocation((Location) ent.getResource());
} else if (ent.getResource() instanceof Organization) {
logger.info(" Bundle contains Organization ");
data.setOrganization((Organization) ent.getResource());
} else if (ent.getResource() instanceof Condition) {
logger.info(" Bundle contains Condition ");
data.getConditions().add((Condition) ent.getResource());
} else if (ent.getResource() instanceof Observation) {
logger.info(" Bundle constains Observation ");
Observation obs = (Observation) ent.getResource();
} else if (ent.getResource() instanceof DiagnosticReport) {
logger.info(" Bundle contains Diagnostic Report ");
data.getDiagReports().add((DiagnosticReport) ent.getResource());
} else if (ent.getResource() instanceof MedicationStatement) {
logger.info(" Bundle contains MedicationStatement ");
data.getMedications().add((MedicationStatement) ent.getResource());
} else if (ent.getResource() instanceof Immunization) {
logger.info(" Bundle contains Immunization ");
data.getImmunizations().add((Immunization) ent.getResource());
}
}
}
} else {
logger.error(" No Fhir Bundle Available to create CDA Documents ");
}
return eICR.toString();
}
use of org.hl7.fhir.r4.model.Organization in project eCRNow by drajer-health.
the class CdaFhirUtilitiesTest method testGetOrganization_withOrgEntry.
@Test
public void testGetOrganization_withOrgEntry() {
Reference ref = new Reference();
ref.setReference("ResId");
BundleEntryComponent bundleEntry = new BundleEntryComponent();
Resource org = ResourceFactory.createResource("Organization");
org.setId("ResId");
bundleEntry.setResource(org);
List<BundleEntryComponent> entries = new ArrayList<BundleEntryComponent>();
entries.add(bundleEntry);
Encounter en = new Encounter();
en.setServiceProvider(ref);
Organization testOrg = CdaFhirUtilities.getOrganization(entries, en);
assertNotNull(testOrg);
}
Aggregations