新增自动完成订单,处理处方数据,修改获取问诊评价返回内容
This commit is contained in:
@@ -34,14 +34,14 @@ class PrescriptionExpiredDelayDirectConsumer extends ConsumerMessage
|
||||
|
||||
public function consumeMessage($data, AMQPMessage $message): string
|
||||
{
|
||||
Log::getInstance()->error("开始执行 自动取消未使用处方 队列:" . json_encode($data, JSON_UNESCAPED_UNICODE));
|
||||
Log::getInstance()->error("开始执行 处方过期 队列:" . json_encode($data, JSON_UNESCAPED_UNICODE));
|
||||
|
||||
Db::beginTransaction();
|
||||
try {
|
||||
// 验证参数
|
||||
if (!isset($data['order_prescription_id'])){
|
||||
Db::rollBack();
|
||||
Log::getInstance()->error("自动取消未使用处方队列执行失败:入参错误");
|
||||
Log::getInstance()->error("处方过期队列执行失败:入参错误");
|
||||
return Result::DROP;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ class PrescriptionExpiredDelayDirectConsumer extends ConsumerMessage
|
||||
$order_prescription = OrderPrescription::getOne($params);
|
||||
if (empty($order_prescription)){
|
||||
Db::rollBack();
|
||||
Log::getInstance()->error("自动取消未使用处方队列执行失败:获取处方数据为空");
|
||||
Log::getInstance()->error("处方过期处方队列执行失败:获取处方数据为空");
|
||||
return Result::DROP;
|
||||
}
|
||||
|
||||
@@ -63,15 +63,14 @@ class PrescriptionExpiredDelayDirectConsumer extends ConsumerMessage
|
||||
}
|
||||
|
||||
// 处理处方过期状态
|
||||
|
||||
|
||||
$this->handlePrescription($order_prescription);
|
||||
|
||||
Db::commit();
|
||||
Log::getInstance()->info("自动取消未使用处方 队列执行成功");
|
||||
Log::getInstance()->info("处方过期 队列执行成功");
|
||||
return Result::ACK;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollBack();
|
||||
Log::getInstance()->error("自动取消未使用处方 执行失败:" . $e->getMessage());
|
||||
Log::getInstance()->error("处方过期 执行失败:" . $e->getMessage());
|
||||
return Result::ACK; // 重回队列
|
||||
}
|
||||
}
|
||||
@@ -85,25 +84,31 @@ class PrescriptionExpiredDelayDirectConsumer extends ConsumerMessage
|
||||
{
|
||||
if ($order_prescription['prescription_status'] == 3){
|
||||
Db::rollBack();
|
||||
Log::getInstance()->info("自动取消未使用处方队列执行失败:处方已失效,无需处理");
|
||||
Log::getInstance()->info("处方过期 队列执行失败:处方已失效,无需处理");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($order_prescription['prescription_status'] == 4){
|
||||
Db::rollBack();
|
||||
Log::getInstance()->info("自动取消未使用处方队列执行失败:处方已使用,无需处理");
|
||||
Log::getInstance()->info("处方过期 队列执行失败:处方已使用,无需处理");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 处理处方
|
||||
protected function handlePrescription(array|object $order_prescription){
|
||||
$pamras = array();
|
||||
$pamras['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
||||
/**
|
||||
* 处理处方过期状态
|
||||
* @param array|object $order_prescription
|
||||
* @return void
|
||||
*/
|
||||
protected function handlePrescription(array|object $order_prescription): void
|
||||
{
|
||||
$params = array();
|
||||
$params['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
||||
|
||||
$data = array();
|
||||
$data['prescription_status'] = 3;
|
||||
|
||||
$data['expired_time'] = date('Y-m-d H:i:s',time());
|
||||
OrderPrescription::edit($params,$data);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user