You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virtual-patient/virtual-patient-model/src/main/resources/mapper/MedicalRecMapper.xml

95 lines
5.3 KiB
XML

<?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="patientHeadPic" column="patient_head_pic" jdbcType="VARCHAR"/>
<result property="digitalHumanType" column="digital_human_type" jdbcType="INTEGER"/>
<result property="patientName" column="patient_name" jdbcType="VARCHAR"/>
<result property="patientGender" column="patient_gender" jdbcType="VARCHAR"/>
<result property="patientAge" column="patient_age" jdbcType="INTEGER"/>
<result property="patientMarriage" column="patient_marriage" jdbcType="VARCHAR"/>
<result property="patientProfession" column="patient_profession" jdbcType="VARCHAR"/>
<result property="patientPhone" column="patient_phone" jdbcType="VARCHAR"/>
<result property="nativePlace" column="native_place" jdbcType="VARCHAR"/>
<result property="patientNation" column="patient_nation" jdbcType="VARCHAR"/>
<result property="patientPostcode" column="patient_postcode" jdbcType="VARCHAR"/>
<result property="patientBirthplace" column="patient_birthplace" jdbcType="VARCHAR"/>
<result property="patientHabitation" column="patient_habitation" 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"/>
<result property="fullCheck" column="full_check" jdbcType="VARCHAR"/>
<result property="medicalRecordAi" column="medical_record_ai" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
<result property="createUserId" column="create_user_id" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateUserId" column="update_user_id" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,no,patient_id,patient_head_pic,digital_human_type,
patient_name,patient_gender,patient_age,
patient_marriage,patient_profession,patient_phone,
native_place,patient_nation,patient_postcode,
patient_birthplace,patient_habitation,disease_id,
patient_self_desc,symptoms,primarily_diagnosis_criteria,
confirm_diagnosis_criteria,differential_diagnosis_criteria,full_check,
medical_record_ai,status,create_user_id,create_time,update_user_id,
update_time
</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,
t3.disease_name as diagnosisPrimaryStr,
t1.no as no,
t1.patient_id as patientId,
t1.patient_name as name,
t1.patient_age as age,
t1.patient_gender as gender,
t1.patient_head_pic as patientHeadPic,
t1.patient_self_desc as patientSelfDesc,
t1.status as medicalStatus,
if(t1.update_time is null, t1.create_time, t1.update_time) as time
from vp_medical_rec t1
left join vp_disease t3 on t1.disease_id = t3.id
<where>
<if test="medicalRecPageReqVO.selfDescKeyword != null and medicalRecPageReqVO.selfDescKeyword != ''">
AND t1.patient_self_desc like concat("%",#{medicalRecPageReqVO.selfDescKeyword}, "%")
</if>
<if test="medicalRecPageReqVO.gender != null and medicalRecPageReqVO.gender != ''">
AND t1.patient_gender = #{medicalRecPageReqVO.gender}
</if>
<if test="medicalRecPageReqVO.diseaseId != null and medicalRecPageReqVO.diseaseId != ''">
AND t1.disease_id = #{medicalRecPageReqVO.diseaseId}
</if>
<if test="medicalRecPageReqVO.patientName != null and medicalRecPageReqVO.patientName != ''">
AND t1.patient_name like concat("%",#{medicalRecPageReqVO.patientName}, "%")
</if>
<if test="medicalRecPageReqVO.status != null">
AND t1.status = #{medicalRecPageReqVO.status}
</if>
</where>
order by time desc
</select>
</mapper>