You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
2.1 KiB

4 years ago
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.carbasics.persist.dao.FirstAidDao">
4 years ago
<select id="querySelf" resultType="com.ccsens.carbasics.bean.vo.PatientVo$QueryPatientList">
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
from
t_qcp_first_aid a
left join t_qcp_first_aid_member m
on a.id = m.first_aid_id and m.rec_status = 0
4 years ago
<choose>
<when test="param.type == 0">
4 years ago
and m.create_user_id = #{userId}
</when>
<when test="param.type == 1">
and m.record_user_id in (1000, 0)
4 years ago
</when>
</choose>
4 years ago
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
left join t_qcp_first_aid_record r1 on a.id = r1.first_aid_id and r1.rec_status = 0
<choose>
<when test="param.firstAidType == 0">and r1.question_code='JBXX-FBSJ'</when>
<when test="param.firstAidType == 1">and r1.question_code='CYQK-CYSJ'</when>
</choose>
left join t_qcp_first_aid_record r2 on a.id = r2.first_aid_id and r2.rec_status = 0
<choose>
<when test="param.firstAidType == 0">and r2.question_code='JBXX-DYSJ'</when>
<when test="param.firstAidType == 1">and r2.question_code='CYQK-LYFS'</when>
</choose>
where
<choose>
<when test="param.firstAidType == 0">r.id is null</when>
<when test="param.firstAidType == 1"> r.id is not null</when>
<otherwise>r.id is null</otherwise>
</choose>
<if test="param.name != null and param.name != ''">
and a.name like concat('%', #{param.name}, '%')
</if>
4 years ago
</select>
</mapper>