|
|
@ -139,9 +139,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
t_record tr
|
|
|
|
t_record tr
|
|
|
|
LEFT JOIN t_doctor td ON tr.doctor_id = td.id
|
|
|
|
LEFT JOIN t_doctor td ON tr.doctor_id = td.id
|
|
|
|
LEFT JOIN t_patient tp ON tr.patient_id = tp.id
|
|
|
|
LEFT JOIN t_patient tp ON tr.patient_id = tp.id
|
|
|
|
WHERE
|
|
|
|
<where>
|
|
|
|
tr.doctor_id = #{doctorId}
|
|
|
|
<if test="name != null and name != ''"> and tp.name like concat('%', #{name}, '%')</if>
|
|
|
|
AND tr.hospital_id = #{hospitalId}
|
|
|
|
<if test="doctorId != null "> and tr.doctor_id = #{doctorId}</if>
|
|
|
|
|
|
|
|
<if test="hospitalId != null "> and tr.hospital_id = #{hospitalId}</if>
|
|
|
|
|
|
|
|
<if test="status != null and status != ''"> and tr.status = #{status}</if>
|
|
|
|
|
|
|
|
<if test="doctorName != null and doctorName != ''"> and td.name like concat('%', #{doctorName}, '%')</if>
|
|
|
|
|
|
|
|
<if test="age !=null and age != ''">
|
|
|
|
|
|
|
|
and tp.age between
|
|
|
|
|
|
|
|
<foreach item="item" collection="age.split('-')" separator="and">
|
|
|
|
|
|
|
|
#{item}
|
|
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="sex !=null and sex !=''">and tp.sex = #{sex} </if>
|
|
|
|
|
|
|
|
<if test="identifier !=null and identifier != ''">and tp.identifier like concat('%', #{identifier}, '%')</if>
|
|
|
|
|
|
|
|
<if test="delFlag == null">
|
|
|
|
|
|
|
|
and td.del_flag = '0' and tp.del_flag = '0'
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="createTime != null and createTime !='' and createTime != 'all'">
|
|
|
|
|
|
|
|
and DATE_FORMAT(tp.create_time,'%Y-%m') = #{createTime}
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="createTime == null or createTime ==''">
|
|
|
|
|
|
|
|
and to_days(tr.create_time) = to_days(now())
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="startTime != null and startTime != '' and endTime == null "> and tr.create_time >= #{startTime}</if>
|
|
|
|
|
|
|
|
<if test="startTime == null and endTime != '' and endTime != null "> and tr.create_time <= #{endTime}</if>
|
|
|
|
|
|
|
|
<if test="startTime != null and endTime != null "> and tr.create_time between #{startTime} and #{endTime}</if>
|
|
|
|
|
|
|
|
</where>
|
|
|
|
|
|
|
|
<if test="doctorOder !=null and doctorOder !=''" >order by tr.create_time ${doctorOder}</if>
|
|
|
|
|
|
|
|
<if test="firstVisitOder!=null and firstVisitOder !=''" >order by tp.create_time ${firstVisitOder}</if>
|
|
|
|
) t
|
|
|
|
) t
|
|
|
|
GROUP BY
|
|
|
|
GROUP BY
|
|
|
|
t.patientId
|
|
|
|
t.patientId
|
|
|
|