diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/SignInController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/SignInController.php index e626669..c4fc3ae 100644 --- a/Laravel/app/Http/Controllers/API/Admin/YeWu/SignInController.php +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/SignInController.php @@ -52,26 +52,46 @@ class SignInController extends Controller }elseif ($mainInfo->patient_type==3){ $mainInfo->patient_type=2; } + $p=[]; + $checkroom=$mainInfo->reservation_sources_name; + if($mainInfo->RISRAcceptDeptCode=='FY2003.00'){//超声科 + + $checkroom_array = explode("_", $checkroom); + if(count($checkroom_array)!=2) { + $fail_item[]=$mainInfo->entrust.' 签到失败:未正确关联学组,学组名称:'.$checkroom; + continue; + } + $p=[ + 'isStudyGroupRegistration'=>'Y', + 'studyGroupName'=>$checkroom_array[0], + 'studyGroupCode'=>$checkroom_array[1], + ]; + } + if($mainInfo->RISRAcceptDeptCode=='FY2004.00'){//放射科 + $p=[ + 'videoRoomName'=>$checkroom, + ]; + } $data=[ 'hisId'=>$mainInfo->reg_num, 'yizhuId'=>$mainInfo->entrust_id, 'isAppt'=>'Y', 'appointmentTime'=>$mainInfo->reservation_date.' '.$mainInfo->period_begin_time, - 'isStudyGroupRegistration'=>null, - 'enrolDoctorName'=>'测试医生', - 'enrolDoctorCode'=>'ddddd', + 'enrolDoctorName'=>'医技预约', + 'enrolDoctorCode'=>'FYYJYY', 'admIdIss'=>$mainInfo->patient_type, 'patientName'=>$mainInfo->user_name, 'accessionNo'=>$mainInfo->app_num, 'modalityName'=> $mainInfo->entrust_type, - 'videoRoomName'=> $mainInfo->reservation_sources_name, + 'hospitalId'=>1 ]; - - $yg_signin= self::YG_SignIn('/insertRegisterInfo',$data); + $data= array_merge($data,$p); + $yg_signin= self::YG_SignIn('?CfgItem=JH1738预约签到',$data); if($yg_signin['status']==true){ //盈谷返回成功,更新本地状态 $u=DB::table('s_list')->where(['id'=>$mainInfo->id])->update([ - 'list_status'=>2 + 'list_status'=>2, + 'check_num'=>$yg_signin['data'][0]['checkNo'] ]); if($u){ $success_item[]=$mainInfo->entrust; @@ -105,14 +125,16 @@ class SignInController extends Controller { $baseUrl=config('app.globals.YingGuBaseUrl'); $data=json_encode($data,JSON_UNESCAPED_UNICODE); - $r=\Tools::Post($baseUrl.$url,$data,'盈谷签到'); - + $r=\Tools::PostSoap($baseUrl.$url,$data,'盈谷签到'); if (!json_decode($r, true)) { - return ['status'=>false,'msg'=>"解析检查系统'签到接口'数据出错"]; + return ['status'=>false,'msg'=>"解析'删除签到接口'数据出错:".$r]; } + $r = $r['SendResult']; $res = json_decode($r, true); + + if($res['isSuccess']==true){ - return ['status'=>true,'']; + return ['status'=>true,'msg'=>$res['resultMsg'],'data'=>$res['resultDatas']]; }else{ return ['status'=>false,'msg'=>$res['resultMsg']]; } @@ -141,10 +163,11 @@ class SignInController extends Controller $fail_item=[]; foreach ($mainInfos as $key=>$mainInfo) { $data=[ - 'yizhuId'=>$mainInfo->entrust_id, - 'hisId '=>$mainInfo->reg_num + 'checkNo'=>$mainInfo->check_num, + 'hisId '=>$mainInfo->reg_num, + 'hospitalId'=>1 ]; - $yg_cancelsign= self::YG_CancelSign('/deleteRegisterInfo',$data); + $yg_cancelsign= self::YG_CancelSign('?CfgItem=JH1739取消预约签到',$data); if($yg_cancelsign['status']==true){ //盈谷返回成功,更新本地状态 $u=DB::table('s_list')->where(['id'=>$mainInfo->id])->update([ @@ -176,11 +199,12 @@ class SignInController extends Controller { $baseUrl=config('app.globals.YingGuBaseUrl'); $data=json_encode($data,JSON_UNESCAPED_UNICODE); - $r=\Tools::Post($baseUrl.$url,$data,'盈谷删除签到'); + $r=\Tools::PostSoap($baseUrl.$url,$data,'盈谷删除签到'); if (!json_decode($r, true)) { - return ['status'=>false,'msg'=>"解析检查系统'删除签到接口'数据出错"]; + return ['status'=>false,'msg'=>"解析'删除签到接口'数据出错:".$r]; } + $r = $r['SendResult']; $res = json_decode($r, true); if($res['isSuccess']==true){ return ['status'=>true,'']; diff --git a/Laravel/app/Lib/Tools.php b/Laravel/app/Lib/Tools.php index c4ba79b..e6268c4 100644 --- a/Laravel/app/Lib/Tools.php +++ b/Laravel/app/Lib/Tools.php @@ -99,6 +99,62 @@ class Tools return $r; } + public static function PostSoap($url, $data_string,$mark='') + { + $data=[ + 'request_url'=>$url, + 'post_data'=>$data_string, + ]; + $log_id=self::RequestLog($data,0,$mark); + $xml_data = ' + + + + ? + + ? + + ? + + ? + + + + + + + + + '; + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'Content-Type: application/soap+xml;charset=utf-8', + 'Content-Length: ' . strlen($xml_data) + ]); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data); + $r = curl_exec($ch); + try { + $res = explode('', $r)[1]; + $res = explode('', $res)[0]; + $xmlData = simplexml_load_string($res); + $jsonData = json_encode($xmlData, JSON_UNESCAPED_UNICODE); + }catch (Exception $e) { + $jsonData = $e->getMessage(); + } + + $result = json_decode($jsonData, true); + // dd($result); + curl_close($ch); + $data=[ + 'response_data'=>$r + ]; + self::RequestLog($data,$log_id); + return $result; + } public static function RequestLog($arr,$id,$mark='') { //记录请求日志 date_default_timezone_set('PRC');