Need a pop up when a new patient E&M code is used, but the patient has been seen within 3 years. I can use the MATCH() for the CPT code, but not sure how to write for the 3 years. Maybe with DURATIONDAYS and APPT_PRIOR?
I think you are on the right track. We aren't fans of APPT_PRIOR() because it will show last appointment regardless of status. We base our last appointment date off of the last time the obs term "Chief Cmplnt" is completed. We know that that term should be completed at every office visit. Every now and then it is not, but we find it to be a better solution. I would look and see if you have a similar obs term that is always completed. Then you could do something like this:
{
if (DURATIONDAYS(LAST_SIGNED_OBS_DATE("Chief Cmplnt"), sub(str(DOCUMENT.CLINICALDATE),1,10)) <= 1095 ) then
userok("Patient has been seen in the past 3 years.")
else
""
endif
}
You can use APPT_PRIOR() if that's what you prefer, in something like the above. According to the help file APPT_PRIOR() returns:
01/12/2001,10:30 am,Asthma Visit,SOUTH,Castro,
You just need to make sure it capture the date portion only of what it returns and convert it to a string.
That was exactly what I needed. Thanks for your time.
Glad I could help.
Brad