新增检测回调、修改自动完成订单、新增im推送、

This commit is contained in:
2023-08-09 11:27:56 +08:00
parent 00937e9154
commit 3bb279ab57
9 changed files with 402 additions and 28 deletions
+65 -4
View File
@@ -1394,7 +1394,7 @@ class MessagePush extends BaseService
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function prescriptionVerifyFail(string $order_prescription_id): void
public function prescriptionVerifyFail(string $order_prescription_id = ""): void
{
try {
// 获取问诊订单处方数据
@@ -2232,14 +2232,14 @@ class MessagePush extends BaseService
}
/**
* 患者-订单取消成功通知
* 患者-检测订单取消成功通知
* 订阅
* @param string $order_detection_id
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function patientCancelOrderSuccess(string $order_detection_id): void
public function patientCancelDetectionOrderSuccess(string $order_detection_id): void
{
try {
// 获取检测订单
@@ -2263,7 +2263,7 @@ class MessagePush extends BaseService
$sub_data = array();
$sub_data['push_user_id'] = $this->user['user_id'];
$sub_data['wx_template_id'] = "5aJSrO8SU5rxqdB99zzl4rMVgcOTjt5mQh56cpZI1Hg";//咨询提醒
$sub_data['params']['page'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id=" . $order_detection['order_detection_id'];
$sub_data['params']['page'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id=" . $order_detection['detection_no'];
$sub_data['params']['data'] = [
"thing1" => $order_detection['patient_name'],// 就诊人
"thing7" => (string)$detection_project['detection_project_name'],// 服务项目
@@ -2286,4 +2286,65 @@ class MessagePush extends BaseService
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage());
}
}
// 患者-新报告生成通知
// 订阅发送失败发送短信
public function patientDetectionResultNotice(string $order_detection_id){
try {
// 获取检测订单
$params = array();
$params['order_detection_id'] = $order_detection_id;
$order_detection = OrderDetection::getOne($params);
if (empty($order_detection)) {
Log::getInstance("MessagePush-patientDetectionResultNotice")->error("错误:加入推送队列失败,无检测订单数据");
return;
}
// 获取检测项目
$params = array();
$params['detection_project_id'] = $order_detection['detection_project_id'];
$detection_project = DetectionProject::getOne($params);
if (empty($detection_project)){
Log::getInstance("MessagePush-patientDetectionResultNotice")->error("错误:加入推送队列失败,检测项目错误");
return;
}
// 订阅
$sub_data = array();
$sub_data['push_user_id'] = $this->user['user_id'];
$sub_data['wx_template_id'] = "dNj3azLupP_w3j649v6lqz7je_ScqwgwFsnug6pKvyI"; // 处方审核结果通知
$sub_data['params']['page'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id=" . $order_detection['detection_no'];
$sub_data['params']['data'] = [
"thing1" => $order_detection['patient_name'],// 报告名称
"time3" => (string)$detection_project['detection_project_name'],// 生成时间
"thing9" => date('Y年m月d日 H:i'),// 就诊人
"thing4" => $order_detection['payment_amount_total'],// 单位名称-检测所名称
"thing8" => "订单取消成功,支付金额将立即原路退回。",// 测评结果
];
// 短信
$sms_data = array();
$sms_data['template_code'] = "SMS_271905264";
$sms_data['scene_desc'] = "您为{$this->order_inquiry['patient_name']}患者开具的电子处方药师审核不通过,请尽快前往微信小程序“处方管理”中查看原因,并重开处方。模版code:SMS_271905264";
$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) {
Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
Log::getInstance("MessagePush")->error("错误:加入站内推送队列失败" . $e->getMessage());
}
}
}