I am trying to develop a form that will allow my providers to add orders, tie in Dx to said orders, anSign them w/o having to access the actual orders module.
I have the add ortders and sign orders part down of course. but am struggling to find away to associated active problems as Dx for the orders.
Any help would be greatly appreciated,
I tried to attach my latest dlg, but could not find a mechanism in the forum to do so
I use this code in the watcher panel-
{!global plist}
/*Build problem list to choose from*/
{!if PROB_AFTER("LIST") <> "" then
plist = str(getfield(PROB_AFTER("LIST"),"\n",";,\r"))
else plist = "" endif}
/* Build diagnosis description string*/
{fn descr(dx){
local descri=""
local probarray = getfield(dx,",","")
local sprob = size(probarray)
if (sprob > 0) then descri = descri + sub(probarray[1],1,match(probarray[1]," (")-1) endif
if (sprob > 1) then descri = descri + "|" + sub(probarray[2],1,match(probarray[2]," (")-1) endif
if (sprob > 2) then descri = descri + "|" + sub(probarray[3],1,match(probarray[3]," (")-1) endif
if (sprob > 3) then descri = descri + "|" + sub(probarray[4],1,match(probarray[4]," (")-1) endif
if (sprob > 4) then descri = descri + "|" + sub(probarray[5],1,match(probarray[5]," (")-1) endif
if (sprob > 5) then descri = descri + "|" + sub(probarray[6],1,match(probarray[6]," (")-1) endif
if (sprob > 6) then descri = descri + "|" + sub(probarray[7],1,match(probarray[7]," (")-1) endif
if (sprob > 7) then descri = descri + "|" + sub(probarray[8],1,match(probarray[8]," (")-1) endif
return descri
}}
/* Build diagnosis code string*/
{fn icd_code(dx){
local pcode = ""
local probarray = getfield(dx,",","")
local sprob = size(probarray)
if (sprob > 0) then pcode = pcode + sub(probarray[1],match(probarray[1],"ICD"),size(probarray[1])-match(probarray[1],"ICD")) else "" endif
if (sprob > 1) then pcode = pcode + "|" + sub(probarray[2],match(probarray[2],"ICD"),size(probarray[2])-match(probarray[2],"ICD")) else "" endif
if (sprob > 2) then pcode = pcode + "|" + sub(probarray[3],match(probarray[3],"ICD"),size(probarray[3])-match(probarray[3],"ICD")) else "" endif
if (sprob > 3) then pcode = pcode + "|" + sub(probarray[4],match(probarray[4],"ICD"),size(probarray[4])-match(probarray[4],"ICD")) else "" endif
if (sprob > 4) then pcode = pcode + "|" + sub(probarray[5],match(probarray[5],"ICD"),size(probarray[5])-match(probarray[5],"ICD")) else "" endif
if (sprob > 5) then pcode = pcode + "|" + sub(probarray[6],match(probarray[6],"ICD"),size(probarray[6])-match(probarray[6],"ICD")) else "" endif
if (sprob > 6) then pcode = pcode + "|" + sub(probarray[7],match(probarray[7],"ICD"),size(probarray[7])-match(probarray[7],"ICD")) else "" endif
if (sprob > 7) then pcode = pcode + "|" + sub(probarray[8],match(probarray[8],"ICD"),size(probarray[8])-match(probarray[8],"ICD")) else "" endif
return pcode
}}
My diagnosis lists are in list boxes, choose dynamic options and write plist in the connection box. In the MEL add order use the second two functions with the problem listbox as the variable like icd_code(document.problemlist),descri(document.problemlist). You can add up to 8 diagnosis unless you adjust the function, I think max supported by GE is 12 but I doubt our users have ever added more than 3.
Michael,
thank you very much - really cant thank you enough. Works perfectly.
I'm working on something along these lines as well. The only problem I seem to keep having is the ordering of the diagnosis when the order pushes through.
The only way I have found to modify the order is to open the problem screen, manually adjust the order and then go back and add the order.
This is a pain because the next order may have a different primary, secondary, etc...
I'm wondering if anyone has a working ordering of the dx's that I could incorporate??
What I would do is use dropdowns designated as primary, secondary, and tertiary (use a limit of three?) Then use the below functions to combine them in the proper order when adding the diagnosis. In MEL_ADD_ORDER use -
icd_code(fnItemCombine(",",DOCUMENT.PRIMARY,DOCUMENT.SECONDARY,DOCUMENT.TERTIARY)
and
descr(fnItemCombine(",",DOCUMENT.PRIMARY,DOCUMENT.SECONDARY,DOCUMENT.TERTIARY)
/*Count the number of arguments present and delimits them with argument one*/
{fn fnItemCombine(){
if (getnargs() < 2) then
return ""
endif
local count = getnargs()
local delim = getarg(1)
local rtnstr = ""
for i = 2, i <= count, i = i + 1 do
rtnstr = fnItemCombineUtil(delim,rtnstr,getarg(i))
endfor
return rtnstr
}}
/*Quickly and easily combines two fields with a delim if they are both not blank, used by fnItemCombine*/
{fn fnItemCombineUtil(delim,one,two){
if (one <> "") and (two <> "") then
return (one + delim + two)
else return (one + two) endif
}}
Thank you Michael for posting this code. Unfortunalty I am having problems getting it to work. This What I have done on the form:
1. Created a Dynamic List box, and named Problems:, Connection Type: Document Variable, Variable Name: PROBLEMLIST. In the MEL expression I entered plist.
2. Created a button and labeled it OV, NEW PT, BRIEF, Connection Type: RUNPROCESS, with this code:
MEL_ADD_ORDER("S", "E&M Services (99201-99499)", "OV, NEW PT, BRIEF", DOCUMENT.MODIFIERS, icd_code(document.problemlist), descri(document.problemlist) , DOCUMENT.ORDCOMMENTS, "", "", "", "")
3. Copied the entire code above and place in the watcher panel.
Can you please tell me what I am doing wrong?
Thank you much in advance.
Sounds okay to me, can you run a mel trace? It should give you an error code, either that or put userok() around the add order code in the button and an error code should pop-up. This is what they mean, thats where I would start -
0: It worked
-1 : Invalid Order Type
-2 : Invalid order category
-3 : Invalid Description
-4 : Order obsolete
-5 : Invalid Diagnosis Code
-6 : Comments field too long
-7 : Invalid Priority
-8 : Invalid or obsolete authorizing provider
-9 : Invalid order date
-10: Invalid Modifier
-11: Additional information is required for this order
-12: Unequal number of diagnosis codes and diagnosis code
descriptions
-13: Invalid quantity or units
Thank you so much Michael. Here the couple of issues I found with the form.
1. There was an error call descri() function, so I changed it to descr().
… call DESCRI("LABIAL ADHESIONS (ICD-752.49), INFLUENZA NOS (ICD-478.1)")
ERROR: 32847 FUNCTION DEFINITION IS NOT EXECUTABLE
2. Then, I found out that I was using invalid code (-5 : Invalid Diagnosis Code), so I removed the problem.
execute>call MEL_ADD_ORDER("S", "E&M Services (99201-99499)", "OV, NEW PT, BRIEF", "", "ICD-752.49|ICD-478.1|ICD-242.90", "LABIAL ADHESIONS| INFLUENZA NOS| HYPERTHYROIDISM", "", "", "", "", "")
results>"-5"
results>return "-5"
Lesson learned:
1. If you get stuck with a form not doing what it suppose to, run MEL trace (Michael's tip).
2. Always make sure the function you are calling is spelled correctly.
The form now works correctly.
Thanks again Michael.
Help! With the 9.8 upgrade, this code does not work due to the 2 ICD codes being pushed....how do i fix this? Don't know where to start!
06/24/2014 11:43:09.201-execute> call MEL_ADD_ORDER("T", "LABS", "ELECTROCARDIOGRAM (ROUTINE ECG), COMPLETE", "", "ICD-424.1) (ICD10-I35.1", "AORTIC REGURGITATION", "test", "", "", "", "12/24/2014")
Nope it doesn't, use these -
/* Build diagnosis description string*/
{fn DxLabel(dx){
local rslt = ""
local prob = getfield(dx,",","")
local count
if size(prob)>8 then count = 8 else count = size(prob) endif
for DxLj = 1, DxLj <= count, DxLj = DxLj + 1 do
rslt = fnItemCombine("|",rslt,sub(prob[DxLj],1,match(prob[DxLj]," (ICD") - 1))
endfor
return rslt
}}
/* Build diagnosis code string*/
{fn DxCode(dx){
//CPS 11 and 12 Ready
local rslt = ""
local prob = getfield(dx,",","")
local count
if size(prob)>8 then count = 8 else count = size(prob) endif
for DxCj = 1, DxCj <= count, DxCj = DxCj + 1 do
rslt = fnItemCombine("|",rslt,sub(prob[DxCj],match(prob[DxCj],"ICD"),/**/match(sub(prob[DxCj],match(prob[DxCj],"ICD"),size(prob[DxCj])-match(prob[DxCj],"ICD") + 1),")") - 1))
endfor
return rslt
}}
Michael, what are you passing for your dx parameter?
A listbox that is populated by - {Diag_List_Box(PROB_AFTER("LIST"))}
/*Build problem list to choose from*/
{fn Diag_List_Box(firekey){
if PROB_AFTER("LIST") <> "" then
return str(getfield(PROB_AFTER("LIST"),"\n",";,\r"))
else "" endif
}}
Has anyone gotten this to work with ICD-10?
Changing the [ICounter[[3] to [4] does not work.
I thought maybe it would look at a seperate field, but i am not sure the ICD-10 code is in an individual field.