lgy 2 dienas atpakaļ
vecāks
revīzija
a33aed6572

+ 1 - 1
server/application/api/model/xz/XzModel.php

@@ -154,7 +154,7 @@ class XzModel extends ZskkDefaultModel {
 
     public function getInsFilmInfo($id)
     {
-        $info = InstitutionModel::where('id',$id)->field('film_price,charge_mode')->find();
+        $info = InstitutionModel::where('id',$id)->find();
         return $info;
     }
 

+ 30 - 39
server/application/api/servies/xz/XzService.php

@@ -291,30 +291,7 @@ class XzService extends ZskkDefaultService {
             return true;
         }*/
         $time1 = time();
-        if($params['institution_id'] == '43600001')
-        {
-            $exam = $this->xz->checkIsSet($params['study_id'],$params['studyuid'],$params['institution_id']);
-        }else{
-            $exam = $this->xz->checkIsSet($params['study_id']);
-        }
-        if($params['institution_id'] == '71900004')
-        {
-            $params['name'] = str_replace('=','',$params['name']);
-        }
-        if($params['institution_id'] == '16100014')
-        {
-            if($params['exam_class'] == 'RF')
-            {
-                $params['exam_class'] = 'DX';
-            }
-        }
-        if($params['institution_id'] == '71900007' || $params['institution_id'] == '71900008')
-        {
-            if($params['exam_class'] == 'CR')
-            {
-                $params['exam_class'] = 'DR';
-            }
-        }
+        $exam = $this->xz->checkIsSet($params['study_id']);
         if($exam){
             //存在则修改
             $id = $exam['id'];
@@ -385,25 +362,13 @@ class XzService extends ZskkDefaultService {
             }else{
                 $this->xz->updateExam($id,$update);
             }
-        }
-        else{
+            $studyuid = $exam['STUDYUID'];
+            $acc_num = $exam['ACCESSION_NUM'];
+        }else{
             $name = $params['name'] ?? null;
             $hopitalized_no = null;
             $bed_no = null;
             $exam_project = null;
-            if($params['institution_id'] == '27400005') {
-                $cache = $this->xz->getCache("worklist_".$params['patient_num']);
-                if(!empty($cache))
-                    {
-                    $key = "worklist_".$params['patient_num'];
-                    $d = json_decode($cache, true);
-                    Log::record('东民二院;存储key为'.$key.';存储内容为'.$cache);
-                    $name = $d['NAME'];
-                    $hopitalized_no = $d['zyh'];
-                    $bed_no = $d['cwh'];
-                    $exam_project = $d['PARTOFCHECK'];
-                }
-            }
             $uid = $this->xz->getStudyUid($params['study_id']);
             if(empty($uid))
             {
@@ -414,6 +379,8 @@ class XzService extends ZskkDefaultService {
             {
                 $body_part_text = $this->xz->getBodyText($params['body_part']);
             }
+            $studyuid = $uid;
+            $acc_num = $params['accession_num'];
             $data = [
                 'id'=>UUIDUtils::uuid(),
                 'patient_id'=>$params['patient_id'],
@@ -505,12 +472,36 @@ class XzService extends ZskkDefaultService {
 //                log::record('没有这个医院id'.$params['institution_id'] ?? null);
 //            }
         }
+        $this->syncHr($params['study_id'],$studyuid,$acc_num);
         $time2 = time();
         $time = $time2-$time1;
         $this->xz->insertSpecialLog($time,'xz/create');
         return $id;
     }
 
+    public function syncHr($study_id, $studyuid, $accession_num)
+    {
+        if(empty($study_id))
+        {
+            return '';
+        }else{
+            if(!empty($studyuid))
+            {
+                $hr = Db::query("SELECT ID FROM HR.EXAM_REPORT WHERE STUDYUID='$studyuid'");
+                if(!empty($hr))
+                {
+                    Db::query("UPDATE HR.EXAM_REPORT SET STUDY_ID='$study_id' WHERE STUDYUID='$studyuid'");
+                }else{
+                    $hr2 = Db::query("SELECT ID FROM HR.EXAM_REPORT WHERE ACCESSION_NUM='$accession_num'");
+                    if(!empty($hr2))
+                    {
+                        Db::query("UPDATE HR.EXAM_REPORT SET STUDY_ID='$study_id' WHERE ACCESSION_NUM='$accession_num'");
+                    }
+                }
+            }
+        }
+    }
+
     //医院胶片流水
     public function save_ins_film_water($exam_id,$order_type,$money,$institution)
     {