瀏覽代碼

Merge branch 'master' into tangshan

chw 4 天之前
父節點
當前提交
91ec7f72a9

+ 13 - 0
server/application/api/controller/butt/ButtController.php

@@ -464,4 +464,17 @@ class ButtController extends ZskkDefaultApiController
         $token = $linkService->getShareToken($data);
         return $this->success2($token,1);
     }
+
+    public function getStudyUrl(ButtService $service)
+    {
+        $params = Request::param(false);
+        $data = $service->getStudyUrl($params);
+        if($data['code'] == 1)
+        {
+            return $data['msg'];
+        }else{
+            header("Location: ".$data['url']);
+            exit();
+        }
+    }
 }

+ 1 - 1
server/application/api/dao/link/LinkDao.php

@@ -156,7 +156,7 @@ class LinkDao extends ZskkDefaultDao {
 
         if(empty($report))
         {
-            $examField = ['name','sex','age','is_dcm','application_department','accession_num','hopitalized_no','bed_no','exam_class','exam_datetime','exam_project',"study_id",'pay_status','id AS exam_id','exam_status','institution_id',"'' AS id",'patient_num',"'' AS message","'' AS report_subtitle","'' AS report_title"];
+            $examField = ['NAME','SEX','AGE','IS_DCM','APPLICATION_DEPARTMENT','ACCESSION_NUM','HOPITALIZED_NO','BED_NO','EXAM_CLASS','EXAM_DATETIME','EXAM_PROJECT',"STUDY_ID",'PAY_STATUS','ID AS EXAM_ID','EXAM_STATUS','INSTITUTION_ID',"'' AS ID",'PATIENT_NUM',"'' AS MESSAGE","'' AS REPORT_SUBTITLE","'' AS REPORT_TITLE"];
             $report = $this->examModel->where('id',$examId)->where('status',1)->field($examField)->select();
         }
         return $report;

+ 74 - 0
server/application/api/servies/butt/ButtService.php

@@ -2354,4 +2354,78 @@ class ButtService extends ZskkDefaultService {
         $report['imagenumber'] = $data['B']['BD'];
         return $report;
     }
+    /**
+     * AES-128-ECB 解密方法
+     * @param string $str 需要解密的 Base64 编码字符串
+     * @return string 解密后的原始数据
+     */
+    public function aesDecrypt($str)
+    {
+        $key = 'ghbfdmlyhxdxlyjl';
+        if($str) {
+            return openssl_decrypt(base64_decode($str), 'AES-128-ECB', $key, OPENSSL_RAW_DATA);
+        }
+        return $str;
+    }
+    /*
+     * 获取检查报告
+     * @param $param
+     * type:查询类型
+     * code: 加密值
+     * institution_id: 机构id
+     */
+    public function getStudyUrl($param)
+    {
+        $acc = $param['code'];
+        $acc = $this->aesDecrypt($acc);
+        if(empty($acc))
+        {
+            return ['code'=>1,'msg'=>$param['acc'].'密文无法解密,请联系管理员'];
+        }
+        if (empty($param['institution_id'])){
+            return ['code'=>1,'msg'=>'请选择机构'];
+        }
+        if (!in_array($param['type'],['1','2','3','4','5'])){
+            return ['code'=>1,'msg'=>'请选择查询类型'];
+        }
+        $where = [];
+        switch ($param['type']){
+            case '1':
+                //病历号
+                $where['patient_num'] = $acc;
+                break;
+            case '2':
+                //检查号
+                $where['accession_num'] = $acc;
+                break;
+            case '3':
+                //住院号
+                $where['hopitalized_no'] = $acc;
+                break;
+            case '4':
+                //身份证
+                $where['card_num'] = $acc;
+                break;
+            case '5':
+                //手机号
+                $where['phone'] = $acc;
+                break;
+        }
+        $where['institution_id'] = $param['institution_id'];
+        $study = $this->butt->getExam($where,['study_id']);
+        if(empty($study))
+        {
+            return ['code'=>1,'msg'=>$acc.'的检查未找到'];
+        }
+        if(empty($param['url']))
+        {
+            $domain = 'http://114.118.9.145:9603';
+        }else{
+            $domain = $param['url'];
+        }
+        $study_id = $study['study_id'];
+        $url = "$domain/#/mobile?studyurl=$domain/query/?address=$domain/dcmdown&study_id=$study_id&type=1&node_type=1&version=V1.2.0.0";
+
+        return ['code'=>0,'url'=>$url];
+    }
 }

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

@@ -483,12 +483,6 @@ class LinkService extends ZskkDefaultService {
 
     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');
@@ -625,7 +619,10 @@ class LinkService extends ZskkDefaultService {
                     $info[$k]['insConfig'] = $value;
                     $info[$k]['config_number'] = $v[$key];
                 }
-                $info[$k]['age'] = str_replace('W','周',str_replace('D','天',str_replace('M','月',str_replace('Y','岁',ltrim($info[$k]['age'],'0')))));
+                if(!empty($v['age']))
+                {
+                    $info[$k]['age'] = str_replace('W','周',str_replace('D','天',str_replace('M','月',str_replace('Y','岁',ltrim($info[$k]['age'],'0')))));
+                }
             }
         }
         return $info;