getRegInfo.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. function SoapToXml($xml)
  3. {
  4. //api测试先关闭
  5. $startStr=strrpos($xml,"<![CDATA[");
  6. $endStr=strpos($xml,"]]>");
  7. $xml=substr($xml,$startStr,$endStr-$startStr);
  8. $xml = str_replace("<![CDATA[>","",$xml);
  9. $xml = str_replace("<![CDATA[","",$xml);
  10. $xml = str_replace("]]]]>","",$xml);
  11. $xml = str_replace("]]>","",$xml);
  12. $xml = str_replace("<ILLEGAL VALUE>","",$xml);
  13. return $xml;
  14. }
  15. //==============获得前台请求==============
  16. $callback = isset($_GET['callback']) ? trim($_GET['callback']) : '';
  17. $req['HospitalId'] = $_GET['hospitalId'];
  18. $req['startDate'] = $_GET['startDate'];
  19. $req['endDate'] = $_GET['endDate'];
  20. $req['deptId'] = $_GET['deptId'];
  21. if(isset($_GET['doctorId'])) {
  22. $req['doctorId'] = $_GET['doctorId'];
  23. }
  24. //$req = simplexml_load_string($req); //提取POST数据为simplexml对象
  25. $TradeCode = "1004";
  26. $ExtOrgCode = "南方医务通";
  27. $ExtUserID = "NFYWT";
  28. $ClientType ="";
  29. $HospitalId =$req['HospitalId'];
  30. $DeptType = "";
  31. $DoctorCode = "";
  32. $SessType = "";
  33. $StartDate = $req['startDate'];
  34. $EndDate = $req['endDate'];
  35. $RBASSessionCode = "";
  36. $ServiceCode = "";
  37. $StopScheduleFlag = "";
  38. $DepartmentCode = $req['deptId'];
  39. $DoctorCode= empty($req['doctorId'])?'':$req['doctorId'];
  40. $SearchCode = "";
  41. ini_set('user_agent', 'Mozilla/5.0');
  42. $postData = "<Request><HospitalId>$HospitalId</HospitalId><ExtOrgCode>$ExtOrgCode</ExtOrgCode><ExtUserID>$ExtUserID</ExtUserID><ClientType>$ClientType</ClientType><TradeCode>$TradeCode</TradeCode><DeptType>$DeptType</DeptType><DoctorCode>$DoctorCode</DoctorCode><SessType>$SessType</SessType><StartDate>$StartDate</StartDate><EndDate>$EndDate</EndDate><RBASSessionCode>$RBASSessionCode</RBASSessionCode><ServiceCode>$ServiceCode</ServiceCode><StopScheduleFlag>$StopScheduleFlag</StopScheduleFlag><DepartmentCode>$DepartmentCode</DepartmentCode><SearchCode>$SearchCode</SearchCode></Request>";
  43. //$postData = str_replace(' ','%20',$postData);
  44. //$wsdl = "http://yygh1.dept.nfyy.com/csp/oep/DHC.OEP.BS.OEPSTANWebService.cls?soap_method=QuerySchedule&Input=";
  45. //$result = file_get_contents($wsdl.$postData);
  46. $url = "http://yygh1.dept.nfyy.com/csp/oep/DHC.OEP.BS.OEPSTANWebService.cls?soap_method=QuerySchedule&Input=";
  47. $url .= $postData;
  48. ini_set('memory_limit', '256M');
  49. set_time_limit(0);
  50. $curl = curl_init();
  51. curl_setopt_array($curl, array(
  52. CURLOPT_URL => $url,
  53. CURLOPT_RETURNTRANSFER => true,
  54. CURLOPT_ENCODING => "",
  55. CURLOPT_MAXREDIRS => 10,
  56. CURLOPT_TIMEOUT => 30,
  57. CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  58. CURLOPT_CUSTOMREQUEST => "GET",
  59. CURLOPT_HTTPHEADER => array(
  60. "cache-control: no-cache"
  61. ),
  62. //CURLOPT_USERAGENT => "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727;http://www.baidu.com)",
  63. ));
  64. $result = curl_exec($curl);
  65. $error = curl_error($curl);
  66. curl_close($curl);
  67. $res = SoapToXml($result);
  68. $res = simplexml_load_string($res);
  69. echo $callback.'('.json_encode($res).')';exit;