Does anyone have a form / function that sets a visibility field to true if the last time that order was entered was outside of the calendar year? I have a service order that needs to be completed once per year so I was thinking of using the orders_after() data symbol and creating a delimited list to pull out the date of the order, then run a match function for the year of that date as well as the year from str(._todaysdate). However, since I only need the most recent instance of a particular order, I think I need to use a while loop. I don't really know anything about how to do a while loop. Is there anyone that can help me out?
I have a similar piece for a pop up, maybe this will help:
{!fn PopUpDisplayDiabetesCDS() {
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[3] == "ICD-250.00" then
if rslt <> "" then
rslt = rslt + hret
endif
rslt = rslt + hold[3]
endif
endfor
return rslt
}}
{!fn HGBA1C(){
local date = ._TODAYSDATE
local avalue = LASTOBSDATE("HGBA1C")
cond
case avalue == ""
return ""
case val(ADDDATES(avalue,"","6","1"))>= date
return ""
else
return "DUE NOW"
endcond
}}
{!if PopUpDisplayDiabetesCDS() <> "" and HGBA1C() <> "" and document.stoppopup1 <> "true" then
userok("This patient has diabetes and hasn't had a HGBA1C in over 6 months")
document.stoppopup1 = "true"
else ""
endif}
For us when or lab interfaces in from orchard and the provider signs it the data goes to the respective obs.
Hi! If I were to code a visibility based on an obsterm being signed, (only want the box to appear if the obs hasn't been signed in 2017), how would I code that function?
Thnx a million
Haven't done one that way, but similar, so this will need some testing. I think this will achieve what your looking for.
{!fn pull_colon_last_signed_date(){
local avalue = LISTSUBSET(LAST_SIGNED_OBS_DATE("COLONOSCOPY"),"list","2017", "contains", "any")
return avalue
}}
Then your vis region:
pull_colon_last_signed_date() == ""
Let me know what you run into.