You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
3.8 KiB
PHP
104 lines
3.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API\H5;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
use App\Http\Controllers\API\PEISApiController;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class ReportController extends Controller
|
|
{
|
|
public function GetReportList(){
|
|
$openid =request('openid');
|
|
if(!isset($openid)) return \Yz::echoError1("openid不能为空");
|
|
$user = DB::table('web_users')->where(['openid' => $openid, 'status' => 1, 'is_del' => 0])->first();
|
|
if (!$user) return \Yz::echoError1('用户不存在');
|
|
$persons=DB::table('web_user_person')->where(['user_id' => $user->id, 'is_del' => 0])->pluck('id_number')->toArray();
|
|
|
|
$list=DB::table('report_l1_records')->select('姓名','性别','登记时间','套餐名称','体检号','体检状态','is_read')->whereIn('证件号码',$persons)->get();
|
|
return \Yz::Return(true,"查询完成",['list'=>$list]);
|
|
}
|
|
public function GetReportJieLunJianYi()
|
|
{
|
|
$YiBanJianChaList=[
|
|
['name'=>"身高(cm)",
|
|
'code'=>"SG"],
|
|
['name'=>"体重(kg)",
|
|
'code'=>"TZ"],
|
|
['name'=>"收缩压",
|
|
'code'=>"XY(SSY)"],
|
|
['name'=>"血红蛋白",
|
|
'code'=>"BXBSM"],
|
|
];
|
|
$tijian_num =request('tijian_num');
|
|
$report=DB::table('report_l1_records as a')->where(['a.体检号'=>$tijian_num])->first();
|
|
if(!!$report){
|
|
if($report->体检状态=='报告未出') return \Yz::echoError1("此报告暂时未出");
|
|
$items=DB::table('report_l2_items as b')->leftJoin('report_l3_base_items as c' ,'b.id','=','c.report_l2_id')->where(['b.reprort_l1_id'=>$report->id])->get();
|
|
$v_error_items=[];
|
|
$error_items=[];
|
|
$base_items=[];
|
|
foreach($items as $item){
|
|
foreach ($YiBanJianChaList as $ybitem) {
|
|
if($item->基础项目代码==$ybitem['code']){
|
|
$base_items[]=[
|
|
'name'=>$ybitem['name'],
|
|
'value'=>$item->结果值,
|
|
];
|
|
}
|
|
}
|
|
if($item->异常标识!=null and $item->异常标识!=''){
|
|
$error_items[]=$item;
|
|
}
|
|
}
|
|
|
|
$info=[];
|
|
$info['name']=$report->姓名;
|
|
$info['base_date']=$base_items;
|
|
$info['items']=[
|
|
'all_count'=>count($items),
|
|
'ipt_error_count'=>count($v_error_items),//重要异常数量
|
|
'error_count'=>count($error_items),//异常数量
|
|
|
|
];
|
|
$info['content']=$report->总检建议;
|
|
|
|
return \Yz::Return(true,"查询完成",['info'=>$info]);
|
|
}else{
|
|
return \Yz::echoError1("查询报告失败");
|
|
}
|
|
}
|
|
//完整报告中的列表
|
|
public function GetReportDetaiList()
|
|
{
|
|
$tijian_num =request('tijian_num');
|
|
$report=DB::table('report_l1_records as a')->where(['a.体检号'=>$tijian_num])->first();
|
|
if(!$report) return \Yz::echoError1("查询报告失败");
|
|
if($report->体检状态=='报告未出') return \Yz::echoError1("此报告暂时未出");
|
|
$items=DB::table('report_l2_items as b')->leftJoin('report_l3_base_items as c' ,'b.id','=','c.report_l2_id')->where(['b.reprort_l1_id'=>$report->id])->get();
|
|
$list=[];
|
|
|
|
foreach($items as $item){
|
|
$ShouFeiName = $item->收费项目名称;
|
|
if (!isset($list[$ShouFeiName])) {
|
|
$error_count=0;
|
|
$list[$ShouFeiName] = ['id'=>$item->report_l2_id,'error_count'=>$error_count];
|
|
}
|
|
if($item->异常标识!=null and $item->异常标识!=''){
|
|
$error_count++;
|
|
}
|
|
$list[$ShouFeiName] = ['id'=>$item->report_l2_id,'error_count'=>$error_count];
|
|
}
|
|
return \Yz::Return(true,"查询完成",['list'=>$list]);
|
|
}
|
|
public function GetReportDetai(){
|
|
$id =request('id');
|
|
$items=DB::table('report_l3_base_items')->where(['report_l2_id'=>$id])->get();
|
|
foreach ($items as $item){
|
|
|
|
}
|
|
}
|
|
|
|
}
|