|
|
|
|
@ -445,7 +445,8 @@ class OrdersController extends CommonController
|
|
|
|
|
$data = [
|
|
|
|
|
"name" => request()->name,
|
|
|
|
|
"sex" => request()->sex,
|
|
|
|
|
"age" => request()->age
|
|
|
|
|
"age" => request()->age,
|
|
|
|
|
"mobile" => request()->mobile
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$vo = (new Patient())->create($data);
|
|
|
|
|
@ -552,53 +553,6 @@ class OrdersController extends CommonController
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\POST(
|
|
|
|
|
* path="/manager/reserve-order/{id}",
|
|
|
|
|
* summary="预约/取消预约护工",
|
|
|
|
|
* description="预约/取消预约护工",
|
|
|
|
|
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
|
|
|
|
|
* @OA\Parameter(name="id", in="path", @OA\Schema(type="integer"), required=true, description="订单id"),
|
|
|
|
|
* @OA\Parameter(name="paramedic_id", in="query", @OA\Schema(type="integer"), required=false, description="预约的护工id,为空表示取消预约护工,恢复等待管理老师安排"),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response="200",
|
|
|
|
|
* description="预约/取消预约护工"
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public function reserveOrder($id)
|
|
|
|
|
{
|
|
|
|
|
$order = (new Orders())->with("orderItems")->find($id);
|
|
|
|
|
if ($order->status !== Orders::STATUS_UNCONFIRMED && $order->status !== Orders::STATUS_UNASSIGNED) {
|
|
|
|
|
return response()->json([
|
|
|
|
|
"errorcode" => 50001,
|
|
|
|
|
"errormsg" => "订单状态不适配"
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
if (Carbon::parse(date("Y-m-d"))->greaterThanOrEqualTo($order->from_date)) {
|
|
|
|
|
return response()->json([
|
|
|
|
|
"errorcode" => 50002,
|
|
|
|
|
"errormsg" => "开始服务日需晚于当前日期才可以进行预约。请联系管理老师或取消订单"
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DB::beginTransaction();
|
|
|
|
|
try {
|
|
|
|
|
$order->update([
|
|
|
|
|
"paramedic_id" => request()->paramedic_id
|
|
|
|
|
]);
|
|
|
|
|
DB::commit();
|
|
|
|
|
return response()->json($order);
|
|
|
|
|
} catch (\Exception $exception) {
|
|
|
|
|
DB::rollBack();
|
|
|
|
|
return response()->json([
|
|
|
|
|
"errorcode" => $exception->getCode(),
|
|
|
|
|
"errormsg" => $exception->getMessage()
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\POST(
|
|
|
|
|
* path="/manager/confirm-order/{id}",
|
|
|
|
|
|