Openemr fhir device, careplan, goal (#4422)
commit592cd5f1af3f0b06a60a575ea8ec036603901122
authorStephen Nielson <stephen@nielson.org>
Fri, 28 May 2021 05:16:55 +0000 (28 01:16 -0400)
committerGitHub <noreply@github.com>
Fri, 28 May 2021 05:16:55 +0000 (27 22:16 -0700)
tree34b856137ae114ef5edc0408c1e4a78755a6ca12
parent3df07580320dce8fe6b67d4f58d1a838eaf65c17
Openemr fhir device, careplan, goal (#4422)

* Implement medical device, fix practitioner

Had some bugs in the practitioner resource.  Went ahead and fixed those
so they work properly with FHIR.  This ended up refactoring some of the
address and name elements into the FHIR utils class so we could remove
duplicate code in Patient, and Person.

Also implemented the DeviceService for searching on medical devices.

* Implemented Goal&Careplan resources,Test Fixtures

Created a CarePlan service that handles the care plan form where goals and care plans are stored.  Since care plans do not have a unique id we had to implement a surrogate key using the encounter and the form_id of the care plan form.

Implemented the CodeTypesService that wraps around some of the global lookup code functions and provides additional helper method functions for grabbing the OID or system URI for a specific code.

Fixed some style issues in various classes.

Updated PatientService's getOne function to remove duplicate code.

Added some protection on npi number in the PractitionerService class to deal with the 'missing' modifier.

Heavily modified the test fixtures to be able to pull in referenced column data points for the fixture.  Wrote a small DSL to allow whitelisted function calls inside the JSON to do things like generate ids, and uuids.  Wrote a fixture manager for Encounters and care plan.

* Fix styling bug.

* Fix the unit tests on demo db.

* Add patient uuid, fix device manufacturer,styles

Style fixes, fix patient uuid searches for care plan and device
manufacturer.

* Fix unit tests if provider, facility is empty

We were throwing errors if the provider or facility db was empty.  This
resolves that issue.

* Fix escaping on fixture manager.

* Improve exception debugging.

* Improve table escaping

Added an option to throw an exception on the sql column name work so I
could figure out why the code was dieing.  Fixed the incorrect column
key for encounters.

* Fix style issues.

Co-authored-by: Stephen Nielson <snielson@discoverandchange.com>
37 files changed:
_rest_routes.inc.php
library/formdata.inc.php
src/Common/Database/QueryUtils.php
src/RestControllers/FHIR/FhirDeviceRestController.php
src/RestControllers/FHIR/FhirGoalRestController.php
src/Services/CarePlanService.php [new file with mode: 0644]
src/Services/CodeTypesService.php [new file with mode: 0644]
src/Services/DeviceService.php [new file with mode: 0644]
src/Services/EncounterService.php
src/Services/FHIR/FhirCarePlanService.php
src/Services/FHIR/FhirCodeSystemUris.php
src/Services/FHIR/FhirDeviceService.php [new file with mode: 0644]
src/Services/FHIR/FhirGoalService.php [new file with mode: 0644]
src/Services/FHIR/FhirPatientService.php
src/Services/FHIR/FhirPersonService.php
src/Services/FHIR/FhirPractitionerService.php
src/Services/FHIR/UtilsService.php
src/Services/PatientService.php
src/Services/PractitionerService.php
src/Services/Search/FHIRSearchFieldFactory.php
src/Services/Search/SearchFieldStatementResolver.php
src/Services/Search/TokenSearchValue.php
tests/Tests/Api/FacilityApiTest.php
tests/Tests/Fixtures/BaseFixtureManager.php
tests/Tests/Fixtures/CarePlanFixtureManager.php [new file with mode: 0644]
tests/Tests/Fixtures/EncounterFixtureManager.php [new file with mode: 0644]
tests/Tests/Fixtures/FacilityFixtureManager.php
tests/Tests/Fixtures/care-plan.json [new file with mode: 0644]
tests/Tests/Fixtures/encounters.json [new file with mode: 0644]
tests/Tests/Fixtures/facility.json
tests/Tests/RestControllers/FHIR/FhirOrganizationRestControllerTest.php
tests/Tests/RestControllers/FacilityRestControllerTest.php
tests/Tests/Services/CarePlanServiceTest.php [new file with mode: 0644]
tests/Tests/Services/EncounterServiceTest.php [new file with mode: 0644]
tests/Tests/Services/FHIR/FhirOrganizationServiceCrudTest.php
tests/Tests/Services/FacilityServiceTest.php
tests/Tests/Services/PatientServiceTest.php