Does anyone know how I could possibly use some MEL symbols to pull a list of orders placed in any status by CPT range.
For example, the provider wants all their previous Flex Sig procedures to be listed either in a history view, or pulled into the chart note via a quick text. So the Flex sig could have a range of CPT's that we would like to pull.
Any easy ideas?
Thanks!!
The following could probably be simplified; it started as something different, but then became a lookup with three matching values. I use it to print out recent (within 7 days; RD variable) if any of three (RM1,RM2,Rm3) text values as description are present.
This is in a Letter, but the logic should be possible with a quicktext.
(By the way, while I check Row[1] I think you would check Row[3] for CPT codes.)
{!fn FindOrderTest() {
local FindX
local Cnt
local Row
local OL
local OA
local Osz
local RM1
local RM2
local RM3
local RD
FindX =""
OL = ORDERS_ALL('DELIMITED','T')
OA = getfield(OL,"|","")
Osz = size(OA)
for Cnt=1, Cnt<=Osz, Cnt=Cnt+1 do
Row = getfield(OA[Cnt],"^","")
RM1 = match(Row[1],"Colonoscopy")
RM2 = match(Row[1],"Sigmoidoscopy")
RM3 = match(Row[1],"EGD")
RD = val(DURATIONDAYS(str(._TODAYSDATE),ROW[4]))
If ((RM1+RM2+RM3)>0) and (RD>-7)
then FindX = FindX + str(Row[4] + " " + Row[1]+" ["+ROW[3] + "] for " + ROW[26] + " signed by " + ROW[21] + HRET + ROW[8] + HRET + HRET)
Else ""
Endif
Endfor
If FindX = ""
Then FindX = "None"
Else ""
Endif
Return FindX
}}
and then inside the letter, I call the function to print out results:
{FindOrderTest()}