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: Invalid Appointment Type Default in Patient Chart

About

This SQL identifies patient charts that have a Default Appointment Type that does not match an Appointment Type in your system.

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

Caveats

  • If the SQL returns no results, then there is no action necessary. 
  • If results are returned, the patient record will need to be edited to either remove the default appointment type or select a valid appointment type.

Code

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

select r.patno as patient_id, r.well_appt_type as default_well_appointment_type, '' as default_sick_appointment_type from register r where r.well_appt_type not in (select code1 from appt_type where code_type = 0) union select r.patno as patient_id, '' as default_well_appointment_type, r.sick_appt_type as default_sick_appointment_type from register r where r.sick_appt_type not in (select code1 from appt_type where code_type = 0)