I was wondering if there is away to strip of the instructions on a medication list when setting up a Drop-down list using Dynamic choice list along with MEL Code
Mel Code:
{IF MEDS_AFTER("LIST") <> "" THEN str(getfield(MEDS_AFTER("LIST"),"\n",",\r")) ELSE "" ENDIF}
Example:
PULMICORT 0.25 MG/2ML SUSP (BUDESONIDE) 1 vial by nebulizer 2/day
I would like to remove "1 vial by nebulizer 2/day" so only the medication is listed.
Theresa
Theresa
An option would be to use the delimited version and parse out the med names to construct the list:
{fn GetMeds(){
local lMedArr,lCount,lResult
lResult = ""
/* Create array of meds */
lMedArr = getfield(MEDS_AFTER("delimited"),"|","")
for lCount=1, lCount <= size(lMedArr), lCount = lCount + 1 do
/* Create an array for each med */
lMedArr[lCount] = getfield(lMedArr[lCount],"^","")
/* Create result */
if lResult == "" then
lResult = lMedArr[lCount][1] + cfmt(lMedArr[lCount][2],""," (","",")")
else
lResult = lResult + "," + lMedArr[lCount][1] + cfmt(lMedArr[lCount][2],""," (","",")")
endif
endfor
return lResult
}}
THIS WORKED THANK YOU!!!
So I am trying to get a data display to show all innactive medications with date removed, dose/instructions, qty and refills. The data symbol MEDS_REMOVED only shows removed meds from the current update not previous... how can I get this to work??
Thank you!
MEDS_AFTER should give you what you need use Delimited list
I have tried that but I need the inactive meds only....
I dont think it is possible using the data symbols. You would have to come up with some way to directly query the database to pull that information in.
I checked the HELP in the EMR for MEDS_AFTER and if you use "dat"
SYNTAX: MEDS_AFTER(list_type, dat)
MEDS_AFTER("delimited","dat") it should pull in the date the med was removed
This EMR from help:
dat: The date the medicated is removed from the patient's medication list in the format mm/dd/yyyy.
treesavage63 said:
I checked the HELP in the EMR for MEDS_AFTER and if you use "dat"
SYNTAX: MEDS_AFTER(list_type, dat)
MEDS_AFTER("delimited","dat") it should pull in the date the med was removed
This EMR from help:
dat: The date the medicated is removed from the patient's medication list in the format mm/dd/yyyy.
The MEDS_AFTER will only show the date that the medication will be removed automatically if an enddate is put in when prescribing the medications. It will not show already inactive medications.
Right. I am trying to write a function in order to accomplish this as I do not want the full meds list only inactive meds. Meds_after will not accomplish this. I was hoping someone may have a function already to pull this...
Thank you for your considerations!
David Nelsen MD shared this function with me some time ago. It wasn't complete at the time and I had started to make some modifications but set it aside for other priorities. Perhaps he will respond if he has worked on it further or has completed it, but here it is if you want to try it out. I remember there was an issue I found with the stop date - one is always added behind the scenes as 12/31/4700! so i modified the loop condition to ignore those. Other than that I think it was working, but as I said I didn't finish revising and haven't actually used. The intention was to be able to restart these meds easily, but you could use it to display them, or whatever.
Regards,
Paul
/*_MasterMed is in mldefs and erx in mldefs 8*/
{fn get_dn_expired_or_stopped_meds()
{
local a,c
local i = getRowCount('_MasterMed')
// Loop thru patients meds
while i > 0 do
i = i-1
a = getRow('_MasterMed',i,'Description','Instructions','GenericMed','NDCLabProd','NDCPackage','StopDate')
if a[6] <> "" and match(a[6], "4700") == 0 then c=c+"|" + a[3] + "^" + a[1] + "^" + esc_comma(a[2]) + "^" + a[4] + "^" + a[5] +"^" + "Stop date: " + a[6] else "" endif
endwhile
if c=="" then return "None entered" else "" endif
local result=sort(getfield(c,"|",""))
local arr_size=size(result)
for a=1, a<arr_size, a=a+1
do
if result[a]==result[a+1] then remove(result,a+1) arr_size=arr_size-1 else "" endif
endfor
dn_expired_or_stopped_meds=str(result)
return ""
}}
Sorry, you'll need this fn too, since the first one calls it. Also, if using a data display just call the variable that is assigned the result at the end of the fn previously posted: dn_expired_or_stopped_meds
{fn esc_comma(_string){
local a, b, result=_string, counter=0
if match(_string,",")==0 then return _string else "" endif
while match(_string,",")>0
do
a=match(_string,",")
_string=remove(_string,a,1)
b=a + counter
result=insert(result,b,numtoascii(92))
counter=counter+2
endwhile
return result
}}
Thanks! I have added these to the form and called the function name for the datadisplay but it does not seem to be working.... I will keep playing..
Thank you!!!