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: Contacts and Contact Information of Active Patients

About

Shows all active patients plus the name of their contacts #1 and #2 (if they have them), along with the preferred method of contact for each of those contacts for reminder, recall, medical, and billing.

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


Caveats

Contacts who are enumerated as #1 and #2 will be listed irrespective of their relationship to the patient.   These may or may not be suitable to contact for your purposes!  For example, a patient who is over 18 may have an emergency contact but it would not be appropriate to send information to the emergency contact.  A child might have contact #1 = mother and contact #2 = grandfather for emergency purposes but only mother should be contacted about this particular child’s medical issues.

Code

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

select patno, fname, lname, first_name, last_name, cell_phone,denorm_no as contact_rank, contact.pref_reminder, contact.pref_recall, contact.pref_medical, contact.pref_billing from  register
inner join register_contact on register.patno = register_contact.patno
inner join contact on contact.id = register_contact.contact_id
where patno is not null and patno >= 99
and lname not in ( 'TESTPATIENT','TEST-PATIENT')
and status_pat = 'ACTIVE'
and (denorm_no in ('1','2'))
order by patno