Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Insurance Edit Screen overwrites insurance fax value #7164

Closed
adunsulag opened this issue Jan 16, 2024 · 0 comments · Fixed by #7197
Closed

bug: Insurance Edit Screen overwrites insurance fax value #7164

adunsulag opened this issue Jan 16, 2024 · 0 comments · Fixed by #7197
Assignees
Labels
Milestone

Comments

@adunsulag
Copy link
Member

Describe the bug

In the insurance edit screen if you use the popup Add/Search insurance companies and use the Update button to update the phone of the insurance company, it overwrites both the work phone number and the fax number instead of just updating the work number for the company.

To Reproduce

In the Practice Settings Insurance Company setup an insurance company with a fax and a work phone number.
Open a patient and edit their insurance coverages.
Select the insurance company for the Provider field.
Click the Search/Add/Edit button to popup the insurance edit screen.
Change the phone number.
Hit the Update button.
Go back to Practice Settings Insurance Company and see that the fax and work number are now the same.

Expected behavior

Only the work insurance phone number is updated.

Client configuration

OpenEMR master (7.0.2.1)
Chrome 119.0.6045.123
Ubuntu 20.04 LTS

@adunsulag adunsulag added the Bug label Jan 16, 2024
@adunsulag adunsulag added this to the 7.0.2.1 milestone Jan 16, 2024
@adunsulag adunsulag self-assigned this Jan 16, 2024
adunsulag added a commit to DiscoverAndChange/openemr that referenced this issue Jan 16, 2024
Made the add edit search work properly when updating an insurance
policy, creating a new one, etc.  It all funnels through the same
javascript mechanism now and populates the provider correctly.

Fixed a bug where the display name wasn't populating properly when you
enter in an insurance company as it didn't respect the globals settings
for insurance company display.

Also fixed issue openemr#7164 by fixing up the phone number update statements.

Also includes style fixes.
adunsulag added a commit to DiscoverAndChange/openemr that referenced this issue Jan 18, 2024
Made the add edit search work properly when updating an insurance
policy, creating a new one, etc.  It all funnels through the same
javascript mechanism now and populates the provider correctly.

Fixed a bug where the display name wasn't populating properly when you
enter in an insurance company as it didn't respect the globals settings
for insurance company display.

Also fixed issue openemr#7164 by fixing up the phone number update statements.

Also includes style fixes.
stephenwaite added a commit to stephenwaite/openemr that referenced this issue Mar 11, 2024
* fix: load all insurances for editing

* fix for insurance until date when date end isn't set

* new ins edit script

* WIP openemr#7108, Fixes openemr#7107

This is a work in progress for openemr#7108 refactoring the insurance edit
screen.  This pulls the insurance_edit screen out into twig.

It adds an enhancement to the options.inc.php screen so we can add additional
classes.

Since we now have translations on the client side, it implements a
select2 bootstrap select option that handles translations without having
to mess with the complicated php include statements that breaks twig
functionality.

I currently have the twig file rendering the entire insurance edit form.
I need to set it up so we can switch between Primary / Secondary /
Tertiary forms.

Then I need to implement saving the data as well as creating a new
insurance policy.

At that point we can implement the view functionality in the
demographics_all.php screen.

The next step is being able to add a new insurance policy

* Implemented switching of insurance types

Made it so you can switch between the tabs of the insurance types now
and they load properly.

* Refactored js controllers/service/model for CRUD

Refactored the javascript into edit/new controllers, into a service and
insurance policy model to handle data synchronization / saving in the
new / save mode.  Added initial framework for data validation with error
message displays.

* Edit/New Insurance screen ui edits

Fixed the policy dropdown to work better.

Renamed InsuranceEditController to provide more clarity

Moved DOM updates to single render loop to cleanup rendering logic.

* Fixed more bugs on new/edit screen.

* Changes to insurance REST api, validation, service

Fixed the select style issues on edit screen.  Fixed select tab order.
Fixed the policy_type not populating and the insurance provider field not
populating on edit.  Made several of the dropdowns use the select2 code for
styling / UX consistency.

Changed all insurance policy api endpoints to use patient uuid instead of pid
as that's what the code uses.

