So currently I have a piece that populates a list box of the patient active diagnosis and order selections that uses MEL_ADD_ORDERS to add orders. I'm thinking there has got to be a way to use that same list box to remove orders by populating the first piece of MEL_REMOVE_PROBLEM syntax (ex. {MEL_REMOVE_PROBLEM(fnGetDxInfo3(), "", false, "Resolved")}
I have:
/*To get the Active Problem list*/
{!gProblemList = fnBuildProbList(PROB_AFTER("delimited"))}
{! gProblemList}
{! fn fnBuildProbList(strList)
{
local retStr = ""
local strTemp = ""
local strBuf = ""
local i
strTemp = getfield(strList,"|","")
for i = 1, i <= size(strTemp), i = i + 1 do
strTemp[i] = getfield(strTemp[i],"^","")
if strTemp[i][3] "" or strTemp[i][8] "" then
strBuf = ReplaceStr(strTemp[i][2],",",numtoascii(130))
if retStr "" then
retStr = retStr + "," + strBuf
else
retStr = strBuf
endif
else ""
endif
endfor
return retStr
}}
{! fn fnGetDxInfo(strSelDx,strType)
{
local retStr = ""
local strTemp = ""
local strBuf = ""
local i
local strArry = ""
local bufArry = ""
local bufStr = ""
strTemp = getfield(strSelDx,",","")
for i = 1, i <= size(strTemp), i = i + 1 do
if sub(strTemp[i],1,1) == " " then
strBuf = sub(strTemp[i],2)
else
strBuf = strTemp[i]
endif
strBuf = ReplaceStr(strBuf,numtoascii(130),",")
strArry = fnGetDxInfo2(strBuf)
if strArry "" then
bufArry = getfield(strArry,"^","")
if bufArry[2] "" then
cond
case strType == "Desc" bufStr = bufArry[1]
case strType == "ICD" bufStr = bufArry[2]
case strType == "PRID" bufStr = bufArry[9]
else bufStr = ""
endcond
else
bufStr = ""
endif
else
bufStr = ""
endif
if bufStr "" then
if retStr "" then
retStr = retStr + "|" + bufStr
else
retStr = bufStr
endif
else ""
endif
endfor
return retStr
}}
{! fn fnGetDxInfo2(strDx)
{
local retStr = ""
local strTemp = ""
local strBuf = ""
local i
local strList = ""
strList = PROB_AFTER("delimited")
strTemp = getfield(strList,"|","")
for i = 1, i <= size(strTemp), i = i + 1 do
strTemp[i] = getfield(strTemp[i],"^","")
if strDx == strTemp[i][2] then
retStr = strTemp[i][2] + "^" + strTemp[i][3]
break
else ""
endif
endfor
return retStr
}}
/*pull PRID for Remove Prob btn*/
{! fn fnGetDxInfo3(strSelDx)
{
local retStr = ""
local strTemp = ""
local strBuf = ""
local i
local strList = ""
strList = strSelDx
strTemp = getfield(strList,"|","")
for i = 1, i <= size(strTemp), i = i + 1 do
strTemp[i] = getfield(strTemp[i],"^","")
if strDx == strTemp[i][2] then
retStr = strTemp[i][9]
break
else ""
endif
endfor
return retStr
}}
fnGetDxInfo3 throws the error "ERROR: 32848 BAD VALUE OR BAD INDEX"
Posted : September 23, 2020 5:42 am