新增问诊订单自动完成延迟队列
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Amqp\Producer\AutoFinishInquiryDelayDirectProducer;
|
||||
use App\Amqp\Producer\CancelUnInquiryOrdersDelayDirectProducer;
|
||||
use App\Amqp\Producer\CancelUnPayInquiryOrderDelayProducer;
|
||||
use App\Amqp\Producer\CancelUnpayOrdersDelayDirectProducer;
|
||||
@@ -276,6 +277,7 @@ class InquiryService extends BaseService
|
||||
}
|
||||
|
||||
// 加入未接诊取消订单延迟队列
|
||||
// 专家问诊-公益问诊
|
||||
if (!empty($request_params['doctor_id']) && ($request_params['inquiry_type'] == 1 || $request_params['inquiry_type'] == 3)){
|
||||
$data = array();
|
||||
$data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
|
||||
@@ -395,6 +395,8 @@ class MessagePush extends BaseService
|
||||
// 获取问诊订单处方数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
|
||||
$params['pharmacist_audit_status'] = 1;
|
||||
$order_prescription = OrderPrescription::getOne($params);
|
||||
if (empty($order_prescription)) {
|
||||
throw new BusinessException("加入推送队列失败:处方数据为空");
|
||||
@@ -1167,6 +1169,8 @@ class MessagePush extends BaseService
|
||||
// 获取问诊订单处方数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
|
||||
$params['pharmacist_audit_status'] = 1;
|
||||
$order_prescription = OrderPrescription::getOne($params);
|
||||
if (empty($order_prescription)) {
|
||||
throw new BusinessException("加入推送队列失败:处方数据为空");
|
||||
@@ -1244,12 +1248,12 @@ class MessagePush extends BaseService
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function prescriptionVerifyFail(): bool
|
||||
public function prescriptionVerifyFail(string $order_prescription_id): bool
|
||||
{
|
||||
try {
|
||||
// 获取问诊订单处方数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||
$params['order_prescription_id'] = $order_prescription_id;
|
||||
$order_prescription = OrderPrescription::getOne($params);
|
||||
if (empty($order_prescription)) {
|
||||
throw new BusinessException("加入推送队列失败:处方数据为空");
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Services;
|
||||
|
||||
use App\Amqp\Producer\AssignPharmacistProducer;
|
||||
use App\Amqp\Producer\AutoCompleteInquiryDelayDirectProducer;
|
||||
use App\Amqp\Producer\AutoFinishInquiryDelayDirectProducer;
|
||||
use App\Constants\DoctorTitleCode;
|
||||
use App\Constants\HttpEnumCode;
|
||||
@@ -1636,6 +1637,29 @@ class UserDoctorService extends BaseService
|
||||
$MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->patientAcceptedInquiry();
|
||||
|
||||
if ($order_inquiry['inquiry_type'] == 1 || $order_inquiry['inquiry_type'] == 3){
|
||||
// 专家问诊-公益问诊
|
||||
$time = 1000 * 60 * 60;
|
||||
}elseif($order_inquiry['inquiry_type'] == 2){
|
||||
// 快速问诊
|
||||
$time = 1000 * 60 * 30;
|
||||
}else{
|
||||
// 购药
|
||||
$time = 1000 * 60 * 30;
|
||||
}
|
||||
|
||||
// 添加自动完成队列
|
||||
$data = array();
|
||||
$data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
|
||||
$message = new AutoCompleteInquiryDelayDirectProducer($data);
|
||||
$message->setDelayMs($time);
|
||||
$producer = $this->container->get(Producer::class);
|
||||
$res = $producer->produce($message);
|
||||
if (!$res) {
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败");
|
||||
}
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
Db::rollBack();
|
||||
|
||||
@@ -266,7 +266,7 @@ class UserPharmacistService extends BaseService
|
||||
}else{
|
||||
// 站内、订阅失败发送短信-医生开具的处方审核未通过
|
||||
$MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->prescriptionVerifyFail();
|
||||
$MessagePush->prescriptionVerifyFail($order_prescription['order_prescription_id']);
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
|
||||
Reference in New Issue
Block a user