I would like to create a button or data display in VFE that tells the INR nurse if a patient is on Heparin. How do I go about doing something like that?
Lots of ways to do this...one idea is to have the data display call a function: heparinCheck(MEDS_AFTER("delimited"))
fn heparinCheck(meds)
{
local retStr = "NO HEPARIN"
if meds <> "" then
if match(meds, 1, "HEPARIN") > 0 then
retStr = "HEPARIN ON MED LIST"
endif
endif
return retStr
}
The other approach is to pick it up by GPI Code Class, I think you would want GPI starting with "831000". It would return "" if they are NOT on a Heparin. This approach requires the meds to be coded, but would still account for the drug if it released under a different name.
{fn GetMedsByClass(med_class, update){
local rets = ""
local meds_array = getfield(MEDS_AFTER("delimited"), "|", "")
local med_array
for i = 1, i <= size(meds_array), i = i + 1 do
med_array = getfield(meds_array[i], "^", "")
if (ok(med_array[4])) then
if (med_array[4] "") then
if match(med_array[4],med_class) == 1 then
rets = rets + med_array[1] + HRET
endif
endif
endif
endfor
return rets
}}
{GetMedsByClass("831000",meds_after())}