Hello,
I have created our own CPOE form that allows the clinician to assess 6 problems per page. I have a pop up showing when the clinician has chosen the same problem more than once ("* You have selected a problem more than once for evaluation."+hret+hret+"* Remove the duplicate problem before addressing the next diagnosis!")
I would like to remove the problem from the drop down so the clinician does not have the opportunity to pick the same problem 2 times. Following is the code I am using for the drop down. Does anyone have any ideas?
Thanks in advance,
Carolyn
{
!fn fnProbDropdown(strList)
{
local strProblemList
local strNewProblemlist
local nStart
local strBuf
local strFormattedList = ""
strProblemList = getfield(strList, "|", "")
for i = 1, i <= size(strProblemList), i = i + 1 do
strProblemList[i] = getfield(strProblemList[i], "^", "")
strFormattedList = strFormattedList + fnConvertProblemTypeToString(strProblemList[i][1], FALSE)
strBuf = strProblemList[i][2]
strBuf = ReplaceStr(strBuf, ",", "\,")+" "+"("+strProblemList[i][3]+")"+" " +"("+strProblemList[i][8]+")"
strFormattedList = strFormattedList + strBuf + ","
endfor
if (i > 1) then
strFormattedList = remove(strFormattedList, size(strFormattedList))
endif
return strFormattedList
}
}
Try this (untested, but should work):
Define and create a global variable to hold the already selected problems.
{!
//Replace the DOCUMENT.XXX with the actual variable names of the problem drop down fields.
gSelectedProblems = str(DOCUMENT.PROB1,DOCUMENT.PROB2,...)
}
{! gSelectedProblems}
Update your function calls to:
fnProbDropdown(PROB_AFTER("delimited"),gSelectedProblems)
Change the function definition to:
{! fn fnProbDropdown(strList,strUsedProbs)
{
local strProblemList
local strNewProblemlist
local nStart
local strBuf
local strFormattedList = “”
strProblemList = getfield(strList, “|”, “”)
for i = 1, i <= size(strProblemList), i = i + 1 do
strProblemList[i] = getfield(strProblemList[i], “^”, “”)
strFormattedList = strFormattedList + fnConvertProblemTypeToString(strProblemList[i][1], FALSE)
strBuf = strProblemList[i][2]
strBuf = ReplaceStr(strBuf, “,”, “\,”)+” “+”(“+strProblemList[i][3]+”)”+” ” +”(“+strProblemList[i][8]+”)”
if match(strUsedProbs,strBuf) > 0 then
continue
else ""
endif
strFormattedList = strFormattedList + strBuf + “,”
endfor
if (i > 1) then
strFormattedList = remove(strFormattedList, size(strFormattedList))
endif
return strFormattedList
}
}
That worked Lee. Thank you!
I needed to edit this because it works after the visit is put on hold and when it is taken off of hold, the assessed problem is not in the list.