We are currently updating the OP Help Center content for the release of OP 19, which is a member of the certified OP 14 family of products. OP 19’s 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: Vaccine Count for Active Patients

About

This report shows all active patients and the number of vaccines they have had recorded in their chart.  Blank means 0. You can change the dropdown filter to show only blanks.

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

Caveats

  • Only active patients are included.
  • The vaccines shown are both vaccines given by your practice and legacy vaccines. 
  • A child might have a blank record if the patient has never received any vaccines (either newborn or total vaccine refuser), or if you simply don’t have a vaccine record for that patient recorded in OP yet.

Code

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

select register.patno, fname, lname, birthdat, t as total_vaccines from register
left outer join
(

select register.patno, t from register
left outer join (select patno, count(vacname) as t from vaccine1 group by patno) v on v.patno = register.patno
where status_pat = 'ACTIVE'
) u  on u.patno = register.patno
where status_pat = 'ACTIVE' and patno > 99