新增消息推送
This commit is contained in:
parent
67c99d2db5
commit
4701bb2bce
@ -11,6 +11,7 @@ use App\Model\OrderInquiry;
|
|||||||
use App\Model\UserDoctor;
|
use App\Model\UserDoctor;
|
||||||
use App\Services\ImService;
|
use App\Services\ImService;
|
||||||
use App\Services\InquiryService;
|
use App\Services\InquiryService;
|
||||||
|
use App\Services\MessagePush;
|
||||||
use App\Services\UserDoctorService;
|
use App\Services\UserDoctorService;
|
||||||
use App\Utils\Log;
|
use App\Utils\Log;
|
||||||
use Extend\TencentIm\Message;
|
use Extend\TencentIm\Message;
|
||||||
@ -192,6 +193,10 @@ class AssignDoctorConsumer extends ConsumerMessage
|
|||||||
$imService = new ImService();
|
$imService = new ImService();
|
||||||
$imService->waitDoctorInquiry($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id']);
|
$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("分配医生成功,发送系统问诊消息成功");
|
Log::getInstance()->info("分配医生成功,发送系统问诊消息成功");
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// 验证失败
|
// 验证失败
|
||||||
|
|||||||
@ -529,7 +529,25 @@ class CallBackController extends AbstractController
|
|||||||
|
|
||||||
Log::getInstance()->info("药品微信退款回调数据处理成功");
|
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();
|
return $server->serve();
|
||||||
|
|||||||
@ -260,6 +260,8 @@ class InquiryService extends BaseService
|
|||||||
UserCoupon::edit($params, $data);
|
UserCoupon::edit($params, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 增加至取消订单延迟队列
|
// 增加至取消订单延迟队列
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['order_no'] = $order_inquiry['inquiry_no'];
|
$data['order_no'] = $order_inquiry['inquiry_no'];
|
||||||
@ -294,6 +296,18 @@ class InquiryService extends BaseService
|
|||||||
return fail(HttpEnumCode::HTTP_ERROR, $e->getMessage());
|
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 = array();
|
||||||
$result['inquiry_no'] = (string)$order_inquiry['inquiry_no']; // 订单编号
|
$result['inquiry_no'] = (string)$order_inquiry['inquiry_no']; // 订单编号
|
||||||
$result['order_inquiry_id'] = (string)$order_inquiry['order_inquiry_id']; // 订单主键id
|
$result['order_inquiry_id'] = (string)$order_inquiry['order_inquiry_id']; // 订单主键id
|
||||||
|
|||||||
@ -711,7 +711,6 @@ class MessagePush extends BaseService
|
|||||||
|
|
||||||
$product_name = implode('、',$product_name_array);
|
$product_name = implode('、',$product_name_array);
|
||||||
|
|
||||||
if ($this->push_type == 1) {
|
|
||||||
// 站内
|
// 站内
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['user_id'] = $this->user['user_id'];
|
$data['user_id'] = $this->user['user_id'];
|
||||||
@ -734,7 +733,7 @@ class MessagePush extends BaseService
|
|||||||
if (!$result) {
|
if (!$result) {
|
||||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||||
}
|
}
|
||||||
} elseif ($this->push_type == 2) {
|
|
||||||
// 订阅
|
// 订阅
|
||||||
$sub_data = array();
|
$sub_data = array();
|
||||||
$sub_data['push_user_id'] = $this->user['user_id'];
|
$sub_data['push_user_id'] = $this->user['user_id'];
|
||||||
@ -763,7 +762,7 @@ class MessagePush extends BaseService
|
|||||||
if (!$result) {
|
if (!$result) {
|
||||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||||
}
|
}
|
||||||
} elseif ($this->push_type == 3) {
|
|
||||||
// 短信
|
// 短信
|
||||||
// 获取系统接诊配置
|
// 获取系统接诊配置
|
||||||
$data = array();
|
$data = array();
|
||||||
@ -784,7 +783,6 @@ class MessagePush extends BaseService
|
|||||||
if (!$result) {
|
if (!$result) {
|
||||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||||
}
|
}
|
||||||
@ -939,7 +937,6 @@ class MessagePush extends BaseService
|
|||||||
throw new BusinessException("加入推送队列失败:医生数据为空");
|
throw new BusinessException("加入推送队列失败:医生数据为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->push_type == 1) {
|
|
||||||
// 站内
|
// 站内
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['user_id'] = $this->user['user_id'];
|
$data['user_id'] = $this->user['user_id'];
|
||||||
@ -964,7 +961,7 @@ class MessagePush extends BaseService
|
|||||||
if (!$result) {
|
if (!$result) {
|
||||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||||
}
|
}
|
||||||
} elseif ($this->push_type == 2) {
|
|
||||||
// 订阅
|
// 订阅
|
||||||
$inquiry_type = inquiryTypeToString($this->order_inquiry['inquiry_type']);
|
$inquiry_type = inquiryTypeToString($this->order_inquiry['inquiry_type']);
|
||||||
|
|
||||||
@ -1005,8 +1002,6 @@ class MessagePush extends BaseService
|
|||||||
if (!$result) {
|
if (!$result) {
|
||||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||||
}
|
}
|
||||||
@ -1128,7 +1123,6 @@ class MessagePush extends BaseService
|
|||||||
throw new BusinessException("加入推送队列失败:问诊病例为空");
|
throw new BusinessException("加入推送队列失败:问诊病例为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->push_type == 1) {
|
|
||||||
// 站内
|
// 站内
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['user_id'] = $this->user['user_id'];
|
$data['user_id'] = $this->user['user_id'];
|
||||||
@ -1150,7 +1144,6 @@ class MessagePush extends BaseService
|
|||||||
if (!$result) {
|
if (!$result) {
|
||||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||||
}
|
}
|
||||||
@ -1176,7 +1169,6 @@ class MessagePush extends BaseService
|
|||||||
throw new BusinessException("加入推送队列失败:处方数据为空");
|
throw new BusinessException("加入推送队列失败:处方数据为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->push_type == 1) {
|
|
||||||
// 站内
|
// 站内
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['user_id'] = $this->user['user_id'];
|
$data['user_id'] = $this->user['user_id'];
|
||||||
@ -1201,7 +1193,7 @@ class MessagePush extends BaseService
|
|||||||
if (!$result) {
|
if (!$result) {
|
||||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||||
}
|
}
|
||||||
} elseif ($this->push_type == 2) {
|
|
||||||
// 订阅
|
// 订阅
|
||||||
$sub_data = array();
|
$sub_data = array();
|
||||||
$sub_data['push_user_id'] = $this->user['user_id'];
|
$sub_data['push_user_id'] = $this->user['user_id'];
|
||||||
@ -1235,8 +1227,6 @@ class MessagePush extends BaseService
|
|||||||
if (!$result) {
|
if (!$result) {
|
||||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||||
}
|
}
|
||||||
@ -1262,7 +1252,6 @@ class MessagePush extends BaseService
|
|||||||
throw new BusinessException("加入推送队列失败:处方数据为空");
|
throw new BusinessException("加入推送队列失败:处方数据为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->push_type == 2) {
|
|
||||||
// 订阅
|
// 订阅
|
||||||
$sub_data = array();
|
$sub_data = array();
|
||||||
$sub_data['push_user_id'] = $this->user['user_id'];
|
$sub_data['push_user_id'] = $this->user['user_id'];
|
||||||
@ -1296,7 +1285,6 @@ class MessagePush extends BaseService
|
|||||||
if (!$result) {
|
if (!$result) {
|
||||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1713,6 +1713,10 @@ class UserDoctorService extends BaseService
|
|||||||
$imService = new ImService();
|
$imService = new ImService();
|
||||||
$imService->inquiryEnd($order_inquiry,$user_info['user_id'],$order_inquiry['user_id']);
|
$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();
|
Db::commit();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Db::rollBack();
|
Db::rollBack();
|
||||||
|
|||||||
@ -235,10 +235,21 @@ class UserPharmacistService extends BaseService
|
|||||||
$imService = new ImService();
|
$imService = new ImService();
|
||||||
$imService->prescriptionIssued($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id'],$product_name,(string)$order_prescription['order_prescription_id'],"7");
|
$imService->prescriptionIssued($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id'],$product_name,(string)$order_prescription['order_prescription_id'],"7");
|
||||||
|
|
||||||
|
if ($pharmacist_audit_status == 1){
|
||||||
// 发送站内、短信消息-患者的处方被药师审核通过
|
// 发送站内、短信消息-患者的处方被药师审核通过
|
||||||
$MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['order_inquiry_id']);
|
$MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['order_inquiry_id']);
|
||||||
$MessagePush->patientPrescriptionVerifyPass();
|
$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();
|
Db::commit();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Db::rollBack();
|
Db::rollBack();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user