MenZhengXiangMuDao.java 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. package thyyxxk.webserver.dao.his.zhuyuanyiji;
  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.MzChargeDetail;
  7. import java.util.List;
  8. /**
  9. * <p>
  10. * 描述: 门诊项目确认或取消
  11. * </p>
  12. *
  13. * @author xc
  14. * @date 2021-10-09 15:16
  15. */
  16. @Mapper
  17. public interface MenZhengXiangMuDao {
  18. @Select("select rtrim(patient_id) patient_id,rtrim(name) name from mz_charge_detail " +
  19. "where charge_date >= #{startTime} and charge_date <= #{endTime} " +
  20. "and exec_dept = #{execDept} and group_no = '00' and confirm_flag = 0 " +
  21. "and charge_item_code <> 'BILL99' " +
  22. "group by patient_id ,name")
  23. List<MzChargeDetail> kuaiSuChaZhao(@Param("startTime") String startTime,
  24. @Param("endTime") String endTime,
  25. @Param("execDept") String execDept);
  26. @Select("SELECT mz_patient_mi.name, " +
  27. " mz_patient_mi.sex, " +
  28. " rtrim(mz_patient_mi.patient_id) patient_id, " +
  29. " ic_card_no = cast(mz_patient_mi.ic_card_no as varchar(50)), " +
  30. " mz_patient_mi.birth_day, " +
  31. " mz_patient_mi.phone_no, " +
  32. " mz_patient_mi.adress , " +
  33. " age=space(20), " +
  34. " account_balance=0.00, " +
  35. " account_status =space(2), " +
  36. " times, " +
  37. " response_type, " +
  38. " yb_flag=space(1), " +
  39. " by_flag=space(1), " +
  40. " contract_code=contract_code, " +
  41. " charge_type " +
  42. "FROM mz_patient_mi " +
  43. "where patient_id=#{patientId} or ic_card_no = #{patientId}")
  44. MzChargeDetail getMzPatient(String patientId);
  45. @Select("<script>" +
  46. "select charge_date,real_no,rtrim(patient_id) patient_id,times " +
  47. "from mz_charge_detail where charge_date &gt;= #{startTime} and charge_date &lt;= #{endTime} and " +
  48. "patient_id = #{patientId} and pay_mark = '0' " +
  49. "<if test=\"confirmFlag == 0 \">" +
  50. "and (confirm_flag = 0 or confirm_flag = 3) " +
  51. "</if>" +
  52. "<if test=\"confirmFlag != 0 \">" +
  53. "and confirm_flag = 1" +
  54. "</if>" +
  55. "and group_no = '00' and charge_item_code &lt;&gt; 'BILL99' " +
  56. "group by charge_date,real_no,patient_id,times " +
  57. "</script>")
  58. List<MzChargeDetail> huoQuMenZhenQueRenShuJu(@Param("patientId") String patientId,
  59. @Param("startTime") String startTime,
  60. @Param("endTime") String endTime,
  61. @Param("confirmFlag") Integer confirmFlag);
  62. // 父节点 根据 patient_id times receipt_no order_no charge_item_code
  63. // 子节点 根据 patient_id times receipt_no order_no tc_no
  64. @Select("<script>" +
  65. "select confirm_flag,rtrim(patient_id) patient_id ,times,item_no,receipt_no,order_no,req_no, " +
  66. " rtrim(charge_item_code) charge_item_code,rtrim(isnull(tc_no,'')) tc_no,rtrim(tc_name) tc_name," +
  67. " rtrim(bill_item_code) bill_item_code,exec_dept," +
  68. " charge_name = (select rtrim(name) from zd_charge_item where charge_item_code = code)," +
  69. " quantity,drug_win,unit_price, " +
  70. " exec_dept_name= (select rtrim(name) from zd_unit_code where code = exec_dept), " +
  71. " confirm_id,confirm_id_name = (select rtrim(name) from a_employee_mi where code = confirm_id), " +
  72. " confirm_time " +
  73. " from mz_charge_detail " +
  74. "where real_no = #{realNo} and patient_id = #{patientNo} and times = #{times} " +
  75. "and pay_mark = '0' and group_no = '00' and charge_item_code &lt;&gt; 'BILL99' " +
  76. "<if test=\"xiangMuZhuangTai != null and xiangMuZhuangTai == 0 \">" +
  77. "and (confirm_flag = 0 or confirm_flag = 3) " +
  78. "</if>" +
  79. "<if test=\"xiangMuZhuangTai !=null and xiangMuZhuangTai == 1 \">" +
  80. "and confirm_flag = 1" +
  81. "</if>" +
  82. "</script>")
  83. List<MzChargeDetail> feiYongXinXi(@Param("realNo") Integer realNo,
  84. @Param("patientNo") String patientNo,
  85. @Param("times") Integer times,
  86. @Param("xiangMuZhuangTai") Integer xiangMuZhuangTai);
  87. /**
  88. * @param patientId 门诊号
  89. * @param times 次数
  90. * @param reqNo 申请号
  91. * @return 缴费的详细信息
  92. */
  93. @Select("select (unit_price * quantity * drug_win) charge_fee,quantity charge_amount, " +
  94. "(select rtrim(name) from zd_charge_item where code = charge_item_code) " +
  95. "from mz_charge_detail where " +
  96. "req_no = #{reqNo} and unit_price <> 0 and patient_id = #{patientId} and times = #{times} " +
  97. "and group_no = 00 and charge_item_code <> 'BILL99' ")
  98. List<MzChargeDetail> getMingXi(@Param("patientId") String patientId,
  99. @Param("times") Integer times,
  100. @Param("reqNo") Integer reqNo);
  101. @Update("<script>" +
  102. "<foreach collection='list' item='item' separator=';'> " +
  103. "update mz_charge_detail " +
  104. "<set>" +
  105. " confirm_flag = #{item.confirmFlag} , receive_flag = #{item.confirmFlag} " +
  106. "<choose>" +
  107. "<when test=\"item.confirmFlag == 1\">" +
  108. ",confirm_time =getdate() , exec_dept =#{execDept},confirm_id =#{confirmId}" +
  109. "</when>" +
  110. "<otherwise>" +
  111. ",confirm_time = null,confirm_id = null" + // , exec_dept = null
  112. "</otherwise>" +
  113. "</choose>" +
  114. "</set>" +
  115. "where " +
  116. "patient_id = #{item.patientId} and times =#{item.times} " +
  117. "and item_no = #{item.itemNo} and charge_item_code = #{item.chargeItemCode} " +
  118. "and receipt_no = #{item.receiptNo} and order_no = #{item.orderNo} " +
  119. "and req_no =#{item.reqNo} " +
  120. "</foreach>" +
  121. "</script>")
  122. void xiangMuQueRenHuoQuXiao(@Param("list") List<MzChargeDetail> list,
  123. @Param("confirmId") String confirmId,
  124. @Param("execDept") String execDept);
  125. @Update("<script>" +
  126. "<foreach collection='list' item='item' separator=';'> " +
  127. "update mz_yj_req " +
  128. "<set>" +
  129. " confirm_flag = #{item.confirmFlag} , receive_flag = #{item.confirmFlag} " +
  130. "<choose>" +
  131. "<when test=\"item.confirmFlag == 1\">" +
  132. ",confirm_time =getdate() , exec_dept =#{execDept},confirm_id =#{confirmId}" +
  133. "</when>" +
  134. "<otherwise>" +
  135. ",confirm_time = null ,confirm_id = null" + // , exec_dept = null
  136. "</otherwise>" +
  137. "</choose>" +
  138. "</set>" +
  139. "where " +
  140. "patient_id = #{item.patientId} and times =#{item.times} " +
  141. "and item_no = #{item.itemNo} " +
  142. "and receipt_no = #{item.receiptNo} and order_no = #{item.orderNo} " +
  143. "and req_no =#{item.reqNo} " +
  144. "</foreach>" +
  145. "</script>")
  146. void xiangMuQueRenYjReq(@Param("list") List<MzChargeDetail> list,
  147. @Param("confirmId") String confirmId,
  148. @Param("execDept") String execDept);
  149. }