刘桂岩 há 3 anos atrás
pai
commit
6f74b55a21
2 ficheiros alterados com 47 adições e 24 exclusões
  1. 41 24
      app/controller/Index.php
  2. 6 0
      config/app.php

+ 41 - 24
app/controller/Index.php

@@ -3,6 +3,7 @@ namespace app\controller;
 
 use app\BaseController;
 use app\common\array2xml;
+use think\facade\Config;
 use think\facade\Db;
 use think\facade\Cache;
 
@@ -20,6 +21,46 @@ class Index extends BaseController
     }
     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 = [
@@ -38,28 +79,4 @@ class Index extends BaseController
         $obj = json_decode($ins,true);
         var_dump($obj);die;
     }
-
-
-    public function aa()
-    {
-        $conn = mysqli_connect('localhost','root','');
-        $a = mysqli_select_db($conn,'tijianzhongxin');
-        $sql = "select * from dianApiInfo where Barcode='12203020024872'";
-        $result = mysqli_query($conn, $sql);
-        $info = mysqli_fetch_row($result);
-        var_dump($info);die;
-        if(!empty($info))
-        {
-            $return = [
-                'xml'=>$info[1],
-                'patientId'=>$info[2],
-                'barCode'=>$info[3]
-            ];
-            $a2x = new array2xml();
-            $r = $a2x->toXml($return);
-            return $r;
-        }else{
-            return '';
-        }
-    }
 }

+ 6 - 0
config/app.php

@@ -29,4 +29,10 @@ return [
     'error_message'    => '页面错误!请稍后再试~',
     // 显示错误信息
     'show_error_msg'   => false,
+
+
+    'dian'=>[
+        'ClientID'=>'黑龙江昆仑盛和安体检中心',
+        'ClientGUID'=>'79A5CFF272A203F9E0530BF0000AE4D1',
+    ],
 ];