From c24c563858299a113933f52650da09d2511f175b Mon Sep 17 00:00:00 2001 From: yanzai Date: Wed, 4 Dec 2024 14:38:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E9=87=8D=E5=86=99=E4=B8=BB=E5=B7=A5=E4=BD=9C=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E3=80=81=E5=85=A8=E9=83=A8=E8=B5=84=E6=BA=90=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E3=80=81=E5=85=A8=E9=83=A8=E5=8C=BB=E5=98=B1=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../API/Admin/YeWu/DepartmentController.php | 4 +- .../YeWu/DepartmentResourceController.php | 7 +- .../API/Admin/YeWu/EntrustController.php | 130 ++++ .../API/Admin/YeWu/PlanListController.php | 6 +- .../API/Admin/YeWu/WorkMainController.php | 9 +- .../Services/Admin/YeWu/DepartmentService.php | 4 +- .../Services/Admin/YeWu/PlanListService.php | 46 +- Laravel/routes/api.php | 2 + YiJi-admin/src/api/api.js | 28 + YiJi-admin/src/components/Yewu/YuYue.vue | 598 ++++++++++++++++++ YiJi-admin/src/router/index.js | 14 + YiJi-admin/src/views/Info/EntrustList.vue | 352 +++++++++++ YiJi-admin/src/views/Info/PlanList.vue | 521 +++++++++++++++ YiJi-admin/src/views/YeWu/MainList.vue | 55 +- .../src/views/YeWu/MainList_ZhuYuan.vue | 526 ++++++++++++--- 15 files changed, 2204 insertions(+), 98 deletions(-) create mode 100644 Laravel/app/Http/Controllers/API/Admin/YeWu/EntrustController.php create mode 100644 YiJi-admin/src/components/Yewu/YuYue.vue create mode 100644 YiJi-admin/src/views/Info/EntrustList.vue create mode 100644 YiJi-admin/src/views/Info/PlanList.vue diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/DepartmentController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/DepartmentController.php index 6f459ed..dddaee3 100644 --- a/Laravel/app/Http/Controllers/API/Admin/YeWu/DepartmentController.php +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/DepartmentController.php @@ -23,8 +23,10 @@ class DepartmentController extends Controller { $userid = $request->get('userid');//中间件产生的参数 $group = $request->get('role');//中间件产生的参数 + $is_all = $request->get('is_all'); + $is_all=isset($is_all)?$is_all:false; $service = new DepartmentService(); - return $service->GetEnableList(['userid'=>$userid,'group'=>$group]); + return $service->GetEnableList(['userid'=>$userid,'group'=>$group],$is_all); } //保存科室信息 diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/DepartmentResourceController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/DepartmentResourceController.php index 817e774..343070e 100644 --- a/Laravel/app/Http/Controllers/API/Admin/YeWu/DepartmentResourceController.php +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/DepartmentResourceController.php @@ -27,11 +27,14 @@ class DepartmentResourceController extends Controller public function GetEnableList(Request $request) { $userid = $request->get('userid');//中间件产生的参数 + $res_department_id=$request->get('department_id'); $userInfo = DB::table('users')->where(['id' => $userid])->first(); - if(!isset($userInfo->department_id)){ + if(!isset($userInfo->department_id) and !isset($res_department_id)){ return \Yz::echoError1('科室信息不存在'); } - $resource=DB::table('s_department_resources')->where(['department_id'=>$userInfo->department_id,'department_resources_status'=>1,'is_del'=>0])->get(); + if(isset($userInfo->department_id)) $department_id=$userInfo->department_id; + if(isset($res_department_id)) $department_id=$res_department_id; + $resource=DB::table('s_department_resources')->where(['department_id'=>$department_id,'department_resources_status'=>1,'is_del'=>0])->get(); if(count($resource)>0){ return \Yz::Return(true, '操作成功',$resource); }else{ diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/EntrustController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/EntrustController.php new file mode 100644 index 0000000..e725865 --- /dev/null +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/EntrustController.php @@ -0,0 +1,130 @@ +leftJoin('s_period','s_list.reservation_time','=','s_period.id') + ->leftJoin('s_department_resources','s_list.reservation_sources','=','s_department_resources.id') + ->select('s_list.*','s_period.period_begin_time','s_period.period_end_time','s_department_resources.department_resources_name'); + if ($searchInfo['dateRange']!=null and count($searchInfo['dateRange']) == 2) { + $list = $list->where(function ($q) use($searchInfo) { + $q->whereBetween('s_list.entrust_date', $searchInfo['dateRange']) + ->orWhereBetween('s_list.reservation_date', $searchInfo['dateRange']); + }); + } + if(isset($searchInfo['department_id'])){ + $department = DB::table('s_department')->where(['id' => $searchInfo['department_id'],'is_del'=>0])->first(); + $list=$list->where(['RISRAcceptDeptCode'=>$department->department_number]); + } + if (isset($searchInfo['list_status'])) { + $list = $list->where('s_list.list_status', $searchInfo['list_status']); + } + if (isset($searchInfo['patient_type'])) { + $list = $list->where('s_list.patient_type', $searchInfo['patient_type']); + } + if (!empty($searchInfo['resources'])) { + $list = $list->whereIn('s_list.reservation_sources', $searchInfo['resources']); + } + if (isset($searchInfo['services_group'])) { + $list = $list->whereRaw("FIND_IN_SET({$searchInfo['services_group']}, s_list.services_group)"); + } + if (isset($searchInfo['reg_num'])) { + $list = $list->where('s_list.reg_num', $searchInfo['reg_num']); + } + if (isset($searchInfo['user_name'])) { + $list = $list->where('s_list.user_name', 'like','%'.$searchInfo['user_name'].'%'); + } + if (isset($searchInfo['doctor'])) { + $list = $list->where('s_list.docotr', 'like','%'.$searchInfo['doctor'].'%'); + } + if (isset($searchInfo['apply_department'])) { + $list = $list->where('s_list.reservation_department', 'like','%'.$searchInfo['apply_department'].'%'); + } + + $count = $list; + $count = $count->count(); + $list=$list->where(['s_list.is_del'=>0,'s_list.is_nullify'=>0])->orderBy('id', 'desc')->limit($pageSize)->skip(($page - 1) * $pageSize) // 跳过前9999条记录 + ->take($pageSize)->get(); + + //匹配设备(服务组) + $devices = DB::table('s_devices')->get(); + foreach ($list as $key => $value) { + $list[$key]->age = Tools::calculateAgeText($value->user_brithday); + $list[$key]->devices = []; + $array_device_id = explode(",", $value->services_group); + foreach ($devices as $k => $v) { + if (in_array($v->id, $array_device_id)) { + $list[$key]->devices[] = $v; + } + } + } + return \Yz::Return(true,'查询完成',['list'=>$list,'count'=>$count]); + } + //获取医嘱信息 支持多人 + public function getMainDetail_duoren() + { + date_default_timezone_set('PRC'); + $entrustInfos = request('entrustInfo'); + $entrustids = request('entrustid'); + $episodeid = request('episodeid'); + $appointment_type=request('appointment_type'); + if(empty($entrustInfos)) return \Yz::echoError1("entrustInfo不能为空"); + $allInfo=[]; + foreach ($entrustInfos as $key => $entrustInfo) { + $info = DB::table('s_list as a')->where(['a.reg_num' => $entrustInfo['reg_num'], 'a.episodeid'=>$entrustInfo['episodeid'],'a.is_nullify'=>0]) + ->select('a.*','c.period_begin_time','c.period_end_time') + ->leftJoin('s_period as c','a.reservation_time','=','c.id') + ->whereIn('a.entrust_id',$entrustInfo['entrustid']) + ->get(); + if (count($info)===0) return \Yz::echoError1('登记号'.$entrustInfo['reg_num'].'没有找到对应医嘱信息'); + + $mainInfo=$info[0]; + $itemInfo=[]; + foreach ($info as $value){ + $ii = DB::table('s_check_item as a') + ->leftJoin('s_check_item_device as b','a.id','=','b.item_id') + ->where(['a.item_code' => $value->entrust_code,'a.status'=>1,"a.is_del"=>0])->first(); + + $msg=''; + if(!$ii){ + $msg="检查项目不可用"; + } + if(!!$ii){ + if(empty($ii->device_id)){ + $msg="检查项目未关联服务组"; + } + + $qudaos = explode(',', $ii->reservation_method); + if (!in_array($appointment_type, $qudaos)){ + $msg=$msg.',该项目不支持在此渠道预约'; + } + + } + $itemInfo[]=[ + 'entrust'=>$value, + 'item'=>$ii, + 'msg'=>$msg, + 'selected'=>false + ]; + } + $allInfo[]=['mainInfo'=>$mainInfo,'itemInfo'=>$itemInfo]; + } + + + + + + return \Yz::Return(true,'查询完成',['today_date'=>date("Y-m-d"),'info'=>$allInfo]); + } +} diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanListController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanListController.php index 87ca059..9533dd7 100644 --- a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanListController.php +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanListController.php @@ -194,20 +194,23 @@ class PlanListController extends Controller $page = request('page'); $pageSize = request('pageSize'); $department_id = 0; + $department_info=false; $list = DB::table('s_source_roster_detail') ->leftJoin('s_department_resources', 's_source_roster_detail.resources_id', '=', 's_department_resources.id') // ->leftJoin('s_devices', 's_source_roster_detail.device_id', '=', 's_devices.id') ->leftJoin('s_period', 's_source_roster_detail.period_id', '=', 's_period.id') ->select('s_source_roster_detail.*', 's_department_resources.department_resources_name', 's_period.period_name') ->where(['s_source_roster_detail.is_del' => 0]); - if ($group == 1) {//如果是管理员 + if (!empty($searchInfo['department_id'])) {//以前判断的是管理员group==1 改为 (任何角色都能查看了) if (!empty($searchInfo['department_id'])) { + $department_info=DB::table('s_department')->where(['id' => $searchInfo['department_id']])->first(); $list = $list->where('s_source_roster_detail.department_id', $searchInfo['department_id']); } } else { $userInfo = DB::table('users')->where(['id' => $userid])->get(); $department_id = $userInfo[0]->department_id; + $department_info=DB::table('s_department')->where(['id' => $department_id])->first(); $list = $list->where(['s_source_roster_detail.department_id' => $department_id]); } if (!empty($searchInfo['resources_id'])) { @@ -233,6 +236,7 @@ class PlanListController extends Controller ->take($pageSize)->get(); $ids = []; foreach ($list as $key => $value) { + $list[$key]->department_name = !!$department_info?$department_info->department_name:'' ; $list[$key]->countsInfo = []; $ids[] = $value->id; } diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/WorkMainController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/WorkMainController.php index 8faf512..30423d9 100644 --- a/Laravel/app/Http/Controllers/API/Admin/YeWu/WorkMainController.php +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/WorkMainController.php @@ -159,6 +159,7 @@ class WorkMainController extends Controller public function CheckEntrstItemGroup() { $list=[]; + $rowids=[]; $itemNames=[]; $items= request('items'); if(!empty($items)){ @@ -184,6 +185,7 @@ class WorkMainController extends Controller ->leftJoin('s_devices as c','b.device_id','=','c.id') ->whereIn('a.item_name',$itemNames)->where(['a.is_del'=>0,'a.status'=>1,'check_begin_time'=>$FirstItem->check_begin_time])->get(); //按照第一个勾选的检查项目关联的设备进行分组,能在一个设备上进行检查的分在一组 + if(!empty($FirstItemDevices)){ $group=[]; foreach ($FirstItemDevices as $f_key=> $value){ @@ -192,8 +194,9 @@ class WorkMainController extends Controller if($v->device_id==$value){ foreach ($items as $item){ if($item['name']==$v->item_name){ - $v->rowid=$item['rowid']; + $v->rowid[]=$item['rowid']; + $rowids[]=$item['rowid']; } } @@ -206,10 +209,12 @@ class WorkMainController extends Controller } - return \Yz::Return(true,'查询完成',['group'=>$group]); + + return \Yz::Return(true,'查询完成',['group'=>$group,'rowids'=>$rowids]); }else{ return \Yz::echoError1('当前勾选检查项目不可进行此操作'); } + }else{ return \Yz::echoError1('检查项目不能为空'); } diff --git a/Laravel/app/Services/Admin/YeWu/DepartmentService.php b/Laravel/app/Services/Admin/YeWu/DepartmentService.php index 3f5c38a..5aacda5 100644 --- a/Laravel/app/Services/Admin/YeWu/DepartmentService.php +++ b/Laravel/app/Services/Admin/YeWu/DepartmentService.php @@ -25,10 +25,10 @@ class DepartmentService } return \Yz::Return(true, '查询成功', ['list'=>$l,'count'=>$c]); } - public function GetEnableList($arr) + public function GetEnableList($arr,$is_all=false) { $list=DB::table('s_department'); - if($arr['group']!=1){ + if(!in_array($arr['group'],[1,5]) and $is_all===false){ $userInfo = DB::table('users')->where(['id'=>$arr['userid']])->get(); $department_id=$userInfo[0]->department_id; $list= $list->where(['id'=>$department_id]); diff --git a/Laravel/app/Services/Admin/YeWu/PlanListService.php b/Laravel/app/Services/Admin/YeWu/PlanListService.php index cf50163..4312a86 100644 --- a/Laravel/app/Services/Admin/YeWu/PlanListService.php +++ b/Laravel/app/Services/Admin/YeWu/PlanListService.php @@ -24,8 +24,9 @@ class PlanListService $allDevice = [];//所有医嘱检查项目绑定的设备id $commPatientType = [];//所有医嘱共同的病人类型 foreach ($entrustids as $key => $entrustid) { - $info = DB::table('s_list')->where(['reg_num' => $regnum, 'entrust_id' => $entrustid, 'episodeid' => $episodeid, 'is_nullify' => 0])->first(); - if (!$info) return \Yz::echoError1('没有找到对应医嘱信息'); +// $info = DB::table('s_list')->where(['reg_num' => $regnum, 'entrust_id' => $entrustid, 'episodeid' => $episodeid, 'is_nullify' => 0])->first(); + $info = DB::table('s_list')->where(['entrust_id' => $entrustid, 'is_nullify' => 0])->first(); + if (!$info) return \Yz::echoError1('没有找到对应医嘱信息:'.$entrustid); $itemInfo = DB::table('s_check_item')->where(['item_name' => $info->entrust, 'status' => 1, "is_del" => 0])->get(); if (count($itemInfo) == 0) return \Yz::echoError1('没有找到可用的检查项目信息'); @@ -94,8 +95,9 @@ class PlanListService // ->whereIn('d.device_id',$commonDevice) // ->orderBy('a.date') // ->get(); - + if(count($commonDevice)==0) return \Yz::echoError1("无可用号源"); $placeholders = implode(',', array_fill(0, count($commonDevice), '?')); + $canshu = array_merge($commonDevice, [$department_id->id, $appointment_date, $appointment_type]); $plan = DB::select("SELECT a.*, @@ -169,7 +171,7 @@ WHERE $planCount = DB::table('s_source_roster_detail_count')->where(['roster_detail_id' => $planid, 'appointment_type_id' => $appointment_type])->first(); if ($planCount->count < ($planCount->used_count + count($mainlistids))) return \Yz::echoError1('当前预约时间名额不足'); - + $huchiList=[];//互斥item_id对应关系 $oldMainInfos = [];//临时存储原来的主表信息,用于改约 //遍历多个s_list表id,前端多选,一次预约多个检查项目 foreach ($mainlistids as $key_m => $mainlistid) { @@ -222,7 +224,11 @@ WHERE ->where(function ($q) use ($item) { $q->where(['code1' => $item->item_code])->orWhere('code2', $item->item_code); })->get(); + foreach ($cha_hc as $hc) { + $huchiList[]=[$hc->code1,$hc->code2]; + } if (count($cha_hc) > 0) { + //查询用户预约中的医嘱 $status_1 = DB::table('s_list') ->select('s_check_item.item_code', 's_list.entrust', 's_list.reservation_date', 's_list.reservation_time') @@ -262,8 +268,28 @@ WHERE } } + //判断某人这些待预约项目里,是否存在互斥 + $userGroup=[]; + foreach ($oldMainInfos as $key1 => $value1) { + $reg_num = $value1->reg_num; + if (!isset($userGroup[$reg_num])) { + $userGroup[$reg_num] = []; + } + $userGroup[$reg_num][]=[ + 'reg_num' => $value1->reg_num, + 'user_name' => $value1->user_name, + 'entrust_code' => $value1->entrust_code, + 'entrust' => $value1->entrust, + ]; + } + // $huchiList - + foreach ($userGroup as $personEntry) { + $ids = array_column($personEntry, 'entrust_code'); + if ($this->isMutuallyExclusive($ids, $huchiList)) { + return \Yz::echoError1($personEntry[0]['user_name'].'勾选的项目存在互斥,不可同时预约'); + } + } DB::beginTransaction(); try { //更新计划明细表使用数量 @@ -448,4 +474,14 @@ WHERE $s->sendMessage($info->user_phone,'测试短信,项目:'.$mainInfo->entrust.',时间:'.$mainInfo->reservation_date.' '.substr($mainInfo->period_begin_time,0,5).'-'.substr($mainInfo->period_end_time,0,5)); } } + + //判断是否在互斥组内 + function isMutuallyExclusive($ids, $huchi) { + foreach ($huchi as $pair) { + if (in_array($pair[0], $ids) && in_array($pair[1], $ids)) { + return true; + } + } + return false; + } } diff --git a/Laravel/routes/api.php b/Laravel/routes/api.php index 4553caf..61196eb 100644 --- a/Laravel/routes/api.php +++ b/Laravel/routes/api.php @@ -114,6 +114,8 @@ Route::group(['middleware'=>['log']],function () { Route::post('admin/NearestEnablePlanDate','App\Http\Controllers\API\Admin\YeWu\PlanListController@NearestEnablePlanDate');//获取最近可用日期 Route::post('testSendMsg','App\Http\Controllers\TestSendMsgController@SendMsg');//测试发送短信 Route::post('admin/GetPersonYuYueList','App\Http\Controllers\API\Admin\YeWu\WorkMainController@GetPersonYuYueList');//医生获取某人全部预约记录 + Route::post('admin/EntrustGetList','App\Http\Controllers\API\Admin\YeWu\EntrustController@GetList');//获取医嘱列表,非主工作列表 + Route::post('admin/getMainDetail_duoren','App\Http\Controllers\API\Admin\YeWu\EntrustController@getMainDetail_duoren');//获取医嘱信息(支持多人) Route::post('admin/AutoYuYue','App\Http\Controllers\API\Admin\YeWu\PlanListController@AutoYuYue');//自动预约 }); diff --git a/YiJi-admin/src/api/api.js b/YiJi-admin/src/api/api.js index 3ad5034..ebe83f7 100644 --- a/YiJi-admin/src/api/api.js +++ b/YiJi-admin/src/api/api.js @@ -321,4 +321,32 @@ export const SignIn = (data = {}) => { //取消签到 export const CancelSign = (data = {}) => { return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/CancelSign', data: data }) +} +//获取医嘱列表,非主工作列表 +export const EntrustGetList = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'admin/EntrustGetList', data: data }) +} +//获取医嘱详情_多人 +export const getMainDetail_duoren = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'admin/getMainDetail_duoren', data: data }) +} +//获取最近可用日期 +export const NearestEnablePlanDate = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'admin/NearestEnablePlanDate', data: data }) +} +//获取某日可用号源 +export const GetEnablePlan = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'admin/GetEnablePlan', data: data }) +} +//获取某日可用号源 +export const PlanYuYue = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'admin/PlanYuYue', data: data }) +} +////检查当前时段是否有存在已经预约的待检查项目 +export const CheckIsDaiJian = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'admin/CheckIsDaiJian', data: data }) +} +//医生端取消预约 +export const DoctorCancelYuYue = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'admin/DoctorCancelYuYue', data: data }) } \ No newline at end of file diff --git a/YiJi-admin/src/components/Yewu/YuYue.vue b/YiJi-admin/src/components/Yewu/YuYue.vue new file mode 100644 index 0000000..8e54337 --- /dev/null +++ b/YiJi-admin/src/components/Yewu/YuYue.vue @@ -0,0 +1,598 @@ + + + + + + \ No newline at end of file diff --git a/YiJi-admin/src/router/index.js b/YiJi-admin/src/router/index.js index 12f22fe..84bd39c 100644 --- a/YiJi-admin/src/router/index.js +++ b/YiJi-admin/src/router/index.js @@ -170,6 +170,20 @@ const router = createRouter({ meta: { title: '主工作列表(住院)' } + },{ + path: '/info/EntrustList', + name: 'EntrustList', + component: () => import('../views/Info/EntrustList.vue'), + meta: { + title: '医嘱信息列表' + } + },{ + path: '/info/PlanList', + name: 'InfoPlanList', + component: () => import('../views/Info/PlanList.vue'), + meta: { + title: '资源信息列表' + } }] }, diff --git a/YiJi-admin/src/views/Info/EntrustList.vue b/YiJi-admin/src/views/Info/EntrustList.vue new file mode 100644 index 0000000..02b8482 --- /dev/null +++ b/YiJi-admin/src/views/Info/EntrustList.vue @@ -0,0 +1,352 @@ + + + + + \ No newline at end of file diff --git a/YiJi-admin/src/views/Info/PlanList.vue b/YiJi-admin/src/views/Info/PlanList.vue new file mode 100644 index 0000000..9ff686b --- /dev/null +++ b/YiJi-admin/src/views/Info/PlanList.vue @@ -0,0 +1,521 @@ + + + \ No newline at end of file diff --git a/YiJi-admin/src/views/YeWu/MainList.vue b/YiJi-admin/src/views/YeWu/MainList.vue index 5b71282..1fd24f9 100644 --- a/YiJi-admin/src/views/YeWu/MainList.vue +++ b/YiJi-admin/src/views/YeWu/MainList.vue @@ -292,18 +292,28 @@ } let tableSelected = ref([]) const handleSelect = (e) => { - //console.log('取消前:', tableSelected.value) + if (e.length > 1) { + const firstStatus = e[0].list_status; + // 检查所有元素的状态是否一致,如果勾选的有不同状态,则只选中最后1个 + const allEqual = e.every(item => item.list_status === firstStatus); + if (!allEqual) { + SelectClear() + e = [e[e.length - 1]] + } + } + + if (e[e.length - 1].list_status != 0) { //非申请状态,只能勾选1个 + SelectClear() + e = [e[e.length - 1]] + } let select_qian = tableSelected.value ? tableSelected.value.length : 0 - SelectClear(); - // console.log(e) - autoSeleted([e[e.length - 1]]) - // console.log('取消后:', tableSelected.value) + //SelectClear(); + autoSeleted(e) + // console.log('后:', tableSelected.value) if (select_qian > tableSelected.value.length) { - } else { FindMatchItem() } - } const handleSelectionChange = (e) => { // tableSelected.value = e @@ -314,14 +324,14 @@ //清空数据,通过Element-Plus表格的clearSelection的方法,清空所有已选中的数据 tableref.value.clearSelection() // console.log("清空选中数据后==", tableref.value.getSelectionRows()) - tableSelected.value = null + tableSelected.value = [] } const autoSeleted = (rows) => { - - // tableref.value.toggleRowSelection(e[0], true) if (rows) { rows.forEach((row) => { - tableref.value.toggleRowSelection(row, true) + if(row!=undefined){ + tableref.value.toggleRowSelection(row, true) + } }) tableSelected.value = rows } else { @@ -333,8 +343,29 @@ let ItemGroup = ref(null); //查找同一个人同一个就诊号,当前页面 状态申请中的项目名称 const FindMatchItem = () => { + console.log(tableSelected.value) + tableSelected.value.reverse(); + let temp_reg_num='' + let chongzhi=false; + tableSelected.value.forEach((v, i) => { + if(temp_reg_num==''){ + temp_reg_num=v.reg_num + } + if(temp_reg_num!='' && temp_reg_num!=v.reg_num){ + chongzhi=true + } + + }) + if(chongzhi===true){ + let a=tableSelected.value[0] + SelectClear(); + + autoSeleted([a]) + } + console.log(tableSelected.value) let list = [] if(tableSelected.value[0].list_status!=0)return false //如果勾选的不是申请中的医嘱则不进行匹配 + tableData.value.forEach((v, i) => { if (v.list_status == 0 && v.reg_num == tableSelected.value[0].reg_num && v.episodeid == tableSelected.value[0].episodeid) { @@ -361,7 +392,7 @@ loading.value = false if (res.status) { let group = res.data.group - if (group.length > 1) { + if (group.length > 1000000000) { ItemGroupShow.value = true; ItemGroup.value = group } else { diff --git a/YiJi-admin/src/views/YeWu/MainList_ZhuYuan.vue b/YiJi-admin/src/views/YeWu/MainList_ZhuYuan.vue index 435f0c4..124aa75 100644 --- a/YiJi-admin/src/views/YeWu/MainList_ZhuYuan.vue +++ b/YiJi-admin/src/views/YeWu/MainList_ZhuYuan.vue @@ -1,5 +1,8 @@ @@ -56,9 +156,13 @@ ElMessage, ElMessageBox } from 'element-plus' + import YuYue from '@/components/Yewu/YuYue.vue' import { GetMainList, - GetServiceDateTime + CancelYuYue, + GetServiceDateTime, + CheckEntrstItemGroup, + getMainDetail,GetLoglist } from '@/api/api.js' let loading = ref(false) let searchInfo = ref({}) @@ -66,6 +170,11 @@ let currentPage = ref(1) //当前页码 let pageSize = ref(15) //每页数量 let total = 0 //总数量 + let YuYueKey = ref(0); //用于每次打开更新组件key,强制重新加载 + let tableref = ref(null) + let tableSelected = ref([]); + let Is_AutoDuoRen = ref([]); //是否自动勾选多人 + let shenqingdan_show = ref(false); const PageSizeChange = (e) => { // 修改每页数量 pageSize.value = e GetList() @@ -74,8 +183,9 @@ currentPage.value = e GetList() } - + const GetList = () => { + tableSelected.value = [] loading.value = true GetMainList({ searchInfo: searchInfo.value, @@ -91,60 +201,276 @@ } }) } - let Info = ref({}); - let dialogVisible = ref(false); - const Add = () => { - Info.value = {} - Info.value.id = 0 - Info.value.status = 1 - dialogVisible.value = true - + + let YuYueDialogVisible = ref(false); //打开预约对话框 + let YuYueInfo = ref({}); + const openYuYue = (type) => { + if(tableSelected.value.length==0){ + ElMessage.error('请勾选项目') + return false + } + if (type == 1) { + if (!tableSelected.value.every(item => item.list_status === 0)) { + ElMessage.error('当前勾选项目,不能预约') + return false + } + } + if (type == 2) { + if (!tableSelected.value.every(item => item.list_status === 1)) { + ElMessage.error('当前勾选项目,不能改约预约') + return false + } + } + YuYueInfo.value.entrustInfo = mergeByRegNum(tableSelected.value) + YuYueKey.value++; + YuYueInfo.value.dotype = type //预约类型1预约2改约 + YuYueInfo.value.appointment_type = 4 //预约渠道id 4护士站 + YuYueDialogVisible.value = true; } - const Save = () => { - loading.value = true - ComboCrowdSave({ - Info: Info.value - }).then(res => { - loading.value = false - if (res.status) { - dialogVisible.value = false - GetList() - } else { - ElMessage.error(res.msg) + //取消预约 + const cancel = () => { + if (tableSelected.value.length === 0) { + ElMessage.error('请勾选1条记录') + return false + } + let next = true + tableSelected.value.forEach((v, i) => { + if (v.list_status != 1) { + ElMessage.error(v.entrust + " 无需取消") + next = false } }) + if (next == false) return false + ElMessageBox.prompt('请输入登录密码后再操作', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + inputType: 'password' + }) + .then(({ + value + }) => { + loading.value = true + CancelYuYue({ + MainListId: tableSelected.value[0].id, + reg_num: tableSelected.value[0].reg_num, + password: value + }).then(res => { + loading.value = false + if (res.status) { + ElMessage({ + message: res.msg, + type: 'success', + }) + GetList() + } else { + ElMessage.error(res.msg) + } + + }) + }) + .catch(() => { + + }) } - const Edit=(row)=>{ - dialogVisible.value = true - Info.value.name =row.name - Info.value.id = row.id + //勾选表格记录 + const TableSelectChange = (e) => { + if (e.length > 1) { + const firstStatus = e[0].list_status; + // 检查所有元素的状态是否一致,如果勾选的有不同状态,则只选中最后1个 + const allEqual = e.every(item => item.list_status === firstStatus); + if (!allEqual) { + SelectClear() + e = [e[e.length - 1]] + } + } + + if (e[e.length - 1].list_status != 0) { //非申请状态,只能勾选1个 + SelectClear() + e = [e[e.length - 1]] + } + let select_qian = tableSelected.value ? tableSelected.value.length : 0 + //SelectClear() + autoSeleted(e) + if (select_qian > tableSelected.value.length) { + + } else { + if (Is_AutoDuoRen.value.length == 0) { //单人多项目 + FindPersonMatchItem() + } + if (Is_AutoDuoRen.value.length == 1) { //多人单项目 + FindAllMatchItem() + } + } } - //获取详情 - const GetDetailFunc=(id)=>{ - loading.value = true - PlanTypeGetDetail({ - id: id - }).then(res => { - loading.value = false - if (res.status) { - Info.value=res.data - } else { - ElMessage.error(res.msg) + //清空所有 + const SelectClear = () => { + tableref.value.clearSelection() + tableSelected.value = [] + } + const autoSeleted = (rows) => { + if (rows) { + rows.forEach((row) => { + if (row != undefined) { + tableref.value.toggleRowSelection(row, true) + } + }) + tableSelected.value = rows + } else { + SelectClear() + } + } + + //查找多个人可同时预约的项目 + const FindAllMatchItem = () => { + console.log(tableSelected.value) + tableSelected.value.reverse(); + let temp_reg_num = '' + let chongzhi = false; + let list = [] + if (tableSelected.value[0].list_status != 0) return false //如果勾选的不是申请中的医嘱则不进行匹配 + + tableData.value.forEach((v, i) => { + if (v.list_status == 0) { + if (v.id == tableSelected.value[0].id) { + list.push({ + name: v.entrust, + rowid: i, + first: 1 + }) + } else { + list.push({ + name: v.entrust, + rowid: i, + first: 0 + }) + } } }) + if (list.length >= 2) { + loading.value = true + CheckEntrstItemGroup({ + items: list + }).then(res => { + loading.value = false + if (res.status) { + let group = res.data.group + if (group.length > 1) { + ItemGroupShow.value = true; + ItemGroup.value = group + } else { + SelectClear(); + let d = [] + group[0].forEach((vv, ii) => { + vv.rowid.forEach((v3, i3) => { + d.push(tableData.value[v3]) + }) + }) + autoSeleted(d) + } + } else { + ElMessage.error(res.msg) + } + }) + } } - const Del=(id)=>{ - loading.value = true - ComboCrowdDel({ - id: id - }).then(res => { - loading.value = false - if (res.status) { - GetList() - } else { - ElMessage.error(res.msg) + + let ItemGroupShow = ref(false); + let ItemGroup = ref(null); + //查找同一个人同一个就诊号,当前页面 状态申请中的项目名称 + const FindPersonMatchItem = () => { + + console.log('开始匹配个人项目') + tableSelected.value.reverse(); + let temp_reg_num = '' + let chongzhi = false; + tableSelected.value.forEach((v, i) => { + if (temp_reg_num == '') { + temp_reg_num = v.reg_num + } + if (temp_reg_num != '' && temp_reg_num != v.reg_num) { + chongzhi = true + } + + }) + if (chongzhi === true) { + let a = tableSelected.value[0] + SelectClear(); + + autoSeleted([a]) + } + console.log(tableSelected.value) + let list = [] + if (tableSelected.value[0].list_status != 0) return false //如果勾选的不是申请中的医嘱则不进行匹配 + + tableData.value.forEach((v, i) => { + if (v.list_status == 0 && v.reg_num == tableSelected.value[0].reg_num && v.episodeid == + tableSelected.value[0].episodeid) { + if (v.id == tableSelected.value[0].id) { + list.push({ + name: v.entrust, + rowid: i, + first: 1 + }) + } else { + list.push({ + name: v.entrust, + rowid: i, + first: 0 + }) + } } }) + if (list.length >= 2) { + loading.value = true + CheckEntrstItemGroup({ + items: list + }).then(res => { + loading.value = false + if (res.status) { + let group = res.data.group + if (group.length > 10000000) { + ItemGroupShow.value = true; + ItemGroup.value = group + } else { + SelectClear(); + let d = [] + group[0].forEach((vv, ii) => { + vv.rowid.forEach((v3, i3) => { + d.push(tableData.value[v3]) + }) + + }) + autoSeleted(d) + } + } else { + ElMessage.error(res.msg) + } + }) + } + } + + + function mergeByRegNum(items) { + return items.reduce((acc, item) => { + const existingItem = acc.find(i => i.reg_num === item.reg_num); + + if (existingItem) { + // 如果找到了相同的reg_num,则添加当前id到ids数组中 + existingItem.entrustid.push(item.entrust_id); + } else { + // 如果没有找到相同的reg_num,则创建一个新的条目 + acc.push({ + entrustid: [item.entrust_id], + reg_num: item.reg_num, + episodeid: item.episodeid + }); + } + + return acc; + }, []); + } + const YuYueDialogClose = () => { + GetList() } //获取服务器时间 const GetServiceDate = () => { @@ -156,14 +482,68 @@ } }) } + //查看日志 + let LogShow = ref(false); + let LogList = ref(null); + let LogDataShow = ref(false); + const showLog = (row) => { + LogShow.value = true + GetLoglist({ + id: row.id + }).then(res => { + if (res.status) { + LogList.value = res.data + } + }) + } + let LogDataJson = ref(''); + const showLogJson = (data) => { + LogDataShow.value = true + LogDataJson.value = data + } + //打印申请单 + let print_shenqingdan_button = ref(null); + let shenqingdan_list = ref([]) + const print_shenqingdan = () => { + if (tableSelected.value.length !== 1) { + ElMessage.error('请选择1项进行打印') + return false + } + + getMainDetail({ + regnum: tableSelected.value[0].reg_num, + entrustid: tableSelected.value[0].entrust_id, + episodeid: tableSelected.value[0].episodeid, + appointment_type: 4 + }).then(res => { + if (res.status) { + let enable = true + shenqingdan_list.value = res.data.info + shenqingdan_list.value.forEach((v, i) => { + if (v.maininfo.list_status != 1) { + ElMessage.error(v.maininfo.entrust + " 不可打印,请重新选择") + enable = false + } + }) + if (enable) { + shenqingdan_show.value = true + setTimeout(function() { + print_shenqingdan_button.value.$el.click(); + shenqingdan_show.value = false + }, 500) + } + } else { + ElMessage.error(res.msg) + } + }) + } onMounted(() => { - GetList() - GetServiceDate() + GetServiceDate() }) \ No newline at end of file