|
|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
<?php
|
|
|
|
|
namespace App\Services\mH5;
|
|
|
|
|
use App\Services\Admin\YeWu\AppointmentService;
|
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
use App\Services\mH5\PersonService;
|
|
|
|
|
class OrganizationService
|
|
|
|
|
@ -18,6 +19,9 @@ class OrganizationService
|
|
|
|
|
if($arr['yuyue_type']=='jiankangzheng_mf'){
|
|
|
|
|
$list= $list->where(['enable_yuyue'=>1,'enable_jiankangzheng_mf'=>1]);
|
|
|
|
|
}
|
|
|
|
|
if($arr['yuyue_type']=='laonianren_mf'){
|
|
|
|
|
$list= $list->where(['enable_yuyue'=>1,'enable_laonianren_mf'=>1]);
|
|
|
|
|
}
|
|
|
|
|
$list= $list->get();
|
|
|
|
|
if(count($list)>0){
|
|
|
|
|
$result['status']=true;
|
|
|
|
|
@ -112,44 +116,72 @@ class OrganizationService
|
|
|
|
|
return \Yz::echoError1('身份证解密失败');
|
|
|
|
|
}
|
|
|
|
|
$sfz_mingwen=$sfz_HSM['data'];
|
|
|
|
|
$data=[];
|
|
|
|
|
if($type==1){
|
|
|
|
|
$data= [
|
|
|
|
|
'type'=>$type,
|
|
|
|
|
'calendar_id' => $info['calendar_id'],
|
|
|
|
|
'name' => $cha_info[0]->name,
|
|
|
|
|
'id_card_num' => $cha_info[0]->id_card_num,
|
|
|
|
|
'sex'=>$cha_info[0]->sex,
|
|
|
|
|
'age'=>\App\Lib\Tools::calculateAgeFromID($sfz_mingwen,$nowtime),
|
|
|
|
|
'birthday'=>\App\Lib\Tools::getBirthdayFromIDCard($sfz_mingwen),
|
|
|
|
|
'person_id'=>$cha_info[0]->id,
|
|
|
|
|
'openid'=>$openid,
|
|
|
|
|
'date'=>$q_date[0]->date,
|
|
|
|
|
'time'=>$q_date[0]->time,
|
|
|
|
|
'fee_type'=>0,
|
|
|
|
|
'doc_type_id'=>$info['doc_id'],
|
|
|
|
|
'doc_type_name'=>$info['doc_name'],
|
|
|
|
|
'org_id'=>$info['org_id'],
|
|
|
|
|
'org_code'=>$jgINfo->sn,
|
|
|
|
|
'status'=>1,
|
|
|
|
|
'hmac'=>$Hmac['data'],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
if($type==2){ //如果是65老年人免费体检
|
|
|
|
|
//判断年龄
|
|
|
|
|
$s=new AppointmentService();
|
|
|
|
|
if(!$s->isOver65($sfz_mingwen)) return \Yz::echoError1("用户年龄不满足条件,不可预约");
|
|
|
|
|
$data= [
|
|
|
|
|
'type'=>$type,
|
|
|
|
|
'calendar_id' => $info['calendar_id'],
|
|
|
|
|
'name' => $cha_info[0]->name,
|
|
|
|
|
'id_card_num' => $cha_info[0]->id_card_num,
|
|
|
|
|
'sex'=>$cha_info[0]->sex,
|
|
|
|
|
'age'=>\App\Lib\Tools::calculateAgeFromID($sfz_mingwen,$nowtime),
|
|
|
|
|
'birthday'=>\App\Lib\Tools::getBirthdayFromIDCard($sfz_mingwen),
|
|
|
|
|
'person_id'=>$cha_info[0]->id,
|
|
|
|
|
'openid'=>$openid,
|
|
|
|
|
'date'=>$q_date[0]->date,
|
|
|
|
|
'time'=>$q_date[0]->time,
|
|
|
|
|
'fee_type'=>0,
|
|
|
|
|
'org_id'=>$info['org_id'],
|
|
|
|
|
'org_code'=>$jgINfo->sn,
|
|
|
|
|
'status'=>1,
|
|
|
|
|
'hmac'=>$Hmac['data'],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
//如果都通过则继续
|
|
|
|
|
DB::beginTransaction();
|
|
|
|
|
try {
|
|
|
|
|
$idd=DB::table('appointment_record')->insertGetId(
|
|
|
|
|
[
|
|
|
|
|
'type'=>$type,
|
|
|
|
|
'calendar_id' => $info['calendar_id'],
|
|
|
|
|
'name' => $cha_info[0]->name,
|
|
|
|
|
'id_card_num' => $cha_info[0]->id_card_num,
|
|
|
|
|
'sex'=>$cha_info[0]->sex,
|
|
|
|
|
'age'=>\App\Lib\Tools::calculateAgeFromID($sfz_mingwen,$nowtime),
|
|
|
|
|
'birthday'=>\App\Lib\Tools::getBirthdayFromIDCard($sfz_mingwen),
|
|
|
|
|
'person_id'=>$cha_info[0]->id,
|
|
|
|
|
'openid'=>$openid,
|
|
|
|
|
'date'=>$q_date[0]->date,
|
|
|
|
|
'time'=>$q_date[0]->time,
|
|
|
|
|
'fee_type'=>0,
|
|
|
|
|
'doc_type_id'=>$info['doc_id'],
|
|
|
|
|
'doc_type_name'=>$info['doc_name'],
|
|
|
|
|
'org_id'=>$info['org_id'],
|
|
|
|
|
'org_code'=>$jgINfo->sn,
|
|
|
|
|
'status'=>1,
|
|
|
|
|
'hmac'=>$Hmac['data'],
|
|
|
|
|
]
|
|
|
|
|
);
|
|
|
|
|
$file=array();
|
|
|
|
|
foreach ($info['upfileList'] as $key=> $fvalue) {
|
|
|
|
|
foreach ($fvalue as $key2=> $fvalue2) {
|
|
|
|
|
$file[]=[
|
|
|
|
|
'type' =>$key,
|
|
|
|
|
'appointment_record_id' =>$idd,
|
|
|
|
|
'imgurl' =>$fvalue2,
|
|
|
|
|
];
|
|
|
|
|
$idd=DB::table('appointment_record')->insertGetId($data);
|
|
|
|
|
if($type==1){
|
|
|
|
|
$file=array();
|
|
|
|
|
foreach ($info['upfileList'] as $key=> $fvalue) {
|
|
|
|
|
foreach ($fvalue as $key2=> $fvalue2) {
|
|
|
|
|
$file[]=[
|
|
|
|
|
'type' =>$key,
|
|
|
|
|
'appointment_record_id' =>$idd,
|
|
|
|
|
'imgurl' =>$fvalue2,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$i_img=DB::table('appointment_img')->insert($file);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$i_img=DB::table('appointment_img')->insert($file);
|
|
|
|
|
if($i_img){
|
|
|
|
|
if($idd){
|
|
|
|
|
DB::commit();
|
|
|
|
|
return \Yz::Return(true,'预约完成');
|
|
|
|
|
}else{
|
|
|
|
|
|