forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Openemr fhir medication request (openemr#4558)
* Implementing MedicationRequest with prescriptions. We store medications in two different spots, medication list and prescriptions table. WENO stores them in prescriptions table and NewCROP stores them in medication list. For now we are just working with the prescription table and will add the medication list in a bit. * Add debugs for scope repo * Moved where scopes are loaded into auth controller * FHIR MedicationRequest resource Fixed embedded medication. Moved the status from the FHIR resource down into the prescription level. Got the drug codes to work correctly. Removed the unit, interval, and route stuff which wasn't working and didn't have the right codes. Implemented the intent and status ordering. Moved the route stuff into a separate function so we could re-use it if we do indeed need it later. Added initial provenance resource implementation. Added a narrative entity helper function to Utility. * MedicationRequest FHIR implementation This was a much bigger endeavor than expected due to the way OpenEMR handles medications and the way FHIR handles medications. US Core combines the listing of a patient's medications and the patient's perscriptions into a single MedicationRequest resource. FHIR R4 has a breakdown of various resources but US Core brings them into a single resource. Many of the US core must support fields are not supported in the NewCrop and WENO e-prescribe and so we add those fields to the Medications issues screen. In this commit I add to the Medication Issues screen the ability to specify a medication order's intent, the usage category of a medication, and an open text field for dosage instructions for a patient taking the medication. The usage category specifies where the medication is intended to be used (at home, in an inpatient, outpatient, or at the time of discharge). Eventually its been proposed to move this into the procedure order screen which will have to be a project by someone else. I've gone and created a lists_medication table to hold all of the medication specific fields for an issue there. I ended up moving the patient issue saving to its own service so we could centralize this logic and make sure we are saving data consistently. I had to modify the deleter.php file to make sure we delete the data properly. All the extra medication data is optional in the database so we don't break any existing logic elsewhere where we utilize issues. I noticed the add_edit_issue.php was using our old system of escaping columns and I moved the logic to use parameterized sql binding. I had to fix some bugs in the BaseService.php classes dealing with NULL values. * Notes on future work that should be done. * Fix style issues * Had minor sequence order issue. * Fix style issues. * Fix sql problems from code review.
- Loading branch information
Showing
19 changed files
with
926 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
interface/patient_file/summary/add_edit_issue_medication_fragment.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/** | ||
* add_edit_issue_medication_fragment.php Represents the medication fields used for the medication type issue list | ||
* @package openemr | ||
* @link http:https://www.open-emr.org | ||
* @author Stephen Nielson <[email protected]> | ||
* @copyright Copyright (c) 2021 Stephen Nielson <[email protected]> | ||
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 | ||
*/ | ||
|
||
/** | ||
* @global $irow The issues list record row we are working with | ||
*/ | ||
if (empty($irow)) { | ||
return; | ||
} | ||
$medication = $irow['medication'] ?? []; | ||
$usage_category = $medication['usage_category'] ?? null; | ||
$request_intent = $medication['request_intent'] ?? null; | ||
?> | ||
<div class="form-group col-12"> | ||
<label class="col-form-label" for="medication[usage_category]"><?php echo xlt('Medication Usage'); ?>:</label> | ||
<?php | ||
generate_form_field(array('data_type' => 1, 'field_id' => 'medication[usage_category]', 'list_id' => 'medication-usage-category', 'empty_title' => 'SKIP'), $usage_category); | ||
?> | ||
</div> | ||
<div class="form-group col-12"> | ||
<label class="col-form-label" for="medication[request_intent]"><?php echo xlt('Medication Request Intent'); ?>:</label> | ||
<?php | ||
generate_form_field(array('data_type' => 1, 'field_id' => 'medication[request_intent]', 'list_id' => 'medication-request-intent'), $request_intent); | ||
?> | ||
</div> | ||
<div class="form-group col-12"> | ||
<label class="col-form-label" for="form_medication[drug_dosage_instructions]"><?php echo xlt('Medication Dosage Instructions'); ?>:</label> | ||
<textarea class="form-control" name='form_medication[drug_dosage_instructions]' id='form_medication[drug_dosage_instructions]' | ||
rows="4"><?php echo text($medication['drug_dosage_instructions'] ?? '') ?></textarea> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.