Patients with Unapplied Payments and Outstanding Balances

I need a report that shows me all of the patients who have an unapplied credit AND a patient balance. At the end of the month I need to run a this report and go back and apply credits to balances that somehow I have missed throughout the month. I have tried to do this by running the unapplied credit report but that report includes patients without a balance and is very time consuming to go into each of those accounts. For example, a patient received a statement for $75.00 yet she had $70 in unapplied credits.

While all the information you need is in the standard Aging by Patient report, this query filters that information so the results contain only those accounts and payors of interest.

SELECT
   (PtPayors.Age0to30 + PtPayors.Age31to60 + PtPayors.Age61to90 + PtPayors.Age91to120 + PtPayors.AgeOvr120) AS "BALANCE",
   PtPayors.Ageunapplied AS "UNAPPLIED",
   Patients.ID,
   Patients.LastName + ', ' + Patients.FirstName AS "Patient Name",
   Payors.PayorName + ' ' + Payors.FirstName AS "Payor Name",
   PtPayors.PayorNum
 FROM  
   SOS.Patients Patients
   LEFT OUTER JOIN SOS.PtPayors PtPayors ON Patients.PtNum= PtPayors.PtNum
   LEFT OUTER JOIN SOS.Payors Payors ON PtPayors.PayorNum=Payors.PayorNum
 WHERE
   "UNAPPLIED" > 0
   AND "BALANCE" > 0
 ORDER BY
  "Patient Name", Patients.ID, PtPayors.PayorNum

Patients with Identifying Data, Provider, and Visit Count for Specified SortCodes

We have a report that need to be done for the state each month for some of our clients. what I need is a query (to go out to a Lotus or excel spreadsheet) that has first and last names, client ID, DOB, insurance coverage, date of admission (intake) and number of times seen in that month, rendering provider. Ideally we could do this for multiple sort codes but not all of them. For example, I would need it for our sort codes MI, DB, DN, DC but not for the others and if it could be done in one query rather than combining the results of four that would be great.

This query is pretty straightforward, except that you specified RENDERING provider. That would cause multiple lines for each patient account, one for
each provider the patient has seen during the period specified. I have substituted primary provider, but the other is possible if you wanted it (with multiple lines as described).

Another issue is that this query will report dates of service rather than distinct service entries, which could also be done with a slight modification. Further, I have added a condition requiring a fee > 0 (“AND b.amount > 0”), but that may or may not be appropriate in your case. In addition, for your requested “insurance coverage” I have included the payor name and insured’s ID, but just for the first listed policy, if any. You did not specify exactly what you wanted.

Note that the OUTPUT statement you use depends on whether you run the query using dbisqlc or dbisqlg.

SELECT
  a.lastname, a.firstname, a.id, a.dob, a.intakedate,
  e.provcode,
  COUNT(DISTINCT b.trandate) AS "SrvDateCount",
  d.payorname AS "Insurer",
  d.insdid AS "Subscriber#"
FROM
  sos.patients a
  JOIN sos.journal b
  JOIN sos.jcharges c
  LEFT OUTER JOIN sos.rv_policies d ON a.ptnum = d.ptnum
  LEFT OUTER JOIN sos.providers e ON a.providernum = e.providernum
  LEFT OUTER JOIN sos.lookups f ON b.sortcode = f.lunum
WHERE
  b.trandate BETWEEN '2001-01-01' AND '2001-03-31'
  AND d.inspos = 1 //only PRIMARY insurance
  AND f.lucode IN ('MI','DB','DN','DC')
  AND b.amount > 0
GROUP BY
  a.lastname, a.firstname, a.id, a.dob, a.intakedate, e.provcode,"insurer","subscriber#"
;
OUTPUT TO c:\sos\statereport.html FORMAT HTML  

Patients with Appointments Today and a Significant Balance, Sorted by Site and Provider

List the names of patients with balances of $120 or more, sorted by site and provider, who are scheduled to be seen on the day the query is run.

SELECT
  a.sitename+' ('+a.sitecode+')' AS "site",
  (a.provlname+', '+a.provfname+' ('+provcode+')') AS "provider",
  a.ptfullname,
  a.id,
  b.ptbalance
FROM
  sos.rv_appts a
  JOIN sos.pt_noninsbalance b ON a.ptnum = b.ptnum
WHERE
  b.ptbalance >= 120
  AND a.cancelflag = 0
  AND a.apptdate = TODAY()
ORDER BY
  "site","provider",a.ptfullname,a.id

Patients with any of Several Diagnoses Seen This Year

I need a list of patients with certain diagnoses (309.0, 309.21, 309.24, 309.28, 309.3, or 309.4) who were seen for treatment this year.

SELECT
  /*columns to include in list */
  lastname,
  firstname,
  dob,
  socsec
FROM
  sos.patients a JOIN sos.ptcsudx b ON a.ptcsunum = b.ptcsunum
WHERE
  /* at least one charge in ledger during the current year */
  (SELECT count(*) FROM sos.journal
   WHERE trantype = 'S' AND amount > 0
   AND ptnum = a.ptnum
   AND trandate BETWEEN '2008-01-01' AND '2008-12-31') > 0
  /* one of patient's dx's must be in the specified list of codes */
  AND
  (DXCODE1 IN ('309.0','309.21','309.24','309.28','309.3','309.4') OR
   DXCODE2 IN ('309.0','309.21','309.24','309.28','309.3','309.4') OR
   DXCODE3 IN ('309.0','309.21','309.24','309.28','309.3','309.4') OR
   DXCODE4 IN ('309.0','309.21','309.24','309.28','309.3','309.4')  )
ORDER BY
  lastname, firstname, dob

Count of Patients by Provider with and without Medicaid

I need to know by provider how many active patients they have and how many have Medicaid coverage.

This query shows the combined use a an IF expression that evaluates based on a subquery that returns a count. In this case, if there is any Medicaid coverage (carriers.coverage = ‘D’) then the expression returns “Yes”, otherwise (no ‘caid coverage) it returns “No”.

SELECT
(a.provfname + ' '+a.provlname) AS "Provider",
(IF (SELECT COUNT(*)
    FROM sos.ptpayors s1 JOIN sos.payors s2 ON s1.payornum = s2.payornum JOIN sos.carriers s3 ON s2.payornum = s3.payornum
    WHERE s1.ptnum = a.ptnum AND s3.coverage = 'D') > 0
THEN 'YES'
ELSE 'NO'
END IF)
AS "Medicaid",
COUNT(DISTINCT a.ptnum) AS "Pt Count"
FROM
sos.rv_charges a
WHERE
a.trandate BETWEEN '2008-01-01' AND '2008-12-31'
GROUP BY
"Provider", "Medicaid"
ORDER BY
"Provider", "Medicaid"