修改专家详情 消息推送
This commit is contained in:
parent
57d46577cf
commit
70e89a8b53
@ -67,9 +67,10 @@ class DoctorInquiryConfig extends Model
|
||||
* 在线问诊+专家问诊
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @param array $inquiry_type_in_params
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getInquiryConfigList(array $params, array $fields = ['*'] ,$inquiry_type_in_params = [1,3]): object|null
|
||||
public static function getInquiryConfigList(array $params, array $fields = ['*'] , array $inquiry_type_in_params = [1,3]): object|null
|
||||
{
|
||||
return self::where($params)->whereIn("inquiry_type",$inquiry_type_in_params)->get($fields);
|
||||
}
|
||||
|
||||
@ -65,6 +65,7 @@ class MessagePush extends BaseService
|
||||
/**
|
||||
* 快速/购药的服务5分钟未接诊
|
||||
* 公益/专家24小时未接诊
|
||||
* 站内、订阅
|
||||
* @return bool
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
@ -150,6 +151,7 @@ class MessagePush extends BaseService
|
||||
|
||||
/**
|
||||
* 患者回复通知
|
||||
* 订阅
|
||||
* @param string $content 回复内容
|
||||
* @return bool
|
||||
* @throws ContainerExceptionInterface
|
||||
@ -188,6 +190,7 @@ class MessagePush extends BaseService
|
||||
|
||||
/**
|
||||
* 医生已接诊
|
||||
* 站内、订阅、短信
|
||||
* @return bool
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
@ -301,6 +304,7 @@ class MessagePush extends BaseService
|
||||
|
||||
/**
|
||||
* 服务结束
|
||||
* 站内、订阅
|
||||
* @return bool
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
@ -378,6 +382,7 @@ class MessagePush extends BaseService
|
||||
|
||||
/**
|
||||
* 处方审核通过
|
||||
* 站内、短信
|
||||
* @return bool
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
@ -454,6 +459,7 @@ class MessagePush extends BaseService
|
||||
|
||||
/**
|
||||
* 优惠劵发放
|
||||
* 站内
|
||||
* @return bool
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
@ -471,7 +477,6 @@ class MessagePush extends BaseService
|
||||
|
||||
if ($this->push_type == 1) {
|
||||
// 站内
|
||||
// 服务消息
|
||||
// 获取问诊订单处方数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||
@ -502,4 +507,231 @@ class MessagePush extends BaseService
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 优惠劵退还
|
||||
* 站内
|
||||
* @return bool
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function refundCoupon(): bool
|
||||
{
|
||||
try {
|
||||
// 获取医生数据
|
||||
$params = array();
|
||||
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
|
||||
$user_doctor = UserDoctor::getOne($params);
|
||||
if (empty($user_doctor)){
|
||||
throw new BusinessException("加入推送队列失败:医生数据为空");
|
||||
}
|
||||
|
||||
if ($this->push_type == 1) {
|
||||
// 站内
|
||||
// 获取问诊订单处方数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||
$order_prescription = OrderPrescription::getOne($params);
|
||||
if (empty($order_prescription)) {
|
||||
throw new BusinessException("加入推送队列失败:处方数据为空");
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
$data['notice_type'] = 3;
|
||||
$data['notice_system_type'] = 2; // 系统消息类型(患者端系统消息存在 1:服务消息 2:福利消息 3:退款消息 4:物流消息)
|
||||
$data['from_name'] = "肝胆小秘书";
|
||||
$data['notice_title'] = "【优惠劵名称】已退还";
|
||||
$data['notice_content'] = "您有优惠劵已退还至您的账户,请点击查看详情!";
|
||||
$data['link_type'] = 7;
|
||||
|
||||
$message = new SendStationMessageProducer($data);
|
||||
$producer = ApplicationContext::getContainer()->get(Producer::class);
|
||||
$result = $producer->produce($message);
|
||||
if (!$result) {
|
||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 优惠劵过期
|
||||
* 站内
|
||||
* @return bool
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function expireCoupon(): bool
|
||||
{
|
||||
try {
|
||||
// 获取医生数据
|
||||
$params = array();
|
||||
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
|
||||
$user_doctor = UserDoctor::getOne($params);
|
||||
if (empty($user_doctor)){
|
||||
throw new BusinessException("加入推送队列失败:医生数据为空");
|
||||
}
|
||||
|
||||
if ($this->push_type == 1) {
|
||||
// 站内
|
||||
// 获取问诊订单处方数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||
$order_prescription = OrderPrescription::getOne($params);
|
||||
if (empty($order_prescription)) {
|
||||
throw new BusinessException("加入推送队列失败:处方数据为空");
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
$data['notice_type'] = 3;
|
||||
$data['notice_system_type'] = 2; // 系统消息类型(患者端系统消息存在 1:服务消息 2:福利消息 3:退款消息 4:物流消息)
|
||||
$data['from_name'] = "肝胆小秘书";
|
||||
$data['notice_title'] = "【优惠劵名称】即将过期";
|
||||
$data['notice_content'] = "您有一张优惠劵即将过期,点击查看详情!";
|
||||
$data['link_type'] = 7;
|
||||
|
||||
$message = new SendStationMessageProducer($data);
|
||||
$producer = ApplicationContext::getContainer()->get(Producer::class);
|
||||
$result = $producer->produce($message);
|
||||
if (!$result) {
|
||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 问诊服务退款成功
|
||||
* 站内、订阅、短信
|
||||
* @param int $type 类型 1:已支付未接诊 2:已支付未成功分配医生 3:已支付未接诊患者取消订单
|
||||
* @return bool
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function refundInquirySuccess(int $type): bool
|
||||
{
|
||||
try {
|
||||
// 获取医生数据
|
||||
$params = array();
|
||||
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
|
||||
$user_doctor = UserDoctor::getOne($params);
|
||||
if (empty($user_doctor)){
|
||||
throw new BusinessException("加入推送队列失败:医生数据为空");
|
||||
}
|
||||
|
||||
if ($this->push_type == 1) {
|
||||
// 站内
|
||||
$inquiry_type_string = inquiryTypeToString($this->order_inquiry['inquiry_type']);
|
||||
|
||||
$data = array();
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
$data['notice_type'] = 3;
|
||||
$data['notice_system_type'] = 3;
|
||||
$data['from_name'] = "肝胆小秘书";
|
||||
if ($type == 1){
|
||||
// 已支付未接诊
|
||||
$data['notice_title'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功";
|
||||
$data['notice_content'] = "因医生繁忙未及时接诊,平台会在24小时内给您退款至原账户中,带来的不便敬请谅解。";
|
||||
}elseif ($type == 2){
|
||||
// 已支付未成功分配医生
|
||||
$data['notice_title'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功";
|
||||
$data['notice_content'] = "当前服务排队人较多,暂无空闲医生为您接诊,平台会在24小时内给您退款至原账户中,带来的不便敬请谅解。";
|
||||
}elseif ($type == 2){
|
||||
// 已支付未接诊患者取消订单
|
||||
$data['notice_title'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功";
|
||||
$data['notice_content'] = "您已取消成功当前服务,平台会在24小时内给您退还至原账户中,带来的不便敬请谅解。";
|
||||
}else{
|
||||
throw new BusinessException("加入推送队列失败:类型错误");
|
||||
}
|
||||
|
||||
$data['link_type'] = 10;// 问诊订单详情
|
||||
|
||||
$link_params = array();
|
||||
$link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||
$data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数
|
||||
|
||||
$message = new SendStationMessageProducer($data);
|
||||
$producer = ApplicationContext::getContainer()->get(Producer::class);
|
||||
$result = $producer->produce($message);
|
||||
if (!$result) {
|
||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
} elseif ($this->push_type == 2) {
|
||||
// 订阅
|
||||
$sub_data = array();
|
||||
$sub_data['push_user_id'] = $this->user['user_id'];
|
||||
$sub_data['template_title'] = "问诊异常通知";
|
||||
$sub_data['params']['page'] = "pages/orderDetail/orderDetail?order_inquiry_id={$this->order_inquiry['order_inquiry_id']}";
|
||||
$sub_data['params']['data'] = [
|
||||
"character_string1" => $this->order_inquiry['inquiry_no'],// 订单ID
|
||||
"name2" => (string)$user_doctor['user_name'],// 问诊医生
|
||||
"date3" => $this->order_inquiry['created_at'],// 问诊时间
|
||||
"thing4" => "医生未接诊退款",// 取消原因
|
||||
"thing5" => "点击详情查看",// 提示说明
|
||||
];
|
||||
|
||||
$data = array();
|
||||
$data['sub_data'] = $sub_data;
|
||||
$data['sms_data'] = array();
|
||||
|
||||
$message = new SendSubMessageProducer($data);
|
||||
$producer = ApplicationContext::getContainer()->get(Producer::class);
|
||||
$result = $producer->produce($message);
|
||||
if (!$result) {
|
||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
} elseif ($this->push_type == 3) {
|
||||
// 短信
|
||||
// 获取系统接诊配置
|
||||
$params = array();
|
||||
$params['inquiry_type'] = $this->order_inquiry['inquiry_type'];
|
||||
$params['inquiry_mode'] = $this->order_inquiry['inquiry_mode'];
|
||||
$system_inquiry_config = SystemInquiryConfig::getOne($params);
|
||||
if (empty($system_inquiry_config)) {
|
||||
throw new BusinessException("加入推送队列失败:获取系统接诊配置失败");
|
||||
}
|
||||
|
||||
$duration = $system_inquiry_config['duration'];
|
||||
if ($duration <= 0){
|
||||
$duration = "不限制";
|
||||
}else{
|
||||
$duration = $duration . "分钟";
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['template_code'] = "SMS_271955088";
|
||||
$data['scene_desc'] = "医生已接诊";
|
||||
$data['phone'] = $this->user['mobile'];
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
|
||||
$template_param = array();
|
||||
$template_param['type'] = inquiryTypeToString($this->order_inquiry['inquiry_type']);
|
||||
$template_param['name'] = $user_doctor['user_name'];
|
||||
$template_param['duration'] = $duration; // 服务时长
|
||||
$data['template_param'] = $template_param;
|
||||
|
||||
|
||||
$message = new SendSmsMessageProducer($data);
|
||||
$producer = ApplicationContext::getContainer()->get(Producer::class);
|
||||
$result = $producer->produce($message);
|
||||
if (!$result) {
|
||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -246,7 +246,7 @@ class PatientDoctorService extends BaseService
|
||||
$inquiry_type_in_params[] = 1;
|
||||
}
|
||||
if ($user_doctor['is_img_welfare_reception'] == 1){
|
||||
$inquiry_type_in_params[] = 2;
|
||||
$inquiry_type_in_params[] = 3;
|
||||
}
|
||||
|
||||
$doctor_inquiry_config = DoctorInquiryConfigModel::getInquiryConfigList($params,['*'],$inquiry_type_in_params);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user