MeasureDataInfoMapper.xml 10.6 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
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
<?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.MeasureDataInfoMapper">

<resultMap type="com.lyms.platform.pojo.MeasureDataInfoModel" id="measureDataInfoModelMap">
<result column="id" property="id"/>
<result column="measure_user_id" property="measureUserId"/>
<result column="value_one" property="valueOne"/>
<result column="value_two" property="valueTwo"/>
<result column="value_three" property="valueThree"/>
<result column="value_type" property="valueType"/>
<result column="record_count" property="recordCount"/>
<result column="created" property="created"/>
<result column="modified" property="modified"/>
<result column="today_count" property="todayCount"/>
<result column="remark_value" property="remarkValue"/>
</resultMap>


<resultMap type="com.lyms.platform.pojo.MeasureDataInfoModel" id="measureDataInfoModelMapList">
<id property="id" column="id"/>
<result column="measure_user_id" property="measureUserId"/>
<result column="value_one" property="valueOne"/>
<result column="value_two" property="valueTwo"/>
<result column="value_three" property="valueThree"/>
<result column="value_type" property="valueType"/>
<result column="record_count" property="recordCount"/>
<result column="created" property="created"/>
<result column="modified" property="modified"/>
<result column="today_count" property="todayCount"/>
<result column="record_content" property="recordContent"/>
<result column="remark_value" property="remarkValue"/>
<association property="measureUserInfoModel" javaType="com.lyms.platform.pojo.MeasureUserInfoModel">
<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"/>
</association>
</resultMap>
<insert id="addMeasureDataInfo" parameterType="com.lyms.platform.pojo.MeasureDataInfoModel" >
INSERT INTO measure_data_info(measure_user_id,
value_one,value_two,value_three,value_type
,record_count,created,modified,today_count,remark_value,record_content)
VALUES (#{measureUserId},#{valueOne}
,#{valueTwo},#{valueThree},#{valueType},#{recordCount},#{created},#{modified},#{todayCount},#{remarkValue},#{recordContent})
</insert>

<select id="queryMeasureDataInfoList" parameterType="com.lyms.platform.query.MeasureDataInfoQuery"
resultMap="measureDataInfoModelMap">
SELECT id,measure_user_id,
value_one,value_two,value_three,value_type
,record_count,created,modified,today_count,remark_value,record_content
FROM measure_data_info
<include refid="queryMeasureDataInfoCondition"/>
<include refid="orderAndLimit"/>
</select>

<select id="queryMeasureList" parameterType="com.lyms.platform.query.MeasureDataInfoQuery"
resultMap="measureDataInfoModelMapList">
SELECT
m.id,
m.measure_user_id,
m.value_one,m.value_two,m.value_three,m.value_type,
m.record_count,m.created,m.modified,
m.today_count,m.remark_value,
m.record_content,
u.user_name,u.cert_type,
u.cert_no,u.age,u.phone,u.sex,u.vc_card_no,
u.hospital_id,u.patient_id,u.address,u.face,u.finger
FROM measure_data_info m
LEFT JOIN
measure_user_info u ON m.measure_user_id = u.id
WHERE 1 = 1
<if test="id != null and id >= 0">
and m.id = #{id,jdbcType=INTEGER}
</if>
<if test="valueOne != null and valueOne != ''">
and m.value_one = #{valueOne,jdbcType=VARCHAR}
</if>
<if test="valueTwo != null and valueTwo != ''">
and m.value_two = #{valueTwo,jdbcType=VARCHAR}
</if>
<if test="valueThree != null and valueThree != ''">
and m.value_three = #{valueThree,jdbcType=VARCHAR}
</if>
<if test="valueType != null and valueType > 0">
and m.value_type = #{valueType,jdbcType=INTEGER}
</if>
<if test="created != null">
AND date_format(m.created,'%Y-%m-%d') = #{created}
</if>
<if test="recordCount != null and recordCount >= 0">
and m.record_count = #{m.recordCount,jdbcType=INTEGER}
</if>

<if test="modified != null">
AND date_format(m.modified,'%Y-%m-%d') = #{modified}
</if>

<if test="createdTimeStart != null">
AND m.created >= date_format(#{createdTimeStart},'%Y-%m-%d')
</if>
<if test="createdTimeEnd != null">
AND <![CDATA[ m.created < date_format(#{createdTimeEnd},'%Y-%m-%d') ]]>
</if>

<if test="modifiedTimeStart != null">
AND m.modified >= date_format(#{modifiedTimeStart},'%Y-%m-%d')
</if>
<if test="modifiedTimeEnd != null">
AND <![CDATA[ m.modified < date_format(#{modifiedTimeEnd},'%Y-%m-%d') ]]>
</if>

<if test="todayCount != null and todayCount > 0">
m.today_count = #{todayCount,jdbcType=INTEGER},
</if>

<if test="queryNo != null and queryNo != ''">
and (u.phone = #{queryNo,jdbcType=VARCHAR} or u.cert_no = #{queryNo,jdbcType=VARCHAR}
or u.user_name = #{queryNo,jdbcType=VARCHAR})
</if>

<if test="hospitalId != null and hospitalId != ''">
and u.hospital_id = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="hospitalIds != null and hospitalIds.size() > 0">
and u.hospital_id in
<foreach collection="hospitalIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="address != null and address != ''">
and u.address = #{address,jdbcType=VARCHAR}
</if>
<if test="face != null and face != ''">
and u.face = #{face,jdbcType=VARCHAR}
</if>
<if test="finger != null and finger != ''">
and u.finger = #{finger,jdbcType=VARCHAR}
</if>

<if test="userName != null">
and u.user_name = #{userName,jdbcType=VARCHAR}
</if>
<if test="certType != null and certType != ''">
and u.cert_type = #{certType,jdbcType=VARCHAR}
</if>
<if test="certNo != null and certNo != ''">
and u.cert_no = #{certNo,jdbcType=VARCHAR}
</if>
<if test="age != null and age != ''">
and u.age = #{age,jdbcType=VARCHAR}
</if>
<if test="phone != null and phone != ''">
and u.phone = #{phone,jdbcType=VARCHAR}
</if>
<if test="sex != null">
and u.sex = #{sex,jdbcType=INTEGER}
</if>
<if test="vcCardNo != null and vcCardNo != ''">
and u.vc_card_no = #{vcCardNo,jdbcType=VARCHAR}
</if>
<if test="zyNo != null and zyNo != ''">
and u.zy_no = #{zyNo,jdbcType=VARCHAR}
</if>
<if test="visitId != null and visitId != ''">
and u.visit_id = #{visitId,jdbcType=VARCHAR}
</if>
<if test="patientId != null and patientId != ''">
and u.patient_id = #{valueOne,jdbcType=VARCHAR}
</if>
order by m.created desc
<if test="need != null">
limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER}
</if>
</select>

<select id="queryMeasureDataInfoListCount" parameterType="com.lyms.platform.query.MeasureDataInfoQuery" resultType="int">
SELECT count(id) FROM measure_data_info
<include refid="queryMeasureDataInfoCondition"/>
</select>


<update id="updateMeasureDataInfo" parameterType="com.lyms.platform.pojo.MeasureDataInfoModel" >
UPDATE
measure_data_info
<set>
<if test="id != null and id >= 0">
id = #{id,jdbcType=INTEGER},
</if>
<if test="measureUserId != null">
measure_user_id = #{measureUserId},
</if>

<if test="valueOne != null and valueOne != ''">
value_one = #{valueOne,jdbcType=VARCHAR},
</if>
<if test="valueTwo != null and valueTwo != ''">
value_two = #{valueTwo,jdbcType=VARCHAR},
</if>
<if test="valueThree != null and valueThree != ''">
value_three = #{valueThree,jdbcType=VARCHAR},
</if>
<if test="valueType != null and valueType > 0">
value_type = #{valueType,jdbcType=INTEGER},
</if>
<if test="recordCount != null and recordCount >= 0">
record_count = #{recordCount,jdbcType=INTEGER},
</if>
<if test="recordContent != null">
record_content = #{recordContent,jdbcType=VARCHAR},
</if>
<if test="created != null">
created = #{created},
</if>
<if test="modified != null">
modified = #{modified},
</if>
<if test="todayCount != null and todayCount > 0">
today_count = #{todayCount,jdbcType=INTEGER},
</if>
<if test="remarkValue != null and remarkValue != ''">
remark_value = #{remarkValue,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="queryMeasureDataInfoCondition">
<where>
1 = 1
<if test="id != null and id >= 0">
and id = #{id,jdbcType=INTEGER}
</if>
<if test="valueOne != null and valueOne != ''">
and value_one = #{valueOne,jdbcType=VARCHAR}
</if>
<if test="valueTwo != null and valueTwo != ''">
and value_two = #{valueTwo,jdbcType=VARCHAR}
</if>
<if test="valueThree != null and valueThree != ''">
and value_three = #{valueThree,jdbcType=VARCHAR}
</if>
<if test="valueType != null and valueType > 0">
and value_type = #{valueType,jdbcType=INTEGER}
</if>
<if test="created != null">
AND date_format(created,'%Y-%m-%d') = #{created}
</if>
<if test="recordCount != null and recordCount >= 0">
and record_count = #{recordCount,jdbcType=INTEGER}
</if>

<if test="measureUserId != null and measureUserId >= 0">
and measure_user_id = #{measureUserId,jdbcType=INTEGER}
</if>

<if test="recordContent != null">
and record_content = #{recordContent,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="todayCount != null and todayCount > 0">
today_count = #{todayCount,jdbcType=INTEGER},
</if>
</where>
</sql>
</mapper>