XiangMuLuRuDao.java 70 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276
  1. package thyyxxk.webserver.dao.his.inpatient;
  2. import com.baomidou.mybatisplus.core.conditions.Wrapper;
  3. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  4. import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  5. import com.baomidou.mybatisplus.core.metadata.IPage;
  6. import com.baomidou.mybatisplus.core.toolkit.Constants;
  7. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  8. import org.apache.ibatis.annotations.*;
  9. import thyyxxk.webserver.entity.datamodify.FeiYongLeiXin;
  10. import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
  11. import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
  12. import thyyxxk.webserver.entity.inpatient.WeiGuiFeiYongFenXi;
  13. import thyyxxk.webserver.entity.projectEntry.DrugReturnForm;
  14. import java.math.BigDecimal;
  15. import java.util.List;
  16. /**
  17. * <p>
  18. * 描述: 项目录入
  19. * </p>
  20. *
  21. * @author xc
  22. * @date 2021-08-02 10:37
  23. */
  24. @Mapper
  25. public interface XiangMuLuRuDao extends BaseMapper<ZyDetailCharge> {
  26. @Select("<script>" +
  27. "select a.admiss_times, a.inpatient_no, a.order_no, a.gen_time, a.ledger_sn, a.detail_sn, " +
  28. " a.trans_flag_yb, " +
  29. " a.charge_date, a.op_id_code, d.name op_name, a.charge_code, a.charge_fee, a.charge_status , " +
  30. " bill_item_code= b.bill_item_zy, bill_item_name=(select name from zy_bill_item where code = b.bill_item_zy), " +
  31. " charge_name=b.name, spec=b.charge_unit, a.charge_code_mx, a.serial, price=0.0000, charge_amount=a.charge_amount, " +
  32. " exec_dept=(select name from zd_unit_code where code = a.exec_unit), " +
  33. " dept_code = (select name from zd_unit_code where code = a.ward_code) , " +
  34. " self_flag=isnull(a.self_flag,0), suppress_flag=a.suppress_flag, group_no='00', " +
  35. " separate_flag=a.separate_flag, ope_flag=a.ope_flag, drugname=c.name, isnull(a.ori_detail_sn,0) ori_detail_sn " +
  36. " FROM (select top ${pageSize} * from (select ROW_NUMBER() OVER (order by charge_date ${riQiPaiXu} ) as RowNumber,* from zy_detail_charge a " +
  37. "where a.charge_code " +
  38. "like 'BILL%' and a.ledger_sn = #{ledgerSn} and trans_flag_yb &lt;&gt; 2 and a.order_no &lt;&gt; 6 and inpatient_no = #{inpatientNo} " +
  39. "and admiss_times = #{admissTimes} and a.infant_flag = #{infantFlag} " +
  40. "<if test=\"chargeCode != null and chargeCode != '' \">" +
  41. "and charge_code_mx = #{chargeCode} " +
  42. "</if>" +
  43. "<if test=\"startTime != null and startTime!= '' \">" +
  44. "and charge_date &gt;= #{startTime} and charge_date &lt;= #{endTime} " +
  45. "</if>" +
  46. "<if test=\"dept != null and dept != '' \"> " +
  47. "and exec_unit=#{dept} " +
  48. "</if>" +
  49. "<if test=\"orderNo != 2 and orderNo != 1 \">" +
  50. "and order_no = #{orderNo} " +
  51. "</if>" +
  52. "<if test=\"orderNo !=2 and orderNo == 1\">" +
  53. "and len(order_no) &gt;2 " +
  54. "</if>" +
  55. "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 0 \">" +
  56. "and ori_detail_sn is null and charge_fee > 0" +
  57. "</if>" +
  58. "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 1 \">" +
  59. "and (ori_detail_sn &gt; 0 or charge_fee &lt; 0) " +
  60. "</if>" +
  61. "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 2 \">" +
  62. "and (ori_detail_sn = -1 )" +
  63. "</if>" +
  64. "<if test=\"actOrderNo != null\">" +
  65. " and order_no = #{actOrderNo} " +
  66. "</if>" +
  67. ") temp where RowNumber > ${pageSize} * (${currentPage} - 1 )) a " +
  68. " left join zd_charge_item b on (a.charge_code = b.code) " +
  69. " left join yp_zd_dict c on (a.serial = c.serial and c.code= a.charge_code_mx) " +
  70. " left join a_employee_mi d on (d.code = a.op_id_code) " +
  71. "</script>")
  72. List<ZyDetailCharge> huanZheYaoPinFeiYong(@Param("currentPage") long currentPage,
  73. @Param("pageSize") long pageSize,
  74. @Param("inpatientNo") String inpatientNo,
  75. @Param("admissTimes") Integer admissTimes,
  76. @Param("ledgerSn") Integer ledgerSn,
  77. @Param("chargeCode") String chargeCode,
  78. @Param("infantFlag") int infantFlag,
  79. @Param("startTime") String startTime,
  80. @Param("endTime") String endTime,
  81. @Param("orderNo") BigDecimal orderNo,
  82. @Param("actOrderNo") BigDecimal actOrderNo,
  83. @Param("dept") String dept,
  84. @Param("riQiPaiXu") String riQiPaiXu,
  85. @Param("tuiFeiFlag") Integer tuiFeiFlag);
  86. @Select("<script>" +
  87. "select count(*) total,sum(charge_fee) charge_fee" +
  88. " FROM zy_detail_charge a " +
  89. "where a.charge_code " +
  90. "like 'BILL%' and a.ledger_sn = #{ledgerSn} and trans_flag_yb &lt;&gt; 2 and a.order_no &lt;&gt; 6 and inpatient_no = #{inpatientNo} " +
  91. "and admiss_times = #{admissTimes} and a.infant_flag = #{infantFlag} " +
  92. "<if test=\"chargeCode != null and chargeCode != '' \">" +
  93. "and charge_code_mx = #{chargeCode} " +
  94. "</if>" +
  95. "<if test=\"startTime != null and startTime!= '' \">" +
  96. "and charge_date &gt;= #{startTime} and charge_date &lt;= #{endTime} " +
  97. "</if>" +
  98. "<if test=\"dept != null and dept != '' \"> " +
  99. "and exec_unit=#{dept} " +
  100. "</if>" +
  101. "<if test=\"orderNo != 2 and orderNo != 1 \">" +
  102. "and order_no = #{orderNo} " +
  103. "</if>" +
  104. "<if test=\"orderNo !=2 and orderNo == 1\">" +
  105. "and len(order_no) &gt;2 " +
  106. "</if>" +
  107. "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 0 \">" +
  108. "and ori_detail_sn is null and charge_fee > 0" +
  109. "</if>" +
  110. "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 1 \">" +
  111. "and (ori_detail_sn &gt; 0 or charge_fee &lt; 0) " +
  112. "</if>" +
  113. "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 2 \">" +
  114. "and (ori_detail_sn = -1 )" +
  115. "</if>" +
  116. "<if test=\"actOrderNo != null\">" +
  117. " and order_no = #{actOrderNo} " +
  118. "</if>" +
  119. "</script>")
  120. long huanZheYaoPinFeiYongTotal(@Param("inpatientNo") String inpatientNo,
  121. @Param("admissTimes") Integer admissTimes,
  122. @Param("ledgerSn") Integer ledgerSn,
  123. @Param("chargeCode") String chargeCode,
  124. @Param("infantFlag") int infantFlag,
  125. @Param("startTime") String startTime,
  126. @Param("endTime") String endTime,
  127. @Param("orderNo") BigDecimal orderNo,
  128. @Param("actOrderNo") BigDecimal actOrderNo,
  129. @Param("dept") String dept,
  130. @Param("tuiFeiFlag") Integer tuiFeiFlag);
  131. @Select("<script>" +
  132. " SELECT " +
  133. " a.admiss_times, " +
  134. " a.inpatient_no, " +
  135. " a.order_no, " +
  136. " a.gen_time, " +
  137. " a.ledger_sn," +
  138. " a.trans_flag_yb, " +
  139. " a.detail_sn, " +
  140. " a.charge_date, " +
  141. " a.op_id_code, " +
  142. " c.name op_name, " +
  143. " a.charge_code, " +
  144. " a.charge_fee, " +
  145. " a.charge_status , " +
  146. " bill_item_code = b.bill_item_zy, " +
  147. " bill_item_name=(select name from zy_bill_item where code = b.bill_item_zy), " +
  148. " charge_name=b.name, " +
  149. " spec=b.charge_unit, " +
  150. " a.charge_code_mx, " +
  151. " a.serial, " +
  152. " price=0.0000, " +
  153. " charge_amount=a.charge_amount, " +
  154. " exec_dept=(select name from zd_unit_code where code = a.exec_unit), " +
  155. " dept_code = (select name from zd_unit_code where code = a.ward_code) , " +
  156. " self_flag=a.self_flag, " +
  157. " suppress_flag=a.suppress_flag, " +
  158. " group_no='00', " +
  159. " separate_flag=a.separate_flag, " +
  160. " ope_flag=a.ope_flag," +
  161. " specification, " +
  162. " drugname=b.name, " +
  163. " isnull(a.ori_detail_sn,0) ori_detail_sn " +
  164. " FROM (select top ${pageSize} * from (select ROW_NUMBER() OVER (order by charge_date ${riQiPaiXu} ) as RowNumber,* from zy_detail_charge where inpatient_no= #{inpatientNo} and " +
  165. "admiss_times= #{admissTimes} and ledger_sn = #{ledgerSn} and infant_flag = #{infantFlag} and trans_flag_yb &lt;&gt; 2 AND charge_code not like 'BILL%' and order_no &lt;&gt; 6" +
  166. "<if test=\"chargeCode != null and chargeCode != '' \">" +
  167. "and charge_code_mx = #{chargeCode} " +
  168. "</if>" +
  169. "<if test=\"startTime != null and startTime!= '' \">" +
  170. "and charge_date &gt;= #{startTime} and charge_date &lt;= #{endTime} " +
  171. "</if>" +
  172. "<if test=\"dept != null and dept != '' \"> " +
  173. "and exec_unit = #{dept} " +
  174. "</if>" +
  175. "<if test=\"orderNo != 2 and orderNo != 1 \">" +
  176. "and order_no = #{orderNo} " +
  177. "</if>" +
  178. "<if test=\"orderNo !=2 and orderNo == 1\">" +
  179. "and len(order_no) &gt;2 " +
  180. "</if>" +
  181. "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 0 \">" +
  182. "and ori_detail_sn is null and charge_fee > 0" +
  183. "</if>" +
  184. "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 1 \">" +
  185. "and (ori_detail_sn &gt; 0 or charge_fee &lt; 0) " +
  186. "</if>" +
  187. "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 2 \">" +
  188. "and (ori_detail_sn = -1 )" +
  189. "</if>" +
  190. "<if test=\"actOrderNo != null\">" +
  191. " and order_no = #{actOrderNo} " +
  192. "</if>" +
  193. ") temp where RowNumber > ${pageSize} * (${currentPage}-1) ) a " +
  194. " left join zd_charge_item b on (a.charge_code=b.code) " +
  195. " left join a_employee_mi c on (c.code = a.op_id_code)" +
  196. "</script>")
  197. List<ZyDetailCharge> huanZheXiangMuFeiYong(@Param("currentPage") long currentPage,
  198. @Param("pageSize") long pageSize,
  199. @Param("inpatientNo") String inpatientNo,
  200. @Param("admissTimes") Integer admissTimes,
  201. @Param("ledgerSn") Integer ledgerSn,
  202. @Param("chargeCode") String chargeCode,
  203. @Param("infantFlag") int infantFlag,
  204. @Param("startTime") String startTime,
  205. @Param("endTime") String endTime,
  206. @Param("orderNo") BigDecimal orderNo,
  207. @Param("actOrderNo") BigDecimal actOrderNo,
  208. @Param("dept") String dept,
  209. @Param("riQiPaiXu") String riQiPaiXu,
  210. @Param("tuiFeiFlag") Integer tuiFeiFlag);
  211. @Select("<script>" +
  212. " select count(*) total,sum(charge_fee) charge_fee from zy_detail_charge where inpatient_no= #{inpatientNo} and " +
  213. "admiss_times= #{admissTimes} and ledger_sn = #{ledgerSn} and infant_flag = #{infantFlag} and trans_flag_yb &lt;&gt; 2 AND charge_code not like 'BILL%' and order_no &lt;&gt; 6" +
  214. "<if test=\"chargeCode != null and chargeCode != '' \">" +
  215. "and charge_code_mx = #{chargeCode} " +
  216. "</if>" +
  217. "<if test=\"startTime != null and startTime!= '' \">" +
  218. "and charge_date &gt;= #{startTime} and charge_date &lt;= #{endTime} " +
  219. "</if>" +
  220. "<if test=\"dept != null and dept != '' \"> " +
  221. "and exec_unit = #{dept} " +
  222. "</if>" +
  223. "<if test=\"orderNo != 2 and orderNo != 1 \">" +
  224. "and order_no = #{orderNo} " +
  225. "</if>" +
  226. "<if test=\"orderNo !=2 and orderNo == 1\">" +
  227. "and len(order_no) &gt;2 " +
  228. "</if>" +
  229. "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 0 \">" +
  230. "and ori_detail_sn is null and charge_fee > 0" +
  231. "</if>" +
  232. "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 1 \">" +
  233. "and (ori_detail_sn &gt; 0 or charge_fee &lt; 0) " +
  234. "</if>" +
  235. "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 2 \">" +
  236. "and (ori_detail_sn = -1 )" +
  237. "</if>" +
  238. "<if test=\"actOrderNo != null\">" +
  239. " and order_no = #{actOrderNo} " +
  240. "</if>" +
  241. "</script>")
  242. long huanZheFeiYongToatal(@Param("inpatientNo") String inpatientNo,
  243. @Param("admissTimes") Integer admissTimes,
  244. @Param("ledgerSn") Integer ledgerSn,
  245. @Param("chargeCode") String chargeCode,
  246. @Param("infantFlag") int infantFlag,
  247. @Param("startTime") String startTime,
  248. @Param("endTime") String endTime,
  249. @Param("orderNo") BigDecimal orderNo,
  250. @Param("actOrderNo") BigDecimal actOrderNo,
  251. @Param("dept") String dept,
  252. @Param("tuiFeiFlag") Integer tuiFeiFlag);
  253. @Select("select detail_sn,ori_detail_sn from zy_detail_charge where inpatient_no=#{inpatientNo} and admiss_times = #{admissTimes} " +
  254. "and charge_fee <= 0 and ori_detail_sn is not null and infant_flag = #{infantFlag}")
  255. List<ZyDetailCharge> tuiFeiList(@Param("inpatientNo") String inpatientNo,
  256. @Param("admissTimes") Integer admissTimes,
  257. @Param("infantFlag") int infantFlag);
  258. /**
  259. * @param pyCode 拼音编码
  260. * @return 获取项目的名称和code
  261. */
  262. @Select("select distinct code,name from zd_charge_item where (py_code like #{pyCode} or code like #{pyCode} or name like #{pyCode})" +
  263. "union all " +
  264. "select distinct code,name from yp_zd_dict where (py_code like #{pyCode} or code like #{pyCode} or name like #{pyCode})")
  265. List<GetDropdownBox> getChargeCode(String pyCode);
  266. /**
  267. * @param inpatientNo 住院次数
  268. * @param admissTimes 住院号
  269. * @param list 需要退费的流水号
  270. * @return 获取患者的全部详细信息 因为要生成一条一样的数据 只是 费用和数量不一致 以及录入人 和 录入时间
  271. */
  272. @Select("<script>" +
  273. "select " +
  274. "inpatient_no, " +
  275. " admiss_times, " +
  276. " ledger_sn, " +
  277. " detail_sn, " +
  278. " charge_date, " +
  279. " op_id_code, " +
  280. " charge_code, " +
  281. " bill_item_code = (select bill_item_zy from zd_charge_item where code = charge_code), " +
  282. " infant_flag, " +
  283. " charge_status, " +
  284. " retprice, " +
  285. " charge_amount, " +
  286. " charge_fee, " +
  287. " self_flag, " +
  288. " separate_flag, " +
  289. " suppress_flag, " +
  290. " ward_code, " +
  291. " dept_code, " +
  292. " order_no, " +
  293. " ope_flag, " +
  294. " exec_unit, " +
  295. " gen_time, " +
  296. " pay_percent, " +
  297. " zj_flag, " +
  298. " zfl, " +
  299. " rtrim(charge_code_mx) as charge_code_mx, " +
  300. " case when nullif(serial, '') is null then '00' else rtrim(serial) end as serial, " +
  301. " zy_serial_no, " +
  302. " doctor_code, " +
  303. " yb_self_flag, " +
  304. " orig_charge_fee, " +
  305. " confirm_id, " +
  306. " trans_flag_yb, " +
  307. " ss_code, " +
  308. " gs_flag, " +
  309. " refer_physician, " +
  310. " consult_physician, " +
  311. " ori_detail_sn" +
  312. " from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and detail_sn in " +
  313. "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
  314. "#{item.detailSn}" +
  315. "</foreach>" +
  316. "</script>")
  317. List<ZyDetailCharge> huoQuJuTiFeiYong(@Param("inpatientNo") String inpatientNo,
  318. @Param("admissTimes") Integer admissTimes,
  319. @Param("ledgerSn") Integer ledgerSn,
  320. @Param("list") List<ZyDetailCharge> list);
  321. /**
  322. * 查询出 有哪些数据已经退过了 费用
  323. *
  324. * @param inpatientNo 住院号
  325. * @param admissTimes 住院次数
  326. * @param list 流水号
  327. * @return 返回 已经退过费用的数据
  328. */
  329. @Select("<script>" +
  330. "select " +
  331. "inpatient_no, " +
  332. " admiss_times, " +
  333. " ledger_sn, " +
  334. " detail_sn, " +
  335. " charge_date, " +
  336. " op_id_code, " +
  337. " charge_code, " +
  338. " bill_item_code = (select bill_item_zy from zd_charge_item where code = charge_code), " +
  339. " infant_flag, " +
  340. " charge_status, " +
  341. " retprice, " +
  342. " charge_amount, " +
  343. " charge_fee, " +
  344. " self_flag, " +
  345. " separate_flag, " +
  346. " suppress_flag, " +
  347. " ward_code, " +
  348. " dept_code, " +
  349. " order_no, " +
  350. " ope_flag, " +
  351. " exec_unit, " +
  352. " gen_time, " +
  353. " pay_percent, " +
  354. " zj_flag, " +
  355. " zfl, " +
  356. " charge_code_mx, " +
  357. " serial, " +
  358. " zy_serial_no, " +
  359. " doctor_code, " +
  360. " yb_self_flag, " +
  361. " orig_charge_fee, " +
  362. " confirm_id, " +
  363. " trans_flag_yb, " +
  364. " ss_code, " +
  365. " gs_flag, " +
  366. " refer_physician, " +
  367. " consult_physician, " +
  368. " ori_detail_sn" +
  369. " from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and detail_sn in " +
  370. "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
  371. "#{item.detailSn}" +
  372. "</foreach>" +
  373. "</script>")
  374. List<ZyDetailCharge> chaKanSFYiJingTuiFeiLe(@Param("inpatientNo") String inpatientNo,
  375. @Param("admissTimes") Integer admissTimes,
  376. @Param("ledgerSn") Integer ledgerSn,
  377. @Param("list") List<ZyDetailCharge> list);
  378. /**
  379. * 插入数据
  380. *
  381. * @param list 插入退费的数据 生成一条一样的数据 只是 费用和数量不一致 以及录入人 和 录入时间 ori_detail_sn 保存退费的原流水号
  382. */
  383. @Insert("<script>" +
  384. "insert into zy_detail_charge(inpatient_no, admiss_times, ledger_sn, detail_sn, charge_date, op_id_code, charge_code, infant_flag, " +
  385. "charge_status, retprice, charge_amount, charge_fee, self_flag, separate_flag, suppress_flag, ward_code, dept_code, order_no, ope_flag, exec_unit, gen_time, " +
  386. "pay_percent, zj_flag, zfl, charge_code_mx, serial, zy_serial_no, doctor_code, yb_self_flag, orig_charge_fee, confirm_id, trans_flag_yb, ss_code, gs_flag, " +
  387. "refer_physician, consult_physician, ori_detail_sn) " +
  388. "values " +
  389. "<foreach collection='list' item='item' separator=','>" +
  390. "(#{item.inpatientNo},#{item.admissTimes},#{item.ledgerSn},#{item.detailSn},getdate(),#{item.opIdCode},#{item.chargeCode},#{item.infantFlag}," +
  391. "#{item.chargeStatus},#{item.retprice},cast(#{item.chargeAmount,jdbcType=DECIMAL} as decimal(14,5)),cast(#{item.chargeFee,jdbcType=DECIMAL} as decimal(14,5))," +
  392. "#{item.selfFlag},#{item.separateFlag},#{item.suppressFlag},#{item.wardCode},#{item.deptCode},#{item.orderNo}," +
  393. "#{item.opeFlag},#{item.execUnit},#{item.oldGenTime}," +
  394. "#{item.payPercent},#{item.zjFlag},#{item.zfl},#{item.chargeCodeMx},#{item.serial},#{item.zySerialNo},#{item.doctorCode}," +
  395. "#{item.ybSelfFlag},cast(#{item.origChargeFee,jdbcType=DECIMAL} as decimal(14,5)),#{item.confirmId},0,#{item.ssCode},#{item.gsFlag}," +
  396. "#{item.referPhysician},#{item.consultPhysician},#{item.oriDetailSn})" +
  397. "</foreach>" +
  398. "</script>")
  399. void xiangMuTuiFei(@Param("list") List<ZyDetailCharge> list);
  400. /**
  401. * 更新对应 退费的正数 流水
  402. *
  403. * @param inpatientNo 住院号
  404. * @param admissTimes 住院次数
  405. * @param ledgerSn 账页号
  406. * @param list 正流水
  407. */
  408. @Update("<script>" +
  409. "update zy_detail_charge set ori_detail_sn = #{flag} where " +
  410. "inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} " +
  411. "and ledger_sn = #{ledgerSn} " +
  412. "and charge_fee &gt; 0 and charge_amount &gt; 0 and detail_sn in " +
  413. "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
  414. "#{item}" +
  415. "</foreach>" +
  416. "</script>")
  417. void genXinZhenShuTuiFeiLiuShui(@Param("inpatientNo") String inpatientNo,
  418. @Param("admissTimes") Integer admissTimes,
  419. @Param("ledgerSn") Integer ledgerSn,
  420. @Param("list") List<Integer> list,
  421. @Param("flag") int flag);
  422. /**
  423. * 退药汇总单
  424. */
  425. @Insert("insert into yz_yp_page_no (page_no, dept_code, ward_code, submit_time, submit_name,\n" +
  426. " submit_flag, page_class, page_name, group_no)\n" +
  427. "values (#{pageNo}, #{wardCode}, #{wardCode}, getdate(), #{userCode}, 1, 'HT', '护士退药单', #{groupNo})")
  428. void drugReturnForm(@Param("pageNo") Integer pageNo,
  429. @Param("wardCode") String wardCode,
  430. @Param("userCode") String userCode,
  431. @Param("groupNo") String groupNo);
  432. @Insert("<script>" +
  433. "insert into yz_yp_zy_order (inpatient_no, admiss_times, name, bed_no, dept_code, ward_code, charge_code, amount,\n" +
  434. " retprice, charge_date, infant_flag, drawer, always_flag, status_flag, drug_class, \n" +
  435. " occ_time, act_order_no, serial, group_no, doctor_name, page_no_ty,ledger_sn,detail_sn,serail,page_class)\n" +
  436. "values " +
  437. "<foreach collection='list' item='item' index='index' separator=','>" +
  438. "(#{patNo}, #{times}, #{name}, #{bedNo}, #{wardCode}, #{wardCode}, #{item.chargeCodeMx}, #{item.chargeAmount,jdbcType=REAL},\n" +
  439. " #{item.chargeFee,jdbcType=REAL}, getdate(), #{infantFlag}, #{userCode}, 'a', '1',\n" +
  440. " #{item.drugClass}, getdate(), ${index}, #{item.serial}, #{groupNo},\n" +
  441. " #{item.doctorCode}, #{pageNo},#{ledgerSn},#{item.detailSn},0,'HT')" +
  442. "</foreach>" +
  443. "</script>")
  444. void detailsOfDrugReturnForm(@Param("list") List<ZyDetailCharge> list,
  445. @Param("patNo") String patNo,
  446. @Param("times") Integer times,
  447. @Param("name") String name,
  448. @Param("bedNo") String bedNo,
  449. @Param("wardCode") String wardCode,
  450. @Param("infantFlag") Integer infantFlag,
  451. @Param("groupNo") String groupNo,
  452. @Param("userCode") String userCode,
  453. @Param("pageNo") Integer pageNo,
  454. @Param("ledgerSn") Integer ledgerSn);
  455. /**
  456. * 获取模板
  457. *
  458. * @param queryWrapper 根据科室来搜索
  459. * @return 返回模板信息
  460. */
  461. @Select("SELECT rtrim(pattern_name) as name, " +
  462. " max(group_no) as group_no, " +
  463. " max(op_id_code) as op_id_code, " +
  464. " op_dept " +
  465. "FROM zy_charge_pattern " +
  466. " ${ew.customSqlSegment} " +
  467. "group by pattern_name, op_dept ")
  468. Page<ZyDetailCharge> getMuBan(IPage<ZyDetailCharge> page,
  469. @Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper);
  470. /**
  471. * 这个是获取模板下面的那些项目具体信息
  472. *
  473. * @param patternName 模板名称
  474. * @param opIdCode 录入人id
  475. * @return 返回模板 下面的详细信息
  476. */
  477. @Select("SELECT charge_name=RTRIM(b.name), " +
  478. " charge_code_mx=b.code, " +
  479. " amount=a.amount, " +
  480. " charge_amount=b.charge_amount, " +
  481. " op_id_code=a.op_id_code, " +
  482. " bill_item_code=b.bill_item_zy, " +
  483. " bill_item_name=(select name from zy_bill_item where code = b.bill_item_zy)," +
  484. " national_code," +
  485. " national_name," +
  486. " descriptions," +
  487. " a.serial " +
  488. "FROM zy_charge_pattern a, " +
  489. " zd_charge_item b " +
  490. "WHERE (a.pattern_name = #{patternName}) " +
  491. " and a.op_id_code = #{opIdCode} " +
  492. " and a.charge_code = b.code " +
  493. " and isnull(a.serial, '01') = '00' " +
  494. " and (isnull(b.del_flag, '0') <> '1') " +
  495. "union all " +
  496. "SELECT charge_name=RTRIM(d.name), " +
  497. " charge_code_mx=b.charge_code, " +
  498. " amount=a.amount, " +
  499. " charge_amount=d.pack_retprice, " +
  500. " op_id_code=a.op_id_code, " +
  501. " bill_item_code=d.bill_item_zy, " +
  502. " bill_item_name=(select name from zy_bill_item where code = d.bill_item_zy)," +
  503. " national_code," +
  504. " national_name," +
  505. " specification as descriptions," +
  506. " a.serial " +
  507. "FROM zy_charge_pattern a, " +
  508. " yp_base_yf b, " +
  509. " yp_zd_dict d " +
  510. "WHERE (a.pattern_name = #{patternName}) " +
  511. " and a.op_id_code = #{opIdCode} " +
  512. " and a.group_no = b.group_no " +
  513. " and a.charge_code = b.charge_code " +
  514. " and isnull(a.serial, '01') = b.serial " +
  515. " and b.charge_code = d.code " +
  516. " and b.serial = d.serial " +
  517. " and isnull(d.del_flag, '0') <> '1' " +
  518. " and isnull(b.visible_flag_zy, '0') <> '1'")
  519. List<ZyDetailCharge> getMuBanXinXi(@Param("patternName") String patternName, @Param("opIdCode") String opIdCode);
  520. /**
  521. * 搜索项目信息
  522. *
  523. * @param pyCode 拼音码
  524. * @return 返回模板信息
  525. */
  526. @Select("SELECT a.code charge_code," +
  527. " a.code charge_code_mx, " +
  528. " a.exec_unit dept_code," +
  529. " rtrim(a.yb_comment) yb_comment, " +
  530. " RTRIM(a.name) charge_name, " +
  531. " a.charge_amount," +
  532. " amount = 1, " +
  533. " bill_item_code=a.bill_item_zy, " +
  534. " bill_item_name=(select name from zy_bill_item where code = a.bill_item_zy)," +
  535. " a.py_code, " +
  536. " a.d_code, " +
  537. " a.suppress_flag, " +
  538. " a.bill_item_out, " +
  539. " a.n_code, " +
  540. " self_flag =isnull(a.self_flag,'0'), " +
  541. " a.separate_flag , " +
  542. " spec=charge_unit, " +
  543. " a.yb_comment, " +
  544. " exec_unit_name=b.name, " +
  545. " serial='00', " +
  546. " group_no='00'," +
  547. " national_code," +
  548. " national_name," +
  549. " descriptions " +
  550. "FROM zd_charge_item a left join zd_unit_code b on (a.exec_unit = b.code) " +
  551. "where isnull(a.del_flag,'') <> '1' and " +
  552. " isnull(a.in_out_flag,'') <> '1' and " +
  553. " (a.py_code like #{pyCode} or a.code like #{pyCode} or a.name like #{pyCode})")
  554. List<ZyDetailCharge> queryXiangMu(String pyCode);
  555. @Select("SELECT distinct a.code charge_code_mx, " +
  556. " charge_code = (select charge_code from zy_bill_item where a.bill_item_zy = zy_bill_item.code), " +
  557. " a.serial, " +
  558. " RTRIM(a.name) charge_name, " +
  559. " a.pack_size amount, " +
  560. " charge_amount=a.pack_retprice, " +
  561. " spec=a.specification, " +
  562. " a.drug_flag , " +
  563. " a.fix_price, " +
  564. " c.stock_amount, " +
  565. " self_flag=isnull(a.self_flag,'0'), " +
  566. " suppress_flag=a.suprice_flag, " +
  567. " group_no=c.group_no, " +
  568. " bill_item_code=a.bill_item_zy, " +
  569. " bill_item_name=(select name from zy_bill_item where code = a.bill_item_zy), " +
  570. " ybbz=a.yb_comment_new, " +
  571. " yblx=(select name from yp_zd_yb_type where code=a.yb_flag_new), " +
  572. " xnh=a.xnh_flag," +
  573. " national_code," +
  574. " national_name " +
  575. "FROM yp_zd_dict a ,yp_print_name b , " +
  576. " yp_base_yf c " +
  577. "where " +
  578. "(a.py_code like #{pyCode} or a.name like #{pyCode} or a.code like #{pyCode}) and" +
  579. " a.code=b.charge_code and " +
  580. " a.code=c.charge_code and " +
  581. " a.serial=c.serial and " +
  582. " c.visible_flag_mz <> '1' and " +
  583. " c.visible_flag_zy <> '1' and" +
  584. " isnull(a.del_flag,0) = 0 and " +
  585. " c.group_no='73'")
  586. List<ZyDetailCharge> queryYaoPin(String pyCode);
  587. /**
  588. * 插入项目录入费用
  589. *
  590. * @param zyDetailCharge 插入的信息
  591. * @param list 费用详情
  592. */
  593. @Insert("<script>" +
  594. "INSERT INTO zy_detail_charge (inpatient_no, admiss_times, ledger_sn, detail_sn, charge_date " +
  595. " , op_id_code, charge_code, infant_flag, charge_status, charge_fee " +
  596. " , self_flag, separate_flag, suppress_flag, ward_code, dept_code " +
  597. " , order_no, ope_flag, exec_unit, charge_amount, gen_time " +
  598. " , zy_serial_no, charge_code_mx, serial,ss_code,yb_self_flag,refer_physician,doctor_code) " +
  599. "VALUES " +
  600. "<foreach collection='list' item='item' separator=','>" +
  601. "(#{zyDetailCharge.inpatientNo}, #{zyDetailCharge.admissTimes}, #{ledgerSn}, #{item.detailSn}, getdate() " +
  602. " , #{zyDetailCharge.opIdCode}, #{item.chargeCode}, #{infantFlag}, '2', cast(#{item.chargeAmount,jdbcType=DECIMAL} as decimal(14,5)) " +
  603. " , '0', '0', NULL, #{zyDetailCharge.ward}, #{zyDetailCharge.dept} " +
  604. " , #{item.orderNo}, '0', #{item.deptCode}, cast(#{item.amount,jdbcType=DECIMAL} as decimal(14,5)), getdate() " +
  605. " , #{zyDetailCharge.zySerialNo}, #{item.chargeCodeMx}, #{item.serial},#{zyDetailCharge.ssCode}," +
  606. // 是否医保报销 标志 默认为空值
  607. "<if test=\"item.ybSelfFlag == null\">" +
  608. "0" +
  609. "</if>" +
  610. "<if test=\"item.ybSelfFlag != null\">" +
  611. "#{item.ybSelfFlag}" +
  612. "</if>" +
  613. ",#{zyDetailCharge.referPhysician}," +
  614. "null)" +
  615. "</foreach>" +
  616. "</script>")
  617. void chaRuFeiYong(@Param("zyDetailCharge") ZyDetailCharge zyDetailCharge,
  618. @Param("list") List<ZyDetailCharge> list,
  619. @Param("infantFlag") int infantFlag,
  620. @Param("ledgerSn") Integer ledgerSn);
  621. @Select("<script>" +
  622. "SELECT charge_code charge_code_mx,group_no,serial FROM yp_base_yf WHERE charge_code in " +
  623. "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
  624. "#{item.chargeCodeMx}" +
  625. "</foreach>" +
  626. "</script>")
  627. List<ZyDetailCharge> yaoFang(List<ZyDetailCharge> yaoPingCode);
  628. @Select("<script>" +
  629. "select code as charge_code_mx,\n" +
  630. " CASE infusion_flag\n" +
  631. " when '1' then 'i'\n" +
  632. " else (case when code &gt;= '30000' and code &lt; '50000' then 'd' else 'j' end) end as drug_class\n" +
  633. "from yp_zd_dict\n" +
  634. "where rtrim(code) + rtrim(serial) in " +
  635. "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
  636. " '${item.chargeCodeMx}${item.serial}' " +
  637. "</foreach>" +
  638. "</script>")
  639. List<ZyDetailCharge> getDrugClass(List<ZyDetailCharge> yaoPingCode);
  640. @Insert("<script>" +
  641. "insert into zy_drug ( inpatient_no , admiss_times , ledger_sn , detail_sn , charge_date , op_id_code , charge_code , infant_flag , " +
  642. "charge_fee , self_flag , separate_flag , supress_flag , ward_code , dept_code , ope_flag , exec_unit , retprice , amount , zy_serial_no , " +
  643. "serial , group_no , occ_cate ) values " +
  644. "<foreach collection='list' item='item' separator=','>" +
  645. "( #{zyDetailCharge.inpatientNo} , #{zyDetailCharge.admissTimes} , #{ledgerSn} , #{item.detailSn} , getdate() , #{opIdCode} , " +
  646. "#{item.chargeCodeMx} , #{infantFlag} , " +
  647. // 金额
  648. "cast(#{item.chargeFee,jdbcType=DECIMAL} as decimal(14,5))," +
  649. " '0' , '0' , null , #{zyDetailCharge.ward} , #{zyDetailCharge.dept} , '0' , #{item.deptCode} ," +
  650. // 单价
  651. " cast(#{item.chargeFee,jdbcType=DECIMAL} / #{item.chargeAmount,jdbcType=DECIMAL} as decimal(14,5)) , " +
  652. // 数量
  653. "cast(#{item.chargeAmount,jdbcType=DECIMAL} as decimal(14,5)) " +
  654. ", #{zyDetailCharge.zySerialNo} , #{item.serial} , 73 ,'1' )" +
  655. "</foreach>" +
  656. "</script>")
  657. void shenQingYaoPing(@Param("zyDetailCharge") ZyDetailCharge zyDetailCharge,
  658. @Param("list") List<ZyDetailCharge> list,
  659. @Param("infantFlag") int infantFlag,
  660. @Param("ledgerSn") Integer ledgerSn,
  661. @Param("opIdCode") String opIdCode);
  662. /**
  663. * 需要更新患者的总费用
  664. *
  665. * @param fy 费用
  666. * @param inpatientNo 住院号
  667. * @param admissTimes 住院次数
  668. */
  669. @Update("<script>" +
  670. "update ${tableName} " +
  671. "<trim prefix='set' suffixOverrides=','> " +
  672. "total_charge = total_charge + #{fy.totalCharge} , " +
  673. "balance = balance - #{fy.totalCharge}," +
  674. "<if test=\"fy.charge1 !=null \">" +
  675. "charge1 =charge1 + #{fy.charge1} ," +
  676. "</if>" +
  677. "<if test=\"fy.charge2 !=null \">" +
  678. "charge2 =charge2 + #{fy.charge2} ," +
  679. "</if>" +
  680. "<if test=\"fy.charge3 !=null \">" +
  681. "charge3 =charge3 + #{fy.charge3} ," +
  682. "</if>" +
  683. "<if test=\"fy.charge4 !=null \">" +
  684. "charge4 =charge4 + #{fy.charge4} ," +
  685. "</if>" +
  686. "<if test=\"fy.charge5 !=null \">" +
  687. "charge5 =charge5 + #{fy.charge5} ," +
  688. "</if>" +
  689. "<if test=\"fy.charge6 !=null \">" +
  690. "charge6 =charge6 + #{fy.charge6} ," +
  691. "</if>" +
  692. "<if test=\"fy.charge7 !=null \">" +
  693. "charge7 =charge7 + #{fy.charge7} ," +
  694. "</if>" +
  695. "<if test=\"fy.charge8 !=null \">" +
  696. "charge8 =charge8 + #{fy.charge8} ," +
  697. "</if>" +
  698. "<if test=\"fy.charge9 !=null \">" +
  699. "charge9 =charge9 + #{fy.charge9} ," +
  700. "</if>" +
  701. "<if test=\"fy.charge10 !=null \">" +
  702. "charge10 =charge10 + #{fy.charge10} ," +
  703. "</if>" +
  704. "<if test=\"fy.charge11 !=null \">" +
  705. "charge11 =charge11 + #{fy.charge11} ," +
  706. "</if>" +
  707. "<if test=\"fy.charge12 !=null \">" +
  708. "charge12 =charge12 + #{fy.charge12} ," +
  709. "</if>" +
  710. "<if test=\"fy.charge13 !=null \">" +
  711. "charge13 =charge13 + #{fy.charge13} ," +
  712. "</if>" +
  713. "<if test=\"fy.charge14 !=null \">" +
  714. "charge14 =charge14 + #{fy.charge14} ," +
  715. "</if>" +
  716. "<if test=\"fy.charge15 !=null \">" +
  717. "charge15 =charge15 + #{fy.charge15} ," +
  718. "</if>" +
  719. "<if test=\"fy.charge16 !=null \">" +
  720. "charge16 =charge16 + #{fy.charge16} ," +
  721. "</if>" +
  722. "<if test=\"fy.charge17 !=null \">" +
  723. "charge17 =charge17 + #{fy.charge17} ," +
  724. "</if>" +
  725. "<if test=\"fy.charge18 !=null \">" +
  726. "charge18 =charge18 + #{fy.charge18} ," +
  727. "</if>" +
  728. "<if test=\"fy.charge19 !=null \">" +
  729. "charge19 =charge19 + #{fy.charge19} ," +
  730. "</if>" +
  731. "<if test=\"fy.charge20 !=null \">" +
  732. "charge20 =charge20 + #{fy.charge20} ," +
  733. "</if>" +
  734. "<if test=\"fy.charge21 !=null \">" +
  735. "charge21 =charge21 + #{fy.charge21} ," +
  736. "</if>" +
  737. "<if test=\"fy.charge22 !=null \">" +
  738. "charge22 =charge22 + #{fy.charge22} ," +
  739. "</if>" +
  740. "<if test=\"fy.charge23 !=null \">" +
  741. "charge23 =charge23 + #{fy.charge23} ," +
  742. "</if>" +
  743. "<if test=\"fy.charge24 !=null \">" +
  744. "charge24 =charge24 + #{fy.charge24} ," +
  745. "</if>" +
  746. "<if test=\"fy.charge25 !=null \">" +
  747. "charge25 =charge25 + #{fy.charge25} ," +
  748. "</if>" +
  749. "<if test=\"fy.charge26 !=null \">" +
  750. "charge26 =charge26 + #{fy.charge26} ," +
  751. "</if>" +
  752. "<if test=\"fy.charge27 !=null \">" +
  753. "charge27 =charge27 + #{fy.charge27} ," +
  754. "</if>" +
  755. "<if test=\"fy.charge28 !=null \">" +
  756. "charge28 =charge28 + #{fy.charge28} ," +
  757. "</if>" +
  758. "<if test=\"fy.charge29 !=null \">" +
  759. "charge29 =charge29 + #{fy.charge29} ," +
  760. "</if>" +
  761. "<if test=\"fy.charge30 !=null \">" +
  762. "charge30 =charge30 + #{fy.charge30} ," +
  763. "</if>" +
  764. "</trim>" +
  765. "WHERE inpatient_no = #{inpatientNo} and admiss_times=#{admissTimes}" +
  766. "</script>")
  767. void huanZheZongFeiYong(@Param("fy") FeiYongLeiXin fy,
  768. @Param("inpatientNo") String inpatientNo,
  769. @Param("admissTimes") Integer admissTimes,
  770. @Param("tableName") String tableName);
  771. /**
  772. * 查看模板名称是否存在
  773. *
  774. * @param patternName 模板名字
  775. * @param opIdCode 创建模板的人 code
  776. * @return 返回条数
  777. */
  778. @Select("select count(*) from zy_charge_pattern where pattern_name = #{patternName} and op_id_code <> #{opIdCode} ")
  779. Integer chaKanMuBanMingChengSFcunZi(@Param("patternName") String patternName,
  780. @Param("opIdCode") String opIdCode);
  781. /**
  782. * 删除模板
  783. *
  784. * @param patternName 模板名字
  785. * @param opIdCode 创建模板的人 code
  786. */
  787. @Select("delete zy_charge_pattern where pattern_name = #{patternName} and op_id_code = #{opIdCode} ")
  788. Integer delMuBan(@Param("patternName") String patternName,
  789. @Param("opIdCode") String opIdCode);
  790. /**
  791. * 保存模板
  792. *
  793. * @param param 保存的数据
  794. */
  795. @Insert("<script>" +
  796. "INSERT INTO zy_charge_pattern ( charge_name, " +
  797. " pattern_name, " +
  798. " charge_code, " +
  799. " group_no," +
  800. " serial, " +
  801. " amount, " +
  802. " self, " +
  803. " separate," +
  804. " suppress, " +
  805. " infant, " +
  806. " per1," +
  807. " per2," +
  808. " per3," +
  809. " per4," +
  810. " per5," +
  811. " item_no, " +
  812. " op_id_code, " +
  813. " py_code, " +
  814. " d_code, " +
  815. " charge_fee, " +
  816. " op_dept, " +
  817. " default_no " +
  818. " )" +
  819. " VALUES " +
  820. "<foreach collection='param.list' item='item' index='index' separator=','>" +
  821. "( substring(#{item.chargeName},0,15) , #{param.name} , #{item.chargeCodeMx} , #{item.groupNo}, #{item.serial}, cast(#{item.amount,jdbcType=DECIMAL} as decimal(14,5)) , " +
  822. "'0', '0', '0', '0', 1, 1, 1, 1, 1, #{index} + 1 , #{param.opIdCode} , #{param.pyCode} , #{param.dCode} , cast(#{item.chargeAmount,jdbcType=DECIMAL} as decimal(14,5)) ," +
  823. " #{param.deptCode} , " +
  824. "#{param.defaultNo} )" +
  825. "</foreach>" +
  826. "</script>")
  827. void baoCunMuBan(@Param("param") ZyDetailCharge param);
  828. /**
  829. * 获取医嘱的费用
  830. *
  831. * @param inpatientNo 住院号
  832. * @param admissTimes 住院次数
  833. * @param ZF 正的费用还是负的费用
  834. * @return 返回list 费用集合
  835. */
  836. @Select("<script>" +
  837. "select charge_date,charge_fee,charge_amount,charge_code_mx,detail_sn,ori_detail_sn,ABS(order_no),order_no,ledger_sn,exec_unit " +
  838. "from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
  839. "and ori_detail_sn is null and charge_amount ${ZF} 0 and charge_fee ${ZF} 0 and infant_flag = #{infantFlag} and trans_flag_yb &lt;&gt; 2 " +
  840. "<if test=\"list.size >0 \">" +
  841. "and exec_unit in " +
  842. "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
  843. "#{item}" +
  844. "</foreach>" +
  845. "</if>" +
  846. "</script>")
  847. List<ZyDetailCharge> getYiZhuFeiYong(@Param("inpatientNo") String inpatientNo,
  848. @Param("admissTimes") Integer admissTimes,
  849. @Param("ledgerSn") Integer ledgerSn,
  850. @Param("ZF") String ZF,
  851. @Param("infantFlag") int infantFlag,
  852. @Param("list") List<String> list);
  853. /**
  854. * @param inpatientNo 住院号
  855. * @param admissTimes 住院次数
  856. * @param yiZhuPiPei 需要匹配的流水信息
  857. */
  858. @Update("<script>" +
  859. "<foreach collection='list' item='item' index='index' open='' close='' separator=';'>" +
  860. "update zy_detail_charge set ori_detail_sn = #{item.oriDetailSn} where inpatient_no= #{inpatientNo} and admiss_times = #{admissTimes} " +
  861. "and detail_sn = #{item.detailSn} and infant_flag = #{infantFlag} and ledger_sn = #{item.ledgerSn} " +
  862. "</foreach>" +
  863. "</script>")
  864. void yiZhuTuiFeiPiPei(@Param("inpatientNo") String inpatientNo,
  865. @Param("admissTimes") Integer admissTimes,
  866. @Param("list") List<ZyDetailCharge> yiZhuPiPei,
  867. @Param("infantFlag") int infantFlag);
  868. @Select("SELECT small_dept FROM zd_dept_all where dept = #{dept}")
  869. List<String> chaXunZhiZXinKeShi(@Param("dept") String dept);
  870. @Select("select role_id from dj_user_role where user_code = #{code}")
  871. List<Integer> huoQuJueSe(@Param("code") String code);
  872. @Select("select code,rtrim(name) name from zd_unit_code where code not like '8%'")
  873. List<GetDropdownBox> getDept();
  874. @Select("select code,rtrim(name) name from zd_unit_code where code like '8%'")
  875. List<GetDropdownBox> getWard();
  876. @Select("SELECT small_dept code,name=(select name from zd_unit_code where code = small_dept) FROM zd_dept_all where dept = #{dept}")
  877. List<GetDropdownBox> getBingQuDuiYingKeShi(@Param("dept") String dept);
  878. @Select("select count(*) from zy_actpatient where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes}")
  879. Integer getHuanZheSFZaiYuan(@Param("inpatientNo") String inpatientNo,
  880. @Param("admissTimes") Integer admissTimes);
  881. @Select("select case settle_type when '1' then '0' else settle_type end as settle_type from zy_ledger_file where " +
  882. "inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} " +
  883. "and ledger_sn = (select max(ledger_sn)ledger_sn from zy_ledger_file where zy_ledger_file.inpatient_no = #{inpatientNo} " +
  884. "and zy_ledger_file.admiss_times = #{admissTimes}) ")
  885. Integer getHuanZheSFJieSuan(@Param("inpatientNo") String inpatientNo,
  886. @Param("admissTimes") Integer admissTimes);
  887. @Select("select detail_sn,ori_detail_sn,trans_flag_yb from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} " +
  888. "and detail_sn = #{detailSn} and order_no <> 6 and trans_flag_yb <> 2 ")
  889. ZyDetailCharge beiTuiFeiYongXinXi(@Param("inpatientNo") String inpatientNo,
  890. @Param("admissTimes") Integer admissTimes,
  891. @Param("ledger") Integer ledger,
  892. @Param("detailSn") Integer detailSn);
  893. @Select("<script>" +
  894. "select code from yp_zd_dict where code in " +
  895. "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
  896. " #{item}" +
  897. "</foreach> " +
  898. " and serial = '01' and isnull(del_flag,0) = 1 " +
  899. "union all " +
  900. "select code from zd_charge_item where code in " +
  901. "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
  902. " #{item}" +
  903. "</foreach> " +
  904. " and isnull(del_flag,0) = 1" +
  905. "</script>")
  906. List<String> chaXunFeiYongShiFouTingYong(List<String> bianMa);
  907. @Select("<script>" +
  908. "select charge_code from yp_base_yf where stock_amount &lt;= 0 and serial = '01' and charge_code in " +
  909. "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
  910. " #{item}" +
  911. "</foreach> " +
  912. "</script>")
  913. List<String> kuCun(List<String> bianMa);
  914. @Delete("delete zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} " +
  915. "and detail_sn = #{detailSn} and order_no <> 6 and trans_flag_yb <> 2")
  916. void cheXiaoFeiYong(@Param("inpatientNo") String inpatientNo,
  917. @Param("admissTimes") Integer admissTimes,
  918. @Param("ledger") Integer ledger,
  919. @Param("detailSn") Integer detailSn);
  920. @Update("update zy_detail_charge set ori_detail_sn = null where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} " +
  921. "and detail_sn = #{detailSn} and order_no <> 6 and trans_flag_yb <> 2")
  922. void cheXiaoHouHuanYuanZhenShuJu(@Param("inpatientNo") String inpatientNo,
  923. @Param("admissTimes") Integer admissTimes,
  924. @Param("ledger") Integer ledger,
  925. @Param("detailSn") Integer detailSn);
  926. @Select("select act_order_no as order_no,exec_unit from yz_erase_order where act_order_no in " +
  927. "(select order_no from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} " +
  928. "and exec_unit is null AND charge_fee < 0 and ori_detail_sn is null)")
  929. List<ZyDetailCharge> huoQuYaoPingZhongKeShiWeiKongDe(@Param("inpatientNo") String inpatientNo,
  930. @Param("admissTimes") Integer admissTimes,
  931. @Param("ledger") Integer ledger);
  932. @Update("<script>" +
  933. " <foreach collection='list' item='item' separator=';' >" +
  934. "update zy_detail_charge set exec_unit = #{item.execUnit} where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} " +
  935. "and order_no = #{item.orderNo} and exec_unit is null and charge_fee &lt; 0" +
  936. "</foreach> " +
  937. "</script> ")
  938. void yiZhuTuiFeiGenXingZhiXingKeShi(@Param("inpatientNo") String inpatientNo,
  939. @Param("admissTimes") Integer admissTimes,
  940. @Param("ledger") Integer ledger,
  941. @Param("list") List<ZyDetailCharge> genXingDeZhiXinKeShi);
  942. @Select("select b.code from zy_detail_charge a, yp_zd_dict b " +
  943. "where order_no <> 6 and trans_flag_yb not in (1,2) and charge_code like 'BILL%' " +
  944. " and isnull(b.national_code,'') = '' and inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} " +
  945. "and a.infant_flag = #{infantFlag} " +
  946. " and a.charge_code_mx = b.code " +
  947. "group by b.code ")
  948. List<String> weiGuiYaoPinInt(@Param("inpatientNo") String inpatientNo,
  949. @Param("admissTimes") Integer admissTimes,
  950. @Param("ledger") Integer ledger,
  951. @Param("infantFlag") Integer infantFlag);
  952. @Update("<script>" +
  953. "<foreach collection='list' item='item' separator=';'>" +
  954. "update yp_zd_dict set national_code = (select top(1) national_code from yp_zd_dict where code = #{item} and national_code is not null ) " +
  955. "where code = #{item} and national_code is null" +
  956. "</foreach>" +
  957. "</script>")
  958. void genXinYaoPingPiPeiXinXi(@Param("list") List<String> list);
  959. @Select("select a.charge_code_mx,case when (select top(1) rtrim(name) from zd_charge_item where code = a.charge_code_mx) != '' then " +
  960. "(select top(1) rtrim(name) from zd_charge_item where code = a.charge_code_mx) else " +
  961. "(select top(1) rtrim(name) from yp_zd_dict where code = a.charge_code_mx) end as name " +
  962. "from zy_detail_charge a left join zd_charge_item_hnsgs b " +
  963. "on (a.charge_code_mx = b.hosp_code) where " +
  964. "inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} and infant_flag = #{infantFlag} and ori_detail_sn is null and isnull(b.hnsyb_item_code,'') = '' " +
  965. "group by a.charge_code_mx ")
  966. List<WeiGuiFeiYongFenXi> gongShangWeiPiPei(@Param("inpatientNo") String inpatientNo,
  967. @Param("admissTimes") Integer admissTimes,
  968. @Param("ledger") Integer ledger,
  969. @Param("infantFlag") Integer infantFlag);
  970. /**
  971. * 违规药品 信息 没有匹配的
  972. *
  973. * @param inpatientNo 住院号
  974. * @param admissTimes 住院次数
  975. * @param ledger 账页号
  976. * @return 返回违规药品 没有匹配的
  977. */
  978. @Select("select charge_code_mx,b.name from zy_detail_charge a, yp_zd_dict b " +
  979. "where trans_flag_yb not in (1,2) and charge_code like 'BILL%' " +
  980. " and isnull(b.national_code,'') = '' and inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} " +
  981. "and a.infant_flag = #{infantFlag} " +
  982. " and a.charge_code_mx = b.code " +
  983. "group by charge_code_mx, b.name")
  984. List<WeiGuiFeiYongFenXi> weiGuiYaoPin(@Param("inpatientNo") String inpatientNo,
  985. @Param("admissTimes") Integer admissTimes,
  986. @Param("ledger") Integer ledger,
  987. @Param("infantFlag") Integer infantFlag);
  988. @Select("select charge_code_mx,b.name from zy_detail_charge a, zd_charge_item b " +
  989. "where trans_flag_yb not in (1,2) and charge_code not like 'BILL%' " +
  990. " and isnull(b.national_code,'') = '' and inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} " +
  991. " and a.infant_flag = #{infantFlag} " +
  992. " and a.charge_code_mx = b.code " +
  993. "group by charge_code_mx, b.name")
  994. List<WeiGuiFeiYongFenXi> weiGuiXiangMu(@Param("inpatientNo") String inpatientNo,
  995. @Param("admissTimes") Integer admissTimes,
  996. @Param("ledger") Integer ledger,
  997. @Param("infantFlag") Integer infantFlag);
  998. @Select("<script>" +
  999. "select rtrim(inpatient_no) inpatient_no,admiss_times,ledger_sn,charge_code_mx,detail_sn,ori_detail_sn,order_no,charge_fee,charge_amount, " +
  1000. " exec_unit_name = (select rtrim(name) name from zd_unit_code where exec_unit = code),charge_date,trans_flag_yb, exec_unit, " +
  1001. " op_id_code = (select rtrim(name) name from a_employee_mi where code = op_id_code)," +
  1002. " charge_code_name = (select rtrim(name) name from zd_charge_item where code = charge_code_mx),charge_code = 'xm' from zy_detail_charge " +
  1003. "where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} and infant_flag = #{infantFlag} " +
  1004. " and charge_fee &lt; 0 and charge_code not like 'BILL%' " +
  1005. " and trans_flag_yb not in (1,2) " +
  1006. " and ori_detail_sn is null " +
  1007. "<if test=\"chuYuanYiZhu == 0\">" +
  1008. " and CONVERT(varchar(100), charge_date, 23) &lt;= CONVERT(varchar(100), GETDATE(), 23)" +
  1009. "</if>" +
  1010. "<if test=\"list.size >0 \">" +
  1011. " and exec_unit in " +
  1012. "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
  1013. "#{item}" +
  1014. "</foreach>" +
  1015. "</if>" +
  1016. "</script>")
  1017. List<ZyDetailCharge> weiXieDaiYuanLiuShuiXiangMu(@Param("inpatientNo") String inpatientNo,
  1018. @Param("admissTimes") Integer admissTimes,
  1019. @Param("ledger") Integer ledger,
  1020. @Param("infantFlag") Integer infantFlag,
  1021. @Param("list") List<String> execUnit,
  1022. @Param("chuYuanYiZhu") Integer chuYuanYiZhu);
  1023. @Select("<script>" +
  1024. "select rtrim(inpatient_no) inpatient_no,admiss_times,ledger_sn,charge_code_mx,detail_sn,order_no,ori_detail_sn,charge_fee,charge_amount, " +
  1025. " exec_unit_name = (select rtrim(name) name from zd_unit_code where exec_unit = code),charge_date,trans_flag_yb,exec_unit, " +
  1026. " op_id_code = (select rtrim(name) name from a_employee_mi where code = op_id_code)," +
  1027. " charge_code_name = (select top(1) rtrim(name) name from yp_zd_dict where code = charge_code_mx),charge_code = 'yp' from zy_detail_charge " +
  1028. "where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} and infant_flag = #{infantFlag} " +
  1029. " and charge_fee &lt; 0 and charge_code like 'BILL%' " +
  1030. " and trans_flag_yb not in (1,2) " +
  1031. " and ori_detail_sn is null" +
  1032. "<if test=\"chuYuanYiZhu == 0\">" +
  1033. " and CONVERT(varchar(100), charge_date, 23) &lt;= CONVERT(varchar(100), GETDATE(), 23)" +
  1034. "</if>" +
  1035. "<if test=\"list.size > 0 \">" +
  1036. " and exec_unit in " +
  1037. "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
  1038. "#{item}" +
  1039. "</foreach>" +
  1040. "</if>" +
  1041. "</script>")
  1042. List<ZyDetailCharge> weiXieDaiYuanLiuShuiYaoPing(@Param("inpatientNo") String inpatientNo,
  1043. @Param("admissTimes") Integer admissTimes,
  1044. @Param("ledger") Integer ledger,
  1045. @Param("infantFlag") Integer infantFlag,
  1046. @Param("list") List<String> execUnit,
  1047. @Param("chuYuanYiZhu") Integer chuYuanYiZhu);
  1048. @Select("<script>" +
  1049. "select inpatient_no,admiss_times,ledger_sn,detail_sn,charge_amount,charge_fee,order_no,charge_code_mx,charge_date,ori_detail_sn " +
  1050. "from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and charge_code_mx = #{chargeCodeMx} " +
  1051. "<choose>" +
  1052. "<when test=\"execUnit != null and execUnit != ''\">" +
  1053. "and exec_unit = #{execUnit} " +
  1054. "</when>" +
  1055. "<otherwise>" +
  1056. "and order_no = #{orderNo}" +
  1057. "</otherwise>" +
  1058. "</choose>" +
  1059. "and trans_flag_yb &lt;&gt; 2 and order_no &lt;&gt; 6 and charge_fee &gt; 0 and charge_amount &gt; 0 " +
  1060. "and infant_flag = #{infantFlag} " +
  1061. "<if test=\"startTime != null and startTime != '' \">" +
  1062. "and charge_date &gt;= #{startTime} and charge_date &lt;= #{endTime} " +
  1063. "</if>" +
  1064. " order by charge_date ${riQiPaiXu}" +
  1065. "</script>")
  1066. List<ZyDetailCharge> weiGuiZhenShuPiPei(@Param("inpatientNo") String inpatientNo,
  1067. @Param("admissTimes") Integer admissTimes,
  1068. @Param("ledgerSn") Integer ledgerSn,
  1069. @Param("infantFlag") Integer infantFlag,
  1070. @Param("chargeCodeMx") String chargeCodeMx,
  1071. @Param("execUnit") String execUnit,
  1072. @Param("orderNo") String orderNo,
  1073. @Param("startTime") String startTime,
  1074. @Param("endTime") String endTime,
  1075. @Param("riQiPaiXu") String riQiPaiXu);
  1076. @Select("select inpatient_no,admiss_times,ledger_sn,detail_sn,charge_code_mx,sum(charge_fee) yi_tui_fei from ( " +
  1077. "select inpatient_no,admiss_times,ledger_sn,detail_sn,charge_code_mx,charge_fee " +
  1078. "from zy_detail_charge where " +
  1079. "inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and charge_code_mx = #{chargeCodeMx} " +
  1080. "and exec_unit = #{execUnit} and trans_flag_yb <> 2 and order_no <> 6 and" +
  1081. " detail_sn in(select ori_detail_sn from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and " +
  1082. "ledger_sn = #{ledgerSn} and charge_code_mx = #{chargeCodeMx}" +
  1083. " and charge_fee <0 and ori_detail_sn is not null) " +
  1084. "union all " +
  1085. "select inpatient_no,admiss_times,ledger_sn,ori_detail_sn,charge_code_mx,charge_fee " +
  1086. "from zy_detail_charge where " +
  1087. "inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and charge_code_mx = #{chargeCodeMx} " +
  1088. "and exec_unit = #{execUnit} and trans_flag_yb <> 2 and order_no <> 6 and " +
  1089. "ori_detail_sn in(select ori_detail_sn from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} " +
  1090. "and ledger_sn = #{ledgerSn} and charge_code_mx = #{chargeCodeMx} and charge_fee <0 and ori_detail_sn is not null) " +
  1091. ") temp " +
  1092. "group by inpatient_no, admiss_times, ledger_sn, detail_sn, charge_code_mx")
  1093. List<ZyDetailCharge> tuiFeiYuEr1(@Param("inpatientNo") String inpatientNo,
  1094. @Param("admissTimes") Integer admissTimes,
  1095. @Param("ledgerSn") Integer ledgerSn,
  1096. @Param("chargeCodeMx") String chargeCodeMx,
  1097. @Param("execUnit") String execUnit);
  1098. @Select("<script>" +
  1099. "select detail_sn,ori_detail_sn,order_no,charge_fee,charge_amount,charge_code_mx,charge_date, " +
  1100. " exec_unit_name = (select rtrim(name) from zd_unit_code where code =exec_unit), " +
  1101. " ward_code = (select rtrim(name) from zd_unit_code where code = ward_code) " +
  1102. " from zy_detail_charge where " +
  1103. " inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
  1104. "and infant_flag = #{infantFlag} " +
  1105. "and charge_code_mx = #{chargeCodeMx} and trans_flag_yb &lt;&gt; 2 and order_no &lt;&gt; 6 " +
  1106. "and charge_amount &gt; 0 " +
  1107. "<if test=\"startTime != null and startTime != '' \">" +
  1108. "and charge_date &gt;= #{startTime} and charge_date &lt;= #{endTime} " +
  1109. "</if>" +
  1110. "order by charge_date ${riQiPaiXu}" +
  1111. "</script>")
  1112. List<ZyDetailCharge> genJuBianMaChaZhaoZhenShuFeiYong(@Param("inpatientNo") String inpatientNo,
  1113. @Param("admissTimes") Integer admissTimes,
  1114. @Param("ledgerSn") Integer ledgerSn,
  1115. @Param("infantFlag") Integer infantFlag,
  1116. @Param("chargeCodeMx") String chargeCodeMx,
  1117. @Param("startTime") String startTime,
  1118. @Param("endTime") String endTime,
  1119. @Param("riQiPaiXu") String riQiPaiXu);
  1120. @Select("<script>" +
  1121. "select * from zy_detail_charge " +
  1122. "where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and infant_flag = #{infantFlag} and detail_sn in " +
  1123. "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
  1124. "#{item}" +
  1125. "</foreach>" +
  1126. " and charge_fee &gt; 0 and charge_amount &gt; 0 " +
  1127. "</script>")
  1128. List<ZyDetailCharge> piPeiXinXi(@Param("inpatientNo") String inpatientNo,
  1129. @Param("admissTimes") Integer admissTimes,
  1130. @Param("ledgerSn") Integer ledgerSn,
  1131. @Param("infantFlag") Integer infantFlag,
  1132. @Param("list") int[] detailSnList);
  1133. @Select("<script>" +
  1134. "select inpatient_no,admiss_times,ledger_sn,ori_detail_sn,sum(charge_fee) charge_fee from zy_detail_charge " +
  1135. " where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and infant_flag = #{infantFlag} and ori_detail_sn in " +
  1136. "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
  1137. "#{item} " +
  1138. "</foreach>" +
  1139. "and charge_fee &lt; 0 and charge_amount &lt; 0 " +
  1140. "group by inpatient_no, admiss_times, ledger_sn, ori_detail_sn " +
  1141. "</script>")
  1142. List<ZyDetailCharge> tuiFeiYuEr2(@Param("inpatientNo") String inpatientNo,
  1143. @Param("admissTimes") Integer admissTimes,
  1144. @Param("ledgerSn") Integer ledgerSn,
  1145. @Param("infantFlag") Integer infantFlag,
  1146. @Param("list") int[] detailSnList);
  1147. @Select("select inpatient_no,admiss_times,ledger_sn,detail_sn,charge_fee,charge_amount,ori_detail_sn,trans_flag_yb,exec_unit from zy_detail_charge " +
  1148. "where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and detail_sn = #{detailSn} " +
  1149. "and infant_flag = #{infantFlag} and charge_fee < 0 and charge_amount < 0 ")
  1150. ZyDetailCharge piPeiXinXiFuShu(@Param("inpatientNo") String inpatientNo,
  1151. @Param("admissTimes") Integer admissTimes,
  1152. @Param("ledgerSn") Integer ledgerSn,
  1153. @Param("infantFlag") Integer infantFlag,
  1154. @Param("detailSn") Integer detailSn);
  1155. @Update("update zy_detail_charge set ori_detail_sn = #{oriDetailSn} where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
  1156. "and detail_sn = #{detailSn} ")
  1157. void zhiYouYiGeJiuGenXingFuShuLiuShui(@Param("inpatientNo") String inpatientNo,
  1158. @Param("admissTimes") Integer admissTimes,
  1159. @Param("ledgerSn") Integer ledgerSn,
  1160. @Param("detailSn") Integer detailSn,
  1161. @Param("oriDetailSn") Integer oriDetailSn);
  1162. @Update("update zy_detail_charge set yb_self_flag = 0 ${ew.customSqlSegment}")
  1163. void xiuGaiZiFeiZhiYiBaoBiaoZhi(@Param(Constants.WRAPPER) Wrapper<?> wq);
  1164. @Select("<script>" +
  1165. "select a.charge_code,\n" +
  1166. " b.name as drug_name,\n" +
  1167. " b.specification,\n" +
  1168. " a.amount,\n" +
  1169. " a.retprice,\n" +
  1170. " b.pack_retprice,\n" +
  1171. " a.inpatient_no as pat_no,\n" +
  1172. " a.name,\n" +
  1173. " page_class,\n" +
  1174. " page_no_ty\n" +
  1175. "from yz_yp_zy_order a,\n" +
  1176. " yp_zd_dict b\n" +
  1177. "where a.inpatient_no = #{patNo}\n" +
  1178. " and a.admiss_times = #{times}" +
  1179. " and group_no = #{groupNo} " +
  1180. " and a.status_flag = 1 " +
  1181. " and page_class = 'HT' " +
  1182. "<if test=\"refundTime != null and refundTime != '' \">" +
  1183. " and CONVERT(varchar(100), occ_time, 23) = #{refundTime} " +
  1184. "</if>" +
  1185. " and a.charge_code = b.code\n" +
  1186. " and a.serial = b.serial " +
  1187. "</script>")
  1188. List<DrugReturnForm> queryTheDrugReturnForm(@Param("groupNo") String groupNo,
  1189. @Param("patNo") String patNo,
  1190. @Param("times") Integer times,
  1191. @Param("refundTime") String refundTime);
  1192. }