What MEL function is available to retrieve completed orders on a patient? I wish to retrieve orders for a specific CPT code.
description Lists orders entered during the current or specified update, indicating each order’s status. type Data symbol function syntax ORDER_LIST_CHANGES arguments N/A when to evaluate Set evaluation to Continuously to include changes to the list made after the symbol is inserted in the note. returns List of orders and their status with a blank line between orders comment This data symbol function provides a listing of changes made during the current update. This symbol returns information for only the last order given. example {'{ORDER_LIST_CHANGES()}'} Sample return showing several orders in an update, some of which have already been signed. Added new Test order of CBC with Differential (CPT-85025) – signed Added new Referral order of EEG Evaluation (CPT-95950) – signed Added new Service order of Ofc Vst, Est Level II (CPT-99212) where used Chart: text components, chart notes, and quick text Encounter Form Editor: Data Display items with a Clinical Function connection and MEL expressions |
I want to determine the authorizing provider of a completed order. None of the Order functions are able to access completed orders: Orders_After(), Orders_Prior(), etc. I would like to know if there is an object in the mldefs*.txt that I can access via the find() symbol.
I was just trying to do something similar – get a list of completed referrals. ORDERS_ALL seems to return all orders including completed and canceled. Something like this might work for the question in your original post (did not test for errors)
fn FindCompletedOrders(cptCode){
local orders = ""
local ordersDelim = getfield(ORDERS_ALL("delimited"), "|","")
local ordersDelimSize = size(ordersDelim)
for i = 1, i <= ordersDelimSize, i = i + 1 do
ordersDelim[i] = getfield(ordersDelim[i],"^","")
if ordersDelim[i][3] == cptCode and ordersDelim[i][20] == "C" then
if orders <> "" then
orders = orders + HRET
endif
orders = orders + ordersDelim[i]
endif
endfor
return orders
}
(actually, after looking at that, I'm not sure if its legal to do something like "orders = orders + ordersDelim[i]" after ordersDelim was made into an array… I'm still new to MEL, lol)
The key thing is to check the status, here's the codes from the database docs:
U Unsigned
H Administrative hold; the order has been signed, but not sent to the service provider.
S In process; the order has been signed and sent to the service provider.
C Complete; the order has been processed and any requested results have been received.
X Canceled; the order was canceled after being signed.
This is exactly the help I was looking for. Orders_All is not listed in the data symbols help file for CPS 9.5. Do you have a description of the function. Would help to have the order of the elements but not critical. Fantastic work.
Probably the same as the others besides that it returns all
ORDERS_ALL
description Returns a list of all orders for a patient. Active orders do not include those with a status of Complete. That means that some orders created type Data symbol function syntax ORDERS_ALL(listtype,order type) arguments
|
You were correct in your concern about orders=orders+ordersDelim[i], doesn't work. Here is the code that I wrote (formatting stripped out unfortunately):
/*Retrieve all orders for a given CPT-4, return authorizing provider, order description, date of order*/
{! fn getAuthProv(strCPT)
{
local strOrders=""
local i=1
local OrdersArray=getfield(Orders_All("delimited"),"|","")
local OrdersSize=size(OrdersArray)
if OrdersSize>0 then
for i=1,i<=OrdersSize,i=i+1
do
OrdersArray[i]=getfield(OrdersArray[i],"^","")
if OrdersArray[i][3]==strCPT then
if strOrders<>"" then
strOrders=strOrders+HRET
endif
strOrders=strOrders+OrdersArray[i][21]+": "+OrdersArray[i][1]+" "+OrdersArray[i][4]
endif
endfor
endif
return strOrders
}
}
I am trying to generate a dynamic choice list for a listbox that will populate only the current orders and its CPT Code and then have it make the next selection on the list.
So far I have had very little luck.
This is the current MEL Expressoin I am trying to use.
{ If ORDERS_AFTER("list")<>"" then str(getfield(ORDERS_AFTER("lists"),"]","\r")) else "" endif}
Any help is appreciated.
You have and extra "s",
{ If ORDERS_AFTER("list")<>"" then str(getfield(ORDERS_AFTER("lists"),"]","\r")) else "" endif}
but even so, this isn't quite what you need. The goal is to return a comma-delimited list of orders because your listbox expects a comma in order to start the new item in the list. The simplest way is to use orders_after("comma") instead of "list" so you'll get the delimited the listbox expects. That may return more info than you really need in the list, in which case you could use the delimited version and write a function to select the elements you need, but start with "comma" and see how that goes. Just assign your dynamic list to: {orders_after("comma")} you don't need the conditional statement.
Thanks for your suggestion
When I do this instead of getting a check box:
CT Scan brain w/o Contrast [CPT-70450]
I get a check box for each:
CT Scan
brain
w/o Contrast [CPT-70450]
Any help is appreciated.