My providers want the diagnosis "Tobacco Use Disorder, F17.200" to be automatically entered in the problem list if a particular field in the smoking history section is checked. My function works, but it adds the diagnosis every time the note is put on hold, potentially multiple times within the same note. Any suggestions?
{IF DOCUMENT.TOBUSE"" AND match(PROB_AFTER(),"Tobacco Use Disorder")==0 then MEL_ADD_PROBLEM("hx of", "Tobacco Use Disorder", "305.1", str(._TODAYSDATE), "", "") ELSE "" ENDIF}
It looks like you are miss a not equals sign. Try this:
{IF DOCUMENT.TOBUSE <> "" AND match(PROB_AFTER(),”Tobacco Use Disorder”)==0 then MEL_ADD_PROBLEM(“hx of”, “Tobacco Use Disorder”, “305.1″, str(._TODAYSDATE), “”, “”) ELSE “” ENDIF}
Brad
Simple.
If match(Prob_After("List"),ICD10Code)==0 then
...add problem code
endif
I tried this change and it works in adding the diagnosis, but still adds mulitple times. Every time the note is put on hold and opened again, the diagnosis is added again. Isn't PROB_AFTER supposed to recognize changes within the current chart update?
Many times, I find that if I compare directly from a MEL call (such as PROB_AFTER("list")) that the code will fail when the form is still loading. so when you put it on hold and open it again, the code PROB_AFTER("list") returns "". This is why it will add the problem to the problem list, even if it is already on the list. it is also why it will add every time it is put on hold and opened again.
Your best bet is to either set a Document Variable on the page to = PROB_AFTER("List"), and then check your function against DOCUMENT.PROBLEM_VAR instead of using the PROB_AFTER code, or have a button that has to be pressed to run the code.
Please let me know if you need more info, and I will be happy to share what I have encountered and what works for our clinic. I am hoping that 12.2 makes some of the timing issues better.
Thank you,
Daniel C.
I agree with Daniel about the timing of the form as it loads as I have seen this as well.
Another option, in addition to his suggestions, would be to add your code to the Page Close Handler.