I have our banner showing last appt and next appt. Perhaps there are simpler ways, but it works for me. For your question, about 33 lines in the two for loops to set last and next. And then the last couple lines of code print them both out.
{global apls = getfield(APPTS_BY_STATUS("scheduled","FULL"),"\r","")
global apsz = size(apls)
global nxtap = ""
global nextappt = ""
fps = 1
for count = 1, count < apsz, count = count + 1
do
datedelim =match(apls[count],"/")
if datedelim > 0 then
appt_dt = sub(apls[count],datedelim-2,10)
days = DURATIONDAYS(str(._TODAYSDATE),appt_dt)
if val(days) >= 0 then
if fps = 1
then nxtap=appt_dt;fps=0
else "" endif
else "" endif
endif
endfor
nextappt=nxtap
global apptlisting = getfield(APPTS_BY_STATUS("ARRIVED","FULL"),"\r","")
global apptsize = size(apptlisting)
global lastappt2 = ""
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
}{PATIENT.LABELNAME} {if PATIENT.PSTATUS = "X" then "DECEASED: " + PATIENT.DATEOFDEATH + " MRN: " + PATIENT.MEDRECNO else "" endif}{if PATIENT.PSTATUS = "I" then "INACTIVE" else "" endif}{if PATIENT.PSTATUS = "O" then "OBSOLETE" else "" endif} {if PATIENT.PSTATUS = "A" then "Patient ID: " + PATIENT.MEDRECNO else "" endif} Home: {if PATIENT.ALTPHONE = "" then "None" else PATIENT.ALTPHONE endif} Work: {if PATIENT.WORKPHONE = "" then "None" else PATIENT.WORKPHONE endif} Portal PIN: {if (obsany("PATPORTALPIN")<>"" AND obsany("PATPORTALPIN")<>"Declined") THEN "Gen" ELSE if (obsany("PATPORTALPIN")=="Declined") THEN "Decl" ELSE "--" ENDIF ENDIF} Contact By: {if (obsany("METHCONTACT")=="secmsg" AND PATIENT.EMAIL<>"") AND (match(PATIENT.EMAIL,"@")<>0 OR match(PATIENT.EMAIL,".")<>0) THEN "Portal" ELSE if (obsany("METHCONTACT")=="phone") THEN "Phone" ELSE if (obsany("METHCONTACT")=="paper") THEN "Paper" ELSE "Unknown" ENDIF ENDIF ENDIF} Portal Msg: {if (obsany("SECMSGOPT")<>"") THEN "Active" ELSE "--" ENDIF} {if (obsany("MEDHXCSNTSIG")=="Paper" OR obsany("MEDHXCSNTSIG")=="Portal") THEN " *eRx=OK" ELSE if obsany("MEDHXCSNTSIG")=="Decline" then " *eRx=DECL" else "" ENDIF ENDIF}
{PATIENT.FORMATTEDAGE} {PATIENT.SEX} (DOB: {Patient.DateOfBirth}) PCP: {if PATIENT.RespProvID = "" then "None" else PATIENT.RespProvID endif} Ins: {if (size(INS_NAME("P"))>19) THEN sub(INS_NAME("P"),1,20) ELSE if (size(INS_NAME("P"))>0) THEN sub(INS_NAME("P"),1,size(INS_NAME("P"))) ELSE "--" ENDIF ENDIF} {if match(PROB_AFTER(),1,"V65.8")>0 then "[* High-Risk *]" else "" endif} Last Appt: {if lastappt2 = "" then "None" else lastappt2 endif} Next Appt: {if nextappt = "" then "None" else nextappt endif}
Posted : February 29, 2016 10:09 am