12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- namespace app\controller;
- use app\BaseController;
- use app\common\array2xml;
- use think\facade\Config;
- use think\facade\Db;
- use think\facade\Cache;
- class Index extends BaseController
- {
- public function index()
- {
- phpinfo();
- }
- public function hello($name = 'ThinkPHP6')
- {
- return 'hello,' . $name;
- }
- public function getReport()
- {
- $code = $_REQUEST['code'];
- $type = $_REQUEST['type'];
- libxml_disable_entity_loader(false);
- $client = new \SoapClient("http://report.dalabs.cn/RasClientDetail.asmx?wsdl");
- $data = [
- 'ClientID'=>Config::get('app')['dian']['ClientID'],
- 'ClientGUID'=>Config::get('app')['dian']['ClientGUID'],
- 'hospBarcode'=>$code,
- 'SelectType'=>$type
- ]; //请求参数
- try{
- $result = $client->GetDetailDataByHospBarcode3($data); //请求获取接口
- $data = ((array)$result)['GetDetailDataByHospBarcode3Result'];
- $obj = simplexml_load_string("<data>".$data."</data>","SimpleXMLElement", LIBXML_NOCDATA);
- if($obj)
- {
- $info = json_decode(json_encode($obj),true);
- $code = $info['Error']['Code'];
- if($code !== '0')
- {
- return '报告获取失败!迪安回传信息:'.$info['Error']['Descript'];
- }
- }
- $report = json_encode($obj);
- DB::table('dianapiinfo')->where('Barcode',$code)->update(['result_xml'=>$report]);
- return 'success';
- }catch(\SoapFault $e){
- return $e->getMessage();
- }
- }
- public function aa()
- {
- $a = new \SimpleXMLElement();
- ;die;
- libxml_disable_entity_loader(false);
- $client = new \SoapClient("http://112.103.134.89:10020/server.php?wsdl");
- $data = [
- 'Barcode'=>'12203310010001'
- ]; //请求参数
- $a2x = new array2xml();
- $data = $a2x->toXml($data); //参数转xml
- try{
- $result = $client->getDiAnData($data); //请求获取接口
- }catch(\SoapFault $e){
- return $e->getMessage();
- }
- var_dump(htmlspecialchars($result));die;
- $obj = simplexml_load_string($result,"SimpleXMLElement", LIBXML_NOCDATA);
- $ins = json_encode($obj);
- $obj = json_decode($ins,true);
- var_dump($obj);die;
- }
- }
|