<?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="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="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_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, 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_self_desc as patientSelfDesc, 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="selfDescKeyword != null and selfDescKeyword != ''"> AND t1.patient_self_desc like concat("%",#{selfDescKeyword}, "%") </if> <if test="gender != null and gender != ''"> AND t1.patient_gender = #{gender} </if> <if test="diseaseId != null and diseaseId != ''"> AND t1.disease_id = #{diseaseId} </if> </where> order by time desc </select> </mapper>