Ver código fonte

新增外链接口

lgy 1 dia atrás
pai
commit
e98c1b1263

+ 7 - 0
server/application/api/controller/link/LinkController.php

@@ -79,6 +79,13 @@ class LinkController extends ZskkDefaultController
         return $this->success($list);
     }
 
+    public function getAnotherPatientList(LinkService $linkService)
+    {
+        $param = Request::param();
+        $list = $linkService->getAnotherPatientList($param);
+        return $this->success($list);
+    }
+
     public function getPatientInfo(LinkService $linkService)
     {
         $param = Request::param();

+ 8 - 1
server/application/api/servies/butt/ButtService.php

@@ -1916,7 +1916,7 @@ class ButtService extends ZskkDefaultService {
         $authID = $params['clientsecret'];  //授权码
         if(empty($orgCode) || empty($authID))
         {
-            $this->throwError('','');
+            $this->throwError('','-1');
         }
         $where = ['id'=>$orgCode,'clientid'=>$authID];
         $institution = $this->butt->getInstitution($where);
@@ -2252,6 +2252,13 @@ class ButtService extends ZskkDefaultService {
                 $this->butt->insertExam($arr);
                 $id = $arr['id'];
             }else{
+                foreach ($arr as $k=>$v)
+                {
+                    if(empty($v))
+                    {
+                        unset($arr[$k]);
+                    }
+                }
                 $this->butt->updateExam($arr,$info['id']);
                 $id = $info['id'];
             }

+ 146 - 4
server/application/api/servies/link/LinkService.php

@@ -207,6 +207,17 @@ class LinkService extends ZskkDefaultService {
     public function getMiddleProjectList()
     {
         $list = $this->linkDao->getMiddleProjectList();
+        foreach ($list as $k=>$v)
+        {
+            if(!empty($v['name']))
+            {
+                $name = $v['name'];
+                $nameLen = mb_strlen($name, 'UTF-8');
+                if ($nameLen > 1) {
+                    $list[$k]['name'] = mb_substr($name, 0, 1, 'UTF-8') . str_repeat('*', $nameLen - 1);
+                }
+            }
+        }
         return $list;
     }
 
@@ -355,8 +366,8 @@ class LinkService extends ZskkDefaultService {
     public function getPatientList($param)
     {
         $param['code'] = openssl_decrypt(base64_decode($param['code']), 'AES-128-ECB', Config::get('chengde')['key']);
-        $param['institution_id'] = openssl_decrypt(base64_decode($param['institution_id']), 'AES-128-ECB', Config::get('chengde')['key']);
-        if(empty($param['institution_id']) || empty($param['code']))
+//        $param['institution_id'] = openssl_decrypt(base64_decode($param['institution_id']), 'AES-128-ECB', Config::get('chengde')['key']);
+        if(empty($param['code']))
         {
             $this->throwError('数据解密失败','1210');
         }
@@ -364,11 +375,12 @@ class LinkService extends ZskkDefaultService {
         {
             $this->throwError('没有相应的类型','1211');
         }
-        $insIds = explode(',',$param['institution_id']);
+//        $insIds = explode(',',$param['institution_id']);
         $type = explode(',',$param['type']);
         $code = explode(',',$param['code']);
         $where = [];
-        $institution[] = ['institution_id','in',$insIds];
+        $institution = [];
+//        $institution[] = ['institution_id','in',$insIds];
         $whereTime = [];
         if(count($type) == 1&& count($code) !== 1)
         {
@@ -468,6 +480,136 @@ class LinkService extends ZskkDefaultService {
         return $info;
     }
 
+
+    public function getAnotherPatientList($param)
+    {
+        $param['code'] = openssl_decrypt(base64_decode($param['code']), 'AES-128-ECB', Config::get('chengde')['key']);
+//        $param['institution_id'] = openssl_decrypt(base64_decode($param['institution_id']), 'AES-128-ECB', Config::get('chengde')['key']);
+        if(empty($param['code']))
+        {
+            $this->throwError('数据解密失败','1210');
+        }
+        if(empty($param['type']) || empty($param['code']))
+        {
+            $this->throwError('没有相应的类型','1211');
+        }
+//        $insIds = explode(',',$param['institution_id']);
+        $type = explode(',',$param['type']);
+        $code = explode(',',$param['code']);
+        $where = [];
+        $institution = [];
+//        $institution[] = ['institution_id','in',$insIds];
+        $whereTime = [];
+        if(count($type) == 1&& count($code) !== 1)
+        {
+            //1个type多个code
+            if(!(Config::get('institution_docking')[$type[0]] ?? null))
+            {
+                $this->throwError('没有相应的类型','1211');
+            }
+            $field = Config::get('institution_docking')[$type[0]];
+            if($field == 'name')
+            {
+                $field = 'e.name';
+            }
+            $where[] = [$field,'in',$code];
+        }else{
+            foreach ($type as $k=>$v)
+            {
+                $field = Config::get('institution_docking')[$v];
+                if(empty($field) /*|| empty($code[$k])*/){
+                    continue;
+                }
+                if($field == 'name')
+                {
+                    $field = 'e.name';
+                }
+                if($field == 'exam_datetime')
+                {
+                    $whereTime['exam_datetime'] = $code[$k];
+                }else{
+                    if(empty($code[$k]))
+                    {
+                        if(!empty($code[0]))
+                        {
+                            $where[$field] = $code[0];
+                        }
+                    }else{
+                        $where[$field] = $code[$k];
+                    }
+                }
+            }
+        }
+        if(empty($where) && empty($whereTime))
+        {
+            return [];
+        }
+        if(($param['check'] ?? null))
+        {
+            switch ($param['check'])
+            {
+                case 1:
+                    $value = 'card_num';
+                    break;
+                case 2:
+                    $value = 'phone';
+                    break;
+                default:
+                    $value = '';
+                    $this->throwError('验证错误','1223');
+                    break;
+            }
+            $data = $this->linkDao->getExamsCheck($where,$institution,$value);
+            if(empty($data))
+            {
+                $this->throwError('验证错误','1223');
+            }
+            $str = substr($data,-4);
+            if($param['checkcode'] !== $str)
+            {
+                $this->throwError('验证码错误','1224');
+            }
+        }
+        $must_where = [];
+        if(isset($param['must']) && !empty($param['must']))
+        {
+            $must = $param['must'];
+            $must_type = Config::get('institution_docking')[$must['key']];
+            if($must_type == 'name')
+            {
+                $must_type = 'e.name';
+            }
+            $must_code = $must['value'];
+            $must_where = [$must_type=>$must_code];
+        }
+        $info = $this->linkDao->getPatientReportList($where,$institution,$whereTime,$must_where);
+        foreach ($info as $k=>$v)
+        {
+            $info[$k]['insConfig'] = '';
+            $info[$k]['config_number'] = '';
+            $config = Config::get('hospital_config');
+            foreach ($config as $key=>$value)
+            {
+                if(isset($v[$key]) && !empty($v[$key]))
+                {
+                    $info[$k]['insConfig'] = $value;
+                    $info[$k]['config_number'] = $v[$key];
+                }
+            }
+            if(!empty($v['patient_source']))
+            {
+                $sourceArr = Config::get('patient_source');
+                $sourceInfo = $sourceArr[$v['patient_source']] ?? [];
+                if(!empty($sourceInfo))
+                {
+                    $info[$k]['insConfig'] = $sourceInfo['name'];
+                    $info[$k]['config_number'] = $v[$sourceInfo['field']];
+                }
+            }
+        }
+        return $info;
+    }
+
     public function getPatientInfo($params)
     {
         $info = $this->linkDao->getConfirmReportInfo($params['exam_id']);

+ 1 - 0
server/route/route.php

@@ -249,6 +249,7 @@ Route::group('', function () {
     Route::post('basic-api/getShareToken', 'app\api\controller\butt\ButtController/getShareToken');
     Route::post('getViewDetail', 'app\api\controller\link\LinkController/getViewDetail');
     Route::post('getPatientList', 'app\api\controller\link\LinkController/getPatientList');
+    Route::post('getAnotherPatientList', 'app\api\controller\link\LinkController/getAnotherPatientList');
     Route::post('getPatientInfo', 'app\api\controller\link\LinkController/getPatientInfo');
     Route::get('getJm', 'app\api\controller\link\LinkController/getJm');
 })->header('Access-Control-Allow-Headers','X-Requested-With,Content-Type,zskk-random,zskk_institution,zskk-signature,zskk-timestamp,zskk-token,zskk-version')