We would like the data symbol for {APPT_NEXT()} to display the book name instead of the name of the person who booked the appointment.
Stacey LaGrange
Software Developer/Analyst
St. Mary's Health System
[email protected]
(207) 777-8410
We upgraded to EMR 9.5 over the weekend and now that data symbol shows the Location of Care of the appt. along with who made the appt. It used to show the appt. book name.
This shows appts for all users, or just the current user, (mine) and all future appts, or just the next appt, (next). arg is either 'list' or 'delimited' format.
{fn ListFutureAppointments(arg, mine, next)
{
local rec_delim = ""
local field_delim = ""
local count
local appt = array()
local atype
local book = array()
local bookcount
local loc
local username
local i = 0
local j
local status
local result = ""
if arg=="delim" then
rec_delim = "|"
field_delim = "^"
else
rec_delim = hret
field_delim = ", "
endif
count = GETROWCOUNT("_MELCurPatientAppt") // _MEL???? are global variables from mellib.txt
// Loop thru patients appointments and stop after first for current user
while i<count
and (next<>"next"
or (result==""
and next=="next")) do
appt = GETROW("_MELCurPatientAppt", i, "ApptDate", "ApptTime", "Appttype", "Booklist", "ApptStatus")
// Check for future appointment
if VAL(appt[1])>=._TODAYSDATE then
// Is appointment still scheduled
if VAL(appt[5])==0 then
// Get the type of appointment ... ApptType from _MELApptDef where ID = appt[3]
atype = FIND("_MELApptDef", "ApptType", "ID", appt[3])
// Get the books associated with appointment
book = GETFIELD(appt[4], ":", "")
bookcount = SIZE(book)
// Loop thru books
j = 2
while j<bookcount do
// Get the location of care from the each book
loc = FIND("_MELBook", "LOCID", "ID", book[j])
loc = FIND("_MELLoc", "Name", "LOCID", loc)
// Get the user name from the each book
username = FIND("_MELBook", "UserName", "ID", book[j])
// Build the result if book matches current user
if mine=="all"
or (mine=="mine"
and MATCH(username, 1, user.firstname)>0
and MATCH(username, 1, user.lastname)>0) then
if result<>"" then
result = result + rec_delim
endif
result = result + appt[1] + field_delim + appttime(appt[2]) + field_delim + loc + field_delim + username
endif
j = j + 1
endwhile
endif
endif
i = i + 1
endwhile
return result
}
}
So glad this was fixed, thanks for the update. In the meantime I can try this code and see if it works better than what I use. My MEL has a bug with am/pm between noon and 12:59.
APPT_NEXT() showing who made the appointment is a bug and was reported on CISDB00047210 per the GE tech I communicated with. You could call and reference that number and get on the SPR to get notified
David
Does anyone know if there is a function for displaying the last most 5 recent appointments? (date, time, location of car, provider (appointment book))
If not - perhaps appointments from the past 3 months?
much appreciated!
We use this to display the last appointment if you wanted to alter this. I added the function below to usrlib.txt and then we use the data symbol {SMRMC_APPT_PRIOR()} in letters etc. It looks like this:
11/11/2015,2:45 pm,AV30,KAPP,rkappelm
//APPT (PRIOR) FUNCTION
fn SMRMC_APPT_PRIOR() {
local a, b,c, loc, atype, book
local result=''
local i = getRowCount('_MELCurPatientAppt')
// Loop thru patients appointments
while i > 0 do
i = i-1
a = getRow('_MELCurPatientAppt',i,'ApptDate', 'ApptTime',
'Appttype','Booklist','ApptStatus')
// Find the last appointment
if val(a[1]) < ._TODAYSDATE and val(a[5]) = 3 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 + ',' + loc + "," + book
break
endif
endwhile
result
}
This is awesome! Thanks so much