I am new to MEL and am working on customizing a history view where the providers would like a function put in to determine if a patient is pre-diabetic or diabetic and if they are it would pull in LASTOBSVALUEDATE for certain things like A1C, foot exam, ect.
I am able to pull the full problem list by using
{
global prbl = getfield(PROB_AFTER("list"),"\r","")
global probsize = size(prbl)
global probicd = "" for cnt = 1, cnt < probsize, cnt = cnt + 1
do icddlm =match(prbl[cnt],"(")
if icddlm > 0 then
prb_d = sub(prbl[cnt],1,icddlm - 2)
probicd = probicd + prb_d
endif
endfor
probicd
}
But I have not been able to modify or come up with another function that can do this if it is even possible. I've had some help from some of the programmers in the office but this is even stumping them.
Any help would be appreciated.
I would be delighted to help you. Contact me via e-mail so I can better understand your issue, then we can design and implement a solution.
So I use the following piece to pull a problem and give me a value. Just adjust the ICD10 accordingly (I bolded it below). You'll probably need to swap the locals to globals for the history view. You use "or" if you wanted to look through multiple diagnosis.
{!fn PullColonProbs() {
local temp = getfield(PROB_PRIOR("delimited"), "|", "")
local hold
local rslt =""
for i=1, i<=size(temp),i=i+1 do
hold = getfield(temp[i],"^","")
if hold[8] == "ICD10-D36.9" then
if rslt <> "" then
rslt = rslt + hret
endif
rslt = rslt + hold[8]
endif
endfor
return rslt
}}
Hope this could point you in the right direction
Here is another example using ICD 9:
{!fn PopUpDisplayDiabetesCDS() {
local temp = getfield(PROB_PRIOR("delimited"), "|", "")
local hold
local rslt =""
for i=1, i<=size(temp),i=i+1 do
hold = getfield(temp[i],"^","")
if hold[3] == "ICD-250.00" or hold[3] == "ICD-648.80" or hold[3] == "ICD-250.20" then
if rslt <> "" then
rslt = rslt + hret
endif
rslt = rslt + hold[3]
endif
endfor
return rslt
}}
If you need to change the parameters of the field you look in the hold piece controls that. So if you add the diabetes you need into a test patient chart and do {PROB_AFTER("delimited")} you'll get:
Dx of^DIABETES MELLITUS^ICD-250.00^^05/16/2014^^^ICD10-E11.9^1716288954014860.000000^12/04/2015^1764856100714520.000000
Dx 0f (field 1)
DIABETES MELLITUS (field 2)
ICD-250.00 (field 3)
and so on.