WxApiDao.java 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. package thyyxxk.wxservice_server.dao;
  2. import org.apache.ibatis.annotations.*;
  3. import thyyxxk.wxservice_server.entity.appointment.DoctorInfo;
  4. import thyyxxk.wxservice_server.entity.scheduled.TradeNo;
  5. import thyyxxk.wxservice_server.entity.wxapi.WxPayOrder;
  6. import java.util.List;
  7. /**
  8. * @author dj
  9. */
  10. @Mapper
  11. public interface WxApiDao {
  12. @Select("select rtrim(name) from mz_patient_mi with(nolock) where patient_id=#{patientId}")
  13. String selectPatientName(@Param("patientId") String patientId);
  14. @Select("select * from t_wechat_pay_order with(nolock) where patient_id=#{patientId} and " +
  15. "mzy_request_id=#{mzyRequestId} ")
  16. WxPayOrder selectSameGhOrder(@Param("patientId") String patientId,
  17. @Param("mzyRequestId") Integer mzyRequestId);
  18. @Select("select * from t_wechat_pay_order with(nolock) where his_ord_num=#{hisOrdNum}")
  19. WxPayOrder selectSameMzPayOrder(@Param("hisOrdNum") String hisOrdNum);
  20. @Insert("insert into t_wechat_pay_order (body,open_id,total_fee,patient_id," +
  21. "patient_name,inpatient_no,admiss_times,app_id,mch_id,prepay_id," +
  22. "time_stamp,trade_no,create_order_sign,pay_sign,spbill_create_ip," +
  23. "create_datetime,pay_status,serial_no,order_type,his_ord_num," +
  24. "mzy_request_id,yj_req_no,his_status,query_state_times) " +
  25. "values (#{body},#{openId},#{totalFee},#{patientId},#{patientName},#{inpatientNo}," +
  26. "#{admissTimes},#{appId},#{mchId},#{prepayId},#{timeStamp},#{tradeNo},#{createOrderSign}," +
  27. "#{paySign},#{spbillCreateIp},#{createDatetime},#{payStatus},#{serialNo},#{orderType}," +
  28. "#{hisOrdNum},#{mzyRequestId},#{yjReqNo},0,0)")
  29. void insertNewOrder(WxPayOrder param);
  30. @Update("update t_wechat_pay_order set pay_status=#{status}, pay_datetime=#{successTime}, " +
  31. "query_state_times=(query_state_times+1),last_query_state=getdate() where trade_no=#{tradeNo}")
  32. void updatePayStatusAndPayTime(@Param("tradeNo") String tradeNo, @Param("status") Integer status,
  33. @Param("successTime") String successTime);
  34. @Update("update t_wechat_pay_order set pay_status=#{status},query_state_times=(query_state_times+1), " +
  35. "last_query_state=getdate() where trade_no=#{tradeNo}")
  36. void updatePayStatusAndQueryTimes(@Param("tradeNo") String tradeNo, @Param("status") Integer status);
  37. @Update("update t_wechat_pay_order set pay_status=#{status} where trade_no=#{tradeNo}")
  38. void updatePayStatusOnly(@Param("tradeNo") String tradeNo, @Param("status") Integer status);
  39. @Update("update t_wechat_pay_order set pay_status=4,refund_op_code='99999',refund_reason=#{rea}, " +
  40. "his_status=0,refund_op_datetime=getdate() where trade_no=#{tradeNo}")
  41. void refundOrder(@Param("tradeNo") String tradeNo, @Param("rea") String rea);
  42. @Update("update t_wechat_pay_order set his_status=1,pay_status=1 where trade_no=#{tradeNo}")
  43. void updateSuccessHisStatus(@Param("tradeNo") String tradeNo);
  44. @Update("update t_wechat_pay_order set open_id=#{openId} where trade_no=#{tradeNo}")
  45. void updatePayOpenId(@Param("tradeNo") String tradeNo,
  46. @Param("openId") String openId);
  47. @Select("select * from t_wechat_pay_order with(nolock) where trade_no=#{tradeNo}")
  48. WxPayOrder selectOrderByTradeNo(@Param("tradeNo") String tradeNo);
  49. @Select("select trade_no, query_state_times from t_wechat_pay_order with(nolock) where his_status=#{status} " +
  50. "and order_type<=3 and pay_status in (99, 0, 5, 6, 100) ")
  51. List<TradeNo> selectTradeNosForScheduleTask(@Param("status") int status);
  52. @Select("select open_id from t_wechat_patient_bind with(nolock) where patient_id=#{cardNo} and del_flag=0")
  53. List<String> selectOpenIdByPatientId(@Param("cardNo") String cardNo);
  54. @Select("select open_id from t_wechat_patient_bind with(nolock) where ic_card_no=#{cardNo} and del_flag=0")
  55. List<String> selectOpenIdByIcCardNo(@Param("cardNo") String cardNo);
  56. @Select("select rtrim(a.code) doctorCode,rtrim(a.name) doctorName,rtrim(b.name) doctorTitle,rtrim(a.dept_code) deptCode, " +
  57. "deptName=(select rtrim(name) from zd_unit_code with(nolock) where code=a.dept_code), " +
  58. "a.specialty,a.introduction,a.portrait " +
  59. "from a_employee_mi a with(nolock), zd_emp_title b with(nolock) " +
  60. "where a.code=#{doctorCode} and a.emp_tit_code=b.code and " +
  61. "a.code not in ('00000', '00026') and isnull(a.del_flag,0)<>1")
  62. DoctorInfo selectDoctorInfo(@Param("doctorCode") String doctorCode);
  63. @Select("select pay_status from t_wechat_pay_order with(nolock) where trade_no=#{tradeNo}")
  64. Integer selectOrderStatus(@Param("tradeNo") String tradeNo);
  65. }