|
|
|
|
@ -550,7 +550,7 @@ class OrdersController extends CommonController
|
|
|
|
|
DB::beginTransaction();
|
|
|
|
|
try {
|
|
|
|
|
$order = Orders::with(["customer", "patient", "product", "productItem", "productParamedicLevel"])->find($id);
|
|
|
|
|
if (request()->paramedic_id && (request()->paramedic_id != $order->paramedic_id)) {
|
|
|
|
|
if (request()->paramedic_id && $order->paramedic_id && (request()->paramedic_id != $order->paramedic_id)) {
|
|
|
|
|
return response()->json([
|
|
|
|
|
"errorcode" => "103",
|
|
|
|
|
"errormsg" => "修改订单不包含护工更改,更换护工请移步"
|
|
|
|
|
@ -598,6 +598,16 @@ class OrdersController extends CommonController
|
|
|
|
|
$update["factors"] = json_encode($factors);
|
|
|
|
|
}
|
|
|
|
|
$order->update($update);
|
|
|
|
|
|
|
|
|
|
//如果原本的护工id为空且新提交了护工id,视同为派单
|
|
|
|
|
if (!$order->paramedic_id && request()->paramedic_id) {
|
|
|
|
|
$order->update([
|
|
|
|
|
"paramedic_id" => request()->paramedic_id,
|
|
|
|
|
"status" => Orders::STATUS_ONGOING
|
|
|
|
|
]);
|
|
|
|
|
event(new OrderAssigned($order));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DB::commit();
|
|
|
|
|
return response()->json($order->toArray());
|
|
|
|
|
} catch (\Exception $exception) {
|
|
|
|
|
|