|
|
|
|
@ -64,6 +64,11 @@ class StatisticsController extends CommonController
|
|
|
|
|
* type="decimal",
|
|
|
|
|
* description="今日应扣款"
|
|
|
|
|
* ),
|
|
|
|
|
* @OA\Property(
|
|
|
|
|
* property="paramedic_has_order",
|
|
|
|
|
* type="integer",
|
|
|
|
|
* description="今日上工人数(今日有正在进行中的订单的护工)"
|
|
|
|
|
* ),
|
|
|
|
|
* example={
|
|
|
|
|
* "orders_all": "999",
|
|
|
|
|
* "orders_pending": "60",
|
|
|
|
|
@ -71,7 +76,8 @@ class StatisticsController extends CommonController
|
|
|
|
|
* "orders_finished": "889",
|
|
|
|
|
* "orders_finished_today": "12",
|
|
|
|
|
* "paramedics": "126",
|
|
|
|
|
* "bill_today": "9980.00"
|
|
|
|
|
* "bill_today": "9980.00",
|
|
|
|
|
* "paramedic_has_order" : "10"
|
|
|
|
|
* }
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
@ -79,8 +85,9 @@ class StatisticsController extends CommonController
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function overview()
|
|
|
|
|
public function overview(Request $request)
|
|
|
|
|
{
|
|
|
|
|
DB::enableQueryLog();
|
|
|
|
|
$project_id = request()->project_id;
|
|
|
|
|
$counts = [];
|
|
|
|
|
$counts["orders_all"] = (new Orders())->ofProject($project_id)->count();
|
|
|
|
|
@ -104,6 +111,16 @@ class StatisticsController extends CommonController
|
|
|
|
|
->where("new_value", Orders::STATUS_ONGOING);
|
|
|
|
|
})->count();
|
|
|
|
|
|
|
|
|
|
$counts["orders_finished_in_today"] = (new Orders())->ofProject($project_id)->whereHas("audits", function($query) {
|
|
|
|
|
$query->whereRaw("DATEDIFF(`created_at`,now()) = 0")
|
|
|
|
|
->where("field_name","status")
|
|
|
|
|
->where("new_value", Orders::STATUS_FINISHED);
|
|
|
|
|
})->count();
|
|
|
|
|
|
|
|
|
|
if ($request->is_test) {
|
|
|
|
|
dd(DB::getQueryLog());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return response()->json(compact("counts"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|