Active Patients with Zero Balance and No Recent Activity


Back to Query Directory

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.

SELECT
  "Name/ID",
  lfeedate AS "Last Service",
  priprvcode AS "Primary Provider"
FROM
  rv_patients a
  JOIN 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"


The version below has a 90 day inactivity period and sorts by primary provider.

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



Note that "active" is defined in this query as both being in the Active list (flag = 0) AND having no discharge date entered (a.dischargedate IS NULL). If desired, you can remove the latter.


CategoryQueries


Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki