修改问诊

This commit is contained in:
wucongxing 2023-03-29 19:32:41 +08:00
parent 5362cd2a74
commit 57e0489fb4
7 changed files with 680 additions and 28 deletions

View File

@ -130,15 +130,17 @@ class AssignDoctorConsumer extends ConsumerMessage
// 分配医生
$UserDoctorService = new UserDoctorService();
$doctor_id = $UserDoctorService->getInquiryAssignDoctor($order_inquiry['inquiry_type'],$order_inquiry['patient_id']);
if (!empty($doctor_id)){
if (empty($doctor_id)){
// 无合适医生
Db::rollBack();
Log::getInstance()->error("分配医生队列执行失败原因:重回队列,目前没有合适医生");
Log::getInstance()->info("分配医生队列执行:目前没有合适医生");
$redis_value = $this->checkAssignCount($order_inquiry['order_inquiry_id']);
// 执行睡眠,防止重复执行队列
// 执行规则第一次30秒第二次30秒。以30的倍数增加
sleep($redis_value * 30);
sleep($redis_value * 5);
Log::getInstance()->info("分配医生队列执行:重回队列");
return Result::REQUEUE; // 重回队列
}

View File

@ -209,10 +209,6 @@ class SendStationMessageConsumer extends ConsumerMessage
$notice_data['read_status'] = 0;
if (isset($push_data['inquiry_type'])){
$notice_data['inquiry_type'] = $push_data['inquiry_type'] ;
}
if (isset($push_data['from_name'])){
$notice_data['from_name'] = $push_data['from_name'] ;
}

View File

@ -2,6 +2,7 @@
namespace App\Controller;
use App\Amqp\Producer\AssignDoctorProducer;
use App\Amqp\Producer\CancelUnpayOrdersDelayDirectProducer;
use App\Constants\HttpEnumCode;
use App\Model\DoctorInquiryTime;
@ -10,11 +11,13 @@ use App\Model\OrderInquiry;
use App\Model\UserDoctor;
use App\Services\ImService;
use App\Services\MessagePush;
use App\Services\UserDoctorService;
use App\Utils\Log;
use Extend\Alibaba\Oss;
use Extend\Ca\Ca;
use Hyperf\Amqp\Producer;
use Hyperf\DbConnection\Db;
use Hyperf\Utils\ApplicationContext;
use Intervention\Image\ImageManager;
use TCPDF;
@ -484,6 +487,16 @@ class TestController extends AbstractController
//
// $ImService->sendMessage($user_doctor['user_id'], $order_inquiry['user_id'], $message_content, "TIMCustomElem", $cloud_custom_data);
// $data = array();
// $data['order_inquiry_id'] = "499654588596031489";
//
// $message = new AssignDoctorProducer($data);
// $producer = ApplicationContext::getContainer()->get(Producer::class);
// $result = $producer->produce($message);
}
}

View File

@ -16,16 +16,15 @@ use Hyperf\Snowflake\Concern\Snowflake;
* @property int $notice_type 消息类型1:医生服务通知 2:医生系统公告 3:患者系统消息)
* @property int $notice_system_type 系统消息类型(患者端系统消息存在 1:服务消息 2:福利消息 3:退款消息 4:物流消息)
* @property int $read_status 读取状态0:未读 1:已读)
* @property int $inquiry_type 问诊类型(医生端服务通知存在 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
* @property string $from_name 发送人姓名
* @property string $notice_brief_type 缩略消息标题(列表页展示)
* @property string $notice_brief_title 缩略消息标题(列表页展示)
* @property string $notice_title 消息标题
* @property string $notice_send_time 发送时间
* @property string $notice_content 内容
* @property int $send_status 发送状态0:未处理 1:已发送 2:发送失败)
* @property string $send_fail_reason 发送失败原因
* @property int $button_type 按钮类型1:我的账户 2:联系客服 3:查看协议 4:订单详情 5:查看处方 6:问诊详情
* @property int $link_type 跳转页面类型1:聊天详情页 2:问诊结束列表页 3:问诊消息列表页 4:我的名片 5:我的简介 6:我的账户 7:我的福利 8:药品订单详情页 9:物流详情 10:问诊订单详情 11:联系客服 12:协议详情 13:处方详情
* @property int $link_type 跳转页面类型1:聊天详情页 2:问诊结束列表页 3:问诊消息列表页 4:我的名片 5:我的简介 6:我的账户 7:我的福利 8:药品订单详情页 9:物流详情 10:问诊订单详情 11:联系客服 12:协议详情 13:处方详情 14:多点执业认证页
* @property string $link_params 跳转参数json
* @property int $show_type 展示类型1:医生数据)
* @property string $show_params 展示数据json
@ -44,7 +43,7 @@ class MessageNotice extends Model
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['notice_id', 'user_id', 'user_type', 'notice_type', 'notice_system_type', 'read_status', 'inquiry_type', 'from_name', 'notice_brief_type', 'notice_title', 'notice_send_time', 'notice_content', 'send_status', 'send_fail_reason', 'button_type', 'link_type', 'link_params', 'show_type', 'show_params', 'created_at', 'updated_at'];
protected array $fillable = ['notice_id', 'user_id', 'user_type', 'notice_type', 'notice_system_type', 'read_status', 'from_name', 'notice_brief_title', 'notice_title', 'notice_send_time', 'notice_content', 'send_status', 'send_fail_reason', 'button_type', 'link_type', 'link_params', 'show_type', 'show_params', 'created_at', 'updated_at'];
protected string $primaryKey = "notice_id";

