InpExpandOrderMapper.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  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.pubservice.mysqlmapper.InpExpandOrderMapper" >
  4. <resultMap id="BaseResultMap" type="com.xinxin.topro.pubservice.mysqlModel.InpExpandOrder" >
  5. <result column="RecordId" property="recordid" jdbcType="INTEGER" />
  6. <result column="VisitNo" property="visitno" jdbcType="VARCHAR" />
  7. <result column="PtName" property="ptname" jdbcType="VARCHAR" />
  8. <result column="InfantID" property="infantid" jdbcType="INTEGER" />
  9. <result column="ChartNo" property="chartno" jdbcType="VARCHAR" />
  10. <result column="DepartNo" property="departno" jdbcType="VARCHAR" />
  11. <result column="DepartName" property="departname" jdbcType="CHAR" />
  12. <result column="Gender" property="gender" jdbcType="VARCHAR" />
  13. <result column="Age" property="age" jdbcType="BIGINT" />
  14. <result column="PtWeight" property="ptweight" jdbcType="DOUBLE" />
  15. <result column="VisitZone" property="visitzone" jdbcType="INTEGER" />
  16. <result column="BirthDay" property="birthday" jdbcType="DATE" />
  17. <result column="DivNo" property="divno" jdbcType="VARCHAR" />
  18. <result column="DivName" property="divname" jdbcType="CHAR" />
  19. <result column="BedNo" property="bedno" jdbcType="VARCHAR" />
  20. <result column="AdmitTime" property="admittime" jdbcType="TIMESTAMP" />
  21. <result column="IdNo" property="idno" jdbcType="VARCHAR" />
  22. <result column="PhyDoctor" property="phydoctor" jdbcType="VARCHAR" />
  23. <result column="InHospitalStatus" property="inhospitalstatus" jdbcType="INTEGER" />
  24. <result column="OrderNo" property="orderno" jdbcType="VARCHAR" />
  25. <result column="OrderUser" property="orderuser" jdbcType="VARCHAR" />
  26. <result column="OrderUserName" property="orderusername" jdbcType="VARCHAR" />
  27. <result column="OrderTime" property="ordertime" jdbcType="TIMESTAMP" />
  28. <result column="PreExecTime" property="preexectime" jdbcType="TIMESTAMP" />
  29. <result column="PreExecLocName" property="preexeclocname" jdbcType="CHAR" />
  30. <result column="PreExecBed" property="preexecbed" jdbcType="CHAR" />
  31. <result column="ExecTime" property="exectime" jdbcType="CHAR" />
  32. <result column="ExecLocName" property="execlocname" jdbcType="CHAR" />
  33. <result column="ItemNo" property="itemno" jdbcType="VARCHAR" />
  34. <result column="Dose" property="dose" jdbcType="DOUBLE" />
  35. <result column="DoseUnit" property="doseunit" jdbcType="VARCHAR" />
  36. <result column="WayNo" property="wayno" jdbcType="CHAR" />
  37. <result column="SkinTest" property="skintest" jdbcType="CHAR" />
  38. <result column="WayType" property="waytype" jdbcType="VARCHAR" />
  39. <result column="WayName" property="wayname" jdbcType="CHAR" />
  40. <result column="ItemCode" property="itemcode" jdbcType="VARCHAR" />
  41. <result column="ItemName" property="itemname" jdbcType="VARCHAR" />
  42. <result column="OrderType" property="ordertype" jdbcType="INTEGER" />
  43. <result column="BigType" property="bigtype" jdbcType="CHAR" />
  44. <result column="PairItemNo" property="pairitemno" jdbcType="VARCHAR" />
  45. <result column="Rate" property="rate" jdbcType="VARCHAR" />
  46. <result column="RateUnit" property="rateunit" jdbcType="VARCHAR" />
  47. <result column="TakeMedWay" property="takemedway" jdbcType="INTEGER" />
  48. <result column="Usage" property="usage" jdbcType="VARCHAR" />
  49. <result column="LongOrTempFlag" property="longortempflag" jdbcType="INTEGER" />
  50. <result column="ExecStatus" property="execstatus" jdbcType="INTEGER" />
  51. <result column="BloodStatus" property="bloodstatus" jdbcType="CHAR" />
  52. <result column="Advise" property="advise" jdbcType="VARCHAR" />
  53. <result column="DrugBarCode" property="drugbarcode" jdbcType="VARCHAR" />
  54. <result column="isCollection" property="isCollection" jdbcType="INTEGER"/>
  55. <result column="PSM_Collect_Time" property="collectTime" jdbcType="TIMESTAMP" />
  56. <result column="UI_Name" property="collector" jdbcType="VARCHAR" />
  57. <result column="validTime" property="validTime" jdbcType="VARCHAR" />
  58. <result column="Entrust" property="entrust" jdbcType="VARCHAR" />
  59. </resultMap>
  60. <resultMap id="CommonResultMap" type="com.xinxin.topro.base.sqlservermodel.OrderInfo" >
  61. <result column="RecordId" property="recordid" jdbcType="INTEGER" />
  62. <result column="VisitNo" property="visitno" jdbcType="VARCHAR" />
  63. <result column="InfantID" property="infantid" jdbcType="VARCHAR" />
  64. <result column="ChartNo" property="chartno" jdbcType="VARCHAR" />
  65. <result column="DepartNo" property="departno" jdbcType="VARCHAR" />
  66. <result column="DepartName" property="departname" jdbcType="VARCHAR" />
  67. <result column="Gender" property="gender" jdbcType="VARCHAR" />
  68. <result column="Age" property="age" jdbcType="INTEGER" />
  69. <result column="BirthDay" property="birthday" jdbcType="TIMESTAMP" />
  70. <result column="DivNo" property="divno" jdbcType="VARCHAR" />
  71. <result column="DivName" property="divname" jdbcType="NVARCHAR" />
  72. <result column="BedNo" property="bedno" jdbcType="VARCHAR" />
  73. <result column="AdmitTime" property="admittime" jdbcType="TIMESTAMP" />
  74. <result column="IdNo" property="idno" jdbcType="VARCHAR" />
  75. <result column="PhyDoctor" property="phydoctor" jdbcType="VARCHAR" />
  76. <result column="OrderNo" property="orderno" jdbcType="VARCHAR" />
  77. <result column="OrderUser" property="orderuser" jdbcType="VARCHAR" />
  78. <result column="OrderTime" property="ordertime" jdbcType="TIMESTAMP" />
  79. <result column="PreExecTime" property="preexectime" jdbcType="TIMESTAMP" />
  80. <result column="PreExecLocName" property="preexeclocname" jdbcType="VARCHAR" />
  81. <result column="PreExecBed" property="preexecbed" jdbcType="VARCHAR" />
  82. <result column="ExecTime" property="exectime" jdbcType="TIMESTAMP" />
  83. <result column="ExecLocName" property="execlocname" jdbcType="VARCHAR" />
  84. <result column="ItemNo" property="itemno" jdbcType="VARCHAR" />
  85. <result column="Dose" property="dose" jdbcType="DECIMAL" />
  86. <result column="DoseUnit" property="doseunit" jdbcType="VARCHAR" />
  87. <result column="WayType" property="waytype" jdbcType="VARCHAR" />
  88. <result column="WayName" property="wayname" jdbcType="VARCHAR" />
  89. <result column="ItemCode" property="itemcode" jdbcType="VARCHAR" />
  90. <result column="ItemName" property="itemname" jdbcType="VARCHAR" />
  91. <result column="OrderType" property="ordertype" jdbcType="INTEGER" />
  92. <result column="BigType" property="bigtype" jdbcType="VARCHAR" />
  93. <result column="PairItemNo" property="pairitemno" jdbcType="VARCHAR" />
  94. <result column="Rate" property="rate" jdbcType="VARCHAR" />
  95. <result column="RateUnit" property="rateunit" jdbcType="VARCHAR" />
  96. <result column="TakeMedWay" property="takemedway" jdbcType="VARCHAR" />
  97. <result column="Usage" property="usage" jdbcType="VARCHAR" />
  98. <result column="LongOrTempFlag" property="longortempflag" jdbcType="INTEGER" />
  99. <result column="ExecStatus" property="execstatus" jdbcType="INTEGER" />
  100. <result column="BloodStatus" property="bloodstatus" jdbcType="INTEGER" />
  101. <result column="DrugBarCode" property="drugbarcode" jdbcType="VARCHAR" />
  102. </resultMap>
  103. <insert id="insert" parameterType="com.xinxin.topro.pubservice.mysqlModel.InpExpandOrder" >
  104. insert into v_expand_order (RecordId, VisitNo, PtName,
  105. InfantID, ChartNo, DepartNo,
  106. DepartName, Gender, Age,
  107. PtWeight, VisitZone, BirthDay,
  108. DivNo, DivName, BedNo,
  109. AdmitTime, IdNo, PhyDoctor,
  110. InHospitalStatus, OrderNo, OrderUser,
  111. OrderUserName, OrderTime, PreExecTime,
  112. PreExecLocName, PreExecBed, ExecTime,
  113. ExecLocName, ItemNo, Dose,
  114. DoseUnit, WayNo, SkinTest,
  115. WayType, WayName, ItemCode,
  116. ItemName, OrderType, BigType,
  117. PairItemNo, Rate, RateUnit,
  118. TakeMedWay, Usage, LongOrTempFlag,
  119. ExecStatus, BloodStatus, Advise,
  120. DrugBarCode)
  121. values (#{recordid,jdbcType=INTEGER}, #{visitno,jdbcType=VARCHAR}, #{ptname,jdbcType=VARCHAR},
  122. #{infantid,jdbcType=INTEGER}, #{chartno,jdbcType=VARCHAR}, #{departno,jdbcType=VARCHAR},
  123. #{departname,jdbcType=CHAR}, #{gender,jdbcType=VARCHAR}, #{age,jdbcType=BIGINT},
  124. #{ptweight,jdbcType=DOUBLE}, #{visitzone,jdbcType=INTEGER}, #{birthday,jdbcType=DATE},
  125. #{divno,jdbcType=VARCHAR}, #{divname,jdbcType=CHAR}, #{bedno,jdbcType=VARCHAR},
  126. #{admittime,jdbcType=TIMESTAMP}, #{idno,jdbcType=VARCHAR}, #{phydoctor,jdbcType=VARCHAR},
  127. #{inhospitalstatus,jdbcType=INTEGER}, #{orderno,jdbcType=VARCHAR}, #{orderuser,jdbcType=VARCHAR},
  128. #{orderusername,jdbcType=VARCHAR}, #{ordertime,jdbcType=TIMESTAMP}, #{preexectime,jdbcType=TIMESTAMP},
  129. #{preexeclocname,jdbcType=CHAR}, #{preexecbed,jdbcType=CHAR}, #{exectime,jdbcType=CHAR},
  130. #{execlocname,jdbcType=CHAR}, #{itemno,jdbcType=VARCHAR}, #{dose,jdbcType=DOUBLE},
  131. #{doseunit,jdbcType=VARCHAR}, #{wayno,jdbcType=CHAR}, #{skintest,jdbcType=CHAR},
  132. #{waytype,jdbcType=VARCHAR}, #{wayname,jdbcType=CHAR}, #{itemcode,jdbcType=VARCHAR},
  133. #{itemname,jdbcType=VARCHAR}, #{ordertype,jdbcType=INTEGER}, #{bigtype,jdbcType=CHAR},
  134. #{pairitemno,jdbcType=VARCHAR}, #{rate,jdbcType=VARCHAR}, #{rateunit,jdbcType=VARCHAR},
  135. #{takemedway,jdbcType=INTEGER}, #{usage,jdbcType=VARCHAR}, #{longortempflag,jdbcType=INTEGER},
  136. #{execstatus,jdbcType=INTEGER}, #{bloodstatus,jdbcType=CHAR}, #{advise,jdbcType=VARCHAR},
  137. #{drugbarcode,jdbcType=VARCHAR})
  138. </insert>
  139. <insert id="insertSelective" parameterType="com.xinxin.topro.pubservice.mysqlModel.InpExpandOrder" >
  140. insert into v_expand_order
  141. <trim prefix="(" suffix=")" suffixOverrides="," >
  142. <if test="recordid != null" >
  143. RecordId,
  144. </if>
  145. <if test="visitno != null" >
  146. VisitNo,
  147. </if>
  148. <if test="ptname != null" >
  149. PtName,
  150. </if>
  151. <if test="infantid != null" >
  152. InfantID,
  153. </if>
  154. <if test="chartno != null" >
  155. ChartNo,
  156. </if>
  157. <if test="departno != null" >
  158. DepartNo,
  159. </if>
  160. <if test="departname != null" >
  161. DepartName,
  162. </if>
  163. <if test="gender != null" >
  164. Gender,
  165. </if>
  166. <if test="age != null" >
  167. Age,
  168. </if>
  169. <if test="ptweight != null" >
  170. PtWeight,
  171. </if>
  172. <if test="visitzone != null" >
  173. VisitZone,
  174. </if>
  175. <if test="birthday != null" >
  176. BirthDay,
  177. </if>
  178. <if test="divno != null" >
  179. DivNo,
  180. </if>
  181. <if test="divname != null" >
  182. DivName,
  183. </if>
  184. <if test="bedno != null" >
  185. BedNo,
  186. </if>
  187. <if test="admittime != null" >
  188. AdmitTime,
  189. </if>
  190. <if test="idno != null" >
  191. IdNo,
  192. </if>
  193. <if test="phydoctor != null" >
  194. PhyDoctor,
  195. </if>
  196. <if test="inhospitalstatus != null" >
  197. InHospitalStatus,
  198. </if>
  199. <if test="orderno != null" >
  200. OrderNo,
  201. </if>
  202. <if test="orderuser != null" >
  203. OrderUser,
  204. </if>
  205. <if test="orderusername != null" >
  206. OrderUserName,
  207. </if>
  208. <if test="ordertime != null" >
  209. OrderTime,
  210. </if>
  211. <if test="preexectime != null" >
  212. PreExecTime,
  213. </if>
  214. <if test="preexeclocname != null" >
  215. PreExecLocName,
  216. </if>
  217. <if test="preexecbed != null" >
  218. PreExecBed,
  219. </if>
  220. <if test="exectime != null" >
  221. ExecTime,
  222. </if>
  223. <if test="execlocname != null" >
  224. ExecLocName,
  225. </if>
  226. <if test="itemno != null" >
  227. ItemNo,
  228. </if>
  229. <if test="dose != null" >
  230. Dose,
  231. </if>
  232. <if test="doseunit != null" >
  233. DoseUnit,
  234. </if>
  235. <if test="wayno != null" >
  236. WayNo,
  237. </if>
  238. <if test="skintest != null" >
  239. SkinTest,
  240. </if>
  241. <if test="waytype != null" >
  242. WayType,
  243. </if>
  244. <if test="wayname != null" >
  245. WayName,
  246. </if>
  247. <if test="itemcode != null" >
  248. ItemCode,
  249. </if>
  250. <if test="itemname != null" >
  251. ItemName,
  252. </if>
  253. <if test="ordertype != null" >
  254. OrderType,
  255. </if>
  256. <if test="bigtype != null" >
  257. BigType,
  258. </if>
  259. <if test="pairitemno != null" >
  260. PairItemNo,
  261. </if>
  262. <if test="rate != null" >
  263. Rate,
  264. </if>
  265. <if test="rateunit != null" >
  266. RateUnit,
  267. </if>
  268. <if test="takemedway != null" >
  269. TakeMedWay,
  270. </if>
  271. <if test="usage != null" >
  272. Usage,
  273. </if>
  274. <if test="longortempflag != null" >
  275. LongOrTempFlag,
  276. </if>
  277. <if test="execstatus != null" >
  278. ExecStatus,
  279. </if>
  280. <if test="bloodstatus != null" >
  281. BloodStatus,
  282. </if>
  283. <if test="advise != null" >
  284. Advise,
  285. </if>
  286. <if test="drugbarcode != null" >
  287. DrugBarCode,
  288. </if>
  289. </trim>
  290. <trim prefix="values (" suffix=")" suffixOverrides="," >
  291. <if test="recordid != null" >
  292. #{recordid,jdbcType=INTEGER},
  293. </if>
  294. <if test="visitno != null" >
  295. #{visitno,jdbcType=VARCHAR},
  296. </if>
  297. <if test="ptname != null" >
  298. #{ptname,jdbcType=VARCHAR},
  299. </if>
  300. <if test="infantid != null" >
  301. #{infantid,jdbcType=INTEGER},
  302. </if>
  303. <if test="chartno != null" >
  304. #{chartno,jdbcType=VARCHAR},
  305. </if>
  306. <if test="departno != null" >
  307. #{departno,jdbcType=VARCHAR},
  308. </if>
  309. <if test="departname != null" >
  310. #{departname,jdbcType=CHAR},
  311. </if>
  312. <if test="gender != null" >
  313. #{gender,jdbcType=VARCHAR},
  314. </if>
  315. <if test="age != null" >
  316. #{age,jdbcType=BIGINT},
  317. </if>
  318. <if test="ptweight != null" >
  319. #{ptweight,jdbcType=DOUBLE},
  320. </if>
  321. <if test="visitzone != null" >
  322. #{visitzone,jdbcType=INTEGER},
  323. </if>
  324. <if test="birthday != null" >
  325. #{birthday,jdbcType=DATE},
  326. </if>
  327. <if test="divno != null" >
  328. #{divno,jdbcType=VARCHAR},
  329. </if>
  330. <if test="divname != null" >
  331. #{divname,jdbcType=CHAR},
  332. </if>
  333. <if test="bedno != null" >
  334. #{bedno,jdbcType=VARCHAR},
  335. </if>
  336. <if test="admittime != null" >
  337. #{admittime,jdbcType=TIMESTAMP},
  338. </if>
  339. <if test="idno != null" >
  340. #{idno,jdbcType=VARCHAR},
  341. </if>
  342. <if test="phydoctor != null" >
  343. #{phydoctor,jdbcType=VARCHAR},
  344. </if>
  345. <if test="inhospitalstatus != null" >
  346. #{inhospitalstatus,jdbcType=INTEGER},
  347. </if>
  348. <if test="orderno != null" >
  349. #{orderno,jdbcType=VARCHAR},
  350. </if>
  351. <if test="orderuser != null" >
  352. #{orderuser,jdbcType=VARCHAR},
  353. </if>
  354. <if test="orderusername != null" >
  355. #{orderusername,jdbcType=VARCHAR},
  356. </if>
  357. <if test="ordertime != null" >
  358. #{ordertime,jdbcType=TIMESTAMP},
  359. </if>
  360. <if test="preexectime != null" >
  361. #{preexectime,jdbcType=TIMESTAMP},
  362. </if>
  363. <if test="preexeclocname != null" >
  364. #{preexeclocname,jdbcType=CHAR},
  365. </if>
  366. <if test="preexecbed != null" >
  367. #{preexecbed,jdbcType=CHAR},
  368. </if>
  369. <if test="exectime != null" >
  370. #{exectime,jdbcType=CHAR},
  371. </if>
  372. <if test="execlocname != null" >
  373. #{execlocname,jdbcType=CHAR},
  374. </if>
  375. <if test="itemno != null" >
  376. #{itemno,jdbcType=VARCHAR},
  377. </if>
  378. <if test="dose != null" >
  379. #{dose,jdbcType=DOUBLE},
  380. </if>
  381. <if test="doseunit != null" >
  382. #{doseunit,jdbcType=VARCHAR},
  383. </if>
  384. <if test="wayno != null" >
  385. #{wayno,jdbcType=CHAR},
  386. </if>
  387. <if test="skintest != null" >
  388. #{skintest,jdbcType=CHAR},
  389. </if>
  390. <if test="waytype != null" >
  391. #{waytype,jdbcType=VARCHAR},
  392. </if>
  393. <if test="wayname != null" >
  394. #{wayname,jdbcType=CHAR},
  395. </if>
  396. <if test="itemcode != null" >
  397. #{itemcode,jdbcType=VARCHAR},
  398. </if>
  399. <if test="itemname != null" >
  400. #{itemname,jdbcType=VARCHAR},
  401. </if>
  402. <if test="ordertype != null" >
  403. #{ordertype,jdbcType=INTEGER},
  404. </if>
  405. <if test="bigtype != null" >
  406. #{bigtype,jdbcType=CHAR},
  407. </if>
  408. <if test="pairitemno != null" >
  409. #{pairitemno,jdbcType=VARCHAR},
  410. </if>
  411. <if test="rate != null" >
  412. #{rate,jdbcType=VARCHAR},
  413. </if>
  414. <if test="rateunit != null" >
  415. #{rateunit,jdbcType=VARCHAR},
  416. </if>
  417. <if test="takemedway != null" >
  418. #{takemedway,jdbcType=INTEGER},
  419. </if>
  420. <if test="usage != null" >
  421. #{usage,jdbcType=VARCHAR},
  422. </if>
  423. <if test="longortempflag != null" >
  424. #{longortempflag,jdbcType=INTEGER},
  425. </if>
  426. <if test="execstatus != null" >
  427. #{execstatus,jdbcType=INTEGER},
  428. </if>
  429. <if test="bloodstatus != null" >
  430. #{bloodstatus,jdbcType=CHAR},
  431. </if>
  432. <if test="advise != null" >
  433. #{advise,jdbcType=VARCHAR},
  434. </if>
  435. <if test="drugbarcode != null" >
  436. #{drugbarcode,jdbcType=VARCHAR},
  437. </if>
  438. </trim>
  439. </insert>
  440. <select id="getOrderInfoByOrderType" resultMap="BaseResultMap">
  441. SELECT a.*,CASE when psm_barcode is null then 0 else 1 end isCollection
  442. from v_expand_order a LEFT JOIN pda_specimen b on a.drugbarcode = b.psm_barcode
  443. where
  444. DepartNo = #{DepartNo,jdbcType=VARCHAR} and InHospitalStatus = 0 and VisitZone = #{visitZone,jdbcType=INTEGER}
  445. and orderType = #{orderType,jdbcType=INTEGER}
  446. </select>
  447. <select id="getSpecimenByPatientNo" resultMap="BaseResultMap">
  448. SELECT * from (
  449. SELECT DISTINCT a.*,CASE when psm_barcode is null then 0 else 1 end isCollection ,PSM_Collect_Time,c.UI_Name
  450. from v_expand_order a LEFT JOIN pda_specimen b on a.drugbarcode = b.psm_barcode
  451. LEFT JOIN sys_userinfo c on b.PSM_Collector = c.UI_Code
  452. where
  453. VisitNo = #{patientNo,jdbcType=VARCHAR} and InHospitalStatus = 0 and VisitZone = #{visitZone,jdbcType=INTEGER}
  454. and orderType = 3 ) cc where isCollection = #{status,jdbcType=VARCHAR}
  455. <if test="collectTime != null" >
  456. and DATE_FORMAT(PSM_Collect_Time,'%Y-%m-%d') = #{collectTime,jdbcType=VARCHAR}
  457. </if>
  458. </select>
  459. <select id="selectByLabelPrint" resultMap="BaseResultMap">
  460. SELECT c.DB_BedNo BedNo,c.IP_Name PtName,c.IP_Med_Rec ChartNo,c.IP_Sex Gender,a.IEO_DrugValidity validTime,
  461. d.DMW_Name WayName,a.IEO_Rate Rate,a.IEO_Item_Name ItemName,a.IEO_Dose Dose,a.IEO_DoseUnit DoseUnit,a.IEO_Entrust Entrust,
  462. a.IEO_Item_Explain Advise,a.IMO_Med_Usage `Usage`,
  463. (case a.IEO_TakeMed_Way when 1 then CONCAT('JSY-', a.IEO_ID)
  464. ELSE a.IEO_Bar_Code END)
  465. AS DrugBarCode,a.IEO_Pre_ExecTime PreExecTime,a.IEO_TakeMed_Way TakeMedWay
  466. from inp_expand_order a
  467. INNER JOIN inp_patient c on a.PatientNo = c.IP_PatientNo
  468. LEFT JOIN dic_med_way d on a.IEO_AdviceNo = d.DMW_Code
  469. where
  470. a.PatientNo in <foreach item='item' index='index' collection='patinetNos' open='(' separator=',' close=')'> #{item} </foreach>
  471. -- and (b.IMO_PIVA != 1 or IEO_TakeMed_Way in (2,3))
  472. <if test="takeMedWay != null" >
  473. and IEO_TakeMed_Way = #{takeMedWay}
  474. </if>
  475. <if test="longTemp != null" >
  476. and IEO_IsLong = #{longTemp,jdbcType=INTEGER}
  477. </if>
  478. and ((a.IEO_Bar_Code != '' and a.IEO_Bar_Code is not null) or (IEO_TakeMed_Way = 1))
  479. <choose>
  480. <when test="timeStatus == 3">
  481. and (IEO_Open_Time BETWEEN #{orderSTime,jdbcType=TIMESTAMP} and #{orderETime,jdbcType=TIMESTAMP})
  482. </when>
  483. <otherwise>
  484. and (IEO_Pre_ExecTime BETWEEN #{preSTime,jdbcType=TIMESTAMP} and #{preETime,jdbcType=TIMESTAMP})
  485. </otherwise>
  486. </choose>
  487. <if test="medWays != null">
  488. <choose>
  489. <when test="inFlag==1">
  490. and IEO_Med_Way in <foreach item='item' index='index' collection='medWays' open='(' separator=',' close=')'> #{item} </foreach>
  491. </when>
  492. <otherwise>
  493. and IEO_Med_Way not in <foreach item='item' index='index' collection='medWays' open='(' separator=',' close=')'> #{item} </foreach>
  494. </otherwise>
  495. </choose>
  496. </if>
  497. </select>
  498. <select id="getRecivedOrderByDispensedTime" resultMap="CommonResultMap">
  499. SELECT `a`.`PatientNo` AS `VisitNo`,
  500. `a`.`IEO_Dose` AS `Dose`,
  501. `a`.`IEO_DoseUnit` AS `DoseUnit`,
  502. `a`.`IEO_Item_Name` AS `ItemName`,
  503. `a`.`IEO_Item_OrderID` AS `PairItemNo`,
  504. `a`.`IMO_Med_Usage` AS `Usage`,
  505. `a`.`IEO_IsLong` AS `LongOrTempFlag`,
  506. `a`.`IEO_Pre_ExecTime` AS `PreExecTime`,
  507. `d`.`DMW_Name` AS `WayName`,`a`.`IEO_Item_Explain` AS `Advise`,
  508. a.IEO_Bar_Code AS `DrugBarCode`
  509. FROM `inp_expand_order` `a`
  510. LEFT JOIN `dic_med_way` `d` ON `a`.`IEO_AdviceNo` = `d`.`DMW_Code`
  511. where DATE_FORMAT(a.IEO_DispensedTime,'%Y-%m-%d') = #{PreExecTime}
  512. and a.DW_WardDm = #{DepartNo}
  513. and a.HI_ID = #{visitZone}
  514. and (a.IEO_Order_Type = 2 or a.IEO_Order_Type = 99)
  515. and a.IEO_Status = 3
  516. and a.ieo_bar_code is not null
  517. and a.PatientNo in <foreach item='item' index='index' collection='list' open='(' separator=',' close=')'> #{item} </foreach>
  518. </select>
  519. <select id="getTotalBarCode" resultType="String">
  520. SELECT ieo_bar_code FROM inp_expand_order
  521. WHERE DATE_FORMAT(IEO_DispensedTime,'%Y-%m-%d') = #{PreExecTime}
  522. AND DW_WardDm = #{DepartNo} AND IEO_Status = 3 AND HI_ID = #{visitZone}
  523. and (IEO_Order_Type = 2 or IEO_Order_Type = 99)
  524. and patientno in <foreach item='item' index='index' collection='list' open='(' separator=',' close=')'> #{item} </foreach>
  525. and ieo_bar_code is not null GROUP BY ieo_bar_code
  526. </select>
  527. <select id="getOrderCountByBarCodes" resultType="Integer">
  528. select count(1) from pda_order WHERE PO_OperatType = 0 and PO_IsDel = 0 and po_barcode
  529. in <foreach item='item' index='index' collection='barCodes' open='(' separator=',' close=')'> #{item} </foreach>
  530. GROUP BY po_barcode
  531. </select>
  532. <update id="updateByBarCodes" >
  533. <foreach collection="ids" item="item" index="index" open="" close="" separator=";">
  534. update inp_expand_order
  535. <set>
  536. IEO_Bar_Code= CONCAT('JSY-', ${item})
  537. </set>
  538. where IEO_ID = ${item}
  539. </foreach>
  540. </update>
  541. </mapper>