Hi Fellow Chugers, We are attempting to show a patient's next appt in the patient banner. We have tried the function Appt_next but this function returned the next appt only and regardless of status (status not part of the information that is pulled). The appt could be a resourse appt like ultrasound or urodynamics and not the next appt with the doctor. We tried appts_by_status scheduled but this option pulled ALL the appts with a status of scheduled, past and future, with oldest first if the status of the old appts were not changed by a staff member on the day of the appt. My question is; is there a way to pull just the future appointments of a certain Appt type? We need to see any appt with a type of follow up or a procedure appt type. Tx
I wrote a function that we use for quick text that could be modified to work. We loaded it into the userlib.txt file so that it was available throughout the emr. (actually it was loaded into a file that was loaded with userlib)
The function searches for the provider so you could use it as is if you only wanted to return scheduled appointments with the patients responsible provider.
If you wanted to search by appt type, you could change the "if(match" line to search on the appointment type by changing the [z] to [2].
For example if you wanted to return the next scheduled appointment type of "Annual Exam" it would look something like this:
if(match(aDtls[2], search)>0) Then
You would then run the function using: nextAppt("Annual Exam")
You would also need to change the return line to only return the data you wanted. For example if you wanted to return the appt date you would do this:
return aDtls[1]
Here is the code:
fn nextAppt(search){
aAppt = getfield(APPTS_BY_STATUS("scheduled", "FULL"), "\r", "")
for x = 1, x 0) Then
return aDtls[1] + aDtls[2] + ":" + aDtls[3] + "," + aDtls[z]
endif
endfor
return ""
}