I want to customize the openemr in a way that the diagnosis code will fit into one windows with the other fields when adding a medical problem.I found that the source code in …/interface/patient_file/summary/add_edit_issue.php calls a function sel_diagnosis() and it popups the new window.Then,I found the source code of interface/patient_file/encounter/find_code_popup.php and because I am new to openemr and php, I want to help me and tell me which is the main function that calls from sql and gets the results to show them when you hit “search” button?
We made code box a Select2 dropdown. As users type key words, the dropdown shows 20 matches dynamically. 1 more line also converts the title box that now offers top 20 problem descriptions matching partial User input.
We had submitted some code to the project as part of larger design change we went through. This thread identifies some of the places you can look for ‘standard’ code. We did not find any of those approaches reusable.
Function is main_code_set_search() in the script you pointed to above that can be found in custom/code_types.inc.php library. Note that function can deal with any code set/type and can even do a search across multiple different code types/sets(see Administration->Codes which can search across multiple code sets/types via the multiselect). Check out Kevin’s code in the Fee Sheet which uses that same function to do a dynamic search via his diagnosis_search() wrapper:
interface/forms/fee_sheet/review/fee_sheet_search_queries.php
interface/forms/fee_sheet/review/fee_sheet_search_ajax.php
Thank you for your answers.I have a question,how can I get the description of the diagnosis in the search box so when I start typing some words,the most suitable descriptions will appear, and then I will select the one I want? I know about jquery autocomplete and I would like to import it in the away I just wrote,so I will remove the extra window that appears when the diagnosis code field is tapped.Should I choose simple jquery autocomplete or select2 as MD Support mentioned above? Thank you!
Whatever approach you choose, you need to handle multiple code selections from different descriptions. Another user experience improvement you may want to consider:
a. Selectively delete a code
b. reorder existing selections.
I know I must consider these also. I have another question as I am new to this project,is there any table that has all the words or keywords of all the diseases so I can use it for autocomplete instead of showing the whole description? My idea is to start typing and then to show you some recommendations of what disease you look for.If there is a that has all the keywords would help a lot. Thank you!
No, there is no table that breakdowns the descriptions by keyword.
However, if you use the existing code search routines, it effectively treats search terms separated by spaces as keywords. It’s table scanning, but performance seems to be adequate given the size of the data set.
Ok thank you,I will try it later. Now,I try to fit the diagnosis popup window into the add issue window.As a result, some fields that should not be appeared they appear in this window. I attached the photo of the original window and the modified one.Why is that happening? How can I fix the problem? I also attach the source code of add_issue.php so you can see I didn’t change anything but only added code. Another problem is that, after I press the “search” button,the title’s text box is going blank and the title I enter before pressing the button is disappeared.How can I keep the text of title in the text box after pressing the search button? Thank you.
As for the autocomplete,I try to use jquery autocomplete (http://jqueryui.com/autocomplete/) with remote datasource. However,I can’t understand how can I create the search.php at line that says source: search.php.
Is there any way for getting the database values of descriptions? I looked at fee sheet autocomplete and it’s the perfect example for me.Can you explain me please,Kevin, how the files are connected and how is working the autocomplete? Thank you!
Thank you Kevin for your explanation.I have a question,the source code for the small window that does the autocomplete where actually is it? I attached the small window I talk about. I am confused because I tried to create a similar approach with the diagnosis code but failed.I also tried jquery with json without the UI of knockoutjs but not working…I would really appreciate if you can guide me with any of 2 ways for autocomplete,with yours Kevin if I can use it without knockoutjs or with jquery simple autocomplete.Thank you.
This is the view template which renders the html for that window.
Binding to the keydown event is what triggers the lookup
My approach fundamentally depends on using knockout, between triggering the lookup, rendering the options, and what happens when you choose a diagnosis code. Everything is driven by knockout’s mvvm framework. It is inseparable.
I have never used jquery autocomplete so I can’t help you there.
Ok but I saw that in fee_sheet_search_queries.php you implement the function diagnosis_search and you return an array.Then, in fee_sheet_search_ajax.php why you put that array in $retval[‘codes’]? What is that mean? A whole array returns to a row? The variable has the same name “retval” in both files and I think is global.I need some explanation on this as I can’t understand how that part works.