In our patient banner, I use my old one that I had put in the the usrlib.txt file:
{SMRMC_APPT_ALL_FUTURE()}
this works as it should now that the mellib.txt file is fixed. I pasted it below. My hospital is SMRMC so you could change that part on yours.
//APPT (ALL FUTURE) FUNCTION
fn SMRMC_APPT_ALL_FUTURE() {
//lists all future appts with a comma between fields a hret between records
//use nested getfields to turn in to a 2D array if you want to pick elements
//DN--3-31-04 modified from mellib stock function
local a, b,c, loc, atype, book, i = 0
local result=''
local j = getRowCount('_MELCurPatientAppt')
// Loop thru patients appointments
if j == 1 then a = getRow('_MELCurPatientAppt',0, 'ApptDate',
'ApptTime','Appttype','Booklist','ApptStatus')
// Find the next appointmnet
if val(a[1]) >= ._TODAYSDATE and val(a[5]) = 0 then
// Get the type of appointment
atype = find('_MELApptDef', 'ApptType', 'ID', a[3])
// Get the location of care from the first book
b = getfield(a[4],',',' :')
loc = find('_MELBook', 'LocationAbbrevName', 'ID',b[1])
//Get the Book Name
c = getfield(a[4],',',' :')
book = find('_MELBook', 'Name', 'ID',c[1])
// Build the result
result = a[1] + ',' + appttime(a[2]) + ',' + atype + ',' + book
//edit previous line if you want to return only part or use different
delimiters etc
//note this first part is if theres only 1 appointment
endif
else if j > 1 then
while i < j do
i = i+1
a = getRow('_MELCurPatientAppt',i,
'ApptDate','ApptTime','Appttype','Booklist','ApptStatus')
// Find the next appointmnet
if val(a[1]) >= ._TODAYSDATE and val(a[5]) = 0 then
// Get the type of appointment
atype = find('_MELApptDef', 'ApptType', 'ID', a[3])
// Get the location of care from the first book
b = getfield(a[4],',',' :')
loc = find('_MELBook', 'LocationAbbrevName', 'ID',b[1])
//Get the Book Name
c = getfield(a[4],',',' :')
book = find('_MELBook', 'Name', 'ID',c[1])
// Build the result
if result=="" then
result = result + a[1] + ',' + appttime(a[2]) + ',' +
atype + ',' + book else result = result + hret + a[1] + ',' + appttime(a[2])
+ ',' + atype + ',' + book endif
//edit previous line if you want to return only part or use different
delimiters etc
//this part there are 2 or more appointments or rows
endif
endwhile
endif
endif
result
}
Posted : July 2, 2012 3:23 am