Monsterglue said:
I am trying to create a handout that also lists patients past appointments. Im using the
{APPTS_BY_STATUS()} function, but I have to modify it somehow to include all visits. We use different status for appointments. Is there a function to collect all appointments?
Any help would be appreciated.
Adrienne Hannan
The Gastroenterology Group, P.C.
I don't think you'll be able to modify this function to include all statuses. However, you can call this function multiple times, loop through the results of each time, and add the appropriate appointments into one array using INSERT. In the example below, I'm returning all past/future appointments with appointment type = 'Office Visit'. I am checking first for appointment status of Confirmed (which we use for upcoming appointments) and then for appointment status of Checked Out (which we use when a visit is complete). Please note...I didn't do any error checking this code, so it may need to be modified slightly...but the general idea is there.
{fn getAllAppts(){
local retStr = ""
local apptArrayOV1
local apptArrayOV2
local apptArrayOVDTL_DATES = array("DELETE", "ME")
local apptArrayOVDTL_TIMES = array("DELETE", "ME")
local apptArrayOVDTL_TYPES = array("DELETE", "ME")
local apptArrayOVDTL_PROV = array("DELETE", "ME")
if APPTS_BY_STATUS("Confirmed", "FULL") <> "" then
apptArrayOV1 = getfield(APPTS_BY_STATUS("Confirmed", "FULL"), "\r", "")
for x = 1, x <= size(apptArrayOV1) - 1, x = x + 1 do
apptArrayOV2 = getfield(apptArrayOV1[x], ",", "")
if match(apptArrayOV2[3], 1, "Office Visit") > 0 and durationdays(apptArrayOV2[1], str(._TODAYSDATE)) < 0 then
INSERT(apptArrayOVDTL_DATES, size(apptArrayOVDTL_DATES) + 1, apptArrayOV2[1])
INSERT(apptArrayOVDTL_TIMES, size(apptArrayOVDTL_TIMES) + 1, apptArrayOV2[2])
INSERT(apptArrayOVDTL_TYPES, size(apptArrayOVDTL_TYPES) + 1, apptArrayOV2[3])
cond
case size(apptArrayOV2) == 6: INSERT(apptArrayOVDTL_PROV, size(apptArrayOVDTL_PROV) + 1, apptArrayOV2[6] + " " + apptArrayOV2[5])
case size(apptArrayOV2) == 5: INSERT(apptArrayOVDTL_PROV, size(apptArrayOVDTL_PROV) + 1, apptArrayOV2[5])
endcond
endif
endfor
endif
if APPTS_BY_STATUS("Checked Out", "FULL") <> "" then
apptArrayOV1 = getfield(APPTS_BY_STATUS("Checked Out", "FULL"), "\r", "")
for x = 1, x <= size(apptArrayOV1) - 1, x = x + 1 do
apptArrayOV2 = getfield(apptArrayOV1[x], ",", "")
if match(apptArrayOV2[3], 1, "Office Visit") > 0 and durationdays(apptArrayOV2[1], str(._TODAYSDATE)) >= 0 then
INSERT(apptArrayOVDTL_DATES, size(apptArrayOVDTL_DATES) + 1, apptArrayOV2[1])
INSERT(apptArrayOVDTL_TIMES, size(apptArrayOVDTL_TIMES) + 1, apptArrayOV2[2])
INSERT(apptArrayOVDTL_TYPES, size(apptArrayOVDTL_TYPES) + 1, apptArrayOV2[3])
cond
case size(apptArrayOV2) == 6: INSERT(apptArrayOVDTL_PROV, size(apptArrayOVDTL_PROV) + 1, apptArrayOV2[6] + " " + apptArrayOV2[5])
case size(apptArrayOV2) == 5: INSERT(apptArrayOVDTL_PROV, size(apptArrayOVDTL_PROV) + 1, apptArrayOV2[5])
endcond
endif
endfor
endif
if size(apptArrayOVDTL_DATES) <= 2 then
retStr = "No History of Office Visit Appointments!"
else
for x = 3, x <= size(apptArrayOVDTL_DATES), x = x + 1 do
if retStr <> "" then retStr = retStr + HRET endif
retStr = retStr + apptArrayOVDTL_DATES[x] + " " + apptArrayOVDTL_TIMES[x] + " -" + "\t" + apptArrayOVDTL_TYPES[x]
if apptArrayOVDTL_PROV[x] <> "" then
retStr = retStr + "," + apptArrayOVDTL_PROV[x]
endif
endfor
endif
if retStr <> "" and match(retStr, 1, "\n\n") > 0 then
retStr = replaceStr(retStr, "\n\n", "\n")
endif
return retStr
}}
Posted : July 30, 2014 12:24 am