Search in sources :

Example 76 with Organization

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));
    }
}
Also used : ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) Organization(org.hl7.fhir.r4.model.Organization) Coding(org.hl7.fhir.r4.model.Coding) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Location(org.hl7.fhir.r4.model.Location)

Example 77 with Organization

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));
// }
}
Also used : ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) Organization(org.hl7.fhir.r4.model.Organization) Coding(org.hl7.fhir.r4.model.Coding) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Location(org.hl7.fhir.r4.model.Location)

Example 78 with Organization

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);
    }
}
Also used : BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) Bundle(org.hl7.fhir.r4.model.Bundle) ResourceType(org.hl7.fhir.r4.model.Enumerations.ResourceType) TestHelpers.getResourceAsString(au.csiro.pathling.test.helpers.TestHelpers.getResourceAsString) URI(java.net.URI) Test(org.junit.jupiter.api.Test)

Example 79 with Organization

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();
}
Also used : Condition(org.hl7.fhir.r4.model.Condition) Immunization(org.hl7.fhir.r4.model.Immunization) Organization(org.hl7.fhir.r4.model.Organization) Bundle(org.hl7.fhir.r4.model.Bundle) Patient(org.hl7.fhir.r4.model.Patient) DiagnosticReport(org.hl7.fhir.r4.model.DiagnosticReport) Practitioner(org.hl7.fhir.r4.model.Practitioner) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) Observation(org.hl7.fhir.r4.model.Observation) Encounter(org.hl7.fhir.r4.model.Encounter) MedicationStatement(org.hl7.fhir.r4.model.MedicationStatement) Location(org.hl7.fhir.r4.model.Location)

Example 80 with Organization

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);
}
Also used : BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) Organization(org.hl7.fhir.r4.model.Organization) Reference(org.hl7.fhir.r4.model.Reference) Resource(org.hl7.fhir.r4.model.Resource) ArrayList(java.util.ArrayList) Encounter(org.hl7.fhir.r4.model.Encounter) Test(org.junit.Test)

Aggregations

Test (org.junit.jupiter.api.Test)101 Organization (org.hl7.fhir.dstu3.model.Organization)90 Organization (org.hl7.fhir.r4.model.Organization)69 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)41 Resource (org.hl7.fhir.r4.model.Resource)38 ArrayList (java.util.ArrayList)34 List (java.util.List)33 Reference (org.hl7.fhir.r4.model.Reference)33 Identifier (org.hl7.fhir.r4.model.Identifier)30 Bundle (org.hl7.fhir.dstu3.model.Bundle)27 UUID (java.util.UUID)26 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)25 Patient (org.hl7.fhir.r4.model.Patient)25 IdType (org.hl7.fhir.dstu3.model.IdType)24 Bundle (org.hl7.fhir.r4.model.Bundle)24 Coding (org.hl7.fhir.r4.model.Coding)24 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)19 ContactPoint (org.hl7.fhir.r4.model.ContactPoint)17 Reference (org.hl7.fhir.dstu3.model.Reference)16 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)16