转移字符串

This commit is contained in:
2023-03-29 15:30:36 +08:00
parent 70e89a8b53
commit 5362cd2a74
10 changed files with 570 additions and 45 deletions
+1 -1
View File
@@ -295,7 +295,7 @@ class InquiryService extends BaseService
$result = array();
$result['inquiry_no'] = (string)$order_inquiry['inquiry_no']; // 订单编号
$result['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; // 订单主键id
$result['order_inquiry_id'] = (string)$order_inquiry['order_inquiry_id']; // 订单主键id
return success($result);
}
+465 -28
View File
@@ -8,7 +8,11 @@ use App\Amqp\Producer\SendSubMessageProducer;
use App\Constants\HttpEnumCode;
use App\Exception\BusinessException;
use App\Model\OrderInquiry;
use App\Model\OrderInquiryCase;
use App\Model\OrderPrescription;
use App\Model\OrderProduct;
use App\Model\OrderProductItem;
use App\Model\Product;
use App\Model\SystemInquiryConfig;
use App\Model\User;
use App\Model\UserDoctor;
@@ -83,15 +87,15 @@ class MessagePush extends BaseService
$data['from_name'] = "肝胆小秘书";
if ($this->order_inquiry['inquiry_type'] == 1 || $this->order_inquiry['inquiry_type'] == 3) {
// 专家-公益
$inquiry_type_string = inquiryTypeToString($this->order_inquiry['inquiry_type']);
$data['notice_title'] = "{$inquiry_type_string}】医生未接诊:您咨询的医生因工作繁忙没有时间接诊,点击查看详情。";
$data['notice_content'] = "{$inquiry_type_string}】未接诊:您咨询的服务当前排队人较多,暂无空闲医生接诊。给您带来不便敬请谅解,平台会在24小时内进行退款,您可以点击订单详情查看退款详情。";
$data['notice_brief_type'] = "您咨询的服务暂无医生接诊,点击查看详情。";
$data['notice_title'] = "您咨询的服务暂无医生接诊,点击查看详情。";
$data['notice_content'] = "您咨询的服务当前排队人较多,暂无空闲医生接诊。给您带来不便敬请谅解,平台会在24小时内进行退款,您可以点击订单详情查看退款详情。";
} elseif ($this->order_inquiry['inquiry_type'] == 1 || $this->order_inquiry['inquiry_type'] == 4) {
// 快速-购药
$inquiry_type_string = inquiryTypeToString($this->order_inquiry['inquiry_type']);
$data['notice_title'] = "{$inquiry_type_string}】未接诊:您咨询的服务暂无医生接诊,点击查看详情。";
$data['notice_content'] = "{$inquiry_type_string}】医生未接诊:您咨询的医生因工作繁忙,暂无空闲时间接诊。给您带来不便敬请谅解,平台会在24小时内进行退款,您可以点击订单详情查看退款详情。";
$data['notice_brief_type'] = "您咨询的医生因工作繁忙没有时间接诊,点击查看详情。";
$data['notice_title'] = "您咨询的医生因工作繁忙没有时间接诊,点击查看详情。";
$data['notice_content'] = "您咨询的医生因工作繁忙,暂无空闲时间接诊。给您带来不便敬请谅解,平台会在24小时内进行退款,您可以点击订单详情查看退款详情。";
}
$data['link_type'] = 10;// 问诊订单详情
@@ -126,7 +130,7 @@ class MessagePush extends BaseService
"character_string1" => $this->order_inquiry['inquiry_no'],// 订单ID
"name2" => (string)$user_doctor['user_name'],// 问诊医生
"date3" => $this->order_inquiry['created_at'],// 问诊时间
"thing4" => cancelReasonToString($this->order_inquiry['cancel_reason']),// 取消原因
"thing4" => inquiryCancelReasonToString($this->order_inquiry['cancel_reason']),// 取消原因
"thing5" => "点击详情更换医生问诊",// 提示说明
];
@@ -165,7 +169,7 @@ class MessagePush extends BaseService
$sub_data = array();
$sub_data['push_user_id'] = $this->user['user_id'];
$sub_data['template_title'] = "患者回复通知";
$sub_data['params']['page'] = "Pages/yishi/chat/index?from_account={$this->user['user_id']}&order_inquiry_id={$this->order_inquiry['order_inquiry_id']}&inquiry_type={$this->order_inquiry['inquiry_type']}";
$sub_data['params']['page'] = "Pages/yishi/wenzhen_v2/wenzhen";
$sub_data['params']['data'] = [
"thing1" => $this->user['user_name'],// 患者姓名
"thing2" => $content,// 回复内容
@@ -208,12 +212,12 @@ class MessagePush extends BaseService
if ($this->push_type == 1) {
// 站内
// 服务消息
$data = array();
$data['user_id'] = $this->user['user_id'];
$data['notice_type'] = 3;
$data['notice_system_type'] = 1;
$data['from_name'] = "肝胆小秘书";
$data['notice_brief_type'] = "{$user_doctor['user_name']}医生已接诊,请尽快和医生进行沟通交流病情,点击查看详情";
$data['notice_title'] = "{$user_doctor['user_name']}医生已接诊,请尽快和医生进行沟通交流病情,点击查看详情";
$data['notice_content'] = "{$user_doctor['user_name']}医生已接诊,请您尽快和医生进行沟通交流病情,您可以点击问诊详情进行交流。";
$data['link_type'] = 1;// 聊天详情页
@@ -330,6 +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_title'] = "您咨询的【{$inquiry_type_string}】服务已结束,点击查看详情。";
$data['notice_content'] = "您咨询{$user_doctor['user_name']}医生的服务已结束,请对本次问诊服务做出评价。您的评价对医生和其他患者也有很重要的参考价值。您也可以点击医生头像,进入医生主页关注医生。";
$data['link_type'] = 10;// 聊天详情页
@@ -414,6 +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_title'] = "{$user_doctor['user_name']}医生为您开具的电子处方已审核通过,点击查看详情。";
$data['notice_content'] = "{$user_doctor['user_name']}医生为您开具的电子处方已审核通过,您可以点击查看处方进行购买药品。";
$data['link_type'] = 13;
@@ -490,6 +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_title'] = "【优惠劵名称】已到账";
$data['notice_content'] = "有新的优惠劵已下发至您的账户中,点击查看详情!";
$data['link_type'] = 7;
@@ -541,6 +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_title'] = "【优惠劵名称】已退还";
$data['notice_content'] = "您有优惠劵已退还至您的账户,请点击查看详情!";
$data['link_type'] = 7;
@@ -592,6 +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_title'] = "【优惠劵名称】即将过期";
$data['notice_content'] = "您有一张优惠劵即将过期,点击查看详情!";
$data['link_type'] = 7;
@@ -640,14 +649,17 @@ class MessagePush extends BaseService
$data['from_name'] = "肝胆小秘书";
if ($type == 1){
// 已支付未接诊
$data['notice_brief_type'] = "您咨询的【{$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_title'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功";
$data['notice_content'] = "当前服务排队人较多,暂无空闲医生为您接诊,平台会在24小时内给您退款至原账户中,带来的不便敬请谅解。";
}elseif ($type == 2){
// 已支付未接诊患者取消订单
$data['notice_brief_type'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功,点击查看详情。";
$data['notice_title'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功";
$data['notice_content'] = "您已取消成功当前服务,平台会在24小时内给您退还至原账户中,带来的不便敬请谅解。";
}else{
@@ -693,31 +705,14 @@ class MessagePush extends BaseService
} 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['template_code'] = "SMS_272180110";
$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;
@@ -734,4 +729,446 @@ class MessagePush extends BaseService
return true;
}
/**
* 药品订单退款成功
* 站内、订阅、短信
* @param string $order_product_id
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function refundProductSuccess(string $order_product_id): bool
{
try {
// 获取药品订单数据
$params = array();
$params['order_product_id'] = $order_product_id;
$order_product = OrderProduct::getOne($params);
if (empty($order_product)){
throw new BusinessException("加入推送队列失败:药品订单数据为空");
}
// 获取药品订单商品数据
$params = array();
$params['order_product_id'] = $order_product_id;
$order_product_item = OrderProductItem::getList($params);
if (empty($order_product_item)){
throw new BusinessException("加入推送队列失败:商品订单列表数据为空");
}
// 获取商品数据
$product_name_array = array();
foreach ($order_product_item as $item){
$params = array();
$params['product_id'] = $item['product_id'];
$product = Product::getOne($params);
if (empty($product)){
throw new BusinessException("加入推送队列失败:商品数据为空");
}
$product_name_array[] = $product['common_name'];
}
$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_type'] = "您购买的【{$product_name}】药品,平台已退款成功,点击查看详情";
$data['notice_title'] = "您购买的【{$product_name}】药品,平台已退款成功";
$data['notice_content'] = "因平台特殊情况发生,导致您的药品无法邮寄。平台已进行退款处理,并退款成功,带来的不便敬请谅解。";
$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 == 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_string3" => $order_product['order_product_no'],// 订单号
"time5" => $order_product['cancel_time'],// 取消时间
"amount4" => $order_product['payment_amount_total'],// 退款金额
"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'];
$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;
}
/**
* 物流信息-暂时无法开发,无物流信息表
* 已揽收、已发货、自动收货
* 站内
* @param string $order_product_id
* @return bool
*/
public function logistics(string $order_product_id): bool
{
try {
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
* 药品已发货
* 订阅失败发送短信
* @param string $order_product_id
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function ProductDelivery(string $order_product_id): bool
{
try {
// 获取药品订单数据
$params = array();
$params['order_product_id'] = $order_product_id;
$order_product = OrderProduct::getOne($params);
if (empty($order_product)){
throw new BusinessException("加入推送队列失败:药品订单数据为空");
}
// 获取药品订单商品数据
$params = array();
$params['order_product_id'] = $order_product_id;
$order_product_item = OrderProductItem::getList($params);
if (empty($order_product_item)){
throw new BusinessException("加入推送队列失败:商品订单列表数据为空");
}
// 获取商品数据
$product_name_array = array();
foreach ($order_product_item as $item){
$params = array();
$params['product_id'] = $item['product_id'];
$product = Product::getOne($params);
if (empty($product)){
throw new BusinessException("加入推送队列失败:商品数据为空");
}
$product_name_array[] = $product['common_name'];
}
$product_name = implode('、',$product_name_array);
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/orderDetail/orderDetail?order_inquiry_id={$this->order_inquiry['order_inquiry_id']}";
$sub_data['params']['data'] = [
"character_string9" => $order_product['order_product_no'],// 快递单号
"time7" => $order_product['delivery_time'],// 发货时间
"thing3" => $order_product['province'] . $order_product['city'] . $order_product['county'],// 收货地址
"thing6" => $order_product['consignee_name'],// 收货人
"thing5" => "您的药品已发货,点击可以查看订单详情。",// 备注
];
// 短信
$sms_data = array();
$sms_data['template_code'] = "SMS_271980127";
$sms_data['scene_desc'] = "药品发货通知";
$sms_data['phone'] = $this->user['mobile'];
$sms_data['user_id'] = $this->user['user_id'];
$template_param = array();
$template_param['name'] = $product_name;
$template_param['code'] = $order_product['logistics_no'] ?: "";
$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 medicationReminder(string $order_product_id): bool
{
try {
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
* 新问诊
* 站内、订阅失败发送短信
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function newInquiry(): 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['inquiry_type'] = $this->order_inquiry['inquiry_type']; // 问诊类型(医生端服务通知存在 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
$data['from_name'] = "肝胆小秘书";
$data['notice_brief_type'] = "您有新的问诊咨询,请注意查看。";
$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);// 跳转参数
$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']);
$sub_data = array();
$sub_data['push_user_id'] = $this->user['user_id'];
$sub_data['template_title'] = "咨询提醒";
// $sub_data['params']['page'] = "Pages/yishi/chat/index?from_account={$this->order_inquiry['user_id']}&order_inquiry_id={$this->order_inquiry['order_inquiry_id']}&inquiry_type={$this->order_inquiry['inquiry_type']}";
$sub_data['params']['page'] = "Pages/yishi/wenzhen_v2/wenzhen";
$sub_data['params']['data'] = [
"thing1" => "您有新的患者向您发起了({$inquiry_type})服务,请您尽快上线接诊;",// 提醒内容
"name2" => $this->order_inquiry['patient_name'],// 患者姓名
"thing4" => (string)$user_doctor['user_name'],// 病情描述
"thing6" => "24小时内未接诊,平台将自动取消问诊。",// 提示说明
"thing5" => "",// 咨询内容
];
// 短信
$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'];
$template_param = array();
$template_param['type'] = inquiryTypeToString($this->order_inquiry['inquiry_type']);
$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;
}
/**
* 医生xx时间后还未接诊
* 站内、订阅失败发送短信
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function doctorNotYetInquiry(): 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_type'] = "{$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);// 跳转参数
$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']);
$sub_data = array();
$sub_data['push_user_id'] = $this->user['user_id'];
$sub_data['template_title'] = "咨询提醒";
// $sub_data['params']['page'] = "Pages/yishi/chat/index?from_account={$this->order_inquiry['user_id']}&order_inquiry_id={$this->order_inquiry['order_inquiry_id']}&inquiry_type={$this->order_inquiry['inquiry_type']}";
$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" => "",// 咨询内容
];
// 短信
$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'];
$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));
}
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
}
return true;
}
}
+16 -1
View File
@@ -7,6 +7,7 @@ use App\Model\OrderPrescription;
use App\Model\User;
use App\Model\UserPharmacist;
use App\Model\UserPharmacistInfo;
use Hyperf\DbConnection\Db;
/**
* 药师
@@ -157,7 +158,21 @@ class UserPharmacistService extends BaseService
return fail(HttpEnumCode::HTTP_ERROR,"处方已审核,请勿重复审核");
}
//
Db::beginTransaction();
try {
// 修改处方审核状态
$data = array();
Db::commit();
} catch (\Exception $e) {
Db::rollBack();
return fail(HttpEnumCode::HTTP_ERROR, $e->getMessage());
}
// 新增商品订单表
// 新增商品订单明细表
// 新增未支付取消订单队列