韩盟盟 пре 3 дана
родитељ
комит
c8c3e4d36f
2 измењених фајлова са 51 додато и 22 уклоњено
  1. 45 18
      neo4jApi/app/controller/Cdss.php
  2. 6 4
      neo4jApi/app/controller/PatientAuxiliary.php

+ 45 - 18
neo4jApi/app/controller/Cdss.php

@@ -90,6 +90,7 @@ class Cdss extends CommonTwoController
      */
     public function getSymptomAboutDisease($values, $age, $sex, $tag = 'symptom', $page = 1, $pagesize = 1000): array
     {
+        $aboutDiseases = [];
         switch ($tag) {
             case 'symptom':
                 /**
@@ -98,30 +99,55 @@ class Cdss extends CommonTwoController
                  */
                 if (stripos($values, ',') !== false) {
                     $symptoms = explode(',', $values);
-                    $query = CdssXyDisease::where('1=1');
-                    // 使用AND连接多个症状条件
-                    foreach ($symptoms as $symptom) {
-                        $query = $query->where('clinicalFeature', 'like', '%' . $symptom . '%');
+			
+		            $symptomData = Symptom::field('disease')->where('1=1')->whereIn('name',$symptoms)->select()->toArray();
+
+                    if(!empty($symptomData)){
+                        $whereIn = [];
+                        foreach ($symptomData as $key => $val) {
+                            if(!empty($val) && $val != ''){
+                                $whereIn = array_merge($whereIn,explode('||',$val['disease']));
+                            }
+                        }
+                        $aboutDiseases = CdssXyDisease::whereIn('name',$whereIn)->limit(200)->select()->toArray();
                     }
-                    $aboutDiseases = $query->limit(200)->select()->toArray();
+                    if(empty($aboutDiseases)) {
 
-                    if(empty($aboutDiseases)){
                         $query = CdssXyDisease::where('1=1');
                         // 使用AND连接多个症状条件
-                        foreach ($symptoms as $key => $symptom) {
-                            if($key == 0){
-                                $query->where('clinicalFeature', 'like', '%' . $symptom . '%');
-                            }else {
-                                $query = $query->whereOr('clinicalFeature', 'like', '%' . $symptom . '%');
-                            }
+                        foreach ($symptoms as $symptom) {
+                            $query = $query->where('clinicalFeature', 'like', '%' . $symptom . '%');
                         }
                         $aboutDiseases = $query->limit(200)->select()->toArray();
+
+                        if (empty($aboutDiseases)) {
+                            $query = CdssXyDisease::where('1=1');
+                            // 使用AND连接多个症状条件
+                            foreach ($symptoms as $key => $symptom) {
+                                if ($key == 0) {
+                                    $query->where('clinicalFeature', 'like', '%' . $symptom . '%');
+                                } else {
+                                    $query = $query->whereOr('clinicalFeature', 'like', '%' . $symptom . '%');
+                                }
+                            }
+                            $aboutDiseases = $query->limit(200)->select()->toArray();
+                        }
                     }
                 } else {
-                    $aboutDiseases = CdssXyDisease::whereLike('clinicalFeature', '%' . $values . '%')
-                        ->limit(200)
-                        ->select()
-                        ->toArray();
+                    $symptomData = Symptom::where('1=1')->where('name',$values)->value('disease');
+                    if(!empty($symptomData)){
+                        $whereIn = [];
+                            if(!empty($symptomData) && $symptomData != ''){
+                                $whereIn = array_merge($whereIn,explode('||',$symptomData));
+                            }
+                        $aboutDiseases = CdssXyDisease::whereIn('name',$whereIn)->limit(200)->select()->toArray();
+                    }
+                    if(empty($aboutDiseases)) {
+                        $aboutDiseases = CdssXyDisease::whereLike('clinicalFeature', '%' . $values . '%')
+                            ->limit(200)
+                            ->select()
+                            ->toArray();
+                    }
                 }
 
                 /**
@@ -883,7 +909,7 @@ class Cdss extends CommonTwoController
     public function getMedicalKnowledgeByKeyword(): Json
     {
         //限制时间访问
-        $expirationTime = strtotime("2026-01-01 00:00:00");
+        $expirationTime = strtotime("2026-06-01 00:00:00");
         $currentTimestamp = time();
 
         if ($currentTimestamp > $expirationTime) {
@@ -1769,6 +1795,7 @@ class Cdss extends CommonTwoController
         $tag = $params['tag'] ?? 'Disease';
         $value = $params['name'] ?? '';
         $id = $params['id'] ?? '';
+        $is_web = $params['is_web'] ?? 0;
         //对接东华加的字段
         $donghua_name = $params['donghua_name'] ?? '';
         //中联字段
@@ -2008,7 +2035,7 @@ class Cdss extends CommonTwoController
                 unset($detail['format']);
             }
 
-            if ($tag == 'Inspection' || $tag = 'MedicineProduction') {
+            if ($tag == 'Inspection' || ($tag == 'MedicineProduction' && $is_web)) {
                 $a[] = $detail;
                 $detail = $a;
             }

+ 6 - 4
neo4jApi/app/controller/PatientAuxiliary.php

@@ -104,7 +104,7 @@ class PatientAuxiliary extends CommonTwoController
                 try {
                     // 从主诉症状中提取关键词
 //                    $dictionary = SymptomDictionary::field('symptom')->whereRaw("'".$params['ZSZZ']."'".' LIKE CONCAT("%", symptom, "%")')->select()->toArray();
-                    $dictionary = Db::table('jm_knowledge_rule')->field('keyword')->whereRaw("'".$params['ZSZZ']."'".' LIKE CONCAT("%", keyword, "%")')->select()->toArray();
+                    $dictionary = Db::table('jm_cdss_symptom_keywords')->field('keyword')->whereRaw("'".$params['ZSZZ']."'".' LIKE CONCAT("%", keyword, "%")')->select()->toArray();
 //                    $mainSymptoms = $dictionary ? implode(',',array_column($dictionary,'symptom')) : '';
                     $mainSymptoms = $dictionary ? implode(',',array_column($dictionary,'keyword')) : '';
 
@@ -138,7 +138,8 @@ class PatientAuxiliary extends CommonTwoController
                     // 调用detail方法
                     $response = $this->cdss->detail([
                         'name' => $params['name'],
-                        'tag' => $params['tag']
+                        'tag' => $params['tag'],
+                        'is_web' => 1
                     ]);
                     
                     // 从Json响应中获取数据
@@ -165,7 +166,8 @@ class PatientAuxiliary extends CommonTwoController
                         // 调用detail方法
                         $medicineResult = $this->cdss->detail([
                             'name' => $medicineProduction,
-                            'tag' => 'MedicineProduction'
+                            'tag' => 'MedicineProduction',
+                            'is_web' => 1
                         ]);
 
                         // 从Json响应中获取数据
@@ -176,7 +178,7 @@ class PatientAuxiliary extends CommonTwoController
                         // 调用detail方法
                         $inspectionResult = $this->cdss->detail([
                             'name' => $inspection,
-                            'tag' => 'Inspection'
+                            'tag' => 'Inspection',
                         ]);
 
                         // 从Json响应中获取数据