UpIdCollectionDao.java 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. package thyyxxk.webserver.dao.his.medicalinsurance;
  2. import org.apache.ibatis.annotations.*;
  3. import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
  4. import thyyxxk.webserver.entity.datamodify.TYbSetModifyTime;
  5. import thyyxxk.webserver.entity.datamodify.TYbSetlModifyReq;
  6. import thyyxxk.webserver.entity.medicalinsurance.inpatient.BatjBa4;
  7. import thyyxxk.webserver.entity.medicalinsurance.inpatient.YbZyDisDiag;
  8. import thyyxxk.webserver.entity.medicalinsurance.inpatient.ZyDisDiagYb;
  9. import thyyxxk.webserver.entity.medicalinsurance.inpatient.ZyInactpatient;
  10. import thyyxxk.webserver.entity.medicalinsurance.query.SiPatInfo;
  11. import thyyxxk.webserver.entity.medicalinsurance.setllistupld.*;
  12. import thyyxxk.webserver.entity.querydata.SiSetlinfoTemp;
  13. import java.util.Date;
  14. import java.util.List;
  15. import java.util.Map;
  16. import java.util.Set;
  17. /**
  18. * <p>
  19. * 描述: 医保结算单上传
  20. * </p>
  21. *
  22. * @author xc
  23. * @date 2021-11-25 08:42
  24. */
  25. @Mapper
  26. public interface UpIdCollectionDao {
  27. @Select("select a.mdtrt_id, " + // -- 就诊ID
  28. " a.setl_id, " + // -- 结算ID
  29. " a.psn_no as hi_no, " + //-- 医保编号
  30. " medcasno=(a.pat_no+'_'+cast(a.times as varchar)), " + //-- 病案号
  31. " dcla_time=getdate(), " + //-- 申报时间
  32. " a.psn_name, " + //-- 人员姓名
  33. " a.gend, " + // -- 性别
  34. " a.brdy, " + //-- 出生日期
  35. " a.age, " + // -- 年龄
  36. " a.certno, " + // -- 证件号码
  37. " a.psn_cert_type as patnCertType, " + // -- 患者证件类别
  38. " b.insuplc_admdvs as insuplc, " + // -- 参保地
  39. " psnSelfpay=cast(a.psn_cash_pay as decimal(16,2)) , " + // -- 个人自付
  40. " psnOwnpay=cast(a.fulamt_ownpay_amt as decimal(16,2)) , " + // -- 个人自费
  41. " acct_pay=cast(a.acct_pay as decimal(16,2)), " + // -- 个人账户支出
  42. " psnCashpay=cast(a.psn_cash_pay as decimal(16,2)) , " + // -- 个人现金支付
  43. " a.clr_optins as hsorg, " + // -- 医保机构
  44. " a.insutype as hi_type," + // -- 险种类型
  45. " a.setl_time as setl_end_date " + //结算时间
  46. "from t_si_setlinfo a, t_si_pat_info b " +
  47. "where a.pat_no=b.pat_no and a.times=b.times " +
  48. "and a.ledger_sn = b.ledger_sn " +
  49. "and a.pat_no = #{patNo} and a.times = #{times} " +
  50. "and a.ledger_sn = #{ledgerSn} " +
  51. "and a.revoked = 0 ")
  52. SetlinfoUpld setlinfo1(@Param("patNo") String patNo,
  53. @Param("times") Integer times,
  54. @Param("ledgerSn") Integer ledgerSn);
  55. @Select("select rtrim(country) as ntly, " + // 国籍
  56. " rtrim(social_no) as certno, " + // 证件
  57. " rtrim(occupation_code) as prfs, " + // -- 职业 在 Prfs 中有对应的
  58. " rtrim(home_street) as curr_addr ," + // -- 现住址
  59. " rtrim(employer_name) as emp_name, " + //-- 单位名称
  60. " rtrim(employer_street) as emp_addr, " + //-- 单位地址
  61. " rtrim(employer_tel) as emp_tel, " +
  62. " rtrim(employer_zipcode) as poscode," +
  63. " (select rtrim(name) from zd_nation_code where code = nation_code) as naty," +
  64. " rtrim(relation_name) as coner_name, " +
  65. " (select isnull(rtrim(yb_code),80) from zy_zd_relative_code where code = relation_code) as patn_rlts, " + // 与患者的关系
  66. " rtrim(relation_tel) as coner_tel " + // 联系人电话
  67. "from a_patient_mi " +
  68. "where inpatient_no = #{patNo} or mz_no = #{patNo}")
  69. SetlinfoUpld setlinfo2(@Param("patNo") String patNo);
  70. @Select("select " +
  71. " pwcry_bfadm_coma_dura = isnull(ryq_hmsj_day,0) + '/' + isnull(ryq_hmsj_hour,0) + '/' + isnull(ryq_hmsj_min,0), " + // -- 颅脑损伤患者入院前昏迷时长
  72. " pwcry_afadm_coma_dura = isnull(ryh_hmsj_day,0) + '/' + isnull(ryh_hmsj_hour,0) + '/' + isnull(ryh_hmsj_min,0), " + // -- 颅脑损伤患者入院后昏迷时长
  73. " lyfs as dscg_way, " + // -- 离院方式
  74. " jsjg as acp_medins_name, " + // -- 拟接收机构名称
  75. " acp_optins_code = '', " + // -- 拟接收机构代码 (占时为空)
  76. " zzy_flag as days_rinp_flag_31, " + // -- 出院31天内再住院计划标志
  77. " rtrim(zzy_md) as days_rinp_pup_31, " + // -- 出院31天内再住院目的
  78. " chfpdr_name = (select rtrim(name) from a_employee_mi where code = isnull(zzys,b.consult_physician)), " + // -- 主诊医师姓名
  79. " (select yb_code from a_employee_mi where code = isnull(zzys,b.consult_physician)) as chfpdr_code, " + //-- 主诊医师代码
  80. " b.admiss_date as adm_time, " + //-- 入院时间
  81. " adm_caty = (select rtrim(si_caty) from zd_unit_code where code = b.small_dept), " + // -- 入院科别
  82. " refldept_dept = (select rtrim(si_caty) from zd_unit_code where code = b.zk_ward), " + //--转科科别
  83. " b.dis_date as dscg_time, " + // -- 出院时间
  84. " dscg_caty = (select rtrim(si_caty) from zd_unit_code where code=isnull(zk_ward,small_dept)), " + // -- 出院科别
  85. " datediff(day ,b.admiss_date ,b.dis_date) as act_ipt_days, " + // 实际住院天数
  86. " zy_serial_no as biz_sn " +// 业务流水号
  87. "from batj_ba2 a,zy_inactpatient b " +
  88. "where a.bah = b.inpatient_no and a.zycs = b.admiss_times " +
  89. "and a.bah = #{patNo} and a.zycs = #{times}")
  90. SetlinfoUpld setlinfo3(@Param("patNo") String patNo,
  91. @Param("times") Integer times);
  92. @Select("select case age_days when '-' then 0 else age_days end as nwb_age, " +
  93. " rtrim(lxdz2) as coner_addr, " +
  94. " rtrim(rytj) as adm_way, " +
  95. " case new_born_weight when '-' then 0 else age_days end as nwb_bir_wt, " +
  96. " case new_born_admiss_weight when '-' then 0 else age_days end as nwb_bir_wt" +
  97. " from batj_ba1 where zyh = #{patNo} and zycs = #{times} ")
  98. SetlinfoUpld setlinfo4(@Param("patNo") String patNo,
  99. @Param("times") Integer times);
  100. @Select("select top(1) rtrim(name) name,dept_name = (select rtrim(name) from zd_unit_code where code = dept_code) " +
  101. "from a_employee_mi where code = #{code}")
  102. GetDropdownBox userInfo(String code);
  103. @Select("select isnull(sum(charge_amount),0) from zy_detail_charge where inpatient_no = #{patNo} and admiss_times = #{times} and ledger_sn = #{ledgerSn} and infant_flag = #{infantFlag}" +
  104. " and charge_code_mx in ('F01464','017051')")
  105. int teJiHuLi(@Param("patNo") String patNo,
  106. @Param("times") Integer times,
  107. @Param("ledgerSn") Integer ledgerSn,
  108. @Param("infantFlag") Integer infantFlag);
  109. @Select("select isnull(sum(charge_amount),0) from zy_detail_charge where inpatient_no = #{patNo} and admiss_times = #{times} and ledger_sn = #{ledgerSn} and infant_flag = #{infantFlag}" +
  110. " and charge_code_mx in ('F01465','017052')")
  111. int yiJiHuLi(@Param("patNo") String patNo,
  112. @Param("times") Integer times,
  113. @Param("ledgerSn") Integer ledgerSn,
  114. @Param("infantFlag") Integer infantFlag);
  115. @Select("select isnull(sum(charge_amount),0) from zy_detail_charge where inpatient_no = #{patNo} and admiss_times = #{times} and ledger_sn = #{ledgerSn} and infant_flag = #{infantFlag}" +
  116. " and charge_code_mx in ('F01466','017053')")
  117. int erJiHuLi(@Param("patNo") String patNo,
  118. @Param("times") Integer times,
  119. @Param("ledgerSn") Integer ledgerSn,
  120. @Param("infantFlag") Integer infantFlag);
  121. @Select("select isnull(sum(charge_amount),0) from zy_detail_charge where inpatient_no = #{patNo} and admiss_times = #{times} and ledger_sn = #{ledgerSn} and infant_flag = #{infantFlag}" +
  122. " and charge_code_mx in ('F01467','017054')")
  123. int sanJiHuLi(@Param("patNo") String patNo,
  124. @Param("times") Integer times,
  125. @Param("ledgerSn") Integer ledgerSn,
  126. @Param("infantFlag") Integer infantFlag);
  127. // 这里是 住院诊断消息
  128. @Select("select si_diag_type as diag_type, " +
  129. " rtrim(dis_diag) as diag_code, " +
  130. " rtrim(dis_diag_comment) as diag_name " +
  131. "from ${tableName} " +
  132. "where inpatient_no = #{patNo} and admiss_times = #{times} " +
  133. "order by dis_diag_no ")
  134. List<DiseinfoUpld> diseinfo(@Param("patNo") String patNo,
  135. @Param("times") Integer times,
  136. @Param("tableName") String tableName);
  137. // 这里是手术操作信息
  138. @Select("select " +
  139. " rtrim(ssmc) as oprn_oprt_name, " +
  140. " rtrim(ssbm) as oprn_oprt_code, " +
  141. " ssrq as oprn_oprt_date, " +
  142. " (select rtrim(isnull(yb_code,9)) from zd_anaesthesia where code = mzff ) as anst_way, " +
  143. " (select top(1) rtrim(name) from a_employee_mi where code = ssys) as oper_dr_name, " +
  144. " (select rtrim(yb_code) from a_employee_mi where code = ssys) as oper_dr_code, " +
  145. " (select rtrim(name) from a_employee_mi where code = mzys) as anst_dr_name, " +
  146. " (select rtrim(yb_code) from a_employee_mi where code = mzys) as anst_dr_code " +
  147. " from ${tableName} " +
  148. "where zyh = #{patNo} and zycs = #{times} " +
  149. "order by ssxh")
  150. List<OprninfoUpld> oprninfoUplds(@Param("patNo") String patNo,
  151. @Param("times") Integer times,
  152. @Param("tableName") String tableName);
  153. @Select("select insuplc_admdvs,insutype,med_type from t_si_pat_info " +
  154. "where pat_no = #{patNo} and times = #{times} and ledger_sn = #{ledgerSn}")
  155. SiPatInfo huoQuZhiFuFangShi(@Param("patNo") String patNo,
  156. @Param("times") Integer times,
  157. @Param("ledgerSn") Integer ledgerSn);
  158. @Update("update t_si_setlinfo set hi_paymtd = #{hiPaymtd} where pat_no = #{patNo} and times = #{times} and ledger_sn = #{ledgerSn}")
  159. void genXingYiBaoZhiFuFangShi(@Param("patNo") String patNo,
  160. @Param("times") Integer times,
  161. @Param("ledgerSn") Integer ledgerSn,
  162. @Param("hiPaymtd") Integer hiPaymtd);
  163. @Select("select receipt_no from zy_receipt where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn} and receipt_no<>'0000000'" +
  164. "and receipt_sn = 1")
  165. String billNo(@Param("patNo") String patNo,
  166. @Param("times") Integer times,
  167. @Param("ledgerSn") Integer ledgerSn);
  168. @Select("select isnull(audit_flag,0) from t_yb_setl_modify_req where pat_no = #{patNo} " +
  169. "and times = #{times}")
  170. Integer setlModifyReqAuditFlag(@Param("patNo") String patNo,
  171. @Param("times") Integer times);
  172. // 基金支付信息
  173. @Select("select fund_pay_type,fund_payamt=cast(sum(fund_payamt) as decimal(16,2)) from t_si_setldetail " +
  174. "where pat_no = #{patNo} and times = #{times} and ledger_sn = #{ledgerSn} " +
  175. "group by fund_pay_type ")
  176. List<PayinfoUpld> payinfoUpld(@Param("patNo") String patNo,
  177. @Param("times") Integer times,
  178. @Param("ledgerSn") Integer ledgerSn);
  179. /* 收费项目信息 */
  180. // 总金额 和 全自费 和 医疗收费项目
  181. @Select("select med_chrgitm_type as med_chrgitm," +
  182. "amt=cast(sum(det_item_fee_sumamt) as decimal(16,2)), " +
  183. "fulamt_ownpay_amt=cast(sum(fulamt_ownpay_amt) as decimal(16,2)), " +
  184. "claa_sumfee = 0,clab_amt = 0,oth_amt = 0 from t_si_setl_fee_detl " +
  185. "where setl_id = #{setlId} group by med_chrgitm_type")
  186. List<IteminfoUpld> amtAndOthAmt(@Param("setlId") String setlId);
  187. // -- 01 甲类
  188. @Select("select med_chrgitm_type as med_chrgitm," +
  189. "claa_sumfee=cast(sum(det_item_fee_sumamt) as decimal(16,2)) " +
  190. "from t_si_setl_fee_detl " +
  191. "where setl_id = #{setlId} and chrgitm_lv = '01' " +
  192. "group by med_chrgitm_type")
  193. List<IteminfoUpld> jiaLeiFeiYong(@Param("setlId") String setlId);
  194. // -- 02 乙类
  195. @Select("select med_chrgitm_type as med_chrgitm," +
  196. "clab_amt=cast(sum(det_item_fee_sumamt) as decimal(16,2)) " +
  197. "from t_si_setl_fee_detl " +
  198. "where setl_id = #{setlId} and chrgitm_lv = '02' " +
  199. "group by med_chrgitm_type")
  200. List<IteminfoUpld> yiLeiFeiYong(@Param("setlId") String setlId);
  201. // 重症监护信息
  202. @Select("select op_time from zy_zk_list where inpatient_no=#{patNo} and admiss_times=#{times} and " +
  203. "(dept_code in ('1160000','8000160') or f_dept_code in ('1160000','8000160')) " +
  204. "order by zk_times")
  205. List<Date> zhuanKeShiJian(@Param("patNo") String patNo,
  206. @Param("times") Integer times);
  207. // 保存返回信息
  208. @Update("update t_si_setlinfo set setl_list_id = #{setlListId} where setl_id = #{setlId} ")
  209. void fanHuiLiuShuiHao(@Param("setlListId") String setlListId,
  210. @Param("setlId") String setlId);
  211. @Select("<script>" +
  212. "select top ${pageSize} * from (" +
  213. "select " +
  214. "row_number() over (order by setl_time) as rowNumber," +
  215. "rtrim(a.pat_no) pat_no,a.times,ledger_sn,psn_name,gend,brdy,insutype,psn_type,mdtrt_id,setl_id,setl_time, " +
  216. " a.med_type,medfee_sumamt,fund_pay_sumamt, " +
  217. " acct_pay,psn_cash_pay,clr_optins,clr_optins_name = (select name from t_region where code=clr_optins), " +
  218. " outDeptName=(select rtrim(name) from zd_unit_code where code=isnull(zk_ward,small_dept))," +
  219. " rtrim(isnull(zk_ward,small_dept)) as out_dept, " +
  220. " setl_list_id,datediff(day ,b.admiss_date ,b.dis_date) as act_ipt_days,b.operation,b.dec_type," +
  221. " id,req_op_id,rtrim(req_op_name) req_op_name,req_op_date,req_remark," +
  222. "audit_staff,audit_name,audit_date,audit_remark,audit_flag," +
  223. "refer_physician_name = (select top 1 rtrim(name) from a_employee_mi where code = b.refer_physician),b.refer_physician " +
  224. "from t_si_setlinfo a left join zy_inactpatient b on (a.pat_no = b.inpatient_no and a.times = b.admiss_times) " +
  225. "left join t_yb_setl_modify_req c on (a.pat_no = c.pat_no and a.times = c.times) " +
  226. "where revoked = 0 " +
  227. "<if test=\"startTime !=null and startTime != '' \">" +
  228. " and a.setl_time &gt;= #{startTime} and a.setl_time &lt;= #{endTime} " +
  229. "</if>" +
  230. "<if test=\"setlType !=null and setlType != '' \">" +
  231. " and a.setl_type = #{setlType} " +
  232. "</if>" +
  233. "<if test=\"patNo !=null and patNo != '' \">" +
  234. " and a.pat_no = #{patNo} " +
  235. "</if>" +
  236. "<if test=\"insutypes.size > 0 \">" +
  237. " and insutype in " +
  238. "<foreach collection='insutypes' item='item' index='index' open='(' close=')' separator=','>" +
  239. "#{item}" +
  240. "</foreach>" +
  241. "</if>" +
  242. "<if test=\"outDepts.size > 0 and outDepts != null \">" +
  243. "and isnull(zk_ward,small_dept) in " +
  244. "<foreach collection='outDepts' item='item' index='index' open='(' close=')' separator=','>" +
  245. "#{item} " +
  246. "</foreach>" +
  247. "</if>" +
  248. "<if test=\"medTypes.size > 0 \">" +
  249. " and a.med_type in " +
  250. "<foreach collection='medTypes' item='item' index='index' open='(' close=')' separator=','>" +
  251. "#{item}" +
  252. "</foreach>" +
  253. "</if>" +
  254. "<if test=\"psnTypes.size > 0 \">" +
  255. " and psn_type in " +
  256. "<foreach collection='psnTypes' item='item' index='index' open='(' close=')' separator=','>" +
  257. "#{item}" +
  258. "</foreach>" +
  259. "</if>" +
  260. "<if test=\"decTypes.size > 0 \">" +
  261. " and b.dec_type in " +
  262. "<foreach collection='decTypes' item='item' index='index' open='(' close=')' separator=','>" +
  263. "#{item}" +
  264. "</foreach>" +
  265. "</if>" +
  266. "<if test=\"clrOptins.size > 0 \">" +
  267. " and clr_optins in " +
  268. "<foreach collection='clrOptins' item='item' index='index' open='(' close=')' separator=','>" +
  269. "#{item}" +
  270. "</foreach>" +
  271. "</if>" +
  272. "<if test=\"flag == 1 \">" +
  273. " and a.setl_list_id is null " +
  274. "</if>" +
  275. "<if test=\"flag == 2 \">" +
  276. " and a.setl_list_id is not null " +
  277. "</if>" +
  278. "<if test=\"auditFlag != 4 \">" +
  279. " and c.audit_flag = #{auditFlag} " +
  280. "</if>" +
  281. "<if test=\"hiPaymtd != null and hiPaymtd != 0 \">" +
  282. " and a.hi_paymtd = #{hiPaymtd} " +
  283. "</if>" +
  284. "<if test=\"referPhysician != null and referPhysician != '' \">" +
  285. " and b.refer_physician = #{referPhysician} " +
  286. "</if>" +
  287. " ) temp where rowNumber > ${pageSize} * (${currentPage} - 1)" +
  288. "</script>")
  289. List<SiSetlinfoTemp> huoQuJieSuanRenYuan(@Param("startTime") String startTime,
  290. @Param("endTime") String endTime,
  291. @Param("setlType") String setlTyle,
  292. @Param("patNo") String patNo,
  293. @Param("insutypes") List<String> insutypes,
  294. @Param("outDepts") List<String> outDepts,
  295. @Param("medTypes") List<String> medTypes,
  296. @Param("psnTypes") List<String> psnTypes,
  297. @Param("clrOptins") List<String> clrOptins,
  298. @Param("decTypes") List<Integer> decTypes,
  299. @Param("flag") Integer flag,
  300. @Param("referPhysician") String referPhysician,
  301. @Param("auditFlag") Integer auditFlag,
  302. @Param("hiPaymtd") Integer hiPaymtd,
  303. @Param("currentPage") long currentPage,
  304. @Param("pageSize") long pageSize);
  305. @Select("<script>" +
  306. "select count(*) " +
  307. "from t_si_setlinfo a left join zy_inactpatient b on (a.pat_no = b.inpatient_no and a.times = b.admiss_times) " +
  308. "left join t_yb_setl_modify_req c on (a.pat_no = c.pat_no and a.times = c.times) " +
  309. "where revoked = 0 " +
  310. "<if test=\"startTime !=null and startTime != '' \">" +
  311. " and setl_time &gt;= #{startTime} and setl_time &lt;= #{endTime} " +
  312. "</if>" +
  313. "<if test=\"setlType !=null and setlType != '' \">" +
  314. " and setl_type = #{setlType} " +
  315. "</if>" +
  316. "<if test=\"patNo !=null and patNo != '' \">" +
  317. " and a.pat_no = #{patNo} " +
  318. "</if>" +
  319. "<if test=\"insutypes.size > 0 \">" +
  320. " and insutype in " +
  321. "<foreach collection='insutypes' item='item' index='index' open='(' close=')' separator=','>" +
  322. "#{item}" +
  323. "</foreach>" +
  324. "</if>" +
  325. "<if test=\"outDepts.size > 0 \">" +
  326. "and isnull(zk_ward,small_dept) in " +
  327. "<foreach collection='outDepts' item='item' index='index' open='(' close=')' separator=','>" +
  328. "#{item} " +
  329. "</foreach>" +
  330. "</if>" +
  331. "<if test=\"medTypes.size > 0 \">" +
  332. " and a.med_type in " +
  333. "<foreach collection='medTypes' item='item' index='index' open='(' close=')' separator=','>" +
  334. "#{item}" +
  335. "</foreach>" +
  336. "</if>" +
  337. "<if test=\"psnTypes.size > 0 \">" +
  338. " and psn_type in " +
  339. "<foreach collection='psnTypes' item='item' index='index' open='(' close=')' separator=','>" +
  340. "#{item}" +
  341. "</foreach>" +
  342. "</if>" +
  343. "<if test=\"decTypes.size > 0 \">" +
  344. " and b.dec_type in " +
  345. "<foreach collection='decTypes' item='item' index='index' open='(' close=')' separator=','>" +
  346. "#{item}" +
  347. "</foreach>" +
  348. "</if>" +
  349. "<if test=\"clrOptins.size > 0 \">" +
  350. " and clr_optins in " +
  351. "<foreach collection='clrOptins' item='item' index='index' open='(' close=')' separator=','>" +
  352. "#{item}" +
  353. "</foreach>" +
  354. "</if>" +
  355. "<if test=\"flag == 1 \">" +
  356. " and a.setl_list_id is null " +
  357. "</if>" +
  358. "<if test=\"flag == 2 \">" +
  359. " and a.setl_list_id is not null " +
  360. "</if>" +
  361. "<if test=\"auditFlag != 4 \">" +
  362. " and c.audit_flag = #{auditFlag} " +
  363. "</if>" +
  364. "<if test=\"referPhysician != null and referPhysician != '' \">" +
  365. " and b.refer_physician = #{referPhysician} " +
  366. "</if>" +
  367. "<if test=\"hiPaymtd != null and hiPaymtd != 0 \">" +
  368. " and a.hi_paymtd = #{hiPaymtd} " +
  369. "</if>" +
  370. "</script>")
  371. long huoQuJieSuanRenYuanTotal(@Param("startTime") String startTime,
  372. @Param("endTime") String endTime,
  373. @Param("setlType") String setlTyle,
  374. @Param("patNo") String patNo,
  375. @Param("insutypes") List<String> insutypes,
  376. @Param("outDepts") List<String> outDepts,
  377. @Param("medTypes") List<String> medTypes,
  378. @Param("psnTypes") List<String> psnTypes,
  379. @Param("clrOptins") List<String> clrOptins,
  380. @Param("decTypes") List<Integer> decTypes,
  381. @Param("flag") Integer flag,
  382. @Param("referPhysician") String referPhysician,
  383. @Param("auditFlag") Integer auditFlag,
  384. @Param("hiPaymtd") Integer hiPaymtd);
  385. @Select("select opName = (select top(1) rtrim(name) from a_employee_mi where code = op_id_code)," +
  386. "rtrim(inpatient_no) inpatient_no, admiss_times, dis_diag_no, dis_diag_type,rtrim(dis_diag) dis_diag," +
  387. "rtrim(dis_diag_comment) dis_diag_comment," +
  388. "op_id_code, op_diag_date, dis_diag_bzfx, dis_diag_status, operation, si_diag_type,admiss_cond " +
  389. "from ${tableName} where inpatient_no = #{patNo} and admiss_times = #{times} " +
  390. "order by dis_diag_no ")
  391. List<YbZyDisDiag> zhenDuanXinXi(@Param("patNo") String patNo,
  392. @Param("times") Integer times,
  393. @Param("tableName") String tableName);
  394. @Select("select ssys_name = (select top(1) rtrim(name) from a_employee_mi where code = ssys), " +
  395. " sszsName1 = (select top(1) rtrim(name) from a_employee_mi where code = sszs1), " +
  396. " sszsName2 = (select top(1) rtrim(name) from a_employee_mi where code = sszs2), " +
  397. " mzys_name = (select top(1) rtrim(name) from a_employee_mi where code = mzys)," +
  398. " bah, zyh, zycs, ssxh, ssrq, sstj, " +
  399. " ssys , sszs1, sszs2, mzys ," +
  400. " ssbm, ssmc, rtrim(mzff) mzff, rtrim(qkjb) qkjb," +
  401. "rtrim(yhqk) yhqk, ssbfz, fhqk, ssjb, cut_heal," +
  402. "(select top(1) yb_code from a_employee_mi where code = ssys) as oper_dr_code, " +
  403. "(select top(1) yb_code from a_employee_mi where code = mzys) as anst_dr_code " +
  404. "from ${tableName} where zyh = #{patNo} and zycs = #{times} " +
  405. "order by ssxh")
  406. List<BatjBa4> shouShuXinXi(@Param("patNo") String patNo,
  407. @Param("times") Integer times,
  408. @Param("tableName") String tableName);
  409. @Select("select rtrim(inpatient_no) inpatient_no,admiss_times,rtrim(name) name,admiss_date,dis_date,responce_type,operation, " +
  410. " responce_type_name = (select rtrim(name) from zy_zd_responce_type where code = responce_type),sex,rtrim(refer_physician) refer_physician " +
  411. "from zy_inactpatient where inpatient_no = #{patNo} and admiss_times = #{times}")
  412. ZyInactpatient huanZheXinXi(@Param("patNo") String patNo,
  413. @Param("times") Integer times);
  414. @Select("select top(1) * from t_yb_set_modify_time")
  415. TYbSetModifyTime keXiuGaiShiJian();
  416. @Select("<script>" +
  417. "select rtrim(inpatient_no) inpatient_no,admiss_times,dis_diag,dis_diag_comment from ${tableName} where inpatient_no in " +
  418. "<foreach collection='patNos' item='item' index='index' open='(' close=')' separator=','>" +
  419. "#{item}" +
  420. "</foreach>" +
  421. " and dis_diag_no = 1" +
  422. "</script>")
  423. List<ZyDisDiagYb> zhuZhenDuan(@Param("patNos") Set<String> patNos,
  424. @Param("tableName") String tableName);
  425. @Select("<script>" +
  426. "select ward_code,ward_code_name = (select rtrim(name) from zd_unit_code where code = ward_code), " +
  427. " rtrim(inpatient_no) patNo,admiss_times times " +
  428. "from zy_detail_charge where inpatient_no in " +
  429. "<foreach collection='patNos' item='item' index='index' open='(' close=')' separator=','>" +
  430. "#{item}" +
  431. "</foreach>" +
  432. " order by times,charge_date" +
  433. "</script>")
  434. List<SiSetlinfoTemp> zhuanKeKeShi(@Param("patNos") Set<String> patNos);
  435. @Select("select top 10 surgical_operation_code code,operation_operation_name name from " +
  436. "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS Number, * " +
  437. "from t_si_dl_oprtn where (surgical_operation_code like #{content} or operation_operation_name like #{content} or py_code like #{content})) a " +
  438. "where Number > (${page}-1) * 10 ")
  439. List<GetDropdownBox> searchSurgeryByAlpha(@Param("content") String content, @Param("page") long page);
  440. @Select("select count(1) from t_si_dl_oprtn where (surgical_operation_code like #{content} or operation_operation_name" +
  441. " like #{content} or py_code like #{content})")
  442. long searchSurgeryTotal(@Param("content") String content);
  443. @Delete("delete zy_dis_diag_yb_modify where inpatient_no = #{patNo} and admiss_times = #{times}; " +
  444. "delete batj_ba4_modify where zyh = #{patNo} and zycs = #{times}; " +
  445. "delete t_yb_setl_modify_req where pat_no = #{patNo} and times = #{times};")
  446. void delReq(@Param("patNo") String patNo, @Param("times") Integer times);
  447. @Insert("insert into t_yb_setl_modify_req (pat_no, times, req_op_id, req_op_name, req_remark) " +
  448. "values (#{patNo},#{times},#{opIdCode},#{opIdName},#{reqRemark})")
  449. void setlModifyReq(@Param("patNo") String patNo,
  450. @Param("times") Integer times,
  451. @Param("opIdCode") String opIdCode,
  452. @Param("opIdName") String opIdName,
  453. @Param("reqRemark") String reqRemark);
  454. @Insert("<script>" +
  455. "insert into ${tableName} (inpatient_no, admiss_times, dis_diag_no, dis_diag_type, dis_diag, dis_diag_comment, " +
  456. "op_id_code, op_diag_date, dis_diag_bzfx, dis_diag_status, operation, si_diag_type,admiss_cond) " +
  457. "values " +
  458. "<foreach collection='list' item='param' separator=','>" +
  459. "(#{param.inpatientNo},#{param.admissTimes},#{param.disDiagNo},'13',#{param.disDiag},#{param.disDiagComment}, " +
  460. " #{param.opIdCode},#{param.opDiagDate},'001',#{param.disDiagStatus},null,#{param.siDiagType},#{param.admissCond})" +
  461. "</foreach>" +
  462. "</script>")
  463. void setlModDis(@Param("list") List<YbZyDisDiag> param,
  464. @Param("tableName") String tableName);
  465. @Insert("<script>" +
  466. "insert into ${tableName} (bah, zyh, zycs, ssxh, ssrq, sstj, ssys, sszs1, sszs2, " +
  467. "mzys, ssbm, ssmc, mzff, qkjb, yhqk, ssbfz, fhqk, ssjb, cut_heal) " +
  468. "values " +
  469. "<foreach collection='list' item='param' separator=','>" +
  470. "(#{param.zyh},#{param.zyh},#{param.zycs},#{param.ssxh},#{param.ssrq},null,#{param.ssys},#{param.sszs1}," +
  471. "#{param.sszs2},#{param.mzys},#{param.ssbm},#{param.ssmc},#{param.mzff},#{param.qkjb},#{param.yhqk},null,null,#{param.ssjb},null)" +
  472. "</foreach>" +
  473. "</script>")
  474. void setlModBat(@Param("list") List<BatjBa4> batjBa4s,
  475. @Param("tableName") String tableName);
  476. @Select("update zy_inactpatient set operation = #{operation} /*治疗方式*/ , dec_type = #{decType} /*申报类型*/ " +
  477. "where inpatient_no = #{patNo} and admiss_times = #{times}")
  478. void shenBao(@Param("operation") String operation,
  479. @Param("decType") Integer decType,
  480. @Param("patNo") String patNo,
  481. @Param("times") Integer times);
  482. @Select("select pat_name = (select top 1 rtrim(name) from zy_inactpatient where inpatient_no = pat_no),* from t_yb_setl_modify_req where id = #{id}")
  483. TYbSetlModifyReq shenHeXinXi(Integer id);
  484. @Select("select rtrim(code_rs) from a_employee_mi where code = #{code}")
  485. String yuanGongGongHao(String code);
  486. @Update("update t_yb_setl_modify_req set audit_flag = #{auditFlag} where id = #{id}")
  487. void upAuditFlag(@Param("id") Integer id,
  488. @Param("auditFlag") Integer auditFlag);
  489. @Delete("delete zy_dis_diag_yb where inpatient_no = #{patNo} and admiss_times = #{times};" +
  490. "delete batj_ba4 where zyh = #{patNo} and zycs = #{times}")
  491. void delYuanShuJu(@Param("patNo") String patNo,
  492. @Param("times") Integer times);
  493. @Insert("insert into zy_dis_diag_yb (inpatient_no, admiss_times, dis_diag_no, dis_diag_type, dis_diag, " +
  494. " dis_diag_comment, op_id_code, op_diag_date, dis_diag_bzfx, dis_diag_status, " +
  495. " operation, si_diag_type) " +
  496. "select inpatient_no, admiss_times, dis_diag_no, dis_diag_type, dis_diag, " +
  497. " dis_diag_comment, op_id_code, op_diag_date, dis_diag_bzfx, dis_diag_status, " +
  498. " operation, si_diag_type from zy_dis_diag_yb_modify " +
  499. "where inpatient_no = #{patNo} and admiss_times = #{times}; " +
  500. "insert into batj_ba4 (bah, zyh, zycs, ssxh, ssrq, sstj, ssys, sszs1, sszs2, mzys, ssbm, ssmc, mzff, qkjb, " +
  501. " yhqk, ssbfz, fhqk, ssjb, cut_heal) " +
  502. "select bah, zyh, zycs, ssxh, ssrq, sstj, ssys, sszs1, sszs2, mzys, ssbm, ssmc, mzff, qkjb, yhqk, ssbfz, fhqk, ssjb, cut_heal " +
  503. "from batj_ba4_modify where zyh = #{patNo} and zycs = #{times};")
  504. void auditTongGuo(@Param("patNo") String patNo,
  505. @Param("times") Integer times);
  506. @Update("update t_yb_setl_modify_req set audit_staff = #{auditStaff},audit_remark = #{remark},audit_name = #{auditName}," +
  507. "audit_date = getdate() " +
  508. "where id = #{id}")
  509. void updateReq(@Param("id") Integer id,
  510. @Param("remark") String remark,
  511. @Param("auditStaff") String auditStaff,
  512. @Param("auditName") String auditName);
  513. @Select("select top 1 *,op_id_name = (select top 1 rtrim(name) from a_employee_mi where op_id = code) from t_yb_set_modify_time")
  514. TYbSetModifyTime xianZhiShiJian();
  515. @Select("update t_yb_set_modify_time set start_time = #{startTime} ,end_time = #{endTime}, op_id = #{opId} ,op_date = getdate()")
  516. void sheZhiShiJian(@Param("startTime") String startTime,
  517. @Param("endTime") String endTime,
  518. @Param("opId") String opId);
  519. @Select("select ward_code as execUnit,execUnitName = (select rtrim(name) from zd_unit_code where code = ward_code), " +
  520. " sum(charge_amount) chargeAmount,sum(charge_fee) chargeFee " +
  521. "from zy_detail_charge where inpatient_no = #{patNo} and admiss_times = #{times} " +
  522. "group by ward_code order by chargeFee desc")
  523. List<Map<String, String>> getHuanZheFeiYong(@Param("patNo") String patNo,
  524. @Param("times") Integer times);
  525. @Update("update zy_inactpatient set refer_physician = #{code} where inpatient_no = #{patNo} and admiss_times = #{times}")
  526. void xiuGaiGuanChaungYiShen(@Param("patNo") String patNo,
  527. @Param("times") Integer times,
  528. @Param("code") String code);
  529. @Select("select rtrim(inpatient_no) inpatient_no,admiss_times,rtrim(dis_diag) dis_diag,case admiss_status when '' then null else admiss_status end admiss_cond " +
  530. "from ba_first_page1 " +
  531. "where isnull(dis_diag,'') <> '' and inpatient_no = #{patNo} and admiss_times = #{times} ")
  532. List<YbZyDisDiag> huanZheBingAnShouYeZhenDuanRuYuanBingQing(String patNo, Integer times);
  533. @Update("<script>" +
  534. "<foreach collection='list' item='item' separator=';'>" +
  535. "update zy_dis_diag_yb set admiss_cond = #{item.admissCond} where inpatient_no = #{item.inpatientNo} and admiss_times = #{item.admissTimes} and dis_diag_no = #{item.disDiagNo}" +
  536. "</foreach>" +
  537. "</script>")
  538. void genXingLaoZhenDuan(@Param("list") List<YbZyDisDiag> ybZyDisDiagList);
  539. @Select("select rtrim(name) from zd_country_code where code = #{ntly}")
  540. String getNtlyName(String ntly);
  541. @Select("select rtrim(name) from zd_nation_code where code = #{naty}")
  542. String getNatyName(String naty);
  543. @Select("select rtrim(name) from t_zd_psn_cert_type where code = #{cert}")
  544. String getPatnCertTypeName(String cert);
  545. @Select("select rtrim(name) name from zy_occupation_code where code = #{prfs}")
  546. String getPrfsName(String prfs);
  547. @Select("select rtrim(name) name from zy_zd_relative_code where code = #{code}")
  548. String getPatnRltsName(String code);
  549. @Select("select rtrim(name) from t_si_admdvs where code = #{code} ")
  550. String getInsuplcName(String code);
  551. @Select("select rtrim(name) from t_yb_dept where code = #{code}")
  552. String getYbDeptName(String code);
  553. @Select("select (select yb_code from a_employee_mi where code = job_nurse) as code, " +
  554. "name = (select rtrim(name) from a_employee_mi where code = job_nurse ) from batj_ba2 a,a_employee_mi b " +
  555. "where job_nurse = b.code and zyh = #{patNo} and zycs = #{times} ")
  556. GetDropdownBox zeRenHuShi(@Param("patNo") String patNo,
  557. @Param("times") Integer times);
  558. @Select("select pat_no,times,ledger_sn from t_si_setlinfo where hi_paymtd is null")
  559. List<Map<String, Object>> huoQuQuanBuJieSuanRenYuan();
  560. }