4 次代碼提交 0c34166a8b ... 8673e59c92

作者 SHA1 備註 提交日期
  chw 8673e59c92 获取报告接口 4 天之前
  chw 91ec7f72a9 Merge branch 'master' into tangshan 4 天之前
  chw a83260fe3f 影像获取api 4 天之前
  lgy 3550152d56 xg 1 月之前

+ 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();
+        }
+    }
 }

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

@@ -79,6 +79,16 @@ class LinkController extends ZskkDefaultController
         return $this->success($list);
     }
 
+    /*
+     * 唐山获取报告
+     */
+    public function reportListOuter(LinkService $linkService)
+    {
+        $param = Request::param();
+        $list = $linkService->getNewPatientList($param);
+        return $this->success($list);
+    }
+
     public function getAnotherPatientList(LinkService $linkService)
     {
         $param = Request::param();

+ 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];
+    }
 }

+ 90 - 5
server/application/api/servies/link/LinkService.php

@@ -480,15 +480,97 @@ class LinkService extends ZskkDefaultService {
         return $info;
     }
 
-
-    public function getAnotherPatientList($param)
+    /*
+     * 唐山获取 报告对接
+     * $param type code
+     * type 查询类型、code 参数
+     */
+    public function getNewPatientList($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']);
+        $param['code'] = openssl_decrypt(base64_decode($param['code']), 'AES-128-ECB', 'ghbfdmlyhxdxlyjl');
+
         if(empty($param['code']))
         {
             $this->throwError('数据解密失败','1210');
         }
+        if(empty($param['type']) || !in_array($param['type'],[1,2,3,4,5,6,7,8,9]))
+        {
+            $this->throwError('没有相应的类型','1211');
+        }
+
+        $code = $param['code'];
+        $where = $institution = $whereTime =  [];
+
+        switch ($param['type']){
+            case '1':
+                //病历号
+                $where['patient_num'] = $code;
+                break;
+            case '2':
+                //检查号
+                $where['accession_num'] = $code;
+                break;
+            case '3':
+                //住院号
+                $where['hopitalized_no'] = $code;
+                break;
+            case '4':
+                //身份证
+                $where['card_num'] = $code;
+                break;
+            case '5':
+                //手机号
+                $where['phone'] = $code;
+                break;
+            case '6':
+                //姓名
+                $where['name'] = $code;
+                break;
+            case '7':
+                //门诊号
+                $where['out_patient'] = $code;
+                break;
+            case '8':
+                //医院HIS病人ID
+                $where['his_patient_id'] = $code;
+                break;
+            case '9':
+                //检查时间
+                $where['exam_datetime'] = $code;
+                break;
+        }
+        if(empty($where)) {return [];}
+
+        $info = $this->linkDao->getPatientReportList($where,$institution,$whereTime,[]);
+        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 getAnotherPatientList($param)
+    {
         if(empty($param['type']) || empty($param['code']))
         {
             $this->throwError('没有相应的类型','1211');
@@ -625,7 +707,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;

+ 2 - 0
server/route/route.php

@@ -43,6 +43,7 @@ Route::get('makeYdUrl', 'app\api\controller\butt\ButtController/makeYdUrl');
 Route::get('sendYqSms', 'app\api\controller\xz\XzController/sendSms');
 Route::get('sendWechatEmail', 'app\api\controller\butt\ButtController/sendWechatEmail');
 Route::get('saveAnalysis', 'app\api\controller\butt\ButtController/saveAnalysis');
+Route::get('getStudyUrl', 'app\api\controller\butt\ButtController/getStudyUrl');
 Route::group('', function () {
     Route::get('getInsNum', 'app\api\controller\butt\ButtController/ins_num');;
     Route::post('getAiNode', 'app\api\controller\butt\ButtController/getAiNode');;
@@ -251,6 +252,7 @@ Route::group('', function () {
     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('reportListOuter', 'app\api\controller\link\LinkController/reportListOuter');
     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')
     ->allowCrossDomain();