|
|
|
|
@ -35,9 +35,11 @@ class StatisticsController extends CommonController
|
|
|
|
|
$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")
|
|
|
|
|
}])->select("bed.id", "bed.name", "bed.room_id", "bed.area_id", "bed.myindex")
|
|
|
|
|
->leftJoin("room", "bed.room_id", "=", "room.id")
|
|
|
|
|
->addSelect("room.name as room_name");
|
|
|
|
|
->addSelect("room.name as room_name")
|
|
|
|
|
->orderBy("room.myindex")
|
|
|
|
|
->orderBy("bed.myindex");
|
|
|
|
|
}])
|
|
|
|
|
->whereRaw("`area`.`project_id` = '{$request->project_id}'")
|
|
|
|
|
->orderBy("building.myindex")
|
|
|
|
|
@ -46,9 +48,8 @@ class StatisticsController extends CommonController
|
|
|
|
|
->leftJoin("building", "area.building_id", "=", "building.id")
|
|
|
|
|
->addSelect("building.name as building_name")
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
if ($request->has_ongoing_order) {
|
|
|
|
|
$areas = $areas->filter(function($item) {
|
|
|
|
|
$areas = $areas->filter(function ($item) {
|
|
|
|
|
return $item->beds->count();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|