InpGluMapper.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  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.xinxin.topro.inpnurseservice.mysqlmapper.InpGluMapper" >
  4. <resultMap id="BaseResultMap" type="com.xinxin.topro.inpnurseservice.mysqlmodel.InpGlu" >
  5. <id column="GLU_ID" property="gluId" jdbcType="INTEGER" />
  6. <result column="PatientNo" property="patientno" jdbcType="VARCHAR" />
  7. <result column="HI_ID" property="hiId" jdbcType="INTEGER" />
  8. <result column="DD_DepDm" property="ddDepdm" jdbcType="VARCHAR" />
  9. <result column="DW_WardDm" property="dwWarddm" jdbcType="VARCHAR" />
  10. <result column="DB_BedNo" property="dbBedno" jdbcType="VARCHAR" />
  11. <result column="GLU_Measure_Time" property="gluMeasureTime" jdbcType="TIMESTAMP" />
  12. <result column="GLU_Recordor" property="gluRecordor" jdbcType="VARCHAR" />
  13. <result column="GLU_Record_Time" property="gluRecordTime" jdbcType="TIMESTAMP" />
  14. <result column="GLU_Source" property="gluSource" jdbcType="INTEGER" />
  15. <result column="GLU_Value" property="gluValue" jdbcType="VARCHAR" />
  16. <result column="GLU_Time_Point" property="gluTimePoint" jdbcType="VARCHAR" />
  17. <result column="GLU_Unit" property="gluUnit" jdbcType="VARCHAR" />
  18. <result column="GLU_Nurse_Record" property="gluNurseRecord" jdbcType="VARCHAR" />
  19. <result column="GLU_IsRecord" property="gluIsrecord" jdbcType="INTEGER" />
  20. <result column="GLU_Operation_Time" property="gluOperationTime" jdbcType="TIMESTAMP" />
  21. <result column="GLU_Operator" property="gluOperator" jdbcType="VARCHAR" />
  22. <result column="GLU_IsDel" property="gluIsdel" jdbcType="INTEGER" />
  23. <result column="GLU_FormerID" property="gluFormerid" jdbcType="INTEGER" />
  24. <result column="GLU_IsAbnormal" property="gluIsabnormal" jdbcType="INTEGER" />
  25. <result column="GLU_Abnormal_Reason" property="gluAbnormalReason" jdbcType="VARCHAR" />
  26. <result column="GLU_Original" property="gluOriginal" jdbcType="VARCHAR" />
  27. <result column="GLU_Original_ID" property="gluOriginalId" jdbcType="INTEGER" />
  28. </resultMap>
  29. <resultMap id="ResultMap" type="com.xinxin.topro.inpnurseservice.vo.GluScheduleVO" >
  30. <id column="gluId" property="gluId" jdbcType="INTEGER" />
  31. <result column="visitno" property="visitno" jdbcType="VARCHAR" />
  32. <result column="bedno" property="bedno" jdbcType="VARCHAR" />
  33. <result column="ptname" property="ptname" jdbcType="VARCHAR" />
  34. <result column="chartno" property="chartno" jdbcType="VARCHAR" />
  35. <result column="gluValue" property="gluValue" jdbcType="VARCHAR" />
  36. <result column="gluAbnormalReason" property="gluAbnormalReason" jdbcType="VARCHAR" />
  37. <result column="sort" property="sort" jdbcType="VARCHAR" />
  38. <result column="measureTime" property="measureTime" jdbcType="TIMESTAMP" />
  39. <result column="timePoint" property="timePoint" jdbcType="VARCHAR" />
  40. </resultMap>
  41. <resultMap id="PDAMap" type="com.xinxin.topro.inpnurseservice.vo.PDAGluVO" >
  42. <result column="visitno" property="visitno" jdbcType="VARCHAR" />
  43. <result column="bedno" property="bedno" jdbcType="VARCHAR" />
  44. <result column="ptname" property="ptname" jdbcType="VARCHAR" />
  45. <result column="timePoint" property="timePoint" jdbcType="VARCHAR" />
  46. <result column="gluValue" property="gluValue" jdbcType="VARCHAR" />
  47. <result column="status" property="status" jdbcType="INTEGER" />
  48. </resultMap>
  49. <select id="newSelectSelective" resultMap="BaseResultMap" parameterType="java.lang.String" >
  50. SELECT
  51. a.GLU_ID, a.PatientNo, a.HI_ID, a.DD_DepDm, a.DW_WardDm, a.DB_BedNo, a.GLU_Measure_Time, a.GLU_Recordor,
  52. a.GLU_Record_Time, a.GLU_Source, a.GLU_Time_Point, a.GLU_Unit, g.IRM_Record GLU_Nurse_Record,
  53. a.GLU_IsRecord, a.GLU_Operation_Time, a.GLU_Operator, a.GLU_IsDel, a.GLU_FormerID, a.GLU_IsAbnormal,
  54. a.GLU_Abnormal_Reason,
  55. b.ui_name gluRecordorName,e.SDD_Detail_Name gluTimePointName,
  56. case when a.glu_abnormal_reason is null or a.glu_abnormal_reason = '' then a.glu_value else f.SDD_Detail_Name end glu_value
  57. from inp_glu a
  58. LEFT JOIN sys_userinfo b on a.glu_recordor = b.ui_code
  59. LEFT JOIN (SELECT SDD_Detail_Code,SDD_Detail_Name from sys_dictionary_detail c
  60. INNER JOIN sys_dictionary d on c.SD_ID = d.SD_ID and d.SD_DicDM = 'opportunity') e
  61. on a.GLU_Time_Point = e.SDD_Detail_Code
  62. LEFT JOIN (SELECT SDD_Detail_Code,SDD_Detail_Name from sys_dictionary_detail c
  63. INNER JOIN sys_dictionary d on c.SD_ID = d.SD_ID and d.SD_DicDM = 'glu_abnormal_reason') f
  64. on a.glu_abnormal_reason = f.SDD_Detail_Code
  65. LEFT JOIN inp_remark g ON a.PatientNo = g.PatientNo AND a.GLU_Measure_Time = g.IRM_Measure_Time
  66. LEFT JOIN inp_remark_original h ON g.irm_id = h.irm_id
  67. AND h.iro_original = 'BloodGlucose'
  68. AND g.irm_isdel = 0
  69. AND h.iro_isdel = 0
  70. where 1 = 1
  71. <if test="patientNo != null" >
  72. and a.PatientNo = #{patientNo,jdbcType=INTEGER}
  73. </if>
  74. <if test="startTime != null" >
  75. and a.glu_measure_time &gt;= #{startTime,jdbcType=TIMESTAMP}
  76. </if>
  77. <if test="endTime != null" >
  78. and a.glu_measure_time &lt;= #{endTime,jdbcType=TIMESTAMP}
  79. </if>
  80. and GLU_IsDel = 0
  81. ORDER BY GLU_Measure_Time desc
  82. </select>
  83. <sql id="Base_Column_List" >
  84. GLU_ID, PatientNo, HI_ID, DD_DepDm, DW_WardDm, DB_BedNo, GLU_Measure_Time, GLU_Recordor,
  85. GLU_Record_Time, GLU_Source, GLU_Value, GLU_Time_Point, GLU_Unit, GLU_Nurse_Record,
  86. GLU_IsRecord, GLU_Operation_Time, GLU_Operator, GLU_IsDel, GLU_FormerID, GLU_IsAbnormal,
  87. GLU_Abnormal_Reason, GLU_Original, GLU_Original_ID
  88. </sql>
  89. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  90. select
  91. <include refid="Base_Column_List" />
  92. from inp_glu
  93. where GLU_ID = #{gluId,jdbcType=INTEGER}
  94. </select>
  95. <select id="selectGlu" resultMap="BaseResultMap" >
  96. SELECT b.IRM_Record GLU_Nurse_Record, a.* from inp_glu a
  97. LEFT JOIN inp_remark b on a.PatientNo = b.PatientNo
  98. and a.GLU_Measure_Time = b.IRM_Measure_Time
  99. and b.IRM_IsDel=0
  100. where DATE_FORMAT(a.GLU_Measure_Time,'%Y-%m-%d %H:%i') = #{measureTime,jdbcType=VARCHAR}
  101. and a.GLU_IsDel = 0
  102. and a.PatientNo = #{patientNo,jdbcType=INTEGER}
  103. </select>
  104. <select id="selectSelective" resultMap="BaseResultMap" parameterType="java.lang.String" >
  105. SELECT
  106. a.GLU_ID, a.PatientNo, a.HI_ID, a.DD_DepDm, a.DW_WardDm, a.DB_BedNo, a.GLU_Measure_Time, a.GLU_Recordor,
  107. a.GLU_Record_Time, a.GLU_Source, a.GLU_Time_Point, a.GLU_Unit, p.IRM_Record GLU_Nurse_Record,
  108. a.GLU_IsRecord, a.GLU_Operation_Time, a.GLU_Operator, a.GLU_IsDel, a.GLU_FormerID, a.GLU_IsAbnormal,
  109. a.GLU_Abnormal_Reason,
  110. b.ui_name gluRecordorName,e.SDD_Detail_Name gluTimePointName,
  111. case when a.glu_abnormal_reason is null or a.glu_abnormal_reason = '' then a.glu_value else f.SDD_Detail_Name end glu_value
  112. from inp_glu a
  113. LEFT JOIN sys_userinfo b on a.glu_recordor = b.ui_code
  114. LEFT JOIN (SELECT SDD_Detail_Code,SDD_Detail_Name from sys_dictionary_detail c
  115. INNER JOIN sys_dictionary d on c.SD_ID = d.SD_ID and d.SD_DicDM = 'opportunity') e
  116. on a.GLU_Time_Point = e.SDD_Detail_Code
  117. LEFT JOIN (SELECT SDD_Detail_Code,SDD_Detail_Name from sys_dictionary_detail c
  118. INNER JOIN sys_dictionary d on c.SD_ID = d.SD_ID and d.SD_DicDM = 'glu_abnormal_reason') f
  119. on a.glu_abnormal_reason = f.SDD_Detail_Code
  120. LEFT JOIN (SELECT g.PatientNo,g.IRM_Measure_Time,g.IRM_Record from inp_remark g
  121. INNER JOIN inp_remark_original h on g.irm_id = h.irm_id and h.iro_original = 'BloodGlucose'
  122. and g.irm_isdel = 0 and h.iro_isdel = 0
  123. ) p on a.PatientNo = p.PatientNo and a.GLU_Measure_Time = p.IRM_Measure_Time
  124. where 1 = 1
  125. <if test="patientNo != null" >
  126. and a.PatientNo = #{patientNo,jdbcType=INTEGER}
  127. </if>
  128. <if test="startTime != null" >
  129. and a.glu_measure_time &gt;= #{startTime,jdbcType=TIMESTAMP}
  130. </if>
  131. <if test="endTime != null" >
  132. and a.glu_measure_time &lt;= #{endTime,jdbcType=TIMESTAMP}
  133. </if>
  134. and GLU_IsDel = 0
  135. ORDER BY GLU_Measure_Time desc
  136. </select>
  137. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  138. delete from inp_glu
  139. where GLU_ID = #{gluId,jdbcType=INTEGER}
  140. </delete>
  141. <insert id="insert" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.InpGlu" useGeneratedKeys="true" keyColumn="GLU_ID" keyProperty="gluId">
  142. insert into inp_glu (GLU_ID, PatientNo, HI_ID,
  143. DD_DepDm, DW_WardDm, DB_BedNo,
  144. GLU_Measure_Time, GLU_Recordor, GLU_Record_Time,
  145. GLU_Source, GLU_Value, GLU_Time_Point,
  146. GLU_Unit, GLU_Nurse_Record, GLU_IsRecord,
  147. GLU_Operation_Time, GLU_Operator, GLU_IsDel,
  148. GLU_FormerID, GLU_IsAbnormal, GLU_Abnormal_Reason,
  149. GLU_Original, GLU_Original_ID
  150. )
  151. values (#{gluId,jdbcType=INTEGER}, #{patientno,jdbcType=INTEGER}, #{hiId,jdbcType=INTEGER},
  152. #{ddDepdm,jdbcType=VARCHAR}, #{dwWarddm,jdbcType=VARCHAR}, #{dbBedno,jdbcType=VARCHAR},
  153. #{gluMeasureTime,jdbcType=TIMESTAMP}, #{gluRecordor,jdbcType=VARCHAR}, #{gluRecordTime,jdbcType=TIMESTAMP},
  154. #{gluSource,jdbcType=INTEGER}, #{gluValue,jdbcType=VARCHAR}, #{gluTimePoint,jdbcType=VARCHAR},
  155. #{gluUnit,jdbcType=VARCHAR}, #{gluNurseRecord,jdbcType=VARCHAR}, #{gluIsrecord,jdbcType=INTEGER},
  156. #{gluOperationTime,jdbcType=TIMESTAMP}, #{gluOperator,jdbcType=VARCHAR}, #{gluIsdel,jdbcType=INTEGER},
  157. #{gluFormerid,jdbcType=INTEGER}, #{gluIsabnormal,jdbcType=INTEGER}, #{gluAbnormalReason,jdbcType=VARCHAR},
  158. #{gluOriginal,jdbcType=VARCHAR}, #{gluOriginalId,jdbcType=INTEGER}
  159. )
  160. </insert>
  161. <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="GLU_ID" keyProperty="gluId">
  162. insert into inp_glu (GLU_ID, PatientNo, HI_ID,
  163. DD_DepDm, DW_WardDm, DB_BedNo,
  164. GLU_Measure_Time, GLU_Recordor, GLU_Record_Time,
  165. GLU_Source, GLU_Value, GLU_Time_Point,
  166. GLU_Unit, GLU_Nurse_Record, GLU_IsRecord,
  167. GLU_Operation_Time, GLU_Operator, GLU_IsDel,
  168. GLU_FormerID, GLU_IsAbnormal, GLU_Abnormal_Reason
  169. )
  170. values
  171. <foreach collection="list" item="item" separator=",">
  172. (#{item.gluId,jdbcType=INTEGER}, #{item.patientno,jdbcType=INTEGER}, #{item.hiId,jdbcType=INTEGER},
  173. #{item.ddDepdm,jdbcType=VARCHAR}, #{item.dwWarddm,jdbcType=VARCHAR}, #{item.dbBedno,jdbcType=VARCHAR},
  174. #{item.gluMeasureTime,jdbcType=TIMESTAMP}, #{item.gluRecordor,jdbcType=VARCHAR}, #{item.gluRecordTime,jdbcType=TIMESTAMP},
  175. #{item.gluSource,jdbcType=INTEGER}, #{item.gluValue,jdbcType=VARCHAR}, #{item.gluTimePoint,jdbcType=VARCHAR},
  176. #{item.gluUnit,jdbcType=VARCHAR}, #{item.gluNurseRecord,jdbcType=VARCHAR}, #{item.gluIsrecord,jdbcType=INTEGER},
  177. #{item.gluOperationTime,jdbcType=TIMESTAMP}, #{item.gluOperator,jdbcType=VARCHAR}, #{item.gluIsdel,jdbcType=INTEGER},
  178. #{item.gluFormerid,jdbcType=INTEGER}, #{item.gluIsabnormal,jdbcType=INTEGER}, #{item.gluAbnormalReason,jdbcType=VARCHAR}
  179. )
  180. </foreach>
  181. </insert>
  182. <update id="deleteByIds" parameterType="java.util.List" >
  183. update inp_glu
  184. set GLU_IsDel = -1
  185. where GLU_ID in <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  186. #{item.gluId,jdbcType=INTEGER}
  187. </foreach>
  188. </update>
  189. <insert id="insertSelective" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.InpGlu" useGeneratedKeys="true" keyColumn="GLU_ID" keyProperty="gluId">
  190. insert into inp_glu
  191. <trim prefix="(" suffix=")" suffixOverrides="," >
  192. <if test="gluId != null" >
  193. GLU_ID,
  194. </if>
  195. <if test="patientno != null" >
  196. PatientNo,
  197. </if>
  198. <if test="hiId != null" >
  199. HI_ID,
  200. </if>
  201. <if test="ddDepdm != null" >
  202. DD_DepDm,
  203. </if>
  204. <if test="dwWarddm != null" >
  205. DW_WardDm,
  206. </if>
  207. <if test="dbBedno != null" >
  208. DB_BedNo,
  209. </if>
  210. <if test="gluMeasureTime != null" >
  211. GLU_Measure_Time,
  212. </if>
  213. <if test="gluRecordor != null" >
  214. GLU_Recordor,
  215. </if>
  216. <if test="gluRecordTime != null" >
  217. GLU_Record_Time,
  218. </if>
  219. <if test="gluSource != null" >
  220. GLU_Source,
  221. </if>
  222. <if test="gluValue != null" >
  223. GLU_Value,
  224. </if>
  225. <if test="gluTimePoint != null" >
  226. GLU_Time_Point,
  227. </if>
  228. <if test="gluUnit != null" >
  229. GLU_Unit,
  230. </if>
  231. <if test="gluNurseRecord != null" >
  232. GLU_Nurse_Record,
  233. </if>
  234. <if test="gluIsrecord != null" >
  235. GLU_IsRecord,
  236. </if>
  237. <if test="gluOperationTime != null" >
  238. GLU_Operation_Time,
  239. </if>
  240. <if test="gluOperator != null" >
  241. GLU_Operator,
  242. </if>
  243. <if test="gluIsdel != null" >
  244. GLU_IsDel,
  245. </if>
  246. <if test="gluFormerid != null" >
  247. GLU_FormerID,
  248. </if>
  249. <if test="gluIsabnormal != null" >
  250. GLU_IsAbnormal,
  251. </if>
  252. <if test="gluAbnormalReason != null" >
  253. GLU_Abnormal_Reason,
  254. </if>
  255. <if test="gluOriginal != null" >
  256. GLU_Original,
  257. </if>
  258. <if test="gluOriginalId != null" >
  259. GLU_Original_ID,
  260. </if>
  261. </trim>
  262. <trim prefix="values (" suffix=")" suffixOverrides="," >
  263. <if test="gluId != null" >
  264. #{gluId,jdbcType=INTEGER},
  265. </if>
  266. <if test="patientno != null" >
  267. #{patientno,jdbcType=INTEGER},
  268. </if>
  269. <if test="hiId != null" >
  270. #{hiId,jdbcType=INTEGER},
  271. </if>
  272. <if test="ddDepdm != null" >
  273. #{ddDepdm,jdbcType=VARCHAR},
  274. </if>
  275. <if test="dwWarddm != null" >
  276. #{dwWarddm,jdbcType=VARCHAR},
  277. </if>
  278. <if test="dbBedno != null" >
  279. #{dbBedno,jdbcType=VARCHAR},
  280. </if>
  281. <if test="gluMeasureTime != null" >
  282. #{gluMeasureTime,jdbcType=TIMESTAMP},
  283. </if>
  284. <if test="gluRecordor != null" >
  285. #{gluRecordor,jdbcType=VARCHAR},
  286. </if>
  287. <if test="gluRecordTime != null" >
  288. #{gluRecordTime,jdbcType=TIMESTAMP},
  289. </if>
  290. <if test="gluSource != null" >
  291. #{gluSource,jdbcType=INTEGER},
  292. </if>
  293. <if test="gluValue != null" >
  294. #{gluValue,jdbcType=VARCHAR},
  295. </if>
  296. <if test="gluTimePoint != null" >
  297. #{gluTimePoint,jdbcType=VARCHAR},
  298. </if>
  299. <if test="gluUnit != null" >
  300. #{gluUnit,jdbcType=VARCHAR},
  301. </if>
  302. <if test="gluNurseRecord != null" >
  303. #{gluNurseRecord,jdbcType=VARCHAR},
  304. </if>
  305. <if test="gluIsrecord != null" >
  306. #{gluIsrecord,jdbcType=INTEGER},
  307. </if>
  308. <if test="gluOperationTime != null" >
  309. #{gluOperationTime,jdbcType=TIMESTAMP},
  310. </if>
  311. <if test="gluOperator != null" >
  312. #{gluOperator,jdbcType=VARCHAR},
  313. </if>
  314. <if test="gluIsdel != null" >
  315. #{gluIsdel,jdbcType=INTEGER},
  316. </if>
  317. <if test="gluFormerid != null" >
  318. #{gluFormerid,jdbcType=INTEGER},
  319. </if>
  320. <if test="gluIsabnormal != null" >
  321. #{gluIsabnormal,jdbcType=INTEGER},
  322. </if>
  323. <if test="gluAbnormalReason != null" >
  324. #{gluAbnormalReason,jdbcType=VARCHAR},
  325. </if>
  326. <if test="gluOriginal != null" >
  327. #{gluOriginal,jdbcType=VARCHAR},
  328. </if>
  329. <if test="gluOriginalId != null" >
  330. #{gluOriginalId,jdbcType=INTEGER},
  331. </if>
  332. </trim>
  333. </insert>
  334. <update id="updateByPrimaryKeySelective" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.InpGlu" >
  335. update inp_glu
  336. <set >
  337. <if test="patientno != null" >
  338. PatientNo = #{patientno,jdbcType=INTEGER},
  339. </if>
  340. <if test="hiId != null" >
  341. HI_ID = #{hiId,jdbcType=INTEGER},
  342. </if>
  343. <if test="ddDepdm != null" >
  344. DD_DepDm = #{ddDepdm,jdbcType=VARCHAR},
  345. </if>
  346. <if test="dwWarddm != null" >
  347. DW_WardDm = #{dwWarddm,jdbcType=VARCHAR},
  348. </if>
  349. <if test="dbBedno != null" >
  350. DB_BedNo = #{dbBedno,jdbcType=VARCHAR},
  351. </if>
  352. <if test="gluMeasureTime != null" >
  353. GLU_Measure_Time = #{gluMeasureTime,jdbcType=TIMESTAMP},
  354. </if>
  355. <if test="gluRecordor != null" >
  356. GLU_Recordor = #{gluRecordor,jdbcType=VARCHAR},
  357. </if>
  358. <if test="gluRecordTime != null" >
  359. GLU_Record_Time = #{gluRecordTime,jdbcType=TIMESTAMP},
  360. </if>
  361. <if test="gluSource != null" >
  362. GLU_Source = #{gluSource,jdbcType=INTEGER},
  363. </if>
  364. <if test="gluValue != null" >
  365. GLU_Value = #{gluValue,jdbcType=VARCHAR},
  366. </if>
  367. <if test="gluTimePoint != null" >
  368. GLU_Time_Point = #{gluTimePoint,jdbcType=VARCHAR},
  369. </if>
  370. <if test="gluUnit != null" >
  371. GLU_Unit = #{gluUnit,jdbcType=VARCHAR},
  372. </if>
  373. <if test="gluNurseRecord != null" >
  374. GLU_Nurse_Record = #{gluNurseRecord,jdbcType=VARCHAR},
  375. </if>
  376. <if test="gluIsrecord != null" >
  377. GLU_IsRecord = #{gluIsrecord,jdbcType=INTEGER},
  378. </if>
  379. <if test="gluOperationTime != null" >
  380. GLU_Operation_Time = #{gluOperationTime,jdbcType=TIMESTAMP},
  381. </if>
  382. <if test="gluOperator != null" >
  383. GLU_Operator = #{gluOperator,jdbcType=VARCHAR},
  384. </if>
  385. <if test="gluIsdel != null" >
  386. GLU_IsDel = #{gluIsdel,jdbcType=INTEGER},
  387. </if>
  388. <if test="gluFormerid != null" >
  389. GLU_FormerID = #{gluFormerid,jdbcType=INTEGER},
  390. </if>
  391. <if test="gluIsabnormal != null" >
  392. GLU_IsAbnormal = #{gluIsabnormal,jdbcType=INTEGER},
  393. </if>
  394. <if test="gluAbnormalReason != null" >
  395. GLU_Abnormal_Reason = #{gluAbnormalReason,jdbcType=VARCHAR},
  396. </if>
  397. <if test="gluOriginal != null" >
  398. GLU_Original = #{gluOriginal,jdbcType=VARCHAR},
  399. </if>
  400. <if test="gluOriginalId != null" >
  401. GLU_Original_ID = #{gluOriginalId,jdbcType=INTEGER},
  402. </if>
  403. </set>
  404. where GLU_ID = #{gluId,jdbcType=INTEGER}
  405. </update>
  406. <update id="updateBySource" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.InpGlu" >
  407. update inp_glu
  408. set GLU_IsDel = #{gluIsdel,jdbcType=INTEGER}
  409. where GLU_Source = #{gluSource,jdbcType=INTEGER}
  410. and GLU_Original_ID = #{gluOriginalId,jdbcType=INTEGER}
  411. and GLU_Original = #{gluOriginal,jdbcType=VARCHAR}
  412. </update>
  413. <update id="updateByPrimaryKey" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.InpGlu" >
  414. update inp_glu
  415. set PatientNo = #{patientno,jdbcType=INTEGER},
  416. HI_ID = #{hiId,jdbcType=INTEGER},
  417. DD_DepDm = #{ddDepdm,jdbcType=VARCHAR},
  418. DW_WardDm = #{dwWarddm,jdbcType=VARCHAR},
  419. DB_BedNo = #{dbBedno,jdbcType=VARCHAR},
  420. GLU_Measure_Time = #{gluMeasureTime,jdbcType=TIMESTAMP},
  421. GLU_Recordor = #{gluRecordor,jdbcType=VARCHAR},
  422. GLU_Record_Time = #{gluRecordTime,jdbcType=TIMESTAMP},
  423. GLU_Source = #{gluSource,jdbcType=INTEGER},
  424. GLU_Value = #{gluValue,jdbcType=VARCHAR},
  425. GLU_Time_Point = #{gluTimePoint,jdbcType=VARCHAR},
  426. GLU_Unit = #{gluUnit,jdbcType=VARCHAR},
  427. GLU_Nurse_Record = #{gluNurseRecord,jdbcType=VARCHAR},
  428. GLU_IsRecord = #{gluIsrecord,jdbcType=INTEGER},
  429. GLU_Operation_Time = #{gluOperationTime,jdbcType=TIMESTAMP},
  430. GLU_Operator = #{gluOperator,jdbcType=VARCHAR},
  431. GLU_IsDel = #{gluIsdel,jdbcType=INTEGER},
  432. GLU_FormerID = #{gluFormerid,jdbcType=INTEGER},
  433. GLU_IsAbnormal = #{gluIsabnormal,jdbcType=INTEGER},
  434. GLU_Abnormal_Reason = #{gluAbnormalReason,jdbcType=VARCHAR},
  435. GLU_Original = #{gluOriginal,jdbcType=VARCHAR},
  436. GLU_Original_ID = #{gluOriginalId,jdbcType=INTEGER}
  437. where GLU_ID = #{gluId,jdbcType=INTEGER}
  438. </update>
  439. <select id="selectGluSchedule" resultMap="ResultMap" >
  440. SELECT null gluId, a.PatientNo visitno,a.DB_BedNo bedno,b.IP_Med_Rec chartno,b.IP_Name ptname,c.DB_Sort sort,null gluAbnormalReason,null gluValue
  441. from inp_schedule a INNER JOIN inp_patient b on a.PatientNo = b.IP_PatientNo
  442. LEFT JOIN dic_bed c on b.DB_BedNo = c.DB_BedNo AND b.DW_WardDm = c.DW_WardDm
  443. WHERE a.HI_ID = #{Hiid,jdbcType=INTEGER} and a.DW_WardDm = #{wardDm,jdbcType=VARCHAR} and b.IP_Status = 0 and IFNULL(a.IS_IsReview,0) = 0
  444. and IS_Code = 'BloodGlucose' and date_format(a.IS_Review_Time,'%Y-%m-%d') = #{time,jdbcType=VARCHAR} and a.IS_Time_Point = #{timePoint,jdbcType=VARCHAR}
  445. UNION ALL
  446. SELECT a.GLU_ID gluId, a.PatientNo visitno,b.DB_BedNo bedno,b.IP_Med_Rec chartno,b.IP_Name ptname,c.DB_Sort sort,a.GLU_Abnormal_Reason gluAbnormalReason,a.GLU_Value gluValue
  447. from inp_glu a INNER JOIN inp_patient b on a.PatientNo = b.IP_PatientNo and b.ip_status = 0
  448. LEFT JOIN dic_bed c on b.DB_BedNo = c.DB_BedNo AND b.DW_WardDm = c.DW_WardDm AND b.DW_WardDm = c.DW_WardDm
  449. where DATE_FORMAT(GLU_Measure_Time,'%Y-%m-%d %H:%i') = #{measureTime,jdbcType=VARCHAR}
  450. and GLU_Time_Point = #{timePoint,jdbcType=VARCHAR} and a.GLU_IsDel = 0 and a.DW_WardDm = #{wardDm,jdbcType=VARCHAR}
  451. </select>
  452. <select id="selectHasInputGlu" resultMap="ResultMap" >
  453. SELECT a.GLU_ID gluId, a.PatientNo visitno,b.DB_BedNo bedno,b.IP_Med_Rec chartno,b.IP_Name ptname,c.DB_Sort sort,a.GLU_Abnormal_Reason gluAbnormalReason,a.GLU_Value gluValue
  454. from inp_glu a INNER JOIN inp_patient b on a.PatientNo = b.IP_PatientNo
  455. LEFT JOIN dic_bed c on b.DB_BedNo = c.DB_BedNo AND b.DW_WardDm = c.DW_WardDm
  456. where DATE_FORMAT(GLU_Measure_Time,'%Y-%m-%d %H:%i') = #{measureTime,jdbcType=VARCHAR}
  457. and GLU_Time_Point = #{timePoint,jdbcType=VARCHAR} and a.GLU_IsDel = 0 and a.DW_WardDm = #{wardDm,jdbcType=VARCHAR}
  458. </select>
  459. <select id="selectPDAGlu" resultMap="PDAMap" >
  460. SELECT e.sdd_detail_name timePoint,
  461. a.PatientNo visitno,
  462. b.DB_BedNo bedno,
  463. b.IP_Name ptname,
  464. CASE b.IP_Sex WHEN 1 THEN '男' WHEN 2 THEN '女' ELSE '未知' END as gender,
  465. 1 status,
  466. c.DB_Sort sort,
  467. a.GLU_Value gluValue
  468. from inp_glu a INNER JOIN inp_patient b on a.PatientNo = b.IP_PatientNo and b.ip_status = 0
  469. LEFT JOIN dic_bed c on b.DB_BedNo = c.DB_BedNo AND b.DW_WardDm = c.DW_WardDm
  470. left join (select sdd_detail_code,sdd_detail_name from sys_dictionary_detail where sd_id = (select distinct sd_id from sys_dictionary where sd_dicdm = 'opportunity')) e
  471. on a.GLU_Time_Point = e.sdd_detail_code
  472. where DATE_FORMAT(GLU_Measure_Time,'%Y-%m-%d') = #{dateTime,jdbcType=VARCHAR}
  473. and a.GLU_IsDel = 0 and a.DW_WardDm = #{wardDm,jdbcType=VARCHAR} order by sort
  474. </select>
  475. <select id="selectGluPatient" resultMap="ResultMap" >
  476. SELECT a.GLU_ID gluId, a.PatientNo visitno,b.DB_BedNo bedno,b.IP_Med_Rec chartno,b.IP_Name ptname,c.DB_Sort sort,
  477. a.GLU_Abnormal_Reason gluAbnormalReason,a.GLU_Value gluValue,a.GLU_Measure_Time measureTime,a.glu_time_point timePoint
  478. from inp_glu a INNER JOIN inp_patient b on a.PatientNo = b.IP_PatientNo
  479. LEFT JOIN dic_bed c on b.DB_BedNo = c.DB_BedNo AND b.DW_WardDm = c.DW_WardDm
  480. where a.GLU_Measure_Time
  481. between
  482. #{sTime,jdbcType=TIMESTAMP}
  483. and
  484. #{eTime,jdbcType=TIMESTAMP}
  485. <if test="dwWardDm !=null">
  486. and a.DW_WardDm = #{dwWardDm,jdbcType=VARCHAR}
  487. </if>
  488. and a.GLU_IsDel = 0
  489. <if test="keyword !=null">
  490. and (b.IP_Name like CONCAT('%', #{keyword,jdbcType=VARCHAR}, '%') or b.IP_Med_Rec like CONCAT('%', #{keyword,jdbcType=VARCHAR}, '%'))
  491. </if>
  492. </select>
  493. <select id="selectLastGlu" resultMap="BaseResultMap">
  494. SELECT PatientNo, glu_value from inp_glu where glu_id in (
  495. SELECT max(GLU_ID) FROM inp_glu
  496. where 1= 1
  497. <if test="patientNo !=null">
  498. and PatientNo = #{patientNo,jdbcType=INTEGER}
  499. </if>
  500. and glu_measure_time &gt;= #{startTime,jdbcType=TIMESTAMP} and glu_measure_time &lt;= #{endTime,jdbcType=TIMESTAMP}
  501. and GLU_IsDel = 0 GROUP BY PatientNo )
  502. </select>
  503. </mapper>