liyinglin 2 years ago
parent 59c5ffd868
commit c3b806dbd1

@ -205,6 +205,7 @@ class OrdersController extends CommonController
*/
public function artboard(Request $request)
{
$has_ongoing_order = $request->get('has_ongoing_order',1);
$userId = auth()->id();
// 判断是否护士长
$roleId = Role::where('name', 'like', '%护士长%')->where('guard_name', 'admin')->value('id');
@ -227,9 +228,9 @@ class OrdersController extends CommonController
if ($request->project_id) {
$query->where('project_id', $request->project_id);
}
})->with([
"beds" => function ($query) use ($request) {
if ($request->has_ongoing_order) {
})->with(['project',
"beds" => function ($query) use ($request,$has_ongoing_order) {
if ($has_ongoing_order) {
$query->has("onGoingOrder");
}
$query->with(["onGoingOrder" => function ($query) {
@ -247,12 +248,11 @@ class OrdersController extends CommonController
->addSelect("building.name as building_name")
->withCount("beds")
->paginate(10);
if ($request->has_ongoing_order) {
if ($has_ongoing_order) {
$data = $data->filter(function ($item) {
return $item->beds->count();
});
}
dd($data->toArray());
return view($this->bladePath . ".artboard", compact("data"));

@ -20,4 +20,9 @@ class Area extends SoftDeletesModel
{
return $this->hasMany(Bed::class);
}
public function project()
{
return $this->hasOne(Project::class,'id','project_id');
}
}

@ -19,34 +19,21 @@
<table class="table table-bordered" id="data-table">
<thead>
<tr>
<th>订单编号</th>
<th>所属项目/医院</th>
<th>所在楼栋</th>
<th>所在病区</th>
<th>客户姓名</th>
<th>联系电话</th>
<th>被护理人</th>
<th>开始服务日期</th>
<th>评分</th>
<th>评价</th>
<th>操作</th>
<th>客户信息</th>
</tr>
</thead>
<tbody>
@foreach ($data as $row)
<tr data-id="{{$row->id}}">
<td>{{ $row->project->name }}</td>
<td>{{ $row->name }}</td>
<td>
{{ $row->serial }}
@foreach ($row->beds as $r)
{{$r->name}}-{{$r->}}
@endforeach
</td>
<td>{{ $row->project->name }}</td>
<td>{{ $row->bed->building->name }}</td>
<td>{{ $row->bed->area->name }}</td>
<td>{{ $row->customer->name ?: $row->patient->name }}</td>
<td>{{ $row->customer->mobile }}</td>
<td>{{ $row->patient->name }}</td>
<td>{{ $row->from_date }}</td>
<td>{{ $row->score }}</td>
<td>{{ $row->comment }}</td>
</tr>
@endforeach

Loading…
Cancel
Save