|
|
|
|
@ -69,7 +69,7 @@ class ProjectController extends CommonController
|
|
|
|
|
}]);
|
|
|
|
|
}])->find($id);
|
|
|
|
|
|
|
|
|
|
$data = (new Bed())->where("project_id", $id)->orderBy("id","desc")->with(["project", "building", "area", "room"])->paginate(10);
|
|
|
|
|
$data = (new Bed())->where("project_id", $id)->orderBy("id", "desc")->with(["project", "building", "area", "room"])->paginate(10);
|
|
|
|
|
|
|
|
|
|
return view($this->bladePath . ".beds", compact("project", "data"));
|
|
|
|
|
}
|
|
|
|
|
@ -122,7 +122,7 @@ class ProjectController extends CommonController
|
|
|
|
|
return $this->error("不正确的类型");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this->success("添加成功!",'',$res);
|
|
|
|
|
return $this->success("添加成功!", '', $res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function editDepartment(Request $request)
|
|
|
|
|
@ -178,8 +178,12 @@ class ProjectController extends CommonController
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function exportBeds(Request $request) {
|
|
|
|
|
$beds = Bed::with(["area","building","room"])
|
|
|
|
|
function exportBeds(Request $request)
|
|
|
|
|
{
|
|
|
|
|
$beds = Bed::with(["area", "building", "room"])
|
|
|
|
|
->whereHas("area")
|
|
|
|
|
->whereHas("building")
|
|
|
|
|
->whereHas("room")
|
|
|
|
|
->where("project_id", $request->project_id)
|
|
|
|
|
->orderBy("building_id")
|
|
|
|
|
->orderBy("area_id")
|
|
|
|
|
@ -188,14 +192,14 @@ class ProjectController extends CommonController
|
|
|
|
|
$data = [];
|
|
|
|
|
foreach ($beds as $bed) {
|
|
|
|
|
$data[] = [
|
|
|
|
|
"楼栋" => $bed->building->name,
|
|
|
|
|
"病区" => $bed->area->name,
|
|
|
|
|
"病房" => $bed->room->name,
|
|
|
|
|
"楼栋" => $bed->building ? $bed->building->name : "",
|
|
|
|
|
"病区" => $bed->area ? $bed->area->name : "",
|
|
|
|
|
"病房" => $bed->room ? $bed->room->name : "",
|
|
|
|
|
"床号" => $bed->name,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
$data = collect($data);
|
|
|
|
|
|
|
|
|
|
return Excel::download(new CommonExport($data),"beds.xlsx");
|
|
|
|
|
return Excel::download(new CommonExport($data), "beds.xlsx");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|