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

patient_report.php bug from forum, appears on 5.0.0 #1409

Open
stephenwaite opened this issue Feb 3, 2018 · 21 comments · May be fixed by hansglz/openemr#267
Open

patient_report.php bug from forum, appears on 5.0.0 #1409

stephenwaite opened this issue Feb 3, 2018 · 21 comments · May be fixed by hansglz/openemr#267
Labels
Milestone

Comments

@stephenwaite
Copy link
Sponsor Member

No description provided.

@stephenwaite stephenwaite changed the title https://community.open-emr.org/t/report-bug/9594?u=stephenwaite https://community.open-emr.org/t/report-bug/9594 Feb 3, 2018
@stephenwaite
Copy link
Sponsor Member Author

@stephenwaite stephenwaite changed the title https://community.open-emr.org/t/report-bug/9594 patient_report.php bug from forum, appears on 5.0.0 Feb 3, 2018
@bradymiller bradymiller added this to the 5.0.2 milestone Mar 29, 2018
@sssopen
Copy link
Contributor

sssopen commented Apr 4, 2018

I can't reproduce this issue. Added screenshots on the forum:
https://community.open-emr.org/t/report-bug/9594/4

@stephenwaite
Copy link
Sponsor Member Author

hi @sssopen , it looks like it was done with the soap note form

@sssopen
Copy link
Contributor

sssopen commented Apr 4, 2018

Hi stephenwaite,
I used SOAP notes in the encounters and still can't reproduce. Added new screenshots on the forum.

@stephenwaite
Copy link
Sponsor Member Author

stephenwaite commented Apr 4, 2018

thanks for diligently researching this bug @sssopen , @bradymiller miller has a nice point there that it shows up here
untitled

@stephenwaite
Copy link
Sponsor Member Author

then select the encounters and choose patient report

@sssopen
Copy link
Contributor

sssopen commented Apr 4, 2018

Thanks. I found it and was able to recreate the issue. I will look into it.

@sssopen
Copy link
Contributor

sssopen commented Apr 5, 2018

Hello experts,

This seems like a design issue. Encounters are created with the user specified date so I can create an encounter with the date 04/08/18 (current date 04/04/18). However, when we add a note (ex. SOAP) to an encounter we create the note with the current timestamp (04/04/18). When we pull the encounters and notes for the report with the below SQL, the resultset is giving the data the way report is being displayed. Do we really need to allow future dated encounters?

SELECT forms.encounter, forms.form_id, forms.form_name,
forms.formdir, forms.date AS fdate, form_encounter.date,form_encounter.reason
FROM forms, form_encounter
WHERE forms.pid =1 AND form_encounter.pid = 1 AND
form_encounter.encounter = forms.encounter AND forms.deleted=0
ORDER BY form_encounter.encounter DESC, form_encounter.date DESC, fdate ASC

image

@sssopen
Copy link
Contributor

sssopen commented Apr 5, 2018

Taking another look at it and the code, the data retrieved should work. Seems like there is some mess in the code.

@sssopen
Copy link
Contributor

sssopen commented Apr 6, 2018

Okay. I think I found the issue. Code is expecting to have records in particular a order. "New Patient Encounter" record come before the other notes in that encounter. However, that's not happening if you look at the SQL result:

image

Based on that resultset, the report output will be:

image

Either we make the code changes to resolve this issue or we make a change in SQL to return the data the way code is expecting. So making SQL could be easier. If I change the SQL ORDER BY:

SELECT forms.encounter, forms.form_id, forms.form_name,
forms.formdir, forms.date AS fdate, form_encounter.date,form_encounter.reason
FROM forms, form_encounter
WHERE forms.pid =2 AND form_encounter.pid = 2 AND
form_encounter.encounter = forms.encounter AND forms.deleted=0
ORDER BY form_encounter.date DESC, form_encounter.encounter DESC

//ORDER BY form_encounter.encounter DESC, form_encounter.date DESC, fdate ASC -- OLD

The results will be in the order the way code is expecting:

image

The report output will be correct, encounters will have their own notes:

image

@stephenwaite
Copy link
Sponsor Member Author

really nice research and explanation @sssopen , thank you
believe @bradymiller had suggested that we add a new feature that would enable a user to priortize the forms and how they appear in the encounter view and this could probably be extended to the report too

@bradymiller
Copy link
Sponsor Member

bradymiller commented Apr 6, 2018

hi @sssopen ,

We should make sure that we don't reintroduce another bug that was fixed previously here:
#1015
(ie. it looks like things just got more complicated :) )

-brady

@sssopen
Copy link
Contributor

sssopen commented Apr 6, 2018

Hi Brady,
Thanks for letting me know about #1015. I double checked. Seems like #1015 didn't completely fix the issue. If you look at the my above example closely, problem was still there that scenario.
I tested a few different scenarios and my fix seems to be working fine.

Let me know if I should push my change.

@bradymiller
Copy link
Sponsor Member

Sorry for the delay. Was travelling out of country for a bit. I received this info regarding this from somebody via email regarding this and fix 1015:
"Prior to fix encounters appear in reverse date order. Post fix the possibility exists that now they will not always appear this way. .."

@bradymiller
Copy link
Sponsor Member

hi @sssopen ,
Forgot to flag you on my post above. Also, if your interested, have been thinking of cool things we can do with the current menu customization features (completely unrelated to this and bug fixes; and would be a rather large project); let me know if your interested.

@sssopen
Copy link
Contributor

sssopen commented Apr 16, 2018

Hi Brady
Just saw your messages. Yes, I am interested working on menu customization features. Thanks for checking with me.

@bradymiller
Copy link
Sponsor Member

@sssopen , just sent you an email :)

@ghost ghost added good first issue help wanted first-timers-only https://www.firsttimersonly.com/ and removed help-wanted labels Jan 3, 2019
@kacyw
Copy link
Contributor

kacyw commented Feb 8, 2019

@bradymiller is this still an issue?

@bradymiller
Copy link
Sponsor Member

I don't think so, but I honestly can't figure out if it is. Per the forum thread, it appears this is a non-issue:
https://community.open-emr.org/t/same-day-multiple-encounters-patient-report-bug/9594/13

@stephenwaite , any thoughts on this?

@bradymiller
Copy link
Sponsor Member

@kacyw , forgot to mention you on above post

@stephenwaite
Copy link
Sponsor Member Author

guess we should try to recreate the bug to see if it addresses @vrjulas original report, @epsdky has a Fermat like comment that leaves me mystified

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.

5 participants