query for insurance percentages

For users or potential users.
Post Reply
drtbar
Posts: 72
Joined: Wed Dec 26, 2007 6:43 pm
Location: Muskegon, MI

query for insurance percentages

Post by drtbar » Thu Oct 16, 2008 8:47 am

I checked the list of query examples, but did not find this query. I tried #67 but got "unhandled exception."What I want is a query to show all my insurance carriers and what percentage of my patients have that insurance. I'd also like to know how many patients have no insurance. Is there a way to do this?

Thanks in advance.

nathansparks
Posts: 172
Joined: Mon Aug 04, 2008 12:39 pm

Re: query for insurance percentages

Post by nathansparks » Fri Oct 17, 2008 9:46 am

I will have some queries posted for you within an hour or so
nathan

nathansparks
Posts: 172
Joined: Mon Aug 04, 2008 12:39 pm

Re: query for insurance percentages

Post by nathansparks » Fri Oct 17, 2008 12:51 pm

OK, the question is, are you wanting to count primary insurance only or any insurance? If you count any insurance then your percentages will be greater than 100% added together. Also it might be more effective if we limit it to a time period where you have seen the patients, typically 2 years or whatever you define, because it is less informative to include former patients.

nathansparks
Posts: 172
Joined: Mon Aug 04, 2008 12:39 pm

Re: query for insurance percentages

Post by nathansparks » Fri Oct 17, 2008 3:30 pm

Use this for the count of patients with each insurance, the unhandled exception eror you got was because there was an error in your SQL, probably you put a date in wrong format, try this exactly as written, save to favorites, THEN change the date each time you run
Call me if you have any problems, or reply in this thread

I will update this to do percentages next week, but you can do the math in excel in the meantime
Nathan

SET @Start='2007-01-01' , @Before='2008-01-01';
/*Adjust above Dates AS needed*/
SELECT carrier.CarrierName, COUNT(DISTINCT claimproc.PatNum) AS 'Patients'
FROM carrier
INNER JOIN insplan ON carrier.CarrierNum=insplan.CarrierNum
INNER JOIN claim ON insplan.PlanNum=claim.PlanNum
INNER JOIN claimproc ON claim.ClaimNum=claimproc.ClaimNum
INNER JOIN procedurelog ON claimproc.ProcNum=procedurelog.ProcNum
INNER JOIN procedurecode ON procedurelog.CodeNum=procedurecode.CodeNum
AND procedurelog.ProcDate >= @Start
AND procedurelog.ProcDate < @Before
AND ProcStatus=2
GROUP BY CarrierName
ORDER BY CarrierName;

For the patient counts with and without insurance, use this
SET @Start='2007-01-01' , @Before='2008-01-01';
SELECT (SELECT COUNT(DISTINCT PatNum)
FROM procedurelog pl
WHERE pl.ProcDate Between @Start AND @Before
AND ProcStatus=2) AS 'TotPatients',
(SELECT COUNT(DISTINCT p.PatNum)
FROM procedurelog pl
INNER JOIN patient p ON p.PatNum=pl.PatNum
WHERE pl.ProcDate Between @Start AND @Before
AND ProcStatus=2 AND p.HasIns='I') AS 'InsPatients',
(SELECT COUNT(DISTINCT p.PatNum)
FROM procedurelog pl
INNER JOIN patient p ON p.PatNum=pl.PatNum
WHERE pl.ProcDate Between @Start AND @Before
AND ProcStatus=2 AND NOT(p.HasIns='I')) AS 'NoInsPatients';

drtbar
Posts: 72
Joined: Wed Dec 26, 2007 6:43 pm
Location: Muskegon, MI

Re: query for insurance percentages

Post by drtbar » Mon Oct 20, 2008 5:22 am

Awesome, thanks for the reply. I've only had OpenDental since April so limiting patients is probably not necessary. Will check out the query and let you know. Thanks again.

drtbar
Posts: 72
Joined: Wed Dec 26, 2007 6:43 pm
Location: Muskegon, MI

Re: query for insurance percentages

Post by drtbar » Mon Oct 20, 2008 6:03 am

Query works great. I did export to excel to calculate percentages. Thanks again.

Post Reply