From f520b31d4ddd3e21832ce63d0b884f3345b521b3 Mon Sep 17 00:00:00 2001 From: yanzai Date: Fri, 4 Apr 2025 22:16:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=A2=E6=A3=80=E5=8F=B7=E6=BA=90=20?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=20=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../API/Admin/YeWu/PlanController.php | 1 + .../API/Admin/YeWu/PlanTypeController.php | 3 ++ .../API/Admin/YeWu/WorkUnitController.php | 17 +++++++ .../Controllers/API/H5/PersonController.php | 1 + .../Controllers/API/H5/PlanController.php | 50 +++++++++++++++++-- Laravel/public/nginx.htaccess | 8 --- Laravel/routes/api.php | 1 + admin/src/api/api.js | 4 ++ admin/src/views/PlanMngr/PlanType.vue | 25 +++++++++- h5/pages/main/index/index.vue | 2 +- h5/pages/main/yytjsj/yytjsj_new.vue | 4 +- 11 files changed, 102 insertions(+), 14 deletions(-) create mode 100644 Laravel/app/Http/Controllers/API/Admin/YeWu/WorkUnitController.php diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanController.php index ebf90fb..06bcdad 100644 --- a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanController.php +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanController.php @@ -94,6 +94,7 @@ class PlanController extends Controller 'week' => $dayOfWeek, 'time' => $time->time, 'type' => $time->type, + 'bind_work_unit_id' => empty($planType)?null:$planType->bind_units, 'plan_number' => substr($cleanTime, 0, 4), 'is_vip' => empty($planType)?null: $planType->is_vip, 'use_type' => empty($planType)?null:$planType->use_type, diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanTypeController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanTypeController.php index 72cfb11..cb4ba57 100644 --- a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanTypeController.php +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanTypeController.php @@ -17,6 +17,7 @@ class PlanTypeController extends Controller 'use_type' => isset($Info['use_type']) ? $Info['use_type'] : null, 'sex' => isset($Info['sex']) ? $Info['sex'] : null, 'checkup_type_id' => isset($Info['checkup_type_id']) ? json_encode($Info['checkup_type_id']) : null, + 'bind_units' => isset($Info['bind_units']) ? json_encode($Info['bind_units']) : null, 'amount_limit1' => isset($Info['amount_limit1']) ? $Info['amount_limit1'] : 0, 'amount_limit2' => isset($Info['amount_limit2']) ? $Info['amount_limit2'] : 0, 'status'=>isset($Info['status']) ? $Info['status'] : 0, @@ -29,6 +30,7 @@ class PlanTypeController extends Controller return \Yz::echoError1('参数 ' . $field . ' 不能为空'); } } + $do=false; $table=DB::table('plan_type'); if($Info['id']==0){ @@ -83,6 +85,7 @@ class PlanTypeController extends Controller $info=DB::table('plan_type')->where(['id'=>$id,'is_del'=>0])->first(); if(!!$info){ $info->checkup_type_id=json_decode($info->checkup_type_id,true); + $info->bind_units=json_decode($info->bind_units,true); return \Yz::Return(true,'查询完成',$info); }else{ return \Yz::echoError1('查询失败'); diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/WorkUnitController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/WorkUnitController.php new file mode 100644 index 0000000..1acca4f --- /dev/null +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/WorkUnitController.php @@ -0,0 +1,17 @@ +where(['status'=>1,'is_del'=>0])->get(); + return \Yz::Return(true,'查询成功',['list'=>$list]); + } +} diff --git a/Laravel/app/Http/Controllers/API/H5/PersonController.php b/Laravel/app/Http/Controllers/API/H5/PersonController.php index d977ac6..e37216d 100644 --- a/Laravel/app/Http/Controllers/API/H5/PersonController.php +++ b/Laravel/app/Http/Controllers/API/H5/PersonController.php @@ -97,6 +97,7 @@ class PersonController extends Controller 'combo_id' => $group_info['套餐Id'], 'start_time' => $group_info['预约开始日期'], 'end_time' => $group_info['预约结束日期'], + 'danwei_name' => $group_info['单位名称'], 'group_name' => $group_info['单位名称'] . ($group_info['部门名称']), 'bumen_name' => $group_info['部门名称'], 'group_id' => $group_info['预约Id'], diff --git a/Laravel/app/Http/Controllers/API/H5/PlanController.php b/Laravel/app/Http/Controllers/API/H5/PlanController.php index 570b7c2..4521979 100644 --- a/Laravel/app/Http/Controllers/API/H5/PlanController.php +++ b/Laravel/app/Http/Controllers/API/H5/PlanController.php @@ -20,6 +20,10 @@ class PlanController extends Controller $checkup_type_id=request('checkup_type_id');//体检类型表对应id $amount=request('amount');//总金额 if(!isset($checkup_type_id)) return \Yz::echoError1("体检类型不能为空"); + + $danwei_id=request('danwei_id');//单位id + + $first_day_timestamp = strtotime($month . '-01'); $first_day = date('Y-m-d', $first_day_timestamp); //当月第一天 $last_day_timestamp = strtotime($month . '-01 +1 month -1 day'); @@ -31,7 +35,18 @@ class PlanController extends Controller ->whereRaw('JSON_CONTAINS(checkup_type_id, ?, "$")', [json_encode($checkup_type_id)]) ->where(['hospital_id'=>$hospital_id,'type'=>1,'is_del'=>0]) ->where('is_vip','<>',1) - ->whereIn('use_type',[0,$use_type]); + ->whereIn('use_type',[0,$use_type]) + ->where(function ($query) use ($danwei_id) { + // 检查 bind_work_unit_id 为 NULL 或空字符串 + $query->whereNull('bind_work_unit_id') + ->orWhere('bind_work_unit_id', '=', ''); + + // 如果 $danwei_id 不为空,则添加额外的条件 + if (!empty($danwei_id)) { + $query->orWhereRaw('JSON_CONTAINS(bind_work_unit_id, ?)', [json_encode($danwei_id)]); + } + }); + if(isset($person_id)){ $personInfo=DB::table('web_user_person')->where(['id'=>$person_id])->first(); if(!!$personInfo){ @@ -108,6 +123,9 @@ class PlanController extends Controller $checkup_type_id=(string)request('checkup_type_id');//体检类型表对应id $amount=request('amount');//总金额 if(!isset($checkup_type_id)) return \Yz::echoError1("体检类型不能为空"); + + $danwei_id=request('danwei_id');//单位名称 + $personInfo=false; if(isset($person_id)){ $personInfo=DB::table('web_user_person')->where(['id'=>$person_id])->first(); @@ -119,7 +137,20 @@ class PlanController extends Controller ->whereRaw('JSON_CONTAINS(checkup_type_id, ?, "$")',[$checkup_type_id]) ->where(['hospital_id'=>$hospital_id,'type'=>1,'is_del'=>0]) ->where('is_vip','<>',1) - ->whereIn('use_type',[0,$use_type]); + ->whereIn('use_type',[0,$use_type]) + ->where(function ($query) use ($danwei_id) { + // 检查 bind_work_unit_id 为 NULL 或空字符串 + $query->whereNull('bind_work_unit_id') + ->orWhere('bind_work_unit_id', '=', ''); + + // 如果 $danwei_id 不为空,则添加额外的条件 + if (!empty($danwei_id)) { + $query->orWhereRaw('JSON_CONTAINS(bind_work_unit_id, ?)', [json_encode($danwei_id)]); + } + }); + + + $comboItemsNmr=[]; if(!!$combo_id){ $comboInfo=DB::table('combos')->where(['combo_id'=>$combo_id])->first(); @@ -184,7 +215,20 @@ class PlanController extends Controller ->whereRaw('JSON_CONTAINS(checkup_type_id, ?, "$")', [$checkup_type_id]) ->where(['hospital_id'=>$hospital_id,'type'=>1,'is_del'=>0]) ->where('is_vip','<>',1) - ->whereIn('use_type',[0,$use_type]); + ->whereIn('use_type',[0,$use_type]) + ->where(function ($query) use ($danwei_id) { + // 检查 bind_work_unit_id 为 NULL 或空字符串 + $query->whereNull('bind_work_unit_id') + ->orWhere('bind_work_unit_id', '=', ''); + + // 如果 $danwei_id 不为空,则添加额外的条件 + if (!empty($danwei_id)) { + $query->orWhereRaw('JSON_CONTAINS(bind_work_unit_id, ?)', [json_encode($danwei_id)]); + } + }); + + + if(count($comboItemsNmr)>0 or count($ItemsNmr)>0 or !empty($er_xian_info)){ //如果有核磁项目,11点往后的号源不可用 $weeklist=$weeklist->where('time','<=','11:00'); diff --git a/Laravel/public/nginx.htaccess b/Laravel/public/nginx.htaccess index 743de63..e69de29 100644 --- a/Laravel/public/nginx.htaccess +++ b/Laravel/public/nginx.htaccess @@ -1,8 +0,0 @@ -location / { - # root html; - index index.php index.html index.htm; - - try_files $uri $uri/ /index.php$is_args$query_string; - - - } \ No newline at end of file diff --git a/Laravel/routes/api.php b/Laravel/routes/api.php index 66b4703..32d2d31 100644 --- a/Laravel/routes/api.php +++ b/Laravel/routes/api.php @@ -137,6 +137,7 @@ Route::group(['middleware' => ['checktoken', 'log'], 'prefix' => 'v1'], function Route::post('admin/CouponsGetDetail', 'App\Http\Controllers\API\Admin\YeWu\CouponsController@GetDetail'); Route::post('admin/QuestionExport', 'App\Http\Controllers\API\Admin\YeWu\QuestionLogController@Export');//导出回答 + Route::post('admin/GetWorkUnitEnableList', 'App\Http\Controllers\API\Admin\YeWu\WorkUnitController@GetEnableList');//获取单位列表 diff --git a/admin/src/api/api.js b/admin/src/api/api.js index 8fd46e8..31fb729 100644 --- a/admin/src/api/api.js +++ b/admin/src/api/api.js @@ -444,4 +444,8 @@ export const QuestionExport = (data = {}) => { //套餐保存排序 export const ComboSaveOrder = (data = {}) => { return axios({ url: import.meta.env.VITE_APP_API + `v1/admin/ComboSaveOrder`, data: data }) +} +//获取单位可用列表 +export const GetWorkUnitEnableList = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + `v1/admin/GetWorkUnitEnableList`, data: data }) } \ No newline at end of file diff --git a/admin/src/views/PlanMngr/PlanType.vue b/admin/src/views/PlanMngr/PlanType.vue index e1ad94c..564933b 100644 --- a/admin/src/views/PlanMngr/PlanType.vue +++ b/admin/src/views/PlanMngr/PlanType.vue @@ -88,6 +88,13 @@ + + + + + + @@ -146,7 +153,8 @@ CheckUpTypeGetEnableList, PlanTypeSave, PlanTypeGetDetail, - PlanTypeDel + PlanTypeDel, + GetWorkUnitEnableList } from '@/api/api.js' let loading = ref(false) let searchInfo = ref({}) @@ -246,9 +254,24 @@ } }) } + let EnableWorkUnitsList=ref([]); + const GetWorkUnitEnableListFunc=()=>{ + loading.value = true + GetWorkUnitEnableList({ + + }).then(res => { + loading.value = false + if (res.status) { + EnableWorkUnitsList.value=res.data.list + } else { + ElMessage.error(res.msg) + } + }) + } onMounted(() => { GetList() GetCheckUpTypeEnableList_Func() + GetWorkUnitEnableListFunc() }) diff --git a/h5/pages/main/index/index.vue b/h5/pages/main/index/index.vue index eed5493..ddd3e36 100644 --- a/h5/pages/main/index/index.vue +++ b/h5/pages/main/index/index.vue @@ -326,7 +326,7 @@ - 03281011 + 04042207 diff --git a/h5/pages/main/yytjsj/yytjsj_new.vue b/h5/pages/main/yytjsj/yytjsj_new.vue index b1a93b0..b200f31 100644 --- a/h5/pages/main/yytjsj/yytjsj_new.vue +++ b/h5/pages/main/yytjsj/yytjsj_new.vue @@ -160,7 +160,8 @@ amount: amount.value, combo_id:combo_id.value, item_ids:item_ids.value, - er_xian_info:er_xian_info.value + er_xian_info:er_xian_info.value, + danwei_id:(use_type.value==2 && $store.getGroupInfo()?.danwei_id)?$store.getGroupInfo()?.danwei_id:null } const response = await $api("GetDayPlanList", data); uni.hideLoading(); @@ -354,6 +355,7 @@ use_type: use_type.value, checkup_type_id: checkup_type_id.value, amount: amount.value, + danwei_id:(use_type.value==2 && $store.getGroupInfo()?.danwei_id)?$store.getGroupInfo()?.danwei_id:null } const response = await $api("GetMonthPlanCount", data); uni.hideLoading();