Hope you can find some nuggets in there. I'll post it here, my favorite piece and most versatile code I use and variants littered through most of my forms:
{!fn fnDisplayImmunHx() {
local hold = getfield(IMMUN_GETLIST("", "last"), "|", "")
local temp
local rslt = ""
for i = 1, i <= size(hold), i = i + 1 do
temp = getfield(hold[i], "^", "")
if (rslt <> "") then
rslt = rslt
endif
rslt = rslt + temp[3] + " Vaccine" + " - " + temp[30] + if temp[18] <> "" then " - " else "" endif + temp[18] + " " + temp [19] + " - " + if temp[7] == "Y" then "was given" else if temp[7] == "N" then "declined" else if temp[7] == "U" then "Undetermined" else "" endif endif endif + if temp[8] <> "" then " - " else "" endif + temp[8] + "
"
endfor
return rslt
}}
Swapping the:
local hold = getfield(IMMUN_GETLIST("", "last"), "|", "")
Will allow you to grab just about anything, for example we have pop ups that fire if they meet certain criteria:
{!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" or hold[8] == "ICD10-D12.6" or hold[8] == "ICD10-K57.32" or hold[8] == "ICD10-K57.92" then
if rslt <> "" then
rslt = rslt + hret
endif
rslt = rslt + hold[8]
endif
endfor
return rslt
}}
{!if colon_5_pop_up() <> "" and pull_colon_normal() <> "" and colon_pop_up() == "" and PullColonProbs() == "" and document.stoppopup7 <> "true" then
userok("Reminder for:
FIT occult due.
")
document.stoppopup7 = "true"
else ""
endif}
If used in handouts use global:
{fn PullNep(){
global temp = getfield(PROB_PRIOR("delimited"), "|", "")
global hold
global nephro =""
for i=1, i<=size(temp),i=i+1 do
hold = getfield(temp[i],"^","")
if hold[8] == "ICD10-N28.9" then
if nephro <> "" then
nephro = nephro + hret
endif
nephro = nephro + hold[8]
endif
endfor
return nephro}}
Using {MEDS_AFTER("delimited")} and commands like it, you get the raw data as I call it, allowing you to grab any field off a clinical list item. Like the PullNep function above I added the diagnosis to a test chart used a quicktext of {PROB_AFTER("delimited")} to show me what field the ICD code was in, there's probably a easy way to do this but it works for me. Once you are able to pull whatever you need you can plug the fn into other pieces and evaluate all kinds of things with multiple other functions.
Posted : June 28, 2016 7:35 am