SQL: Nurse Charting Productivity

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 indicates which staff member (other than a provider) opened sick and well notes for a period. The report is based upon the staff ID number in the Entered by field on the visit's Visit Info tab for a Patient's Well or Encounter note. Data in this report is summed by staff member, according to the date range you select.

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

Caveats

  • “Entered by” is defined as the person who was logged in when the note was opened. This might be the nurse/assistant, the rendering provider, or another person. Note that this field, while it defaults to the logged in user, may be manually changed. 
  • The Entered by field does not correlate with the Nurse/assistant field. The Nurse/assistant field and the Entered By field may be two different users. 
  • If the “Entered by” person is the same person as the rendering provider, the rendering provider is assumed to have created his or her own note, and nothing appears in this report.

SQL Code: Firebird

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

select total_patient_charted, dos, staffname from
(
select count(patno) as total_patient_charted, date1 as dos, s_addr_id from
(
select patno, date1, p_addr_id, s_addr_id from
(
select patno, date1, p_addr_id, s_addr_id, a_addr_id from enc_note where date1 between :Start_date and :end_date
union
select patno, date1, p_addr_id, s_addr_id, a_addr_id from enc_note where date1 between :Start_date and :end_date
) where s_addr_id <> p_addr_id
) group by date1, s_addr_id
) a left outer join staff1 on 
staff1.staffid = a.s_addr_id


SQL Code: MySQL

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

select total_patient_charted, dos, staffname from
(
select count(patno) as total_patient_charted, date1 as dos, s_addr_id from
(
select patno, date1, p_addr_id, s_addr_id from
(
select patno, date1, p_addr_id, s_addr_id, a_addr_id from enc_note where date1 between :start_date and :end_date
union
select patno, date1, p_addr_id, s_addr_id, a_addr_id from enc_note where date1 between :start_date and :end_date
) t1 where s_addr_id <> p_addr_id
) t2 group by date1, s_addr_id
) a left outer join staff1 on 
staff1.staffid = a.s_addr_id