健康证体检增加日期范围判断

main
yanzai 1 year ago
parent 60218a2065
commit f52691da84

@ -90,14 +90,33 @@ class AppointmentService
->where(function ($query) use ($id_card_num, $encode_id_card_num) {
$query->where('a.id_card_num', $id_card_num)
->orWhere('a.id_card_num', $encode_id_card_num);
})
->where(['a.type' => $type,'a.is_del'=>0, ['a.created_at', '>=', $firstDay], ['a.created_at', '<=', $lastDay]]);
});
if($type==2){
$c=$c->whereIn('a.status', [1, 2]);
}
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();
//,如果有判断是否快到期(先不判断是否体检通过),能否继续预约
if(!!$cha_jkz){
$date = new DateTime($cha_jkz->created_at);
$date->modify('+'.$month.' months');
$now = new DateTime();
if ($date > $now) {
return \Yz::Return(false,'已体检过');
}
}
//查询是否有预约记录
$currentDate = date('Y-m-d');
$firstDay = date('Y-m-d', strtotime('-'.$month.' months', strtotime($currentDate)));
// $firstDay = date('Y-01-01', strtotime($currentYear));
$lastDay = date('Y-12-31', strtotime($currentYear));
$c=$c->whereIn('a.status', [2]);
}
$c=$c->where(['a.type' => $type,'a.is_del'=>0, ['a.created_at', '>=', $firstDay], ['a.created_at', '<=', $lastDay]]);
$c=$c->get();
if(count($c)){

@ -1,6 +1,7 @@
<?php
namespace App\Services\mH5;
use App\Services\Admin\YeWu\AppointmentService;
use DateTime;
use Illuminate\Support\Facades\DB;
use App\Services\mH5\PersonService;
class OrganizationService
@ -81,8 +82,28 @@ class OrganizationService
$currentYear = date('Y');
$firstDay = date('Y-01-01', strtotime($currentYear));
$lastDay = date('Y-12-31', strtotime($currentYear));
if($type==1){
$month=config('app.globals.HealthyCardTimeRange');
//如果是健康证体检,则先查寻是否有体检记录
$cha_jkz=DB::table('examination_records')->where(['id_card_num'=>$cha_info[0]->id_card_num])->orderBy('id','desc')->first();
//,如果有判断是否快到期(先不判断是否体检通过),能否继续预约
if(!!$cha_jkz){
$date = new DateTime($cha_jkz->created_at);
$date->modify('+'.$month.' months');
$now = new DateTime();
if ($date > $now) {
return \Yz::Return(false,'本年度已经体检过,请于:'. $date->format('Y-m-d H:i:s').'后再进行预约');
}
}
//查询是否有预约记录
$currentDate = date('Y-m-d');
$firstDay = date('Y-m-d', strtotime('-'.$month.' months', strtotime($currentDate)));
// $firstDay = date('Y-01-01', strtotime($currentYear));
$lastDay = date('Y-12-31', strtotime($currentYear));
}
$cha=DB::table('appointment_record')->where([['id_card_num','=',$cha_info[0]->id_card_num],['created_at','>',$firstDay],['created_at','<',$lastDay]])->whereIn('status',[1,2])->get();
$cha=DB::table('appointment_record')->where([['id_card_num','=',$cha_info[0]->id_card_num],['is_del','=','0'],['created_at','>',$firstDay],['created_at','<',$lastDay]])->whereIn('status',[1,2])->get();
if(count($cha)) {
return \Yz::Return(false,'本年度已经预约过,无法继续预约');
}

@ -14,6 +14,8 @@ return [
'WxReturnCodeUrl_server'=>'https://www.yanzai.vip/common/mH5/#/getWxCode/', //获取code后引导返回到前端的地址 生产
'GongWeiBaseUrl'=>'http://114.242.58.53:8082/jkdacp/webservice/DPService?wsdl', //公卫接口地址,外网测试地址
'HealthyCardTimeRange'=>11,//健康证过期时间跨度 单位 月
],
/*

Loading…
Cancel
Save