Okay mel guru's, I need some help. I have written a function that I need some help looping it and I have been banging my head on this for the last few days. Basically the function is being used to pull the problem, icd code and assessment in a visit for that day. It works great as long as you dont sign clinical list changes and then updated the assessment. If you do that, it puts a second, third, etc assessment in the note if the original assessment is modified. I only want it to pull the most recent assessment and I am just drawing a blank. Please take a look at it and let me know what you think.
{!fn fnGetProbChang2(strList)
{
local lCounter
local prob_counter = 0
local strProblemList
local nStart
local strBuf
local strFormattedList = ""
strProblemList = getfield(strList, "|", "")
for lCounter = 1, lCounter <= size(strProblemList), lCounter = lCounter + 1 do
strProblemList[lCounter] = getfield(strProblemList[lCounter], "^", "")
cond
case strProblemList[lCounter][1] == "ASSESS"
/* Needed to only pull Assessments*/
prob_counter = prob_counter + 1
strFormattedList = strFormattedList + str(prob_counter) + ") "
strBuf = strProblemList[lCounter][3] + " " + " (" + strProblemList[lCounter][17] + ") " + " - " + fnConvertProblemAssessTypeToString2(strProblemList[lCounter][9]) + " - " + strProblemList[lCounter][15] + HRET + HRET
case strProblemList[lCounter][1] <> "ASSESS"
strBuf = ""
else strBuf = ""
endcond
strBuf = ReplaceStr(strBuf, ",", "\, ")
if strBuf <> "" then strFormattedList = strFormattedList + strBuf endif
endfor
if (lCounter > 1) then
strFormattedList = remove(strFormattedList, size(strFormattedList))
endif
return strFormattedList
}}
It looks like strList is PROB_LIST_CHANGES, correct?
Look at argument 14, signed or unsigned. Add a check to see if you have added a signed value that also has a unsigned value in the list. From there, you can opt to add both with an identifier or simply use the unsigned one. This is about your only option since a time stamp is not available in the symbols data string.
That is correct and that is what I have been beating my head on. I hadnt thought about just using the unsigned assessment. I will work on it from that direction.
Thanks Lee
Okay, I must be pulling a total brain fart today. I got it where it would only show the unsigned but it is still incrementing the count up for each one instead of staying the same number. Basically this is only doing a translation out of the problems assessed and counts the number of assessements.
I have the old problem assessment form and I am looking at it to try and puzzle out how it will only show the last assessment. Hopefully I can pull it apart and figure it out.
I haven't tested this, but I suspect it should work. If not, hopefully you get the idea and can get it working without much effort.
{! fn fnGetProbAssessments(strList)
{
local retStr = ""
local strTemp = ""
local strBuf = ""
local strCk = ""
local nCount = 0
local i
strTemp = getfield(strList,"|","")
for i = 1, i <= size(strTemp), i = i + 1 do
strTemp[i] = getfield(strTemp[i],"^","")
if strTemp[i][1] == "ASSESS" then
if strTemp[i][14] == "Unsigned" then
strCk = "add"
else
strCk = fnCheckIfUnsignedExists(strTemp[i][3],strTemp[i][17],strList)
endif
if strCk == "add" then
nCount = nCount + 1
strBuf = str(nCount) + ") " + strTemp[i][3] + " (" + strTemp[i][17] + ")"
strBuf = strBuf + " – " + fnConvertProblemAssessTypeToString2(strTempi[9])
strBuf = strBuf + ” – ” + strTempi[15] + HRET + HRET
if retStr <> "" then
retStr = retStr + strBuf
else
retStr = strBuf
endif
else ""
endif
else ""
endif
endfor
return retStr
}
}
{! fn fnCheckIfUnsignedExists(strDx,strCode,strList)
{
local retStr = ""
local strTemp = ""
local strBuf = ""
strTemp = getfield(strList,"|","")
for i = 1, i <= size(strTemp), i = i + 1 do
strTemp[i] = getfield(strTemp[i],"^","")
if strDx == strTemp[i][3] and strCode == strTemp[i][17] then
if strTemp[i][14] == "Unsinged" then
strBuf = "skip"
break
else ""
endif
else ""
endif
endfor
if strBuf == "" then
retStr = "add"
else
retStr = "skip"
endif
return retStr
}
}