Hey everyone... New user back again.
I've been working on MEL_ADD_MEDICATION and have run into a brick wall.
The code I've written & the error code I get is as follows:
{MEL_ADD_MEDICATION('AMOXICILLIN 500 MG ORAL CAPSULE (AMOXICILLIN)','1 tab po bid x 10 days',str(._todaysdate),'658620017',20,0,'N')}
{MEL_ADD_MEDICATION('AMOXICILLIN 500 MG ORAL CAPSULE (AMOXICILLIN)','1 tab po bid x 10 days',str(._todaysdate),'658620017',20,0,'N') <-INVALID OPERATION OR BAD SYMBOL TYPE
I'm confused because here's an already-created example I found from an online resource, and it works perfectly:
{MEL_ADD_MEDICATION('Cipro 250 mg Tabs','Take one tablet by mouth every 12 hours for 3 days',str(._todaysdate), 4617,'',6,0,'N')}
The only difference I can see is that the example uses the DDID whereas mine uses the NDC (because I can't find the DDIDs easily...).
Any ideas? Anyone have a good online resource for the DDID (or is it even available online?)
As always, thanks in advance
Look closely at the code. You are missing the stop date parameter. In your example of one that works, it is blank but represented by two single quotes. Add that to your code and it should work fine.
Notes:
NDC is a poor choice for adding medications since most valid NDC numbers do not exist in the EMR's medication table. The DDID is the EMR's native value for medications followed by GPI. You did well by enclosing the NDC in quotes (the other two must be numerical - so no quotes for those), so any failure that follows most probably means that a valid DDID for the coded NDC was not found.
DDID numbers are subject to change when KB Updates are installed. As such, it is recommended that any hard coded reference to medications be closely monitored for changes (mostly active vs. inactive medication). A report can be created to provide the current list by referencing the MEDINFO table in the EMR.
Hope this helps.
You can find a DDID without a query too. If you go to Chart Reports -> Reports -> Medicalogic, there is a report for Medication DDID. Type in a medication in all caps and click preview and it will show all matching medications with the DDID.
I found the easiest way for me to find the DDID for medications was to add them to the med list of a practice patient and then use the following quicktext:
{fn fcn_find_ddid() {
local dlist=med_list_changes("delimited"), darr, i, o=""
if dlist<>"" then
darr=getfield(dlist,"|","")
for i=1, i<=size(darr), i=i+1 do
darr[i]=getfield(darr[i],"^","")
if darr[i][1]=="ADD" then
o=o+darr[i][2]+"\r\n\t"+darr[i][7]+"\r\n\r\n"
endif
endfor
endif
return o
}}{fcn_find_ddid()}
The way we are addressing finding when DDIDs used in forms and quicktext change is to create a medication custom list that contains all of the medications that are used in a form or quicktext with the instructions field noting where it is used. That makes it easy to run the report and know what needs to be fixed where after a change.