新增消息推送
This commit is contained in:
parent
67c99d2db5
commit
4701bb2bce
@ -11,6 +11,7 @@ use App\Model\OrderInquiry;
|
||||
use App\Model\UserDoctor;
|
||||
use App\Services\ImService;
|
||||
use App\Services\InquiryService;
|
||||
use App\Services\MessagePush;
|
||||
use App\Services\UserDoctorService;
|
||||
use App\Utils\Log;
|
||||
use Extend\TencentIm\Message;
|
||||
@ -192,6 +193,10 @@ class AssignDoctorConsumer extends ConsumerMessage
|
||||
$imService = new ImService();
|
||||
$imService->waitDoctorInquiry($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id']);
|
||||
|
||||
// 发送站内、订阅失败发送短信消息-问诊结束
|
||||
$MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->doctorHaveNewInquiry();
|
||||
|
||||
Log::getInstance()->info("分配医生成功,发送系统问诊消息成功");
|
||||
} catch (\Exception $e) {
|
||||
// 验证失败
|
||||
|
||||
@ -529,7 +529,25 @@ class CallBackController extends AbstractController
|
||||
|
||||
Log::getInstance()->info("药品微信退款回调数据处理成功");
|
||||
|
||||
// 发送短信消息
|
||||
// 发送推送消息
|
||||
try {
|
||||
// 获取患者数据
|
||||
$params = array();
|
||||
$params['patient_id'] = $order_product['patient_id'];
|
||||
$user_patient = UserPatient::getOne($params);
|
||||
if (empty($user_patient)){
|
||||
Log::getInstance()->error("微信退款回调处理成功,推送消息失败:推送用户数据错误");
|
||||
}
|
||||
|
||||
// 发送站内、订阅、短信消息-药品订单退款成功
|
||||
$MessagePush = new MessagePush($user_patient['user_id']);
|
||||
|
||||
$MessagePush->refundProductSuccess($order_product['order_product_id']);
|
||||
}catch (\Exception $e) {
|
||||
// 验证失败
|
||||
Log::getInstance()->error("微信退款回调处理成功,推送消息失败:" . $e->getMessage());
|
||||
return $server->serve();
|
||||
}
|
||||
|
||||
// 告知处方平台
|
||||
return $server->serve();
|
||||
|
||||
@ -260,6 +260,8 @@ class InquiryService extends BaseService
|
||||
UserCoupon::edit($params, $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 增加至取消订单延迟队列
|
||||
$data = array();
|
||||
$data['order_no'] = $order_inquiry['inquiry_no'];
|
||||
@ -294,6 +296,18 @@ class InquiryService extends BaseService
|
||||
return fail(HttpEnumCode::HTTP_ERROR, $e->getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
if (!empty($request_params['doctor_id']) && ($request_params['inquiry_type'] == 1 || $request_params['inquiry_type'] == 3)){
|
||||
if (isset($doctor)){
|
||||
// 发送站内、订阅失败发送短信消息-医生有新问诊
|
||||
$MessagePush = new MessagePush($doctor['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->doctorHaveNewInquiry();
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::getInstance()->error("新问诊消息发送失败:" . $e->getMessage());
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$result['inquiry_no'] = (string)$order_inquiry['inquiry_no']; // 订单编号
|
||||
$result['order_inquiry_id'] = (string)$order_inquiry['order_inquiry_id']; // 订单主键id
|
||||
|
||||
@ -711,79 +711,77 @@ class MessagePush extends BaseService
|
||||
|
||||
$product_name = implode('、',$product_name_array);
|
||||
|
||||
if ($this->push_type == 1) {
|
||||
// 站内
|
||||
$data = array();
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
$data['notice_type'] = 3;
|
||||
$data['notice_system_type'] = 3;
|
||||
$data['from_name'] = "肝胆小秘书";
|
||||
$data['notice_brief_title'] = "您购买的【{$product_name}】药品,平台已退款成功,点击查看详情";
|
||||
$data['notice_title'] = "您购买的【{$product_name}】药品,平台已退款成功";
|
||||
$data['notice_content'] = "因平台特殊情况发生,导致您的药品无法邮寄。平台已进行退款处理,并退款成功,带来的不便敬请谅解。";
|
||||
// 站内
|
||||
$data = array();
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
$data['notice_type'] = 3;
|
||||
$data['notice_system_type'] = 3;
|
||||
$data['from_name'] = "肝胆小秘书";
|
||||
$data['notice_brief_title'] = "您购买的【{$product_name}】药品,平台已退款成功,点击查看详情";
|
||||
$data['notice_title'] = "您购买的【{$product_name}】药品,平台已退款成功";
|
||||
$data['notice_content'] = "因平台特殊情况发生,导致您的药品无法邮寄。平台已进行退款处理,并退款成功,带来的不便敬请谅解。";
|
||||
|
||||
$data['link_type'] = 8;// 药品订单详情页
|
||||
$data['link_type'] = 8;// 药品订单详情页
|
||||
|
||||
$link_params = array();
|
||||
$link_params['order_product_id'] = $order_product_id;
|
||||
$data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数
|
||||
$link_params = array();
|
||||
$link_params['order_product_id'] = $order_product_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['wx_template_id'] = "gQO5vhPQfdnvXtK0XnGns1XqNhQpOrXTjdl-5HWWMUw";//药品订单取消通知
|
||||
$sub_data['params']['page'] = "pages/orderDetail/orderDetail?order_inquiry_id={$this->order_inquiry['order_inquiry_id']}";
|
||||
$sub_data['params']['data'] = [
|
||||
"character_string3" => $order_product['order_product_no'],// 订单号
|
||||
$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));
|
||||
}
|
||||
|
||||
"time5" => $order_product['cancel_time'],// 取消时间
|
||||
// 订阅
|
||||
$sub_data = array();
|
||||
$sub_data['push_user_id'] = $this->user['user_id'];
|
||||
$sub_data['wx_template_id'] = "gQO5vhPQfdnvXtK0XnGns1XqNhQpOrXTjdl-5HWWMUw";//药品订单取消通知
|
||||
$sub_data['params']['page'] = "pages/orderDetail/orderDetail?order_inquiry_id={$this->order_inquiry['order_inquiry_id']}";
|
||||
$sub_data['params']['data'] = [
|
||||
"character_string3" => $order_product['order_product_no'],// 订单号
|
||||
|
||||
"amount4" => $order_product['payment_amount_total'],// 退款金额
|
||||
"time5" => $order_product['cancel_time'],// 取消时间
|
||||
|
||||
"thing1" => productCancelReasonToString($order_product['cancel_reason']),// 取消原因
|
||||
"amount4" => $order_product['payment_amount_total'],// 退款金额
|
||||
|
||||
"thing6" => "点击详情查看",// 温馨提示
|
||||
"thing1" => productCancelReasonToString($order_product['cancel_reason']),// 取消原因
|
||||
|
||||
];
|
||||
"thing6" => "点击详情查看",// 温馨提示
|
||||
|
||||
$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) {
|
||||
// 短信
|
||||
// 获取系统接诊配置
|
||||
$data = array();
|
||||
$data['template_code'] = "SMS_271955204";
|
||||
$data['scene_desc'] = "患者药品费用退款";
|
||||
$data['phone'] = $this->user['mobile'];
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
$data = array();
|
||||
$data['sub_data'] = $sub_data;
|
||||
$data['sms_data'] = array();
|
||||
|
||||
$template_param = array();
|
||||
$template_param['name'] = $product_name;
|
||||
$template_param['status'] = productCancelReasonToString($order_product['cancel_reason']);
|
||||
$data['template_param'] = $template_param;
|
||||
$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));
|
||||
}
|
||||
|
||||
// 短信
|
||||
// 获取系统接诊配置
|
||||
$data = array();
|
||||
$data['template_code'] = "SMS_271955204";
|
||||
$data['scene_desc'] = "患者药品费用退款";
|
||||
$data['phone'] = $this->user['mobile'];
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
|
||||
$template_param = array();
|
||||
$template_param['name'] = $product_name;
|
||||
$template_param['status'] = productCancelReasonToString($order_product['cancel_reason']);
|
||||
$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));
|
||||
}
|
||||
$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());
|
||||
@ -939,73 +937,70 @@ class MessagePush extends BaseService
|
||||
throw new BusinessException("加入推送队列失败:医生数据为空");
|
||||
}
|
||||
|
||||
if ($this->push_type == 1) {
|
||||
// 站内
|
||||
$data = array();
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
$data['notice_type'] = 1;
|
||||
$data['inquiry_type'] = $this->order_inquiry['inquiry_type']; // 问诊类型(医生端服务通知存在 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
$data['from_name'] = "肝胆小秘书";
|
||||
$data['notice_brief_title'] = "您有新的问诊咨询,请注意查看。";
|
||||
$data['notice_title'] = "您有新的问诊咨询,请注意查看。";
|
||||
$data['notice_content'] = "您有新的问诊咨询,请注意查看。";
|
||||
$data['link_type'] = 1; // 聊天详情页
|
||||
// 站内
|
||||
$data = array();
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
$data['notice_type'] = 1;
|
||||
$data['inquiry_type'] = $this->order_inquiry['inquiry_type']; // 问诊类型(医生端服务通知存在 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
$data['from_name'] = "肝胆小秘书";
|
||||
$data['notice_brief_title'] = "您有新的问诊咨询,请注意查看。";
|
||||
$data['notice_title'] = "您有新的问诊咨询,请注意查看。";
|
||||
$data['notice_content'] = "您有新的问诊咨询,请注意查看。";
|
||||
$data['link_type'] = 1; // 聊天详情页
|
||||
|
||||
$link_params = array();
|
||||
$link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||
$link_params['inquiry_type'] = $this->order_inquiry['inquiry_type'];
|
||||
$link_params['doctor_user_id'] = $user_doctor['user_id'];
|
||||
$link_params['patient_user_id'] = $this->order_inquiry['user_id'];
|
||||
$data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数
|
||||
$link_params = array();
|
||||
$link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||
$link_params['inquiry_type'] = $this->order_inquiry['inquiry_type'];
|
||||
$link_params['doctor_user_id'] = $user_doctor['user_id'];
|
||||
$link_params['patient_user_id'] = $this->order_inquiry['user_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) {
|
||||
// 订阅
|
||||
$inquiry_type = inquiryTypeToString($this->order_inquiry['inquiry_type']);
|
||||
$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));
|
||||
}
|
||||
|
||||
$sub_data = array();
|
||||
$sub_data['push_user_id'] = $this->user['user_id'];
|
||||
$sub_data['wx_template_id'] = "G1RIs0RYqsTQ2CuPQWalIMyb6_deuEEbJfajfhGvNzc";//咨询提醒
|
||||
$sub_data['params']['page'] = "Pages/yishi/wenzhen_v2/wenzhen";
|
||||
$sub_data['params']['data'] = [
|
||||
"thing1" => "您有新的患者向您发起了({$inquiry_type})服务,请您尽快上线接诊;",// 提醒内容
|
||||
// 订阅
|
||||
$inquiry_type = inquiryTypeToString($this->order_inquiry['inquiry_type']);
|
||||
|
||||
"name2" => $this->order_inquiry['patient_name'],// 患者姓名
|
||||
$sub_data = array();
|
||||
$sub_data['push_user_id'] = $this->user['user_id'];
|
||||
$sub_data['wx_template_id'] = "G1RIs0RYqsTQ2CuPQWalIMyb6_deuEEbJfajfhGvNzc";//咨询提醒
|
||||
$sub_data['params']['page'] = "Pages/yishi/wenzhen_v2/wenzhen";
|
||||
$sub_data['params']['data'] = [
|
||||
"thing1" => "您有新的患者向您发起了({$inquiry_type})服务,请您尽快上线接诊;",// 提醒内容
|
||||
|
||||
"thing4" => (string)$user_doctor['user_name'],// 病情描述
|
||||
"name2" => $this->order_inquiry['patient_name'],// 患者姓名
|
||||
|
||||
"thing6" => "24小时内未接诊,平台将自动取消问诊。",// 提示说明
|
||||
"thing4" => (string)$user_doctor['user_name'],// 病情描述
|
||||
|
||||
"thing5" => "",// 咨询内容
|
||||
"thing6" => "24小时内未接诊,平台将自动取消问诊。",// 提示说明
|
||||
|
||||
];
|
||||
// 短信
|
||||
$sms_data = array();
|
||||
$sms_data['template_code'] = "SMS_272015117";
|
||||
$sms_data['scene_desc'] = "医生接到新问诊";
|
||||
$sms_data['phone'] = $this->user['mobile'];
|
||||
$sms_data['user_id'] = $this->user['user_id'];
|
||||
"thing5" => "",// 咨询内容
|
||||
|
||||
$template_param = array();
|
||||
$template_param['type'] = inquiryTypeToString($this->order_inquiry['inquiry_type']);
|
||||
$sms_data['template_param'] = $template_param;
|
||||
];
|
||||
// 短信
|
||||
$sms_data = array();
|
||||
$sms_data['template_code'] = "SMS_272015117";
|
||||
$sms_data['scene_desc'] = "医生接到新问诊";
|
||||
$sms_data['phone'] = $this->user['mobile'];
|
||||
$sms_data['user_id'] = $this->user['user_id'];
|
||||
|
||||
$data = array();
|
||||
$data['sub_data'] = $sub_data;
|
||||
$data['sms_data'] = $sms_data;
|
||||
$template_param = array();
|
||||
$template_param['type'] = inquiryTypeToString($this->order_inquiry['inquiry_type']);
|
||||
$sms_data['template_param'] = $template_param;
|
||||
|
||||
$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));
|
||||
}
|
||||
$data = array();
|
||||
$data['sub_data'] = $sub_data;
|
||||
$data['sms_data'] = $sms_data;
|
||||
|
||||
$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));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||
@ -1128,28 +1123,26 @@ class MessagePush extends BaseService
|
||||
throw new BusinessException("加入推送队列失败:问诊病例为空");
|
||||
}
|
||||
|
||||
if ($this->push_type == 1) {
|
||||
// 站内
|
||||
$data = array();
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
$data['notice_type'] = 1;
|
||||
$data['inquiry_type'] = $this->order_inquiry['inquiry_type']; // 问诊类型(医生端服务通知存在 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
$data['from_name'] = "肝胆小秘书";
|
||||
$data['notice_brief_title'] = "{$this->order_inquiry['patient_name']}患者的问诊已结束,请注意查看。";
|
||||
$data['notice_title'] = "{$this->order_inquiry['patient_name']}患者的问诊已结束,请注意查看。";
|
||||
$data['notice_content'] = "{$this->order_inquiry['patient_name']}患者的问诊已结束,请注意查看。";
|
||||
$data['link_type'] = 3; // 问诊消息列表页
|
||||
// 站内
|
||||
$data = array();
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
$data['notice_type'] = 1;
|
||||
$data['inquiry_type'] = $this->order_inquiry['inquiry_type']; // 问诊类型(医生端服务通知存在 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
$data['from_name'] = "肝胆小秘书";
|
||||
$data['notice_brief_title'] = "{$this->order_inquiry['patient_name']}患者的问诊已结束,请注意查看。";
|
||||
$data['notice_title'] = "{$this->order_inquiry['patient_name']}患者的问诊已结束,请注意查看。";
|
||||
$data['notice_content'] = "{$this->order_inquiry['patient_name']}患者的问诊已结束,请注意查看。";
|
||||
$data['link_type'] = 3; // 问诊消息列表页
|
||||
|
||||
$link_params = array();
|
||||
$link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||
$data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数
|
||||
$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));
|
||||
}
|
||||
$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());
|
||||
@ -1176,66 +1169,63 @@ class MessagePush extends BaseService
|
||||
throw new BusinessException("加入推送队列失败:处方数据为空");
|
||||
}
|
||||
|
||||
if ($this->push_type == 1) {
|
||||
// 站内
|
||||
$data = array();
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
$data['notice_type'] = 1;
|
||||
$data['inquiry_type'] = $this->order_inquiry['inquiry_type']; // 问诊类型(医生端服务通知存在 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
$data['from_name'] = "肝胆小秘书";
|
||||
$data['notice_brief_title'] = "处方审核通过";
|
||||
$data['notice_title'] = "处方审核通过";
|
||||
$data['notice_content'] = "{$this->order_inquiry['patient_name']}患者的电子处方已审核通过,请注意查看。";
|
||||
$data['link_type'] = 1; // 聊天详情页
|
||||
// 站内
|
||||
$data = array();
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
$data['notice_type'] = 1;
|
||||
$data['inquiry_type'] = $this->order_inquiry['inquiry_type']; // 问诊类型(医生端服务通知存在 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
$data['from_name'] = "肝胆小秘书";
|
||||
$data['notice_brief_title'] = "处方审核通过";
|
||||
$data['notice_title'] = "处方审核通过";
|
||||
$data['notice_content'] = "{$this->order_inquiry['patient_name']}患者的电子处方已审核通过,请注意查看。";
|
||||
$data['link_type'] = 1; // 聊天详情页
|
||||
|
||||
$link_params = array();
|
||||
$link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||
$link_params['inquiry_type'] = $this->order_inquiry['inquiry_type'];
|
||||
$link_params['doctor_user_id'] = $this->user['user_id'];
|
||||
$link_params['patient_user_id'] = $this->order_inquiry['user_id'];
|
||||
$data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数
|
||||
$link_params = array();
|
||||
$link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||
$link_params['inquiry_type'] = $this->order_inquiry['inquiry_type'];
|
||||
$link_params['doctor_user_id'] = $this->user['user_id'];
|
||||
$link_params['patient_user_id'] = $this->order_inquiry['user_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['wx_template_id'] = "kUy70xHlr7ADo4aIHiictM4Te7MSec3E5kHsYvFQu40"; // 处方审核结果通知
|
||||
$sub_data['params']['page'] = "Pages/yishi/chufangsetup/index";
|
||||
$sub_data['params']['data'] = [
|
||||
"phrase1" => "药师审方通过",// 审核结果
|
||||
"thing2" => "审核通过",// 原因
|
||||
"date3" => $order_prescription['pharmacist_verify_time'],// 审核时间
|
||||
"thing4" => "提醒患者用药提醒,并结束问诊",// 提示说明
|
||||
];
|
||||
$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));
|
||||
}
|
||||
|
||||
// 短信
|
||||
$sms_data = array();
|
||||
$sms_data['template_code'] = "SMS_272120097";
|
||||
$sms_data['scene_desc'] = "医生开具的处方审核通过";
|
||||
$sms_data['phone'] = $this->user['mobile'];
|
||||
$sms_data['user_id'] = $this->user['user_id'];
|
||||
// 订阅
|
||||
$sub_data = array();
|
||||
$sub_data['push_user_id'] = $this->user['user_id'];
|
||||
$sub_data['wx_template_id'] = "kUy70xHlr7ADo4aIHiictM4Te7MSec3E5kHsYvFQu40"; // 处方审核结果通知
|
||||
$sub_data['params']['page'] = "Pages/yishi/chufangsetup/index";
|
||||
$sub_data['params']['data'] = [
|
||||
"phrase1" => "药师审方通过",// 审核结果
|
||||
"thing2" => "审核通过",// 原因
|
||||
"date3" => $order_prescription['pharmacist_verify_time'],// 审核时间
|
||||
"thing4" => "提醒患者用药提醒,并结束问诊",// 提示说明
|
||||
];
|
||||
|
||||
$template_param = array();
|
||||
$template_param['name'] = $this->order_inquiry['patient_name'];
|
||||
$sms_data['template_param'] = $template_param;
|
||||
// 短信
|
||||
$sms_data = array();
|
||||
$sms_data['template_code'] = "SMS_272120097";
|
||||
$sms_data['scene_desc'] = "医生开具的处方审核通过";
|
||||
$sms_data['phone'] = $this->user['mobile'];
|
||||
$sms_data['user_id'] = $this->user['user_id'];
|
||||
|
||||
$data = array();
|
||||
$data['sub_data'] = $sub_data;
|
||||
$data['sms_data'] = $sms_data;
|
||||
$template_param = array();
|
||||
$template_param['name'] = $this->order_inquiry['patient_name'];
|
||||
$sms_data['template_param'] = $template_param;
|
||||
|
||||
$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));
|
||||
}
|
||||
$data = array();
|
||||
$data['sub_data'] = $sub_data;
|
||||
$data['sms_data'] = $sms_data;
|
||||
|
||||
$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));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||
@ -1262,40 +1252,38 @@ class MessagePush extends BaseService
|
||||
throw new BusinessException("加入推送队列失败:处方数据为空");
|
||||
}
|
||||
|
||||
if ($this->push_type == 2) {
|
||||
// 订阅
|
||||
$sub_data = array();
|
||||
$sub_data['push_user_id'] = $this->user['user_id'];
|
||||
$sub_data['wx_template_id'] = "kUy70xHlr7ADo4aIHiictM4Te7MSec3E5kHsYvFQu40"; // 处方审核结果通知
|
||||
$sub_data['params']['page'] = "Pages/yishi/chufangsetup/index";
|
||||
$sub_data['params']['data'] = [
|
||||
"phrase1" => "药师审方不通过",// 审核结果
|
||||
"thing2" => $order_prescription['pharmacist_fail_reason'],// 原因
|
||||
"date3" => $order_prescription['pharmacist_verify_time'],// 审核时间
|
||||
"thing4" => "建议您修改处方并重新为患者开具",// 提示说明
|
||||
];
|
||||
// 订阅
|
||||
$sub_data = array();
|
||||
$sub_data['push_user_id'] = $this->user['user_id'];
|
||||
$sub_data['wx_template_id'] = "kUy70xHlr7ADo4aIHiictM4Te7MSec3E5kHsYvFQu40"; // 处方审核结果通知
|
||||
$sub_data['params']['page'] = "Pages/yishi/chufangsetup/index";
|
||||
$sub_data['params']['data'] = [
|
||||
"phrase1" => "药师审方不通过",// 审核结果
|
||||
"thing2" => $order_prescription['pharmacist_fail_reason'],// 原因
|
||||
"date3" => $order_prescription['pharmacist_verify_time'],// 审核时间
|
||||
"thing4" => "建议您修改处方并重新为患者开具",// 提示说明
|
||||
];
|
||||
|
||||
// 短信
|
||||
$sms_data = array();
|
||||
$sms_data['template_code'] = "SMS_271905264";
|
||||
$sms_data['scene_desc'] = "医生开具的处方审核未通过";
|
||||
$sms_data['phone'] = $this->user['mobile'];
|
||||
$sms_data['user_id'] = $this->user['user_id'];
|
||||
// 短信
|
||||
$sms_data = array();
|
||||
$sms_data['template_code'] = "SMS_271905264";
|
||||
$sms_data['scene_desc'] = "医生开具的处方审核未通过";
|
||||
$sms_data['phone'] = $this->user['mobile'];
|
||||
$sms_data['user_id'] = $this->user['user_id'];
|
||||
|
||||
$template_param = array();
|
||||
$template_param['name'] = $this->order_inquiry['patient_name'];
|
||||
$sms_data['template_param'] = $template_param;
|
||||
$template_param = array();
|
||||
$template_param['name'] = $this->order_inquiry['patient_name'];
|
||||
$sms_data['template_param'] = $template_param;
|
||||
|
||||
$data = array();
|
||||
$data['sub_data'] = $sub_data;
|
||||
$data['sms_data'] = $sms_data;
|
||||
$data = array();
|
||||
$data['sub_data'] = $sub_data;
|
||||
$data['sms_data'] = $sms_data;
|
||||
|
||||
$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));
|
||||
}
|
||||
$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));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||
|
||||
@ -1713,6 +1713,10 @@ class UserDoctorService extends BaseService
|
||||
$imService = new ImService();
|
||||
$imService->inquiryEnd($order_inquiry,$user_info['user_id'],$order_inquiry['user_id']);
|
||||
|
||||
// 发送站内消息-医生有新问诊
|
||||
$MessagePush = new MessagePush($user_info['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->finishInquiryToDoctor();
|
||||
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
Db::rollBack();
|
||||
|
||||
@ -235,9 +235,20 @@ class UserPharmacistService extends BaseService
|
||||
$imService = new ImService();
|
||||
$imService->prescriptionIssued($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id'],$product_name,(string)$order_prescription['order_prescription_id'],"7");
|
||||
|
||||
// 发送站内、短信消息-患者的处方被药师审核通过
|
||||
$MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->patientPrescriptionVerifyPass();
|
||||
if ($pharmacist_audit_status == 1){
|
||||
// 发送站内、短信消息-患者的处方被药师审核通过
|
||||
$MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->patientPrescriptionVerifyPass();
|
||||
|
||||
// 站内、订阅失败发送短信-医生开具的处方审核通过
|
||||
// 发送目标不同,重新实例化
|
||||
$MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->prescriptionVerifySuccess();
|
||||
}else{
|
||||
// 站内、订阅失败发送短信-医生开具的处方审核未通过
|
||||
$MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->prescriptionVerifyFail();
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user