diff --git a/Laravel/app/Http/Controllers/API/Web/OrderController.php b/Laravel/app/Http/Controllers/API/Web/OrderController.php index 3740b20..3ec4c20 100644 --- a/Laravel/app/Http/Controllers/API/Web/OrderController.php +++ b/Laravel/app/Http/Controllers/API/Web/OrderController.php @@ -33,14 +33,14 @@ class OrderController extends Controller $doctor = request('doctor');//预约的医生名字 $appdoctor_department = request('appdoctor_department');//预约的医生的科室 $appdoctor = request('appdoctor');//协助预约的医生名字 - $person= request('person'); //sex,birthday,married,name,id_number,phone - $married_array=["未婚","已婚","丧偶","离婚","其他"]; - if(isset($person['married'])){ - $key= array_search($person['married'], $married_array); + $person = request('person'); //sex,birthday,married,name,id_number,phone + $married_array = ["未婚", "已婚", "丧偶", "离婚", "其他"]; + if (isset($person['married'])) { + $key = array_search($person['married'], $married_array); if ($key !== false) { - $person['married']=$key; + $person['married'] = $key; } else { - $person['married']=4; + $person['married'] = 4; } } @@ -67,17 +67,17 @@ class OrderController extends Controller 'group' => [ 'id' => '', ], - 'nmr_list'=>[] + 'nmr_list' => [] ]; //如果是套餐 - $TJ_Leixing_id=1;//存储用体检类型 + $TJ_Leixing_id = 1;//存储用体检类型 $checkup_type_id = false; //体检类型id if (isset($combo_id) and $combo_id <> 0) { $combo_info = DB::table('combos')->where(['combo_id' => $combo_id, 'status' => 1])->first(); if (!$combo_info) return \Yz::echoError1("套餐不存在"); if (!isset($combo_info->checkup_type_id)) return \Yz::echoError1("套餐未关联体检类型"); $checkup_type_id = $combo_info->checkup_type_id; - $TJ_Leixing_id=$checkup_type_id; + $TJ_Leixing_id = $checkup_type_id; $price += $combo_info->price; $title = $combo_info->name; $buy_info['combo'] = [ @@ -86,10 +86,10 @@ class OrderController extends Controller 'price' => $combo_info->price, ]; //如果有影像科,则存储在nmr_list字段 - $comboItem=DB::table('combo_items')->where(['combo_id' => $combo_id, 'status' => 1,'keshi_name'=>'影像科'])->get(); - if(count($comboItem)>0){ - foreach ($comboItem as $item){ - $buy_info['nmr_list'][]=[ + $comboItem = DB::table('combo_items')->where(['combo_id' => $combo_id, 'status' => 1, 'keshi_name' => '影像科'])->get(); + if (count($comboItem) > 0) { + foreach ($comboItem as $item) { + $buy_info['nmr_list'][] = [ 'item_id' => $item->item_id, 'name' => $item->name, ]; @@ -112,8 +112,8 @@ class OrderController extends Controller 'price' => $item->price ]; //如果有影像科,则存储在nmr_list字段 - if($item->keshi_name=='影像科'){ - $buy_info['nmr_list'][]=[ + if ($item->keshi_name == '影像科') { + $buy_info['nmr_list'][] = [ 'item_id' => $item->item_id, 'name' => $item->name, ]; @@ -144,7 +144,7 @@ class OrderController extends Controller 'items' => $group_info['items'], 'group_id' => $group_info['group_id'], ]; - $TJ_Leixing_id=$group_info['checkup_type_id']; + $TJ_Leixing_id = $group_info['checkup_type_id']; $title = "单位团检" . $group_info['combo_name']; $price = $price + $group_info['sixi_zong_ji_jin_e']; $need_pay = ($price - $group_info['tongshou_xiane']) > 0 ? $price - $group_info['tongshou_xiane'] : 0; @@ -153,11 +153,11 @@ class OrderController extends Controller $true_price = $need_pay; //如果有影像科,则存储在nmr_list字段 - $all_items = DB::table('items')->where(['status' => 1,'keshi_name'=>'影像科'])->get(); + $all_items = DB::table('items')->where(['status' => 1, 'keshi_name' => '影像科'])->get(); foreach ($group_info['items'] as $item) { foreach ($all_items as $it) { if ($it->item_id == $item['id']) { - $buy_info['nmr_list'][]=[ + $buy_info['nmr_list'][] = [ 'item_id' => $item->item_id, 'name' => $item->name, ]; @@ -178,7 +178,7 @@ class OrderController extends Controller "序号" => 0, "性别" => $person['sex'] == 1 ? '男' : '女', "年龄" => floor((time() - strtotime($person['birthday'])) / 86400 / 360), - "婚姻状态" => $person['married']== 1 ? '已婚' : '未婚', + "婚姻状态" => $person['married'] == 1 ? '已婚' : '未婚', ]], '套餐Id' => $combo_id == 0 ? null : $combo_id, '可选项目信息' => $check_items, @@ -210,8 +210,8 @@ class OrderController extends Controller 'title' => $title, 'type' => $type, 'source' => 'web', - 'web_user_id' =>0, - 'checkup_type_id'=>$TJ_Leixing_id, + 'web_user_id' => 0, + 'checkup_type_id' => $TJ_Leixing_id, 'person_id' => 0, 'name' => $person['name'], 'id_number' => $person['id_number'], @@ -227,8 +227,8 @@ class OrderController extends Controller 'combo_id' => $combo_id, 'hospital_id' => $hospital_id, 'doctor' => $doctor, - 'appdoctor'=>$appdoctor, - 'appdoctor_department'=>$appdoctor_department, + 'appdoctor' => $appdoctor, + 'appdoctor_department' => $appdoctor_department, 'phone' => $person['phone'], 'sex' => $person['sex'], 'birthday' => $person['birthday'], @@ -241,40 +241,41 @@ class OrderController extends Controller ]); if ($insert and $up_plan) { DB::commit(); - $action=false; - if($true_price===0){ + $action = false; + if ($true_price === 0) { //如果是免费的,直接去预约 - $yuyue= self::Finish($order_num); - if($yuyue['status']===true){ - return \Yz::return(true, "操作成功", ['action' => $action,'orderid'=>$insert]); - }else{ + $yuyue = self::Finish($order_num); + if ($yuyue['status'] === true) { + return \Yz::return(true, "操作成功", ['action' => $action, 'orderid' => $insert]); + } else { return \Yz::echoError1($yuyue['msg']); } } - if($true_price>0){ + if ($true_price > 0) { //如果大于0则提示前端去支付 - $action="pay"; + $action = "pay"; } - $AspZhuan=new AspNetZhuanController(); - $reqst_data=[ - 'ghzid'=>$person['ghzid'], - 'yyid'=>6, - 'type'=>28, - 'msg1'=>$person['name'], - 'msg2'=>$title, - 'msg3'=>number_format($true_price , 2, '.', ''), - 'msg4'=>$plan->date.' '.$plan->time, - 'msg5'=>"健康管理中心", - 'msg6'=>"", - 'url'=>"pages/other/entry/index?path=/pages/other/jump-h5/index&src=https%3A%2F%2Ftj-h5.hnxdfe.com%2Fh5%2F%23%2Fpages%2Fmain%2Flogin%2Flogin%3Fpath%3Dorder&scene=1014", + $AspZhuan = new AspNetZhuanController(); + $reqst_data = [ + 'ghzid' => $person['ghzid'], + 'yyid' => 6, + 'type' => 28, + 'msg1' => $person['name'], + 'msg2' => $title, + 'msg3' => number_format($true_price, 2, '.', ''), + 'msg4' => $plan->date . ' ' . $plan->time, + 'msg5' => "健康管理中心", + 'msg6' => "", + 'url' => "pages/other/entry/index?path=/pages/other/jump-h5/index&src=https%3A%2F%2Ftj-h5.hnxdfe.com%2Fh5%2F%23%2Fpages%2Fmain%2Flogin%2Flogin%3Fpath%3Dorder&scene=1014", ]; $AspZhuan::WeiXinSend($reqst_data); - return \Yz::return(true, "操作成功", ['action' => $action,'orderid'=>$insert]); + return \Yz::return(true, "操作成功", ['action' => $action, 'orderid' => $insert]); } else { DB::rollBack(); return \Yz::echoError1('操作失败'); } } + //客服预约,只占用号源 public function CreateYuYueOrder() { @@ -288,14 +289,14 @@ class OrderController extends Controller $plan_id = request('plan_id');//号源id $doctor = request('doctor');//预约的医生名字 $appdoctor = request('appdoctor');//协助预约的医生名字 - $person= request('person'); //sex,birthday,married,name,id_number,phone - $married_array=["未婚","已婚","丧偶","离婚","其他"]; - if(isset($person['married'])){ - $key= array_search($person['married'], $married_array); + $person = request('person'); //sex,birthday,married,name,id_number,phone + $married_array = ["未婚", "已婚", "丧偶", "离婚", "其他"]; + if (isset($person['married'])) { + $key = array_search($person['married'], $married_array); if ($key !== false) { - $person['married']=$key; + $person['married'] = $key; } else { - $person['married']=4; + $person['married'] = 4; } } @@ -322,17 +323,17 @@ class OrderController extends Controller 'group' => [ 'id' => '', ], - 'nmr_list'=>[] + 'nmr_list' => [] ]; //如果是套餐 - $TJ_Leixing_id=1;//存储用体检类型 + $TJ_Leixing_id = 1;//存储用体检类型 $checkup_type_id = false; //体检类型id if (isset($combo_id) and $combo_id <> 0) { $combo_info = DB::table('combos')->where(['combo_id' => $combo_id, 'status' => 1])->first(); if (!$combo_info) return \Yz::echoError1("套餐不存在"); if (!isset($combo_info->checkup_type_id)) return \Yz::echoError1("套餐未关联体检类型"); $checkup_type_id = $combo_info->checkup_type_id; - $TJ_Leixing_id=$checkup_type_id; + $TJ_Leixing_id = $checkup_type_id; $price += $combo_info->price; $title = $combo_info->name; $buy_info['combo'] = [ @@ -341,10 +342,10 @@ class OrderController extends Controller 'price' => $combo_info->price, ]; //如果有影像科,则存储在nmr_list字段 - $comboItem=DB::table('combo_items')->where(['combo_id' => $combo_id, 'status' => 1,'keshi_name'=>'影像科'])->get(); - if(count($comboItem)>0){ - foreach ($comboItem as $item){ - $buy_info['nmr_list'][]=[ + $comboItem = DB::table('combo_items')->where(['combo_id' => $combo_id, 'status' => 1, 'keshi_name' => '影像科'])->get(); + if (count($comboItem) > 0) { + foreach ($comboItem as $item) { + $buy_info['nmr_list'][] = [ 'item_id' => $item->item_id, 'name' => $item->name, ]; @@ -366,8 +367,8 @@ class OrderController extends Controller 'price' => $item->price ]; //如果有影像科,则存储在nmr_list字段 - if($item->keshi_name=='影像科'){ - $buy_info['nmr_list'][]=[ + if ($item->keshi_name == '影像科') { + $buy_info['nmr_list'][] = [ 'item_id' => $item->item_id, 'name' => $item->name, ]; @@ -396,7 +397,7 @@ class OrderController extends Controller 'items' => $group_info['items'], 'group_id' => $group_info['group_id'], ]; - $TJ_Leixing_id=$group_info['checkup_type_id']; + $TJ_Leixing_id = $group_info['checkup_type_id']; $title = "单位团检" . $group_info['combo_name']; $price = $price + $group_info['sixi_zong_ji_jin_e']; $need_pay = ($price - $group_info['tongshou_xiane']) > 0 ? $price - $group_info['tongshou_xiane'] : 0; @@ -405,11 +406,11 @@ class OrderController extends Controller $true_price = $need_pay; //如果有影像科,则存储在nmr_list字段 - $all_items = DB::table('items')->where(['status' => 1,'keshi_name'=>'影像科'])->get(); + $all_items = DB::table('items')->where(['status' => 1, 'keshi_name' => '影像科'])->get(); foreach ($group_info['items'] as $item) { foreach ($all_items as $it) { if ($it->item_id == $item['id']) { - $buy_info['nmr_list'][]=[ + $buy_info['nmr_list'][] = [ 'item_id' => $item->item_id, 'name' => $item->name, ]; @@ -430,7 +431,7 @@ class OrderController extends Controller "序号" => 0, "性别" => $person['sex'] == 1 ? '男' : '女', "年龄" => floor((time() - strtotime($person['birthday'])) / 86400 / 360), - "婚姻状态" => $person['married']== 1 ? '已婚' : '未婚', + "婚姻状态" => $person['married'] == 1 ? '已婚' : '未婚', ]], '套餐Id' => $combo_id == 0 ? null : $combo_id, '可选项目信息' => $check_items, @@ -462,8 +463,8 @@ class OrderController extends Controller 'title' => $title, 'type' => $type, 'source' => 'web', - 'web_user_id' =>0, - 'checkup_type_id'=>$TJ_Leixing_id, + 'web_user_id' => 0, + 'checkup_type_id' => $TJ_Leixing_id, 'person_id' => 0, 'name' => $person['name'], 'id_number' => $person['id_number'], @@ -479,7 +480,7 @@ class OrderController extends Controller 'combo_id' => $combo_id, 'hospital_id' => $hospital_id, 'doctor' => $doctor, - 'appdoctor'=>$appdoctor, + 'appdoctor' => $appdoctor, 'phone' => $person['phone'], 'sex' => $person['sex'], 'birthday' => $person['birthday'], @@ -493,35 +494,46 @@ class OrderController extends Controller if ($insert and $up_plan) { DB::commit(); - return \Yz::return(true, "操作成功", ['orderid'=>$insert]); + return \Yz::return(true, "操作成功", ['orderid' => $insert]); } else { DB::rollBack(); return \Yz::echoError1('操作失败'); } } + public function SearchOrder(Request $request) + { + $order_start = $request->post('order_start'); + $order_end = $request->post('order_end'); + $list = DB::table('orders'); + $list = $list->where('created_at', '>=', $order_start); + $list = $list->where('created_at', '<=', $order_end); + $list = $list->orderBy('id', 'desc')->get(); + return \Yz::return(true, "操作成功", ['list' => $list]); + } + public function export() { - $dates=request('dates'); - $key=request('key'); - if($key <>"ddXPpBrM3C93PHFdWDXbMX2vQ2AJQFFy"){ + $dates = request('dates'); + $key = request('key'); + if ($key <> "ddXPpBrM3C93PHFdWDXbMX2vQ2AJQFFy") { return \Yz::echoErrorJson('无权访问'); } - if(!$dates){ + if (!$dates) { return \Yz::echoErrorJson('请选择日期'); } - $table_list=DB::table('orders')->where(['source'=>'web'])->whereBetween('created_at',[$dates[0].' 00:00:00',$dates[1].' 23:59:59']) + $table_list = DB::table('orders')->where(['source' => 'web'])->whereBetween('created_at', [$dates[0] . ' 00:00:00', $dates[1] . ' 23:59:59']) ->select(DB::raw("*, CASE WHEN sex = 1 THEN '男' WHEN sex = 2 THEN '女' ELSE '未知' END as sex")) ->get(); - $status_array=[ - 1=>'未支付', - 2=>'已支付', - 3=>'已取消', - 4=>'到检', - 5=>'已退款', + $status_array = [ + 1 => '未支付', + 2 => '已支付', + 3 => '已取消', + 4 => '到检', + 5 => '已退款', ]; foreach ($table_list as $list_item) { - $list_item->status=$status_array[$list_item->status]; + $list_item->status = $status_array[$list_item->status]; } $template_path = Storage::path('public/excel/hiszhuanzhen.xlsx'); $spreadsheet = IOFactory::load($template_path); @@ -561,7 +573,7 @@ class OrderController extends Controller $writer = new Xlsx($spreadsheet); $writer->save(Storage::path($excel_path)); $url = Storage::url($excel_path); - return ['status'=>true,'msg'=>'查询完成','url'=> env('APP_URL').$url]; + return ['status' => true, 'msg' => '查询完成', 'url' => env('APP_URL') . $url]; } public function item_check($hospital, $data) @@ -570,6 +582,7 @@ class OrderController extends Controller $check = $peis::Post('套餐项目检查', $hospital, $data); return $check; } + public function generateOrderNumber() { // 获取当前时间的时间戳(精确到毫秒) diff --git a/Laravel/public/tool/register.html b/Laravel/public/tool/register.html index 93ae6da..7a758fc 100644 --- a/Laravel/public/tool/register.html +++ b/Laravel/public/tool/register.html @@ -2,17 +2,17 @@ - + - - - - - + content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/> + + + + + - + 体检登记 @@ -130,197 +131,250 @@ -
- - +
+ + +
+
+ + + + + + + + + 搜索 +
-
-
- - - - - - 搜索 -
-
- - - - + + + + + + + - - - + + + + + +
- - - +
+
+ +
- - - + + + - 查看号源 + 搜索
-
-
+ + + + + + + + + + + +
+ + + +
+
+ + + + + + 查看号源 +
+
+
- {{ i.plan_number }} -
-
-
-
- 取消 - 预约 + {{ i.plan_number }}
+
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
+ 取消 + 预约
-
-
-
- - - - - - - - - - - - 搜索 -
-
- 选择套餐 - - -
- {{ !!combo_show ? combo_show.name : '无' }} -
-
-
+
+ -
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + + + + + + + 搜索
-
-
待选项目
- - - - - - - - - - - - +
+ 选择套餐 + + +
+ {{ !!combo_show ? combo_show.name : '无' }} +
+
+
-
-
已选项目
- - - - - - - - - +
+
+
待选项目
+ + + + + + + + + + + + +
+
+
已选项目
+ + + + + + + + + +
+
+
+ 合计价格:¥ {{ pay_info.true_price }} + 原价:¥{{ pay_info.original_price }}
-
-
- 合计价格:¥ {{ pay_info.true_price }} - 原价:¥{{ pay_info.original_price }} -
-
- 清空 - 移除项目 - 预约登记 -
+
+ 订单查询 + 清空 + 移除项目 + 预约登记
- -
+
+ +