BusInfusionHistoryMapper.xml 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.coffee.bus.mapper.BusInfusionHistoryMapper">
  4. <resultMap id="combineResult" type="com.coffee.bus.service.dto.CombineResult">
  5. <result column="infusion_id" property="id"/>
  6. <result column="device_id" property="deviceId"/>
  7. <result column="classification" property="classification"/>
  8. <result column="data_num" property="dataNumber"/>
  9. <result column="clinic_id" property="clinicId"/>
  10. <result column="device_type" property="type"/>
  11. <result column="patient_code" property="patientCode"/>
  12. <result column="ward" property="ward"/>
  13. <result column="bed_no" property="bedNo"/>
  14. <result column="total_dose" property="totalDose"/>
  15. <result column="first_dose" property="firstDose"/>
  16. <result column="remain_dose" property="remainDose"/>
  17. <result column="input_dose" property="inputDose"/>
  18. <result column="append_dose" property="appendDose"/>
  19. <result column="append_lock_time" property="appendLockTime"/>
  20. <result column="max_dose" property="maxDose"/>
  21. <result column="self_control_count" property="selfControlCount"/>
  22. <result column="self_control_lock_time" property="selfControlLockTime"/>
  23. <result column="pca_valid_count" property="pcaValidCount"/>
  24. <result column="pca_invalid_count" property="pcaInvalidCount"/>
  25. <result column="pca_total_count" property="pcaTotalCount"/>
  26. <result column="continue_dose" property="continueDose"/>
  27. <result column="pulse_dose" property="pulseDose"/>
  28. <result column="pulse_first_lock_time" property="pulseFirstLockTime"/>
  29. <result column="pulse_lock_time" property="pulseLockTime"/>
  30. <result column="flow_up_cycle" property="flowUpCycle"/>
  31. <result column="flow_down_cycle" property="flowDownCycle"/>
  32. <result column="flow_count" property="flowCount"/>
  33. <result column="flow_up_limit" property="flowUpLimit"/>
  34. <result column="flow_down_limit" property="flowDownLimit"/>
  35. <result column="flow_adjust_rate" property="flowAdjustRate"/>
  36. <result column="electric_quantity" property="electricQuantity"/>
  37. <result column="run_state" property="runState"/>
  38. <result column="device_alarm" property="alarm"/>
  39. <result column="warn_flow" property="warnFlow"/>
  40. <result column="warn_analgesic_poor" property="warnAnalgesicPoor"/>
  41. <result column="warn_low_battery" property="warnLowBattery"/>
  42. <result column="warn_will_finished" property="warnWillFinished"/>
  43. <result column="infusion_start_time" property="infusionStartTime"/>
  44. <result column="patient_name" property="patientName"/>
  45. <result column="infusion_start_time" property="infusionStartTime"/>
  46. <result column="infusion_finished" property="infusionFinished"/>
  47. <result column="is_undo" property="isUndo"/>
  48. <result column="last_upload_time" property="lastUploadTime"/>
  49. <result column="undo_by" property="undoBy"/>
  50. <result column="destroyer" property="destroyer"/>
  51. <result column="witnesses" property="witnesses"/>
  52. <result column="undo_time" property="undoTime"/>
  53. <result column="surgery_name" property="surgeryName"/>
  54. <result column="asa" property="asa"/>
  55. <result column="patient_gender" property="patientGender"/>
  56. <result column="patient_name" property="patientName"/>
  57. <result column="patient_age" property="patientAge"/>
  58. <result column="weight" property="weight"/>
  59. <result column="height" property="height"/>
  60. <result column="ana_doctor" property="anaDoctor"/>
  61. <result column="ana_type" property="anaType"/>
  62. <result column="anal_type" property="analType"/>
  63. <result column="surgery_doctor" property="surgeryDoctor"/>
  64. <result column="surgery_name" property="surgeryName"/>
  65. <result column="formula" property="formula" typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
  66. <result column="entrust" property="entrust"/>
  67. </resultMap>
  68. <resultMap id="combineAlarmResult" type="com.coffee.bus.service.dto.CombineAlarmResult">
  69. <result column="device_type" property="type"/>
  70. <result column="infusion_id" property="id"/>
  71. <result column="infusion_start_time" property="infusionStartTime"/>
  72. <result column="cause" property="cause"/>
  73. <result column="alarm" property="isAlarm"/>
  74. <result column="run_state" property="runState"/>
  75. <result column="alarm_state" property="alarm"/>
  76. <result column="warn_will_finished" property="warnWillFinished"/>
  77. <result column="warn_analgesic_poor" property="warnAnalgesicPoor"/>
  78. <result column="warn_low_battery" property="warnLowBattery"/>
  79. <result column="warn_flow" property="warnFlow"/>
  80. </resultMap>
  81. <resultMap id="combineEvalResult" type="com.coffee.bus.service.dto.CombineEvalResult">
  82. <result column="infusion_id" property="id"/>
  83. <result column="eval_id" property="evalId"/>
  84. <result column="infusion_start_time" property="infusionStartTime"/>
  85. <result column="statics" property="statics"/>
  86. <result column="activity" property="activity"/>
  87. <result column="calm" property="calm"/>
  88. <result column="left_arm" property="leftArm"/>
  89. <result column="left_leg" property="leftLeg"/>
  90. <result column="right_arm" property="rightArm"/>
  91. <result column="right_leg" property="rightLeg"/>
  92. <result column="nausea_vomit" property="nauseaVomit"/>
  93. <result column="itch" property="itch"/>
  94. <result column="vertigo" property="vertigo"/>
  95. <result column="sore_throat" property="soreThroat"/>
  96. <result column="uroschesis" property="uroschesis"/>
  97. <result column="breath_depression" property="breathDepression"/>
  98. <result column="hoarseness" property="hoarseness"/>
  99. <result column="cognition_obstacle" property="cognitionObstacle"/>
  100. <result column="satisfaction" property="satisfaction"/>
  101. <result column="shrink_pressure" property="shrinkPressure"/>
  102. <result column="diastens_pressure" property="diastensPressure"/>
  103. <result column="heart_rate" property="heartRate"/>
  104. <result column="fetal_heart_rate" property="fetalHeartRate"/>
  105. <result column="breath_rate" property="breathRate"/>
  106. <result column="blood_oxygen_saturation" property="bloodOxygenSaturation"/>
  107. </resultMap>
  108. <select id="currentInClinic" resultType="com.coffee.bus.entity.BusInfusionHistoryEntity">
  109. select d.alias,i.* from
  110. (select * from bus_infusion_history where clinic_id=#{clinicId} ORDER BY start_time desc limit 1) as i
  111. left join bus_device as d on d.device_id=i.device_id
  112. </select>
  113. <select id="queryPage" resultMap="combineResult">
  114. select
  115. i.id as infusion_id,
  116. i.device_id as device_id,
  117. i.classification as classification,
  118. i.data_number as data_number,
  119. i.clinic_id as clinic_id,
  120. i.type as device_type,
  121. i.patient_code as patient_code,
  122. c.ward as ward,
  123. c.bed_no as bed_no,
  124. i.total_dose as total_dose,
  125. i.first_dose as first_dose,
  126. i.remain_dose as remain_dose,
  127. i.input_dose as input_dose,
  128. i.append_dose as append_dose,
  129. i.append_lock_time as append_lock_time,
  130. i.max_dose as max_dose,
  131. i.self_control_count as self_control_count,
  132. i.self_control_lock_time as self_control_lock_time,
  133. i.pca_valid_count as pca_valid_count,
  134. i.pca_invalid_count as pca_invalid_count,
  135. i.pca_total_count as pca_total_count,
  136. i.continue_dose as continue_dose,
  137. i.pulse_dose as pulse_dose,
  138. i.pulse_lock_time as pulse_lock_time,
  139. i.pulse_first_lock_time as pulse_first_lock_time,
  140. i.flow_up_cycle as flow_up_cycle,
  141. i.flow_down_cycle as flow_down_cycle,
  142. i.flow_count as flow_count,
  143. i.flow_up_limit as flow_up_limit,
  144. i.flow_down_limit as flow_down_limit,
  145. i.flow_adjust_rate as flow_adjust_rate,
  146. i.electric_quantity as electric_quantity,
  147. i.run_state as run_state,
  148. i.alarm as alarm,
  149. i.warn_will_finished as warn_will_finished,
  150. i.warn_analgesic_poor as warn_analgesic_poor,
  151. i.warn_low_battery as warn_low_battery,
  152. i.start_time as infusion_start_time,
  153. i.warn_flow as warn_flow,
  154. i.finished as infusion_finished,
  155. i.is_undo as is_undo,
  156. i.last_upload_time as last_upload_time,
  157. i.undo_by as undo_by,
  158. i.destroyer as destroyer,
  159. i.witnesses as witnesses,
  160. i.undo_time as undo_time,
  161. c.surgery_name as surgery_name,
  162. c.asa as asa,
  163. c.patient_gender as patient_gender,
  164. c.`patient_name` as patient_name,
  165. c.`patient_age` as patient_age,
  166. c.weight as weight,
  167. c.`height` as height,
  168. c.ana_doctor as ana_doctor,
  169. c.ana_type as ana_type,
  170. c.anal_type as anal_type,
  171. c.surgery_doctor as surgery_doctor,
  172. c.formula as formula,
  173. c.entrust as entrust
  174. from (select * from bus_infusion_history
  175. <where>
  176. <if test="query.startTimeRange != null and query.startTimeRange.size > 0">
  177. and start_time &gt; #{query.startTimeRange[0]}
  178. <if test="query.startTimeRange.size >1 ">
  179. and start_time &lt; #{query.startTimeRange[1]}
  180. </if>
  181. </if>
  182. <if test="query.undoTimeRange != null and query.undoTimeRange.size > 0">
  183. and undo_time &gt; #{query.undoTimeRange[0]}
  184. <if test="query.startTimeRange.size >1 ">
  185. and undo_time &lt; #{query.undoTimeRange[1]}
  186. </if>
  187. </if>
  188. <if test="query.deviceType != null">
  189. and device_type = #{query.deviceType}
  190. </if>
  191. <if test="query.deviceId != null">
  192. and device_id like concat('%',#{query.deviceId},'%')
  193. </if>
  194. <if test="query.finished != null">
  195. and device_id =#{query.finished}
  196. </if>
  197. <if test="query.validPcaCountRange != null and query.validPcaCountRange.size > 0">
  198. and pca_valid_count &gt; #{query.validPcaCountRange[0]}
  199. <if test="query.validPcaCountRange.size >1 ">
  200. and pca_valid_count &lt; #{query.validPcaCountRange[1]}
  201. </if>
  202. </if>
  203. <if test="query.inValidPcaCountRange != null and query.inValidPcaCountRange.size > 0">
  204. and pca_invalid_count &gt; #{query.inValidPcaCountRange[0]}
  205. <if test="query.inValidPcaCountRange.size >1 ">
  206. and pca_invalid_count &lt; #{query.inValidPcaCountRange[1]}
  207. </if>
  208. </if>
  209. <choose>
  210. <when test="query.warnWillFinished != false or query.warnAnalgesicPoor != false or query.warnLowBattery != false">
  211. and (
  212. <choose>
  213. <when test="query.warnWillFinished != false">warn_will_finished=1</when>
  214. <otherwise>warn_will_finished!=1</otherwise>
  215. </choose>
  216. <if test="query.warnAnalgesicPoor != false">or warn_analgesic_poor=1 </if>
  217. <if test="query.warnLowBattery != false"> or warn_low_battery=1 </if>
  218. <if test="query.warnFlow !=null">
  219. or warn_flow= #{query.warnFlow}
  220. </if>
  221. )
  222. </when>
  223. <otherwise>
  224. <if test="query.warnFlow !=null">
  225. and warn_flow= #{query.warnFlow}
  226. </if>
  227. </otherwise>
  228. </choose>
  229. </where>
  230. ) as i
  231. JOIN (select * from bus_clinic
  232. <where>
  233. <if test="query.patientCode != null">
  234. and patient_code like concat('%',#{query.patientCode},'%')
  235. </if>
  236. <if test="query.patientName != null">
  237. and patient_name like concat('%',#{query.patientName},'%')
  238. </if>
  239. <if test="query.patientGender != null">
  240. and patient_gender =#{query.patientGender}
  241. </if>
  242. <if test="query.ageRange != null and query.ageRange.size > 0">
  243. and patient_age &gt; #{query.ageRange[0]}
  244. <if test="query.ageRange.size >1 ">
  245. and patient_age &lt; #{query.ageRange[1]}
  246. </if>
  247. </if>
  248. <if test="query.weightRange != null and query.weightRange.size > 0">
  249. and weight &gt; #{query.weightRange[0]}
  250. <if test="query.weightRange.size >1 ">
  251. and weight &lt; #{query.weightRange[1]}
  252. </if>
  253. </if>
  254. <if test="query.asa != null">
  255. and asa like concat('%',#{query.asa},'%')
  256. </if>
  257. <if test="query.ward != null">
  258. and ward like concat('%',#{query.ward},'%')
  259. </if>
  260. <if test="query.bedNo != null">
  261. and bed_no like concat('%',#{query.bedNo},'%')
  262. </if>
  263. <if test="query.anaDoctor != null">
  264. and ana_doctor like concat('%',#{query.anaDoctor},'%')
  265. </if>
  266. <if test="query.anaType != null">
  267. and ana_type like concat('%',#{query.anaType},'%')
  268. </if>
  269. <if test="query.analType != null">
  270. and anal_type like concat('%',#{query.analType},'%')
  271. </if>
  272. <if test="query.drugName != null">
  273. and formula like concat('%',#{query.drugName},'%')
  274. </if>
  275. <if test="query.surgeryDoctor != null">
  276. and surgery_doctor like concat('%',#{query.surgeryDoctor},'%')
  277. </if>
  278. <if test="query.surgeryName != null">
  279. and surgery_name like concat('%',#{query.surgeryName},'%')
  280. </if>
  281. </where>
  282. ) as c
  283. on i.clinic_id=c.id
  284. <if test="(query.orderByDesc!=null and query.orderByDesc.size > 0) or (query.orderByAsc!=null and query.orderByAsc.size > 0)">
  285. order by
  286. </if>
  287. <if test="query.orderByDesc!=null and query.orderByDesc.size > 0">
  288. <foreach item="descItem" index="index" collection="query.orderByDesc" open="" separator="," close="">
  289. -- !!!!这里使用$不要使用#,否自只是对列名(字符串)进行排序,而不是进行列排序
  290. ${descItem} desc
  291. </foreach>
  292. </if>
  293. <if test="query.orderByAsc!=null and query.orderByAsc.size > 0">
  294. <if test="query.orderByDesc!=null and query.orderByDesc.size > 0">
  295. ,
  296. </if>
  297. <foreach item="ascItem" index="index" collection="query.orderByAsc" open="" separator="," close="">
  298. ${ascItem} asc
  299. </foreach>
  300. </if>
  301. </select>
  302. <select id="queryStatsAlarm" resultMap="combineAlarmResult">
  303. select
  304. i.type as device_type,
  305. i.id as infusion_id,
  306. i.start_time as infusion_start_time,
  307. a.cause as cause,
  308. i.patient_code as patient_code,
  309. a.alarm as alarm,
  310. a.run_state as run_state,
  311. a.alarm_state as alarm_state,
  312. a.warn_will_finished as warn_will_finished,
  313. a.warn_low_battery as warn_low_battery,
  314. a.warn_analgesic_poor as warn_analgesic_poor,
  315. a.warn_flow as warn_flow
  316. from (select * from bus_infusion_history
  317. <where>
  318. <if test="query.startTimeRange != null and query.startTimeRange.size > 0">
  319. and start_time &gt; #{query.startTimeRange[0]}
  320. <if test="query.startTimeRange.size >1 ">
  321. and start_time &lt; #{query.startTimeRange[1]}
  322. </if>
  323. </if>
  324. <if test="query.undoTimeRange != null and query.undoTimeRange.size > 0">
  325. and undo_time &gt; #{query.undoTimeRange[0]}
  326. <if test="query.startTimeRange.size >1 ">
  327. and undo_time &lt; #{query.undoTimeRange[1]}
  328. </if>
  329. </if>
  330. <if test="query.deviceType != null">
  331. and device_type = #{query.deviceType}
  332. </if>
  333. <if test="query.deviceId != null">
  334. and device_id like concat('%',#{query.deviceId},'%')
  335. </if>
  336. <if test="query.validPcaCountRange != null and query.validPcaCountRange.size > 0">
  337. and pca_valid_count &gt; #{query.validPcaCountRange[0]}
  338. <if test="query.validPcaCountRange.size >1 ">
  339. and pca_valid_count &lt; #{query.validPcaCountRange[1]}
  340. </if>
  341. </if>
  342. <if test="query.inValidPcaCountRange != null and query.inValidPcaCountRange.size > 0">
  343. and pca_invalid_count &gt; #{query.inValidPcaCountRange[0]}
  344. <if test="query.inValidPcaCountRange.size >1 ">
  345. and pca_invalid_count &lt; #{query.inValidPcaCountRange[1]}
  346. </if>
  347. </if>
  348. <choose>
  349. <when test="query.warnWillFinished != false or query.warnAnalgesicPoor != false or query.warnLowBattery != false">
  350. and (
  351. <choose>
  352. <when test="query.warnWillFinished != false">warn_will_finished=1</when>
  353. <otherwise>warn_will_finished!=1</otherwise>
  354. </choose>
  355. <if test="query.warnAnalgesicPoor != false">or warn_analgesic_poor=1 </if>
  356. <if test="query.warnLowBattery != false"> or warn_low_battery=1 </if>
  357. <if test="query.warnFlow !=null">
  358. or warn_flow= #{query.warnFlow}
  359. </if>
  360. )
  361. </when>
  362. <otherwise>
  363. <if test="query.warnFlow !=null">
  364. and warn_flow= #{query.warnFlow}
  365. </if>
  366. </otherwise>
  367. </choose>
  368. </where>
  369. ) as i
  370. JOIN (select * from bus_clinic
  371. <where>
  372. <if test="query.patientCode != null">
  373. and patient_code like concat('%',#{query.patientCode},'%')
  374. </if>
  375. <if test="query.patientName != null">
  376. and patient_name like concat('%',#{query.patientName},'%')
  377. </if>
  378. <if test="query.patientGender != null">
  379. and patient_gender =#{query.patientGender}
  380. </if>
  381. <if test="query.ageRange != null and query.ageRange.size > 0">
  382. and patient_age &gt; #{query.ageRange[0]}
  383. <if test="query.ageRange.size >1 ">
  384. and patient_age &lt; #{query.ageRange[1]}
  385. </if>
  386. </if>
  387. <if test="query.weightRange != null and query.weightRange.size > 0">
  388. and weight &gt; #{query.weightRange[0]}
  389. <if test="query.weightRange.size >1 ">
  390. and weight &lt; #{query.weightRange[1]}
  391. </if>
  392. </if>
  393. <if test="query.asa != null">
  394. and asa like concat('%',#{query.asa},'%')
  395. </if>
  396. <if test="query.ward != null">
  397. and ward like concat('%',#{query.ward},'%')
  398. </if>
  399. <if test="query.bedNo != null">
  400. and bed_no like concat('%',#{query.bedNo},'%')
  401. </if>
  402. <if test="query.anaDoctor != null">
  403. and ana_doctor like concat('%',#{query.anaDoctor},'%')
  404. </if>
  405. <if test="query.anaType != null">
  406. and ana_type like concat('%',#{query.anaType},'%')
  407. </if>
  408. <if test="query.analType != null">
  409. and anal_type like concat('%',#{query.analType},'%')
  410. </if>
  411. <if test="query.drugName != null">
  412. and formula like concat('%',#{query.drugName},'%')
  413. </if>
  414. <if test="query.surgeryDoctor != null">
  415. and surgery_doctor like concat('%',#{query.surgeryDoctor},'%')
  416. </if>
  417. <if test="query.surgeryName != null">
  418. and surgery_name like concat('%',#{query.surgeryName},'%')
  419. </if>
  420. </where>
  421. ) as c
  422. on i.clinic_id=c.id
  423. JOIN bus_device_alarm a on a.infusion_id = i.id
  424. </select>
  425. <select id="queryStatsAnal" resultMap="combineResult">
  426. select
  427. i.id as infusion_id,
  428. i.device_id as device_id,
  429. i.pca_valid_count as pca_valid_count,
  430. i.pca_invalid_count as pca_invalid_count,
  431. i.pca_total_count as pca_total_count,
  432. i.start_time as infusion_start_time,
  433. i.continue_dose as continue_dose,
  434. i.input_dose as input_dose,
  435. i.append_dose as append_dose,
  436. i.self_control_lock_time as self_control_lock_time,
  437. i.patient_code as patient_code,
  438. c.id as clinic_id,
  439. c.asa as asa,
  440. c.patient_gender as patient_gender,
  441. c.`patient_age` as patient_age,
  442. c.anal_type as anal_type,
  443. c.weight as weight,
  444. c.`height` as height
  445. from (select * from bus_infusion_history
  446. <where>
  447. <if test="query.startTimeRange != null and query.startTimeRange.size > 0">
  448. and start_time &gt; #{query.startTimeRange[0]}
  449. <if test="query.startTimeRange.size >1 ">
  450. and start_time &lt; #{query.startTimeRange[1]}
  451. </if>
  452. </if>
  453. <if test="query.undoTimeRange != null and query.undoTimeRange.size > 0">
  454. and undo_time &gt; #{query.undoTimeRange[0]}
  455. <if test="query.startTimeRange.size >1 ">
  456. and undo_time &lt; #{query.undoTimeRange[1]}
  457. </if>
  458. </if>
  459. <if test="query.deviceType != null">
  460. and device_type = #{query.deviceType}
  461. </if>
  462. <if test="query.deviceId != null">
  463. and device_id like concat('%',#{query.deviceId},'%')
  464. </if>
  465. <if test="query.validPcaCountRange != null and query.validPcaCountRange.size > 0">
  466. and pca_valid_count &gt; #{query.validPcaCountRange[0]}
  467. <if test="query.validPcaCountRange.size >1 ">
  468. and pca_valid_count &lt; #{query.validPcaCountRange[1]}
  469. </if>
  470. </if>
  471. <if test="query.inValidPcaCountRange != null and query.inValidPcaCountRange.size > 0">
  472. and pca_invalid_count &gt; #{query.inValidPcaCountRange[0]}
  473. <if test="query.inValidPcaCountRange.size >1 ">
  474. and pca_invalid_count &lt; #{query.inValidPcaCountRange[1]}
  475. </if>
  476. </if>
  477. <choose>
  478. <when test="query.warnWillFinished != false or query.warnAnalgesicPoor != false or query.warnLowBattery != false">
  479. and (
  480. <choose>
  481. <when test="query.warnWillFinished != false">warn_will_finished=1</when>
  482. <otherwise>warn_will_finished!=1</otherwise>
  483. </choose>
  484. <if test="query.warnAnalgesicPoor != false">or warn_analgesic_poor=1 </if>
  485. <if test="query.warnLowBattery != false"> or warn_low_battery=1 </if>
  486. <if test="query.warnFlow !=null">
  487. or warn_flow= #{query.warnFlow}
  488. </if>
  489. )
  490. </when>
  491. <otherwise>
  492. <if test="query.warnFlow !=null">
  493. and warn_flow= #{query.warnFlow}
  494. </if>
  495. </otherwise>
  496. </choose>
  497. </where>
  498. ) as i
  499. JOIN (select * from bus_clinic
  500. <where>
  501. <if test="query.patientCode != null">
  502. and patient_code like concat('%',#{query.patientCode},'%')
  503. </if>
  504. <if test="query.patientName != null">
  505. and patient_name like concat('%',#{query.patientName},'%')
  506. </if>
  507. <if test="query.patientGender != null">
  508. and patient_gender =#{query.patientGender}
  509. </if>
  510. <if test="query.ageRange != null and query.ageRange.size > 0">
  511. and patient_age &gt; #{query.ageRange[0]}
  512. <if test="query.ageRange.size >1 ">
  513. and patient_age &lt; #{query.ageRange[1]}
  514. </if>
  515. </if>
  516. <if test="query.weightRange != null and query.weightRange.size > 0">
  517. and weight &gt; #{query.weightRange[0]}
  518. <if test="query.weightRange.size >1 ">
  519. and weight &lt; #{query.weightRange[1]}
  520. </if>
  521. </if>
  522. <if test="query.asa != null">
  523. and asa like concat('%',#{query.asa},'%')
  524. </if>
  525. <if test="query.ward != null">
  526. and ward like concat('%',#{query.ward},'%')
  527. </if>
  528. <if test="query.bedNo != null">
  529. and bed_no like concat('%',#{query.bedNo},'%')
  530. </if>
  531. <if test="query.anaDoctor != null">
  532. and ana_doctor like concat('%',#{query.anaDoctor},'%')
  533. </if>
  534. <if test="query.anaType != null">
  535. and ana_type like concat('%',#{query.anaType},'%')
  536. </if>
  537. <if test="query.analType != null">
  538. and anal_type like concat('%',#{query.analType},'%')
  539. </if>
  540. <if test="query.drugName != null">
  541. and formula like concat('%',#{query.drugName},'%')
  542. </if>
  543. <if test="query.surgeryDoctor != null">
  544. and surgery_doctor like concat('%',#{query.surgeryDoctor},'%')
  545. </if>
  546. <if test="query.surgeryName != null">
  547. and surgery_name like concat('%',#{query.surgeryName},'%')
  548. </if>
  549. </where>
  550. ) as c
  551. on i.clinic_id=c.id
  552. </select>
  553. <select id="queryStatsEval" resultMap="combineEvalResult">
  554. select
  555. i.id as infusion_id,
  556. i.start_time as infusion_start_time,
  557. e.statics as statics,
  558. e.activity as activity,
  559. e.calm as calm,
  560. e.left_arm as left_arm,
  561. e.left_leg as left_leg,
  562. e.right_arm as right_arm,
  563. e.right_leg as right_leg,
  564. e.nausea_vomit as nausea_vomit,
  565. e.itch as itch,
  566. e.vertigo as vertigo,
  567. e.sore_throat as sore_throat,
  568. e.uroschesis as uroschesis,
  569. e.breath_depression as breath_depression,
  570. e.hoarseness as hoarseness,
  571. e.cognition_obstacle as cognition_obstacle,
  572. e.satisfaction as satisfaction,
  573. e.shrink_pressure as shrink_pressure,
  574. e.diastens_pressure as diastens_pressure,
  575. e.heart_rate as heart_rate,
  576. e.fetal_heart_rate as fetal_heart_rate,
  577. e.breath_rate as breath_rate,
  578. e.blood_oxygen_saturation as blood_oxygen_saturation,
  579. e.id as eval_id
  580. from (select * from bus_infusion_history
  581. <where>
  582. <if test="query.startTimeRange != null and query.startTimeRange.size > 0">
  583. and start_time &gt; #{query.startTimeRange[0]}
  584. <if test="query.startTimeRange.size >1 ">
  585. and start_time &lt; #{query.startTimeRange[1]}
  586. </if>
  587. </if>
  588. <if test="query.undoTimeRange != null and query.undoTimeRange.size > 0">
  589. and undo_time &gt; #{query.undoTimeRange[0]}
  590. <if test="query.startTimeRange.size >1 ">
  591. and undo_time &lt; #{query.undoTimeRange[1]}
  592. </if>
  593. </if>
  594. <if test="query.deviceType != null">
  595. and device_type = #{query.deviceType}
  596. </if>
  597. <if test="query.deviceId != null">
  598. and device_id like concat('%',#{query.deviceId},'%')
  599. </if>
  600. <if test="query.validPcaCountRange != null and query.validPcaCountRange.size > 0">
  601. and pca_valid_count &gt; #{query.validPcaCountRange[0]}
  602. <if test="query.validPcaCountRange.size >1 ">
  603. and pca_valid_count &lt; #{query.validPcaCountRange[1]}
  604. </if>
  605. </if>
  606. <if test="query.inValidPcaCountRange != null and query.inValidPcaCountRange.size > 0">
  607. and pca_invalid_count &gt; #{query.inValidPcaCountRange[0]}
  608. <if test="query.inValidPcaCountRange.size >1 ">
  609. and pca_invalid_count &lt; #{query.inValidPcaCountRange[1]}
  610. </if>
  611. </if>
  612. <choose>
  613. <when test="query.warnWillFinished != false or query.warnAnalgesicPoor != false or query.warnLowBattery != false">
  614. and (
  615. <choose>
  616. <when test="query.warnWillFinished != false">warn_will_finished=1</when>
  617. <otherwise>warn_will_finished!=1</otherwise>
  618. </choose>
  619. <if test="query.warnAnalgesicPoor != false">or warn_analgesic_poor=1 </if>
  620. <if test="query.warnLowBattery != false"> or warn_low_battery=1 </if>
  621. <if test="query.warnFlow !=null">
  622. or warn_flow= #{query.warnFlow}
  623. </if>
  624. )
  625. </when>
  626. <otherwise>
  627. <if test="query.warnFlow !=null">
  628. and warn_flow= #{query.warnFlow}
  629. </if>
  630. </otherwise>
  631. </choose>
  632. </where>
  633. ) as i
  634. JOIN (select * from bus_clinic
  635. <where>
  636. <if test="query.patientCode != null">
  637. and patient_code like concat('%',#{query.patientCode},'%')
  638. </if>
  639. <if test="query.patientName != null">
  640. and patient_name like concat('%',#{query.patientName},'%')
  641. </if>
  642. <if test="query.patientGender != null">
  643. and patient_gender =#{query.patientGender}
  644. </if>
  645. <if test="query.ageRange != null and query.ageRange.size > 0">
  646. and patient_age &gt; #{query.ageRange[0]}
  647. <if test="query.ageRange.size >1 ">
  648. and patient_age &lt; #{query.ageRange[1]}
  649. </if>
  650. </if>
  651. <if test="query.weightRange != null and query.weightRange.size > 0">
  652. and weight &gt; #{query.weightRange[0]}
  653. <if test="query.weightRange.size >1 ">
  654. and weight &lt; #{query.weightRange[1]}
  655. </if>
  656. </if>
  657. <if test="query.asa != null">
  658. and asa like concat('%',#{query.asa},'%')
  659. </if>
  660. <if test="query.ward != null">
  661. and ward like concat('%',#{query.ward},'%')
  662. </if>
  663. <if test="query.bedNo != null">
  664. and bed_no like concat('%',#{query.bedNo},'%')
  665. </if>
  666. <if test="query.anaDoctor != null">
  667. and ana_doctor like concat('%',#{query.anaDoctor},'%')
  668. </if>
  669. <if test="query.anaType != null">
  670. and ana_type like concat('%',#{query.anaType},'%')
  671. </if>
  672. <if test="query.analType != null">
  673. and anal_type like concat('%',#{query.analType},'%')
  674. </if>
  675. <if test="query.drugName != null">
  676. and formula like concat('%',#{query.drugName},'%')
  677. </if>
  678. <if test="query.surgeryDoctor != null">
  679. and surgery_doctor like concat('%',#{query.surgeryDoctor},'%')
  680. </if>
  681. <if test="query.surgeryName != null">
  682. and surgery_name like concat('%',#{query.surgeryName},'%')
  683. </if>
  684. </where>
  685. ) as c
  686. on i.clinic_id=c.id
  687. left join (select * from bus_evaluation) as e
  688. on e.infusion_id=i.id
  689. </select>
  690. </mapper>