刘桂岩 5 years ago
parent
commit
a1966defbc

+ 6 - 4
application/common/library/DicomPaser.php

@@ -13,24 +13,26 @@ namespace app\common\library;
 require dirname(__FILE__).'/nanodicom/Nanodicom.php';
 use Nanodicom;
 use app\common\library\DicomPaserTag;
+use think\Exception;
+
 class DicomPaser {
     public static function paser($filePath = '') { 
 
         if(empty($filePath)) {
-            throw new Error("The filePath $filePath is empty or null");
+            return json_encode(['status'=>'fail','code'=>'2000','msg'=>"The filePath $filePath is empty or null"]);
         }
 
         if(!file_exists($filePath)) {
-            throw new Error("The filePath $filePath not exist");
+            return json_encode(['status'=>'fail','code'=>'2000','msg'=>"The filePath $filePath not exist"]);
         }
 
         if(!is_file($filePath)) {
-            throw new Error("The filePath $filePath not file");
+            return json_encode(['status'=>'fail','code'=>'2000','msg'=>"The filePath $filePath not file"]);
         }
 
         $dicom = Nanodicom::factory($filePath);
         if(! $dicom->is_dicom()) {
-            throw new Error("The filePath $filePath not dcm file");
+            return json_encode(['status'=>'fail','code'=>'2000','msg'=>"The filePath $filePath not dcm file"]);
         }
 
         $a = $dicom->get(0x0010, 0x0010, 'N/A');

+ 1 - 5
application/inter/controller/Dcom.php

@@ -23,15 +23,11 @@ class Dcom extends Controller  //Base
                     foreach($info as  $k=>$v){
                         $info[$k] = trim($v);
                     }
-//                    $hz_bh = $this->service->insert_hz($info);
                     $patient = $this->insertPatient($info);
-//                    $jc_bh = $this->service->insert_jc($info,$hz_bh);
                     $exam = $this->insertExam($info,$patient);
-//                    $xl_bh = $this->service->insert_xl($info,$jc_bh);
                     $series = $this->insertSeries($info,$exam);
-//                    $return = $this->service->insert_tp($info,$xl_bh,$path);
                     $image = $this->insertImages($info,$series,$path,$path);
-//                    return ServerResponse::getSuccess('success',$return);
+                    return json_encode(['status'=>'success','code'=>'0000']);
                 }else{
                     return json_encode(['status'=>'fail','code'=>'2000','msg'=>$file->getError()]);
                 }