SQL: Unbilled Well Notes

There are two versions of this SQL: Firebird and MySQL. The MySQL version only applies to clients who are have migrated to MySQL.. All other Practices should continue to use the Firebird version of this code. Click to expand and copy the code you need. If you are unsure which code to use, please check with your Practice Administrator.

About

This report shows all well notes and whether something was billed on those dates of service for a date of service range that you specify.

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

Caveats

  • A well note will show with a blank row under "CODES" if no CPT codes of any kind were billed on that date of service.
  • Only daysheeted claims appear as billed in this report.  Therefore, if you have submitted claims in the past 2 weeks but you haven’t daysheeted in 2 weeks, all your well visits from the past 2 weeks will appear “unbilled,” even though you’ve technically created claims for them.

SQL Code: Firebird

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

select physical.patno, fname, lname, physical.date1, cast(dwp as char(30000)) as note_plan, cast(codes as char(2000)) as codes from physical	
inner join register on register.patno = physical.patno	
left outer join (select patno, date1, list(cptcode,',') as codes from archive_transactions where date1 between :start_Date and :end_date and archive_Flag = 1 and cptcode not in ('1','2','3','4') group by patno, date1) a on a.patno = physical.patno and a.date1 = physical.date1	
where physical.date1 between :start_Date and :end_date


SQL Code: MySQL

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

select enc_note.patno, fname, lname, enc_note.date1, mdm_plan, codes from enc_note
inner join register on register.patno = enc_note.patno
left outer join (select patno, date1, group_concat(cptcode separator ',') as codes 
from archive_transactions where date1 between :start_date and :end_date and archive_Flag = 1 and cptcode not in ('1','2','3','4') group by patno, date1) a on a.patno = enc_note.patno and a.date1 = enc_note.date1
where enc_note.date1 between :start_date and :end_date