YiZhuLuRuDao.java 82 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645
  1. package thyyxxk.webserver.dao.his.zhuyuanyisheng;
  2. import com.baomidou.mybatisplus.core.conditions.Wrapper;
  3. import com.baomidou.mybatisplus.core.toolkit.Constants;
  4. import org.apache.ibatis.annotations.*;
  5. import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
  6. import thyyxxk.webserver.entity.datamodify.YzActOrder;
  7. import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
  8. import thyyxxk.webserver.entity.inpatient.patient.Overview;
  9. import thyyxxk.webserver.entity.inpatient.patient.Patient;
  10. import thyyxxk.webserver.entity.zhuyuanyisheng.DoctorSOrderFee;
  11. import thyyxxk.webserver.entity.zhuyuanyisheng.ZyOrderZk;
  12. import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.*;
  13. import java.math.BigDecimal;
  14. import java.util.Date;
  15. import java.util.List;
  16. import java.util.Map;
  17. import java.util.Set;
  18. /**
  19. * <p>
  20. * 描述: 医嘱录入dao
  21. * </p>
  22. *
  23. * @author xc
  24. * @date 2022-01-04 17:00
  25. */
  26. @Mapper
  27. public interface YiZhuLuRuDao {
  28. @Select("SELECT " +
  29. "RTRIM(a.bed_no) bedNo, " +
  30. "RTRIM(a.inpatient_no) inpatientNo, " +
  31. "a.admiss_times, " +
  32. "RTRIM(a.name) as name, " +
  33. "sex=isnull(a.sex, 9), " +
  34. "mdtrtId=(select b.mdtrt_id from t_si_pat_info b where b.pat_no=a.inpatient_no " +
  35. "and b.times=a.admiss_times and b.ledger_sn=a.times_billed), " +
  36. "injurySerialNo=(select serial_no from t_injury_si_pat_info where pat_no=a.inpatient_no " +
  37. "and times=a.admiss_times and ledger_sn=a.times_billed), " +
  38. "medType=a.med_type, " +
  39. "dismissOrder=(select count(1) from yz_act_order b where b.inpatient_no=a.inpatient_no " +
  40. "and b.admiss_times=a.admiss_times and status_flag > '1' and isnull(group_no,'00')='00' " +
  41. "and order_code in ('06026','06053','05973'))," +
  42. "orderNoCount = (select count(1) " +
  43. " from yz_act_order c " +
  44. " where a.inpatient_no = c.inpatient_no " +
  45. " and c.admiss_times = a.admiss_times " +
  46. " and c.status_flag = '1' " +
  47. " and c.enter_oper = #{userCode}), " +
  48. " refer_physician, " +
  49. " (select name from a_employee_mi where code = refer_physician) as refer_physician_name, " +
  50. " consult_physician, " +
  51. " (select name from a_employee_mi where code = refer_physician) as consult_physician_name, " +
  52. " dept_director, " +
  53. " (select name from a_employee_mi where code = refer_physician) as dept_director_name " +
  54. "FROM zy_actpatient a with (NOLOCK) " +
  55. "where refer_physician = #{code} " +
  56. "ORDER BY cast(bed_no AS int) ")
  57. List<Patient> getMyPatient(String code);
  58. @Select("select isnull(balance,0) balance, " +
  59. " total_charge, " +
  60. " charge1, " +
  61. " charge2, " +
  62. " charge3, " +
  63. " charge4, " +
  64. " charge5, " +
  65. " charge6, " +
  66. " charge7, " +
  67. " charge8, " +
  68. " charge9, " +
  69. " charge10, " +
  70. " charge11, " +
  71. " charge12, " +
  72. " charge13, " +
  73. " charge14, " +
  74. " charge15, " +
  75. " charge16, " +
  76. " charge17, " +
  77. " charge18, " +
  78. " charge19, " +
  79. " charge20, " +
  80. " charge21, " +
  81. " charge22, " +
  82. " charge23, " +
  83. " charge24, " +
  84. " charge25, " +
  85. " charge26, " +
  86. " charge27, " +
  87. " charge28, " +
  88. " charge29, " +
  89. " charge30, " +
  90. " yp = (isnull(charge1 + charge2 + charge28, 0))," +
  91. " jyjc = (isnull(charge8 + charge9 + charge11 + charge18 + charge13, 0))," +
  92. " isnull(charge_yb, 0) charge_yb " +
  93. "from zy_ledger_file with (NOLOCK) " +
  94. "where inpatient_no = #{inpatientNo} " +
  95. " and admiss_times = #{admissTimes} " +
  96. " and ledger_sn = #{ledgerSn} ")
  97. HuanZheFeiYong feiYongXinXi(@Param("inpatientNo") String inpatientNo,
  98. @Param("admissTimes") Integer admissTimes,
  99. @Param("ledgerSn") Integer ledgerSn);
  100. @Select("select a.act_order_no, " +
  101. " cast(cast(a.act_order_no as decimal) as varchar) id," +
  102. " newOrderFlag = (select count(*) from new_act_order_recording where new_act_order_recording.act_order_no = a.act_order_no), " +
  103. " order_code, " +
  104. " order_name, " +
  105. " rtrim(frequ_code) frequ_code, " +
  106. " frequ_code_name = (select rtrim(comm) " +
  107. " from yz_order_frequency " +
  108. " where code = frequ_code), " +
  109. " instruction, " +
  110. " discription, " +
  111. " infant_flag, " +
  112. " order_time, " +
  113. " physician, " +
  114. " start_time, " +
  115. " drug_specification, " +
  116. " drug_quan, " +
  117. " drug_quan_name = (select name " +
  118. " from yp_zd_unit with (NOLOCK) " +
  119. " where code = mini_unit), " +
  120. " supply_code, " +
  121. " supply_code_name = (select supply_name " +
  122. " from yz_supply_type with (NOLOCK) " +
  123. " where yz_supply_type.supply_code = a.supply_code), " +
  124. " a.inpatient_no, " +
  125. " a.admiss_times, " +
  126. " drug_flag, " +
  127. " enter_oper," +
  128. "enter_oper_name = (select top (1) rtrim(name) " +
  129. " from a_employee_mi with (NOLOCK) " +
  130. " where code = enter_oper) /* 录入人 */, " +
  131. " enter_time, " +
  132. " mini_unit, " +
  133. " drug_weight, " +
  134. " drug_weight_unit, " +
  135. " rtrim(status_flag) status_flag, " +
  136. " status_time, " +
  137. " parent_no," +
  138. " parent_no_name = (select kfc.order_name from yz_act_order kfc where kfc.act_order_no = a.parent_no)," +
  139. " self_buy, " +
  140. " dose, " +
  141. " dose_unit, " +
  142. " dose_unit_name = (select name " +
  143. " from yp_zd_unit with (NOLOCK) " +
  144. " where dose_unit = code), " +
  145. " drug_occ, " +
  146. " drug_volume, " +
  147. " drug_vol_unit, " +
  148. " exclu_back_time, " +
  149. " exclu_act_order_no, " +
  150. " pay_self, " +
  151. " serial, " +
  152. " group_no, " +
  153. " signer, " +
  154. " cl_code, " +
  155. " doctor_flag, " +
  156. " emergency_flag, " +
  157. " exclu_type='', " +
  158. " end_time_b=end_time, " +
  159. " exec_unit, " +
  160. " dept_code, " +
  161. " ward_code, " +
  162. " new_flag='0', " +
  163. " order_no_pattern=0, " +
  164. " suprice_flag='', " +
  165. " self_flag ='', " +
  166. " pack_size=0.0, " +
  167. " parent_no_c= -1000, " +
  168. " reg_flag, " +
  169. " parent_flag='', " +
  170. " yb_self_flag, " +
  171. " kf_flag, " +
  172. " refer_physician, " +
  173. " consult_physician, " +
  174. " physician_name = (select top (1) rtrim(name) " +
  175. " from a_employee_mi with (NOLOCK) " +
  176. " where code = physician) /* 开这个医嘱的医生 */, " +
  177. " exec_unit_name = (select top (1) rtrim(name) " +
  178. " from zd_unit_code with (NOLOCK) " +
  179. " where code = exec_unit), " +
  180. " /*管床医生*/ " +
  181. " refer_physician_name = (select rtrim(name) " +
  182. " from a_employee_mi with (NOLOCK) " +
  183. " where code = refer_physician), " +
  184. " group_no_name = (select rtrim(group_name) " +
  185. " from yp_zd_group_name with (NOLOCK) " +
  186. " where a.group_no = group_no), " +
  187. " signer_name = (select top (1) rtrim(name) " +
  188. " from a_employee_mi with (NOLOCK) " +
  189. " where code = signer) /*确认人*/, " +
  190. " confirm_time /*确认时间*/, " +
  191. " modifier, " +
  192. " modifier_name = (select top (1) rtrim(name) " +
  193. " from a_employee_mi with (NOLOCK) " +
  194. " where code = modifier) /*停止人*/, " +
  195. " end_time /*停止时间*/," +
  196. " b.new_ward as zkWardCode, " +
  197. " b.new_dept as zkDeptCode," +
  198. " kss.yyfs , kss.ssqk,kss.yysj," +
  199. " executer1 = (select name from a_employee_mi where code = executer1), " +
  200. " executer2= (select name from a_employee_mi where code = executer2) " +
  201. "from yz_act_order a with (NOLOCK) left join " +
  202. "zy_order_zk b with (NOLOCK) on (a.act_order_no = b.act_order_no) left join " +
  203. "yz_act_record_kss kss on (a.act_order_no = kss.act_order_no) " +
  204. " ${ew.customSqlSegment} ")
  205. List<XinZhenYzActOrder> selectOrderNo(@Param(Constants.WRAPPER) Wrapper<?> wq);
  206. @Select("select act_order_no, " +
  207. "rtrim(status_flag) status_flag," +
  208. "frequ_code," +
  209. "enter_oper," +
  210. "inpatient_no " +
  211. "from yz_act_order with (NOLOCK) " +
  212. "${ew.customSqlSegment}")
  213. List<XinZhenYzActOrder> getOrdersToDelete(@Param(Constants.WRAPPER) Wrapper<?> wq);
  214. @Update("update yz_act_order " +
  215. "set " +
  216. " order_time = #{order.orderTime,jdbcType=TIMESTAMP}, " +
  217. " start_time = #{order.startTime,jdbcType=TIMESTAMP}, " +
  218. " end_time = #{order.endTime,jdbcType=TIMESTAMP}, " +
  219. " supply_code = '044', " +
  220. " frequ_code = #{order.frequCode}," +
  221. " group_no = #{order.groupNo}," +
  222. " exec_unit = #{order.execUnit} " +
  223. " modifier = #{order.modifier} " +
  224. "where act_order_no = ${orderNo} ")
  225. void updateSubOrderStatus(BigDecimal orderNo, XinZhenYzActOrder order);
  226. @Delete("delete yz_act_order ${ew.customSqlSegment} ")
  227. void deleteMultipleOrders(@Param(Constants.WRAPPER) Wrapper<?> wq);
  228. @Update("<script>" +
  229. "update yz_act_order " +
  230. "set parent_no = null " +
  231. "where inpatient_no = #{patNo} " +
  232. " and admiss_times = #{times} " +
  233. " and parent_no in " +
  234. "<foreach collection='list' item='item' open='(' close=')' separator=','>" +
  235. "#{item}" +
  236. "</foreach>" +
  237. "</script>")
  238. void deleteParentChildRelationship(String patNo,
  239. Integer times,
  240. List<BigDecimal> list);
  241. @Select("<script>" +
  242. "<foreach collection=\"list\" item=\"item\" index=\"index\" separator=\";\">" +
  243. "update yz_act_order " +
  244. "set modifier = #{userCode}, " +
  245. " end_time = #{item.endTime} " +
  246. "where inpatient_no = #{patNo} " +
  247. " and admiss_times = #{times}" +
  248. " and (act_order_no = #{item.actOrderNo} or parent_no = #{item.actOrderNo}) " +
  249. " and end_time is null" +
  250. "</foreach>" +
  251. "</script>")
  252. void setStopTime(List<XinZhenYzActOrder> list,
  253. String userCode,
  254. String patNo,
  255. Integer times);
  256. @Select("SELECT rtrim(a.code) + rtrim(serial) as id, " +
  257. " py_code=a.py_code, " +
  258. " d_code =a.d_code, " +
  259. " order_code =a.code, " +
  260. " order_name =a.name, " +
  261. " drug_specification=a.specification, " +
  262. " drug_flag =case a.infusion_flag " +
  263. " when '1' then 'i' " +
  264. " else (case categories_flag " +
  265. " when '0' " +
  266. " then 'd' " +
  267. " else 'z' " +
  268. " end) " +
  269. " end, " +
  270. " parent_code=null, " +
  271. " exclu_group_type=null, " +
  272. " discription=case a.infusion_flag " +
  273. " when '1' then '大输液' " +
  274. " else (case " +
  275. " when a.code >= '30000' and a.code < '50000' then '中药' " +
  276. " else '西药 ' end) end + convert(char(10), a.pack_retprice) + '元' + '(医保类别:' + " +
  277. " ltrim(rtrim(yb_flag_new)) + ';报销比例:' + ltrim(rtrim(yb_bl_new)) + ';医保说明:' + " +
  278. " ltrim(rtrim(yb_comment_new)) + ')', " +
  279. " serial=a.serial, " +
  280. " group_no=a.group_no, " +
  281. " infusion_flag=a.infusion_flag, " +
  282. " group_name =a.group_name, " +
  283. " pack_size=a.pack_size, " +
  284. " order_class='Y', " +
  285. " spec_pack=a.spec_pack, " +
  286. " jsy_flag =a.jsy_flag, " +
  287. " xnh_flag, " +
  288. " yb_comment, " +
  289. " dosage = a.dosage, " +
  290. " yb_type, " +
  291. " yb_flag_new," +
  292. " father_flag, " +
  293. " manu_name=(select name from yp_zd_manufactory with (NOLOCK) where code = a.manu_code), " +
  294. " stock_amount=a.stock_amount, " +
  295. " national_code," +
  296. " national_name " +
  297. "FROM view_yp_zd_dict_base_yf a with (NOLOCK) " +
  298. "WHERE isnull(a.visible_flag_zy, '') <> '1' " +
  299. " and (a.py_code like #{code} or a.name like #{code} or code like #{code}) " +
  300. " and group_no = '${groupNo}' ")
  301. List<YiZhuMingChen> yiZhuYaoPing(@Param("code") String code,
  302. @Param("groupNo") String groupNo);
  303. @Select("select act_order_no, " +
  304. "rtrim(status_flag) as status_flag," +
  305. "rtrim(frequ_code) as frequ_code," +
  306. "rtrim(supply_code) as supply_code, " +
  307. "inpatient_no," +
  308. "admiss_times," +
  309. "enter_oper," +
  310. "rtrim(serial) as serial," +
  311. "order_time," +
  312. "start_time," +
  313. "end_time," +
  314. "group_no," +
  315. "ward_code," +
  316. "parent_no " +
  317. "from yz_act_order with (NOLOCK) " +
  318. "where act_order_no = #{orderNo} ")
  319. XinZhenYzActOrder getActOrderNoOne(String orderNo);
  320. @Select("select cast(cast(act_order_no as decimal) as varchar) " +
  321. "from yz_act_order with (NOLOCK) " +
  322. "where parent_no = #{orderNo}")
  323. List<String> getParentChildOrders(String orderNo);
  324. @Select("<script>" +
  325. "select * " +
  326. "from zy_detail_charge with (NOLOCK) " +
  327. "where inpatient_no = #{patNo} " +
  328. " and admiss_times = #{times} " +
  329. " and ori_detail_sn is null" +
  330. " and charge_fee > 0 " +
  331. " and order_no in " +
  332. "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
  333. " #{item}" +
  334. "</foreach>" +
  335. "</script>")
  336. List<ZyDetailCharge> getExpenseData(String patNo,
  337. Integer times,
  338. List<String> list);
  339. @Update("<script>" +
  340. "update zy_detail_charge " +
  341. "set ori_detail_sn = -1 " +
  342. "where inpatient_no = #{patNo} " +
  343. " and admiss_times = #{times} " +
  344. " and ori_detail_sn is null " +
  345. " and charge_fee > 0 " +
  346. " and order_no in " +
  347. "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
  348. " #{item}" +
  349. "</foreach>" +
  350. "</script>")
  351. void updateItemFlag(String patNo,
  352. Integer times,
  353. List<String> list);
  354. @Update("update yz_act_order " +
  355. "set status_flag = '-1', " +
  356. " end_time = getdate(), " +
  357. " modifier = #{userCode}, " +
  358. " instruction = #{reasonForCancellation}," +
  359. " order_name = cast('(作废)' + yz_act_order.order_name as char(100))" +
  360. "where act_order_no = #{orderNo}")
  361. void updateVoidedOrders(String orderNo,
  362. String userCode,
  363. String reasonForCancellation);
  364. @Update("update yz_act_order " +
  365. "set status_flag = '-1', " +
  366. " end_time = getdate(), " +
  367. " modifier = #{userCode}, " +
  368. " instruction = #{reasonForCancellation}, " +
  369. " order_name = cast('(作废)' + yz_act_order.order_name as char(100))" +
  370. "where parent_no = #{orderNo}")
  371. void updateChildOrders(String orderNo,
  372. String userCode,
  373. String reasonForCancellation);
  374. /**
  375. * 获取医生下面的病区
  376. *
  377. * @param deptCode 科室编码
  378. * @return
  379. */
  380. @Select("select dept " +
  381. "from zd_dept_all with (NOLOCK) " +
  382. "where small_dept = #{deptCode} " +
  383. " and dept is not null")
  384. List<String> getTheDoctorSDepartment(String deptCode);
  385. /**
  386. * 获取已经确认收费的医嘱
  387. *
  388. * @param orderNo 医嘱号
  389. * @return
  390. */
  391. @Select("select count(*) " +
  392. "from yz_zy_patient_fee with (NOLOCK) " +
  393. "where " +
  394. "inpatient_no = #{patNo} and " +
  395. "admiss_times = #{times} and " +
  396. "act_order_no = #{orderNo} and " +
  397. "charge_status = '1'")
  398. Integer getADoctorSOrderWithADefiniteFee(String patNo,
  399. Integer times,
  400. String orderNo);
  401. @Select("select count(*) " +
  402. "from zy_detail_charge with (NOLOCK) " +
  403. "where inpatient_no = #{patNo} " +
  404. " and admiss_times = #{times} " +
  405. " and order_no = #{orderNo} " +
  406. " and ori_detail_sn is null" +
  407. " and charge_fee > 0 ")
  408. Integer getDetailChargeFee(String patNo,
  409. Integer times,
  410. String orderNo);
  411. @Update("UPDATE " +
  412. " yz_zy_patient_fee " +
  413. "SET charge_status = '2', " +
  414. " op_id = #{userid}, " +
  415. " op_date = GETDATE() " +
  416. "WHERE act_order_no = #{orderNo} " +
  417. " AND inpatient_no = #{patNo} " +
  418. " AND admiss_times = #{times} ")
  419. void cancelMedicalTechnologyAssuranceFee(String userid,
  420. String orderNo,
  421. String patNo,
  422. Integer times);
  423. /**
  424. * 获取,有未确认和未执行的医嘱
  425. *
  426. * @param patNo 住院号
  427. * @param times 住院次数
  428. * @param orderNo 医嘱号
  429. * @return 数据
  430. */
  431. @Select("select count(1) " +
  432. "from yz_act_order with (NOLOCK) " +
  433. "where inpatient_no = #{patNo} " +
  434. " and admiss_times = #{times} " +
  435. " and status_flag in (1, 2)" +
  436. " and frequ_code <> 'ONCE' " +
  437. " and act_order_no <> #{orderNo}")
  438. Integer thereAreUnexecutedOrders(String patNo,
  439. Integer times,
  440. BigDecimal orderNo);
  441. @Select("select count(1) " +
  442. "from yz_act_order " +
  443. "where inpatient_no = #{yz.inpatientNo} " +
  444. " and admiss_times = #{yz.admissTimes} " +
  445. " and status_flag = 1 " +
  446. " and isnull(self_buy, '0') <> '4' " +
  447. " and enter_oper = #{userCode} " +
  448. " and order_code in (select rtrim(order_code) " +
  449. " from yz_zd_order_item_confirm " +
  450. " where item_name = N'出院')")
  451. int selectDischargeOrde(@Param("yz") XinZhenYiZhu yz,
  452. @Param("userCode") String userCode);
  453. @Update("update yz_act_order " +
  454. "set modifier = #{userCode}, " +
  455. " end_time = #{date}," +
  456. " exclu_act_order_no = #{orderNo} " +
  457. "where inpatient_no = #{patNo} " +
  458. " and admiss_times = #{times}" +
  459. " and frequ_code != 'ONCE' " +
  460. " AND status_flag IN (3, 4, 5) " +
  461. " and isnull(end_time, dateadd(day, 1, #{date})) >= #{date} ")
  462. void stopOrder(String patNo, Integer times, Date date, String userCode, BigDecimal orderNo);
  463. @Update("update yz_act_order " +
  464. "set confirm_time = #{confirmDate}, " +
  465. " signer = #{userCode}, " +
  466. " status_time = #{confirmDate}, " +
  467. " status_flag = '2'," +
  468. " supply_code = case " +
  469. " when parent_no is not null then (select isnull(nullif(supply_child, ''), '044') " +
  470. " from yz_supply_type c " +
  471. " where c.supply_code = (select supply_code " +
  472. " from yz_act_order b " +
  473. " where b.act_order_no = yz_act_order.parent_no)) " +
  474. " else " +
  475. " yz_act_order.supply_code end " +
  476. " where act_order_no = #{decimal}")
  477. void confirmOrders(BigDecimal decimal, String userCode, Date confirmDate);
  478. @Update("update yz_act_order " +
  479. "set confirm_time = #{confirmDate}, " +
  480. " signer = #{userCode}, " +
  481. " status_time = #{confirmDate}, " +
  482. " status_flag = '5'," +
  483. " modifier = #{userCode}," +
  484. " end_time = #{confirmDate}, " +
  485. " frequ_code = 'ONCE' " +
  486. " where act_order_no = #{decimal} ")
  487. void takeMedicineAfterDischargeStopOrder(BigDecimal decimal, String userCode, Date confirmDate);
  488. @Delete("delete yz_act_record_kss where act_order_no =#{orderNo}; " +
  489. "delete zy_order_zk where act_order_no =#{orderNo};" +
  490. "delete op_record where inpatient_no = #{patNo} and act_order_no =#{orderNo};" +
  491. "delete ysh_yj_req where inpatient_no =#{patNo} and act_order_no =#{orderNo};" +
  492. "DELETE FROM yz_act_order WHERE act_order_no = #{orderNo}; ")
  493. void toDeleteAnOrder(String orderNo, String patNo);
  494. @Update("UPDATE yz_act_order SET parent_no = NULL WHERE parent_no = #{orderNo} ")
  495. void deleteGroup(String orderNo);
  496. @Delete("delete yz_act_order where " +
  497. "act_order_no = #{orderNo} ")
  498. void deleteOrderNo(String orderNo);
  499. @Insert("INSERT INTO yz_act_order (order_code, order_name, frequ_code, instruction, discription, infant_flag, order_time, " +
  500. " /*录入人*/physician, start_time, drug_specification, drug_quan, supply_code, act_order_no, inpatient_no, " +
  501. " admiss_times, drug_flag/*药品中找这个是 药品的类型 a i d*/, enter_oper, /*录入时间*/ " +
  502. " enter_time, " +
  503. " mini_unit /*药品中找 最小包装规格*/, " +
  504. " drug_weight/*药品的重量*/, drug_weight_unit/*药品重量单位*/, " +
  505. " status_flag/*1*/, self_buy, dose, dose_unit, drug_occ, drug_volume/*药品中的 volum 找*/, " +
  506. " drug_vol_unit/* 药品中的 vol_unit */, pay_self/*0*/, " +
  507. " serial/*前端传*/, group_no/*药房 */, doctor_flag/*写死为 1*/, exec_unit, dept_code/* 在院病人表中的 dept */, " +
  508. " ward_code /* 在院病人表中的 zk_ward*/, " +
  509. " reg_flag/* 0 */, " +
  510. " yb_self_flag/*医保自费标志*/, emergency_flag, " +
  511. " kf_flag /*饭前饭后*/, parent_no, refer_physician/*患者的管床医生*/, end_time," +
  512. " modifier) " +
  513. "values (#{pa.orderCode}, #{pa.orderName}, #{pa.frequCode}, #{pa.instruction}, #{pa.discription}, #{patInfo.infantFlag}, " +
  514. " #{pa.orderTime}, #{userCode}, " +
  515. " #{pa.startTime}, cast(#{pa.drugSpecification} as varchar(16)), #{pa.drugQuan,jdbcType=REAL}, #{pa.supplyCode}, #{pa.actOrderNo,jdbcType=REAL}, #{patInfo.inpatientNo}, " +
  516. " #{patInfo.admissTimes}, #{pa.drugFlag}, #{userCode}, getdate(), " +
  517. " #{pa.miniUnit}, #{pa.drugWeight,jdbcType = REAL}, #{pa.drugWeightUnit,jdbcType=REAL}, '1', #{pa.selfBuy}, " +
  518. " #{pa.dose ,jdbcType = REAL}, #{pa.doseUnit}, #{pa.drugOcc ,jdbcType = REAL}, " +
  519. " #{pa.drugVolume,jdbcType=REAL}, #{pa.drugVolUnit}, '0', #{pa.serial}, #{pa.groupNo}, '1', #{pa.execUnit}, " +
  520. " #{patInfo.deptCode}, #{patInfo.deptCode}, '0', #{pa.ybSelfFlag}, #{pa.emergencyFlag}, " +
  521. " #{pa.kfFlag}, #{pa.parentNo,jdbcType=REAL}, #{patInfo.referPhysician}, #{pa.endTime}," +
  522. " #{pa.modifier})")
  523. void insertEntryOrder(XinZhenYiZhu patInfo, XinZhenYzActOrder pa, String userCode);
  524. @Update("update yz_act_order set " +
  525. "frequ_code = #{frequCode}," +
  526. "exec_unit = #{execUnit}," +
  527. "order_time = #{orderTime}," +
  528. "start_time = #{startTime,jdbcType=TIMESTAMP}," +
  529. "end_time = #{endTime,jdbcType=TIMESTAMP}," +
  530. "group_no = #{groupNo}," +
  531. "modifier = #{modifier} " +
  532. "where parent_no = #{actOrderNo,jdbcType=REAL}")
  533. void howOftenTheSubPhysicianOrderIsModified(XinZhenYzActOrder pa);
  534. @Select("SELECT rtrim(a.order_code) + '00' as id," +
  535. "a.py_code, " +
  536. " a.d_code, " +
  537. " a.order_code , " +
  538. " rtrim(a.order_name) order_name, " +
  539. " drug_specification='诊疗项目', " +
  540. " drug_flag = isnull(operation,'o') , " +
  541. " a.parent_code , " +
  542. " a.exclu_group_type, " +
  543. " discription=a.discription + ' ' + a.yb_comment, " +
  544. " serial ='00', " +
  545. " group_no='00', " +
  546. " infusion_flag='', " +
  547. " group_name ='', " +
  548. " pack_size=1, " +
  549. " order_class=a.order_class, " +
  550. " spec_pack='', " +
  551. " jsy_flag ='', " +
  552. " xnh_flag='', " +
  553. " yb_comment =null, " +
  554. " dosage='', " +
  555. " yb_type='', " +
  556. " father_flag='0', " +
  557. " manu_name='', " +
  558. " stock_amount=0 " +
  559. "FROM yz_order_item a with (NOLOCK) " +
  560. "WHERE isnull(a.del_flag, '') <> '1' " +
  561. " and (py_code like #{code} or order_name like #{code} or order_code like #{code}) " +
  562. " and order_code not in (select zy_order_code from jc_zd_item) " +
  563. " and isnull(exec_dept, '') <> '2010000' ")
  564. List<YiZhuMingChen> yiZhuXiangMu(String code);
  565. @Select("SELECT a.py_code, " +
  566. " a.d_code, " +
  567. " a.pattern_code as order_code, " +
  568. " a.pattern_name as order_name, " +
  569. " specification=' ', " +
  570. " order_type ='t', " +
  571. " parent_code=space(7), " +
  572. " exclu_group_type=space(1), " +
  573. " discription='成组医嘱', " +
  574. " serial ='0000', " +
  575. " group_no='0000', " +
  576. " infusion_flag='', " +
  577. " drug_flag ='', " +
  578. " group_name ='', " +
  579. " pack_size =1, " +
  580. " order_class ='', " +
  581. " spec_pack='', " +
  582. " jsy_flag ='', " +
  583. " exclu_group_type='', " +
  584. " xnh_flag='', " +
  585. " yb_comment =null, " +
  586. " dosage = '', " +
  587. " yb_type='', " +
  588. " father_flag='0', " +
  589. " manu_name='', " +
  590. " stock_amount=0 " +
  591. "FROM yz_OrderPattern a with (NOLOCK) " +
  592. "where (py_code like #{code} or " +
  593. "pattern_name like #{code} or " +
  594. "d_code like #{code}) and dept_code = #{deptCode} ")
  595. List<YiZhuMingChen> composeOrders(String code, String deptCode);
  596. @Select("SELECT act_order_no, " +
  597. " order_name, " +
  598. " order_time, " +
  599. " start_time, " +
  600. " rtrim(frequ_code) frequ_code, " +
  601. " frequ_code_name = (select rtrim(comm) from yz_order_frequency where frequ_code = code), " +
  602. " rtrim(supply_code) supply_code, " +
  603. " supply_code_name = (select rtrim(supply_name) " +
  604. " from yz_supply_type " +
  605. " where yz_act_order.supply_code = yz_supply_type.supply_code)," +
  606. " group_no, " +
  607. " group_no_name = (select rtrim(group_name) " +
  608. " from yp_zd_group_name " +
  609. " where yp_zd_group_name.group_no = yz_act_order.group_no) " +
  610. "FROM yz_act_order with (NOLOCK) " +
  611. "WHERE inpatient_no = #{patNo} " +
  612. " AND admiss_times = #{times} " +
  613. " AND isnull(parent_no, 0) = 0 " +
  614. " and status_flag = '1' " +
  615. " and serial <> '00' ")
  616. List<XinZhenYzActOrder> getParentOrders(String patNo, Integer times);
  617. @Select("SELECT cast(rtrim(isnull(nullif(del_flag, " +
  618. " ''), " +
  619. " 0)) as int) as del_flag, " +
  620. " national_code as national_code, " +
  621. " name as order_name " +
  622. "FROM yz_order_occurence a with (NOLOCK), " +
  623. " zd_charge_item b with (NOLOCK) " +
  624. "where a.occ_code = b.code " +
  625. " and a.order_code = #{code}")
  626. List<XinZhenYzActOrder> huoQuXiangMu(String code);
  627. @Select("select isnull(exclu_group_type, 0) " +
  628. "from yz_order_item with (NOLOCK) where order_code = #{code}")
  629. Integer shiFouPaiChiYiZhu(String code);
  630. @Select("select " +
  631. " drug_flag, categories_flag," +
  632. " a.serial, " +
  633. " /* 医保自费 */ " +
  634. " cast(isnull(NULLIF(self_flag_yb, " +
  635. " ''), " +
  636. " 0) as int) as self_flag_yb, " +
  637. " /* 重量 */ " +
  638. " weight, " +
  639. " /* 重量单位 */ " +
  640. " weigh_unit, " +
  641. " weigh_unit_name = (select name " +
  642. " from yp_zd_unit with (NOLOCK) " +
  643. " where code = weigh_unit), " +
  644. " /*体积*/ " +
  645. " volum, " +
  646. " /*体积单位*/ " +
  647. " vol_unit, " +
  648. " vol_unit_name = (select name " +
  649. " from yp_zd_unit with (NOLOCK) " +
  650. " where code = vol_unit), " +
  651. " /*包装体积*/ " +
  652. " pack_size, " +
  653. " /*包装单位*/ " +
  654. " pack_unit, " +
  655. " pack_unit_name = (select name " +
  656. " from yp_zd_unit with (NOLOCK) " +
  657. " where code = pack_unit), " +
  658. " /*最小单位*/ " +
  659. " mini_unit, " +
  660. " mini_unit_name = (select name " +
  661. " from yp_zd_unit with (NOLOCK) " +
  662. " where code = mini_unit), " +
  663. " /* 需要判断医生的权限 在 select " +
  664. " doctor_xz_yp " +
  665. " from " +
  666. " a_employee_mi */ " +
  667. " cast(isnull(NULLIF(yp_level, " +
  668. " ''), " +
  669. " 0) as int) as yp_level, " +
  670. " /*需要皮试*/ " +
  671. " cast(isnull(NULLIF(ps_flag, " +
  672. " ''), " +
  673. " 0) as int) as ps_flag, " +
  674. " cast(isnull(NULLIF(kss_flag, " +
  675. " ''), " +
  676. " 0) as int) as kss_flag, " +
  677. " cast(isnull(NULLIF(kjyw_flag, " +
  678. " ''), " +
  679. " 0) as int) as kjyw_flag, " +
  680. " code as order_code, " +
  681. " name as order_name, " +
  682. " frequency as frequCode, " +
  683. " (select isnull(rtrim(comm), " +
  684. " '') " +
  685. " from yz_order_frequency " +
  686. " where yz_order_frequency.code = frequency) as frequCodeName, " +
  687. " supply_type as supply_code, " +
  688. " supply_code_name = (select supply_name " +
  689. " from yz_supply_type with (NOLOCK) " +
  690. " where yz_supply_type.supply_code = supply_type), " +
  691. " national_code, " +
  692. " stock_amount," +
  693. " cast(isnull(nullif(visible_flag_zy, ''), 0) as int) as visible_flag_zy " +
  694. "from yp_zd_dict a with (NOLOCK) " +
  695. " left join yp_base_yf b on (code = b.charge_code and a.serial = b.serial) " +
  696. "where rtrim(code) + rtrim(a.serial) = #{code} " +
  697. " and cast(isnull(NULLIF(del_flag, ''), 0) as int) = 0 " +
  698. " and group_no = #{groupNo} ")
  699. YaoPinXinXi huoQuYaoPin(@Param("code") String code,
  700. @Param("groupNo") String groupNo);
  701. @Select("select count(1) " +
  702. "from yp_zd_dept " +
  703. "where charge_code = #{code} " +
  704. " and dept_code = #{dept} ")
  705. Integer restrictedUseInTheDepartment(@Param("code") String code,
  706. @Param("dept") String dept);
  707. @Select("select cast(isnull(NULLIF(doctor_xz_yp, ''), 0) as int) + 1 from a_employee_mi with (NOLOCK) where code = #{code}")
  708. Integer huoQuYiShenDengJi(String code);
  709. /**
  710. * 出院带药数量
  711. *
  712. * @param patNo 住院号
  713. * @param times 住院次数
  714. * @return
  715. */
  716. @Select("select count(*) " +
  717. "from yz_act_order with (NOLOCK) " +
  718. "where inpatient_no = #{patNo} " +
  719. " and admiss_times = #{times} " +
  720. " and self_buy = '4' " +
  721. " and status_flag <> '6' ")
  722. int obtainTheNumberOfDischargedDrugs(String patNo, Integer times);
  723. @Select("select day_800, day_830, day_900, " +
  724. " day_930, day_1000, day_1030, day_1100, day_1130, day_1200, day_1230, day_1300, day_1330, " +
  725. " day_1400, day_1430, day_1500, day_1530, day_1600, day_1630, day_1700, day_1730, " +
  726. " day_1800, day_1830, day_1900, day_1930, day_2000, day_2030, day_2100, day_2130, " +
  727. " day_2200, day_2230, day_2300, day_2330, day_2400, day_030, day_100, day_130, day_200, " +
  728. " day_230, day_300, day_330, day_400, day_430, day_500, day_530, day_600, day_630, " +
  729. " day_700, day_730 " +
  730. "from yz_order_frequency where code = #{code}")
  731. Map<String, Short> numberOfTimesADay(String code);
  732. /**
  733. * 出院带药只能要这些给药方式
  734. *
  735. * @param code 编码
  736. * @return 返回数量
  737. */
  738. @Select("select count(1) " +
  739. "from (select b.charge_code, a.* " +
  740. " from yz_supply_type a " +
  741. " left join yz_supply_charge b on a.supply_code = b.supply_code) aa " +
  742. "where charge_code is null and supply_code = #{code} ")
  743. int dischargeWithMedicationAdministration(String code);
  744. @Update("update yz_act_order set drug_quan = #{item.drugQuan}," +
  745. "drug_occ = #{item.drugOcc} where act_order_no = #{item.actOrderNo} ")
  746. void updateThePickup(@Param("item") XinZhenYzActOrder item);
  747. @Select("select rtrim(supply_code) code,rtrim(supply_name) name " +
  748. "from yz_supply_type with (NOLOCK) " +
  749. "where ps_flag in ('1', '0')")
  750. List<GetDropdownBox> piShiGeiYaoFangShi();
  751. @Select("select rtrim(code) code, rtrim(comm) name " +
  752. "from yz_order_frequency with (NOLOCK) " +
  753. "where (code like #{code} or comm like #{code})")
  754. List<GetDropdownBox> huoQuZhuYuanPinLv(String code);
  755. @Select("select rtrim(code) as code, rtrim(comm) name " +
  756. "from yz_order_frequency")
  757. List<GetDropdownBox> selectFrequency();
  758. @Select("select rtrim(supply_code) code, rtrim(supply_name) name " +
  759. "from yz_supply_type with (NOLOCK) " +
  760. "where (supply_code like #{code} or supply_name like #{code} or py_code like #{code} )")
  761. List<GetDropdownBox> huoQuGeiYaoFangShi(String code);
  762. @Select("select rtrim(supply_code) code, rtrim(supply_name) name " +
  763. "from (select b.charge_code, a.* " +
  764. " from yz_supply_type a " +
  765. " left join yz_supply_charge b on a.supply_code = b.supply_code) aa " +
  766. "where charge_code is null " +
  767. " and (py_code like #{code} or d_code like #{code} or supply_name like #{code} or supply_code like #{code})")
  768. List<GetDropdownBox> getCostFreeDosing(String code);
  769. @Select("SELECT a.code code, " +
  770. " a.name name " +
  771. "FROM zd_unit_code a with (NOLOCK), " +
  772. " zd_dept_all b with (NOLOCK) " +
  773. "where isnull(a.del_flag, '0') <> '1' " +
  774. " and a.code = b.small_dept " +
  775. " and (a.code like #{code} or a.name like #{code} or py_code like #{code}) " +
  776. "group by code,name")
  777. List<GetDropdownBox> huoQuZhiXinKeShi(String code);
  778. @Select("<script>" +
  779. "select rtrim(code) order_code, " +
  780. " rtrim(a.serial) serial, " +
  781. " rtrim(group_no) group_no, " +
  782. " rtrim(name) order_name," +
  783. " case infusion_flag " +
  784. " when '1' then 'i' " +
  785. " else " +
  786. " (case " +
  787. " when rtrim(code) &gt;= '30000' and rtrim(code) &lt; '50000' then 'z' " +
  788. " else 'd' end) end as drug_flag, " +
  789. " mini_unit, " +
  790. " isnull(weight,1) drug_weight, " +
  791. " weigh_unit drug_weight_unit, " +
  792. " isnull(volum,1) drug_volume, " +
  793. " vol_unit drug_vol_unit," +
  794. " isnull(pack_size,1) pack_size, " +
  795. " pack_unit," +
  796. " a.pack_retprice, " +
  797. " national_code," +
  798. " cast(isnull(NULLIF(kjyw_flag, ''), 0) as int) as kjyw_flag," +
  799. " cast(isnull(NULLIF(yp_level, ''), 0) as int) as yp_level," +
  800. " cast(isnull(NULLIF(del_flag, ''), 0) as int) as del_flag, " +
  801. " CASE " +
  802. " WHEN isnull(b.open_virtual2, '') = '1' then isnull(b.stock_amount_virtual2, 0) " +
  803. " else isnull(stock_amount,0) end as stock_amount," +
  804. " cast(isnull(nullif(visible_flag_zy, ''), 0) as int) as visible_flag_zy," +
  805. " deptRestrictions = (select count(1) from yp_zd_dept where code = yp_zd_dept.charge_code and dept_code = '${dept}') " +
  806. " from yp_zd_dict a with (NOLOCK) " +
  807. " left join yp_base_yf b on (code = b.charge_code and a.serial = b.serial) " +
  808. "where rtrim(code) + rtrim(a.serial) + rtrim(group_no) in " +
  809. "<foreach collection='code' item='item' index='index' open='(' close=')' separator=','>" +
  810. "#{item}" +
  811. "</foreach>" +
  812. "</script>")
  813. List<XinZhenYzActOrder> huoQuYaoPinXinXi(@Param("code") Set<String> code,
  814. @Param("dept") String dept);
  815. @Select("select rtrim(code) order_code, " +
  816. " rtrim(a.serial) serial, " +
  817. " rtrim(name) order_name," +
  818. " case infusion_flag " +
  819. " when '1' then 'i' " +
  820. " else " +
  821. " (case " +
  822. " when rtrim(code) >= '30000' and rtrim(code) < '50000' then 'z' " +
  823. " else 'd' end) end as drug_flag, " +
  824. " mini_unit, " +
  825. " isnull(weight,1) drug_weight, " +
  826. " weigh_unit drug_weight_unit, " +
  827. " isnull(volum,1) drug_volume, " +
  828. " vol_unit drug_vol_unit," +
  829. " isnull(pack_size,1) pack_size, " +
  830. " pack_unit," +
  831. " a.pack_retprice, " +
  832. " national_code," +
  833. " cast(isnull(NULLIF(kjyw_flag, ''), 0) as int) as kjyw_flag," +
  834. " cast(isnull(NULLIF(yp_level, ''), 0) as int) as yp_level," +
  835. " cast(isnull(NULLIF(del_flag, ''), 0) as int) as del_flag, " +
  836. " stock_amount," +
  837. " cast(isnull(nullif(visible_flag_zy, ''), 0) as int) as visible_flag_zy " +
  838. " from yp_zd_dict a with (NOLOCK) " +
  839. " left join yp_base_yf b on ( code = b.charge_code and a.serial = b.serial) " +
  840. "where rtrim(code) + rtrim(a.serial) = '${code}' " +
  841. " and group_no = #{groupNo} ")
  842. XinZhenYzActOrder getDrugOne(String code, String groupNo);
  843. @Select("<script>" +
  844. "select b.order_code, " +
  845. " rtrim(c.name) order_name, " +
  846. " national_code, " +
  847. " kjyw_flag = 0, " +
  848. " cast(rtrim(isnull(nullif(c.del_flag, " +
  849. " ''), " +
  850. " 0)) as int) del_flag " +
  851. " from " +
  852. " yz_order_occurence b with (NOLOCK) , " +
  853. " zd_charge_item c with (NOLOCK) " +
  854. "where b.order_code in " +
  855. "<foreach collection='code' item='item' index='index' open='(' close=')' separator=','>" +
  856. "#{item}" +
  857. "</foreach>" +
  858. " and b.occ_code = c.code" +
  859. "</script>")
  860. List<XinZhenYzActOrder> huoQuXiangMuXinXi(Set<String> code);
  861. @Select("select rtrim(inpatient_no) as inpatient_no, " +
  862. " admiss_times, " +
  863. " rtrim(name) as name, " +
  864. " rtrim(dept) as dept_code, " +
  865. " rtrim(zk_ward) as ward_code, " +
  866. " refer_physician, " +
  867. " times_billed, " +
  868. " admiss_date, " +
  869. " small_dept, " +
  870. " bed_no," +
  871. " zk_ward, " +
  872. " ledger_sn = (select max(ledger_sn) " +
  873. " from zy_ledger_file with (NOLOCK) " +
  874. " where zy_actpatient.inpatient_no = zy_ledger_file.inpatient_no " +
  875. " and zy_actpatient.admiss_times = zy_ledger_file.admiss_times) " +
  876. " from zy_actpatient with (NOLOCK) " +
  877. "where inpatient_no = #{patNo} " +
  878. " and admiss_times = #{times} ")
  879. XinZhenYiZhu queryPatientInfo(@Param("patNo") String patNo,
  880. @Param("times") Integer times);
  881. @Insert("<script>" +
  882. "INSERT INTO yz_act_order (order_code, order_name, frequ_code, instruction, discription, infant_flag, order_time, " +
  883. " /*录入人*/physician, start_time, drug_specification, drug_quan, supply_code, act_order_no, inpatient_no, " +
  884. " admiss_times, drug_flag/*药品中找这个是 药品的类型 a i d*/, enter_oper, /*录入时间*/ enter_time, " +
  885. " mini_unit /*药品中找 最小包装规格*/, " +
  886. " drug_weight/*药品的重量*/, drug_weight_unit/*药品重量单位*/, " +
  887. " status_flag/*2*/, self_buy, dose, dose_unit, /*这个是算出来的 输入的 dose 除以选中的单位 */drug_occ, drug_volume/*药品中的 volum 找*/, " +
  888. " drug_vol_unit/* 药品中的 vol_unit */, pay_self/*0*/, " +
  889. " serial/*前端传*/, group_no/*药房 */, doctor_flag/*写死为 1*/, exec_unit, dept_code/* 在院病人表中的 dept */, " +
  890. " ward_code /* 在院病人表中的 zk_ward*/, " +
  891. " reg_flag/* 0 */, " +
  892. " yb_self_flag/*医保自费标志*/,emergency_flag, " +
  893. " kf_flag /*饭前饭后*/,parent_no, refer_physician/*患者的管床医生*/, confirm_time/*确认时间*/, signer/*确认人*/,end_time,modifier) " +
  894. "VALUES " +
  895. "<foreach collection='list' item='item' separator=','>" +
  896. "(#{item.orderCode,jdbcType=VARCHAR}, #{item.orderName,jdbcType=VARCHAR}, #{item.frequCode,jdbcType=VARCHAR}," +
  897. " #{item.instruction,jdbcType=VARCHAR}, #{item.discription,jdbcType=VARCHAR}, #{infantFlag,jdbcType=VARCHAR}, " +
  898. "#{item.orderTime,jdbcType=VARCHAR}, " +
  899. " #{inputCode,jdbcType=TIMESTAMP}, #{item.startTime,jdbcType=TIMESTAMP}, #{item.drugSpecification}, " +
  900. "#{item.drugQuan,jdbcType=DECIMAL}," +
  901. " #{item.supplyCode}," +
  902. " #{item.actOrderNo,jdbcType=DECIMAL}, #{patNo}, #{times}, " +
  903. "#{item.drugFlag}," +
  904. " #{inputCode}, " +
  905. " getdate(), #{item.miniUnit}, " +
  906. "#{item.drugWeight,jdbcType=DECIMAL}, " +
  907. "#{item.drugWeightUnit}, '2', #{item.selfBuy}, " +
  908. "cast(#{item.dose,jdbcType=DECIMAL} as decimal(10,2))," +
  909. " #{item.doseUnit}, " +
  910. "cast(#{item.drugOcc,jdbcType=DECIMAL} as decimal(10,2))," +
  911. "cast(#{item.drugVolume,jdbcType=DECIMAL} as decimal(10,2))," +
  912. " #{item.drugVolUnit}, 0, #{item.serial}, " +
  913. "#{item.groupNo}," +
  914. "'1', #{item.execUnit}, " +
  915. "#{deptCode}, #{wardCode}, '0', #{item.ybSelfFlag},#{item.emergencyFlag}, #{item.kfFlag}," +
  916. "#{item.parentNo,jdbcType=DECIMAL}," +
  917. " #{referPhysician}, getdate(), #{inputCode},#{item.endTime,jdbcType=TIMESTAMP},#{item.modifier})" +
  918. "</foreach>" +
  919. "</script>")
  920. void chaRuYiZhu(@Param("patNo") String patNo,
  921. @Param("times") Integer times,
  922. @Param("inputCode") String inputCode,
  923. @Param("infantFlag") Integer infantFlag,
  924. @Param("deptCode") String deptCode,
  925. @Param("wardCode") String wardCode,
  926. @Param("referPhysician") String referPhysician,
  927. @Param("list") List<XinZhenYzActOrder> list);
  928. @Select("<script>" +
  929. "select top 20 * from (" +
  930. "SELECT row_number() over (order by pattern_code ) row_number," +
  931. " rtrim(pattern_code) pattern_code, " +
  932. " rtrim(pattern_name) pattern_name," +
  933. " rtrim(input_id) input_id," +
  934. " input_date," +
  935. " rtrim(input_type) input_type, " +
  936. " sort_no," +
  937. " yiBeiShouCang = (select count(1) from yz_OrderPattern b with (NOLOCK) where b.collect_code = a.pattern_code " +
  938. " and b.input_id = #{inputId})," +
  939. " collect_code " +
  940. "FROM yz_OrderPattern a with (NOLOCK) " +
  941. "where 1=1 " +
  942. "<if test=\"code != null and code != '' \">" +
  943. "and (py_code like #{code} " +
  944. " or pattern_code like #{code} " +
  945. " or pattern_name like #{code}) " +
  946. "</if>" +
  947. "<if test=\"muBanLeiXing == 2 \">" +
  948. " and dept_code = #{deptCode} AND input_type = '2' " +
  949. "</if>" +
  950. "<if test=\"muBanLeiXing == 3 \">" +
  951. " and input_id = #{inputId} AND input_type = '3' " +
  952. "</if>" +
  953. "<if test=\"muBanLeiXing == 1\">" +
  954. " and input_type = '1' " +
  955. "</if>" +
  956. "<if test=\"muBanLeiXing == 4\">" +
  957. " and input_id = #{inputId} AND input_type = '4' " +
  958. "</if>" +
  959. "<if test=\"muBanLeiXing == 0\">" +
  960. " AND input_type &lt;&gt; '4' " +
  961. "</if>" +
  962. ") temp where row_number > (${currentPage} - 1) * 20 " +
  963. "<if test=\"muBanLeiXing == 3 \">" +
  964. " order by sort_no desc " +
  965. "</if>" +
  966. "</script>")
  967. List<YzOrderPattern> huoQuMuBan(@Param("code") String code,
  968. @Param("inputId") String inputId,
  969. @Param("deptCode") String deptCode,
  970. @Param("muBanLeiXing") Integer muBanLeiXing,
  971. @Param("currentPage") long currentPage);
  972. @Select("select max(sort_no + 1) " +
  973. "from yz_OrderPattern " +
  974. "where input_id = #{code}")
  975. Integer getMyTemplateMaxSortNo(String code);
  976. @Select("<script>" +
  977. "SELECT count(*) " +
  978. "FROM yz_OrderPattern with (NOLOCK) " +
  979. "where 1=1 " +
  980. "<if test=\"code != null and code != '' \">" +
  981. "and (py_code like #{code} " +
  982. " or pattern_code like #{code} " +
  983. " or pattern_name like #{code}) " +
  984. "</if>" +
  985. "<if test=\"muBanLeiXing == 2 \">" +
  986. " and dept_code = #{deptCode} AND input_type = '2' " +
  987. "</if>" +
  988. "<if test=\"muBanLeiXing == 3 \">" +
  989. " and input_id = #{inputId} AND input_type = '3' " +
  990. "</if>" +
  991. "<if test=\"muBanLeiXing == 1\">" +
  992. " and input_type = '1' " +
  993. "</if>" +
  994. "<if test=\"muBanLeiXing == 4\">" +
  995. " and input_id = #{inputId} AND input_type = '4' " +
  996. "</if>" +
  997. "<if test=\"muBanLeiXing == 0\">" +
  998. " AND input_type &lt;&gt; '4' " +
  999. "</if>" +
  1000. "</script>")
  1001. long huoQuMuBanTotal(@Param("code") String code,
  1002. @Param("inputId") String inputId,
  1003. @Param("deptCode") String deptCode,
  1004. @Param("muBanLeiXing") Integer muBanLeiXing);
  1005. @Select("SELECT cast(cast(act_order_no as decimal) as varchar) id, " +
  1006. " act_order_no, " +
  1007. " rtrim(a.order_name) order_name, " +
  1008. " rtrim(a.order_code) order_code, " +
  1009. " a.frequ_code, " +
  1010. " frequ_code_name = (select rtrim(comm) " +
  1011. " from yz_order_frequency with (NOLOCK) " +
  1012. " where yz_order_frequency.code = a.frequ_code), " +
  1013. " a.drug_specification, " +
  1014. " a.supply_code, " +
  1015. " supply_code_name = (select rtrim(supply_name) " +
  1016. " from yz_supply_type with (NOLOCK) " +
  1017. " where yz_supply_type.supply_code = a.supply_code), " +
  1018. " a.drug_quan, " +
  1019. " a.instruction, " +
  1020. " a.mini_unit, " +
  1021. " mini_unit_name = (select rtrim(name) from yp_zd_unit with (NOLOCK) where code = mini_unit), " +
  1022. " a.drug_weight, " +
  1023. " a.drug_weight_unit, " +
  1024. " a.parent_no, " +
  1025. " a.drug_volume, " +
  1026. " a.drug_vol_unit, " +
  1027. " a.dose, " +
  1028. " a.dose_unit, " +
  1029. " dose_unit_name = (select rtrim(name) from yp_zd_unit with (NOLOCK) where code = dose_unit), " +
  1030. " a.exclu_act_order_no, " +
  1031. " a.discription, " +
  1032. " a.pattern_code, " +
  1033. " a.order_type, " +
  1034. " a.serial, " +
  1035. " self_buy=isnull(a.self_buy, '0'), " +
  1036. " del_flag=isnull(b.del_flag, ''), " +
  1037. " a.drug_flag, " +
  1038. " suprice_flag='', " +
  1039. " self_flag ='', " +
  1040. " parent_flag='', " +
  1041. " a.exec_unit, " +
  1042. " exec_unit_name = (select rtrim(name) from zd_unit_code with (NOLOCK) where code = exec_unit)," +
  1043. " group_no = '00', " +
  1044. " group_no_name = N'项目' " +
  1045. "FROM yz_pattern_order a with (NOLOCK), " +
  1046. " yz_order_item b with (NOLOCK) " +
  1047. "WHERE a.pattern_code = #{code} " +
  1048. " and isnull(a.group_no, '00') = '00' " +
  1049. " and a.order_code = b.order_code " +
  1050. "UNION " +
  1051. "SELECT cast(cast(act_order_no as decimal) as varchar) id," +
  1052. " act_order_no, " +
  1053. " a.order_name, " +
  1054. " a.order_code, " +
  1055. " a.frequ_code, " +
  1056. " frequ_code_name = (select rtrim(comm) " +
  1057. " from yz_order_frequency with (NOLOCK) " +
  1058. " where yz_order_frequency.code = a.frequ_code), " +
  1059. " a.drug_specification, " +
  1060. " a.supply_code, " +
  1061. " supply_code_name = (select rtrim(supply_name) " +
  1062. " from yz_supply_type with (NOLOCK) " +
  1063. " where yz_supply_type.supply_code = a.supply_code), " +
  1064. " a.drug_quan, " +
  1065. " a.instruction, " +
  1066. " a.mini_unit, " +
  1067. " mini_unit_name = (select rtrim(name) from yp_zd_unit with (NOLOCK) where code = mini_unit), " +
  1068. " a.drug_weight, " +
  1069. " a.drug_weight_unit, " +
  1070. " a.parent_no, " +
  1071. " a.drug_volume, " +
  1072. " a.drug_vol_unit, " +
  1073. " a.dose, " +
  1074. " a.dose_unit, " +
  1075. " dose_unit_name = (select rtrim(name) from yp_zd_unit with (NOLOCK) where code = dose_unit), " +
  1076. " a.exclu_act_order_no, " +
  1077. " a.discription, " +
  1078. " a.pattern_code, " +
  1079. " a.order_type, " +
  1080. " a.serial, " +
  1081. " self_buy=isnull(a.self_buy, case when b.jsy_flag = '1' then '3' else '0' end), " +
  1082. " del_flag=isnull(b.visible_flag_zy, ''), " +
  1083. " a.drug_flag, " +
  1084. " suprice_flag=b.suprice_flag, " +
  1085. " self_flag =b.self_flag, " +
  1086. " parent_flag='', " +
  1087. " a.exec_unit, " +
  1088. " exec_unit_name = (select rtrim(name) from zd_unit_code with (NOLOCK) where code = exec_unit)," +
  1089. " a.group_no, " +
  1090. " (select yp_zd_group_name.group_name " +
  1091. " from yp_zd_group_name " +
  1092. " where yp_zd_group_name.group_no = a.group_no) " +
  1093. "FROM yz_pattern_order a with (NOLOCK), " +
  1094. " view_yp_zd_dict_base_yf b with (NOLOCK) " +
  1095. "WHERE a.pattern_code = #{code} " +
  1096. " and a.group_no = b.group_no " +
  1097. " and a.order_code = b.code " +
  1098. " and a.serial = b.serial " +
  1099. " and isnull(b.visible_flag_zy, '') <> '1'")
  1100. List<YzActOrder> huoQuMuBanShuJu(String code);
  1101. @Select("select pattern_code," +
  1102. " rtrim(input_type) as input_type," +
  1103. " input_id " +
  1104. "from yz_OrderPattern with (NOLOCK) " +
  1105. "where pattern_name = #{patternName} " +
  1106. " and input_id = #{inputId}" +
  1107. " and input_type <> 4 ")
  1108. YzOrderPattern yuanLaiDeMuBanBianMa(@Param("patternName") String patternName,
  1109. @Param("inputId") String inputId);
  1110. @Select("select top 1 * " +
  1111. "from yz_OrderPattern with (NOLOCK) " +
  1112. "where pattern_code = #{patternCode} " +
  1113. " and input_id = #{inputId}" +
  1114. " and input_type <> 4 ")
  1115. YzOrderPattern getDataAccordingToTemplateCode(@Param("patternCode") String patternCode,
  1116. @Param("inputId") String input);
  1117. @Select("select pattern_code," +
  1118. " rtrim(input_type) input_type," +
  1119. " input_id " +
  1120. "from yz_OrderPattern with (NOLOCK) " +
  1121. "where pattern_name = #{patternName} " +
  1122. "and input_type not in ('3','4') ")
  1123. YzOrderPattern gongGongMuBan(@Param("patternName") String patternName);
  1124. @Delete("<script>" +
  1125. "delete yz_OrderPattern " +
  1126. "where pattern_code = #{patternCode}; " +
  1127. "delete yz_pattern_order " +
  1128. "where pattern_code = #{patternCode} " +
  1129. "</script>")
  1130. void shanChuLaoMuBan(@Param("patternCode") String patternCode);
  1131. @Insert("insert yz_OrderPattern (pattern_code, pattern_name, py_code, d_code, dept_code, " +
  1132. " ward_code, input_id, " +
  1133. " input_type, input_date, sort_no) " +
  1134. "values (#{patternCode},#{patternName},#{pyCode},#{dCode},#{deptCode},#{deptCode}," +
  1135. "#{inputId},#{inputType}," +
  1136. "getdate(),#{sortNo})")
  1137. void chaRuMuBan(YzOrderPattern param);
  1138. @Select("select count(1) " +
  1139. "from yz_OrderPattern " +
  1140. "where pattern_name = #{name} and input_id = #{userCode} ")
  1141. Integer duplicateTemplateName(@Param("name") String name,
  1142. @Param("userCode") String userCode);
  1143. @Insert("<script>" +
  1144. "INSERT INTO yz_pattern_order (act_order_no, order_code, frequ_code, drug_flag, supply_code, drug_quan, instruction, " +
  1145. " drug_specification, mini_unit, drug_weight, drug_weight_unit, parent_no, drug_volume, " +
  1146. " drug_vol_unit, dose, dose_unit, drug_occ, order_name, discription, " +
  1147. " pattern_code, serial, self_buy, exec_unit,group_no) " +
  1148. "VALUES " +
  1149. "<foreach collection='list' item='item' separator=','>" +
  1150. "(#{item.actOrderNo}, #{item.orderCode}, #{item.frequCode}," +
  1151. "<if test=\"item.drugFlag !=null and item.drugFlag != '' \">" +
  1152. "#{item.drugFlag}," +
  1153. "</if>" +
  1154. "<if test=\"item.drugFlag == null or item.drugFlag == '' \">" +
  1155. "'o'," +
  1156. "</if>" +
  1157. " #{item.supplyCode}," +
  1158. "<if test=\"item.drugQuan != null \">" +
  1159. "#{item.drugQuan}," +
  1160. "</if>" +
  1161. "<if test=\"item.drugQuan == null \">" +
  1162. "null," +
  1163. "</if>" +
  1164. "#{item.instruction}, #{item.drugSpecification}, #{item.miniUnit}, " +
  1165. "<if test=\"item.drugWeight != null\">" +
  1166. "#{item.drugWeight}, " +
  1167. "</if>" +
  1168. "<if test=\"item.drugWeight == null\">" +
  1169. "null, " +
  1170. "</if>" +
  1171. "#{item.drugWeightUnit}, " +
  1172. "<if test=\"item.parentNo != null \">" +
  1173. "#{item.parentNo}," +
  1174. "</if>" +
  1175. "<if test=\"item.parentNo == null \">" +
  1176. "null," +
  1177. "</if>" +
  1178. "<if test=\"item.drugVolume != null\">" +
  1179. "cast(#{item.drugVolume,jdbcType=DECIMAL} as decimal(10,2))," +
  1180. "</if>" +
  1181. "<if test=\"item.drugVolume == null\">" +
  1182. "null," +
  1183. "</if>" +
  1184. " #{item.drugVolUnit}, " +
  1185. "<if test=\"item.dose != null\">" +
  1186. "cast(#{item.dose,jdbcType=DECIMAL} as decimal(10,2))," +
  1187. "</if>" +
  1188. "<if test=\"item.dose == null\">" +
  1189. "null," +
  1190. "</if>" +
  1191. "#{item.doseUnit}," +
  1192. "<if test=\"item.drugOcc != null \">" +
  1193. "cast(#{item.drugOcc,jdbcType=DECIMAL} as decimal(10,2))," +
  1194. "</if>" +
  1195. "<if test=\"item.drugOcc == null \">" +
  1196. "null," +
  1197. "</if>" +
  1198. " #{item.orderName},#{item.discription},#{patternCode},#{item.serial},#{item.selfBuy},#{item.execUnit},#{item.groupNo})" +
  1199. "</foreach>" +
  1200. "</script>")
  1201. void chaRuMuBanShuJu(List<XinZhenYzActOrder> list, String patternCode);
  1202. @Select("select * " +
  1203. "from yz_OrderPattern with (NOLOCK) " +
  1204. "where pattern_code = #{code}")
  1205. YzOrderPattern huoQuMuBanXinXi(@Param("code") String code);
  1206. @Update("update yz_OrderPattern " +
  1207. "set pattern_name = #{patternName}, " +
  1208. " py_code = #{pyCode}, " +
  1209. " d_code = #{dCode}, " +
  1210. " input_date = getdate()," +
  1211. " sort_no = #{sortNo} " +
  1212. "where pattern_code = #{patternCode} ")
  1213. void genXingMuBan(@Param("patternName") String patternName,
  1214. @Param("pyCode") String pyCode,
  1215. @Param("dCode") String dCode,
  1216. @Param("patternCode") String patternCode,
  1217. @Param("sortNo") Integer sortNo);
  1218. @Select("select rtrim(dept_code) from a_employee_mi where code = '${code}'")
  1219. String userDeptCode(@Param("code") String code);
  1220. @Delete("/* 父模板 */ " +
  1221. "delete yz_OrderPattern " +
  1222. "where pattern_code = #{patternCode}; " +
  1223. "/* 模板下面的数据 */ " +
  1224. "delete yz_pattern_order " +
  1225. "where pattern_code = #{patternCode} ")
  1226. void shanChuMuBan(@Param("patternCode") String patternCode);
  1227. @Select("select pattern_code " +
  1228. "from yz_OrderPattern " +
  1229. "where collect_code = #{patternCode} and input_id = #{userId}")
  1230. String whetherToSaveTheDoctorSOrderTemplate(@Param("patternCode") String patternCode,
  1231. @Param("userId") String userId);
  1232. @Select("select collect_code " +
  1233. "from yz_OrderPattern with (NOLOCK) " +
  1234. "where input_id = #{inputId} " +
  1235. " and collect_code = #{collectCode} ")
  1236. String chongFuShouCang(@Param("inputId") String inputId,
  1237. @Param("collectCode") String collectCode);
  1238. @Insert("insert into yz_OrderPattern (pattern_code, pattern_name, py_code, d_code, dept_code, ward_code, " +
  1239. " input_id, input_type, input_date, sort_no, collect_code) " +
  1240. "values (#{patternCode},#{patternName},#{pyCode},#{dCode},#{deptCode},#{deptCode},#{inputId},'4',getdate(),0,#{collectCode});")
  1241. void chaRuShouCang(@Param("patternCode") String patternCode,
  1242. @Param("patternName") String patternName,
  1243. @Param("pyCode") String pyCode,
  1244. @Param("dCode") String dCode,
  1245. @Param("deptCode") String deptCode,
  1246. @Param("inputId") String inputId,
  1247. @Param("collectCode") String collectCode);
  1248. @Select("select * " +
  1249. "from yz_act_order with (NOLOCK) " +
  1250. "where act_order_no = #{actOrderNo} ")
  1251. YzActOrder chaXunYiZhuXinXin(BigDecimal actOrderNo);
  1252. @Update("update yz_act_order set emergency_flag = #{emergencyFlag} " +
  1253. "where act_order_no = #{actOrderNo} ")
  1254. void sheZhiJinJi(@Param("actOrderNo") BigDecimal actOrderNo,
  1255. @Param("emergencyFlag") String emergencyFlag);
  1256. @Insert("insert into yz_erase_order_comm (act_order_no, inpatient_no, admiss_times, comment, order_code, sys_date) " +
  1257. "values (#{actOrderNo}, #{patNo}, #{times}, #{content}, #{orderCode}, getdate())")
  1258. void chaRuCheXiaoYuanYin(@Param("actOrderNo") BigDecimal actOrderNo,
  1259. @Param("patNo") String patNo,
  1260. @Param("times") Integer times,
  1261. @Param("content") String content,
  1262. @Param("orderCode") String orderCode);
  1263. @Delete("/*删除费用*/ " +
  1264. "delete yz_zy_patient_fee " +
  1265. "where act_order_no = #{actOrderNo} " +
  1266. " and charge_status = '3';" +
  1267. "/*删除药品的药单*/ " +
  1268. "delete yz_yp_zy_order " +
  1269. "where act_order_no = #{actOrderNo} " +
  1270. " and status_flag = '1';" +
  1271. "/*删除医嘱表*/" +
  1272. "DELETE " +
  1273. "FROM yz_act_order " +
  1274. "WHERE act_order_no = #{actOrderNo};" +
  1275. "/*删除医技*/ " +
  1276. "delete ysh_yj_req " +
  1277. "where act_order_no = #{actOrderNo};")
  1278. void cheXiaoYiZhu(@Param("actOrderNo") BigDecimal actOrderNo);
  1279. @Insert("insert into yz_erase_order " +
  1280. "select * " +
  1281. "from yz_act_order " +
  1282. "where act_order_no = #{actOrderNo}")
  1283. void chaRuShanChuBiao(@Param("actOrderNo") BigDecimal actOrderNo);
  1284. @Update("update yz_erase_order " +
  1285. "set modifier =#{userCode}, " +
  1286. " status_time =getdate(), " +
  1287. " print_order_change =case when isnull(print_order_change, '') = '' then 'd' else '' end " +
  1288. "where act_order_no = #{actOrderNo};" +
  1289. "update op_record " +
  1290. "set status ='d' " +
  1291. "where act_order_no = #{actOrderNo};")
  1292. void genXingShanChuBiaoZhi(@Param("userCode") String userCode,
  1293. @Param("actOrderNo") BigDecimal actOrderNo);
  1294. @Update("update yz_act_order " +
  1295. "set modifier = #{userCode}, " +
  1296. " end_time = #{endTime} " +
  1297. "where act_order_no = #{actOrderNo} ")
  1298. void sheZhiTingZhiShiJian(@Param("userCode") String userCode,
  1299. @Param("actOrderNo") BigDecimal actOrderNo,
  1300. @Param("endTime") String endTime);
  1301. @Select("<script>" +
  1302. "select * from yz_act_order with (NOLOCK) where act_order_no in " +
  1303. "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
  1304. " #{item} " +
  1305. "</foreach>" +
  1306. "</script>")
  1307. List<YzActOrder> yiZhuXinXiJiHe(@Param("list") List<BigDecimal> list);
  1308. @Update("<script>" +
  1309. "<foreach collection='list' item='item' separator=';'>" +
  1310. "update yz_act_order " +
  1311. "set modifier = #{userCode}, " +
  1312. " end_time = #{endTime} " +
  1313. " where act_order_no = #{item} " +
  1314. "</foreach>" +
  1315. "</script>")
  1316. void piLiangSheZhiTingZhiShiJian(@Param("list") List<BigDecimal> actOrderNo,
  1317. @Param("userCode") String userCode,
  1318. @Param("endTime") String endTime);
  1319. @Delete("delete yz_act_record_kss where act_order_no = #{orderNo}")
  1320. void deleteAntimicrobialInformation(String orderNo);
  1321. @Insert("insert into yz_act_record_kss " +
  1322. "(act_order_no, charge_code, input_id, inpatient_no, " +
  1323. "admiss_times, yyfs, ssqk, yysj)" +
  1324. "values " +
  1325. "(#{orderNo},#{kss.chargeCode},#{userCode},#{patNo}," +
  1326. "#{times},#{kss.yyfs},#{kss.ssqk},#{kss.yysj})")
  1327. void insertAntimicrobialInformation(String orderNo,
  1328. YzActRecordKss kss,
  1329. String userCode,
  1330. String patNo,
  1331. Integer times);
  1332. @Delete("delete zy_order_zk where act_order_no = #{orderNo}")
  1333. void deleteTransferOrder(String orderNo);
  1334. @Insert("insert into zy_order_zk (act_order_no, old_ward, " +
  1335. "old_dept, new_ward, new_dept) " +
  1336. "values (#{actOrderNo},#{oldWard},#{oldDept},#{newWard},#{newDept})")
  1337. void insertDoctorSOrder(ZyOrderZk zk);
  1338. @Select("execute dbo.xc_zy_order_fee;1 @in_no = #{patNo}, @in_times = #{times}")
  1339. List<DoctorSOrderFee> expensesForGettingADoctorSOrder(@Param("patNo") String patNo,
  1340. @Param("times") Integer times);
  1341. @Select("select admiss_date " +
  1342. "from zy_actpatient " +
  1343. "where inpatient_no = #{patNo}")
  1344. Date patientAdmissionTime(String patNo);
  1345. @Select("<script>" +
  1346. "select act_order_no, " +
  1347. " inpatient_no, " +
  1348. " admiss_times, " +
  1349. " order_code, " +
  1350. " order_time, " +
  1351. " frequ_code, " +
  1352. " enter_time, " +
  1353. " enter_oper, " +
  1354. " start_time, " +
  1355. " end_time, " +
  1356. " infant_flag, " +
  1357. " drug_flag, " +
  1358. " supply_code, " +
  1359. " performance_time, " +
  1360. " physician, " +
  1361. " confirm_time, " +
  1362. " signer, " +
  1363. " modifier, " +
  1364. " status_flag, " +
  1365. " status_time, " +
  1366. " drug_quan, " +
  1367. " instruction, " +
  1368. " drug_specification, " +
  1369. " mini_unit, " +
  1370. " drug_weight, " +
  1371. " drug_weight_unit, " +
  1372. " print_order_change, " +
  1373. " parent_no, " +
  1374. " self_buy, " +
  1375. " eat_card_flag, " +
  1376. " drug_volume, " +
  1377. " drug_vol_unit, " +
  1378. " dose, " +
  1379. " dose_unit, " +
  1380. " drug_occ, " +
  1381. " print_order, " +
  1382. " print_order_once, " +
  1383. " print_order_anew, " +
  1384. " print_infusion, " +
  1385. " exclu_back_time, " +
  1386. " exclu_act_order_no, " +
  1387. " order_name, " +
  1388. " discription, " +
  1389. " del_flag, " +
  1390. " pay_self, " +
  1391. " serial, " +
  1392. " group_no, " +
  1393. " ward_code, " +
  1394. " yb_self_flag, " +
  1395. " doctor_flag, " +
  1396. " dept_code, " +
  1397. " exec_unit, " +
  1398. " cl_code, " +
  1399. " zy_serial_no, " +
  1400. " executer1, " +
  1401. " executer2, " +
  1402. " reg_flag, " +
  1403. " msg_flag, " +
  1404. " exec_time, " +
  1405. " exec_id, " +
  1406. " ps_status, " +
  1407. " ps_oper, " +
  1408. " ps_time, " +
  1409. " exec_id2, " +
  1410. " act_order_no2, " +
  1411. " print_page, " +
  1412. " print_page_once, " +
  1413. " print_order_change_end, " +
  1414. " emergency_flag, " +
  1415. " req_receive_flag, " +
  1416. " inspect_stuff, " +
  1417. " charge_status, " +
  1418. " ps_result_time, " +
  1419. " kf_flag, " +
  1420. " modifier_oper, " +
  1421. " pass_flag, " +
  1422. " pass_id, " +
  1423. " pass_date, " +
  1424. " pass_comment, " +
  1425. " refer_physician, " +
  1426. " consult_physician " +
  1427. "from yz_act_order " +
  1428. "where act_order_no in " +
  1429. "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
  1430. "#{item} " +
  1431. "</foreach>" +
  1432. "</script>")
  1433. List<YzActOrder> getOriginalOrderData(List<String> list);
  1434. @Insert("<script>" +
  1435. "insert into yz_act_order (act_order_no, inpatient_no, admiss_times, order_code, order_time, frequ_code, enter_time, " +
  1436. " enter_oper, start_time, end_time, infant_flag, drug_flag, supply_code, performance_time, " +
  1437. " physician, confirm_time, signer, modifier, status_flag, status_time, drug_quan, instruction, " +
  1438. " drug_specification, mini_unit, drug_weight, drug_weight_unit, parent_no, " +
  1439. " self_buy, eat_card_flag, drug_volume, drug_vol_unit, dose, dose_unit, drug_occ, " +
  1440. " order_name, discription, del_flag, pay_self, serial, group_no, ward_code, yb_self_flag, " +
  1441. " doctor_flag, dept_code, exec_unit, zy_serial_no, kf_flag, refer_physician, consult_physician) " +
  1442. "values " +
  1443. "<foreach collection='list' item='item' separator=','>" +
  1444. "(#{item.actOrderNo, jdbcType = REAL}, #{item.inpatientNo}, #{item.admissTimes}, '06054', getdate(), 'ONCE', " +
  1445. " getdate(), #{userCode}, GETDATE(), GETDATE(),#{item.infantFlag}, 'o', #{item.supplyCode}, getdate(), " +
  1446. " #{item.physician}, getdate(), #{userCode}, " +
  1447. " #{userCode}, 2, getdate(), " +
  1448. " #{item.drugQuan ,jdbcType = REAL}, #{item.instruction}, #{item.drugSpecification}, #{item.miniUnit}, #{item.drugWeight ,jdbcType = REAL}, " +
  1449. " #{item.drugWeightUnit}, #{item.parentNo ,jdbcType = REAL} , #{item.selfBuy}, #{item.eatCardFlag}, #{item.drugVolume ,jdbcType = REAL},#{item.drugVolUnit},#{item.dose ,jdbcType = REAL},#{item.doseUnit}, " +
  1450. " #{item.drugOcc ,jdbcType = REAL},'退药: ${item.orderName}',#{item.discription},#{item.delFlag},#{item.paySelf},#{item.serial},#{item.groupNo},#{item.wardCode},#{item.ybSelfFlag}, " +
  1451. " #{item.doctorFlag},#{item.deptCode},#{item.execUnit},#{item.zySerialNo},#{item.kfFlag},#{item.referPhysician},#{item.consultPhysician})" +
  1452. "</foreach>" +
  1453. "</script>")
  1454. void insertAReturnOrder(@Param("userCode") String userCode,
  1455. @Param("list") List<YzActOrder> list);
  1456. @Update("UPDATE zy_actpatient " +
  1457. "SET refer_physician = #{param.referPhysician}, " +
  1458. " consult_physician = #{param.consultPhysician}, " +
  1459. " dept_director = #{param.deptDirector} " +
  1460. "WHERE inpatient_no = #{param.inpatientNo} " +
  1461. " AND admiss_times = #{param.admissTimes} ")
  1462. void updateTheThirdLevelDoctor(@Param("param") Overview param);
  1463. /**
  1464. * 插入药品汇总单
  1465. *
  1466. * @param pageNo 药单好
  1467. * @param patInfo 患者信息
  1468. * @param userCode 插入数据
  1469. * @param groupNo 药房
  1470. */
  1471. @Insert("insert into yz_yp_page_no (page_no, dept_code, ward_code, submit_time, " +
  1472. " submit_name, submit_flag, " +
  1473. " page_class, page_name, " +
  1474. " start_date, end_date, group_no) " +
  1475. "values (#{pageNo}, #{patInfo.wardCode}, #{patInfo.deptCode}, getdate()," +
  1476. " #{userCode}, 1, 1, '出院带药', getdate(), getdate(), #{groupNo})")
  1477. void summarySheetOfDrugs(Integer pageNo, XinZhenYiZhu patInfo, String userCode, String groupNo);
  1478. @Insert("<script>" +
  1479. "insert into yz_yp_zy_order (inpatient_no, admiss_times, name, bed_no, dept_code, ward_code, charge_code, " +
  1480. " amount, retprice/*药品的单价*/, charge_date, infant_flag, drawer, always_flag, status_flag/*1*/, drug_class, " +
  1481. " serail/*0*/, " +
  1482. " occ_time, act_order_no, page_no, pay_self/*0*/, serial/*serial*/, " +
  1483. " group_no, doctor_name, page_class) " +
  1484. "values " +
  1485. "<foreach collection='list' item='item' separator=','>" +
  1486. "(#{patInfo.inpatientNo},#{patInfo.admissTimes},#{patInfo.name},#{patInfo.bedNo},#{patInfo.wardCode},#{patInfo.deptCode},#{item.orderCode}," +
  1487. "#{item.drugQuan},(select pack_retprice from yp_zd_dict where code = '${item.orderCode}' and serial = '${item.serial}'),getdate()," +
  1488. "#{patInfo.infantFlag},#{userCode}," +
  1489. "'a','1',#{item.drugFlag},'0',getdate(),#{item.actOrderNo},#{pageNo},'0',#{item.serial},#{groupNo},#{userCode},'1')" +
  1490. "</foreach>" +
  1491. "</script>")
  1492. void insertDetailedMedicineList(Integer pageNo, XinZhenYiZhu patInfo, String userCode, String groupNo, List<XinZhenYzActOrder> list);
  1493. @Update("update yz_act_order " +
  1494. " set " +
  1495. " parent_no = ${order.actOrderNo}," +
  1496. " order_time = #{order.orderTime,jdbcType=TIMESTAMP}, " +
  1497. " start_time = #{order.startTime,jdbcType=TIMESTAMP}, " +
  1498. " end_time = #{order.endTime,jdbcType=TIMESTAMP}, " +
  1499. " supply_code = '044', " +
  1500. " frequ_code = #{order.frequCode}," +
  1501. " group_no = #{order.groupNo} " +
  1502. "where act_order_no = ${children} " +
  1503. " and group_no <> '00' and status_flag = '1' ")
  1504. void associateOrders(BigDecimal children, XinZhenYzActOrder order);
  1505. }