<?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.lyms.platform.permission.dao.master.MeasureUserInfoMapper">
<resultMap type="com.lyms.platform.pojo.MeasureUserInfoModel" id="measureUserInfoModelMap">
<result column="id" property="id"/>
<result column="user_name" property="userName"/>
<result column="cert_type" property="certType"/>
<result column="cert_no" property="certNo"/>
<result column="age" property="age"/>
<result column="phone" property="phone"/>
<result column="sex" property="sex"/>
<result column="vc_card_no" property="vcCardNo"/>
<result column="hospital_id" property="hospitalId"/>
<result column="created" property="created"/>
<result column="modified" property="modified"/>
<result column="zy_no" property="zyNo"/>
<result column="visit_id" property="visitId"/>
<result column="patient_id" property="patientId"/>
<result column="address" property="address"/>
<result column="face" property="face"/>
<result column="finger" property="finger"/>
<result column="is_zy" property="isZy"/>
</resultMap>
<insert id="addMeasureUserInfo" parameterType="com.lyms.platform.pojo.MeasureUserInfoModel" >
<selectKey order="AFTER" keyProperty="id" resultType="java.lang.Integer"> SELECT LAST_INSERT_ID() </selectKey>
INSERT INTO measure_user_info(
user_name,cert_type,
cert_no,age,phone,sex,vc_card_no,
created,modified,hospital_id,zy_no,visit_id,patient_id,address,face,finger,is_zy)
VALUES (#{userName},#{certType},
#{certNo},#{age},#{phone},#{sex}
,#{vcCardNo},#{created},#{modified},
#{hospitalId},#{zyNo},#{visitId},#{patientId},#{address},#{face},#{finger},#{isZy})
</insert>
<select id="queryMeasureUserInfoList" parameterType="com.lyms.platform.query.MeasureUserInfoQuery"
resultMap="measureUserInfoModelMap">
SELECT id,user_name,cert_type,
cert_no,age,phone,sex,vc_card_no,
created,modified,hospital_id,zy_no,visit_id,patient_id,address,face,finger,is_zy
FROM measure_user_info
<include refid="queryMeasureUserInfoCondition"/>
<include refid="orderAndLimit"/>
</select>
<select id="queryMeasureUserInfoListCount" parameterType="com.lyms.platform.query.MeasureUserInfoQuery" resultType="int">
SELECT count(id) FROM measure_user_info
<include refid="queryMeasureUserInfoCondition"/>
</select>
<update id="updateMeasureUserInfo" parameterType="com.lyms.platform.pojo.MeasureUserInfoModel" >
UPDATE
measure_user_info
<set>
<if test="id != null and id >= 0">
id = #{id,jdbcType=INTEGER},
</if>
<if test="userName != null">
user_name = #{userName,jdbcType=VARCHAR},
</if>
<if test="certType != null">
cert_type = #{certType,jdbcType=VARCHAR},
</if>
<if test="certNo != null">
cert_no = #{certNo,jdbcType=VARCHAR},
</if>
<if test="age != null and age >= 0">
age = #{age,jdbcType=INTEGER},
</if>
<if test="isZy != null and isZy >= 0">
is_zy = #{isZy,jdbcType=INTEGER},
</if>
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="sex != null">
sex = #{sex,jdbcType=INTEGER},
</if>
<if test="vcCardNo != null">
vc_card_no = #{vcCardNo,jdbcType=VARCHAR},
</if>
<if test="zyNo != null and zyNo != ''">
zy_no = #{zyNo,jdbcType=VARCHAR},
</if>
<if test="visitId != null and visitId != ''">
visit_id = #{visitId,jdbcType=VARCHAR},
</if>
<if test="patientId != null and patientId != ''">
patient_id = #{patientId,jdbcType=VARCHAR},
</if>
<if test="hospitalId != null and hospitalId != ''">
hospital_id = #{hospitalId,jdbcType=VARCHAR},
</if>
<if test="created != null">
created = #{created},
</if>
<if test="modified != null">
modified = #{modified},
</if>
<if test="address != null and address != ''">
address = #{address,jdbcType=VARCHAR},
</if>
<if test="face != null and face != ''">
face = #{face,jdbcType=VARCHAR},
</if>
<if test="finger != null and finger != ''">
finger = #{finger,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<sql id="orderAndLimit">
<if test="sort != null and sort != '' ">
order by ${sort}
<if test="need != null">
limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER}
</if>
</if>
</sql>
<sql id="queryMeasureUserInfoCondition">
<where>
1 = 1
<if test="id != null and id >= 0">
and id = #{id,jdbcType=INTEGER}
</if>
<if test="userName != null">
and user_name = #{userName,jdbcType=VARCHAR}
</if>
<if test="certType != null and certType != ''">
and cert_type = #{certType,jdbcType=VARCHAR}
</if>
<if test="certNo != null and certNo != ''">
and cert_no = #{certNo,jdbcType=VARCHAR}
</if>
<if test="age != null and age != ''">
and age = #{age,jdbcType=VARCHAR}
</if>
<if test="phone != null and phone != ''">
and phone = #{phone,jdbcType=VARCHAR}
</if>
<if test="sex != null">
and sex = #{sex,jdbcType=INTEGER}
</if>
<if test="isZy != null">
and is_zy = #{isZy,jdbcType=INTEGER}
</if>
<if test="vcCardNo != null and vcCardNo != ''">
and vc_card_no = #{vcCardNo,jdbcType=VARCHAR}
</if>
<if test="zyNo != null and zyNo != ''">
and zy_no = #{zyNo,jdbcType=VARCHAR}
</if>
<if test="visitId != null and visitId != ''">
and visit_id = #{visitId,jdbcType=VARCHAR}
</if>
<if test="patientId != null and patientId != ''">
and patient_id = #{valueOne,jdbcType=VARCHAR}
</if>
<if test="createdTimeStart != null">
AND created >= date_format(#{createdTimeStart},'%Y-%m-%d')
</if>
<if test="createdTimeEnd != null">
AND <![CDATA[ created < date_format(#{createdTimeEnd},'%Y-%m-%d') ]]>
</if>
<if test="modifiedTimeStart != null">
AND modified >= date_format(#{modifiedTimeStart},'%Y-%m-%d')
</if>
<if test="modifiedTimeEnd != null">
AND <![CDATA[ modified < date_format(#{modifiedTimeEnd},'%Y-%m-%d') ]]>
</if>
<if test="queryNo != null and queryNo != ''">
and (phone = #{queryNo,jdbcType=VARCHAR} or cert_no = #{queryNo,jdbcType=VARCHAR}
or user_name = #{queryNo,jdbcType=VARCHAR})
</if>
<if test="hospitalId != null and hospitalId != ''">
and hospital_id = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="hospitalIds != null and hospitalIds.size() > 0">
and hospital_id in
<foreach collection="hospitalIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="address != null and address != ''">
and address = #{address,jdbcType=VARCHAR}
</if>
<if test="face != null and face != ''">
and face = #{face,jdbcType=VARCHAR}
</if>
<if test="finger != null and finger != ''">
and finger = #{finger,jdbcType=VARCHAR}
</if>
</where>
</sql>
</mapper>