BabyDiagnoseMapper.xml 5.37 KB
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
<?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.BabyDiagnoseMapper">

<resultMap id="babyDiagnoseResultMap" type="com.lyms.platform.pojo.BabyDiagnoseModel">
<result column="blh" property="blh"/>
<result column="syxh" property="syxh"/>
<result column="hzxm" property="hzxm"/>
<result column="sex" property="sex"/>
<result column="birth" property="birth"/>
<result column="birthtime" property="birthtime"/>
<result column="cyzddm" property="cyzddm"/>
<result column="cyzdmc" property="cyzdmc"/>
<result column="sfzh" property="sfzh"/>
<result column="lxdh" property="lxdh"/>
<result column="lxdz" property="lxdz"/>
<result column="lxr" property="lxr"/>
<result column="lxrdh" property="lxrdh"/>
<result column="curraddr" property="curraddr"/>
<result column="cyrq" property="cyrq"/>
<result column="lrrq" property="lrrq"/>
<result column="rqrq" property="rqrq"/>
<result column="ryrq" property="ryrq"/>
<result column="cqrq" property="cqrq"/>
<result column="ksdm" property="ksdm"/>
<result column="bqdm" property="bqdm"/>
<result column="mblh" property="mblh"/>
<result column="msyxh" property="msyxh"/>

<result column="isbuild" property="isbuild"/>
</resultMap>


<insert id="addBabyDiagnose" parameterType="com.lyms.platform.pojo.BabyDiagnoseModel">
<selectKey order="AFTER" keyProperty="id" resultType="java.lang.Integer">SELECT LAST_INSERT_ID()</selectKey>
INSERT INTO lyms_baby_diagnose
(blh,syxh,hzxm,birth,
birthtime,sex,sfzh,lxdh,lxdz,lxr,lxrdh,
curraddr,lrrq,ryrq,rqrq,cyrq,cqrq,cyzddm,
cyzdmc,ksdm,bqdm,mblh,msyxh,isbuild)
VALUES (#{blh},#{syxh},#{hzxm},#{birth},
#{birthtime},#{sex},#{sfzh},#{lxdh},#{lxdz},#{lxr},#{lxrdh},
#{curraddr},#{lrrq},#{ryrq},#{rqrq},#{cyrq},#{cqrq},#{cyzddm},
#{cyzdmc},#{ksdm},#{bqdm},#{mblh},#{msyxh},#{isbuild})
</insert>

<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>

<select id="queryBabyDiagnoses" parameterType="java.util.Map" resultType="com.lyms.platform.pojo.BabyDiagnoseModel">
SELECT
id,blh,syxh,hzxm,py,wb,birth,
birthtime,sex,sfzh,lxdh,lxdz,lxr,lxrdh,
curraddr,lrrq,ryrq,rqrq,cyrq,cqrq,cyzddm,
cyzdmc,ksdm,bqdm,mblh,msyxh,isbuild
FROM lyms_baby_diagnose
WHERE 1 = 1
<if test="id != null">
and id = #{id,jdbcType=INTEGER}
</if>
<if test="blh != null and blh != ''">
and blh = #{blh,jdbcType=VARCHAR}
</if>
<if test="syxh != null and syxh != ''">
and syxh = #{syxh,jdbcType=VARCHAR}
</if>
<include refid="orderAndLimit"/>
</select>


<update id="updateBabyDiagnose" parameterType="com.lyms.platform.pojo.BabyDiagnoseModel">
UPDATE
lyms_baby_diagnose
<set>
<if test="isbuild != null">
isbuild = #{isbuild,jdbcType=INTEGER},
</if>
</set>
where blh = #{blh,jdbcType=VARCHAR}

</update>

<sql id="babyDiagnosesCondition">
<where>
1=1
<if test="startDischargeDate != null and startDischargeDate!=''">
AND
<![CDATA[
DATEDIFF(#{startDischargeDate},cyrq)<=0
]]>
</if>
<if test="endDischargeDate != null and endDischargeDate!=''">
AND
<![CDATA[
DATEDIFF(#{endDischargeDate},cyrq)>=0
]]>
</if>
<if test="startBirthDate != null and startBirthDate!=''">
AND
<![CDATA[
DATEDIFF(#{startBirthDate},birth)<=0
]]>
</if>
<if test="endBirthDate != null and endBirthDate!=''">
AND
<![CDATA[
DATEDIFF(#{endBirthDate},birth)>=0
]]>
</if>
<if test="hospitalizationNo != null and hospitalizationNo != ''">
and blh = #{hospitalizationNo}
</if>
<if test="babyName != null and babyName!=''">
and hzxm =#{babyName}
</if>
<if test="finalDiagnosis != null and finalDiagnosis!= '' ">
and cyzddm like CONCAT(#{finalDiagnosis},'%')
</if>
<if test="isbuild != null">
and isbuild = #{isbuild}
</if>
</where>
</sql>


<select id="queryBabyDiagnosesList" parameterType="com.lyms.platform.permission.model.BabyDiagnoseQuery"
resultMap="babyDiagnoseResultMap">
SELECT
id,blh,syxh,hzxm,birth,
birthtime,sex,sfzh,lxdh,lxdz,lxr,lxrdh,
curraddr,lrrq,ryrq,rqrq,cyrq,cqrq,cyzddm,
cyzdmc,ksdm,bqdm,mblh,msyxh,isbuild
FROM lyms_baby_diagnose
<include refid="babyDiagnosesCondition"/>
<include refid="orderAndLimit"/>
</select>

</mapper>