We are currently updating the OP Help Center content for the release of OP 14.19 or OP 19. OP 19 is a member of the certified OP 14 family of products (official version is 14.19.1), which you may see in your software (such as in Help > About) and in the Help Center tabs labeled 14.19. You may also notice that the version number in content and videos may not match the version of your software, and some procedural content may not match the workflow in your software. We appreciate your patience and understanding as we make these enhancements.

SQL: Default Appointment Types per Patient

About

This report shows active patients, their default sick and well appointment types, and all future scheduled appointments.

A sample image of this SQL report run in the Database Viewer is shown below:

Caveats

  • Only patients with the ACTIVE status are shown here.
  • Patients will show multiple times based on the number of appointments. For example, a patient will show twice if the patient has two future appointments, three times for three future appointments, etc.

Code

To highlight and copy the code below to your clipboard, simply click the Copy button.

select register.patno, fname, lname, birthdat, sick_appt_type, well_appt_type, appt_date as future_appt_date, code1 as future_appt_type
from register
left outer join (select patno, appt_date, code1 from schedule where appt_date >= cast('today' as date) and visit_status is null) s on s.patno = register.patno
where status_pat = 'ACTIVE' and register.patno >99