select a.id as firstAidId, a.name, a.gender, a.age, a.data_status as dataStatus,
a.value_type as demonstrate, a.type as type, r1.answer as record1, r2.answer as record2
a.value_type as demonstrate, a.type as type, r1.answer as record1, r2.answer as record2,
a.project_id as projectId, m.record_user_id as recordUserId, r3.answer as probableCase
from
t_qcp_first_aid a
(select a.* from t_qcp_first_aid a, t_organization_project o where a.hospital_id = o.organization_id and o.project_id = #{param.projectId} and a.rec_status = 0 and o.rec_status = 0 )a
left join t_qcp_first_aid_member m
on a.id = m.first_aid_id and m.rec_status = 0
<choose>
<whentest="param.type == 0">
and m.create_user_id = #{userId}
</when>
<whentest="param.type == 1">
and m.record_user_id in (1000, 0)
</when>
</choose>
left join t_qcp_first_aid_record r
on a.id = r.first_aid_id
and r.question_code = 'CYQK-CYSJ' and r.rec_status = 0