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

MedEx updates status of wrong appointment upon confirmation #7439

Open
surfacehazard opened this issue May 17, 2024 · 0 comments
Open

MedEx updates status of wrong appointment upon confirmation #7439

surfacehazard opened this issue May 17, 2024 · 0 comments

Comments

@surfacehazard
Copy link
Contributor

If an appointment date or time is changed after it is created, an additional row is created in the patient_tracker table, having the same eid (calendar event ID) as the original row.

If subsequently, the appointment is confirmed via e-mail or SMS, MedEx will update the appointment status by adding rows and updating the seq number in patient_tracker_element.

However, due to the queries in this block of code, MedEx will only add patient_tracker_element rows associated with the first patient_tracker record returned, which is likely to be the old, incorrect appointment.

If, after that occurs, the appointment status is manually updated, it can happen that the maximum lastseq numbers from both patient_tracker records align, resulting in duplicate entries on the Flow Board.

I suggest to modify this SELECT query as so:

SELECT * FROM patient_tracker WHERE eid=? AND (eid, date) IN (SELECT eid, MAX(date) FROM patient_tracker group by eid)

...to only reference the updated appointment and mitigate the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant