OrderQuashDao.java 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. package thyyxxk.webserver.dao.his.zhuyuanyisheng;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4. import org.apache.ibatis.annotations.*;
  5. import thyyxxk.webserver.entity.zhuyuanyisheng.orderquash.ReqOrderQuash;
  6. import thyyxxk.webserver.entity.zhuyuanyisheng.orderquash.ReturnReqOrderQuash;
  7. import java.math.BigDecimal;
  8. import java.util.Date;
  9. import java.util.List;
  10. @Mapper
  11. public interface OrderQuashDao extends BaseMapper<ReqOrderQuash> {
  12. @Select("select start_time from yz_act_order where act_order_no = #{orderNo}")
  13. Date selectOrderStartTime(BigDecimal orderNo);
  14. @Select("select count(1) from yz_yp_zy_order where act_order_no = #{orderNo} and status_flag = '1' ")
  15. int selectYpOrder(BigDecimal orderNo);
  16. @Select("select count(1) from yz_zy_patient_fee where act_order_no = #{orderNo}")
  17. int selectZyPatientFee(BigDecimal orderNo);
  18. @Select("select count(1) from zy_detail_charge where order_no = #{orderNo} " +
  19. "and inpatient_no = #{patNo} and admiss_times = #{times} and trans_flag_yb <> '2' ")
  20. int selectZyDetailCharge(BigDecimal orderNo,
  21. String patNo,
  22. Integer times);
  23. @Select("select rtrim(pat_no) as pat_no, " +
  24. " (select rtrim(name) " +
  25. " from view_zy_patient_all pat " +
  26. " where pat.inpatient_no = pat_no " +
  27. " and pat.admiss_times = times) as name, " +
  28. " times, " +
  29. " count(1) as count,state," +
  30. " ward_name = (select rtrim(name) from zd_unit_code where ward = code) " +
  31. "from req_order_quash,zy_actpatient b " +
  32. " ${ew.customSqlSegment} and pat_no = inpatient_no " +
  33. " and times = admiss_times " +
  34. "group by pat_no, times,state,ward ")
  35. List<ReturnReqOrderQuash> selectReqListGroupBy(@Param("ew") QueryWrapper<ReturnReqOrderQuash> queryWrapper);
  36. @Select("select a.act_order_no, " +
  37. " req_datetime, " +
  38. " req_id, " +
  39. " req_remark, " +
  40. " approver_id," +
  41. " approver_name = (select rtrim(name) from a_employee_mi where code = approver_id), " +
  42. " approver_datatime, " +
  43. " approver_remark, " +
  44. " state, " +
  45. " pat_no, " +
  46. " times, " +
  47. " b.order_name, " +
  48. " b.frequ_code, " +
  49. " enter_oper_name = (select rtrim(name) from a_employee_mi where code = enter_oper)," +
  50. " order_time, " +
  51. " start_time, " +
  52. " end_time," +
  53. " a.act_order_no " +
  54. "from req_order_quash a " +
  55. " left join view_xc_act_and_erase_order b on (a.act_order_no = b.act_order_no) " +
  56. "where pat_no = #{patNo} " +
  57. " and times = #{times} " +
  58. " and state = #{state} ")
  59. List<ReturnReqOrderQuash> selectReqListByPat(String patNo, String times, int state);
  60. @Update("update req_order_quash " +
  61. "set state = #{req.state}, " +
  62. " approver_id = #{req.approverId}, " +
  63. " approver_datatime = #{req.approverDatatime}, " +
  64. " approver_remark = #{req.approverRemark} " +
  65. "where act_order_no = #{req.actOrderNo}")
  66. void updateReqOrderQuash(@Param("req") ReqOrderQuash req);
  67. @Delete("delete yz_zy_patient_fee where act_order_no = #{orderNo} and charge_status ='3' ")
  68. void delPatientFee(@Param("orderNo") BigDecimal orderNo);
  69. @Delete("delete yz_yp_zy_order where act_order_no =#{orderNo} and status_flag ='1' ")
  70. void delYpZyOrder(@Param("orderNo") BigDecimal orderNo);
  71. @Insert("insert into yz_erase_order select * from yz_act_order a where a.act_order_no = #{orderNo} ")
  72. void eraseOrder(@Param("orderNo") BigDecimal orderNo);
  73. @Update("update yz_erase_order set modifier = enter_oper , " +
  74. "status_time = getdate()," +
  75. " print_order_change =case when isnull ( print_order_change , '' ) ='' then 'd' else '' end where act_order_no =#{orderNo} ")
  76. void upErase(@Param("orderNo") BigDecimal orderNo);
  77. @Delete("delete yz_act_order where act_order_no = #{orderNo}")
  78. void delYzOrder(@Param("orderNo") BigDecimal orderNo);
  79. @Update("update yz_act_order set end_time = getdate() " +
  80. "where act_order_no = #{orderNo} and end_time is null" +
  81. " and frequ_code <> 'ONCE' ")
  82. void stopOrder(@Param("orderNo") BigDecimal orderNo);
  83. }