|
|
|
|
@ -85,7 +85,7 @@ class AppointmentService
|
|
|
|
|
// ->where(['a.id_card_num'=>$id_card_num,'a.is_del'=>0,'a.type'=>$type,['a.created_at','>=',$firstDay],['a.created_at','<=',$lastDay]])->whereIn('a.status',[1,2])->get();
|
|
|
|
|
|
|
|
|
|
$c=DB::table('appointment_record as a')
|
|
|
|
|
->leftJoin('medical_institution as b', 'a.org_id', '=', 'b.id')
|
|
|
|
|
->leftJoin('medical_institution as b', 'a.org_code', '=', 'b.sn')
|
|
|
|
|
->select(['a.id','a.org_id','a.id_card_num','a.created_at as insertime','b.org_name'])
|
|
|
|
|
->where(function ($query) use ($id_card_num, $encode_id_card_num) {
|
|
|
|
|
$query->where('a.id_card_num', $id_card_num)
|
|
|
|
|
@ -98,7 +98,10 @@ class AppointmentService
|
|
|
|
|
if($type==1){
|
|
|
|
|
$month=config('app.globals.HealthyCardTimeRange');
|
|
|
|
|
//如果是健康证体检,则先查寻是否有体检记录
|
|
|
|
|
$cha_jkz=DB::table('examination_records')->where(['id_card_num'=>$encode_id_card_num])->orderBy('id','desc')->first();
|
|
|
|
|
$cha_jkz=DB::table('examination_records as a')
|
|
|
|
|
->leftJoin('medical_institution as b','a.institution_id','=','b.id')
|
|
|
|
|
->select('a.*','b.org_name')
|
|
|
|
|
->where(['a.id_card_num'=>$encode_id_card_num])->orderBy('a.id','desc')->first();
|
|
|
|
|
//,如果有判断是否快到期(先不判断是否体检通过),能否继续预约
|
|
|
|
|
if(!!$cha_jkz){
|
|
|
|
|
|
|
|
|
|
@ -106,7 +109,7 @@ class AppointmentService
|
|
|
|
|
$date->modify('+'.$month.' months');
|
|
|
|
|
$now = new DateTime();
|
|
|
|
|
if ($date > $now) {
|
|
|
|
|
return \Yz::Return(false,'已体检过');
|
|
|
|
|
return \Yz::Return(false,'该人员已于'.$cha_jkz->created_at.'在'.$cha_jkz->org_name.'登记');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//查询是否有预约记录
|
|
|
|
|
@ -121,7 +124,7 @@ class AppointmentService
|
|
|
|
|
$c=$c->get();
|
|
|
|
|
if(count($c)){
|
|
|
|
|
$result['status']=false;
|
|
|
|
|
$result['msg']='已体检过';
|
|
|
|
|
$result['msg']='该人员已于'.$c[0]->insertime.'在'.$c[0]->org_name.'登记.';
|
|
|
|
|
$result['info']=$c;
|
|
|
|
|
}else{
|
|
|
|
|
if($type==2){
|
|
|
|
|
@ -135,7 +138,7 @@ class AppointmentService
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$result['status']=true;
|
|
|
|
|
$result['msg']='可以继续,本年度无免费体检记录';
|
|
|
|
|
$result['msg']='该人员当年无体检记录,可正常登记。';
|
|
|
|
|
$result['info']=$c;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -175,7 +178,7 @@ class AppointmentService
|
|
|
|
|
//判断老年人体检字段
|
|
|
|
|
if(isset($res['queryCheckUp']['sflnrtj']) and $res['queryCheckUp']['sflnrtj']==1){
|
|
|
|
|
$result['status']=false;
|
|
|
|
|
$result['msg']='公卫有记录';
|
|
|
|
|
$result['msg']='公卫系统已存在该年体检记录,请登录公卫系统查询或咨询公卫系统';
|
|
|
|
|
$result['GongWeiinfo']=$res['queryCheckUp'];
|
|
|
|
|
}else{
|
|
|
|
|
$result['status']=true;
|
|
|
|
|
|