From 24edc0c1a981eb8dfdc6b5b1031313b037963321 Mon Sep 17 00:00:00 2001 From: yanzai Date: Sun, 29 Jun 2025 00:15:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E7=BA=BF=E5=A2=9E=E5=8A=A0=E8=83=83?= =?UTF-8?q?=E8=82=A0=E9=95=9C=E9=A2=84=E7=BA=A6=EF=BC=88=E6=9C=AA=E6=B5=8B?= =?UTF-8?q?=E9=80=9A=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/API/AspNetZhuanController.php | 4 +- .../Controllers/API/H5/ComboController.php | 15 ++-- .../Controllers/API/H5/OrderController.php | 85 +++++++++++++----- .../Controllers/API/H5/OrderNewController.php | 87 ++++++++++++++----- Laravel/app/Services/OrderService.php | 4 +- h5/config.js | 4 +- 6 files changed, 141 insertions(+), 58 deletions(-) diff --git a/Laravel/app/Http/Controllers/API/AspNetZhuanController.php b/Laravel/app/Http/Controllers/API/AspNetZhuanController.php index 39029d4..2c298a4 100644 --- a/Laravel/app/Http/Controllers/API/AspNetZhuanController.php +++ b/Laravel/app/Http/Controllers/API/AspNetZhuanController.php @@ -44,8 +44,8 @@ class AspNetZhuanController extends Controller //二线预约 public static function ErXian($data,$nonce) { - // $res= self::Post(self::$BaseUrl . '/erxianzhongzhuan.aspx?str='.$nonce,$data,'二线号源'); - $res= self::Post(self::$BaseUrl . '/erxian.aspx?str='.$nonce,$data,'二线号源'); + $res= self::Post(self::$BaseUrl . '/test.aspx?str='.$nonce,$data,'二线号源'); + // $res= self::Post(self::$BaseUrl . '/erxian.aspx?str='.$nonce,$data,'二线号源'); if($data['action']==2) return $res['gid']??false; return $res['data']??true; } diff --git a/Laravel/app/Http/Controllers/API/H5/ComboController.php b/Laravel/app/Http/Controllers/API/H5/ComboController.php index 59270f9..929638e 100644 --- a/Laravel/app/Http/Controllers/API/H5/ComboController.php +++ b/Laravel/app/Http/Controllers/API/H5/ComboController.php @@ -367,7 +367,7 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4) if($r_v['zu_name'] == $n1v['组名称']){ foreach ($n1v['包含项目'] as $k2 => $v2){ if($v2['Id'] == $r_v['item_id']){ - if($v2['科室名称']=='影像科'){ + if($v2['科室名称']=='影像科' or $v2['科室名称']=='胃肠镜室'){ $nmr_list[]=[ 'item_id' => $v2['Id'], 'name' => $v2['名称'], @@ -454,7 +454,7 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4) } $combo_info['tags'][0]['text']=$comboItemCount. '个项目'; //如果有影像科,则存储在nmr_list - $comboItem=DB::table('combo_items')->where(['combo_id' => $combo_id, 'status' => 1,'keshi_name'=>'影像科'])->get(); + $comboItem=DB::table('combo_items')->where(['combo_id' => $combo_id, 'status' => 1])->whereIn('keshi_name',['影像科','胃肠镜室'])->get(); if(count($comboItem)>0){ foreach ($comboItem as $item){ $nmr_list[]=[ @@ -493,7 +493,7 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4) $groupedData[$keshiName][] = ['desc' => $item->jianjie, 'name' => $item->name,'price'=>number_format( $item->price * config('app.globals.ZiXuan_ZheKou'), 2, '.', ''),'original_price'=>$item->original_price,'id'=>$item->item_id]; //如果有影像科,则存储在nmr_list字段 - if($item->keshi_name=='影像科'){ + if($item->keshi_name=='影像科' or $item->keshi_name=='胃肠镜室'){ $nmr_list[]=[ 'item_id' => $item->item_id, 'name' => $item->name, @@ -583,7 +583,7 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4) if ($it->item_id == $item['id']) { $item['keshi_name'] = $it->keshi_name; $item['desc'] = $it->jianjie; - if($it->keshi_name=='影像科'){ + if($it->keshi_name=='影像科' or $it->keshi_name=='胃肠镜室'){ $nmr_list[]=[ 'item_id' => $it->item_id, 'name' => $it->name, @@ -620,17 +620,19 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4) } $temp_nmr=[]; - $keywords = ['磁']; + $keywords = ['磁','食管镜','肠镜检']; foreach ($nmr_list as $key=>$item){ foreach ($keywords as $index => $keyword) { if (strpos($item['name'], $keyword) !== false) { // 如果找到关键字,且结果数组中还没有该关键字的记录,则初始化 + $leixing=$index+1; if (!isset($temp_nmr[$index])) { $temp_nmr[$index] = [ 'item_id' => $item['item_id'], 'name' => $item['name'], 'price' => $item['price'], + 'leixing' => $leixing, ]; } else { // 如果已经存在记录,只拼接名称 @@ -645,7 +647,8 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4) $finalResult[] = [ 'item_id' => $data['item_id'], 'name' => $data['name'], - 'price' => $data['price'] + 'price' => $data['price'], + 'leixing' => $data['leixing'], ]; } diff --git a/Laravel/app/Http/Controllers/API/H5/OrderController.php b/Laravel/app/Http/Controllers/API/H5/OrderController.php index 5c24617..d1f0e40 100644 --- a/Laravel/app/Http/Controllers/API/H5/OrderController.php +++ b/Laravel/app/Http/Controllers/API/H5/OrderController.php @@ -444,35 +444,70 @@ class OrderController extends Controller $plan_nmr_info=[]; if (isset($erxian_info) and !empty($erxian_info)) { foreach ($erxian_info as $erxian_item) { - $nmrPlans=$AspNet::ErXian(['yyid'=>6,'data'=>[$plan->date],'action'=>"1"],uniqid()); - // if($plan->time<="12:00") $end_time="12:00"; - // if($plan->time>"12:00") $end_time="23:59"; - $end_time="23:59"; - if(!isset($nmrPlans[$plan->date]) or empty($nmrPlans[$plan->date])) return \Yz::echoError1("二线号源不可用,请重新选择日期"); - $temp_date=[]; - $planTime = new DateTime($plan->time); - $planTime->modify('+1 hour'); - $plan_time=$planTime->format('H:i'); - foreach ($nmrPlans[$plan->date] as $nmp_p){ - if($nmp_p['Time']>=$plan_time and $nmp_p['Time']<=$end_time and $nmp_p['keyong']==="0"){ - $temp_date=[ - "item_id"=>$erxian_item['item_id'], - "name"=>$erxian_item['name'], - "price"=>$erxian_item['price'], - "time"=>$plan->date." ".$nmp_p['Time'], - ]; - $plan_nmr_info[]=$temp_date; - break; + if($erxian_item['leixing']==1){ + $nmrPlans=$AspNet::ErXian(['yyid'=>6,'data'=>[$plan->date],'action'=>"1",'leixing'=>$erxian_item['leixing']],uniqid()); + $end_time="23:59"; + if(!isset($nmrPlans[$plan->date]) or empty($nmrPlans[$plan->date])) return \Yz::echoError1("二线号源不可用,请重新选择日期"); + $temp_date=[]; + $planTime = new DateTime($plan->time); + $planTime->modify('+1 hour'); + $plan_time=$planTime->format('H:i'); + foreach ($nmrPlans[$plan->date] as $nmp_p){ + if($nmp_p['Time']>=$plan_time and $nmp_p['Time']<=$end_time and $nmp_p['keyong']==="0"){ + $temp_date=[ + "item_id"=>$erxian_item['item_id'], + "name"=>$erxian_item['name'], + "price"=>$erxian_item['price'], + "time"=>$plan->date." ".$nmp_p['Time'], + "leixing"=>$erxian_item['leixing'] + ]; + $plan_nmr_info[]=$temp_date; + break; + } } - } - if(empty($temp_date)) { - if(isset($yuyue_fangshi) and $yuyue_fangshi<>'GeJianPlanFront') { //个检先选号源此处不提示 不拦截 - return \Yz::echoError1("二线号源不可用,请重新选择日期"); + if(empty($temp_date)) { + if(isset($yuyue_fangshi) and $yuyue_fangshi<>'GeJianPlanFront') { //个检先选号源此处不提示 不拦截 + return \Yz::echoError1("二线号源不可用,请重新选择日期"); + } + } + + if($erxian_item['leixing']==2 or $erxian_item['leixing']==3){ + $find=false; + $startDate = $plan->date; + $date = new DateTime($startDate); + $date->modify('+1 day'); // 先跳过当天 + for ($i = 0; $i < 15; $i++) { + $newdate=$date->format('Y-m-d'); + $nmrPlans=$AspNet::ErXian(['yyid'=>6,'data'=>[$newdate],'action'=>"1",'leixing'=>$erxian_item['leixing']],uniqid()); + if(!isset($nmrPlans[$newdate]) or empty($nmrPlans[$newdate])){ + $date->modify('+1 day'); + continue; + } + foreach ($nmrPlans[$newdate] as $nmp_p){ + if($nmp_p['keyong']==="0"){ + $temp_date=[ + "item_id"=>$erxian_item['item_id'], + "name"=>$erxian_item['name'], + "price"=>$erxian_item['price'], + "time"=>$newdate." ".$nmp_p['Time'], + "leixing"=>$erxian_item['leixing'] + ]; + $plan_nmr_info[]=$temp_date; + $find=true; + break; + } + } + if($find) break; + // 增加一天 + $date->modify('+1 day'); + } } + } + } } @@ -489,9 +524,10 @@ class OrderController extends Controller 'date' => $dt[0], 'time' => $dt[1], 'price' => $plan_nmr['price'], + 'leixing' => $plan_nmr['leixing'] ]; //调用接口校验号源是否可用 - $erxian_status = $AspNet::ErXian(['YYRQ' => $p_nmr_data['date'], 'YYSJ' => $p_nmr_data['time'], 'yyid' => $yyid, 'action' => 4], uniqid()); + $erxian_status = $AspNet::ErXian(['YYRQ' => $p_nmr_data['date'], 'YYSJ' => $p_nmr_data['time'], 'yyid' => $yyid, 'action' => 4,'leixing'=>$p_nmr_data['leixing']], uniqid()); if ($erxian_status !== true) { if(isset($yuyue_fangshi) and $yuyue_fangshi<>'GeJianPlanFront') { //个检先选号源此处不提示 不拦截 return \Yz::echoError1($p_nmr_data['name'] . '号源不可用,请重新选择'); @@ -596,6 +632,7 @@ class OrderController extends Controller 'ZCRQ'=>$nowDateTime, 'yyid'=>$yyid, 'action'=>2, + 'leixing'=>$plan_nmr['leixing'] ]; //调用接口预约二线 $erxian_yuyue= $AspNet::ErXian($p_nmr_data, uniqid()); diff --git a/Laravel/app/Http/Controllers/API/H5/OrderNewController.php b/Laravel/app/Http/Controllers/API/H5/OrderNewController.php index d4e2121..8e50be2 100644 --- a/Laravel/app/Http/Controllers/API/H5/OrderNewController.php +++ b/Laravel/app/Http/Controllers/API/H5/OrderNewController.php @@ -319,6 +319,7 @@ class OrderNewController extends Controller "item_id" => $erxian_item['item_id'], "name" => $erxian_item['name'], "price" => $erxian_item['price'], + "leixing"=>$erxian_item['leixing'], ]; $plan_nmr_info[] = $temp_date; } @@ -486,30 +487,68 @@ class OrderNewController extends Controller $erxian_info=json_decode($order->erxian_appointment_info,true); $AspNet = new AspNetZhuanController(); if (isset($erxian_info) and !empty($erxian_info)) { - foreach ($erxian_info as $erxian_item) { - $nmrPlans=$AspNet::ErXian(['yyid'=>6,'data'=>[$plan->date],'action'=>"1"],uniqid()); - $end_time="23:59"; - if(!isset($nmrPlans[$plan->date]) or empty($nmrPlans[$plan->date])) return \Yz::echoError1("二线号源不可用,请重新选择日期"); - $temp_date=[]; - $planTime = new DateTime($plan->time); - $planTime->modify('+1 hour'); - $plan_time=$planTime->format('H:i'); - foreach ($nmrPlans[$plan->date] as $nmp_p){ - if($nmp_p['Time']>=$plan_time and $nmp_p['Time']<=$end_time and $nmp_p['keyong']==="0"){ - $temp_date=[ - "item_id"=>$erxian_item['item_id'], - "name"=>$erxian_item['name'], - "price"=>$erxian_item['price'], - "time"=>$plan->date." ".$nmp_p['Time'], - ]; - $plan_nmr_info[]=$temp_date; - break; + foreach ($erxian_info as $key=> $erxian_item) { + + if($erxian_item['leixing']==1){ + $nmrPlans=$AspNet::ErXian(['yyid'=>6,'data'=>[$plan->date],'action'=>"1",'leixing'=>$erxian_item['leixing']],uniqid()); + $end_time="23:59"; + if(!isset($nmrPlans[$plan->date]) or empty($nmrPlans[$plan->date])) return \Yz::echoError1("二线号源不可用,请重新选择日期"); + $temp_date=[]; + $planTime = new DateTime($plan->time); + $planTime->modify('+1 hour'); + $plan_time=$planTime->format('H:i'); + foreach ($nmrPlans[$plan->date] as $nmp_p){ + if($nmp_p['Time']>=$plan_time and $nmp_p['Time']<=$end_time and $nmp_p['keyong']==="0"){ + $temp_date=[ + "item_id"=>$erxian_item['item_id'], + "name"=>$erxian_item['name'], + "price"=>$erxian_item['price'], + "time"=>$plan->date." ".$nmp_p['Time'], + "leixing"=>$erxian_item['leixing'] + ]; + $plan_nmr_info[]=$temp_date; + break; + } } + if(empty($temp_date)) return \Yz::echoError1("二线号源不可用,请重新选择日期"); } - if(empty($temp_date)) return \Yz::echoError1("二线号源不可用,请重新选择日期"); + if($erxian_item['leixing']==2 or $erxian_item['leixing']==3){ + $find=false; + $startDate = $plan->date; + $date = new DateTime($startDate); + $date->modify('+1 day'); // 先跳过当天 + for ($i = 0; $i < 15; $i++) { + $newdate=$date->format('Y-m-d'); + $nmrPlans=$AspNet::ErXian(['yyid'=>6,'data'=>[$newdate],'action'=>"1",'leixing'=>$erxian_item['leixing']],uniqid()); + if(!isset($nmrPlans[$newdate]) or empty($nmrPlans[$newdate])){ + $date->modify('+1 day'); + continue; + } + foreach ($nmrPlans[$newdate] as $nmp_p){ + if($nmp_p['keyong']==="0"){ + $temp_date=[ + "item_id"=>$erxian_item['item_id'], + "name"=>$erxian_item['name'], + "price"=>$erxian_item['price'], + "time"=>$newdate." ".$nmp_p['Time'], + "leixing"=>$erxian_item['leixing'] + ]; + $plan_nmr_info[]=$temp_date; + $find=true; + break; + } + } + if($find) break; + // 增加一天 + $date->modify('+1 day'); + } + } + + + } } -//校验二线号源 + //校验二线号源 if (isset($plan_nmr_info) and !empty($plan_nmr_info)) { $plan_nmr_temp = []; foreach ($plan_nmr_info as $key => $plan_nmr) { @@ -521,9 +560,10 @@ class OrderNewController extends Controller 'date' => $dt[0], 'time' => $dt[1], 'price' => $plan_nmr['price'], + 'leixing' => $plan_nmr['leixing'] ]; //调用接口校验号源是否可用 - $erxian_status = $AspNet::ErXian(['YYRQ' => $p_nmr_data['date'], 'YYSJ' => $p_nmr_data['time'], 'yyid' => $yyid, 'action' => 4], uniqid()); + $erxian_status = $AspNet::ErXian(['YYRQ' => $p_nmr_data['date'], 'YYSJ' => $p_nmr_data['time'], 'yyid' => $yyid, 'action' => 4,'leixing'=>$p_nmr_data['leixing']], uniqid()); if ($erxian_status !== true) return \Yz::echoError1($p_nmr_data['name'] . '号源不可用,请重新选择'); $plan_nmr_temp[] = $p_nmr_data; } @@ -559,6 +599,7 @@ class OrderNewController extends Controller 'ZCRQ'=>$nowDateTime, 'yyid'=>$yyid, 'action'=>2, + 'leixing'=>$plan_nmr['leixing'] ]; //调用接口预约二线 $erxian_yuyue= $AspNet::ErXian($p_nmr_data, uniqid()); @@ -579,9 +620,11 @@ class OrderNewController extends Controller 'plan_id' => $plan->id, 'plan_number' => $plan->plan_number, 'doctor' => $doctor, - 'erxian_appointment_info'=>json_encode($plan_nmr_appointment_info, JSON_UNESCAPED_UNICODE), 'updated_at' => date('Y-m-d H:i:s') ]; + if(!empty($plan_nmr_appointment_info)){ + $data['erxian_appointment_info']=json_encode($plan_nmr_appointment_info, JSON_UNESCAPED_UNICODE); + } $u = DB::table('orders')->where(['id' => $orderid])->update($data); $up_plan = DB::table('plans')->where(['id' => $plan->id, 'status' => 1])->update([ 'status' => 2 diff --git a/Laravel/app/Services/OrderService.php b/Laravel/app/Services/OrderService.php index c82af59..6776ecb 100644 --- a/Laravel/app/Services/OrderService.php +++ b/Laravel/app/Services/OrderService.php @@ -270,9 +270,9 @@ class OrderService $erxian_info=json_decode($orderInfo->erxian_appointment_info, true); if (isset($erxian_info) and !empty($erxian_info)) { foreach ($erxian_info as $key => $plan_nmr) { - if(isset($plan_nmr['gid'])){ + if(isset($plan_nmr['gid']) and !empty($plan_nmr['gid'])){ //调用接口取消二线 - $erxian_status = $AspNet::ErXian(['id' =>$plan_nmr['gid'], 'yyid' => $yyid, 'action' => 3], uniqid()); + $erxian_status = $AspNet::ErXian(['id' =>$plan_nmr['gid'], 'yyid' => $yyid, 'action' => 3,'leixing'=>$plan_nmr['leixing']], uniqid()); $erxian_info[$key]['gid']=''; $ex_u= DB::table('orders')->where(['id' => $orderInfo->id])->update([ 'erxian_appointment_info'=>json_encode($erxian_info, JSON_UNESCAPED_UNICODE), diff --git a/h5/config.js b/h5/config.js index 8d29e36..ac2205a 100644 --- a/h5/config.js +++ b/h5/config.js @@ -1,7 +1,7 @@ const app_type = 'gzh' //const base_url = "https://api.hainan2024.sa0.online" //开发环境 -const base_url="https://tj-h5.hnxdfe.com" //正式环境 -//const base_url="http://124.225.137.54:39081" //测试环境 +//const base_url="https://tj-h5.hnxdfe.com" //正式环境 +const base_url="http://124.225.137.54:39081" //测试环境 const config = { api_map_url: base_url + '/api/ApiMap/h5', base_assets_url: base_url,