新增 医生xx时间未接诊提醒队列

This commit is contained in:
2023-08-17 13:49:17 +08:00
parent bea292cd5e
commit 857536e8bd
10 changed files with 208 additions and 67 deletions
+53 -62
View File
@@ -1178,78 +1178,69 @@ 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'] = 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'] = 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) {
// 订阅
$inquiry_type = inquiryTypeToString($this->order_inquiry['inquiry_type']);
$message = new SendStationMessageProducer($data);
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . 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" => "您好医生,{$this->order_inquiry['patient_name']}患者的({$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" => "您好医生,{$this->order_inquiry['patient_name']}患者的({$inquiry_type})服务您还未接诊;",// 提醒内容
"name2" => $this->order_inquiry['patient_name'],// 患者姓名
"thing4" => mb_substr($order_inquiry_case['disease_desc'], 0, 18),// 病情描述
"thing6" => "24小时内未接诊,平台将自动取消问诊。",// 提示说明
"thing5" => "",// 咨询内容
];
"thing4" => mb_substr($order_inquiry_case['disease_desc'], 0, 18),// 病情描述
$sms_data = array();
$sms_data['template_code'] = "SMS_272SMS_271905266120097";
$sms_data['scene_desc'] = "医生xx时间后还未接诊";
$sms_data['phone'] = $this->user['mobile'];
$sms_data['user_id'] = $this->user['user_id'];
"thing6" => "24小时内未接诊,平台将自动取消问诊。",// 提示说明
$template_param = array();
$template_param['type'] = inquiryTypeToString($this->order_inquiry['inquiry_type']);
$template_param['name'] = $this->order_inquiry['patient_name'];
$sms_data['template_param'] = $template_param;
"thing5" => "",// 咨询内容
];
// 短信
$sms_data = array();
$sms_data['template_code'] = "SMS_271905266";
$sms_data['scene_desc'] = "医生xx时间后还未接诊";
$sms_data['phone'] = $this->user['mobile'];
$sms_data['user_id'] = $this->user['user_id'];
$template_param = array();
$template_param['type'] = inquiryTypeToString($this->order_inquiry['inquiry_type']);
$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;
$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) {
Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE));
}
return true;