|
|
@ -77,6 +77,78 @@ |
|
|
) |
|
|
) |
|
|
GROUP BY pp.id |
|
|
GROUP BY pp.id |
|
|
order by pp.create_time desc |
|
|
order by pp.create_time desc |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT |
|
|
|
|
|
pp.id as patientId, |
|
|
|
|
|
pp.`name` as patientName, |
|
|
|
|
|
pp.sex, |
|
|
|
|
|
pp.idcard, |
|
|
|
|
|
pp.mobile as phone, |
|
|
|
|
|
pp.birth_year as birthYear, |
|
|
|
|
|
pp.birthday, |
|
|
|
|
|
pp.belief, |
|
|
|
|
|
pp.hobby, |
|
|
|
|
|
pp.contact_name as contactName, |
|
|
|
|
|
pp.contact_relation as contactRelation, |
|
|
|
|
|
pp.contact_mobile as contactMobile, |
|
|
|
|
|
pp.contact_other as contactOther, |
|
|
|
|
|
pp.id_card_type as idCardType, |
|
|
|
|
|
pp.id_card_type_other as idCardTypeOther, |
|
|
|
|
|
pp.abo_blood_type as aboBloodType, |
|
|
|
|
|
pp.rh_blood_type as rhBloodType, |
|
|
|
|
|
MAX(ae.create_time) as lastEvaluationTime, |
|
|
|
|
|
uu.nick_name as lastTesterName, |
|
|
|
|
|
COUNT(DISTINCT ae.id) as evaluationCount, |
|
|
|
|
|
(select nick_name from ums_user where user_name = pp.create_by and del_flag = 0) as creatorName, |
|
|
|
|
|
pp.create_time as createTime |
|
|
|
|
|
FROM |
|
|
|
|
|
pms_patient pp |
|
|
|
|
|
LEFT JOIN ems_evaluation ae on pp.id = ae.patient_id |
|
|
|
|
|
left join pms_patient_body pb on pp.id = pb.patient_id |
|
|
|
|
|
left join ums_dept ud on pb.department = ud.dept_name |
|
|
|
|
|
WHERE |
|
|
|
|
|
pp.del_flag = 0 |
|
|
|
|
|
<if test="searchValue != null and searchValue != ''"> |
|
|
|
|
|
and ( |
|
|
|
|
|
pp.name like CONCAT('%',#{searchValue},'%') |
|
|
|
|
|
or |
|
|
|
|
|
pp.name_initial like CONCAT('%',LOWER(#{searchValue}),'%') |
|
|
|
|
|
or |
|
|
|
|
|
pp.name_full like CONCAT('%',LOWER(#{searchValue}),'%') |
|
|
|
|
|
or |
|
|
|
|
|
pp.idcard like CONCAT('%',#{searchValue},'%') |
|
|
|
|
|
or |
|
|
|
|
|
pp.id = #{searchValue} |
|
|
|
|
|
or |
|
|
|
|
|
pb.outpatient_no like CONCAT('%',#{searchValue},'%') |
|
|
|
|
|
) |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="idcard != null and idcard != ''"> |
|
|
|
|
|
and (pp.idcard = #{idcard} or pp.idcard = #{idcardEncrypt}) |
|
|
|
|
|
</if> |
|
|
|
|
|
<!--电力医院查看自己关联的部门信息--> |
|
|
|
|
|
AND ( |
|
|
|
|
|
EXISTS ( |
|
|
|
|
|
SELECT 1 FROM ums_user WHERE user_id = #{userId} AND data_power = 'ALL' |
|
|
|
|
|
) |
|
|
|
|
|
OR |
|
|
|
|
|
( |
|
|
|
|
|
FIND_IN_SET(ud.dept_code, |
|
|
|
|
|
(SELECT |
|
|
|
|
|
CONCAT( d.dept_code, ',', u.data_power ) |
|
|
|
|
|
FROM |
|
|
|
|
|
ums_user u LEFT JOIN ums_dept d on u.dept_id = d.dept_id and d.del_flag = 0 |
|
|
|
|
|
WHERE |
|
|
|
|
|
u.user_id = #{userId}) |
|
|
|
|
|
) |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
GROUP BY pp.id |
|
|
|
|
|
order by pp.create_time desc |
|
|
</select> |
|
|
</select> |
|
|
<select id="queryPatientByIdCard" resultType="com.ccsens.system.domain.vo.PmsPatientVo$PatientInfo"> |
|
|
<select id="queryPatientByIdCard" resultType="com.ccsens.system.domain.vo.PmsPatientVo$PatientInfo"> |
|
|
SELECT |
|
|
SELECT |
|
|
|