Hello:
We are trying to develop a report to provide the number of patients on a particular medication active during a time period by payer and are unable to create this in Inquiries.
In other word, for example, the number ( or list of names) of patients on Tamoxifen in 2012, 2013 and 2014 whose payer is Medicare part B. Using inquiries we can only select Active or Any. Neither report gives the specific answer to the question how many patients with Medicare part B had Tamoxifen as an active medication in 2012.
We are in CPS 12. Any help is appreciated.
Marilou Terpenning
Marilou,
You could do something like this to get the data.
SELECT
pp.First,
pp.Last,
pp.PatientId,
[DESCRIPTION],
[STARTDATE],
[STOPDATE],
ic.ListName
FROM [CentricityPS].[dbo].[MEDICATE] as m
left join patientprofile pp on pp.PId=m.PID
left join PatientInsurance pi on pp.patientprofileid=pi.PatientProfileId
left join InsuranceCarriers ic on pi.InsuranceCarriersId=ic.InsuranceCarriersId
where
m.DESCRIPTION like '%tamoxifen%' and
ic.ListName like '%medicare%' and
STARTDATE >'01/01/2012' and (STOPDATE='12/31/4700' or STOPDATE<='12/31/2012')
Thanks! That got me pretty far. But now I am trying to find patients who are on one of the opioid medications with a combination of a benzo. For example, i need to find patients who are on hydrocodone but also on xanax,
This is what i have so far. i think i am missing something....
SELECT
pp.First,
pp.Last,
pp.PatientId,
[DESCRIPTION],
[STARTDATE],
[STOPDATE],
df.[First],
df.[Last]
FROM MEDICATE m
LEFT join patientprofile pp ON pp.PId=m.PID
LEFT JOIN DoctorFacility df ON df.DoctorFacilityId = pp.DoctorId
WHERE m.CHANGE = 2 --Signed
AND m.STOPDATE > GETDATE() -- Not Removed
AND m.XID = 1000000000000000000
AND df.[Last] IN ('casey','russ','ryan','magonet','tav','gilbert')
AND (m.DESCRIPTION like '%hydrocodone%' or m.DESCRIPTION LIKE '%vicodin%' or m.DESCRIPTION LIKE '%morphine%' or m.DESCRIPTION LIKE '%Hydromorphone%'
or m.DESCRIPTION LIKE '%Dilaudid%' or m.DESCRIPTION LIKE '%Norco%' or m.DESCRIPTION LIKE '%oxycodone%' or m.DESCRIPTION LIKE '%percocet%'
or m.DESCRIPTION LIKE '%Fentanyl%' or m.DESCRIPTION LIKE '%Roxicodone%' or m.DESCRIPTION LIKE '%MS Contin%'
or m.DESCRIPTION LIKE '%xanax%')