SQL: Documentation of Passive Smoke Exposure

About

This report lists active patients with second hand smoke exposure in risk assessment, and whether or not they have the second hand smoke SNOMED in their RISK ASSESSMENT as a problem (any status).

A sample image of this SQL report run in the Database Viewer is shown below:

Caveats

None.

Code

To highlight and copy the code below to your clipboard, simply click the Copy button.

select risk_assessment.patno, cast(note1 as char(20000)) as note1, problem_list from risk_assessment		
inner join register on register.patno = risk_assessment.patno		
left outer join		
(select patno, note1, problem_list from chartnotes where snomed1 = '699009004' and section_subheading = 'RISK ASSESSMENT')		
c on register.patno = c.patno		
where is_archived = 0 and risk_question_id = 2 and risk_answer_id = 9		
and status_pat = 'ACTIVE'