From 1eb37e9c5812e386a2d211c40f269e44dcb6759c Mon Sep 17 00:00:00 2001 From: sa0ChunLuyu Date: Sun, 19 Jul 2026 16:20:41 +0800 Subject: [PATCH] 1 --- .../Services/Admin/YeWu/DepartmentService.php | 4 +++ .../Services/Admin/YeWu/DevicesService.php | 26 +++++++++++++++++-- YiJi-admin/src/views/YeWu/CheckItemConfig.vue | 2 +- .../src/views/YeWu/DepartmentConfig.vue | 6 ++++- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/Laravel/app/Services/Admin/YeWu/DepartmentService.php b/Laravel/app/Services/Admin/YeWu/DepartmentService.php index d6a3967..e252db8 100644 --- a/Laravel/app/Services/Admin/YeWu/DepartmentService.php +++ b/Laravel/app/Services/Admin/YeWu/DepartmentService.php @@ -43,6 +43,10 @@ public function GetList($searchInfo,$page,$pageSize,$userid=null,$group=null) if(!empty($searchInfo['only_first_level'])){ $list = $list->where('pid', 0); } + //只显示参与预约的科室 + if(!empty($searchInfo['appointment_enabled'])){ + $list = $list->where('appointment_enabled', 1); + } $c=$list->count(); $l=$list ->orderBy('id','desc')->skip(($page-1)*$pageSize) ->take($pageSize)->get() ; diff --git a/Laravel/app/Services/Admin/YeWu/DevicesService.php b/Laravel/app/Services/Admin/YeWu/DevicesService.php index 4a6f532..fbc487b 100644 --- a/Laravel/app/Services/Admin/YeWu/DevicesService.php +++ b/Laravel/app/Services/Admin/YeWu/DevicesService.php @@ -18,7 +18,25 @@ public function GetList($searchInfo,$page,$pageSize){ } //获取启用的设备列表 public function GetEnableList($hisExecDepts = null){ - $list=DB::table('s_devices')->where(['is_del'=>0,'status'=>1]); + $list = DB::table('s_devices')->where(['s_devices.is_del' => 0, 's_devices.status' => 1]); + + // 反查关联诊室和科室状态:必须存在至少一条有效的关联链路 + $list->whereExists(function ($query) { + $query->select(DB::raw(1)) + ->from('s_department_resources_device') + ->join('s_department_resources', function ($join) { + $join->on('s_department_resources_device.rsourece_id', '=', 's_department_resources.id') + ->where('s_department_resources.is_del', 0) + ->where('s_department_resources.department_resources_status', 1); + }) + ->join('s_department', function ($join) { + $join->on('s_department_resources_device.department_id', '=', 's_department.id') + ->where('s_department.is_del', 0) + ->where('s_department.department_status', 1) + ->where('s_department.appointment_enabled', 1); + }) + ->whereColumn('s_department_resources_device.device_id', 's_devices.id'); + }); if (!empty($hisExecDepts)) { $deptCodes = json_decode($hisExecDepts, true); @@ -27,6 +45,8 @@ public function GetEnableList($hisExecDepts = null){ $deptIds = DB::table('s_department') ->whereIn('department_number', $deptCodes) ->where('is_del', 0) + ->where('department_status', 1) + ->where('appointment_enabled', 1) ->pluck('id') ->toArray(); @@ -38,6 +58,8 @@ public function GetEnableList($hisExecDepts = null){ ->where('pid', '>', 0); }) ->where('is_del', 0) + ->where('department_status', 1) + ->where('appointment_enabled', 1) ->pluck('id') ->toArray(); @@ -49,7 +71,7 @@ public function GetEnableList($hisExecDepts = null){ ->pluck('device_id') ->toArray(); - $list->whereIn('id', $deviceIds); + $list->whereIn('s_devices.id', $deviceIds); } } diff --git a/YiJi-admin/src/views/YeWu/CheckItemConfig.vue b/YiJi-admin/src/views/YeWu/CheckItemConfig.vue index a650c1b..1fd77fb 100644 --- a/YiJi-admin/src/views/YeWu/CheckItemConfig.vue +++ b/YiJi-admin/src/views/YeWu/CheckItemConfig.vue @@ -41,7 +41,7 @@ - +