Active Patients with Zero Balance and No Recent Activity

Is there a report or query that we can run that will give us a list of the active patients with a zero balance and no activity within the last 31 days?

In the following query you can adjust the desired period of inactivity by simply changing “31” in the WHERE clause to some other number of days. If you want to sort by primary provider, just change the ORDER BY clause as in the second version below.

(For a related query that returns more information, see http://www.sosoft.com/queries/2014/07/27/716/)

SELECT
  "Name/ID",
  lfeedate AS "Last Service",
  priprvcode AS "Primary Provider"
FROM
  sos.rv_patients a
  JOIN sos.PatientBalance b ON a.ptnum = b.ptnum
WHERE
  flag = 0
  AND lfeedate < ( TODAY() - 31 )
  AND b.ptbalance = 0
  AND a.dischargedate IS NULL
ORDER BY "name/id"

 

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.