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: Billed Diagnosis Review for Dates

About

This report shows all instances of a specific billed diagnosis for active patients between two dates you specify. The diagnosis code is entered when you enter the the date range.

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

Caveats

  • The billed diagnosis code must match exactly what was entered. If the user enters J45.2, but the practice used J45.21 or J45.3, those instances will not appear.
  • Only active patients are shown.
  • The diagnosis code could have been billed as the first, second, third, or fourth diagnosis.
  • A patient appears each time a diagnosis code was used.  If a patient was seen for diagnosis code J45.21 on 3/1, 4/1, and 5/1, the patient will appear three times in the listing. User could use the “*” wildcard to render all results starting with of J45.* (J45.2, J45.21, and J45.3).

Code

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

select register.patno, fname, lname, sex,  birthdat, dos, dx from register
inner join
(
select patno, date1 as dos, dxcode1 as dx from archive_Transactions where date1 between :start_date and :end_Date and dxcode1  like (:mydx)
union
select patno, date1 as dos, dxcode2 as dx from archive_Transactions where date1 between :start_date and :end_Date and  dxcode2  like (:mydx)
union
select patno, date1 as dos, dxcode3 as dx from archive_Transactions where date1 between :start_date and :end_Date and dxcode3  like (:mydx)
union
select patno, date1 as dos, dxcode4 as dx from archive_Transactions where date1 between :start_date and :end_Date and dxcode4  like (:mydx)
) d on register.patno = d.patno
where status_pat = 'ACTIVE' and dos is not null