PublicDao.java 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. package thyyxxk.webserver.dao.his;
  2. import org.apache.ibatis.annotations.Mapper;
  3. import org.apache.ibatis.annotations.Param;
  4. import org.apache.ibatis.annotations.Select;
  5. import org.apache.ibatis.annotations.Update;
  6. import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
  7. import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
  8. import thyyxxk.webserver.entity.login.UserInfo;
  9. import thyyxxk.webserver.entity.yibao.ZyActpatient;
  10. import java.util.List;
  11. /**
  12. * <p>
  13. * 描述: 公共接口
  14. * </p>
  15. *
  16. * @author xc
  17. * @date 2021-09-17 10:54
  18. */
  19. @Mapper
  20. public interface PublicDao {
  21. @Select("select role_id from dj_user_role where user_code = #{code}")
  22. List<Integer> huoQuJueSe(@Param("code") String code);
  23. /**
  24. * 把表锁住
  25. */
  26. @Update("update yz_sequence set act_order_no = act_order_no")
  27. void lockTable();
  28. /**
  29. * 查询医嘱
  30. *
  31. * @return 返回医嘱号
  32. */
  33. @Select("select act_order_no from yz_sequence")
  34. float getActOrderNo();
  35. /**
  36. * 插入新的医嘱
  37. *
  38. * @param actOrderNo 医嘱号
  39. */
  40. @Update("update yz_sequence set act_order_no = #{actOrderNo}")
  41. void updateActOrderNo(float actOrderNo);
  42. /**
  43. * 获取 这个科室 的子科室
  44. *
  45. * @param deptCode 科室编码
  46. * @return 返回自生和子科室
  47. */
  48. @Select("select code from zd_unit_code where (parent_code = #{deptCode} or code = #{deptCode}) and isnull(del_flag,0) = 0")
  49. List<String> getKeShiLieBiao(String deptCode);
  50. @Select("<script>" +
  51. "select code from zd_unit_code where (parent_code in " +
  52. "<foreach collection='deptCodeList' item='item' index='index' open='(' close=')' separator=','>" +
  53. " #{item,jdbcType = CHAR}" +
  54. "</foreach> " +
  55. "or code in " +
  56. "<foreach collection='deptCodeList' item='item' index='index' open='(' close=')' separator=','>" +
  57. "#{item,jdbcType = CHAR}" +
  58. "</foreach>" +
  59. ") and isnull(del_flag,0) = 0" +
  60. "</script>")
  61. List<String> getKeShiLieBiaoList(@Param("deptCodeList") List<String> deptCodeList);
  62. /**
  63. * 获取人员信息
  64. *
  65. * @param code 人员代码
  66. * @return 返回人员
  67. */
  68. @Select("select rtrim(code) code,rtrim(name) name from a_employee_mi where (name like #{code} or code_rs like #{code} or py_code like #{code}) and isnull(del_flag,0) = 0")
  69. List<GetDropdownBox> getRenYuan(String code);
  70. /**
  71. * @param pyCode 拼音编码
  72. * @return 获取项目的名称和code
  73. */
  74. @Select("select distinct code,name from zd_charge_item where (py_code like #{pyCode} or code like #{pyCode} or name like #{pyCode})" +
  75. "union all " +
  76. "select distinct code,name from yp_zd_dict where (py_code like #{pyCode} or code like #{pyCode} or name like #{pyCode})")
  77. List<GetDropdownBox> getChargeCode(String pyCode);
  78. @Select("select rtrim(code) code,rtrim(name) name from zd_unit_code where isnull(del_flag,0) = 0")
  79. List<GetDropdownBox> getDept();
  80. @Select("select isnull(max(ledger_sn),1) from zy_ledger_file where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes}")
  81. Integer getLedgerSn(@Param("inpatientNo") String inpatient,
  82. @Param("admissTimes") Integer admissTimes);
  83. @Select("select rtrim(inpatient_no) inpatient_no,admiss_times,admiss_date,dis_date,name, " +
  84. "responce_name = (select rtrim(name) name from zy_zd_responce_type where code = responce_type), " +
  85. "ward,ward_name = (select rtrim(name) name from zd_unit_code where code = ward), " +
  86. "ledger_sn = (select ledger_sn from zy_ledger_file where a.inpatient_no = zy_ledger_file.inpatient_no and a.admiss_times = zy_ledger_file.admiss_times), " +
  87. "chu_yuan_yi_zhu = (case when (select count(1) from yz_act_order where inpatient_no= a.inpatient_no and admiss_times= a.admiss_times " +
  88. "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in ('06026','06053','05973')) > 0 " +
  89. "then 1 " +
  90. "when (select count(1) from yz_inact_order where inpatient_no= a.inpatient_no and admiss_times= a.admiss_times " +
  91. "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in ('06026','06053','05973')) > 0 " +
  92. "then 1 else 0 end ), " +
  93. "bed_no,total_charge,balance from zy_patient a where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes}")
  94. ZyActpatient getHuanZheJiBenXinXi(@Param("inpatientNo") String inpatientNo,
  95. @Param("admissTimes") Integer admissTimes);
  96. @Select("select max(admiss_times) from zy_patient where inpatient_no = #{inpatientNo} ")
  97. Integer getAdmissTimes(@Param("inpatientNo") String inpatientNo);
  98. @Select("select ori_detail_sn from zy_detail_charge " +
  99. "where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
  100. " and charge_fee < 0 " +
  101. "group by ori_detail_sn having count(1) > 1")
  102. List<Integer> chongFuTuiFei(@Param("inpatientNo") String inpatientNo,
  103. @Param("admissTimes") Integer admissTimes,
  104. @Param("ledgerSn") Integer ledgerSn);
  105. @Select("select inpatient_no,admiss_times,ledger_sn,detail_sn,charge_code_mx,sum(charge_fee) yi_tui_fei from ( " +
  106. " select inpatient_no,admiss_times,ledger_sn,detail_sn,charge_code_mx,charge_fee " +
  107. " from zy_detail_charge where " +
  108. " inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
  109. " and trans_flag_yb <> 2 and order_no <> 6 and " +
  110. " detail_sn in(select ori_detail_sn from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
  111. " and charge_fee <0 and ori_detail_sn is not null) " +
  112. " union all " +
  113. " select inpatient_no,admiss_times,ledger_sn,ori_detail_sn,charge_code_mx,charge_fee " +
  114. " from zy_detail_charge where " +
  115. " inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
  116. " and trans_flag_yb <> 2 and order_no <> 6 and " +
  117. " ori_detail_sn in(select ori_detail_sn from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
  118. "and charge_fee <0 and ori_detail_sn is not null) " +
  119. " ) temp " +
  120. " group by inpatient_no, admiss_times, ledger_sn, detail_sn, charge_code_mx")
  121. List<ZyDetailCharge> tuiFeiYuEr(@Param("inpatientNo") String inpatientNo,
  122. @Param("admissTimes") Integer admissTimes,
  123. @Param("ledgerSn") Integer ledgerSn);
  124. @Update("<script>" +
  125. "<foreach collection='list' item='item' separator=';'>" +
  126. "update zy_detail_charge set ori_detail_sn = null where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
  127. "and (detail_sn = #{item} or ori_detail_sn = #{item}) " +
  128. "</foreach>" +
  129. "</script>")
  130. void chongFuTuiFeiChongZhi(@Param("inpatientNo") String inpatientNo,
  131. @Param("admissTimes") Integer admissTimes,
  132. @Param("ledgerSn") Integer ledgerSn,
  133. @Param("list") List<Integer> oriDetailSn);
  134. @Update("update zy_detail_charge set ori_detail_sn = null where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
  135. "and charge_fee > 0 and charge_amount > 0 and ori_detail_sn = -1 " +
  136. "and detail_sn not in (select ori_detail_sn from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and ori_detail_sn is not null " +
  137. " and charge_amount < 0 and charge_fee < 0)")
  138. void jiuZhengZhenShuLiuShui(@Param("inpatientNo") String inpatientNo,
  139. @Param("admissTimes") Integer admissTimes,
  140. @Param("ledgerSn") Integer ledgerSn);
  141. @Update("update zy_detail_charge set ori_detail_sn = -1 where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and detail_sn in ( " +
  142. " select ori_detail_sn from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and ori_detail_sn is not null and ori_detail_sn <> -1 and charge_fee < 0 and charge_amount < 0 " +
  143. " ) and charge_amount > 0 and charge_fee > 0")
  144. void genXinYuanTuiFeiLiuShui(@Param("inpatientNo") String inpatientNo,
  145. @Param("admissTimes") Integer admissTimes,
  146. @Param("ledgerSn") Integer ledgerSn);
  147. @Select("select top(1) code,dept_code,name,code_rs from a_employee_mi where (code = #{code} or code_rs = #{code}) and isnull(del_flag,0) = 0 ")
  148. UserInfo huoQuYuanGongXinXi(String code);
  149. @Select("SELECT small_dept FROM zd_dept_all where dept = #{deptCode}")
  150. List<String> huoQuBingFanhKeShi(String deptCode);
  151. }