diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/DeptCheckItemController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/DeptCheckItemController.php new file mode 100644 index 0000000..f91b571 --- /dev/null +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/DeptCheckItemController.php @@ -0,0 +1,47 @@ +GetClassList($searchInfo); + } + + //获取当前科室权限范围内的检查项目列表 + public function GetItemList(Request $request) + { + $searchInfo = request('searchInfo'); + $page = request('page'); + $pageSize = request('pageSize'); + $userid = $request->get('userid'); + $service = new DeptCheckItemService(); + return $service->GetItemList($searchInfo, $page, $pageSize, $userid); + } + + //绑定设备 + public function BindDevice(Request $request) + { + $item_id = request('item_id'); + $device_ids = request('device_ids'); + $userid = $request->get('userid'); + $service = new DeptCheckItemService(); + return $service->BindDevice($item_id, $device_ids, $userid); + } + + //保存检查项目信息 + public function Save() + { + $Info = request('Info'); + $service = new DeptCheckItemService(); + return $service->Save($Info); + } +} \ No newline at end of file diff --git a/Laravel/app/Services/Admin/YeWu/DeptCheckItemService.php b/Laravel/app/Services/Admin/YeWu/DeptCheckItemService.php new file mode 100644 index 0000000..72ef0b4 --- /dev/null +++ b/Laravel/app/Services/Admin/YeWu/DeptCheckItemService.php @@ -0,0 +1,172 @@ +where(['pid'=>0,'is_del'=>0])->get(); + $smallClass=[]; + if(!empty($searchInfo['bigClass'])) { + $smallClass = DB::table('s_check_item_class')->where(['pid'=>$searchInfo['bigClass'],'is_del'=>0])->get(); + } + return \Yz::Return(true, '查询成功', ['bigClass'=>$bigClass,'smallClass'=>$smallClass]); + } + //获取当前科室权限范围内的检查项目列表 + public function GetItemList($searchInfo,$page,$pageSize,$userid){ + $user = DB::table('users')->where('id', $userid)->first(); + if (!$user || !$user->department_id) { + return \Yz::Return(true, '查询成功', ['list' => [], 'count' => 0]); + } + + //获取当前科室及子科室的 department_number + $deptNumbers = DB::table('s_department') + ->where('is_del', 0) + ->where(function($q) use ($user) { + $q->where('id', $user->department_id) + ->orWhere('pid', $user->department_id); + }) + ->pluck('department_number') + ->toArray(); + + $small_id=[]; + $list=DB::table('s_check_item')->where('s_check_item.is_del', 0)->whereNotNull('sheetType')->where('sheetType', '!=', ''); + //科室过滤:hisExecDepts 包含当前科室及子科室编号 + $list->whereNotNull('hisExecDepts')->where('hisExecDepts', '!=', ''); + if (!empty($deptNumbers)) { + $list->where(function($q) use ($deptNumbers) { + foreach ($deptNumbers as $num) { + $q->orWhere('hisExecDepts', 'like', '%"' . $num . '"%'); + } + }); + } else { + return \Yz::Return(true, '查询成功', ['list' => [], 'count' => 0]); + } + + if(empty($searchInfo['bigClass'])!==true and empty($searchInfo['smallClass'])===true){ + $small_id= DB::table('s_check_item_class')->where(['pid'=>$searchInfo['bigClass'],'is_del'=>0])->pluck('id')->toArray(); + $list= $list->whereIn('item_class_id',$small_id); + } + if(!empty($searchInfo['smallClass'])){ + $small_id[0]=$searchInfo['smallClass']; + $list= $list->whereIn('item_class_id',$small_id); + } + if(!empty($searchInfo['name'])){ + $list->where(function($query) use ($searchInfo) { + $query->where('item_name', 'like', '%'.$searchInfo['name'].'%') + ->orWhere('item_code', 'like', '%'.$searchInfo['name'].'%'); + }); + } + if (isset($searchInfo['deviceBind']) && $searchInfo['deviceBind'] !== '') { + if ($searchInfo['deviceBind'] == 1) { + $list->whereIn('s_check_item.id', function($q) { + $q->select('item_id')->from('s_check_item_device'); + }); + } elseif ($searchInfo['deviceBind'] == 0) { + $list->whereNotIn('s_check_item.id', function($q) { + $q->select('item_id')->from('s_check_item_device'); + }); + } + } + //执行科室筛选 + if (isset($searchInfo['hisExecDepts']) && $searchInfo['hisExecDepts'] !== '') { + if ($searchInfo['hisExecDepts'] == 1) { + $list->whereNotNull('hisExecDepts')->where('hisExecDepts', '!=', ''); + } elseif ($searchInfo['hisExecDepts'] == 0) { + $list->where(function($q) { + $q->whereNull('hisExecDepts')->orWhere('hisExecDepts', ''); + }); + } + } + $count = $list->count(); + $list= $list + ->leftJoin('s_appointment_type', 's_check_item.reservation_method', '=', 's_appointment_type.id') + ->select('s_check_item.*','s_appointment_type.name as reservation_method_name'); + if (!empty($searchInfo['orderField']) && !empty($searchInfo['orderDirection'])) { + $direction = $searchInfo['orderDirection'] == 'ascending' ? 'asc' : 'desc'; + $list->orderBy($searchInfo['orderField'], $direction); + } + $list = $list->skip(($page-1)*$pageSize)->take($pageSize)->get(); + //查询出所有的预约渠道 + $qudaoList=DB::table('s_appointment_type')->get(); + + //获取当前科室下的设备 IDs + $deptDeviceIds = DB::table('s_department_resources_device') + ->where('department_id', $user->department_id) + ->pluck('device_id') + ->toArray(); + + foreach ($list as $k=>$v){ + $qudao_names=[]; + $qudao_ids = explode(",", $v->reservation_method); + foreach ($qudaoList as $k1=>$v1){ + foreach ($qudao_ids as $k2=>$v2){ + if($v1->id==$v2){ + $qudao_names[]=$v1->name; + } + } + } + + $list[$k]->reservation_method= array_map('intval', $qudao_ids); + $list[$k]->reservation_method_name=$qudao_names; + $list[$k]->devicesInfo=DB::table('s_check_item_device') + ->join('s_devices', 's_check_item_device.device_id', '=', 's_devices.id') + ->select('s_devices.*') + ->where('item_id',$v->id) + ->whereIn('s_check_item_device.device_id', $deptDeviceIds) + ->get(); + } + + return \Yz::Return(true, '查询成功', ['list'=>$list,'count'=>$count]); + } + + //绑定设备(只影响当前科室下的排班关联) + public function BindDevice($item_id,$device_ids,$userid){ + $user = DB::table('users')->where('id', $userid)->first(); + if (!$user || !$user->department_id) { + return \Yz::Return(false, '用户科室信息不存在'); + } + + //获取当前科室下的设备 IDs + $deptDeviceIds = DB::table('s_department_resources_device') + ->where('department_id', $user->department_id) + ->pluck('device_id') + ->toArray(); + + $data=[]; + foreach ($device_ids as $k=>$v){ + $data[$k]['item_id']=$item_id; + $data[$k]['device_id']=$v; + } + DB::beginTransaction(); + //只删除当前科室下的关联 + DB::table('s_check_item_device') + ->where('item_id',$item_id) + ->whereIn('device_id', $deptDeviceIds) + ->delete(); + $i= DB::table('s_check_item_device')->insert($data); + if($i>0){ + DB::commit(); + return \Yz::Return(true, '绑定成功', []); + }else{ + DB::rollBack(); + return \Yz::Return(false, '绑定失败'); + } + } + public function Save($Info){ + if(!empty($Info['id'])){ + $Info['reservation_method']=implode(',', $Info['reservation_method']); + $res=DB::table('s_check_item')->where('id',$Info['id'])->update($Info); + if($res){ + return \Yz::Return(true, '修改成功'); + }else{ + return \Yz::Return(false, '修改失败'); + } + }else{ + return \Yz::Return(false, 'id不能为空'); + } + } +} \ No newline at end of file diff --git a/Laravel/app/Services/Admin/YeWu/DevicesService.php b/Laravel/app/Services/Admin/YeWu/DevicesService.php index c021178..4a6f532 100644 --- a/Laravel/app/Services/Admin/YeWu/DevicesService.php +++ b/Laravel/app/Services/Admin/YeWu/DevicesService.php @@ -170,6 +170,25 @@ public function GetUnboundItems($device_id, $keyword, $page, $pageSize) ->where('s_check_item_device.device_id', $device_id); }); + //根据设备关联科室过滤 hisExecDepts + $deptNumbers = DB::table('s_department_resources_device') + ->join('s_department', 's_department_resources_device.department_id', '=', 's_department.id') + ->where('s_department_resources_device.device_id', $device_id) + ->where('s_department.is_del', 0) + ->pluck('s_department.department_number') + ->toArray(); + + $list->whereNotNull('hisExecDepts')->where('hisExecDepts', '!=', ''); + if (!empty($deptNumbers)) { + $list->where(function($q) use ($deptNumbers) { + foreach ($deptNumbers as $num) { + $q->orWhere('hisExecDepts', 'like', '%"' . $num . '"%'); + } + }); + } else { + $list->whereRaw('1 = 0'); + } + if (!empty($keyword)) { $list->where(function ($q) use ($keyword) { $q->where('s_check_item.item_name', 'like', '%' . $keyword . '%') diff --git a/Laravel/routes/api.php b/Laravel/routes/api.php index 678e442..84cbb8e 100644 --- a/Laravel/routes/api.php +++ b/Laravel/routes/api.php @@ -53,6 +53,10 @@ Route::post('admin/CalendarChangeInfo','App\Http\Controllers\API\Admin\YeWu\healthCalendarController@ChangeInfo'); //admin后台更新日历 Route::post('admin/GetCheckItemClassList','App\Http\Controllers\API\Admin\YeWu\CheckItemController@GetClassList');//admin后台获取检查项目类别列表 Route::post('admin/GetCheckItemList','App\Http\Controllers\API\Admin\YeWu\CheckItemController@GetItemList');//admin后台获取检 + Route::post('admin/GetDeptCheckItemClassList','App\Http\Controllers\API\Admin\YeWu\DeptCheckItemController@GetClassList');//获取当前科室权限的检查项目类别列表 + Route::post('admin/GetDeptCheckItemList','App\Http\Controllers\API\Admin\YeWu\DeptCheckItemController@GetItemList');//获取当前科室权限的检查项目列表 + Route::post('admin/DeptItemBindDevice','App\Http\Controllers\API\Admin\YeWu\DeptCheckItemController@BindDevice');//当前科室权限的检查项目绑定设备 + Route::post('admin/DeptSaveItemInfo','App\Http\Controllers\API\Admin\YeWu\DeptCheckItemController@Save');//当前科室权限的保存检查项目信息 Route::post('admin/GetDeviceList','App\Http\Controllers\API\Admin\YeWu\DevicesController@GetList');//admin后台获取设备列表 Route::post('admin/SaveDeviceList','App\Http\Controllers\API\Admin\YeWu\DevicesController@Save');//admin后台保存设备列表 Route::post('admin/GetEnableDeviceList','App\Http\Controllers\API\Admin\YeWu\DevicesController@GetEnableList');//admin后台可用设备列表 diff --git a/YiJi-admin/src/api/api.js b/YiJi-admin/src/api/api.js index 788488c..10fe650 100644 --- a/YiJi-admin/src/api/api.js +++ b/YiJi-admin/src/api/api.js @@ -168,6 +168,22 @@ export const GetYuYueTypes = (data = {}) => { export const SaveItemInfo = (data = {}) => { return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/SaveItemInfo', data: data }) } +//获取当前科室权限的检查项目类别列表 +export const GetDeptCheckItemClassList = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/GetDeptCheckItemClassList', data: data }) +} +//获取当前科室权限的检查项目列表 +export const GetDeptCheckItemList = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/GetDeptCheckItemList', data: data }) +} +//当前科室权限的检查项目绑定设备 +export const DeptItemBindDevice = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/DeptItemBindDevice', data: data }) +} +//当前科室权限的保存检查项目信息 +export const DeptSaveItemInfo = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/DeptSaveItemInfo', data: data }) +} //admin获取科室列表 export const GetDepartmentList = (data = {}) => { return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/GetDepartmentList', data: data }) diff --git a/YiJi-admin/src/router/index.js b/YiJi-admin/src/router/index.js index d235717..d4aaf4a 100644 --- a/YiJi-admin/src/router/index.js +++ b/YiJi-admin/src/router/index.js @@ -131,6 +131,13 @@ const router = createRouter({ meta: { title: '检查项目设置' } + },{ + path: '/yewu/deptCheckItemConfig', + name: 'YewuDeptCheckItemConfig', + component: () => import('../views/YeWu/DeptCheckItemConfig.vue'), + meta: { + title: '检查项目管理' + } },{ path: '/yewu/devicesConfig', name: 'YewuDevicesConfig', @@ -157,7 +164,7 @@ const router = createRouter({ name: 'YewuDeviceCheckItemBind', component: () => import('../views/YeWu/DeviceCheckItemBind.vue'), meta: { - title: '检查项目管理' + title: '排班项目管理' } },{ path: '/appointmentmngr/timeperiodmngr', diff --git a/YiJi-admin/src/views/YeWu/DeptCheckItemConfig.vue b/YiJi-admin/src/views/YeWu/DeptCheckItemConfig.vue new file mode 100644 index 0000000..cda6a5b --- /dev/null +++ b/YiJi-admin/src/views/YeWu/DeptCheckItemConfig.vue @@ -0,0 +1,832 @@ + + + + + + 医嘱类别 + + + + + + + + + + + + + + + + + + + + + + + 查询 + 批量关联排班 + + + + + + + + + + 是 + 否 + + + + + + + + + {{item.device_name}} + {{item.device_name}} + + + + + + 关联排班 + + + + + 修改 + 互斥 + 规则 + + + + + + + + + + + + + + + + + 取消 + + 确定 + + + + + + 医嘱名称:{{selectedItemInfo.item_name}} + 预约方式: + + {{item.name}} + + + 空腹: + + + + + + 检查时间: + 等待时间: + 医嘱开具后,预约时间需在设定的等待期之后,单位分钟 + + + + 检查须知: + + + + 取消 + + 确定 + + + + + + 请输入想要与 {{SelectedHuChiItemInfo.name}} 互斥的项目名称 + + + + + + + + + + + + + + + + + 查询 + + + + + + + + {{item1.item_name}} + + + + + + + + 已经存在互斥项({{itemHuChiList.length}}) + + + {{item.code2_item_name}} + 小时 + + + 解除 + 更新 + + + 保存 + 移除 + + + + + + -- 暂未设置互斥项 -- + + + + + + + + 设置互斥时间,单位小时,0为永久互斥 + + {{SelectedHuChiItemInfo.name}} + + + + + + {{item.item_name}} + + 添加 + + + + + + 添加规则 + 无规则表示不限制预约时段 + + + + 规则 {{ index + 1 }} + 删除 + + + 允许星期 + + + + + + 允许时段 + + ~ + + + + + 暂未设置时段限制 + + + 取消 + 保存 + + + + + + + + \ No newline at end of file diff --git a/YiJi-admin/src/views/YeWu/DeviceCheckItemBind.vue b/YiJi-admin/src/views/YeWu/DeviceCheckItemBind.vue index 854d448..4553261 100644 --- a/YiJi-admin/src/views/YeWu/DeviceCheckItemBind.vue +++ b/YiJi-admin/src/views/YeWu/DeviceCheckItemBind.vue @@ -1,10 +1,10 @@ - + - 执行检查室 + 排班 - {{ selectedDevice ? selectedDevice.device_name + ' - 已绑定的检查项目' : '请选择一个执行检查室' }} + {{ selectedDevice ? selectedDevice.device_name + ' - 已绑定的检查项目' : '请选择一个排班' }}