|
|
|
<?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.supervision.mapper.MedicalRecMapper">
|
|
|
|
|
|
|
|
<resultMap id="BaseResultMap" type="com.supervision.model.MedicalRec">
|
|
|
|
<id property="id" column="id" jdbcType="VARCHAR"/>
|
|
|
|
<result property="no" column="no" jdbcType="VARCHAR"/>
|
|
|
|
<result property="patientId" column="patient_id" jdbcType="VARCHAR"/>
|
|
|
|
<result property="diseaseId" column="disease_id" jdbcType="VARCHAR"/>
|
|
|
|
<result property="patientSelfDesc" column="patient_self_desc" jdbcType="VARCHAR"/>
|
|
|
|
<result property="symptoms" column="symptoms" jdbcType="VARCHAR"/>
|
|
|
|
<result property="primarilyDiagnosisCriteria" column="primarily_diagnosis_criteria" jdbcType="VARCHAR"/>
|
|
|
|
<result property="confirmDiagnosisCriteria" column="confirm_diagnosis_criteria" jdbcType="VARCHAR"/>
|
|
|
|
<result property="differentialDiagnosisCriteria" column="differential_diagnosis_criteria" jdbcType="VARCHAR"/>
|
|
|
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="Base_Column_List">
|
|
|
|
id
|
|
|
|
,no,patient_id,
|
|
|
|
patient_self_desc,symptoms,primarily_diagnosis_criteria,
|
|
|
|
confirm_diagnosis_criteria,confirm_diagnosis_criteria
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
<update id="updateMedicalRecNo">
|
|
|
|
UPDATE vp_medical_rec
|
|
|
|
SET no = CONCAT(#{code}, LPAD(
|
|
|
|
IFNULL((SELECT MAX(RIGHT (t.no, LENGTH(t.no) - 2)) + 1 FROM (SELECT * FROM vp_medical_rec) t), 1), 6,
|
|
|
|
'0'), #{gender})
|
|
|
|
WHERE id = #{id};
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<select id="queryMedicalRecManagePage" resultType="com.supervision.vo.manage.MedicalRecPageResVO">
|
|
|
|
select
|
|
|
|
t1.id as medicalId,
|
|
|
|
t2.id as patientId,
|
|
|
|
t1.no as no,
|
|
|
|
t2.name as name,
|
|
|
|
t2.age as age,
|
|
|
|
t2.gender as gender,
|
|
|
|
if(t1.update_time is null, t1.create_time, t1.update_time) as time
|
|
|
|
from vp_medical_rec t1
|
|
|
|
left join vp_patient t2
|
|
|
|
on t1.patient_id = t2.id
|
|
|
|
<where>
|
|
|
|
<if test="selfDescKeyword != null and selfDescKeyword != ''">
|
|
|
|
AND t1.patient_self_desc like concat("%",#{selfDescKeyword}, "%")
|
|
|
|
</if>
|
|
|
|
<if test="gender != null and gender != ''">
|
|
|
|
AND t2.gender = #{gender}
|
|
|
|
</if>
|
|
|
|
<if test="gender != null and gender != ''">
|
|
|
|
AND t1.disease_id = #{diseaseId}
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
order by time desc
|
|
|
|
</select>
|
|
|
|
</mapper>
|