how many patients have expired after they have been diagnosed with comp-oth cardiac device within 2 months?
select count( distinct t2.subject_id ) from ( select t1.subject_id, t1.charttime from ( select admissions.subject_id, diagnoses_icd.charttime from diagnoses_icd join admissions on diagnoses_icd.hadm_id = admissions.hadm_id where diagnoses_icd.icd9_code = ( select d_icd_diagnoses.icd9_code from d_icd_diagnoses where d_icd_diagnoses.short_title = 'comp-oth cardiac device' ) ) as t1 group by t1.subject_id having min(t1.charttime) = t1.charttime ) as t2 join ( select patients.subject_id, admissions.hadm_id, patients.dod from admissions join patients on patients.subject_id = admissions.subject_id where patients.dod is not null ) as t3 on t2.subject_id = t3.subject_id where ( datetime(t3.dod) between datetime(t2.charttime) and datetime(t2.charttime,'+2 month') ) or ( datetime(t2.charttime) between datetime(t3.dod) and datetime(t3.dod,'+2 month') )