liyinglin 2 years ago
parent 21ed461c3a
commit 4f28be262d

@ -460,6 +460,11 @@ class StatisticsController extends CommonController
$area = Area::withCount('beds')->where('project_id', $project_id)->get();
$beds = Bed::whereIn('area_id', $area->pluck('id'))->where('project_id', $project_id)->get();
$totalBed = $beds->count();
// 订单总数
$orderTotal = Orders::where('project_id', $project_id)
->where('created_at', 'like', '%' . $month . '%')
->whereIn('bed_id', $beds->pluck('id'))
->count();
foreach ($area as $item) {
// 床位占比
$item->bed_rate = 0;
@ -473,12 +478,12 @@ class StatisticsController extends CommonController
->whereIn('bed_id', $bedsIdTemp)
->count();
$item->rate = 0;
if ($totalBed) {
if ($bedsIdTemp->count()) {
// 配比
$item->rate = round($item->order_total / $totalBed, 4) * 100;
$item->rate = round($item->order_total / $bedsIdTemp->count(), 4) * 100;
}
}
return view($this->bladePath . ".bed", compact("area", "totalBed", "project", "project_id", "month", "projects"));
return view($this->bladePath . ".bed", compact("area", "orderTotal", "totalBed", "project", "project_id", "month", "projects"));
}
}

@ -31,7 +31,7 @@
<th class="p-1" style="white-space: nowrap">病区</th>
<th class="p-1" style="white-space: nowrap">床位数量(总数:{{$totalBed}})</th>
<th class="p-1" style="white-space: nowrap">床位占比</th>
<th class="p-1" style="white-space: nowrap">订单数量</th>
<th class="p-1" style="white-space: nowrap">订单数量(总数:{{$orderTotal}})</th>
<th class="p-1" style="white-space: nowrap">护工配比</th>
</tr>
</thead>

Loading…
Cancel
Save