Removed the POST and PUT /api/patient/{pid}/insurance/{type} endpoint as it
never worked so we can follow REST endpoint best practices

Implemented PUT /api/patient/{puuid}/insurance/{insuranceUuid} for updating an
insurance policy.

Implemented POST /api/patient/{puuid}/insurance for creating a new insurance policy

Added ACL security checks to the insurance policy creation to match what the
insurance edit in demographics uses. POST must have patients/demo[write|addonly]
and PUT must have patients/demo[write]

Implemented a ListOptionRule that will validate against the list_options table
to make sure that the provided value exists in the list.  Its a primitive
implementation with no caching or performance optimizations and hits the
database on each go.  Wrote unit tests for this and created an
OpenEMRParticleValidator that extends the ParticleValidator in order to use
our own custom rules in the future for API validation.  Used this in an updated
CoverageValidator.

Had to modify the Validator class so we can override the internal validator
that is used.

Added copyright / descriptions everywhere.

Created InsurancePolicyTypes constant for the 837p standard policy types for
insurance policies.

Updated CCDA insurance data import process to utilize the refactored
InsuranceService class.

Changed up the InsuranceService class to validate the data in the update/insert
process to make sure we only are dealing with valid data.

Added to the rest config authorization_check for aclPermission to allow
specific ACL permissions.

* Updating phpunit to show deprecation errors.

* Fix checkstyles

* Fix Address Verification global feature

Made it so the address verification global feature works properly in the
insurance edit screen.

* Implemented insurance edit date pickers

Implemented a javascript translated version of our jquery datepicker.

Introduced language direction, date_display_format, and timezone
settings from globals into the jsGlobals array which makes it so we can
get rid of our php language translation mechanisms when working in
javascript land.

Updated the insurance policy models and saving to handle the date
pickers.  Utilized the new international locale date translation to
handle our initial date formatting settings for the date picker.

* Validation updates, javascript fixes.

Implemented validation error displays on the screen.

Implemented cache busting in the javascript files for the insurance
screen.

Updated the insurance coverage/policy required fields.

Added assetVersion to jsGlobals array.

* Add comprehensive validation on effective dates

Made it so the effective date will check against previous records to
verify that we don't violate the db unique constraint checks.

* REST endpoint for single insurance,browse function

Implemented the browse function for the edit screen policy.

REST endpoint implementation for grabbing insurance data for a single
insurance coverage policy for a patient.

* Fixed openemr#7164, Insurance Add/Edit/Search

Made the add edit search work properly when updating an insurance
policy, creating a new one, etc.  It all funnels through the same
javascript mechanism now and populates the provider correctly.

Fixed a bug where the display name wasn't populating properly when you
enter in an insurance company as it didn't respect the globals settings
for insurance company display.

Also fixed issue openemr#7164 by fixing up the phone number update statements.

Also includes style fixes.

* Demographics refactoring, insurance UX changes

Refactored the billing, demographics, and insurance card sections into
individual classes that we can isolate / silo for single responsibility
concerns.

Implemented a preliminary prototype of showing previous insurance
coverages that will cover patients who have lots of previous insurance
cards / insurances.

Fixed a coverage validation bug that stopped you from saving if
effective end date was empty.

Fixed an EDI270 rendering bug on the eligibility as it was returning
broken html.

Added methods to the insurance service to grab a sorted list of
insurance policies that has the current policy and the most recent
policies ordered.

* Fixed code that was commented out.

* Typo ouch

* Fix date orders of insurance history

* Insurance pagination on demographics view screen.

* Hide empty self-pay policies on demographics page

If a policy has no provider it is unassigned ie Self-Pay.  We want to
hide the policies that are self-pay for secondary/tertiary since the
primary is self-pay.

* Fix I18N date exception with value of 0000-00-00

The demographics_comprehensive_save.php will save a DOB of 0000-00-00
for the value if no insurance is provided which is a mess.  Since we
have to deal with existing data we check for the error in the formatter
and just return null if there is an invalid date.

We also catch any exceptions on the selected insurance render and output
it to the screen so at least people know something is broken.

* Make validation errors for select2 display

