新增了医生赠送沟通回合数
This commit is contained in:
+112
-17
@@ -399,7 +399,7 @@ class MessagePush extends BaseService
|
||||
$data['notice_brief_title'] = "您的【{$inquiry_type_string}】服务已结束,点击查看详情。";
|
||||
$data['notice_title'] = "您的【{$inquiry_type_string}】服务已结束,点击查看详情。";
|
||||
$data['notice_content'] = "您咨询{$user_doctor['user_name']}医生的服务已结束,请对本次问诊服务做出评价。您的评价对医生和其他患者也有很重要的参考价值。您也可以点击医生头像,进入医生主页关注医生。";
|
||||
$data['link_type'] = 10;// 聊天详情页
|
||||
$data['link_type'] = 10;// 问诊订单详情
|
||||
|
||||
$link_params = array();
|
||||
$link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||
@@ -456,8 +456,6 @@ class MessagePush extends BaseService
|
||||
* 患者-处方被药师审核通过
|
||||
* 站内、短信
|
||||
* @return void
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function patientPrescriptionVerifyPass(): void
|
||||
{
|
||||
@@ -533,8 +531,6 @@ class MessagePush extends BaseService
|
||||
* 患者-处方审核未通过
|
||||
* 站内
|
||||
* @return void
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function patientPrescriptionVerifyFail(): void
|
||||
{
|
||||
@@ -575,8 +571,6 @@ class MessagePush extends BaseService
|
||||
* 站内
|
||||
* @param string $coupon_name
|
||||
* @return void
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function patientDistributeCoupon(string $coupon_name): void
|
||||
{
|
||||
@@ -639,8 +633,6 @@ class MessagePush extends BaseService
|
||||
* 站内
|
||||
* @param string $coupon_name
|
||||
* @return void
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function patientExpireCoupon(string $coupon_name): void
|
||||
{
|
||||
@@ -671,8 +663,6 @@ class MessagePush extends BaseService
|
||||
* 站内、订阅、短信
|
||||
* @param int $cancel_reason 取消订单原因(1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时)
|
||||
* @return void
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function refundInquirySuccess(int $cancel_reason): void
|
||||
{
|
||||
@@ -1048,8 +1038,6 @@ class MessagePush extends BaseService
|
||||
* 医生-医生有新问诊
|
||||
* 站内、订阅失败发送短信
|
||||
* @return void
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function doctorHaveNewInquiry(): void
|
||||
{
|
||||
@@ -1245,8 +1233,6 @@ class MessagePush extends BaseService
|
||||
* 站内
|
||||
* 发送给医生
|
||||
* @return void
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function finishInquiryToDoctor(): void
|
||||
{
|
||||
@@ -2424,7 +2410,7 @@ class MessagePush extends BaseService
|
||||
/**
|
||||
* 患者-im消息通知
|
||||
* 订阅
|
||||
* @param string $data 消息内容
|
||||
* @param string $msg
|
||||
* @return void
|
||||
*/
|
||||
public function patientImMessageNotice(string $msg): void
|
||||
@@ -2477,7 +2463,7 @@ class MessagePush extends BaseService
|
||||
/**
|
||||
* 医生-im消息通知
|
||||
* 订阅
|
||||
* @param string $im_data
|
||||
* @param string $msg
|
||||
* @return void
|
||||
*/
|
||||
public function doctorImMessageNotice(string $msg): void
|
||||
@@ -2537,4 +2523,113 @@ class MessagePush extends BaseService
|
||||
Log::getInstance("MessagePush-patientImMessageNotice")->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 患者-赠送回合数
|
||||
* 站内、订阅失败发送短信
|
||||
* @param string $times_number
|
||||
* @param string $give_expiration_time 赠送到期时间
|
||||
* @return void
|
||||
*/
|
||||
public function doctorGiveFreeRounds(string $times_number,string $give_expiration_time): void
|
||||
{
|
||||
try {
|
||||
// 获取医生数据
|
||||
$params = array();
|
||||
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
|
||||
$user_doctor = UserDoctor::getOne($params);
|
||||
if (empty($user_doctor)) {
|
||||
Log::getInstance("MessagePush")->error("错误:医生数据为空");
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取问诊订单关联病例
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||
$order_inquiry_case = OrderInquiryCase::getOne($params);
|
||||
if (empty($order_inquiry_case)) {
|
||||
Log::getInstance("MessagePush")->error("错误:病例数据为空");
|
||||
return;
|
||||
}
|
||||
|
||||
$producer = ApplicationContext::getContainer()->get(Producer::class);
|
||||
|
||||
$data = array();
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
$data['notice_type'] = 3;
|
||||
$data['notice_system_type'] = 1;
|
||||
$data['from_name'] = "肝胆小秘书";
|
||||
$data['notice_brief_title'] = "您好,{$user_doctor['user_name']}医生已赠送您{$times_number}次回复机会,请在有效期内和医生进行问诊,请查看详情。";
|
||||
$data['notice_title'] = "您好,{$user_doctor['user_name']}医生已赠送您{$times_number}次回复机会,请在有效期内和医生进行问诊,请查看详情。";
|
||||
$data['notice_content'] = "您好,{$user_doctor['user_name']}医生已赠送您{$times_number}次回复机会(过期时间:{$give_expiration_time}),请在有效期内和医生进行问诊,请查看详情。";
|
||||
$data['link_type'] = 10;// 问诊订单详情
|
||||
|
||||
$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);// 跳转参数
|
||||
|
||||
$data['button_type'] = 4; // 订单详情
|
||||
|
||||
$message = new SendStationMessageProducer($data);
|
||||
$result = $producer->produce($message);
|
||||
if (!$result) {
|
||||
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
// 订阅
|
||||
// 问诊内容-病情主诉
|
||||
$disease_desc = $order_inquiry_case['disease_desc'];
|
||||
if (!empty($disease_desc)) {
|
||||
if (strlen($disease_desc) > 15) {
|
||||
$disease_desc = mb_substr($disease_desc, 0, 15);
|
||||
if ($disease_desc) {
|
||||
$disease_desc = $disease_desc . "...";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 赠送到期时间
|
||||
$give_expiration_time = date('Y-m-d H:i',strtotime($give_expiration_time));
|
||||
|
||||
$sub_data = array();
|
||||
$sub_data['push_user_id'] = $this->user['user_id'];
|
||||
$sub_data['wx_template_id'] = "9v6dZhjg09CttLd3W9nEUV_-eshNc4BYYNy59jglvZE";// 问诊提醒
|
||||
$sub_data['params']['page'] = "pages/orderDetail/orderDetail?order_inquiry_id={$this->order_inquiry['order_inquiry_id']}";
|
||||
$sub_data['params']['data'] = [
|
||||
"thing1" => (string)$disease_desc,// 问诊内容-病情主诉
|
||||
"thing2" => "医生赠送您{$times_number}次沟通机会",// 提醒内容
|
||||
"name3" => (string)$user_doctor['user_name'],// 问诊医生
|
||||
"thing4" => "有效期至{$give_expiration_time}",// 提示说明
|
||||
];
|
||||
|
||||
// 短信
|
||||
$sms_data = array();
|
||||
$sms_data['template_code'] = "SMS_464531282";
|
||||
$sms_data['scene_desc'] = "医生赠送免费回合数";
|
||||
$sms_data['phone'] = $this->user['mobile'];
|
||||
$sms_data['user_id'] = $this->user['user_id'];
|
||||
|
||||
$template_param = array();
|
||||
$template_param['name'] = $user_doctor['user_name'];
|
||||
$template_param['number'] = $times_number;
|
||||
$template_param['time'] = $give_expiration_time;
|
||||
$sms_data['template_param'] = $template_param;
|
||||
|
||||
$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) {
|
||||
Log::getInstance("MessagePush")->error("错误:加入订阅推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user