MeasureDataInfoMapper.xml 20.1 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
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
<?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 valueOne,value_two valueTwo,value_three valueThree,value_type valueType
,record_count recordCount,created,modified,today_count todayCount,remark_value remarkValue,record_content recordContent
FROM measure_data_info
<include refid="queryMeasureDataInfoCondition"/>
<include refid="orderAndLimit"/>
</select>


<sql id="queryMeasureListCondition">
<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>
</where>
</sql>

<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
<include refid="queryMeasureListCondition"/>
order by m.created desc
<if test="need != null">
limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER}
</if>
</select>


<select id="queryMeasureListCount" parameterType="com.lyms.platform.query.MeasureDataInfoQuery"
resultType="int">
SELECT
count(m.id)
FROM measure_data_info m
LEFT JOIN
measure_user_info u ON m.measure_user_id = u.id
<include refid="queryMeasureListCondition"/>
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">
AND today_count = #{todayCount,jdbcType=INTEGER}
</if>
</where>
</sql>

<insert id="addMeasureBabyDataInfo" parameterType="com.lyms.platform.pojo.MeasureBabyInfoModel">
INSERT INTO measure_baby_info(
value_one,value_two,value_three,value_type
,record_count,created,modified,today_count,remark_value,hospital_id,baby_id,jing,pi,dan)
VALUES (#{valueOne}
,#{valueTwo},#{valueThree},#{valueType},#{recordCount},#{created},#{modified},#{todayCount},#{remarkValue},#{hospitalId},#{babyId},#{jing},#{pi},#{dan})
</insert>


<resultMap type="com.lyms.platform.pojo.MeasureBabyInfoModel" id="measureBabyDataInfoMap">
<result column="id" property="id"/>
<result column="hospital_id" property="hospitalId"/>
<result column="baby_id" property="babyId"/>
<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>


<sql id="queryMeasureBabyDataInfoCondition">
<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="babyId != null and babyId != ''">
and baby_id = #{babyId,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">
AND today_count = #{todayCount,jdbcType=INTEGER}
</if>
<if test="hospitalId != null">
AND hospital_id = #{hospitalId,jdbcType=VARCHAR}
</if>

<if test="babyIds != null and babyIds.size > 0">
and baby_id in
<foreach collection="babyIds" open="(" close=")" separator="," item="bid">
#{bid}
</foreach>
</if>

</where>
</sql>


<select id="queryMeasureBabyInfoList" resultMap="measureBabyDataInfoMap">
SELECT id,value_one,value_two,value_three,value_type
,record_count,created,modified,today_count,remark_value,hospital_id,baby_id,jing,pi,dan FROM measure_baby_info
<include refid="queryMeasureBabyDataInfoCondition"/>
<include refid="orderAndLimit"/>
</select>

<select id="queryMeasureBabyInfoCount" resultType="int">
SELECT count(1) FROM measure_baby_info
<include refid="queryMeasureBabyDataInfoCondition"/>
<include refid="orderAndLimit"/>
</select>


<update id="updateMeasureBabyDataInfo" parameterType="com.lyms.platform.pojo.MeasureBabyInfoModel">
UPDATE
measure_baby_info
<set>
<if test="id != null and id >= 0">
id = #{id,jdbcType=INTEGER},
</if>
<if test="babyId != null">
baby_id = #{babyId},
</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="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>
<if test="jing != null and jing != ''">
jing = #{jing,jdbcType=VARCHAR},
</if>
<if test="pi != null and pi != ''">
pi = #{pi,jdbcType=VARCHAR},
</if>
<if test="dan != null and dan != ''">
dan = #{dan,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>

<select id="queryOneMeasureBaby" resultMap="measureBabyDataInfoMap">
select baby_id,hospital_id,value_one,value_two,value_three,jing,pi,dan from measure_baby_info
where
<if test="babyId !=null">
baby_id= #{babyId,jdbcType=VARCHAR}
</if>
<if test="hospitalId!=null">
AND hospital_id=#{hospitalId,jdbcType=VARCHAR}
</if>

</select>

</mapper>