InpRecordDetailMapper.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  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.InpRecordDetailMapper" >
  4. <resultMap id="BaseResultMap" type="com.xinxin.topro.inpnurseservice.mysqlmodel.InpRecordDetail" >
  5. <id column="IRD_ID" property="irdId" jdbcType="INTEGER" />
  6. <result column="IR_ID" property="irId" jdbcType="INTEGER" />
  7. <result column="IRD_Record_Code" property="irdRecordCode" jdbcType="VARCHAR" />
  8. <result column="IRD_Record_Name" property="irdRecordName" jdbcType="VARCHAR" />
  9. <result column="IRD_Record_Value" property="irdRecordValue" jdbcType="VARCHAR" />
  10. <result column="IRD_Unit" property="irdUnit" jdbcType="VARCHAR" />
  11. <result column="IRD_Remark" property="irdRemark" jdbcType="VARCHAR" />
  12. <result column="IRD_Recordor" property="irdRecordor" jdbcType="VARCHAR" />
  13. <result column="IRD_Record_Time" property="irdRecordTime" jdbcType="TIMESTAMP" />
  14. <result column="IRD_Operation_Time" property="irdOperationTime" jdbcType="TIMESTAMP" />
  15. <result column="IRD_Operator" property="irdOperator" jdbcType="VARCHAR" />
  16. <result column="IRD_IsDel" property="irdIsdel" jdbcType="INTEGER" />
  17. <result column="IRD_Property" property="irdProperty" jdbcType="VARCHAR" />
  18. <result column="IC_ID" property="icId" jdbcType="INTEGER" />
  19. <result column="IRD_Catheter_Name" property="irdCatheterName" jdbcType="VARCHAR" />
  20. <result column="IRD_Original" property="irdOriginal" jdbcType="VARCHAR" />
  21. <result column="IRD_Original_ID" property="irdOriginalId" jdbcType="INTEGER" />
  22. <result column="IRD_Source" property="irdSource" jdbcType="INTEGER" />
  23. <result column="IRD_Unmeasure_Code" property="irdUnmeasureCode" jdbcType="VARCHAR" />
  24. <result column="IRD_Unmeasure_Reason" property="irdUnmeasureReason" jdbcType="VARCHAR" />
  25. <result column="IRD_IsTPR" property="irdIsTpr" jdbcType="INTEGER" />
  26. <result column="IRD_Time_Point" property="irdTimePoint" jdbcType="VARCHAR" />
  27. </resultMap>
  28. <sql id="Base_Column_List" >
  29. IRD_ID, IR_ID, IRD_Record_Code, IRD_Record_Name, IRD_Record_Value, IRD_Unit, IRD_Remark,
  30. IRD_Recordor, IRD_Record_Time, IRD_Operation_Time, IRD_Operator, IRD_IsDel, IRD_Property,
  31. IC_ID, IRD_Catheter_Name, IRD_Original, IRD_Original_ID, IRD_Source, IRD_Unmeasure_Code,
  32. IRD_Unmeasure_Reason, IRD_IsTPR, IRD_Time_Point
  33. </sql>
  34. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  35. select
  36. <include refid="Base_Column_List" />
  37. from inp_record_detail
  38. where IRD_IsDel = 0 and IRD_ID = #{irdId,jdbcType=INTEGER}
  39. </select>
  40. <select id="selectAll" resultMap="BaseResultMap">
  41. select
  42. <include refid="Base_Column_List" />
  43. from inp_record_detail
  44. where IRD_IsDel = 0
  45. </select>
  46. <select id="selectByIds" resultMap="BaseResultMap">
  47. select
  48. <include refid="Base_Column_List" />
  49. from inp_record_detail
  50. where IRD_IsDel = 0
  51. and IR_ID in
  52. <foreach collection="list" item="item" index="index" separator="," open="(" close=")">
  53. #{item,jdbcType=INTEGER}
  54. </foreach>
  55. </select>
  56. <select id="selectByIRid" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  57. select
  58. <include refid="Base_Column_List" />
  59. from inp_record_detail
  60. where IRD_IsDel = 0 and IR_ID = #{irId,jdbcType=INTEGER}
  61. </select>
  62. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  63. delete from inp_record_detail
  64. where IRD_ID = #{irdId,jdbcType=INTEGER}
  65. </delete>
  66. <insert id="insert" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.InpRecordDetail" useGeneratedKeys="true" keyColumn="IRD_ID" keyProperty="irdId">
  67. insert into inp_record_detail (IRD_ID, IR_ID, IRD_Record_Code,
  68. IRD_Record_Name, IRD_Record_Value, IRD_Unit,
  69. IRD_Remark, IRD_Recordor, IRD_Record_Time,
  70. IRD_Operation_Time, IRD_Operator, IRD_IsDel,
  71. IRD_Property, IC_ID, IRD_Catheter_Name,
  72. IRD_Original, IRD_Original_ID, IRD_Source,
  73. IRD_Unmeasure_Code, IRD_Unmeasure_Reason, IRD_IsTPR, IRD_Time_Point)
  74. values (#{irdId,jdbcType=INTEGER}, #{irId,jdbcType=INTEGER}, #{irdRecordCode,jdbcType=VARCHAR},
  75. #{irdRecordName,jdbcType=VARCHAR}, #{irdRecordValue,jdbcType=VARCHAR}, #{irdUnit,jdbcType=VARCHAR},
  76. #{irdRemark,jdbcType=VARCHAR}, #{irdRecordor,jdbcType=VARCHAR}, #{irdRecordTime,jdbcType=TIMESTAMP},
  77. #{irdOperationTime,jdbcType=TIMESTAMP}, #{irdOperator,jdbcType=VARCHAR}, #{irdIsdel,jdbcType=INTEGER},
  78. #{irdProperty,jdbcType=VARCHAR}, #{icId,jdbcType=INTEGER}, #{irdCatheterName,jdbcType=VARCHAR},
  79. #{irdOriginal,jdbcType=VARCHAR}, #{irdOriginalId,jdbcType=INTEGER}, #{irdSource,jdbcType=INTEGER},
  80. #{irdUnmeasureCode,jdbcType=VARCHAR}, #{irdUnmeasureReason,jdbcType=VARCHAR}, #{irdIsTpr,jdbcType=INTEGER}, #{irdTimePoint,jdbcType=VARCHAR})
  81. </insert>
  82. <insert id="batchInsert" useGeneratedKeys="true" keyColumn="IRD_ID" keyProperty="irdId">
  83. insert into inp_record_detail (IR_ID, IRD_Record_Code,
  84. IRD_Record_Name, IRD_Record_Value, IRD_Unit,
  85. IRD_Remark, IRD_Recordor, IRD_Record_Time,
  86. IRD_Operation_Time, IRD_Operator, IRD_IsDel,
  87. IRD_Property, IC_ID, IRD_Catheter_Name,
  88. IRD_Original, IRD_Original_ID, IRD_Source,
  89. IRD_Unmeasure_Code, IRD_Unmeasure_Reason, IRD_IsTPR, IRD_Time_Point
  90. )
  91. values <foreach collection="list" item="item" separator=",">
  92. (#{item.irId,jdbcType=INTEGER}, #{item.irdRecordCode,jdbcType=VARCHAR},
  93. #{item.irdRecordName,jdbcType=VARCHAR}, #{item.irdRecordValue,jdbcType=VARCHAR}, #{item.irdUnit,jdbcType=VARCHAR},
  94. #{item.irdRemark,jdbcType=VARCHAR}, #{item.irdRecordor,jdbcType=VARCHAR}, #{item.irdRecordTime,jdbcType=TIMESTAMP},
  95. #{item.irdOperationTime,jdbcType=TIMESTAMP}, #{item.irdOperator,jdbcType=VARCHAR}, 0,
  96. #{item.irdProperty,jdbcType=VARCHAR}, #{item.icId,jdbcType=INTEGER}, #{item.irdCatheterName,jdbcType=VARCHAR},
  97. #{item.irdOriginal,jdbcType=VARCHAR}, #{item.irdOriginalId,jdbcType=INTEGER}, #{item.irdSource,jdbcType=INTEGER},
  98. #{item.irdUnmeasureCode,jdbcType=VARCHAR}, #{item.irdUnmeasureReason,jdbcType=VARCHAR}, #{item.irdIsTpr,jdbcType=INTEGER},
  99. #{item.irdTimePoint,jdbcType=VARCHAR}
  100. )
  101. </foreach>
  102. </insert>
  103. <insert id="insertSelective" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.InpRecordDetail" >
  104. insert into inp_record_detail
  105. <trim prefix="(" suffix=")" suffixOverrides="," >
  106. <if test="irdId != null" >
  107. IRD_ID,
  108. </if>
  109. <if test="irId != null" >
  110. IR_ID,
  111. </if>
  112. <if test="irdRecordCode != null" >
  113. IRD_Record_Code,
  114. </if>
  115. <if test="irdRecordName != null" >
  116. IRD_Record_Name,
  117. </if>
  118. <if test="irdRecordValue != null" >
  119. IRD_Record_Value,
  120. </if>
  121. <if test="irdUnit != null" >
  122. IRD_Unit,
  123. </if>
  124. <if test="irdRemark != null" >
  125. IRD_Remark,
  126. </if>
  127. <if test="irdRecordor != null" >
  128. IRD_Recordor,
  129. </if>
  130. <if test="irdRecordTime != null" >
  131. IRD_Record_Time,
  132. </if>
  133. <if test="irdOperationTime != null" >
  134. IRD_Operation_Time,
  135. </if>
  136. <if test="irdOperator != null" >
  137. IRD_Operator,
  138. </if>
  139. <if test="irdIsdel != null" >
  140. IRD_IsDel,
  141. </if>
  142. <if test="irdProperty != null" >
  143. IRD_Property,
  144. </if>
  145. <if test="icId != null" >
  146. IC_ID,
  147. </if>
  148. <if test="irdCatheterName != null" >
  149. IRD_Catheter_Name,
  150. </if>
  151. <if test="irdOriginal != null" >
  152. IRD_Original,
  153. </if>
  154. <if test="irdOriginalId != null" >
  155. IRD_Original_ID,
  156. </if>
  157. <if test="irdSource != null" >
  158. IRD_Source,
  159. </if>
  160. <if test="irdUnmeasureCode != null" >
  161. IRD_Unmeasure_Code,
  162. </if>
  163. <if test="irdUnmeasureReason != null" >
  164. IRD_Unmeasure_Reason,
  165. </if>
  166. <if test="irdIsTpr != null" >
  167. IRD_IsTPR,
  168. </if>
  169. <if test="irdTimePoint != null" >
  170. IRD_Time_Point,
  171. </if>
  172. </trim>
  173. <trim prefix="values (" suffix=")" suffixOverrides="," >
  174. <if test="irdId != null" >
  175. #{irdId,jdbcType=INTEGER},
  176. </if>
  177. <if test="irId != null" >
  178. #{irId,jdbcType=INTEGER},
  179. </if>
  180. <if test="irdRecordCode != null" >
  181. #{irdRecordCode,jdbcType=VARCHAR},
  182. </if>
  183. <if test="irdRecordName != null" >
  184. #{irdRecordName,jdbcType=VARCHAR},
  185. </if>
  186. <if test="irdRecordValue != null" >
  187. #{irdRecordValue,jdbcType=VARCHAR},
  188. </if>
  189. <if test="irdUnit != null" >
  190. #{irdUnit,jdbcType=VARCHAR},
  191. </if>
  192. <if test="irdRemark != null" >
  193. #{irdRemark,jdbcType=VARCHAR},
  194. </if>
  195. <if test="irdRecordor != null" >
  196. #{irdRecordor,jdbcType=VARCHAR},
  197. </if>
  198. <if test="irdRecordTime != null" >
  199. #{irdRecordTime,jdbcType=TIMESTAMP},
  200. </if>
  201. <if test="irdOperationTime != null" >
  202. #{irdOperationTime,jdbcType=TIMESTAMP},
  203. </if>
  204. <if test="irdOperator != null" >
  205. #{irdOperator,jdbcType=VARCHAR},
  206. </if>
  207. <if test="irdIsdel != null" >
  208. #{irdIsdel,jdbcType=INTEGER},
  209. </if>
  210. <if test="irdProperty != null" >
  211. #{irdProperty,jdbcType=VARCHAR},
  212. </if>
  213. <if test="icId != null" >
  214. #{icId,jdbcType=INTEGER},
  215. </if>
  216. <if test="irdCatheterName != null" >
  217. #{irdCatheterName,jdbcType=VARCHAR},
  218. </if>
  219. <if test="irdOriginal != null" >
  220. #{irdOriginal,jdbcType=VARCHAR},
  221. </if>
  222. <if test="irdOriginalId != null" >
  223. #{irdOriginalId,jdbcType=INTEGER},
  224. </if>
  225. <if test="irdSource != null" >
  226. #{irdSource,jdbcType=INTEGER},
  227. </if>
  228. <if test="irdUnmeasureCode != null" >
  229. #{irdUnmeasureCode,jdbcType=VARCHAR},
  230. </if>
  231. <if test="irdUnmeasureReason != null" >
  232. #{irdUnmeasureReason,jdbcType=VARCHAR},
  233. </if>
  234. <if test="irdIsTpr != null" >
  235. #{irdIsTpr,jdbcType=INTEGER},
  236. </if>
  237. <if test="irdTimePoint != null" >
  238. #{irdTimePoint,jdbcType=VARCHAR},
  239. </if>
  240. </trim>
  241. </insert>
  242. <update id="updateByPrimaryKeySelective" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.InpRecordDetail" >
  243. update inp_record_detail
  244. <set >
  245. <if test="irId != null" >
  246. IR_ID = #{irId,jdbcType=INTEGER},
  247. </if>
  248. <if test="irdRecordCode != null" >
  249. IRD_Record_Code = #{irdRecordCode,jdbcType=VARCHAR},
  250. </if>
  251. <if test="irdRecordName != null" >
  252. IRD_Record_Name = #{irdRecordName,jdbcType=VARCHAR},
  253. </if>
  254. <if test="irdRecordValue != null" >
  255. IRD_Record_Value = #{irdRecordValue,jdbcType=VARCHAR},
  256. </if>
  257. <if test="irdUnit != null" >
  258. IRD_Unit = #{irdUnit,jdbcType=VARCHAR},
  259. </if>
  260. <if test="irdRemark != null" >
  261. IRD_Remark = #{irdRemark,jdbcType=VARCHAR},
  262. </if>
  263. <if test="irdRecordor != null" >
  264. IRD_Recordor = #{irdRecordor,jdbcType=VARCHAR},
  265. </if>
  266. <if test="irdRecordTime != null" >
  267. IRD_Record_Time = #{irdRecordTime,jdbcType=TIMESTAMP},
  268. </if>
  269. <if test="irdOperationTime != null" >
  270. IRD_Operation_Time = #{irdOperationTime,jdbcType=TIMESTAMP},
  271. </if>
  272. <if test="irdOperator != null" >
  273. IRD_Operator = #{irdOperator,jdbcType=VARCHAR},
  274. </if>
  275. <if test="irdIsdel != null" >
  276. IRD_IsDel = #{irdIsdel,jdbcType=INTEGER},
  277. </if>
  278. <if test="irdProperty != null" >
  279. IRD_Property = #{irdProperty,jdbcType=VARCHAR},
  280. </if>
  281. <if test="icId != null" >
  282. IC_ID = #{icId,jdbcType=INTEGER},
  283. </if>
  284. <if test="irdCatheterName != null" >
  285. IRD_Catheter_Name = #{irdCatheterName,jdbcType=VARCHAR},
  286. </if>
  287. <if test="irdOriginal != null" >
  288. IRD_Original = #{irdOriginal,jdbcType=VARCHAR},
  289. </if>
  290. <if test="irdOriginalId != null" >
  291. IRD_Original_ID = #{irdOriginalId,jdbcType=INTEGER},
  292. </if>
  293. <if test="irdSource != null" >
  294. IRD_Source = #{irdSource,jdbcType=INTEGER},
  295. </if>
  296. <if test="irdUnmeasureCode != null" >
  297. IRD_Unmeasure_Code = #{irdUnmeasureCode,jdbcType=VARCHAR},
  298. </if>
  299. <if test="irdUnmeasureReason != null" >
  300. IRD_Unmeasure_Reason = #{irdUnmeasureReason,jdbcType=VARCHAR},
  301. </if>
  302. <if test="irdIsTpr != null" >
  303. IRD_IsTPR = #{irdIsTpr,jdbcType=INTEGER},
  304. </if>
  305. <if test="irdTimePoint != null" >
  306. IRD_Time_Point = #{irdTimePoint,jdbcType=INTEGER},
  307. </if>
  308. </set>
  309. where IRD_ID = #{irdId,jdbcType=INTEGER}
  310. </update>
  311. <update id="updateByPrimaryKey" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.InpRecordDetail" >
  312. update inp_record_detail
  313. set IR_ID = #{irId,jdbcType=INTEGER},
  314. IRD_Record_Code = #{irdRecordCode,jdbcType=VARCHAR},
  315. IRD_Record_Name = #{irdRecordName,jdbcType=VARCHAR},
  316. IRD_Record_Value = #{irdRecordValue,jdbcType=VARCHAR},
  317. IRD_Unit = #{irdUnit,jdbcType=VARCHAR},
  318. IRD_Remark = #{irdRemark,jdbcType=VARCHAR},
  319. IRD_Recordor = #{irdRecordor,jdbcType=VARCHAR},
  320. IRD_Record_Time = #{irdRecordTime,jdbcType=TIMESTAMP},
  321. IRD_Operation_Time = #{irdOperationTime,jdbcType=TIMESTAMP},
  322. IRD_Operator = #{irdOperator,jdbcType=VARCHAR},
  323. IRD_IsDel = #{irdIsdel,jdbcType=INTEGER},
  324. IRD_Property = #{irdProperty,jdbcType=VARCHAR},
  325. IC_ID = #{icId,jdbcType=INTEGER},
  326. IRD_Catheter_Name = #{irdCatheterName,jdbcType=VARCHAR},
  327. IRD_Original = #{irdOriginal,jdbcType=VARCHAR},
  328. IRD_Original_ID = #{irdOriginalId,jdbcType=INTEGER},
  329. IRD_Source = #{irdSource,jdbcType=INTEGER},
  330. IRD_Unmeasure_Code = #{irdUnmeasureCode,jdbcType=VARCHAR},
  331. IRD_Unmeasure_Reason = #{irdUnmeasureReason,jdbcType=VARCHAR},
  332. IRD_IsTPR = #{irdIsTpr,jdbcType=INTEGER},
  333. IRD_Time_Point = #{irdTimePoint,jdbcType=INTEGER}
  334. where IRD_ID = #{irdId,jdbcType=INTEGER}
  335. </update>
  336. <!-- 以下为自定义sql请勿删除 -->
  337. <update id="updateIsDelByIrdId" parameterType="java.lang.Integer">
  338. update inp_record_detail set IRD_IsDel = -1
  339. where IR_ID = #{irId,jdbcType=INTEGER}
  340. </update>
  341. <update id="updateIsIrdId" parameterType="java.lang.Integer">
  342. update inp_record_detail set IRD_IsDel = -1
  343. where IRD_ID = #{irdId,jdbcType=INTEGER}
  344. </update>
  345. <update id="updateIsDelByIrIdList" parameterType="java.util.List">
  346. update inp_record_detail set IRD_IsDel = -1
  347. where IR_ID in
  348. <foreach collection="list" item="item" index="index" separator="," close=")" open="(">
  349. #{item,jdbcType=INTEGER}
  350. </foreach>
  351. </update>
  352. <update id="batchDeleteByIrId">
  353. UPDATE inp_record_detail SET IRD_IsDel = -1,
  354. IRD_Operator = #{irdOperator,jdbcType=VARCHAR},
  355. IRD_Operation_Time = #{irdOperationTime,jdbcType=TIMESTAMP}
  356. WHERE IR_ID = #{irId,jdbcType=INTEGER}
  357. </update>
  358. <update id="updateIsDelByIrIdAndCodes">
  359. UPDATE inp_record_detail SET IRD_IsDel = -1,
  360. IRD_Operator = #{irdOperator,jdbcType=VARCHAR},
  361. IRD_Operation_Time = #{irdOperationTime,jdbcType=TIMESTAMP}
  362. WHERE IR_ID = #{irId,jdbcType=INTEGER}
  363. AND IRD_Record_Code in
  364. <foreach collection="codes" item="item" index="index" separator="," close=")" open="(">
  365. #{item,jdbcType=VARCHAR}
  366. </foreach>
  367. </update>
  368. <select id="selectBySelective" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.InpRecordDetail" resultMap="BaseResultMap">
  369. SELECT
  370. <include refid="Base_Column_List" />
  371. FROM inp_record_detail
  372. WHERE
  373. IRD_IsDel = 0
  374. <if test="irId != null">
  375. AND IR_ID = #{irId,jdbcType=INTEGER}
  376. </if>
  377. <if test="irdOriginal != null" >
  378. AND IRD_Original = #{irdOriginal,jdbcType=VARCHAR}
  379. </if>
  380. <if test="irdOriginalId != null" >
  381. AND IRD_Original_ID = #{irdOriginalId,jdbcType=INTEGER}
  382. </if>
  383. <if test="irdSource != null" >
  384. AND IRD_Source = #{irdSource,jdbcType=INTEGER}
  385. </if>
  386. </select>
  387. <select id="selectByList" resultMap="BaseResultMap">
  388. SELECT
  389. <include refid="Base_Column_List" />
  390. FROM inp_record_detail
  391. WHERE
  392. IRD_IsDel = 0
  393. AND IR_ID IN
  394. <foreach collection="irIds" item="item" index="index" separator="," close=")" open="(">
  395. #{item,jdbcType=INTEGER}
  396. </foreach>
  397. ORDER BY IRD_Operation_Time DESC
  398. </select>
  399. <select id="selectByTime" resultMap="BaseResultMap">
  400. SELECT ird.* FROM inp_record ir
  401. INNER JOIN inp_record_detail ird ON ir.IR_ID = ird.IR_ID
  402. WHERE ir.IR_IsDel = 0
  403. AND ird.IRD_IsDel = 0
  404. AND ir.PatientNo = #{patientNo,jdbcType=VARCHAR}
  405. AND ir.IR_Measure_Time <![CDATA[>=]]>#{start}
  406. AND ir.IR_Measure_Time <![CDATA[<=]]>#{end}
  407. ORDER BY ir.IR_Measure_Time DESC
  408. </select>
  409. <select id="selectByPatientNo" resultMap="BaseResultMap">
  410. SELECT ird.* FROM inp_record ir
  411. INNER JOIN inp_record_detail ird ON ir.IR_ID = ird.IR_ID
  412. WHERE ir.IR_IsDel = 0
  413. AND ird.IRD_IsDel = 0
  414. AND ir.PatientNo = #{patientNo,jdbcType=VARCHAR}
  415. AND ir.HI_ID = #{hiId,jdbcType=VARCHAR}
  416. ORDER BY ir.IR_Measure_Time DESC
  417. </select>
  418. <select id="getIoListByTime" resultType="com.xinxin.topro.inpnurseservice.vo.InpRecordDetailVO">
  419. SELECT
  420. ird.IRD_Record_Value irdRecordValue,
  421. ir.IR_Measure_Time irMeasureTime,
  422. ird.IRD_Record_Code irdRecordCode,
  423. ird.IRD_Unit irdUnit,
  424. ird.IRD_Remark irdRemark,
  425. (select di.DIO_IOName from dic_io di where (di.HI_ID = #{hiId,jdbcType=INTEGER} OR di.HI_ID = 0) and di.DIO_IsDel = 0 and di.DIO_IO_Code = ird.IRD_Remark limit 1) ioName
  426. FROM inp_record_detail ird,inp_record ir
  427. WHERE ir.IR_ID = ird.IR_ID
  428. AND (ird.IRD_Record_Code = 'enter' OR ird.IRD_Record_Code = 'out_put')
  429. AND ird.IRD_IsDel = 0
  430. AND ir.IR_IsDel = 0
  431. and IRD_Record_Value is not null and IRD_Record_Value != ''
  432. and ir.PatientNo = #{patientNo,jdbcType=VARCHAR}
  433. <if test="start != null">
  434. AND ir.IR_Measure_Time >= #{start,jdbcType=TIMESTAMP}
  435. </if>
  436. <if test="end != null">
  437. AND #{end,jdbcType=TIMESTAMP} > ir.IR_Measure_Time
  438. </if>
  439. ORDER BY ir.IR_Measure_Time
  440. </select>
  441. <update id="batchDeleteByOriginal">
  442. UPDATE inp_record_detail SET IRD_IsDel = -1,
  443. IRD_Operator = #{irdOperator,jdbcType=VARCHAR},
  444. IRD_Operation_Time = #{irdOperationTime,jdbcType=TIMESTAMP}
  445. WHERE IR_ID = #{irId,jdbcType=INTEGER}
  446. and IRD_Original = #{irdOriginal,jdbcType=VARCHAR}
  447. and IRD_Original_ID = #{irdOriginalId,jdbcType=INTEGER}
  448. </update>
  449. <update id="updateBatchDeleteByOriginal">
  450. UPDATE inp_record_detail SET IRD_IsDel = -1,
  451. IRD_Operator = #{irdOperator,jdbcType=VARCHAR},
  452. IRD_Operation_Time = #{irdOperationTime,jdbcType=TIMESTAMP}
  453. WHERE IRD_Original = #{irdOriginal,jdbcType=VARCHAR}
  454. and IRD_Original_ID in
  455. <foreach collection="list" item="item" index="index" separator="," open="(" close=")">
  456. #{item,jdbcType=INTEGER}
  457. </foreach>
  458. </update>
  459. <select id="selectByIrIdAndSource" resultMap="BaseResultMap">
  460. select <include refid="Base_Column_List" />
  461. from inp_record_detail
  462. where IR_ID=#{irId,jdbcType=INTEGER}
  463. and IRD_Original=#{irdOriginal,jdbcType=VARCHAR} LIMIT 1
  464. </select>
  465. <resultMap id="RelationMap" type="com.xinxin.topro.inpnurseservice.vo.InpRecordRelationVO">
  466. <id column="IR_ID" property="irId" jdbcType="INTEGER" />
  467. <result column="PatientNo" property="patientno" jdbcType="VARCHAR"/>
  468. <result column="HI_ID" property="hiId" jdbcType="INTEGER" />
  469. <result column="DD_DepDm" property="ddDepdm" jdbcType="VARCHAR" />
  470. <result column="DW_WardDm" property="dwWarddm" jdbcType="VARCHAR" />
  471. <result column="DB_BedNo" property="dbBedno" jdbcType="VARCHAR" />
  472. <result column="IR_Measure_Time" property="irMeasureTime" jdbcType="TIMESTAMP" />
  473. <result column="IR_Recordor" property="irRecordor" jdbcType="VARCHAR" />
  474. <result column="IR_Record_Time" property="irRecordTime" jdbcType="TIMESTAMP" />
  475. <result column="IR_Source" property="irSource" jdbcType="INTEGER" />
  476. <result column="IR_Original" property="irOriginal" jdbcType="VARCHAR" />
  477. <result column="IR_Original_ID" property="irOriginalId" jdbcType="INTEGER" />
  478. <result column="IR_Operation_Time" property="irOperationTime" jdbcType="TIMESTAMP" />
  479. <result column="IR_Operator" property="irOperator" jdbcType="VARCHAR" />
  480. <result column="IR_IsDel" property="irIsdel" jdbcType="INTEGER" />
  481. <result column="IR_Record" property="irRecord" jdbcType="VARCHAR" />
  482. <result column="IR_FormerID" property="irFormerid" jdbcType="INTEGER" />
  483. <result column="IR_IsICU" property="irIsicu" jdbcType="INTEGER" />
  484. <result column="IR_CA" property="irCa" jdbcType="INTEGER" />
  485. <result column="IR_IsPrint" property="irIsprint" jdbcType="INTEGER" />
  486. <result column="IR_Printer" property="irPrinter" jdbcType="VARCHAR" />
  487. <result column="IR_IsIO" property="irIsio" jdbcType="INTEGER" />
  488. <result column="recordName" property="recordName" jdbcType="VARCHAR" />
  489. <result column="remark" property="remark" jdbcType="VARCHAR" />
  490. <collection property="detailList" ofType="com.xinxin.topro.inpnurseservice.vo.InpRecordDetailVO" >
  491. <result column="IRD_Record_Code" property="irdRecordCode" jdbcType="VARCHAR" />
  492. <result column="IRD_Record_Name" property="irdRecordName" jdbcType="VARCHAR" />
  493. <result column="IRD_Record_Value" property="irdRecordValue" jdbcType="VARCHAR" />
  494. <result column="IRD_Unit" property="irdUnit" jdbcType="VARCHAR" />
  495. <result column="IRD_Remark" property="irdRemark" jdbcType="VARCHAR" />
  496. <result column="IRD_Recordor" property="irdRecordor" jdbcType="VARCHAR" />
  497. <result column="IRD_Record_Time" property="irdRecordTime" jdbcType="TIMESTAMP" />
  498. <result column="IRD_Operation_Time" property="irdOperationTime" jdbcType="TIMESTAMP" />
  499. <result column="IRD_Operator" property="irdOperator" jdbcType="VARCHAR" />
  500. <result column="IRD_IsDel" property="irdIsdel" jdbcType="INTEGER" />
  501. <result column="IRD_Property" property="irdProperty" jdbcType="VARCHAR" />
  502. <result column="ioName" property="ioName" jdbcType="VARCHAR" />
  503. <result column="property" property="property" jdbcType="VARCHAR" />
  504. </collection>
  505. </resultMap>
  506. <select id="selectByPatientTimeCode" resultMap="RelationMap">
  507. select
  508. ir.IR_ID, PatientNo, HI_ID, DD_DepDm, DW_WardDm, DB_BedNo, IR_Measure_Time, IR_Recordor,
  509. IR_Record_Time, IR_Source, IR_Original, IR_Original_ID, IR_Operation_Time, IR_Operator,
  510. IR_IsDel, IR_Record, IR_FormerID, IR_IsICU, IR_CA, IR_IsPrint, IR_Printer, IR_IsIO,
  511. IRD_ID, IRD_Record_Code, IRD_Record_Name, IRD_Record_Value, IRD_Unit, IRD_Remark,
  512. IRD_Recordor, IRD_Record_Time, IRD_Operation_Time, IRD_Operator, IRD_IsDel, IRD_Property,
  513. (select su.UI_Name from sys_userinfo su where su.UI_Code = ir.IR_Recordor and su.HI_ID = ir.HI_ID limit 1) recordName,
  514. (select irm.IRM_Record from inp_remark irm where irm.IRM_Measure_Time = ir.IR_Measure_Time and irm.PatientNo = ir.PatientNo and irm.HI_ID = ir.HI_ID and irm.IRM_IsDel = 0 limit 1) remark
  515. from inp_record ir left join inp_record_detail ird on ird.IRD_IsDel = 0 and ird.IR_ID = ir.IR_ID and ird.IRD_Record_Value is not null and ird.IRD_Record_Value != '' and ird.IRD_Record_Code is not null
  516. where
  517. ir.PatientNo = #{patientNo,jdbcType=VARCHAR}
  518. <if test="dwWardDm != null">
  519. and ir.DW_WardDm = #{dwWardDm,jdbcType=VARCHAR}
  520. </if>
  521. and ir.HI_ID = #{hiId,jdbcType=INTEGER}
  522. and ir.IR_IsDel = 0
  523. <if test="startDate != null">
  524. and ir.IR_Measure_Time >= #{startDate,jdbcType=TIMESTAMP}
  525. </if>
  526. <if test="endDate != null">
  527. and #{endDate,jdbcType=TIMESTAMP} >= ir.IR_Measure_Time
  528. </if>
  529. <if test="measureTime != null">
  530. and ir.IR_Measure_Time = #{measureTime,jdbcType=TIMESTAMP}
  531. </if>
  532. <choose>
  533. <when test="list != null">
  534. and (ird.IRD_Record_Code in
  535. <foreach collection="list" separator="," item="item" open="(" close=")">
  536. #{item,jdbcType=VARCHAR}
  537. </foreach>
  538. or exists(select 1 from inp_remark irm where irm.IRM_Measure_Time = ir.IR_Measure_Time and irm.PatientNo = ir.PatientNo and irm.HI_ID = ir.HI_ID and irm.IRM_IsDel = 0))
  539. </when>
  540. <otherwise>
  541. and exists(select 1 from inp_remark irm where irm.IRM_Measure_Time = ir.IR_Measure_Time and irm.PatientNo = ir.PatientNo and irm.HI_ID = ir.HI_ID and irm.IRM_IsDel = 0))
  542. </otherwise>
  543. </choose>
  544. <choose>
  545. <when test="isIo == 1 ">
  546. and ir.IR_IsIO = 1
  547. </when>
  548. <when test="isIo == 0 ">
  549. and (ir.IR_IsIO = 0 or ir.IR_IsIO is null)
  550. </when>
  551. <otherwise>
  552. and 1 = 1
  553. </otherwise>
  554. </choose>
  555. order by ir.IR_Measure_Time desc, ird.IRD_Operation_Time desc
  556. </select>
  557. <update id="updateIsDelByIrdIdList" parameterType="java.util.List">
  558. update inp_record_detail set IRD_IsDel = -1
  559. where IRD_ID in
  560. <foreach collection="list" item="item" index="index" separator="," close=")" open="(">
  561. #{item,jdbcType=INTEGER}
  562. </foreach>
  563. </update>
  564. </mapper>