|
|
|
|
@ -12,12 +12,26 @@ class AppointmentService
|
|
|
|
|
$sql=$sql .' and a.status = ? ';
|
|
|
|
|
array_push($canshu, $arr['searchInfo']['status']);
|
|
|
|
|
}
|
|
|
|
|
if($arr['searchInfo']['userinfo']){
|
|
|
|
|
if (preg_match('/\d/', $arr['searchInfo']['userinfo'])) {
|
|
|
|
|
$HSM =\App\Lib\HSM::HsmEncrypt($arr['searchInfo']['userinfo']);
|
|
|
|
|
if($HSM['status'] !=true){
|
|
|
|
|
return \Yz::echoError1('身份证号加密失败');
|
|
|
|
|
}
|
|
|
|
|
$encode_id_card_num=$HSM['data'];
|
|
|
|
|
$sql=$sql .' and (a.id_card_num like ? or a.id_card_num = ?)';
|
|
|
|
|
array_push($canshu, '%'.$arr['searchInfo']['userinfo'].'%');
|
|
|
|
|
array_push($canshu, $encode_id_card_num);
|
|
|
|
|
}else{
|
|
|
|
|
$sql=$sql .' and a.name like ?';
|
|
|
|
|
array_push($canshu, '%'.$arr['searchInfo']['userinfo'].'%');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if($arr['searchInfo']['calendarId']){
|
|
|
|
|
$sql=$sql .' and a.calendar_id = ? ';
|
|
|
|
|
array_push($canshu, $arr['searchInfo']['calendarId']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($arr['searchInfo']['dateRange']){
|
|
|
|
|
|
|
|
|
|
$sql=$sql . ' and a.date>=? and a.date<=? ';
|
|
|
|
|
@ -41,9 +55,9 @@ class AppointmentService
|
|
|
|
|
array_push($canshu,($arr['page']-1)*$arr['pageSize'],$arr['pageSize']);
|
|
|
|
|
|
|
|
|
|
$query=DB::select("select a.*,b.org_name from appointment_record as a LEFT JOIN
|
|
|
|
|
medical_institution as b on a.org_id=b.id ".$sql." order by a.id desc limit ?,?",$canshu);
|
|
|
|
|
medical_institution as b on a.org_id=b.id ".$sql." and (a.is_del<>1 or a.is_del is null) order by a.id desc limit ?,?",$canshu);
|
|
|
|
|
|
|
|
|
|
$count=DB::select("select count(*) as c from appointment_record as a ".$sql,$canshu);
|
|
|
|
|
$count=DB::select("select count(*) as c from appointment_record as a ".$sql ." and (a.is_del<>1 or a.is_del is null) ",$canshu);
|
|
|
|
|
return \Yz::Return(true,'',['list'=>$query,'count'=>$count[0]->c]);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -60,10 +74,26 @@ class AppointmentService
|
|
|
|
|
if($type==2 and $this->isOver65($id_card_num)===false){
|
|
|
|
|
return \Yz::echoError1("年龄不满足条件");
|
|
|
|
|
}
|
|
|
|
|
$HSM =\App\Lib\HSM::HsmEncrypt($id_card_num);
|
|
|
|
|
if($HSM['status'] !=true){
|
|
|
|
|
return \Yz::echoError1('身份证号加密失败');
|
|
|
|
|
}
|
|
|
|
|
$encode_id_card_num=$HSM['data'];
|
|
|
|
|
// $c=DB::table('appointment_record as a')
|
|
|
|
|
// ->leftJoin('medical_institution as b', 'a.org_id', '=', 'b.id')
|
|
|
|
|
// ->select(['a.id','a.org_id','a.id_card_num','a.created_at as insertime','b.org_name'])
|
|
|
|
|
// ->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')
|
|
|
|
|
->select(['a.id','a.org_id','a.id_card_num','a.created_at as insertime','b.org_name'])
|
|
|
|
|
->where(['a.id_card_num'=>$id_card_num,'a.type'=>$type,['a.created_at','>=',$firstDay],['a.created_at','<=',$lastDay]])->whereIn('a.status',[1,2])->get();
|
|
|
|
|
->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]])
|
|
|
|
|
->whereIn('a.status', [1, 2])
|
|
|
|
|
->get();
|
|
|
|
|
if(count($c)){
|
|
|
|
|
$result['status']=false;
|
|
|
|
|
$result['msg']='已体检过';
|
|
|
|
|
|