Good morning all,
I too am stuck on a function to pull appointment notes. In the beginning I used an edit field and this watcher to grab the booked appointments.
{!DOCUMENT.PRIOR_APPPTS=(APPTS_BY_STATUS("booked","FULL"))}
However, there is no way to use appts by status and get a delimited set of fields from the table without a getrow??
Here is where I am at the moment:
{!fn fnApptNotesGetField()
{
local msg=""
local numRows=getrowcount("_PatientAppointment")
local i,id,apptType,apptDate,apptStatus,apptComments,book,name
local numDaysToCount=365,futureApptDate=""
local monthsOrYears="1 year"
if (numRows>0) then
for i=(numRows-1),i>=0,i=i-1
do
id=getrow("_PatientAppointment",i,"APPTTYPE")
apptType=find("_MELApptDef","APPTTYPE","ID",id)
apptComments=getrow("_PatientAppointment",i,"COMMENTS")
book=getrow("_PatientAppointment",i,"BOOKLIST")
name=find("_MELBook","NAME","ID",ReplaceStr(book,":",""))
if (match(apptType,"Est Patient")>0 or
match(apptType,"Est Pt Visit")>0 or
match(apptType,"New Pt Visit")>0 or
match(apptType,"New Patient")>0 or
match(tolower(apptType),"telemed")>0 or
match(name," MD ")>0 or
match(name," NP ")>0 or
match(name," NP-C ")>0 or
match(name," FNP")>0 or
match(name," PA-C ")>0) then
apptStatus=getrow("_PatientAppointment",i,"APPTSTATUS")
apptDate=getrow("_PatientAppointment",i,"APPTDATE")
if (apptStatus==0 and DURATIONDAYS(apptDate,gClinicalDate)<=0) then
/* found a future appointment, so save the date */
futureApptDate=apptDate
if (DOCUMENT.NEXT_SCHEDULED_OFFICE_VISIT=="") then
DOCUMENT.NEXT_SCHEDULED_OFFICE_VISIT=futureApptDate //set date on screen
endif
endif
if (match(apptComments,"")>0
apptComments=getrow("_PatientAppointment",i,"COMMENTS")
endif
if (DOCUMENT.NEXT_SCHEDULED_OFFICE_VISIT=="") then
DOCUMENT.NEXT_SCHEDULED_OFFICE_VISIT="<None>"
endif
return msg
}}
Thanks in advance for the input!!
Debby Jennings