YiZhuLuRuDao.java 78 KB

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