UpIdCollectionDao.java 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. package thyyxxk.webserver.dao.his.medicalinsurance;
  2. import org.apache.ibatis.annotations.Mapper;
  3. import org.apache.ibatis.annotations.Param;
  4. import org.apache.ibatis.annotations.Select;
  5. import thyyxxk.webserver.entity.medicalinsurance.setllistupload.*;
  6. import java.util.List;
  7. /**
  8. * <p>
  9. * 描述: 医保结算单上传
  10. * </p>
  11. *
  12. * @author xc
  13. * @date 2021-11-25 08:42
  14. */
  15. @Mapper
  16. public interface UpIdCollectionDao {
  17. @Select("select rtrim(country) as ntly, " + // 国籍
  18. " rtrim(social_no) as certno, " + // 证件
  19. " rtrim(occupation_code) as prfs, " + // -- 职业 在 Prfs 中有对应的
  20. " rtrim(home_street) as curr_addr ," + // -- 现住址
  21. " rtrim(employer_name) as emp_name, " + //-- 单位名称
  22. " rtrim(employer_street) as emp_addr, " + //-- 单位地址
  23. " rtrim(employer_tel) as emp_tel, " +
  24. " rtrim(employer_zipcode) as poscode, " +
  25. " rtrim(relation_name) as coner_name, " +
  26. " relation_code as patn_rlts, " + // -- 和患者的关系 (未建枚举)
  27. " rtrim(relation_tel) as coner_tel " + // 联系人电话
  28. "from a_patient_mi " +
  29. "where inpatient_no = #{patNo} or mz_no = #{patNo}")
  30. SetlinfoUpld setlinfo1(@Param("patNo") String patNo);
  31. @Select("select a.mdtrt_id, " + // -- 就诊ID
  32. " a.setl_id, " + // -- 结算ID
  33. " a.psn_no as hi_no, " + //-- 医保编号
  34. " medcasno=(a.pat_no+'_'+cast(a.times as varchar)), " + //-- 病案号
  35. " dcla_time=getdate(), " + //-- 申报时间
  36. " a.psn_name, " + //-- 人员姓名
  37. " a.gend, " + // -- 性别
  38. " a.brdy, " + //-- 出生日期
  39. " a.age, " + // -- 年龄
  40. " a.naty, " + // -- 名族
  41. " a.certno, " + // -- 证件号码
  42. " a.psn_cert_type as patnCertType, " + // -- 患者证件类别
  43. " b.insuplc_admdvs as insuplc, " + // -- 参保地
  44. " a.psn_cash_pay as psnSelfpay, " + // -- 个人自付
  45. " a.fulamt_ownpay_amt as psnOwnpay, " + // -- 个人自费c
  46. " a.acct_pay, " + // -- 个人账户支出
  47. " a.psn_cash_pay as psnCashpay, " + // -- 个人现金支付
  48. " hiPaymtd='3', " + // -- 医保支付方式
  49. " a.clr_optins as hsorg, " + // -- 医保机构
  50. " a.insutype as hi_type, " + // -- 枚举 MdcsType
  51. " a.med_type as trt_type " + // -- 治疗类别
  52. "from t_si_setlinfo a, t_si_pat_info b " +
  53. "where a.pat_no=b.pat_no and a.times=b.times " +
  54. "and a.pat_no = #{patNo} and a.times = #{times}")
  55. SetlinfoUpld setlinfo2(@Param("patNo") String patNo,
  56. @Param("times") Integer times);
  57. @Select("select " +
  58. " pwcry_bfadm_coma_dura = isnull(ryq_hmsj_day,0) + '/' + isnull(ryq_hmsj_hour,0) + '/' + isnull(ryq_hmsj_min,0), " + // -- 颅脑损伤患者入院前昏迷时长
  59. " pwcry_afadm_coma_dura = isnull(ryh_hmsj_day,0) + '/' + isnull(ryh_hmsj_hour,0) + '/' + isnull(ryh_hmsj_min,0), " + // -- 颅脑损伤患者入院后昏迷时长
  60. " lyfs as dscg_way, " + // -- 离院方式
  61. " jsjg as acp_medins_name, " + // -- 拟接收机构名称
  62. " acp_optins_code = '', " + // -- 拟接收机构代码 (占时为空)
  63. " zzy_flag as days_rinp_flag_31, " + // -- 出院31天内再住院计划标志
  64. " rtrim(zzy_md) as days_rinp_pup_31, " + // -- 出院31天内再住院目的
  65. " chfpdr_name = (select rtrim(name) from a_employee_mi where code = isnull(zzys,b.consult_physician)), " + // -- 主诊医师姓名
  66. " isnull(zzys,b.consult_physician) as chfpdr_code, " + //-- 主诊医师代码
  67. " b.admiss_date as adm_time, " + //-- 入院时间
  68. " adm_caty = (select si_caty from zd_unit_code where code = b.small_dept), " + // -- 入院科别
  69. " refldept_dept = (select si_caty from zd_unit_code where code = b.zk_ward), " + //--转科科别
  70. " b.dis_date as dscg_time, " + // -- 出院时间
  71. " dscg_caty = (select si_caty from zd_unit_code where code = b.dis_dept) " + // -- 出院科别
  72. "from batj_ba2 a,zy_inactpatient b " +
  73. "where a.bah = b.inpatient_no and a.zycs = b.admiss_times " +
  74. "and a.bah = #{patNo} and a.zycs = #{times}")
  75. SetlinfoUpld setlinfo3(@Param("patNo") String patNo,
  76. @Param("times") Integer times);
  77. // 这里是 住院诊断消息
  78. @Select("select si_diag_type as diag_type, " +
  79. " rtrim(dis_diag) as diag_code, " +
  80. " rtrim(dis_diag_comment) as diag_name, " +
  81. " case when dis_diag_no = 1 then 1 else 0 end as maindiag_flag " +
  82. "from zy_dis_diag_yb " +
  83. "where inpatient_no = #{patNo} and admiss_times = #{times}")
  84. List<DiseinfoUpld> diseinfo(@Param("patNo") String patNo,
  85. @Param("times") Integer times);
  86. // 这里是手术操作信息
  87. @Select("select rtrim(ssjb) as oprn_oprt_type, " +
  88. " rtrim(ssmc) as oprn_oprt_name, " +
  89. " rtrim(ssbm) as oprn_oprt_code, " +
  90. " ssrq as oprn_oprt_date, " +
  91. " rtrim(mzff) as anst_way, " +
  92. " (select top(1) rtrim(name) from a_employee_mi where code = ssys) as oper_dr_name, " +
  93. " rtrim(ssys) as oper_dr_code, " +
  94. " (select top(1) rtrim(name) from a_employee_mi where code = mzys) as anst_dr_name, " +
  95. " rtrim(mzys) as anst_dr_code " +
  96. " from batj_ba4 " +
  97. "where zyh = #{patNo} and zycs = #{times}")
  98. List<OprninfoUpld> oprninfoUplds(@Param("patNo") String patNo,
  99. @Param("times") Integer times);
  100. // 基金支付信息
  101. @Select("select fund_pay_type,fund_payamt from t_si_setldetail " +
  102. "where pat_no = #{patNo} and times = #{times} and ledger_sn = #{ledgerSn} ")
  103. List<PayinfoUpld> payinfoUpld(@Param("patNo") String patNo,
  104. @Param("times") Integer times,
  105. @Param("ledgerSn") Integer ledgerSn);
  106. /* 收费项目信息 */
  107. // 总金额 和 全自费 和 医疗收费项目
  108. @Select("select med_chrgitm_type as med_chrgitm,sum(det_item_fee_sumamt) as amt, " +
  109. " sum(fulamt_ownpay_amt) fulamt_ownpay_amt,claa_sumfee = 0,clab_amt = 0,oth_amt = 0 from t_si_setl_fee_detl " +
  110. "where setl_id = #{setlId} " +
  111. "group by med_chrgitm_type")
  112. List<IteminfoUpld> amtAndOthAmt(@Param("setlId") String setlId);
  113. // -- 01 甲类
  114. @Select("select med_chrgitm_type as med_chrgitm,sum(det_item_fee_sumamt) as claa_sumfee from t_si_setl_fee_detl " +
  115. "where setl_id = #{setlId} and chrgitm_lv = '01' " +
  116. "group by med_chrgitm_type")
  117. List<IteminfoUpld> jiaLeiFeiYong(@Param("setlId") String setlId);
  118. // -- 02 乙类
  119. @Select("select med_chrgitm_type as med_chrgitm,sum(det_item_fee_sumamt) as clab_amt from t_si_setl_fee_detl " +
  120. "where setl_id = #{setlId} and chrgitm_lv = '02' " +
  121. "group by med_chrgitm_type")
  122. List<IteminfoUpld> yiLeiFeiYong(@Param("setlId") String setlId);
  123. }