Diagnosis code in the same window with other fields

Developers
phil
2013-12-30
2014-01-09
  • phil

    phil - 2013-12-30

    Hello,

    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?

    Thank you!

     
  • MD Support

    MD Support - 2013-12-30

    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.

     
  • phil

    phil - 2013-12-30

    Where can I find the source code for this function? I have version 4.1.1 openemr and I can't find this.

     
  • MD Support

    MD Support - 2013-12-30

    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.

     
  • Brady Miller

    Brady Miller - 2013-12-31

    Hi Phil,

    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

    -brady
    OpenEMR

     
  • phil

    phil - 2013-12-31

    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!

     
  • MD Support

    MD Support - 2013-12-31

    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.

     
  • phil

    phil - 2014-01-02

    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!

     
  • Stephen Waite

    Stephen Waite - 2014-01-02

    there's the short description field in the table icd9_dx_code

     
  • Kevin Yeh

    Kevin Yeh - 2014-01-02

    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.

     
  • phil

    phil - 2014-01-02

    Could you provide the link of the folder that I will call for the short description from icd9_dx_code table?

     
    Last edit: phil 2014-01-02
  • Stephen Waite

    Stephen Waite - 2014-01-02

    it's just a field in the mysql table but i've attached a zipped up file

    i think Kevin's solution is preferrable

     
    • phil

      phil - 2014-01-05

      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.

       
  • phil

    phil - 2014-01-05

    I solved the problem with the extra fields that appeared, now remains the problem with the title as I mentioned before.Any help will be appreciated.

     
  • phil

    phil - 2014-01-08

    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!

     
  • phil

    phil - 2014-01-09

    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.

     
    Last edit: phil 2014-01-09
  • Kevin Yeh

    Kevin Yeh - 2014-01-09

    This is the view template which renders the html for that window.
    Binding to the keydown event is what triggers the lookup

    https://github.com/openemr/openemr/blob/master/interface/forms/fee_sheet/review/views/justify_display.php#L36

    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.

     
  • phil

    phil - 2014-01-09

    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.

     
    Last edit: phil 2014-01-09
  • Kevin Yeh

    Kevin Yeh - 2014-01-09

    $retval['codes'] immediately gets encoded as json and that's what gets sent to the browser.

    So then the browser has an object with property codes which is an array of entries.

    https://github.com/openemr/openemr/blob/master/interface/forms/fee_sheet/review/fee_sheet_justify_view_model.js#L115

    the parameter 'result' here is that object.

    Then the javascript on the client side uses result.codes as an array to populate the view model.

    "$retval" is just the naming convention I use for a variable when I intend use it as a "return value."
    It's global in the ajax wrapper, because that globally scoped code, but in search_query it's just local to the diagnosis_search function. You don't actually need to know that it's called retval within the diagnosis_search function, just that diagnosis_search returns an array.

     

Log in to post a comment.