<?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.HighriskChangeHospitalMapper">
<resultMap id="HighriskChangeHospitalResultMap" type="com.lyms.platform.permission.model.HighriskChangeHospital">
<id column="ID" property="id" jdbcType="VARCHAR"/>
<result column="TARGET_TYPE" property="targetType" jdbcType="INTEGER"/>
<result column="TARGET_ID" property="targetId" jdbcType="VARCHAR"/>
<result column="OUT_ORGID" property="outOrgid" jdbcType="VARCHAR"/>
<result column="INTO_ORGID" property="intoOrgid" jdbcType="VARCHAR"/>
<result column="DESCRIPTION" property="description" jdbcType="VARCHAR"/>
<result column="MUSTDESC" property="mustdesc" jdbcType="VARCHAR"/>
<result column="RISK" property="risk" jdbcType="VARCHAR"/>
<result column="CHANGEWAY" property="changeway" jdbcType="VARCHAR"/>
<result column="APPLY_DOCTORID" property="applyDoctorid" jdbcType="VARCHAR"/>
<result column="CREATE_ID" property="createId" jdbcType="VARCHAR"/>
<result column="CHANGE_TYPE" property="changeType" jdbcType="INTEGER"/>
<result column="STATUS" property="status" jdbcType="INTEGER"/>
<result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP"/>
<result column="RECEIVE_TIME" property="receiveTime" jdbcType="TIMESTAMP"/>
<result column="RECEIVE_DOCTORID" property="receiveDoctorid" jdbcType="VARCHAR"/>
<result column="SCRREEN_ID" property="scrreenId" jdbcType="VARCHAR"/>
<result column="pid" property="pid" jdbcType="VARCHAR"/>
</resultMap>
<insert id="addHighriskChangeHospital" parameterType="com.lyms.platform.permission.model.HighriskChangeHospital">
insert into HIGHRISK_CHANGE_HOSPITAL (ID,TARGET_TYPE,TARGET_ID,OUT_ORGID,INTO_ORGID,DESCRIPTION,MUSTDESC,RISK,CHANGEWAY,APPLY_DOCTORID,CREATE_ID,CHANGE_TYPE,STATUS,CREATE_TIME,RECEIVE_TIME,RECEIVE_DOCTORID,SCRREEN_ID,pid) values (#{id},#{targetType},#{targetId},#{outOrgid},#{intoOrgid},#{description},#{mustdesc},#{risk},#{changeway},#{applyDoctorid},#{createId},#{changeType},#{status},#{createTime},#{receiveTime},#{receiveDoctorid},#{scrreenId},#{pid})
</insert>
<update id="updateHighriskChangeHospital" parameterType="com.lyms.platform.permission.model.HighriskChangeHospital">
update HIGHRISK_CHANGE_HOSPITAL
<set>
<if test="targetType != null and targetType >= 0">
TARGET_TYPE = #{targetType,jdbcType=INTEGER},
</if>
<if test="targetId != null and targetId != ''">
TARGET_ID = #{targetId,jdbcType=VARCHAR},
</if>
<if test="outOrgid != null and outOrgid != ''">
OUT_ORGID = #{outOrgid,jdbcType=VARCHAR},
</if>
<if test="intoOrgid != null and intoOrgid != ''">
INTO_ORGID = #{intoOrgid,jdbcType=VARCHAR},
</if>
<if test="description != null and description != ''">
DESCRIPTION = #{description,jdbcType=VARCHAR},
</if>
<if test="mustdesc != null and mustdesc != ''">
MUSTDESC = #{mustdesc,jdbcType=VARCHAR},
</if>
<if test="risk != null and risk != ''">
RISK = #{risk,jdbcType=VARCHAR},
</if>
<if test="changeway != null and changeway != ''">
CHANGEWAY = #{changeway,jdbcType=VARCHAR},
</if>
<if test="applyDoctorid != null and applyDoctorid != ''">
APPLY_DOCTORID = #{applyDoctorid,jdbcType=VARCHAR},
</if>
<if test="createId != null and createId != ''">
CREATE_ID = #{createId,jdbcType=VARCHAR},
</if>
<if test="changeType != null and changeType >= 0">
CHANGE_TYPE = #{changeType,jdbcType=INTEGER},
</if>
<if test="status != null and status >= 0">
STATUS = #{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="receiveTime != null">
RECEIVE_TIME = #{receiveTime,jdbcType=TIMESTAMP},
</if>
<if test="receiveDoctorid != null and receiveDoctorid != ''">
RECEIVE_DOCTORID = #{receiveDoctorid,jdbcType=VARCHAR},
</if>
<if test="scrreenId != null and scrreenId != ''">
SCRREEN_ID = #{scrreenId,jdbcType=VARCHAR},
</if>
<if test="pid != null and pid != ''">
pid = #{pid,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<select id="getHighriskChangeHospital" resultMap="HighriskChangeHospitalResultMap" parameterType="java.lang.String">
select ID,TARGET_TYPE,TARGET_ID,OUT_ORGID,INTO_ORGID,DESCRIPTION,MUSTDESC,RISK,CHANGEWAY,APPLY_DOCTORID,CREATE_ID,CHANGE_TYPE,STATUS,CREATE_TIME,RECEIVE_TIME,RECEIVE_DOCTORID,SCRREEN_ID,pid
from HIGHRISK_CHANGE_HOSPITAL where id = #{id,jdbcType=VARCHAR}
</select>
<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="HighriskChangeHospitalCondition">
<where>
1 = 1
<if test="id != null and id != ''">
and ID = #{id,jdbcType=VARCHAR}
</if>
<if test="targetType != null and targetType >= 0">
and TARGET_TYPE = #{targetType,jdbcType=INTEGER}
</if>
<if test="babyIds!=null">
and TARGET_ID in (
<foreach item="bId" collection="babyIds" separator=",">
#{bId}
</foreach>
)
</if>
<if test="hospitalIds!=null">
and INTO_ORGID in (
<foreach item="item" collection="hospitalIds" separator=",">
#{item}
</foreach>
)
</if>
<if test="intoOrgidArry!=null">
and INTO_ORGID in (
<foreach item="item" collection="intoOrgidArry" separator=",">
#{item}
</foreach>
)
</if>
<if test="outOrgidArry!=null">
and OUT_ORGID in (
<foreach item="item" collection="outOrgidArry" separator=",">
#{item}
</foreach>
)
</if>
<if test="targetId != null and targetId != ''">
and TARGET_ID = #{targetId,jdbcType=VARCHAR}
</if>
<if test="outOrgid != null and outOrgid != ''">
and OUT_ORGID = #{outOrgid,jdbcType=VARCHAR}
</if>
<if test="intoOrgid != null and intoOrgid != ''">
and INTO_ORGID = #{intoOrgid,jdbcType=VARCHAR}
</if>
<if test="description != null and description != ''">
and DESCRIPTION = #{description,jdbcType=VARCHAR}
</if>
<if test="mustdesc != null and mustdesc != ''">
and MUSTDESC = #{mustdesc,jdbcType=VARCHAR}
</if>
<if test="risk != null and risk != ''">
and RISK = #{risk,jdbcType=VARCHAR}
</if>
<if test="changeway != null and changeway != ''">
and CHANGEWAY = #{changeway,jdbcType=VARCHAR}
</if>
<if test="applyDoctorid != null and applyDoctorid != ''">
and APPLY_DOCTORID = #{applyDoctorid,jdbcType=VARCHAR}
</if>
<if test="createId != null and createId != ''">
and CREATE_ID = #{createId,jdbcType=VARCHAR}
</if>
<if test="changeType != null and changeType >= 0">
and CHANGE_TYPE = #{changeType,jdbcType=INTEGER}
</if>
<if test="status != null and status >= 0">
and STATUS = #{status,jdbcType=INTEGER}
</if>
<if test="createTime != null">
and CREATE_TIME = #{createTime,jdbcType=TIMESTAMP}
</if>
<if test="createStartTime != null and createStartTime != ''">
AND
<![CDATA[
DATEDIFF(#{createStartTime},CREATE_TIME)<=0
]]>
</if>
<if test="createEndTime != null and createEndTime != ''">
AND
<![CDATA[
DATEDIFF(#{createEndTime},CREATE_TIME)>=0
]]>
</if>
<if test="receiveTime != null">
and RECEIVE_TIME = #{receiveTime,jdbcType=TIMESTAMP}
</if>
<if test="receiveDoctorid != null and receiveDoctorid != ''">
and RECEIVE_DOCTORID = #{receiveDoctorid,jdbcType=VARCHAR}
</if>
<if test="scrreenId != null and scrreenId != ''">
and SCRREEN_ID = #{scrreenId,jdbcType=VARCHAR}
</if>
<if test="pid != null and pid != ''">
and pid = #{pid,jdbcType=VARCHAR}
</if>
</where>
</sql>
<select id="queryHighriskChangeHospital" resultMap="HighriskChangeHospitalResultMap"
parameterType="com.lyms.platform.permission.model.HighriskChangeHospitalQuery">
select
ID,TARGET_TYPE,TARGET_ID,OUT_ORGID,INTO_ORGID,DESCRIPTION,MUSTDESC,RISK,CHANGEWAY,APPLY_DOCTORID,CREATE_ID,CHANGE_TYPE,STATUS,CREATE_TIME,RECEIVE_TIME,RECEIVE_DOCTORID,SCRREEN_ID,pid
from HIGHRISK_CHANGE_HOSPITAL
<include refid="HighriskChangeHospitalCondition"/>
<include refid="orderAndLimit"/>
</select>
<select id="queryHighriskChangeHospitalCount" resultType="int"
parameterType="com.lyms.platform.permission.model.HighriskChangeHospitalQuery">
select count(1) from HIGHRISK_CHANGE_HOSPITAL
<include refid="HighriskChangeHospitalCondition"/>
</select>
</mapper>