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.
65 lines
2.3 KiB
PHP
65 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API\Admin\YeWu;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
use App\Services\Admin\YeWu\AppointmentService;
|
|
use Illuminate\Support\Facades\DB;
|
|
class AppointmentController extends Controller
|
|
{
|
|
//获取预约记录
|
|
public function GetAppointmentList(Request $request){
|
|
$userid = $request->get('userid');//中间件产生的参数
|
|
$group = $request->get('role');//中间件产生的参数
|
|
$page =request('page');
|
|
$pageSize =request('pageSize');
|
|
$searchInfo=request('searchInfo');
|
|
$s=app()->make(AppointmentService::class);
|
|
return $s->GetAppointmentList(['userid'=>$userid,'group'=>$group,'page'=>$page,'pageSize'=>$pageSize,'searchInfo'=>$searchInfo]);
|
|
}
|
|
|
|
//对外插入预约记录
|
|
public function CreateAppointment(){
|
|
date_default_timezone_set('PRC');
|
|
$currentYear = date('Y');
|
|
$firstDay = date('Y-01-01', strtotime($currentYear));
|
|
$lastDay = date('Y-12-31', strtotime($currentYear));
|
|
|
|
$source='接口';
|
|
$info=request('info');
|
|
|
|
$c=DB::table('appointment_record as a')
|
|
->where([['a.id_card_num','=',$info['id_card_num']],['a.fee_type','=',0],['a.created_at','>=',$firstDay],['a.created_at','<=',$lastDay]])->get();
|
|
if(count($c)>0){
|
|
$result['status']=false;
|
|
$result['msg']='已体检过';
|
|
$result['info']=$c;
|
|
return \Yz::Return(false,'本年度已经体检过',['info'=>$c]);
|
|
}else{
|
|
$result['status']=true;
|
|
$result['msg']='可以继续,本年度无免费体检记录';
|
|
$result['info']=$c;
|
|
}
|
|
|
|
|
|
$i=DB::table('appointment_record')->insert([
|
|
'source'=>$source,
|
|
'type'=>$info['type'],
|
|
'name'=>$info['name'],
|
|
'id_card_num'=>$info['id_card_num'],
|
|
'sex'=>$info['sex'],
|
|
'tel'=>$info['tel'],
|
|
//'content'=>json_encode($info['content']),
|
|
'content'=>isset($info['content'])?json_encode($info['content'],JSON_UNESCAPED_UNICODE):'',
|
|
'fee_type'=>$info['fee_type']
|
|
]);
|
|
|
|
if($i){
|
|
return \Yz::Return(true,'保存成功',[]);
|
|
}else{
|
|
return \Yz::echoError1('保存失败');
|
|
}
|
|
}
|
|
}
|