I'm building a referral letter to our Community Care team.
In the referral, they would like to know how many office visits the patient has had in the last 6 months.
I'm trying to decipher the _MELCurPatientAppt object, but not having much luck.
Has anyone built a function to do this, or can steer me in the right direction?
All I'm looking for is an integer count of appointments, no other details needed.
I have the following in my banner, to show the last arrived appointment. To know how many ever "ARRIVED" appointments, I think you would just need the first two lines. If you want within past 6 months, you would play with the duration days formula to find a date 6 months ago; and then for days >0 count the entries rather than saving the last one.
Hope that makes sense.
{apptlisting = getfield(APPTS_BY_STATUS("ARRIVED","FULL"),"r","")
apptsize = size(apptlisting)
for count = 1, count < apptsize, count = count + 1
do
datedelim =match(apptlisting[count],"/")
if datedelim > 0 then
appt_date = sub(apptlisting[count],datedelim-2,10)
days = DURATIONDAYS(str(._TODAYSDATE),appt_date)
if val(days) <0 then lastappt2 = appt_date else lastappt2 = "" endif
else ""
endif
endfor
}