新增推送 医生-患者取消问诊

This commit is contained in:
wucongxing 2023-04-17 19:57:52 +08:00
parent e6f1c96c30
commit 836e0c4b9e
2 changed files with 96 additions and 5 deletions

View File

@ -1107,7 +1107,7 @@ class MessagePush extends BaseService
}
/**
* 问诊结束
* 医生-问诊结束
* 站内
* 发送给医生
* @return bool
@ -1157,7 +1157,7 @@ class MessagePush extends BaseService
}
/**
* 医生开具的处方审核通过
* 医生-开具的处方审核通过
* 站内、订阅失败发送短信
* @return bool
* @throws ContainerExceptionInterface
@ -1242,7 +1242,7 @@ class MessagePush extends BaseService
}
/**
* 医生开具的处方审核未通过
* 医生-开具的处方审核未通过
* 订阅失败发送短信
* @param string $order_prescription_id
* @return bool
@ -1847,7 +1847,7 @@ class MessagePush extends BaseService
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function DoctorSystemUpgrade(string $date,string $function): bool
public function doctorSystemUpgrade(string $date,string $function): bool
{
try {
if ($this->push_type == 1) {
@ -1885,7 +1885,7 @@ class MessagePush extends BaseService
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function DoctorAgreementUpdate(string $title): bool
public function doctorAgreementUpdate(string $title): bool
{
try {
if ($this->push_type == 1) {
@ -1914,4 +1914,82 @@ class MessagePush extends BaseService
return true;
}
/**
* 医生-患者取消问诊
* 站内-订阅
* @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function patientCancelInquiryToDoctor(): bool
{
try {
// 获取医生数据
$params = array();
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
throw new BusinessException("加入推送队列失败:医生数据为空");
}
// 站内
$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'] = inquiryTypeToString($this->order_inquiry['inquiry_type']);
$data['notice_title'] = "患者已取消问诊咨询。";
$data['notice_content'] = "患者已取消问诊咨询,您可选择其他患者的问诊咨询进行接诊。";
$data['link_type'] = 3; // 问诊消息列表页
$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));
}
$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" => "问诊咨询已取消",// 提醒内容
"name2" => $this->order_inquiry['patient_name'],// 患者姓名
"thing4" => (string)$user_doctor['user_name'],// 病情描述
"thing6" => "您可以选择其他患者的问诊咨询进行接诊。",// 提示说明
"thing5" => "",// 咨询内容
];
$data = array();
$data['sub_data'] = $sub_data;
$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;
}
}

View File

@ -318,6 +318,19 @@ class PatientOrderService extends BaseService
$inquiryService->inquiryRefund($order_inquiry['order_inquiry_id'], "取消问诊");
}
// 获取医生数据
$params = array();
$params['doctor_id'] = $order_inquiry['doctor_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
Db::rollBack();
return fail(HttpEnumCode::SERVER_ERROR,"取消失败");
}
// 推送医生-患者取消问诊
$MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']);
$MessagePush->patientCancelInquiryToDoctor();
Db::commit();
} catch (\Exception $e) {
Db::rollBack();