新增用药天数
This commit is contained in:
parent
249c585724
commit
4fa343a9d3
@ -32,9 +32,6 @@ class AssignDoctorConsumer extends ConsumerMessage
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param $data
|
* @param $data
|
||||||
* [
|
|
||||||
* "order_inquiry_id":"问诊订单id"
|
|
||||||
* ]
|
|
||||||
* @param AMQPMessage $message
|
* @param AMQPMessage $message
|
||||||
* @return string
|
* @return string
|
||||||
* @throws ContainerExceptionInterface
|
* @throws ContainerExceptionInterface
|
||||||
|
|||||||
52
app/Amqp/Consumer/AssignPharmacistConsumer.php
Normal file
52
app/Amqp/Consumer/AssignPharmacistConsumer.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Amqp\Consumer;
|
||||||
|
|
||||||
|
use App\Model\OrderPrescription;
|
||||||
|
use App\Utils\Log;
|
||||||
|
use Hyperf\Amqp\Result;
|
||||||
|
use Hyperf\Amqp\Annotation\Consumer;
|
||||||
|
use Hyperf\Amqp\Message\ConsumerMessage;
|
||||||
|
use Hyperf\DbConnection\Db;
|
||||||
|
use PhpAmqpLib\Message\AMQPMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分配药师
|
||||||
|
*/
|
||||||
|
#[Consumer(exchange: 'amqp.direct', routingKey: 'AssignPharmacist', queue: 'assign.pharmacist.queue', nums: 1)]
|
||||||
|
class AssignPharmacistConsumer extends ConsumerMessage
|
||||||
|
{
|
||||||
|
public function consumeMessage($data, AMQPMessage $message): string
|
||||||
|
{
|
||||||
|
Log::getInstance()->error("开始执行 分配药师 队列:" . json_encode($data, JSON_UNESCAPED_UNICODE));
|
||||||
|
|
||||||
|
Db::beginTransaction();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 获取订单-处方表数据
|
||||||
|
$params = array();
|
||||||
|
$params['order_prescription_id'] = $data['order_prescription_id'];
|
||||||
|
$order_prescription = OrderPrescription::getOne($params);
|
||||||
|
if (empty($order_prescription)){
|
||||||
|
Db::rollBack();
|
||||||
|
Log::getInstance()->error("分配药师队列执行失败:未查询到对应处方订单数据");
|
||||||
|
return Result::DROP;// 销毁
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检测处方状态
|
||||||
|
if ($order_prescription['prescription_status'] != 1){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Db::rollBack();
|
||||||
|
Log::getInstance()->error("分配药师队列执行失败原因:" . $e->getMessage());
|
||||||
|
return Result::REQUEUE; // 重回队列
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result::ACK;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -14,6 +14,12 @@ use Hyperf\Amqp\Message\ProducerMessage;
|
|||||||
#[Producer(exchange: 'amqp.direct', routingKey: 'AssignDoctor')]
|
#[Producer(exchange: 'amqp.direct', routingKey: 'AssignDoctor')]
|
||||||
class AssignDoctorProducer extends ProducerMessage
|
class AssignDoctorProducer extends ProducerMessage
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @param $data
|
||||||
|
* [
|
||||||
|
* "order_inquiry_id":"问诊订单id"
|
||||||
|
* ]
|
||||||
|
*/
|
||||||
public function __construct($data)
|
public function __construct($data)
|
||||||
{
|
{
|
||||||
$this->payload = $data;
|
$this->payload = $data;
|
||||||
|
|||||||
26
app/Amqp/Producer/AssignPharmacistProducer.php
Normal file
26
app/Amqp/Producer/AssignPharmacistProducer.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Amqp\Producer;
|
||||||
|
|
||||||
|
use Hyperf\Amqp\Annotation\Producer;
|
||||||
|
use Hyperf\Amqp\Message\ProducerMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分配药师
|
||||||
|
*/
|
||||||
|
#[Producer(exchange: 'amqp.direct', routingKey: 'AssignPharmacist')]
|
||||||
|
class AssignPharmacistProducer extends ProducerMessage
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param $data
|
||||||
|
* [
|
||||||
|
* "order_prescription_id":"处方订单id"
|
||||||
|
* ]
|
||||||
|
*/
|
||||||
|
public function __construct($data)
|
||||||
|
{
|
||||||
|
$this->payload = $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -70,6 +70,7 @@ class OrderPrescriptionService extends BaseService
|
|||||||
$data['single_use'] = $order_prescription_product['single_use'] ?? "";
|
$data['single_use'] = $order_prescription_product['single_use'] ?? "";
|
||||||
$data['packaging_unit'] = $order_prescription_product['packaging_unit'] ?? "";
|
$data['packaging_unit'] = $order_prescription_product['packaging_unit'] ?? "";
|
||||||
$data['frequency_use'] = $order_prescription_product['frequency_use'] ?? "";
|
$data['frequency_use'] = $order_prescription_product['frequency_use'] ?? "";
|
||||||
|
$data['available_days'] = $order_prescription_product['available_days'] ?? 0;
|
||||||
|
|
||||||
$result[] = $data;
|
$result[] = $data;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1149,8 +1149,6 @@ class UserDoctorService extends BaseService
|
|||||||
// 获取医生信息
|
// 获取医生信息
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['doctor_id'] = $user_info['client_user_id'];
|
$params['doctor_id'] = $user_info['client_user_id'];
|
||||||
|
|
||||||
|
|
||||||
$user_doctor = UserDoctor::getOne($params);
|
$user_doctor = UserDoctor::getOne($params);
|
||||||
if (empty($user_doctor)) {
|
if (empty($user_doctor)) {
|
||||||
return fail(HttpEnumCode::HTTP_ERROR, "非法医生");
|
return fail(HttpEnumCode::HTTP_ERROR, "非法医生");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user