shihjay2 / nosh2

NOSH ChartingSystem is an electronic health record system designed exclusively for doctors and patients. This is a new mobile-friendly version that is now based off of the Laravel PHP framework and jQuery. NOSH has FHIR, Bluebutton, ICD-10, GoodRX API, RXNorm API, Phaxio, and UMA support.
Other
75 stars 52 forks source link

fix new-meds-added-to-inactive-list-non-null-rx_list-entries #179

Closed dhes closed 3 years ago

dhes commented 3 years ago

Expected behavior after opening a patient chart, clicking Medications in the left sidebar, clicking "+ Add", entering medication details in the Add Medication form, and pressing "Save":

1) New medication is added to Active Medication list. 2) Medications counter in the left sidebar is incremented by one.

Actual behavior:

1) New medication is added to Inactive Medication list. 2) Medication counter in the left sidebar is not incremented.

Root cause (I think): Adding a new, active medication using this form should insert null in rx_list.rxl_date_inactive and rx_list.rxl_date_old. Instead it inserts '0000-00-00'.

Fix: Remove rx_list.rxl_date_inactive and rx_list.rxl_date_old from the Add Medication form by commenting out the related $items[] arrays in nosh/app/Http/Controllers/Controller.php.

Gotchas:

1) Querying datetime fields in mysql tables (e.g. select from rx_list) will display null for datetime fields which actually contain '0000-00-00'. (I am using the jdbc client version 2.7.1 and DBeaver software. ) However querying this table with 'select from rx_list where rxl_date_inactive = null' will not retrieve any records containing '0000-00-00'. Querying this table with "select * from rx_list where rxl_date_inactive = '0000-00-00'" will retrieve records containing '0000-00-00'. In other word, a datetime entry of '0000-00-00' displays as null but queries as '0000-00-00'.

2) Apparently Laravel will insert '0000-00-00' for a hidden datetime entry from a Controller even when $rx = ['rxl_date_inactive' => null] is set. Removing the items from the form seems to fix the problem.

This proposed edit has been pushed to Docker Hub as dheslinga/nosh:v3. You may test it by modifying docker-compose.yml app-nosh to pull image: dheslinga/nosh:v3 rather than shihjay2/nosh:latest.

DH