You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.5 KiB

<?php
namespace App\Http\Controllers\Manager;
use App\Models\Area;
use App\Models\Bed;
use Illuminate\Http\Request;
class StatisticsController extends CommonController
{
/**
* @OA\Get(
* path="/manager/statistics/beds",
* summary="V2-获取项目中的床位陪护一览",
* description="获取项目中的床位陪护一览",
* @OA\Parameter(name="project_id", in="query", @OA\Schema(type="integer"), required=true, description="医院ID"),
* @OA\Parameter(name="has_ongoing_order", in="query", @OA\Schema(type="integer"), required=false, description="是否包含正在服务的订单,默认为不筛选"),
* @OA\Response(
* response="200",
* description="获取项目中的床位陪护一览"
* )
* )
*/
public function beds(Request $request)
{
$areas = Area::with(["beds" => function ($query) use ($request) {
if ($request->has_ongoing_order) {
$query->has("onGoingOrder");
}
$query->with(["onGoingOrder" => function ($query) {
$query->with(["paramedic" => function ($query) {
$query->select("id", "name");
}])->select("id", "bed_id", "paramedic_id", "status");
}]);
}])->with("building")->where("project_id", $request->project_id)->orderBy("building_id")->orderBy("myindex")->get();
return response()->json($areas->toArray());
}
}