Hi, everyone!
I have been asked to create a popup message that will trigger if the patient has not had a Flu shot documented in their chart in the last 120 days. (this is to help us meet the Computer Decision Support measure for MU)
I have done something similar with Allergies: it's just a text component with some simple code (if no documented allergies, then userok enter some). When the text component is added to the encounter, it will trigger the popup message if the condition is met, and doesn't do anything if not. Easy peasy.
But here's my trouble: it seems that Text components don't like more complex code. If I copy the following code into a button on a VFE form it works without a problem. When I try to use it in a text component, however, I get an error:
{IF (DURATIONDAYS(str(LASTOBSDATE("CVX141B" <-COMPILER ERROR NEARBY: Expect COMMA OR RIGHT PARENTHESIS. Instead had STRING after IDENTIFIER
A MEL trace doesn't show anything.
Does anyone have any advice?
Here's the code:
{IF (DURATIONDAYS(str(LASTOBSDATE("CVX141B")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("CVX141A")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("CVX140B")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("CVX140A")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("FLUMIST")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("TIV_HIGHDOSE")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("CVX144B")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("H1N1 VAX")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("FLU VAX")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("FLU VAX#1")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("FLU VAX #2")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("FLU VAX #3")),str(._TODAYSDATE)) <= 120) then USEROK("There is no FLU shot documented for this patient during the past 120 days.")
else ""
ENDIF}
Thanks in advance for any help you can offer!
Jennifer Gardner
More information:
This code seems to also work fine in a quicktext. Does anyone know a trick to call a quicktext from a Text component, or otherwise program it into an encounter so that it does not require any user interaction?
If you want to go the encounter form route, I would use something like this
{!global form_open}
{!if form_open == "" then
Run_Flu_Check()
form_open = "TRUE"
endif}
!fn Run_Flu_Check(){IF (DURATIONDAYS(str(LASTOBSDATE("CVX141B")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("CVX141A")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("CVX140B")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("CVX140A")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("FLUMIST")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("TIV_HIGHDOSE")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("CVX144B")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("H1N1 VAX")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("FLU VAX")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("FLU VAX#1")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("FLU VAX #2")),str(._TODAYSDATE)) <= 120) OR (DURATIONDAYS(str(LASTOBSDATE("FLU VAX #3")),str(._TODAYSDATE)) <= 120) then USEROK("There is no FLU shot documented for this patient during the past 120 days.")
else ""
ENDIF}
The popup should happen when you open the form everytime you open the form, if you just want it to popup once when the form is first opened you can just change the global variable to a document variable.
I'd like to avoid using a form as a trigger. Using a text component, the popup is triggered simply by opening the encounter. I'll go that route if a have to, but that complicates things for us a bit.
we use the following text component for pneumovax, but you could change for flu:
{/* DO NOT SEPARATE CONDITIONS ONTO SEPARATE LINES */}
{global gblSignInName = ""}
{'{if gblSignInName<>USER.FULLNAME then
gblSignInName = USER.FULLNAME
if PATIENT_AGE()<=64 then
""
else
if MATCH("LOC1, LOC2, etc", 1, DOCUMENT.LOCOFCARENAME)==0 then
""
else
if OBSANY("RSNPNEUNTGN")=="contraindicated" then
""
else
if OBSANY("PNEUMOVAX")=="" and OBSANY("PNEUMO2TRNM")=="" then
USEROK("Evaluate need for pneumovax immunization.")
else
if LASTOBSDATE("PNEUMOVAX")<>"" and LASTOBSDATE("PNEUMO2TRNM")<>"" then
if DURATIONDAYS(LASTOBSDATE("PNEUMOVAX"), LASTOBSDATE("PNEUMO2TRNM"))>0 then
if DURATIONDAYS(ADDDATES(STR(PATIENT.DATEOFBIRTH), "65", "0", "0"), LASTOBSDATE("PNEUMO2TRNM"))>0 then
""
else
if DURATIONDAYS(LASTOBSDATE("PNEUMO2TRNM"), STR(._TODAYSDATE))=>1825 then
USEROK("Evaluate need for pneumovax immunization.")
else
""
endif
endif
else
if DURATIONDAYS(ADDDATES(STR(PATIENT.DATEOFBIRTH), "65", "0", "0"), LASTOBSDATE("PNEUMOVAX"))>0 then
""
else
if DURATIONDAYS(LASTOBSDATE("PNEUMOVAX"), STR(._TODAYSDATE))=>1825 then
USEROK("Evaluate need for pneumovax immunization.")
else
""
endif
endif
endif
else
if LASTOBSDATE("PNEUMO2TRNM")<>"" then
if DURATIONDAYS(ADDDATES(STR(PATIENT.DATEOFBIRTH), "65", "0", "0"), LASTOBSDATE("PNEUMO2TRNM"))>0 then
""
else
if DURATIONDAYS(LASTOBSDATE("PNEUMO2TRNM"), STR(._TODAYSDATE))=>1825 then
USEROK("Evaluate need for pneumovax immunization.")
else
""
endif
endif
else
if DURATIONDAYS(ADDDATES(STR(PATIENT.DATEOFBIRTH), "65", "0", "0"), LASTOBSDATE("PNEUMOVAX"))>0 then
""
else
if DURATIONDAYS(LASTOBSDATE("PNEUMOVAX"), STR(._TODAYSDATE))=>1825 then
USEROK("Evaluate need for pneumovax immunization.")
else
""
endif
endif
endif
endif
endif
endif
endif
endif
endif
""}'}
Thanks, jjordet!
I re-coded this, and it will work in a text component now (wow, those text components are finicky!!) Here's what I have now, in case any one else is interested in giving this a try. (if you include this text component in a document template, it will be launched when the encounter is opened)
{
if OBSANY("FLU VAX")=="" AND OBSANY("CVX141BAD")=="" AND OBSANY("CVX141AAD")=="" AND OBSANY("CVX140BAD")=="" AND OBSANY("CVX140AAD")=="" AND OBSANY("FLUMISTAD")=="" AND OBSANY("TIV_HD_AD")== "" AND OBSANY("CVX144BAD")=="" AND OBSANY("H1N1VAXDATE")=="" AND OBSANY("FLU VAX#1")=="" AND OBSANY("FLU VAX #2")=="" AND OBSANY("FLU VAX #3")== "" AND OBSANY("FLU VAXAD")=="" then
USEROK("FLU - No vaccine recorded since Aug 2013." + HRET + "Offer today or document if given elsewhere or refused.")
" "
else
if DURATIONDAYS(LASTOBSDATE("FLU VAX"), STR(._TODAYSDATE))>180 OR DURATIONDAYS(LASTOBSDATE("FLU VAXAD"), STR(._TODAYSDATE))>180 OR DURATIONDAYS(LASTOBSDATE("CVX141BAD"), STR(._TODAYSDATE))>180 OR DURATIONDAYS(LASTOBSDATE("CVX141AAD"), STR(._TODAYSDATE))>180 OR DURATIONDAYS(LASTOBSDATE("CVX140BAD"), STR(._TODAYSDATE))>180 OR DURATIONDAYS(LASTOBSDATE("CVX140AAD"), STR(._TODAYSDATE))>180 OR DURATIONDAYS(LASTOBSDATE("FLUMISTAD"), STR(._TODAYSDATE))>180 OR DURATIONDAYS(LASTOBSDATE("TIV_HD_AD"), STR(._TODAYSDATE))>180 OR DURATIONDAYS(LASTOBSDATE("CVX144BAD"), STR(._TODAYSDATE))>180 OR DURATIONDAYS(LASTOBSDATE("H1N1VAXDATE"), STR(._TODAYSDATE))>180 OR DURATIONDAYS(LASTOBSDATE("FLU VAX#1"), STR(._TODAYSDATE))>180 OR DURATIONDAYS(LASTOBSDATE("FLU VAX #2"), STR(._TODAYSDATE))>180 OR DURATIONDAYS(LASTOBSDATE("FLU VAX #3"), STR(._TODAYSDATE))>180 then
USEROK("FLU - No vaccine recorded since Aug 2013." + HRET + "Offer today or document if given elsewhere or refused.")
" "
else
""
endif
endif}
(edited to reflect some slight changes to the code)