I think I can help get you started.
The first thing you'll need to figure out is how you will get this pop-up to only happen (and maybe also limit how many times it happens) while they are doing the assessment and plan part of the note. You're going to need some sort trigger to let your code know to run the diabetes ace/arb check.
As for the actual code to check if the Diabetic patient is on an ace or arb, I have this coded out already, but it is in a different format than what you are trying to accomplish:
This code can be used to find active meds for a patient based on a GPI #. Med_class is the GPI # and num is the number of characters to use for your comparisons (you could actually just use size(med_class)). It returns a string of all the medications that match the GPI you sent separated by HRET:
{!fn GetMedsByClass(med_class, num)
{
local meds = ""
local meds_array = getfield(MEDS_AFTER("delimited"), "|", "")
for i = 1, i <= size(meds_array), i = i + 1
do
local med_array = getfield(meds_array[i], "^", "")
if (ok(med_array[4])) then
if (med_array[4] <> "") then
if (sub(med_array[4], 1, num) == med_class) then
meds = meds + med_array[1] + HRET
else
continue
endif
else
continue
endif
else
continue
endif
endfor
return meds
}}
GetMedsByClass will be called through this next function to see if this patient is on an ACE/ARB. The parameter changes is used to see if there have been changes to the meds list since the last time it ran. This is so if you are using it in the background, it only runs once there have been changes to the patient's medications list. It returns TRUE if an ACE/ARB was found or FALSE if not:
{!fn NeedsAceArb(changes)
{
if ((changes <> DOCUMENT.ACE_ARB_CHECK OR did_acearb <> "T") AND IsDiab()) then
DOCUMENT.ACE_ARB_CHECK = changes
did_acearb = "T"
local ace = GetMedsByClass("3610", 4)
+ GetMedsByClass("36991802", 8)
+ GetMedsByClass("36991502", 8)
local arb = GetMedsByClass("3615", 4)
+ GetMedsByClass("36993002", 8)
+ GetMedsByClass("36994503", 8)
+ GetMedsByClass("36994002", 8)
if arb <> "" AND ace <> "" then
return FALSE
else
return TRUE
endif
}}
This is used to check to see if patient has diabetes in the active problem list:
{fn IsDiab()
{
return match(PROB_AFTER("List"), "250") > 0
}}
This will need to be initialized for storing the last medication's list to see if it has been update. The global variable is so it runs at the beginning of the creation of the document:
{DOCUMENT.ACE_ARB_CHECK}
{global did_acearb}
So, with all of this code in your coding window, you should be able to call NeedsAceArb(MED_LIST_CHANGES()) somewhere in your form. It will give you TRUE or FALSE for what you need. Manipulate any of the code here to do whatever you need it to.
Posted : August 27, 2014 5:32 am