From f20e8dc0ed585e560599552240c683877385a37e Mon Sep 17 00:00:00 2001 From: yanzai Date: Wed, 2 Oct 2024 23:29:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E5=91=8A=E5=AF=B9=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Http/Controllers/API/ApiMapController.php | 2 + .../Controllers/API/H5/ReportController.php | 107 ++++++++++++++++++ Laravel/routes/web.php | 1 + 3 files changed, 110 insertions(+) diff --git a/Laravel/app/Http/Controllers/API/ApiMapController.php b/Laravel/app/Http/Controllers/API/ApiMapController.php index 268d18c..091fa43 100644 --- a/Laravel/app/Http/Controllers/API/ApiMapController.php +++ b/Laravel/app/Http/Controllers/API/ApiMapController.php @@ -58,10 +58,12 @@ class ApiMapController extends Controller 'GetDayPlanList' => $base_url . '/api/H5/GetDayPlanList',//获取每日号源 'ComboCompare' => $base_url . '/api/H5/ComboCompare',//套餐对比 'GetOrderDetail' => $base_url . '/api/H5/GetOrderDetail',//获取订单详情 + 'ReportContrast' => $base_url . '/api/H5/ReportContrast',//报告对比 'FenzhenAbandon' => $base_url . '/api/H5/Fenzhen/abandon',// 分诊弃检 'FenzhenList' => $base_url . '/api/H5/Fenzhen/list',// 分诊时间线 'FenzhenInfo' => $base_url . '/api/H5/Fenzhen/info',// 分诊项目详情 'FenzhenCheck' => $base_url . '/api/H5/Fenzhen/check',// 分诊检测 + ]; } diff --git a/Laravel/app/Http/Controllers/API/H5/ReportController.php b/Laravel/app/Http/Controllers/API/H5/ReportController.php index d1be168..53b3e95 100644 --- a/Laravel/app/Http/Controllers/API/H5/ReportController.php +++ b/Laravel/app/Http/Controllers/API/H5/ReportController.php @@ -257,6 +257,113 @@ class ReportController extends Controller // 如果没有匹配,返回原始输入 return $input; } + public function contrast(Request $request) + { + $ids = $request->post('tj_numbers'); + if(count($ids)<>2) return \Yz::echoError1("请选择两份报告"); + sort($ids); + $report1=DB::table('report_l1_records as a')->leftJoin('report_l2_items as b' ,'a.id','=','b.reprort_l1_id')->where('a.体检号',$ids[0])->whereIn('体检状态',['报告已出','总检完成'])->get(); + $report2=DB::table('report_l1_records as a')->leftJoin('report_l2_items as b' ,'a.id','=','b.reprort_l1_id')->where('a.体检号',$ids[1])->whereIn('体检状态',['报告已出','总检完成'])->get(); + if(count($report1)==0 || count($report2)==0) return \Yz::echoError1("有未出报告,无法对比"); + $ids1=$ids = $report1->pluck('id')->all(); + $ids2=$ids = $report2->pluck('id')->all(); + $report1_jc_item=DB::table('report_l3_base_items')->whereIn('report_l2_id',$ids1)->get(); + $report2_jc_item=DB::table('report_l3_base_items')->whereIn('report_l2_id',$ids2)->get(); + //dd($report1_jc_item,$report2_jc_item); + $r1_datetime =$report1[0]->报告日期; + $r2_datetime =$report2[0]->报告日期; + $r1_map = []; + foreach ($report1_jc_item as $i) { + $r1_map[$i->基础项目代码] = json_decode(json_encode($i,JSON_UNESCAPED_UNICODE),true); + } + $r2_map = []; + foreach ($report2_jc_item as $i) { + $r2_map[$i->基础项目代码] = json_decode(json_encode($i,JSON_UNESCAPED_UNICODE),true); + } + + $clear_type1_list = []; + $clear_type2_list = []; + $id = 1; + foreach ($r1_map as $key => $item) { + $r2_data = isset($r2_map[$key]) ? [ + 'date' => $r2_datetime, + 'content' => $r2_map[$key]['结果值'] . $r2_map[$key]['结果值单位'], + 'icon' => $r2_map[$key]['异常标识'], + 'desc' => $r2_map[$key]['结果值范围'], + ] : [ + 'date' => $r2_datetime, + 'content' => '', + 'icon' => '', + 'desc' => '' + ]; + $i = [ + 'id' => $id, + 'title' => $item['基础项目名称'], + 'r1' => [ + 'date' => $r1_datetime, + 'content' => $item['结果值'] . $item['结果值单位'], + 'icon' => $item['异常标识'], + 'desc' => $item['结果值范围'], + ], + 'r2' => $r2_data + ]; + if ($item['结果类型'] == '数值') { + $clear_type2_list[$key] = $i; + } else { + $clear_type1_list[$key] = $i; + } + $id = $id + 1; + } + foreach ($r2_map as $key => $item) { + $r1_data = isset($r1_map[$key]) ? [ + 'date' => $r1_datetime, + 'content' => $r1_map[$key]['结果值'] . $r1_map[$key]['结果值单位'], + 'icon' => $r1_map[$key]['异常标识'], + 'desc' => $r1_map[$key]['结果值范围'], + ] : [ + 'date' => $r1_datetime, + 'content' => '', + 'icon' => '', + 'desc' => '', + ]; + $i = [ + 'id' => $id, + 'title' => $item['基础项目名称'], + 'r1' => $r1_data, + 'r2' => [ + 'date' => $r2_datetime, + 'content' => $item['结果值'] . $item['结果值单位'], + 'icon' => $item['异常标识'], + 'desc' => $item['结果值范围'], + ] + ]; + if ($item['结果类型'] == '数值') { + $clear_type2_list[$key] = $i; + } else { + $clear_type1_list[$key] = $i; + } + $id = $id + 1; + } + $report_type1_content = []; + $report_type2_content = []; + foreach ($clear_type1_list as $item) { + $report_type1_content[] = $item; + } + foreach ($clear_type2_list as $item) { + $report_type2_content[] = $item; + } + return \Yz::return(true,"",[ + 'report_type1_content' => $report_type1_content, + 'report_type2_content' => $report_type2_content, + ]); + } + public function orderReportTime($res) + { + foreach ($res as $key => $re) { + $res[$key]['order_time'] = date('YmdHi', strtotime($re['登记时间'])); + } + return self::myUsort($res, ['order_time'], [0]); + } } diff --git a/Laravel/routes/web.php b/Laravel/routes/web.php index d22697d..d18f0c2 100644 --- a/Laravel/routes/web.php +++ b/Laravel/routes/web.php @@ -64,6 +64,7 @@ Route::group(['prefix' => 'api/H5'], function () { Route::post('/CheckPay', 'App\Http\Controllers\API\H5\PayController@CheckPay');//支付结果查询接口 Route::post('/Refund', 'App\Http\Controllers\API\H5\PayController@Refund');//退款 Route::post('/GetOrderDetail', 'App\Http\Controllers\API\H5\OrderController@GetDetail');//获取订单详情 + Route::post('/ReportContrast', 'App\Http\Controllers\API\H5\ReportController@contrast');//报告对比