新增自动完成订单,处理处方数据,修改获取问诊评价返回内容

This commit is contained in:
2023-04-08 16:02:18 +08:00
parent 67429ae31b
commit 3008c1f9bc
8 changed files with 118 additions and 21 deletions
+22
View File
@@ -2,6 +2,9 @@
namespace App\Services;
use App\Amqp\Consumer\PrescriptionExpiredDelayDirectConsumer;
use App\Amqp\Producer\AutoFinishInquiryDelayDirectProducer;
use App\Amqp\Producer\PrescriptionExpiredDelayDirectProducer;
use App\Constants\HttpEnumCode;
use App\Model\OrderInquiry;
use App\Model\OrderPrescription;
@@ -11,7 +14,10 @@ use App\Model\UserDoctor;
use App\Model\UserDoctorInfo;
use App\Model\UserPharmacist;
use App\Model\UserPharmacistInfo;
use Hyperf\Amqp\Producer;
use Hyperf\DbConnection\Db;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/**
* 药师
@@ -123,6 +129,8 @@ class UserPharmacistService extends BaseService
/**
* 审核处方
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function putPrescriptionVerify(): array
{
@@ -181,6 +189,7 @@ class UserPharmacistService extends BaseService
}
// 获取处方商品数据
$product_name = "";
$params = array();
$params['order_prescription_id'] = $order_prescription['order_prescription_id'];
$order_prescription_product = OrderPrescriptionProduct::getList($params);
@@ -241,6 +250,19 @@ class UserPharmacistService extends BaseService
// 发送目标不同,重新实例化
$MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']);
$MessagePush->prescriptionVerifySuccess();
// 添加处方过期队列
$data = array();
$data['order_prescription_id'] = (string)$order_prescription['order_prescription_id'];
$message = new PrescriptionExpiredDelayDirectProducer($data);
$message->setDelayMs(1000 * 60 * 60 * 24 * 3);
$producer = $this->container->get(Producer::class);
$res = $producer->produce($message);
if (!$res) {
Db::rollBack();
return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败");
}
}else{
// 站内、订阅失败发送短信-医生开具的处方审核未通过
$MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']);