View File

@ -24,8 +24,10 @@ use Hyperf\Utils\Arr;
* @property int $status 状态0:禁用 1:正常 2:删除)
* @property int $idcard_status 实名认证状态0:未认证 1:认证通过 2:认证失败)
* @property int $iden_auth_status 身份认证状态0:未认证 1:认证通过 2:审核中 3:认证失败)
* @property string $iden_auth_time 审核时间
* @property string $iden_auth_fail_reason 身份认证失败原因
* @property int $multi_point_status 医生多点执业认证状态0:未认证 1:认证通过 2:审核中 3:认证失败)
* @property string $multi_point_time 审核时间
* @property string $multi_point_fail_reason 多点执业认证失败原因
* @property int $is_bind_bank 是否已绑定结算银行卡0: 1:是)
* @property int $is_recommend 是否首页推荐0: 1:是)
@ -67,7 +69,7 @@ class UserDoctor extends Model
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['doctor_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'idcard_status', 'iden_auth_status', 'iden_auth_fail_reason', 'multi_point_status', 'multi_point_fail_reason', 'is_bind_bank', 'is_recommend', 'avatar', 'doctor_title', 'department_custom_id', 'department_custom_name', 'department_custom_mobile', 'hospital_id', 'served_patients_num', 'praise_rate', 'avg_response_time', 'number_of_fans', 'is_online', 'is_img_expert_reception', 'is_img_welfare_reception', 'is_img_quick_reception', 'is_platform_deep_cooperation', 'is_enterprise_deep_cooperation', 'qr_code', 'be_good_at', 'brief_introduction', 'created_at', 'updated_at'];
protected array $fillable = ['doctor_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'idcard_status', 'iden_auth_status', 'iden_auth_time', 'iden_auth_fail_reason', 'multi_point_status', 'multi_point_time', 'multi_point_fail_reason', 'is_bind_bank', 'is_recommend', 'avatar', 'doctor_title', 'department_custom_id', 'department_custom_name', 'department_custom_mobile', 'hospital_id', 'served_patients_num', 'praise_rate', 'avg_response_time', 'number_of_fans', 'is_online', 'is_img_expert_reception', 'is_img_welfare_reception', 'is_img_quick_reception', 'is_platform_deep_cooperation', 'is_enterprise_deep_cooperation', 'qr_code', 'be_good_at', 'brief_introduction', 'created_at', 'updated_at'];
protected string $primaryKey = "doctor_id";

View File

@ -87,13 +87,13 @@ class MessagePush extends BaseService
$data['from_name'] = "肝胆小秘书";
if ($this->order_inquiry['inquiry_type'] == 1 || $this->order_inquiry['inquiry_type'] == 3) {
// 专家-公益
$data['notice_brief_type'] = "您咨询的服务暂无医生接诊,点击查看详情。";
$data['notice_brief_title'] = "您咨询的服务暂无医生接诊,点击查看详情。";
$data['notice_title'] = "您咨询的服务暂无医生接诊,点击查看详情。";
$data['notice_content'] = "您咨询的服务当前排队人较多暂无空闲医生接诊。给您带来不便敬请谅解平台会在24小时内进行退款您可以点击订单详情查看退款详情。";
} elseif ($this->order_inquiry['inquiry_type'] == 1 || $this->order_inquiry['inquiry_type'] == 4) {
// 快速-购药
$data['notice_brief_type'] = "您咨询的医生因工作繁忙没有时间接诊,点击查看详情。";
$data['notice_brief_title'] = "您咨询的医生因工作繁忙没有时间接诊,点击查看详情。";
$data['notice_title'] = "您咨询的医生因工作繁忙没有时间接诊,点击查看详情。";
$data['notice_content'] = "您咨询的医生因工作繁忙暂无空闲时间接诊。给您带来不便敬请谅解平台会在24小时内进行退款您可以点击订单详情查看退款详情。";
}
@ -217,7 +217,7 @@ class MessagePush extends BaseService
$data['notice_type'] = 3;
$data['notice_system_type'] = 1;
$data['from_name'] = "肝胆小秘书";
$data['notice_brief_type'] = "{$user_doctor['user_name']}医生已接诊,请尽快和医生进行沟通交流病情,点击查看详情";
$data['notice_brief_title'] = "{$user_doctor['user_name']}医生已接诊,请尽快和医生进行沟通交流病情,点击查看详情";
$data['notice_title'] = "{$user_doctor['user_name']}医生已接诊,请尽快和医生进行沟通交流病情,点击查看详情";
$data['notice_content'] = "{$user_doctor['user_name']}医生已接诊,请您尽快和医生进行沟通交流病情,您可以点击问诊详情进行交流。";
$data['link_type'] = 1;// 聊天详情页
@ -334,7 +334,7 @@ class MessagePush extends BaseService
$data['notice_type'] = 3;
$data['notice_system_type'] = 1;
$data['from_name'] = "肝胆小秘书";
$data['notice_brief_type'] = "您咨询的【{$inquiry_type_string}】服务已结束,点击查看详情。";
$data['notice_brief_title'] = "您咨询的【{$inquiry_type_string}】服务已结束,点击查看详情。";
$data['notice_title'] = "您咨询的【{$inquiry_type_string}】服务已结束,点击查看详情。";
$data['notice_content'] = "您咨询{$user_doctor['user_name']}医生的服务已结束,请对本次问诊服务做出评价。您的评价对医生和其他患者也有很重要的参考价值。您也可以点击医生头像,进入医生主页关注医生。";
$data['link_type'] = 10;// 聊天详情页
@ -419,7 +419,7 @@ class MessagePush extends BaseService
$data['notice_type'] = 3;
$data['notice_system_type'] = 1;
$data['from_name'] = "肝胆小秘书";
$data['notice_brief_type'] = "{$user_doctor['user_name']}医生为您开具的电子处方已审核通过,点击查看详情。";
$data['notice_brief_title'] = "{$user_doctor['user_name']}医生为您开具的电子处方已审核通过,点击查看详情。";
$data['notice_title'] = "{$user_doctor['user_name']}医生为您开具的电子处方已审核通过,点击查看详情。";
$data['notice_content'] = "{$user_doctor['user_name']}医生为您开具的电子处方已审核通过,您可以点击查看处方进行购买药品。";
$data['link_type'] = 13;
@ -496,7 +496,7 @@ class MessagePush extends BaseService
$data['notice_type'] = 3;
$data['notice_system_type'] = 2; // 系统消息类型(患者端系统消息存在 1:服务消息 2:福利消息 3:退款消息 4:物流消息)
$data['from_name'] = "肝胆小秘书";
$data['notice_brief_type'] = "有新的优惠券已下发至您的账户,点击查看详情。";
$data['notice_brief_title'] = "有新的优惠券已下发至您的账户,点击查看详情。";
$data['notice_title'] = "【优惠劵名称】已到账";
$data['notice_content'] = "有新的优惠劵已下发至您的账户中,点击查看详情!";
$data['link_type'] = 7;
@ -548,7 +548,7 @@ class MessagePush extends BaseService
$data['notice_type'] = 3;
$data['notice_system_type'] = 2; // 系统消息类型(患者端系统消息存在 1:服务消息 2:福利消息 3:退款消息 4:物流消息)
$data['from_name'] = "肝胆小秘书";
$data['notice_brief_type'] = "您有优惠劵已退还至您的账户,点击查看详情。";
$data['notice_brief_title'] = "您有优惠劵已退还至您的账户,点击查看详情。";
$data['notice_title'] = "【优惠劵名称】已退还";
$data['notice_content'] = "您有优惠劵已退还至您的账户,请点击查看详情!";
$data['link_type'] = 7;
@ -600,7 +600,7 @@ class MessagePush extends BaseService
$data['notice_type'] = 3;
$data['notice_system_type'] = 2; // 系统消息类型(患者端系统消息存在 1:服务消息 2:福利消息 3:退款消息 4:物流消息)
$data['from_name'] = "肝胆小秘书";
$data['notice_brief_type'] = "您有一张优惠劵即将过期,点击查看详情。";
$data['notice_brief_title'] = "您有一张优惠劵即将过期,点击查看详情。";
$data['notice_title'] = "【优惠劵名称】即将过期";
$data['notice_content'] = "您有一张优惠劵即将过期,点击查看详情!";
$data['link_type'] = 7;
@ -649,17 +649,17 @@ class MessagePush extends BaseService
$data['from_name'] = "肝胆小秘书";
if ($type == 1){
// 已支付未接诊
$data['notice_brief_type'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功,点击查看详情。";
$data['notice_brief_title'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功,点击查看详情。";
$data['notice_title'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功";
$data['notice_content'] = "因医生繁忙未及时接诊平台会在24小时内给您退款至原账户中带来的不便敬请谅解。";
}elseif ($type == 2){
// 已支付未成功分配医生
$data['notice_brief_type'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功,点击查看详情。";
$data['notice_brief_title'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功,点击查看详情。";
$data['notice_title'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功";
$data['notice_content'] = "当前服务排队人较多暂无空闲医生为您接诊平台会在24小时内给您退款至原账户中带来的不便敬请谅解。";
}elseif ($type == 2){
// 已支付未接诊患者取消订单
$data['notice_brief_type'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功,点击查看详情。";
$data['notice_brief_title'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功,点击查看详情。";
$data['notice_title'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功";
$data['notice_content'] = "您已取消成功当前服务平台会在24小时内给您退还至原账户中带来的不便敬请谅解。";
}else{
@ -779,7 +779,7 @@ class MessagePush extends BaseService
$data['notice_type'] = 3;
$data['notice_system_type'] = 3;
$data['from_name'] = "肝胆小秘书";
$data['notice_brief_type'] = "您购买的【{$product_name}】药品,平台已退款成功,点击查看详情";
$data['notice_brief_title'] = "您购买的【{$product_name}】药品,平台已退款成功,点击查看详情";
$data['notice_title'] = "您购买的【{$product_name}】药品,平台已退款成功";
$data['notice_content'] = "因平台特殊情况发生,导致您的药品无法邮寄。平台已进行退款处理,并退款成功,带来的不便敬请谅解。";
@ -1007,7 +1007,7 @@ class MessagePush extends BaseService
$data['notice_type'] = 1;
$data['inquiry_type'] = $this->order_inquiry['inquiry_type']; // 问诊类型(医生端服务通知存在 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
$data['from_name'] = "肝胆小秘书";
$data['notice_brief_type'] = "您有新的问诊咨询,请注意查看。";
$data['notice_brief_title'] = "您有新的问诊咨询,请注意查看。";
$data['notice_title'] = "您有新的问诊咨询,请注意查看。";
$data['notice_content'] = "您有新的问诊咨询,请注意查看。";
$data['link_type'] = 1; // 聊天详情页
@ -1101,7 +1101,7 @@ class MessagePush extends BaseService
$data['notice_type'] = 1;
$data['inquiry_type'] = $this->order_inquiry['inquiry_type']; // 问诊类型(医生端服务通知存在 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
$data['from_name'] = "肝胆小秘书";
$data['notice_brief_type'] = "{$this->order_inquiry['patient_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; // 聊天详情页
@ -1143,8 +1143,8 @@ class MessagePush extends BaseService
// 短信
$sms_data = array();
$sms_data['template_code'] = "SMS_272015117";
$sms_data['scene_desc'] = "医生到新问";
$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'];
@ -1171,4 +1171,643 @@ class MessagePush extends BaseService
return true;
}
/**
* 问诊结束
* 站内
* 发送给医生
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function finishInquiryToDoctor(): bool
{
try {
// 获取问诊订单关联病例
$params = array();
$params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
$order_inquiry_case = OrderInquiryCase::getOne($params);
if (empty($order_inquiry_case)){
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; // 问诊消息列表页
$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));
}
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
* 医生开具的处方审核通过
* 站内、订阅失败发送短信
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function prescriptionVerifySuccess(): bool
{
try {
// 获取问诊订单处方数据
$params = array();
$params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
$order_prescription = OrderPrescription::getOne($params);
if (empty($order_prescription)) {
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; // 聊天详情页
$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['template_title'] = "处方审核结果通知";
$sub_data['params']['page'] = "Pages/yishi/chufangsetup/index";
$sub_data['params']['data'] = [
"phrase1" => "药师审方通过",// 审核结果
"thing2" => "审核通过",// 原因
"date3" => $order_prescription['pharmacist_verify_time'],// 审核时间
"thing4" => "提醒患者用药提醒,并结束问诊",// 提示说明
];
// 短信
$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'];
$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;
$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());
}
return true;
}
/**
* 医生开具的处方审核未通过
* 订阅失败发送短信
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function prescriptionVerifyFail(): bool
{
try {
// 获取问诊订单处方数据
$params = array();
$params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
$order_prescription = OrderPrescription::getOne($params);
if (empty($order_prescription)) {
throw new BusinessException("加入推送队列失败:处方数据为空");
}
if ($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/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'];
$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;
$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());
}
return true;
}
/**
* 医师身份通过
* 短信
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function DoctorIdenAuthSuccess(): bool
{
try {
if ($this->push_type == 3) {
// 短信
// 获取系统接诊配置
$data = array();
$data['template_code'] = "SMS_271925089";
$data['scene_desc'] = "医师身份通过";
$data['phone'] = $this->user['mobile'];
$data['user_id'] = $this->user['user_id'];
$template_param = array();
$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;
}
/**
* 医师身份未通过
* 短信
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function DoctorIdenAuthFail(): bool
{
try {
if ($this->push_type == 3) {
// 短信
// 获取系统接诊配置
$data = array();
$data['template_code'] = "SMS_271905155";
$data['scene_desc'] = "医师身份未通过";
$data['phone'] = $this->user['mobile'];
$data['user_id'] = $this->user['user_id'];
$template_param = array();
$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;
}
/**
* 多点执业认证审核通过
* 站内、订阅发送失败发送短信
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function doctorMultiPointSuccess(): bool
{
try {
if ($this->push_type == 1) {
// 站内
$data = array();
$data['user_id'] = $this->user['user_id'];
$data['notice_type'] = 1;
$data['from_name'] = "肝胆小秘书";
$data['notice_title'] = "多点执业认证审核结果";
$data['notice_brief_title'] = "您提交的多点执业认证审核通过,查看详情;";
$data['notice_content'] = "{$this->user['user_name']}医生,您提交的多点执业认证审核通过,现在可以为患者开具电子处方了;";
$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) {
// 订阅
// 获取医生数据
$params = array();
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
throw new BusinessException("加入推送队列失败:医生数据为空");
}
$sub_data = array();
$sub_data['push_user_id'] = $this->user['user_id'];
$sub_data['template_title'] = "审核结果通知";
$sub_data['params']['page'] = "Pages/index/index";
$sub_data['params']['data'] = [
"thing1" => "多点执业认证审核通过",// 审核结果
"thing2" => "多点执业认证",// 审核内容
"time3" => $user_doctor['multi_point_time'],// 审核时间
"thing4" => "您提交的多点执业认证审核通过,点击查看详情。",// 备注
];
// 短信
$sms_data = array();
$sms_data['template_code'] = "SMS_271575911";
$sms_data['scene_desc'] = "多点执业认证审核通过";
$sms_data['phone'] = $this->user['mobile'];
$sms_data['user_id'] = $this->user['user_id'];
$template_param = array();
$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));
}
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
* 多点执业认证审核未通过
* 站内、订阅发送失败发送短信
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function doctorMultiPointFail(): bool
{
try {
if ($this->push_type == 1) {
// 站内
$data = array();
$data['user_id'] = $this->user['user_id'];
$data['notice_type'] = 1;
$data['from_name'] = "肝胆小秘书";
$data['notice_title'] = "多点执业认证审核结果";
$data['notice_brief_title'] = "您提交的多点执业认证审核拒绝,查看详情;";
$data['notice_content'] = "{$this->user['user_name']}医生,您提交的多点执业认证审核未通过,请查看原因重新提交;";
$data['link_type'] = 4;// 我的名片
$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) {
// 订阅
// 获取医生数据
$params = array();
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
throw new BusinessException("加入推送队列失败:医生数据为空");
}
$sub_data = array();
$sub_data['push_user_id'] = $this->user['user_id'];
$sub_data['template_title'] = "资格审核未通过通知";
$sub_data['params']['page'] = "Pages/index/index";
$sub_data['params']['data'] = [
"thing1" => "{$this->user['user_name']}医生您好,多点执业认证审核没有通过,请重新提交",// 温馨提示
"thing2" => $user_doctor['multi_point_fail_reason'],// 驳回理由
"time3" => $user_doctor['multi_point_time'],// 审核时间
];
// 短信
$sms_data = array();
$sms_data['template_code'] = "SMS_272030021";
$sms_data['scene_desc'] = "多点执业认证审核未通过";
$sms_data['phone'] = $this->user['mobile'];
$sms_data['user_id'] = $this->user['user_id'];
$template_param = array();
$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));
}
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
* 医生简介审核通过-因缺少简介表,审核时间使用的是当前时间
* 站内、订阅发送失败发送短信
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function doctorBriefSuccess(): 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) {
// 站内
$data = array();
$data['user_id'] = $this->user['user_id'];
$data['notice_type'] = 1;
$data['from_name'] = "肝胆小秘书";
$data['notice_title'] = "简介信息审核结果";
$data['notice_brief_title'] = "{$this->user['user_name']}医生,您修改的简介信息审核通过,快去通知患者吧;";
$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/index/index";
$sub_data['params']['data'] = [
"thing1" => "医师简介审核通过;",// 审核结果
"thing2" => "医师简介",// 审核内容
"time3" => date('Y-m-d H:i:s',time()),// 审核时间
"thing4" => "{$user_doctor['user_name']}医生,您修改的简介信息审核通过,快去通知患者吧。",// 备注
];
// 短信
$sms_data = array();
$sms_data['template_code'] = "SMS_271990126";
$sms_data['scene_desc'] = "医生简介审核通过";
$sms_data['phone'] = $this->user['mobile'];
$sms_data['user_id'] = $this->user['user_id'];
$template_param = array();
$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));
}
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
* 医生简介审核未通过-因缺少简介表,审核时间使用的是当前时间,驳回理由未填写
* 站内、订阅发送失败发送短信
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function doctorBriefFail(): bool
{
try {
if ($this->push_type == 1) {
// 站内
$data = array();
$data['user_id'] = $this->user['user_id'];
$data['notice_type'] = 1;
$data['from_name'] = "肝胆小秘书";
$data['notice_title'] = "简介信息审核结果";
$data['notice_brief_title'] = "{$this->user['user_name']}医生,您修改的简介信息审核未通过,请查看原因重新提交;";
$data['link_type'] = 5;// 我的简介
$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) {
// 订阅
// 获取医生数据
$params = array();
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
throw new BusinessException("加入推送队列失败:医生数据为空");
}
$sub_data = array();
$sub_data['push_user_id'] = $this->user['user_id'];
$sub_data['template_title'] = "资格审核未通过通知";
$sub_data['params']['page'] = "Pages/index/index";
$sub_data['params']['data'] = [
"thing1" => "{$this->user['user_name']}医生您好,简介信息审核没有通过,请重新提交",// 温馨提示
"thing2" => "未知",// 驳回理由
"time3" => date('Y-m-d H:i:s',time()),// 审核时间
];
// 短信
$sms_data = array();
$sms_data['template_code'] = "SMS_272165092";
$sms_data['scene_desc'] = "简介信息认证审核未通过";
$sms_data['phone'] = $this->user['mobile'];
$sms_data['user_id'] = $this->user['user_id'];
$template_param = array();
$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));
}
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
* 医师服务费结算结果
* 站内、短信
* @param string $order_product_id
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function doctorSettlementResult(string $order_product_id): bool
{
try {
if ($this->push_type == 1) {
// 站内
$data = array();
$data['user_id'] = $this->user['user_id'];
$data['notice_type'] = 2;
$data['from_name'] = "肝胆小秘书";
$data['notice_brief_title'] = "XX月XX日提取的服务费已结算本年显示XX月XX日去年显示XX年XX月;";
$data['notice_title'] = "XX月XX日提取的服务费已结算本年显示XX月XX日去年显示XX年XX月";
$data['notice_content'] = "XX医生您好您XX月XX日提取的服务费已结算至您的银行卡请注意查收。本年显示XX月XX日去年显示XX年XX月";
$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);// 跳转参数
$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 == 3) {
// 短信
// 获取系统接诊配置
$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));
}
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
}
return true;
}
}

View File

@ -1509,6 +1509,7 @@ class UserDoctorService extends BaseService
try {
$data = array();
$data['inquiry_status'] = 4;
$data['reception_time'] = date('Y-m-d H:i:s',time());
$params = array();
$params['order_inquiry_id'] = $order_inquiry_id;