删除检测订单

This commit is contained in:
wucongxing 2023-08-04 11:30:18 +08:00
parent 7bcf4e9fb7
commit 20faf6f59e
2 changed files with 49 additions and 0 deletions

View File

@ -263,4 +263,15 @@ class PatientOrderController extends AbstractController
$data = $PatientOrderService->getPatientDetectionOrderInfo();
return $this->response->json($data);
}
/**
* 删除检测订单
* @return ResponseInterface
*/
public function deletePatientDetectionOrder(): ResponseInterface
{
$PatientOrderService = new PatientOrderService();
$data = $PatientOrderService->deletePatientDetectionOrder();
return $this->response->json($data);
}
}

View File

@ -1742,6 +1742,44 @@ class PatientOrderService extends BaseService
return success($order_detection);
}
/**
* 删除检测订单
* @return array
*/
public function deletePatientDetectionOrder(): array
{
$user_info = $this->request->getAttribute("userInfo") ?? [];
$order_detection_id = $this->request->route('order_detection_id');
// 获取订单数据
$params = array();
$params['patient_id'] = $user_info['client_user_id'];
$params['order_detection_id'] = $order_detection_id;
$params['is_delete'] = 0;
$order_detection = OrderDetection::getOne($params);
if (empty($order_detection)) {
return fail();
}
// 检测订单状态
if (!in_array($order_detection['detection_status'], [5])) {
// 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消)
return fail(HttpEnumCode::HTTP_ERROR, "订单无法删除");
}
// 修改订单删除状态
$data = array();
$data['is_delete'] = 1;
$params = array();
$params['order_detection_id'] = $order_detection['order_detection_id'];
OrderDetection::editOrderDetection($params, $data);
return success();
}
/**
* 获取患者未完成订单