liyinglin 3 years ago
parent 0ba25906f0
commit 938424057c

@ -43,11 +43,19 @@ class OrdersController extends CommonController
$this->model = $this->model->whereRaw("UNIX_TIMESTAMP(`created_at`) >= " . $start_timestamp . " and UNIX_TIMESTAMP(`created_at`) < " . $end_timestamp);
$this->model = $this->model->where("project_id", $project_id);
$user = auth()->user();
$areaId = AdminAreaLink::where('project_id', $project_id)->where('admin_id', $user->id)->pluck('area_id');
$bedList = Bed::whereIn('area_id',$areaId)->pluck('id');
if ($request->keyword) {
$this->model = $this->model->where(function ($query) use ($request) {
$query->where("serial", "like", "%" . $request->keyword . "%")
->orWhere("contact", "like", "%" . $request->keyword . "%")
->orWhere("mobile", "like", "%" . $request->keyword . "%");
})->where(function ($query) use ($bedList) {
if ($bedList) {
$query->whereIn('bed_id', $bedList);
}
});
}
@ -67,7 +75,7 @@ class OrdersController extends CommonController
"customer",
"manager",
"bed" => function ($query) {
$query->with(["room", "building"]);
$query->with(["room", "building","area"]);
}
])
->orderBy("id", "desc");

@ -37,6 +37,8 @@
<tr>
<th>订单编号</th>
<th>所属项目/医院</th>
<th>所在楼栋</th>
<th>所在病区</th>
<th>客户科室</th>
<th>客户姓名</th>
<th>客户余额</th>
@ -56,6 +58,8 @@
{{ $row->serial }}
</td>
<td>{{ $row->project->name }}</td>
<td>{{ $row->bed->building->name }}</td>
<td>{{ $row->bed->area->name }}</td>
<td>{{ $row->department }}</td>
<td>{{ $row->customer->name ?: $row->patient->name }}</td>
<td>{{ $row->customer->balance }}</td>

Loading…
Cancel
Save