ctsidev / UC_Event_Care_planning

0 stars 3 forks source link

Create MyChart flag #1

Closed jsanzucla closed 6 years ago

jsanzucla commented 6 years ago

Add a flag to cohort table indicating if the patient has an active MyChrat account or not. Use this code

SELECT DISTINCT pat.PAT_ID
case when mp.pat_id is not null then ''Yes'' else null end as active_mychart
FROM patient  pat
left join clarity.myc_patient mp on p.pat_id = mp.pat_id
                    and (mp.status_cat_c is null or mp.status_cat_c = 1);