The error highlights were not showing on the select2 dropdown lists.  We
needed to add custom styles on those since it uses a different element
for all of that.

* Validator fix relationship checks. API docs.

Updated the API docs for the insurance endpoints to include the
validation checks / constraints.

Saw that the original insurance edit screen had validation checks on the
subscriber relationship.  Added checks to make sure if the relationship
is self that the patient name and SSN are correct.  Also if the
relationship is not self that the subscriber does not have the same SSN
as the patient.

* Implemented $swap-insurance operation

Reimplemented the swap insurance functionality in the UX and fixed a
number of validation problems and edge cases that would blow up the
insurance save if the effective date for the policy was not set up
properly.

Built an API rest endpoint for $swap-insurance in order to handle the
insurance piece.  Was going to do a FHIR operation here but our FHIR
coverage implementation is woefully inadequate and will need to be
bumped to another PR.

Added some additional helper methods to processing result also.

* Fix PSR problems

* New Policy curr insurance save effective date

Made it so the new policy saves the current insurance effective date if
it was selected.  Apparently missed that piece.

Also added in the datepicker selector for the effective end date to
set the current policy.

* clean up todos

* Remove old insurance code, fix styles.

Removed the old insurance code and fixed the styles on the insurance
page.

* Remove insurance from demographics page

Since insurance editing is now its own section we can safely remove it
from the full demographics edit page.

* Unsaved changes check, fix jquery events

The jquery select2 and jquery datepicker were breaking because they were
not being cleaned up everytime the dom re-rendered on the page. Added
cleanup process that cleans up the events everytime the render()
function is called.

Implemented the unsaved changes check if the user attempts to leave the
screen and the selected policy has changed it will ask the user to
confirm they want to cancel the changes.

* Fix populating insurance search screen

The search screen for the insurance company popup would not actually
open up the correct provider when selected.  Fixed that bug.

* Implemented tabbing for insurance policy edit

The tab order was not working when the screen would render.  This was
because we blow away all of the DOM elements and re-render them.  We
needed to track which element was last focused and handle the tab order
on the render.

* Remove unused code.

* Fix middle name length validation

* Remove autofill for date values.

We don't want to show previous values on the date pickers as it messes
up the UX.

* Populate Subscriber Self Rel., Fixes openemr#7188

Made it so that selecting 'Self' for the Insurance Policy Subscriber Relation
will now populate the insurance policy fields with the current patient
as well as the current patient's employer information.

Added a REST API endpoint for /api/patient/{puuid}/employer to grab the
employer data.  This includes corresponding REST controllers, services,
routes, etc.

Fixes openemr#7188 base service join clause fix.

* Fix self relationship country code population.

The patient country code was not populating because its called
country_code in patient_data instead of country.  Fixing this issue.

* Fix insurance policy search order.

We want policies that are still active but set to terminate in the
future (longer than today) to show up first, even if there is a policy
that is current (IE has no termination date).

We changed the sort order to be the following
- We sort by policies with an end date in the future or no end
date(NULL)
- THEN we sort by policies that have an end date that is NOT null and
the end date is in the future
- THEN we sort by the policies effective date with newer dates in front (NULL being at the front)
- THEN we sort by the policies effective end date with newer dates in
front (NULL being at the front)
- THEN we sort by the policy number with a case sensitive ordering.

* Prevent double event firings on new policy setup.

If you go to the new policy screen and switch back to the regular screen
it sets up the events for the save button, window messages, etc again.
Fixed it so the events clear when we switch screens and put back when we
come back to the edit screen.

* Fix update copy policy id for new screen.

Was not updating the copy policy id for the new screen. This meant only
the first policy chosen was used as the copy.

* Update copyright notices.

Work was commissioned by Care Management Solutions, Inc.  Needed to
update the copyright messages to have the correct copyright notice.

* Fix insurance sort order (again...)

Had the historical insurance not working because the order was being
reversed.

* Fix javascript style errors.

* Fix translation errors

* Fix php style issues.

* More JS fixes... urgh

* Fix escaping, translations.

* Remove todo as testing passed.

---------

Co-authored-by: stephen waite <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant