I added the patient's next appointment to the patient banner using APPT_NEXT() and that worked fine but then I wanted to get rid of everything after the date and time so I used {sub(APPT_NEXT(), 1, 18)}
This works great as long as they have an appointment scheduled but if they don't it gives me the error "bad length." How can I write the code so that if there's no future appointment it will come back as blank or say "None". Thanks!
Maybe something like this:
{if APPT_NEXT() <> "" then sub(APPT_NEXT(), 1, 18) else "" endif}
The banner in my experience is kind of finicky so code that would work all day long in a form sometimes has issues in the banner.
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}
Thanks for helping out with this guys. I ended up using this code and it seems to work so far.
{if match(APPT_NEXT(), ":") > 0 then sub(APPT_NEXT(), 1, 20) else "None" endif}
Where you put this in the patient banner? I have been wanting a way to show the next appointment here.
I just put it at the end so that it was listed on the right bottom of the banner. You could put it anywhere you wanted I suppose.
I put it in but it doesn't show anything in the banner.
Only thing I can think of is just to make sure that the banner template you added it to is the template you have your preferences set to.
Not only make sure that you modified the same Banner Template that you are using, but also make sure that your Banner Template fits your screen size. I've been with my company for 3 years and the first time I went to add an item to a banner, it looked great on my screen, but I had several people telling me they just weren't seeing it. I struggled with it for a few days before I went and visited one of my users to only find out they had a square screen monitor, instead of a widescreen monitor, I keep a small screen laptop in my office for when I'm modifying my banners to make sure that everything can be seen. In fact, I have 2 primary banners that most users use "Patient Banner - Small Screen" and "Patient Banner - Widescreen".
Is there anyway to add the name of the provider the patient is scheduled with?
We have 30 providers and it would be nice to know who the next appointment is with...
Thanks!
Any idea how to add the book name to this? Thanks!
You could pull the info from APPT_NEXT and match the values with the data returned from APPTS_BY_STATUS("scheduled","full") (loop through the values returned to find the next appt) and get the info you want to add from there. Not an elegant solution but I think it could be doable.