Hello,
I am looking for a script that i can run in sql that will show patients who were seen in a facility in the year of 2018 that are on either, Medicare, Medicaid or Self Pay. Any help on this would be appreciated. Thanks!
In Centricity EMR something like:
SELECT MEDRECNO
FROM PERSON... JOIN INSURANC... JOIN INSURECO
WHERE INSURECO.PLANCODE IN ['Medicare, Medicaid, Selfpay#s'] AND INSURANC.PSISTATE='P'
I think those are the important parts. The rest you should be able to construct yourself.
Good luck,
Gerald Neale, BSN
I would be happy to help you with this, the biggest question to answer from your side would be which CPS product you are using though.
- Are you using combined product? (If not are you using CPS EMR or PM)
If you are using combined you could do something like this, assuming any patient "seen" would have a visit created in PM.
Select pp.PatientId,
pp.Last,
pp.First,
ic.ListName as 'Insurance Carrier'
From PatientVisit pv
INNER JOIN PatientProfile pp ON pv.PatientProfileId = pp.PatientProfileId
INNER JOIN InsuranceCarriers ic ON pv.PrimaryInsuranceCarriersId = ic.InsuranceCarriersId
Where pv.FacilityId IN ('Get list of facility ids to put here')
AND
pv.PrimaryInsuranceCarriersId IN ('Get list of Insurance ids to put here')
AND
pv.Visit >= '01/01/2018'
AND
pv.Visit < '01/01/2019'
Also, you would have to make some changes if you want patients where the insurance you mentioned is something other than Primary. That can be done though without too much trouble.