getRegInfo.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. $postData = str_replace(' ','%20',$postData);
  47. libxml_disable_entity_loader(false);
  48. $wsdl = "yygh1.wsdl";
  49. try{
  50. $client = new SoapClient($wsdl);
  51. $param = array(array("Input" => $postData));
  52. $result = $client->__soapCall('QuerySchedule',$param);
  53. $res = reset($result);
  54. } catch (SoapFault $e) {
  55. var_dump($e);exit;
  56. }
  57. //$res = SoapToXml($result);
  58. $res = simplexml_load_string($res);
  59. echo $callback.'('.json_encode($res).')';exit;