<?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.HospitalCheckItemConfMapper">
<resultMap id="HospitalCheckItemConfMap" type="com.lyms.platform.pojo.HospitalCheckItemConf">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="hospital_id" property="hospitalId" jdbcType="INTEGER"/>
<result column="start_week" property="startWeek" jdbcType="INTEGER"/>
<result column="end_week" property="endWeek" jdbcType="INTEGER"/>
<result column="need_check_item" property="needCheckItem" jdbcType="VARCHAR"/>
<result column="backup_check_item" property="backupCheckItem" jdbcType="VARCHAR"/>
<result column="yn" property="yn" jdbcType="INTEGER"/>
<result column="type" property="type" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<insert id="addHospitalCheckItemConf" parameterType="com.lyms.platform.pojo.HospitalCheckItemConf">
insert into hosptial_check_itme_conf
(hospital_id,start_week,end_week,need_check_item,backup_check_item,yn,type
,create_time,update_time) values
(#{hospitalId},#{startWeek},#{endWeek},
#{needCheckItem},#{backupCheckItem},#{yn},#{type},#{createTime},#{updateTime})
</insert>
<select id="selectHospitalCheckItemConfList" parameterType="com.lyms.platform.query.HospitalCheckItemConfQuery"
resultMap="HospitalCheckItemConfMap">
SELECT id,hospital_id,start_week,end_week,need_check_item,backup_check_item,yn,type
,create_time,update_time from hosptial_check_itme_conf
<include refid="HospitalCheckItemConfCondition"/>
<include refid="orderAndLimit"/>
</select>
<update id="updateHospitalCheckItemConf" parameterType="com.lyms.platform.pojo.HospitalCheckItemConf">
update hosptial_check_itme_conf
<set>
need_check_item = #{needCheckItem,jdbcType=VARCHAR},
backup_check_item = #{backupCheckItem,jdbcType=VARCHAR},
<if test="startWeek != null">
start_week = #{startWeek,jdbcType=INTEGER},
</if>
<if test="endWeek != null">
end_week = #{endWeek,jdbcType=INTEGER},
</if>
<if test="yn != null ">
yn = #{yn,jdbcType=INTEGER},
</if>
<if test="type != null ">
type = #{type,jdbcType=INTEGER},
</if>
<if test="updateTime != null ">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<sql id="HospitalCheckItemConfCondition">
<where>
1 = 1
<if test="id != null and id >= 0">
and id = #{id,jdbcType=INTEGER}
</if>
<if test="hospitalId != null">
and hospital_id = #{hospitalId,jdbcType=INTEGER}
</if>
<if test="yn != null and yn >= 0">
and yn = #{yn,jdbcType=INTEGER}
</if>
<if test="type != null ">
and type = #{type,jdbcType=INTEGER}
</if>
<if test="startWeek != null and startWeek >= 0">
<![CDATA[ and start_week >= #{startWeek,jdbcType=INTEGER} ]]>
</if>
<if test="endWeek != null and endWeek >= 0">
<![CDATA[ and end_week <= #{endWeek,jdbcType=INTEGER} ]]>
</if>
</where>
</sql>
<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>
</mapper>