Is there any way to find out the status of an appointment based on the visit ID within MEL.
We require office notes to have a visitID associated with them. We have a popup message that will warn the user if they have linked the office visit with the appointment. We have users that are starting their office notes before the patients arrive (they aren't supposed to) and linking them to the proper visit ID, only to have the appointment cancelled and rescheduled same day. Now the note is linked to a cancelled appointment. I was hoping to find a way to determine the status of an appointment based on the visitid but I do not see any MEL functions that include the visitid.
This should do it, I have never used status, but I use this to get a few other details from the appointment like physician and appttype.
{find("_PatientAppointments","Status","AppointmentsID",find("Document","AppointmentsID"))}
There were a few issues with the names in your code (maybe because it was made for CPS instead of CEMR?) but I was able to use what you gave me along with the mldef files to come up with some working code. The below code checks to see that there is a visit ID and if there is one, it makes sure that the visitid is not a cancelled appointment or a no show appt.
{!
if DOCUMENT.VISITID = "" then
USEROK("* Visit ID Missing *
Click the Close button on the first form, click the Properties button, enter the Visit ID, click the OK button.")
else if (find("_PatientAppointment","ApptStatus","VisitID",DOCUMENT.VISITID) = 2) then
USEROK("* Wrong Visit ID Linked to Note *" + HRET + HRET + "This Document is linked to a *CANCELLED* appointment." + HRET + HRET + " Click the Close button on the first form, click the Properties button, change the Visit ID, click the OK button.")
else if (find("_PatientAppointment","ApptStatus","VisitID",DOCUMENT.VISITID) = 1) then
USEROK("* Wrong Visit ID Linked to Note *" + HRET + HRET + "This Document is linked to a *NO SHOW* appointment." + HRET + HRET + " Click the Close button on the first form, click the Properties button, change the Visit ID, click the OK button.")
endif
endif
endif }