|
|
|
|
@ -205,8 +205,10 @@ class OrdersController extends CommonController
|
|
|
|
|
*/
|
|
|
|
|
public function artboard(Request $request)
|
|
|
|
|
{
|
|
|
|
|
$has_ongoing_order = $request->get('has_ongoing_order', 1);
|
|
|
|
|
$project_id = $request->get('project_id');
|
|
|
|
|
$projects = (new StatisticsController())->_checkProjects();
|
|
|
|
|
dd($projects);
|
|
|
|
|
$project_id = $request->get('project_id',$projects[0]->id);
|
|
|
|
|
|
|
|
|
|
$userId = auth()->id();
|
|
|
|
|
// 判断是否护士长
|
|
|
|
|
$roleId = Role::where('name', 'like', '%护士长%')->where('guard_name', 'admin')->value('id');
|
|
|
|
|
@ -230,11 +232,9 @@ class OrdersController extends CommonController
|
|
|
|
|
$query->where('project_id', $request->project_id);
|
|
|
|
|
}
|
|
|
|
|
})->with(['project',
|
|
|
|
|
"beds" => function ($query) use ($request, $has_ongoing_order) {
|
|
|
|
|
if ($has_ongoing_order) {
|
|
|
|
|
$query->has("onGoingOrder");
|
|
|
|
|
}
|
|
|
|
|
$query->whereHas('onGoingOrder')->with(["onGoingOrder" => function ($query) {
|
|
|
|
|
"beds" => function ($query) use ($request) {
|
|
|
|
|
$query->has("onGoingOrder");
|
|
|
|
|
$query->with(["onGoingOrder" => function ($query) {
|
|
|
|
|
$query->leftJoin("paramedic", "orders.paramedic_id", "=", "paramedic.id")
|
|
|
|
|
->select("orders.id", "orders.bed_id", "orders.paramedic_id", "orders.status", "paramedic.name as paramedic_name");
|
|
|
|
|
}])->select("bed.id", "bed.name", "bed.room_id", "bed.area_id", "bed.myindex")
|
|
|
|
|
@ -243,17 +243,16 @@ class OrdersController extends CommonController
|
|
|
|
|
->orderBy("room.name")
|
|
|
|
|
->orderBy("bed.name");
|
|
|
|
|
}])->orderBy("building.myindex")
|
|
|
|
|
->orderBy("building.myindex")
|
|
|
|
|
->orderBy("area.myindex")
|
|
|
|
|
->select("area.id", "area.name", "area.building_id", "area.project_id")
|
|
|
|
|
->leftJoin("building", "area.building_id", "=", "building.id")
|
|
|
|
|
->addSelect("building.name as building_name")
|
|
|
|
|
// ->addSelect([
|
|
|
|
|
// 'beds_count' => Bed::whereColumn('area_id', 'area.id')->selectRaw('count(1)'),
|
|
|
|
|
// ])
|
|
|
|
|
->withCount("beds")
|
|
|
|
|
->having('beds_count', '>', 0)
|
|
|
|
|
->paginate(10);
|
|
|
|
|
$projects = (new StatisticsController())->_checkProjects();
|
|
|
|
|
->get();
|
|
|
|
|
$data = $data->filter(function ($item) {
|
|
|
|
|
return $item->beds->count();
|
|
|
|
|
});
|
|
|
|
|
return view($this->bladePath . ".artboard", compact("data", "projects", "project_id"));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|