getRootPath().'vendor/autoload.php'; use Neoxygen\NeoClient\ClientBuilder; use think\facade\Request; use app\model\ClinicalTrial; use app\model\ClinicalPathway; class NeojApiMasterWeb extends CommonTwoController { // 菜单栏 public function index() { //if(!$this->checkIslogin()) return $this->_json_error('请登录后查看!'); // 西医科普疾病 $query = "match(n:SickNess) where n.departmentLevel1 is not null return distinct n.departmentLevel1 as departmentLevel1"; $departmentLevel1 = $this->getAboutInfo($query); $list = []; foreach ($departmentLevel1 as $key => $value) { $list[$key]['departmentLevel1'] = $value['departmentLevel1']; $query1 = "match(n:SickNess{departmentLevel1 : "."'".$value["departmentLevel1"]."'"."}) return distinct n.departmentLevel2 as departmentLevel2"; $qdata1 = $this->getAboutInfo($query1); foreach ($qdata1 as $key1 => $value1) { $qdata1[$key1]['tag'] = 'sickness'; } $list[$key]['departmentLevel2']['name'] = $qdata1; } // 西医科室疾病 $query2 = "match(n:Disease) where n.departmentLevel1 is not null return distinct n.departmentLevel1 as departmentLevel1"; $departmentLevel = $this->getAboutInfo($query2); $listt = []; foreach ($departmentLevel as $key => $value) { $listt[$key]['departmentLevel1'] = $value['departmentLevel1']; $query11 = "match(n:Disease{departmentLevel1 : "."'".$value["departmentLevel1"]."'"."}) return distinct n.departmentLevel2 as departmentLevel2"; $qqdata1 = $this->getAboutInfo($query11); foreach ($qqdata1 as $key11 => $value11) { $qqdata1[$key11]['tag'] = 'disease'; } $listt[$key]['departmentLevel2']['name'] = $qqdata1; } // 西医科室疾病 $query2 = "match(n:Disease) where n.departmentLevel1 is not null return distinct n.departmentLevel1 as departmentLevel1"; $data2 = $this->getAboutInfo($query2); foreach ($data2 as $key2 => $value2) { $data2[$key2]['tag'] = 'disease'; } // 中医疾病 $query1 = "match(n:SickNess) where n.department is not null return distinct n.department as departmentLevel2"; $data = $this->getAboutInfo($query1 , 'zy'); unset($data[20]); unset($data[5]); $listzy[0]['departmentLevel1']['name'] = '中医科室'; $listzy[0]['departmentLevel2']['name'] = $data; $lists = [ ['knowledge_base_name' => '西医知识库'], ['knowledge_base_name' => '中医知识库'], ['knowledge_base_name' => '文献和指南'] ]; foreach ($lists as $k => $v) { // 西医知识库 $lists[0]['subordinate'] = [ ['name' => '疾病'] , ['name' => '症状体征' , 'tag' => 'symptom'], ['name' => '药品' , 'tag' => 'medicine'], ['name' => '检查' , 'tag' => 'inspection'], ['name' => '鉴别诊断(误诊)' , 'tag' => 'identify'], ['name' => '临床试验' , 'tag' => 'clinicTrial'], ['name' => '临床路径' , 'tag' => 'clinicalPathway'], ]; // 中医知识库 $lists[1]['subordinate'] = [ ['name' => '疾病' , 'tag' => 'zysickness'] , ['name' => '中成药' , 'tag' => 'zcy'] , ['name' => '经络' , 'tag' => 'jl'] , ['name' => '中药' , 'tag' => 'zy'] , ['name' => '中医药膳' , 'tag' => 'ys'] , ['name' => '方剂' , 'tag' => 'fj'] , ['name' => '体质' , 'tag' => 'tz'] , ['name' => '穴位' , 'tag' => 'xw'] ]; // 指南和文献 $lists[2]['subordinate'] = [ ['name' => '文献' , 'tag' => 'document'] , ['name' => '指南' , 'tag' => 'guide'] ]; } // 中医疾病科室 $zysicknessQuery = "match(n:SickNess) return distinct n.department as departmentLevel2"; $zydeparment = $this->getAboutInfo($zysicknessQuery , 'zy'); foreach ($zydeparment as $zyk => $zyvalue) { $zydeparment[$zyk]['tag'] = 'zysickness'; $zydquery = "match(n:SickNess {department:"."'".$zyvalue['departmentLevel2']."'"."}) return distinct n.name as name"; $datazyd = $this->getAboutInfo($zydquery , 'zy'); foreach ($datazyd as $zydk => $zydv) { $datazyd[$zydk]['tag'] = 'zysickness'; } $zydeparment[$zyk]['subordinate'] = $datazyd; unset($zydeparment[20]); unset($zydeparment[21]); } foreach ($lists as $kk => $v) { $lists[0]['subordinate'][0]['subordinate'] = [['name' => '西医科普疾病'] , ['name' => '西医科室疾病']]; } // 获取中成药分类 $cnquery = "match(n:CnPatentMedicine) where n.classification is not null return distinct n.classification as name"; $cndata = $this->getAboutInfo($cnquery , 'zy'); foreach ($cndata as $cnkey => $cnvalue) { $cndata[$cnkey]['tag'] = 'zcy'; } // 获取经络分类 $cnjlquery = "match(n:ChannelCollateral) where n.name is not null return distinct n.name as name"; $cnjldata = $this->getAboutInfo($cnjlquery , 'zy'); foreach ($cnjldata as $cnjlkey => $cnvalue) { $cnjldata[$cnjlkey]['tag'] = 'jl'; } // 获取西医症状体征分类(部位) $locationquery = "match(n:Location) return distinct n.name as name"; $cnlodata = $this->getAboutInfo($locationquery); foreach ($cnlodata as $cnlokey => $cnvalue) { $cnlodata[$cnlokey]['tag'] = 'symptom'; } foreach ($lists as $kkk => $vvv) { $lists[0]['subordinate'][0]['subordinate'][0]['department'] = $list; //$lists[0]['subordinate'][0]['subordinate'][1]['department'][0]['departmentLevel1'] = '医疗疾病科室'; $lists[0]['subordinate'][0]['subordinate'][1]['department'] = $listt; $lists[0]['subordinate'][1]['subordinate'] = $cnlodata; // 西医部位 $lists[1]['subordinate'][0]['subordinate'][0]['name'] = '中医科室疾病'; $lists[1]['subordinate'][0]['subordinate'][1]['name'] = '中医ICD10疾病'; //$lists[1]['subordinate'][0]['subordinate'][0]['department'][0]['departmentLevel1'] = '中医科室'; $lists[1]['subordinate'][0]['subordinate'][0]['department'] = $zydeparment; $lists[1]['subordinate'][0]['subordinate'][1]['department'] = $this->getIcdSickness(); $lists[1]['subordinate'][1]['subordinate'] = $cndata; $lists[1]['subordinate'][2]['subordinate'] = $cnjldata; // 经络 } return $this->_json_succ($lists); } // 中医icd分类 public function getIcdSickness() { $query = "match(n:Thing) where n.level1 is not null return distinct n.level1 as level"; $data = $this->getAboutInfo($query , 'zy'); foreach ($data as $key => $value) { $query1 = "match(n:Thing {level1:"."'".$value["level"]."'"."}) return distinct n.level2 as level2"; $data1 = $this->getAboutInfo($query1 , 'zy'); $data[$key]['subordinate'] = $data1; foreach ($data1 as $kk => $vv) { //$query2 = "match(n:Thing {level2:"."'".$vv["level2"]."'"."}) return distinct n.name as name order by name"; $vv['level2'] = substr($vv['level2'] , 0 , 3); $query2 = "MATCH (n:SickNess) where n.ICD10 =~'.*".$vv["level2"].".*' and n.ICD10 is not null return distinct n.ICD10 as name order by n.ICD10 asc limit 10"; $data2 = $this->getAboutInfo($query2 , 'zy'); foreach ($data2 as $k => $v) { $data2[$k]['tag'] = 'icd10'; $data2[$k]['name'] = $v['name']; } $data[$key]['subordinate'][$kk]['subordinate'] = $data2; } } return $data; } // 中医知识库列表 public function getZyList() { //if(!$this->checkIslogin()) return $this->_json_error('请登录后查看!'); $tag = Request::param('tag'); $pn = Request::param('pn') ?? 1; $limit = ($pn - 1) * 30; switch ($tag) { case 'zysickness': $query = "match(n:SickNess) return n skip $limit limit 20"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $query_count = "match(n:SickNess) return count(n) as count"; $count = $this->getTotalCount($query_count , 'zy'); $list = []; foreach ($data as $key => $value) { $list[$key]['name'] = $value['dialecticalName']; $list[$key]['symptom'] = ['name' => '症见' , 'text' => $value['symptom'] ?? '' , 'active' => true]; $list[$key]['tongueCondition'] = ['name' => '舌象' , 'text' => $value['tongueCondition'] ?? '' , 'active' => false]; $list[$key]['apparatus'] = ['name' => '发病部位' , 'text' => $value['apparatus'] ?? '' , 'active' => false]; $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false]; $list[$key]['pulseCondition'] = ['name' => '脉象' , 'text' => $value['pulseCondition'] ?? '' , 'active' => false]; $list[$key]['dietTherapy'] = ['name' => '饮食疗法' , 'text' => $value['dietTherapy'] ?? '' , 'active' => false]; $list[$key]['department'] = ['name' => '科室' , 'text' => $value['department'] ?? '' , 'active' => false]; $list[$key]['acupuncturePoints'] = ['name' => '针灸穴位' , 'text' => $value['acupuncturePoints'] ?? '' , 'active' => false]; $list[$key]['dialecticalName'] = ['name' => '辩证法名' , 'text' => $value['dialecticalName'] ?? '' , 'active' => false]; } break; case 'zy': $query = "match(n:CnMedicinalCrop) return n skip $limit limit 20"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $query_count = "match(n:CnMedicinalCrop) return count(n) as count"; $count = $this->getTotalCount($query_count , 'zy'); $list = []; foreach ($data as $key => $value) { $list[$key]['name'] = $value['name']; $list[$key]['toxicity'] = ['name' => '毒性' , 'text' => $value['toxicity'] ?? '' , 'active' => true]; $list[$key]['indications'] = ['name' => '功能主治' , 'text' => $value['indications'] ?? '' , 'active' => false]; $list[$key]['source'] = ['name' => '来源' , 'text' => $value['source'] ?? '' , 'active' => false]; $list[$key]['medicineProperty'] = ['name' => '药性' , 'text' => $value['medicineProperty'] ?? '' , 'active' => false]; $list[$key]['includedIn'] = ['name' => '收录于' , 'text' => $value['includedIn'] ?? '' , 'active' => false]; $list[$key]['pharmacology'] = ['name' => '药理作用' , 'text' => $value['pharmacology '] ?? '' , 'active' => false]; $list[$key]['kgid'] = ['name' => 'kgid' , 'text' => $value['kgid'] ?? '' , 'active' => false]; } break; case 'zcy': $query = "match(n:CnPatentMedicine) return n skip $limit limit 20"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $query_count = "match(n:CnPatentMedicine) return count(n) as count"; $count = $this->getTotalCount($query_count , 'zy'); $list = []; foreach ($data as $key => $value) { $list[$key]['name'] = $value['name']; $list[$key]['classification'] = ['name' => '实体值' , 'text' => $value['classification'] ?? '' , 'active' => true]; $list[$key]['efficacy'] = ['name' => '功效' , 'text' => $value['efficacy'] ?? '' , 'active' => false]; $list[$key]['indications'] = ['name' => '主治' , 'text' => $value['indications'] ?? '' , 'active' => false]; $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false]; } break; case 'ys': $query = "match(n:TonicDiet) return n skip $limit limit 20"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $query_count = "match(n:TonicDiet) return count(n) as count"; $count = $this->getTotalCount($query_count , 'zy'); $list = []; foreach ($data as $key => $value) { $list[$key]['name'] = $value['name']; $list[$key]['composition'] = ['name' => '药膳组成' , 'text' => $value['composition'] ?? '' , 'active' => true]; } break; case 'fj': $query = "match(n:Prescription) return n skip $limit limit 20"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $query_count = "match(n:Prescription) return count(n) as count"; $count = $this->getTotalCount($query_count , 'zy'); $list = []; foreach ($data as $key => $value) { $list[$key]['name'] = $value['name']; $list[$key]['composition'] = ['name' => '方剂组成' , 'text' => $value['composition'] ?? '' , 'active' => true]; $list[$key]['medicinalCrop'] = ['name' => '中药' , 'text' => $value['medicinalCrop'] ?? '' , 'active' => false]; $list[$key]['indications'] = ['name' => '主治' , 'text' => $value['indications'] ?? '' , 'active' => false]; $list[$key]['solution'] = ['name' => '方法/解法' , 'text' => $value['solution'] ?? '' , 'active' => false]; $list[$key]['usageDosage'] = ['name' => '用法用量' , 'text' => $value['usageDosage'] ?? '' , 'active' => false]; $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false]; } break; case 'tz': $query = "match(n:Constitution) return n skip $limit limit 20"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $query_count = "match(n:Constitution) return count(n) as count"; $count = $this->getTotalCount($query_count , 'zy'); $list = []; foreach ($data as $key => $value) { $list[$key]['name'] = $value['name']; $list[$key]['overallFeature'] = ['name' => '总体特征' , 'text' => $value['overallFeature'] ?? '' , 'active' => true]; $list[$key]['psychologicalFeature'] = ['name' => '心理特征' , 'text' => $value['medicinalCrop'] ?? '' , 'active' => false]; $list[$key]['commonPerformance'] = ['name' => '常见表现' , 'text' => $value['indications'] ?? '' , 'active' => false]; $list[$key]['tendency'] = ['name' => '发病倾向' , 'text' => $value['tendency'] ?? '' , 'active' => false]; $list[$key]['exercise'] = ['name' => '体育锻炼' , 'text' => $value['exercise'] ?? '' , 'active' => false]; $list[$key]['meridianHealth'] = ['name' => '经络保健' , 'text' => $value['meridianHealth'] ?? '' , 'active' => false]; $list[$key]['medicineRegimen'] = ['name' => '药物养生' , 'text' => $value['medicineRegimen'] ?? '' , 'active' => false]; $list[$key]['dietTherapy'] = ['name' => '宜食疗' , 'text' => $value['medicineRegimen'] ?? '' , 'active' => false]; $list[$key]['notEat'] = ['name' => '不宜吃' , 'text' => $value['medicineRegimen'] ?? '' , 'active' => false]; } break; case 'xw': $query = "match(n:Acupoint) return n skip $limit limit 20"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $query_count = "match(n:Acupoint) return count(n) as count"; $count = $this->getTotalCount($query_count , 'zy'); $list = []; foreach ($data as $key => $value) { $list[$key]['name'] = $value['name']; $list[$key]['location'] = ['name' => '定位' , 'text' => $value['location'] ?? '' , 'active' => true]; $list[$key]['indications'] = ['name' => '主治' , 'text' => $value['indications'] ?? '' , 'active' => false]; $list[$key]['compatibility'] = ['name' => '配伍' , 'text' => $value['compatibility'] ?? '' , 'active' => false]; $list[$key]['acupuncture'] = ['name' => '针灸法' , 'text' => $value['acupuncture'] ?? '' , 'active' => false]; $list[$key]['notions'] = ['name' => '附注' , 'text' => $value['notions'] ?? '' , 'active' => false]; } break; } return $this->_json_succ(['list' => $list , 'count' => $count]); } // 获取左侧栏目下拉信息 public function getSickNessByDpm() { //if(!$this->checkIslogin()) return $this->_json_error('请登录后查看!'); $department = Request::param('department') ?? ''; $pn = Request::param('pn') ?? 1; $pagesize = 20; $limit = ($pn - 1) * $pagesize; $tag = Request::param('tag') ?? 'sickness'; // sickness 科普 disease 医疗 $list = []; switch ($tag) { case "sickness": $query = "match(n:SickNess{departmentLevel2 : "."'".$department."'"."}) return n.name as name , n.complicationsOverview as complicationsOverview , n.pathogenesis as pathogenesis , n.treatmenCommonSense as treatmenCommonSense , n.inspection as inspection , n.symptom as symptom , n.diagnostiCtriage as diagnostiCtriage skip $limit limit 20"; // $query = "match(n:SickNess{departmentLevel2 : "."'".$department."'"."}) return n skip $limit limit 30"; $sickess = $this->getAboutInfo($query); $query_count = "match(n:SickNess{departmentLevel2 : "."'".$department."'"."}) return count(n) as count"; $count = $this->getTotalCount($query_count); foreach ($sickess as $key => $value) { $list[$key]['sickness_name'] = $value['name']; $list[$key]['symptom'] = ['name' => '临床表现' , 'text' => $value['symptom'] ?? '' , 'active' => true]; $list[$key]['pathogenesis'] = ['name' => '病因' , 'text' => $value['pathogenesis'] ?? '' , 'active' => false]; $list[$key]['complicationsOverview'] = ['name' => '并发症' , 'text' => $value['complicationsOverview'] ?? '' , 'active' => false]; $list[$key]['inspection'] = ['name' => '辅助检查' , 'text' => $value['inspection'] ?? '', 'active' => false]; $list[$key]['treatmenCommonSense'] = ['name' => '治疗' , 'text' => $value['treatmenCommonSense'] ?? '' , 'active' => false]; $list[$key]['diagnostiCtriage'] = ['name' => '诊断' , 'text' => $value['diagnostiCtriage'] ?? '', 'active' => false]; } break; case "disease": $query = "match(n:Disease{departmentLevel2 : "."'".$department."'"."}) return n.name as name, n.clinicalFeature as clinicalFeature , n.pathogenesis as pathogenesis , n.complicationsOverview as complicationsOverview , n.auxiliaryExamination as auxiliaryExamination , n.treatment as treatment , n.diagnosis as diagnosis skip $limit limit 20"; $sickess = $this->getAboutInfo($query); $query_count = "match(n:Disease) where n.departmentLevel2 =~'.*".$department.".*' return count(n) as count"; $count = $this->getTotalCount($query_count); foreach ($sickess as $key => $value) { $list[$key]['sickness_name'] = $value['name']; $list[$key]['symptom'] = ['name' => '临床表现' , 'text' => $value['clinicalFeature'] ?? '', 'active' => true]; $list[$key]['pathogenesis'] = ['name' => '病因' , 'text' => $value['pathogenesis'] ?? '', 'active' => false]; $list[$key]['complicationsOverview'] = ['name' => '并发症' , 'text' => $value['complicationsOverview'] ?? '' , 'active' => false]; $list[$key]['inspection'] = ['name' => '辅助检查' , 'text' => $value['auxiliaryExamination'] ?? '' , 'active' => false]; $list[$key]['treatmenCommonSense'] = ['name' => '治疗' , 'text' => $value['treatment'] ?? '', 'active' => false]; $list[$key]['diagnostiCtriage'] = ['name' => '诊断' , 'text' => $value['diagnosis'] ?? '', 'active' => false]; } break; case "medicine": $query = "match(n:MedicineProduction) return n.name as name , n.pinyin as pinyin , n.usageDosage as usageDosage , n.notes as notes , n.periodValidity as periodValidity , n.indication as indication , n.storage as storage , n.character as character , n.approvalNumber as approvalNumber , n.productionEnterprise as productionEnterprise , n.relateSick as relateSick , n.untowardEffect as untowardEffect , n.majorConstituent as majorConstituent skip $limit limit 20"; $data = $this->getAboutInfo($query); $query_count = "match(n:MedicineProduction) return count(n) as count"; $count = $this->getTotalCount($query_count); foreach ($data as $key => $value) { $list[$key]['sickness_name'] = $value['name']; $list[$key]['pinyi'] = ['name' => '汉语拼音' , 'text' => $value['pinyin'] , 'active' => false]; $list[$key]['usageDosage'] = ['name' => '用法用量' , 'text' => $value['usageDosage'] , 'active' => false]; $list[$key]['notes'] = ['name' => '注意事项' , 'text' => $value['notes'] , 'active' => false]; $list[$key]['periodValidity'] = ['name' => '有效期' , 'text' => $value['periodValidity'], 'active' => false]; $list[$key]['indication'] = ['name' => '适应症' , 'text' => $value['indication'], 'active' => false]; $list[$key]['storage'] = ['name' => '贮藏' , 'text' => $value['storage'], 'active' => false]; $list[$key]['character'] = ['name' => '性状' , 'text' => $value['character'], 'active' => false]; $list[$key]['approvalNumber'] = ['name' => '批准号' , 'text' => $value['approvalNumber'], 'active' => false]; $list[$key]['productionEnterprise'] = ['name' => '生产企业' , 'text' => $value['productionEnterprise'], 'active' => false]; $list[$key]['relateSick'] = ['name' => '相关疾病' , 'text' => $value['relateSick'], 'active' => false]; $list[$key]['untowardEffect'] = ['name' => '不良反应' , 'text' => $value['untowardEffect'], 'active' => false]; $list[$key]['majorConstituent'] = ['name' => '主要成分' , 'text' => $value['majorConstituent'], 'active' => true]; } break; case "inspection": $query = "match (n:Inspection) return n.name as name , n.annotation as annotation , n.principle as principle , n.normalValue as normalValue , n.clinicalSignificance as clinicalSignificance , n.reagent as reagent , n.operation as operation skip $limit limit 20"; $data = $this->getAboutInfo($query); $query_count = "match (n:Inspection) return count(n) as count"; $count = $this->getTotalCount($query_count); foreach ($data as $key => $value) { $list[$key]['sickness_name'] = $value['name']; $list[$key]['annotation'] = ['name' => '附注' , 'text' => $value['annotation'] ?? '' , 'active' => true]; $list[$key]['principle'] = ['name' => '根源' , 'text' => $value['principle'] ?? '' , 'active' => false]; $list[$key]['normalValue'] = ['name' => '正常值' , 'text' => $value['normalValue'] ?? '' , 'active' => false]; $list[$key]['clinicalSignificance'] = ['name' => '临床意义' , 'text' => $value['clinicalSignificance'] ?? '' , 'active' => false]; $list[$key]['reagent'] = ['name' => '试剂' , 'text' => $value['reagent'] ?? '' , 'active' => false]; $list[$key]['operation'] = ['name' => '操作方法' , 'text' => $value['operation'] ?? '' , 'active' => false]; } break; case "zysickness": $query = "match (n:SickNess {name:"."'".$department."'"."}) return n skip $limit limit 20"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $query_count = "match (n:SickNess {name:"."'".$department."'"."}) return count(n) as count"; $count = $this->getTotalCount($query_count , 'zy'); foreach ($data as $key => $value) { $list[$key]['sickness_name'] = $value['dialecticalName']; //$list[$key]['name'] = ['name' => '疾病名称' , 'text' => $value['name'] ?? '' , 'active' => false]; $list[$key]['symptom'] = ['name' => '症见' , 'text' => $value['symptom'] ?? '' , 'active' => true]; $list[$key]['apparatus'] = ['name' => '发病部位' , 'text' => $value['apparatus'] ?? '' , 'active' => false]; $list[$key]['dialecticalName'] = ['name' => '证型' , 'text' => $value['dialecticalName'] ?? '' , 'active' => false]; $list[$key]['tongueCondition'] = ['name' => '舌象' , 'text' => $value['tongueCondition'] ?? '' , 'active' => false]; $list[$key]['pulseCondition'] = ['name' => '脉象' , 'text' => $value['pulseCondition'] ?? '' , 'active' => false]; $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false]; $list[$key]['therapeuticMethod'] = ['name' => '治法原则' , 'text' => $value['therapeuticMethod'] ?? '' , 'active' => false]; $list[$key]['cnPatentMedicine'] = ['name' => '中成药' , 'text' => $value['cnPatentMedicine'] ?? '' , 'active' => false]; $list[$key]['dietTherapy'] = ['name' => '中医食疗法' , 'text' => $value['dietTherapy'] ?? '' , 'active' => false]; $list[$key]['tonicDiet'] = ['name' => '中医药膳' , 'text' => $value['tonicDiet'] ?? '' , 'active' => false]; $list[$key]['acupuncturePoints'] = ['name' => '针灸穴位' , 'text' => $value['acupuncturePoints'] ?? '' , 'active' => false]; $list[$key]['kgid'] = ['name' => 'kgid' , 'text' => $value['kgid'] ?? '' , 'active' => false]; } break; case "icd10": $query = "match (n:SickNess {ICD10:"."'".$department."'"."}) return n skip $limit limit 20"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $query_count = "match (n:SickNess {name:"."'".$department."'"."}) return count(n) as count"; $count = $this->getTotalCount($query_count , 'zy'); foreach ($data as $key => $value) { $list[$key]['sickness_name'] = $value['dialecticalName']; //$list[$key]['name'] = ['name' => '疾病名称' , 'text' => $value['name'] ?? '' , 'active' => false]; $list[$key]['symptom'] = ['name' => '症见' , 'text' => $value['symptom'] ?? '' , 'active' => true]; $list[$key]['apparatus'] = ['name' => '发病部位' , 'text' => $value['apparatus'] ?? '' , 'active' => false]; $list[$key]['dialecticalName'] = ['name' => '证型' , 'text' => $value['dialecticalName'] ?? '' , 'active' => false]; $list[$key]['tongueCondition'] = ['name' => '舌象' , 'text' => $value['tongueCondition'] ?? '' , 'active' => false]; $list[$key]['pulseCondition'] = ['name' => '脉象' , 'text' => $value['pulseCondition'] ?? '' , 'active' => false]; $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false]; $list[$key]['therapeuticMethod'] = ['name' => '治法原则' , 'text' => $value['therapeuticMethod'] ?? '' , 'active' => false]; $list[$key]['cnPatentMedicine'] = ['name' => '中成药' , 'text' => $value['cnPatentMedicine'] ?? '' , 'active' => false]; $list[$key]['dietTherapy'] = ['name' => '中医食疗法' , 'text' => $value['dietTherapy'] ?? '' , 'active' => false]; $list[$key]['tonicDiet'] = ['name' => '中医药膳' , 'text' => $value['tonicDiet'] ?? '' , 'active' => false]; $list[$key]['acupuncturePoints'] = ['name' => '针灸穴位' , 'text' => $value['acupuncturePoints'] ?? '' , 'active' => false]; $list[$key]['kgid'] = ['name' => 'kgid' , 'text' => $value['kgid'] ?? '' , 'active' => false]; } break; case "zcy": $query = "match(n:CnPatentMedicine {classification:"."'".$department."'"."}) return n skip $limit limit 20"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $query_count = "match(n:CnPatentMedicine {classification:"."'".$department."'"."}) return count(n) as count"; $count = $this->getTotalCount($query_count , 'zy'); $list = []; foreach ($data as $key => $value) { $list[$key]['name'] = $value['name']; $list[$key]['classification'] = ['name' => '实体值' , 'text' => $value['classification'] ?? '' , 'active' => true]; $list[$key]['efficacy'] = ['name' => '功效' , 'text' => $value['efficacy'] ?? '' , 'active' => false]; $list[$key]['indications'] = ['name' => '主治' , 'text' => $value['indications'] ?? '' , 'active' => false]; $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false]; } break; case "jl": $query = "match(n:ChannelCollateral {name:"."'".$department."'"."}) return n skip $limit limit 20"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $query_count = "match(n:ChannelCollateral {name:"."'".$department."'"."}) return count(n) as count"; $count = $this->getTotalCount($query_count , 'zy'); $list = []; foreach ($data as $key => $value) { $list[$key]['name'] = $value['name']; $list[$key]['indications'] = ['name' => '主治' , 'text' => $value['aponeuroticSystem'] ?? '' , 'active' => true]; $list[$key]['channelSymptom'] = ['name' => '经脉循行及其病候' , 'text' => $value['channelSymptom'] ?? '' , 'active' => false]; $list[$key]['collateralSymptom'] = ['name' => '络脉循行及其病候' , 'text' => $value['collateralSymptom'] ?? '' , 'active' => false]; $list[$key]['divergentMeridian'] = ['name' => '经别循行' , 'text' => $value['divergentMeridian'] ?? '' , 'active' => false]; $list[$key]['aponeuroticSystem'] = ['name' => '经筋循行及其病候' , 'text' => $value['aponeuroticSystem'] ?? '' , 'active' => false]; $list[$key]['clinicalFeature'] = ['name' => '经络症状主要临床表现' , 'text' => $value['clinicalFeature'] ?? '' , 'active' => false]; $list[$key]['mechanismAnalysis'] = ['name' => '经络病机分析' , 'text' => $value['mechanismAnalysis'] ?? '' , 'active' => false]; $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false]; $list[$key]['kgid'] = ['name' => 'kgid' , 'text' => $value['kgid'] ?? '' , 'active' => false]; } break; case "symptom": $query = "match(n:Thing)-[r:LinkLocation]-(m:Symptom) where n.name="."'".$department."'"." return m skip $limit limit $pagesize"; $data = $this->getAboutInfo($query); $data = array_column($data , 'm'); $query_count = "match(n:Thing)-[r:LinkLocation]-(m:Symptom) where n.name="."'".$department."'"." return count(m) as count"; $count = $this->getTotalCount($query_count); $list = []; foreach ($data as $key => $value) { $list[$key]['sickness_name'] = $value['name']; $list[$key]['identify'] = ['name' => '识别' , 'text' => $value['identify'] ?? '' , 'active' => true]; $list[$key]['abstract'] = ['name' => '摘要' , 'text' => $value['abstract'] ?? '' , 'active' => false]; $list[$key]['precaution'] = ['name' => '预防措施' , 'text' => $value['precaution'] ?? '' , 'active' => false]; $list[$key]['inspection'] = ['name' => '检查' , 'text' => $value['inspection'] ?? '' , 'active' => false]; $list[$key]['etiology'] = ['name' => '病理' , 'text' => $value['etiology'] ?? '' , 'active' => false]; $list[$key]['department'] = ['name' => '科室' , 'text' => $value['department'] ?? '' , 'active' => false]; } break; case "identify": $query = "match (n:Disease) where n.antidiastole is not null return n.name as name , n.antidiastole as antidiastole skip $limit limit 20"; $data = $this->getAboutInfo($query); $query_count = "match (n:Disease) return count(n) as count"; $count = $this->getTotalCount($query_count); foreach ($data as $key => $value) { $list[$key]['sickness_name'] = $value['name']; $list[$key]['antidiastole'] = ['name' => '鉴别诊断' , 'text' => $value['antidiastole'] ?? '' , 'active' => true]; } break; case "clinicalPathway": $like = Request::param('like_name') ?? ''; if($like) { $ClinicalPathway = ClinicalPathway::where("clinical_pathway" , "like" , "%$like%" )->limit($limit , $pagesize)->select(); $count = ClinicalPathway::where("clinical_pathway" , "like" , "%$like%" )->count(); } else { $ClinicalPathway = ClinicalPathway::limit($limit , $pagesize)->select(); $count = ClinicalPathway::count(); } foreach ($ClinicalPathway as $key => $value) { $ClinicalPathway[$key]['file'] = $this->checkDocPdfIsExist('https://zskweb.jiankangche.cn/lcfiles/pdf2/lcpdf/lc/'.$value['clinical_pathway'].'.pdf'); } return $this->_json_succ(['list' => $ClinicalPathway , 'count' => $count]); break; case "clinicTrial": $like = Request::param('like_name') ?? ''; if($like) { $ClinicalTrial = ClinicalTrial::where("drug_name" , "like" , "%$like%" ) ->whereOr("adaptation_disease" , "like" , "%$like%" ) ->whereOr("experimental_popular_topic" , "like" , "%$like%" ) ->limit($limit , $pagesize)->select(); $count = ClinicalTrial::where("drug_name" , "like" , "%$like%" )->count(); } else { $ClinicalTrial = ClinicalTrial::limit($limit , $pagesize)->select(); $count = ClinicalTrial::count(); } foreach ($ClinicalTrial as $key => $value) { $ClinicalTrial[$key]['file'] = $this->checkDocPdfIsExist('https://zskweb.jiankangche.cn/lcfiles/pdf2/docs/'.$value['register_number'].'.pdf'); } return $this->_json_succ(['list' => $ClinicalTrial , 'count' => $count]); break; default: return $this->_json_error('请求有误!'); break; } return $this->_json_succ(['list' => $list , 'count' => $count]); } private function checkDocPdfIsExist($url) { $check = get_headers($url); if(strstr($check[0] , '200')) { return $url; } return ""; } private function getSicknessComplication($name , $tag) { $querydisease = "match p = (n:Disease)-[r:DiseaseComplication]->(m:Thing) where n.name= "."'".$name."'"." return p"; $querysickness = "match p = (n:SickNess)-[r:SicknessComplication]->(m:Thing) where n.name= "."'".$name."'"." return p"; $query = $tag == 'sickness' ? $querysickness : $querydisease; $result = $this->getComplication($query); if(!empty($result)) { foreach ($result as $key => $value) { if($name == $value['properties']) { unset($result[$key]); } } $complications = array_column($result , 'properties') ?? ''; return ['name' => $complications , 'tag' => $tag]; } else { return $complications = []; } } private function getZyRelationship($kgid , $tag) { $name = $kgid ?? '4d839135f8627092b95602acf6dbb5237fadab9419bc88f2199ad7fe2d90ae31'; switch ($tag) { case "fj": $query = "match p = (n:SickNess)-[r:LinkPrescription]->(m:Thing) where n.kgid= "."'".$name."'"." return p"; break; case "ys": $query = "match p = (n:SickNess)-[r:LinkTonicDiet]->(m:Thing) where n.kgid= "."'".$name."'"." return p"; break; case "zcy": $query = "match p = (n:SickNess)-[r:LinkCnPatentMedicine]->(m:Thing) where n.kgid= "."'".$name."'"." return p"; break; } $result = $this->getComplication($query , 'zy'); $arr = array_column($result , 'properties') ?? ''; if(empty($arr)) { return ''; } return ['name' => $arr , 'tag' => $tag]; } // 详情 public function sickNessDetail() { //if(!$this->checkIslogin()) return $this->_json_error('请登录后查看!'); $sickness = Request::param('sickness'); $tag = Request::param('tag') ?? 'sickness'; switch ($tag) { case "sickness": $query = "match(n:SickNess{name:"."'".$sickness."'"."})-[r:LInkeMedicineSickness]-(m:Medicine) return m.name as name limit 10"; $medicine = $this->getAboutInfo($query); if($medicine) { $medicine = array_column($medicine , 'name'); //$medicine = join(',' , $medicine); $medicine = ['name' => $medicine , 'tag' => 'medicine']; } $query_1 = "match(n:SickNess{name : "."'".$sickness."'"."}) return n"; $info = array_column($this->getAboutInfo($query_1) , 'n'); $data = [ 'sickness_name' => ['name' => '名称' , 'text' => $info[0]['name'] ??''], 'alias' => ['name' => '疾病别名' , 'text' => $info[0]['alias'] ?? ''], 'ICD10' => ['name' => 'ICD10' , 'text' => $info[0]['ICD10'] ?? ''], 'department' => ['name' => '疾病类别' , 'text' => $info[0]['department'] ?? ''], 'complication' => ['name' => '并发症' , 'text' => $this->getSicknessComplication($sickness , 'sickness') ?? ''], 'medicine' => ['name' => '相关药品' , 'text' => $medicine ?? ''] , 'introduction' => ['name' => '疾病概述' , 'text' => $info[0]['introduction'] ?? ''], 'epidemiology' => ['name' => '流行病学' , 'text' => $info[0]['epidemiology'] ?? ''], 'suitableFood' => ['name' => '宜吃食物' , 'text' => $info[0]['suitableFood'] ?? ''], 'notEat' => ['name' => '忌吃食物' , 'text' => $info[0]['notEat'] ?? ''], 'diagnostiCtriage' => ['name' => '诊断鉴别' , 'text' => $info[0]['diagnostiCtriage'] ?? ''], 'precaution' => ['name' => '预防' , 'text' => $info[0]['precaution'] ?? ''], 'nursingInfo' => ['name' => '护理信息' , 'text' => $info[0]['nursingInfo'] ?? ''], 'warmPrompt' => ['name' => '温馨提示' , 'text' => $info[0]['warmPrompt'] ?? ''], 'recommendedRecipe' => ['name' => '推荐食谱' , 'text' => $info[0]['recommendedRecipe'] ?? ''], 'treatmentOverview' => ['name' => '治疗概述' , 'text' => $info[0]['treatmentOverview'] ?? ''], 'inspection' => ['name' => '检查' , 'text' => $info[0]['inspection'] ?? ''], 'treatmenCommonSense' => ['name' => '治疗常识' , 'text' => $info[0]['treatmenCommonSense'] ?? ''], 'pathogenesis' => ['name' => '病因' , 'text' => $info[0]['pathogenesis'] ?? ''], 'basicKnowledgel' => ['name' => '基本常识' , 'text' => $info[0]['basicKnowledgel'] ?? ''], 'dietHealth' => ['name' => '饮食保健' , 'text' => $info[0]['dietHealth'] ?? ''], 'symptom' => ['name' => '证型' , 'text' => $info[0]['symptom'] ?? ''], 'complicationsOverview' => ['name' => '并发症概述', 'text' => $info[0]['complicationsOverview'] ?? ''], 'treatmentInfo' => ['name' => '治疗信息' , 'text' => $info[0]['treatmentInfo'] ?? ''], ]; break; case "disease": $query = "match(n:Disease{name : "."'".$sickness."'"."}) return n"; $info = array_column($this->getAboutInfo($query) , 'n'); $query1 = "match(n:Thing)-[r:LinkMedicineDisease]-(m:Disease {name:"."'".$sickness."'"."}) return n.name as name limit 10"; $medicine = $this->getAboutInfo($query1) ?? ''; if($medicine) { $medicine = array_column($medicine , 'name'); $medicine = ['name' => $medicine , 'tag' => 'medicine']; } $query2 = "match (n:Disease)-[r:LinkInspection]-(m:Thing) where n.name= "."'".$sickness."'"." return m.name as name limit 10"; $inspection = $this->getAboutInfo($query2) ?? ''; if($inspection) { $inspection = array_column($inspection , 'name'); $inspection = ['name' => $inspection , 'tag' => 'inspection']; } $data = [ 'sickness_name' => ['name' => '名称' , 'text' => $info[0]['name'] ??''], 'alias' => ['name' => '疾病别名' , 'text' => $info[0]['alias'] ?? ''], 'icd' => ['name' => 'ICD号' , 'text' => $info[0]['icd'] ?? ''], 'department' => ['name' => '疾病类别' , 'text' => $info[0]['department'] ?? ''], 'complication' => ['name' => '并发症' , 'text' => $this->getSicknessComplication($sickness , 'disease') ?? ''], 'epidemiology' => ['name' => '流行病学' , 'text' => $info[0]['epidemiology'] ?? ''], 'nameEn' => ['name' => '英文名称' , 'text' => $info[0]['nameEn'] ?? ''], 'sickOverview' => ['name' => '疾病概述' , 'text' => $info[0]['sickOverview'] ?? ''], 'clinicalFeature' => ['name' => '临床表现' , 'text' => $info[0]['clinicalFeature'] ?? ''], 'diagnosis' => ['name' => '诊断' , 'text' => $info[0]['diagnosis'] ?? ''], 'treatment' => ['name' => '治疗' , 'text' => $info[0]['treatment'] ?? ''], 'regularMedication' => ['name' => '相关药品' , 'text' => $medicine ?? []], 'pathogenesis' => ['name' => '发病机制' , 'text' => $info[0]['pathogenesis'] ?? ''], 'inspection' => ['name' => '相关检查' , 'text' => $inspection ?? []], 'laboratoryInspection' => ['name' => '实验室检查' , 'text' => $info[0]['laboratoryInspection'] ?? ''], 'etiology' => ['name' => '病因' , 'text' => $info[0]['etiology'] ?? ''], 'auxiliaryExamination' => ['name' => '其他辅助检查' , 'text' => $info[0]['auxiliaryExamination'] ?? ''], 'prognosis' => ['name' => '预后' , 'text' => $info[0]['prognosis'] ?? ''], 'complicationsOverview' => ['name' => '并发症概述' , 'text' => $info[0]['complicationsOverview'] ?? ''], 'precaution' => ['name' => '预防' , 'text' => $info[0]['precaution'] ?? ''], ]; break; case "medicine": $query = "match(n:MedicineProduction {name : "."'".$sickness."'"."}) return n"; $data = array_column($this->getAboutInfo($query) , 'n'); $data = [ 'sickness_name' => ['name' => '名称' , 'text' => $data[0]['name'] ??''], 'pinyi' => ['name' => '汉语拼音' , 'text' => $data[0]['pinyin'] ?? ''], 'oldUse' => ['name' => '老人用药' , 'text' => $data[0]['oldUse'] ?? ''], 'chilldUse' => ['name' => '儿童用药' , 'text' => $data[0]['chilldUse'] ?? ''], 'medicinePregnant' => ['name' => '孕妇及哺乳期妇女用药' , 'text' => $data[0]['medicinePregnant'] ?? ''], 'usageDosage' => ['name' => '用法用量' , 'text' => $data[0]['usageDosage'] ?? ''], 'notes' => ['name' => '注意事项' , 'text' => $data[0]['notes'] ?? ''], 'periodValidity' => ['name' => '有效期' , 'text' => $data[0]['periodValidity'] ?? ''], 'indication' => ['name' => '适应症' , 'text' => $data[0]['indication'] ?? ''], 'storage' => ['name' => '贮藏' , 'text' => $data[0]['storage'] ?? ''], 'character' => ['name' => '性状' , 'text' => $data[0]['character'] ?? ''], 'contraindication' => ['name' => '禁忌' , 'text' => $data[0]['contraindication'] ?? ''], 'pharmacologyToxicology'=> ['name' => '药理毒理' , 'text' => $data[0]['pharmacologyToxicology'] ?? ''], 'specification' => ['name' => '规格' , 'text' => $data[0]['specification'] ?? ''], 'approvalNumber' => ['name' => '批准号' , 'text' => $data[0]['approvalNumber'] ?? ''], 'productionEnterprise' => ['name' => '生产企业' , 'text' => $data[0]['productionEnterprise'] ?? ''], 'relateSick' => ['name' => '相关疾病' , 'text' => $data[0]['relateSick'] ?? ''], 'untowardEffect' => ['name' => '不良反应' , 'text' => $data[0]['untowardEffect'] ?? ''], 'majorConstituent' => ['name' => '主要成分' , 'text' => $data[0]['majorConstituent'] ?? ''], ]; break; case "inspection": $query = "match (n:Inspection {name : "."'".$sickness."'"."}) return n"; $data = array_column($this->getAboutInfo($query) , 'n'); $data = [ 'sickness_name' => ['name' => '名称' , 'text' => $data[0]['name'] ?? ''], 'overview' => ['name' => '概述' , 'text' => $data[0]['overview'] ?? ''], 'annotation' => ['name' => '附注' , 'text' => $data[0]['annotation'] ?? ''], 'principle' => ['name' => '原理' , 'text' => $data[0]['principle'] ?? ''], 'normalValue' => ['name' => '正常值' , 'text' => $data[0]['normalValue'] ?? ''], 'clinicalSignificance' => ['name' => '临床意义' , 'text' => $data[0]['clinicalSignificance'] ?? ''], 'reagent' => ['name' => '试剂' , 'text' => $data[0]['reagent'] ?? ''], 'operation' => ['name' => '操作方法' , 'text' => $data[0]['operation'] ?? ''], ]; break; case "zysickness": case "icd10": $query = "match(n:SickNess {kgid:"."'".$sickness."'"."}) return n"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $data = [ 'dialecticalName' => ['name' => '证型' , 'text' => $data[0]['dialecticalName'] ?? ''], 'ICD10' => ['name' => 'ICD10' , 'text' => $data[0]['ICD10'] ?? ''], 'sickness_name' => ['name' => '名称' , 'text' => $data[0]['name'] ?? ''], 'fj' => ['name' => '方剂' , 'text' => $this->getZyRelationship($data[0]['kgid'] , 'fj') ?? ''], 'ys' => ['name' => '药膳' , 'text' => $this->getZyRelationship($data[0]['kgid'] , 'ys') ?? ''], 'zcy' => ['name' => '中成药' , 'text' => $this->getZyRelationship($data[0]['kgid'] , 'zcy') ?? ''], 'tongueCondition' => ['name' => '舌象' , 'text' => $data[0]['tongueCondition'] ?? ''], 'apparatus' => ['name' => '发病部位' , 'text' => $data[0]['apparatus'] ?? ''], 'source' => ['name' => '数据来源' , 'text' => $data[0]['source'] ?? ''], 'pulseCondition' => ['name' => '脉象' , 'text' => $data[0]['pulseCondition'] ?? ''], 'dietTherapy' => ['name' => '饮食疗法' , 'text' => $data[0]['dietTherapy'] ?? ''], 'symptom' => ['name' => '症见' , 'text' => $data[0]['symptom'] ?? ''], 'department' => ['name' => '科室' , 'text' => $data[0]['department'] ?? ''], 'acupuncturePoints' => ['name' => '针灸穴位' , 'text' => $data[0]['acupuncturePoints'] ?? ''], 'therapeuticMethod' => ['name' => '治疗方法' , 'text' => $data[0]['therapeuticMethod'] ?? ''], 'kgid' => ['name' => 'kgid' , 'text' => $data[0]['kgid'] ?? ''], ]; break; case "zy": // 中药详情 $query = "match(n:CnMedicinalCrop {kgid:"."'".$sickness."'"."}) return n"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $data = [ 'sickness_name' => ['name' => '名称' , 'text' => $data[0]['name'] ?? ''], 'toxicity' => ['name' => '毒性' , 'text' => $data[0]['toxicity'] ?? ''], 'indications' => ['name' => '功能主治' , 'text' => $data[0]['indications'] ?? ''], 'source' => ['name' => '来源' , 'text' => $data[0]['source'] ?? ''], 'medicineProperty' => ['name' => '药理作用' , 'text' => $data[0]['medicineProperty'] ?? ''], 'includedIn' => ['name' => '收录于' , 'text' => $data[0]['includedIn'] ?? ''], 'kgid' => ['name' => 'kgid' , 'text' => $data[0]['kgid'] ?? ''], ]; break; case "zcy": $query = "match(n:CnPatentMedicine {name:"."'".$sickness."'"."}) return n"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $data = [ 'sickness_name' => ['name' => '名称' , 'text' => $data[0]['name'] ?? ''], 'classification' => ['name' => '分类' , 'text' => $data[0]['classification'] ?? ''], 'efficacy' => ['name' => '功效' , 'text' => $data[0]['efficacy'] ?? ''], 'indications' => ['name' => '主治' , 'text' => $data[0]['indications'] ?? ''], 'source' => ['name' => '数据来源' , 'text' => $data[0]['source'] ?? ''], ]; break; case "fj": $query = "match(n:Prescription {name:"."'".$sickness."'"."}) return n"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $data = [ 'sickness_name' => ['name' => '名称' , 'text' => $data[0]['name'] ?? ''], 'composition' => ['name' => '方剂组成' , 'text' => $data[0]['composition'] ?? ''], 'medicinalCrop' => ['name' => '中药' , 'text' => $data[0]['medicinalCrop'] ?? ''], 'indications' => ['name' => '主治' , 'text' => $data[0]['indications'] ?? ''], 'solution' => ['name' => '方法/解法' , 'text' => $data[0]['solution'] ?? ''], 'usageDosage' => ['name' => '用法用量' , 'text' => $data[0]['usageDosage'] ?? ''], 'source' => ['name' => '数据来源' , 'text' => $data[0]['source'] ?? ''], ]; break; case "ys": // 中医药膳 $query = "match(n:TonicDiet {name:"."'".$sickness."'"."}) return n"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); // 获取药膳对应疾病 LinkTonicDiet $query1 = "match(n:Thing{name:"."'".$sickness."'"."})-[r:LinkTonicDiet]-(m:SickNess) return m.name as name , m.kgid as kgid limit 10"; $getSicknessByLinkTonicDiet = $this->getAboutInfo($query1 , 'zy'); foreach ($getSicknessByLinkTonicDiet as $key => $value) { $getSicknessByLinkTonicDiet[$key]['name'] = $getSicknessByLinkTonicDiet[$key]['name'].'-'. $getSicknessByLinkTonicDiet[$key]['kgid']; } if($getSicknessByLinkTonicDiet) { $sickNesss = array_column($getSicknessByLinkTonicDiet , 'name'); foreach ($sickNesss as $k => $v) { $array = explode('-' , $v); $sickNessses[] = ['name' => $array[0] , 'kgid' => $array[1]]; } $sickNesss = ['name' => $sickNessses , 'tag' => 'zysickness']; } else { $sickNesss = []; } $data = [ 'sickness_name' => ['name' => '名称' , 'text' => $data[0]['name'] ?? ''], 'composition' => ['name' => '药膳组成' , 'text' => $data[0]['composition'] ?? ''], 'sickness' => ['name' => '疾病' , 'text' => $sickNesss] ]; break; case 'tz': $query = "match(n:Constitution {name:"."'".$sickness."'"."}) return n"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $data = [ 'sickness_name' => ['name' => '名称' , 'text' => $data[0]['name'] ?? ''], 'overallFeature' => ['name' => '总体特征' , 'text' => $data[0]['overallFeature'] ?? ''], 'psychologicalFeature' => ['name' => '心理特征' , 'text' => $data[0]['psychologicalFeature'] ?? ''], 'commonPerformance' => ['name' => '常见表现' , 'text' => $data[0]['commonPerformance'] ?? ''], 'tendency' => ['name' => '发病倾向' , 'text' => $data[0]['tendency'] ?? ''], 'exercise' => ['name' => '体育锻炼' , 'text' => $data[0]['exercise'] ?? ''], 'meridianHealth' => ['name' => '经络保健' , 'text' => $data[0]['meridianHealth'] ?? ''], 'medicineRegimen' => ['name' => '药物养生' , 'text' => $data[0]['medicineRegimen'] ?? ''], 'dietTherapy' => ['name' => '宜食疗' , 'text' => $data[0]['dietTherapy'] ?? ''], 'notEat' => ['name' => '不宜吃' , 'text' => $data[0]['notEat'] ?? ''], ]; break; case 'jl': $query = "match(n:ChannelCollateral {kgid:"."'".$sickness."'"."}) return n"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $data = [ 'sickness_name' => ['name' => '经络' , 'text' => $data[0]['name'] ?? ''], 'indications' => ['name' => '主治' , 'text' => $data[0]['indications'] ?? ''], 'channelSymptom' => ['name' => '经脉循行及其病候' , 'text' => $data[0]['channelSymptom'] ?? ''], 'collateralSymptom' => ['name' => '络脉循行及其病候' , 'text' => $data[0]['collateralSymptom'] ?? ''], 'divergentMeridian' => ['name' => '经别循行' , 'text' => $data[0]['divergentMeridian'] ?? ''], 'aponeuroticSystem' => ['name' => '经筋循行及其病候' , 'text' => $data[0]['aponeuroticSystem'] ?? ''], 'clinicalFeature' => ['name' => '经络症状主要临床表现', 'text' => $data[0]['clinicalFeature'] ?? ''], 'mechanismAnalysis' => ['name' => '经络病机分析' , 'text' => $data[0]['mechanismAnalysis'] ?? ''], 'source' => ['name' => '数据来源' , 'text' => $data[0]['source'] ?? ''], ]; break; case 'xw': $query = "match(n:Acupoint {name:"."'".$sickness."'"."}) return n"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $data = [ 'sickness_name' => ['name' => '穴位' , 'text' => $data[0]['name'] ?? ''], 'location' => ['name' => '定位' , 'text' => $data[0]['location'] ?? ''], 'indications' => ['name' => '主治' , 'text' => $data[0]['indications'] ?? ''], 'compatibility' => ['name' => '配伍' , 'text' => $data[0]['compatibility'] ?? ''], 'acupuncture' => ['name' => '针灸法' , 'text' => $data[0]['acupuncture'] ?? ''], 'notions' => ['name' => '附注' , 'text' => $data[0]['notions'] ?? ''], ]; break; case "symptom": $query = "match(n:Symptom {name:"."'".$sickness."'"."}) return n"; $data = $this->getAboutInfo($query); $data = array_column($data , 'n'); // 医疗症状关系 $query1 = "match(n:Thing)-[r:LinkDiseaseSymptom]-(m:Disease) where n.name="."'".$sickness."'"." return m.name as name"; $data2 = $this->getAboutInfo($query1) ?? ''; if($data2) { $diseaseSymptoms = array_column($data2 , 'name'); $diseaseSymptoms = ['name' => $diseaseSymptoms , 'tag' => 'disease']; } $data = [ 'sickness_name' => ['name' => '名称' , 'text' => $data[0]['name'] ?? ''], 'identify' => ['name' => '识别' , 'text' => $data[0]['identify'] ?? ''], 'abstract' => ['name' => '摘要' , 'text' => $data[0]['abstract'] ?? ''], 'precaution' => ['name' => '预防措施' , 'text' => $data[0]['precaution'] ?? ''], 'inspection' => ['name' => '检查' , 'text' => $data[0]['inspection'] ?? ''], 'diseaseSymptoms' => ['name' => '症状疾病' , 'text' => $diseaseSymptoms ?? []], 'etiology' => ['name' => '病理' , 'text' => $data[0]['etiology'] ?? ''], 'department' => ['name' => '科室' , 'text' => $data[0]['department'] ?? ''], ]; break; } return $this->_json_succ($data); } // 详情图谱 public function detailGraph() { //if(!$this->checkIslogin()) return $this->_json_error('请登录后查看!'); $tag = Request::param('tag') ?? 'disease'; $name = Request::param('name') ?? '肠道革兰阴性杆菌脑膜炎'; switch ($tag) { case 'disease': $query = "match p = (n:Disease)-[r:DiseaseComplication]-(m:Thing) where n.name= "."'".$name."'"." return p"; $query1 = "match p1 = (n:Disease)-[r:LinkMedicineDisease]-(m:Thing) where n.name= "."'".$name."'"." return p1"; $query2 = "match p2 = (n:Disease)-[r:LinkInspection]-(m:Thing) where n.name= "."'".$name."'"." return p2"; $data = $this->getXyR($query , $query1 , $query2); $list = []; foreach ($data as $key => $value) { $list['icd'] = ['name' => 'ICD' , 'text' => $data[$key]['start']['properties']['icd'] ?? '']; $list['name'] = ['name' => '名称' , 'text' => $data[$key]['start']['properties']['name'] ?? '']; $list['alias'] = ['name' => '疾病别名' , 'text' => $data[$key]['start']['properties']['alias'] ?? '']; $list['department'] = ['name' => '疾病类别' , 'text' => $data[$key]['start']['properties']['department'] ?? '']; $list['complication'] = ['name' => '并发症' , 'text' => $data[$key]['start']['properties']['complication'] ?? '']; $list['epidemiology'] = ['name' => '流行病学' , 'text' => $data[$key]['start']['properties']['epidemiology'] ?? '']; $list['nameEn'] = ['name' => '英文名称' , 'text' => $data[$key]['start']['properties']['nameEn'] ?? '']; $list['sickOverview'] = ['name' => '疾病概述' , 'text' => $data[$key]['start']['properties']['sickOverview'] ?? '']; $list['clinicalFeature'] = ['name' => '临床表现' , 'text' => $data[$key]['start']['properties']['clinicalFeature'] ?? '']; $list['diagnosis'] = ['name' => '诊断' , 'text' => $data[$key]['start']['properties']['diagnosis'] ?? '']; $list['treatment'] = ['name' => '治疗' , 'text' => $data[$key]['start']['properties']['treatment'] ?? '']; $list['regularMedication'] = ['name' => '相关药品' , 'text' => $data[$key]['start']['properties']['regularMedication'] ?? '']; $list['pathogenesis'] = ['name' => '发病机制' , 'text' => $data[$key]['start']['properties']['pathogenesis'] ?? '']; $list['inspection'] = ['name' => '相关检查' , 'text' => $data[$key]['start']['properties']['inspection'] ?? '']; $list['laboratoryInspection'] = ['name' => '实验室检查' , 'text' => $data[$key]['start']['properties']['laboratoryInspection'] ?? '']; $list['etiology'] = ['name' => '病因' , 'text' => $data[$key]['start']['properties']['etiology'] ?? '']; $list['auxiliaryExamination'] = ['name' => '其他辅助检查' , 'text' => $data[$key]['start']['properties']['auxiliaryExamination'] ?? '']; $list['prognosis'] = ['name' => '预后' , 'text' => $data[$key]['start']['properties']['prognosis'] ?? '']; $list['complicationsOverview'] = ['name' => '并发症概述' , 'text' => $data[$key]['start']['properties']['complicationsOverview'] ?? '']; $list['precaution'] = ['name' => '预防' , 'text' => $data[$key]['start']['properties']['precaution'] ?? '']; $data[$key]['start']['properties'] = $list; $data[$key]['start']['tag'] = $tag; if($value['relationship']['type'] == 'DISEASECOMPLICATION') { $listEnd = [ 'name' => ['name' => '疾病名称' , 'text' => $data[$key]['end']['properties']['name']], ]; $data[$key]['end']['properties'] = $listEnd; $data[$key]['end']['tag'] = $tag; } if($value['relationship']['type'] == 'LINKMEDICINEDISEASE') { $listEnd = [ 'name' => ['name' => '名称' , 'text' =>$data[$key]['end']['properties']['name'] ?? ''], 'pinyi' => ['name' => '汉语拼音' , 'text' =>$data[$key]['end']['properties']['pinyin'] ?? ''], 'oldUse' => ['name' => '老人用药' , 'text' =>$data[$key]['end']['properties']['oldUse'] ?? ''], 'chilldUse' => ['name' => '儿童用药' , 'text' =>$data[$key]['end']['properties']['chilldUse'] ?? ''], 'medicinePregnant' => ['name' => '孕妇及哺乳期妇女用药' , 'text' =>$data[$key]['end']['properties']['medicinePregnant'] ?? ''], 'usageDosage' => ['name' => '用法用量' , 'text' =>$data[$key]['end']['properties']['usageDosage'] ?? ''], 'notes' => ['name' => '注意事项' , 'text' =>$data[$key]['end']['properties']['notes'] ?? ''], 'periodValidity' => ['name' => '有效期' , 'text' =>$data[$key]['end']['properties']['periodValidity'] ?? ''], 'indication' => ['name' => '适应症' , 'text' =>$data[$key]['end']['properties']['indication'] ?? ''], 'storage' => ['name' => '贮藏' , 'text' =>$data[$key]['end']['properties']['storage'] ?? ''], 'character' => ['name' => '性状' , 'text' =>$data[$key]['end']['properties']['character'] ?? ''], 'contraindication' => ['name' => '禁忌' , 'text' =>$data[$key]['end']['properties']['contraindication'] ?? ''], 'pharmacologyToxicology'=> ['name' => '药理毒理' , 'text' =>$data[$key]['end']['properties']['pharmacologyToxicology'] ?? ''], 'specification' => ['name' => '规格' , 'text' =>$data[$key]['end']['properties']['specification'] ?? ''], 'approvalNumber' => ['name' => '批准号' , 'text' =>$data[$key]['end']['properties']['approvalNumber'] ?? ''], 'productionEnterprise' => ['name' => '生产企业' , 'text' =>$data[$key]['end']['properties']['productionEnterprise'] ?? ''], 'relateSick' => ['name' => '相关疾病' , 'text' =>$data[$key]['end']['properties']['relateSick'] ?? ''], 'untowardEffect' => ['name' => '不良反应' , 'text' =>$data[$key]['end']['properties']['untowardEffect'] ?? ''], 'majorConstituent' => ['name' => '主要成分' , 'text' =>$data[$key]['end']['properties']['majorConstituent'] ?? ''], ]; $data[$key]['end']['properties'] = $listEnd; $data[$key]['end']['tag'] = 'medicine'; } if($value['relationship']['type'] == 'LINKINSPECTION') { $listEnd = [ 'name' => ['name' => '名称' , 'text' => $data[$key]['end']['properties']['name'] ?? ''], 'overview' => ['name' => '概述' , 'text' => $data[$key]['end']['properties']['overview'] ?? ''], 'annotation' => ['name' => '附注' , 'text' => $data[$key]['end']['properties']['annotation'] ?? ''], 'principle' => ['name' => '原理' , 'text' => $data[$key]['end']['properties']['principle'] ?? ''], 'normalValue' => ['name' => '正常值' , 'text' => $data[$key]['end']['properties']['normalValue'] ?? ''], 'clinicalSignificance' => ['name' => '临床意义' , 'text' => $data[$key]['end']['properties']['clinicalSignificance'] ?? ''], 'reagent' => ['name' => '试剂' , 'text' => $data[$key]['end']['properties']['reagent'] ?? ''], 'operation' => ['name' => '操作方法' , 'text' => $data[$key]['end']['properties']['operation'] ?? ''], ]; $data[$key]['end']['properties'] = $listEnd; $data[$key]['end']['tag'] = 'inspection'; } } break; case 'sickness': $query = "match p = (n:SickNess)-[r:SicknessComplication]-(m:Thing) where n.name= "."'".$name."'"." return p"; $query1 = "match p1 = (n:SickNess)-[r:LInkeMedicineSickness]-(m:Thing) where n.name= "."'".$name."'"." return p1"; $data = $this->getXyR($query , $query1); $list = []; foreach ($data as $key => $value) { $list['ICD10'] = ['name' => 'ICD10' , 'text' => $data[$key]['start']['properties']['ICD10'] ?? '']; $list['name'] = ['name' => '名称' , 'text' => $data[$key]['start']['properties']['name'] ?? '']; $list['alias'] = ['name' => '疾病别名' , 'text' => $data[$key]['start']['properties']['alias'] ?? '']; $list['department'] = ['name' => '疾病类别' , 'text' => $data[$key]['start']['properties']['department'] ?? '']; $list['complication'] = ['name' => '并发症' , 'text' => $data[$key]['start']['properties']['complication'] ?? '']; $list['introduction'] = ['name' => '疾病概述' , 'text' => $data[$key]['start']['properties']['introduction'] ?? '']; $list['epidemiology'] = ['name' => '流行病学' , 'text' => $data[$key]['start']['properties']['epidemiology'] ?? '']; $list['suitableFood'] = ['name' => '宜吃食物' , 'text' => $data[$key]['start']['properties']['suitableFood'] ?? '']; $list['notEat'] = ['name' => '忌吃食物' , 'text' => $data[$key]['start']['properties']['notEat'] ?? '']; $list['diagnostiCtriage'] = ['name' => '诊断鉴别' , 'text' => $data[$key]['start']['properties']['diagnostiCtriage'] ?? '']; $list['precaution'] = ['name' => '预防' , 'text' => $data[$key]['start']['properties']['precaution'] ?? '']; $list['nursingInfo'] = ['name' => '护理信息' , 'text' => $data[$key]['start']['properties']['nursingInfo'] ?? '']; $list['warmPrompt'] = ['name' => '温馨提示' , 'text' => $data[$key]['start']['properties']['warmPrompt'] ?? '']; $list['recommendedRecipe'] = ['name' => '推荐食谱' , 'text' => $data[$key]['start']['properties']['recommendedRecipe'] ?? '']; $list['treatmentOverview'] = ['name' => '治疗概述' , 'text' => $data[$key]['start']['properties']['treatmentOverview'] ?? '']; $list['inspection'] = ['name' => '检查' , 'text' => $data[$key]['start']['properties']['inspection'] ?? '']; $list['treatmenCommonSense'] = ['name' => '治疗常识' , 'text' => $data[$key]['start']['properties']['treatmenCommonSense'] ?? '']; $list['pathogenesis'] = ['name' => '病因' , 'text' => $data[$key]['start']['properties']['pathogenesis'] ?? '']; $list['basicKnowledgel'] = ['name' => '基本常识' , 'text' => $data[$key]['start']['properties']['basicKnowledgel'] ?? '']; $list['dietHealth'] = ['name' => '饮食保健' , 'text' => $data[$key]['start']['properties']['dietHealth'] ?? '']; $list['symptom'] = ['name' => '检查' , 'text' => $data[$key]['start']['properties']['symptom'] ?? '']; $list['complicationsOverview'] = ['name' => '并发症概述' , 'text' => $data[$key]['start']['properties']['complicationsOverview'] ?? '']; $list['treatmentInfo'] = ['name' => '治疗信息' , 'text' => $data[$key]['start']['properties']['treatmentInfo'] ?? '']; $data[$key]['start']['properties'] = $list; $data[$key]['start']['tag'] = $tag; if($data[$key]['relationship']['type'] == 'SICKNESSCOMPLICATION') { $listEnd['name'] = ['name' => '疾病名称' , 'text' => $data[$key]['end']['properties']['name']]; $data[$key]['end']['properties'] = $listEnd; $data[$key]['end']['tag'] = $tag; } if($data[$key]['relationship']['type'] == 'LINKEMEDICINESICKNESS') { $listEnd = [ 'name' => ['name' => '名称' , 'text' =>$data[$key]['end']['properties']['name'] ?? ''], 'pinyi' => ['name' => '汉语拼音' , 'text' =>$data[$key]['end']['properties']['pinyin'] ?? ''], 'oldUse' => ['name' => '老人用药' , 'text' =>$data[$key]['end']['properties']['oldUse'] ?? ''], 'chilldUse' => ['name' => '儿童用药' , 'text' =>$data[$key]['end']['properties']['chilldUse'] ?? ''], 'medicinePregnant' => ['name' => '孕妇及哺乳期妇女用药' , 'text' =>$data[$key]['end']['properties']['medicinePregnant'] ?? ''], 'usageDosage' => ['name' => '用法用量' , 'text' =>$data[$key]['end']['properties']['usageDosage'] ?? ''], 'notes' => ['name' => '注意事项' , 'text' =>$data[$key]['end']['properties']['notes'] ?? ''], 'periodValidity' => ['name' => '有效期' , 'text' =>$data[$key]['end']['properties']['periodValidity'] ?? ''], 'indication' => ['name' => '适应症' , 'text' =>$data[$key]['end']['properties']['indication'] ?? ''], 'storage' => ['name' => '贮藏' , 'text' =>$data[$key]['end']['properties']['storage'] ?? ''], 'character' => ['name' => '性状' , 'text' =>$data[$key]['end']['properties']['character'] ?? ''], 'contraindication' => ['name' => '禁忌' , 'text' =>$data[$key]['end']['properties']['contraindication'] ?? ''], 'pharmacologyToxicology'=> ['name' => '药理毒理' , 'text' =>$data[$key]['end']['properties']['pharmacologyToxicology'] ?? ''], 'specification' => ['name' => '规格' , 'text' =>$data[$key]['end']['properties']['specification'] ?? ''], 'approvalNumber' => ['name' => '批准号' , 'text' =>$data[$key]['end']['properties']['approvalNumber'] ?? ''], 'productionEnterprise' => ['name' => '生产企业' , 'text' =>$data[$key]['end']['properties']['productionEnterprise'] ?? ''], 'relateSick' => ['name' => '相关疾病' , 'text' =>$data[$key]['end']['properties']['relateSick'] ?? ''], 'untowardEffect' => ['name' => '不良反应' , 'text' =>$data[$key]['end']['properties']['untowardEffect'] ?? ''], 'majorConstituent' => ['name' => '主要成分' , 'text' =>$data[$key]['end']['properties']['majorConstituent'] ?? ''], ]; $data[$key]['end']['properties'] = $listEnd; $data[$key]['end']['tag'] = 'medicine'; } } break; case 'zysickness': case 'icd10': $query = "match p = (n:SickNess)-[r:LinkCnPatentMedicine]-(m:Thing) where n.kgid= "."'".$name."'"." return p"; $query1 = "match p1 = (n:SickNess)-[r:LinkConstitution]-(m:Thing) where n.kgid= "."'".$name."'"." return p1"; $query2 = "match p2 = (n:SickNess)-[r:LinkPrescription]-(m:Thing) where n.kgid= "."'".$name."'"." return p2"; $query3 = "match p3 = (n:SickNess)-[r:LinkTonicDiet]-(m:Thing) where n.kgid= "."'".$name."'"." return p3"; $data = $this->getZyR($query , $query1 , $query2 , $query3); if(empty($data) ) { $query = "match(n:SickNess) where n.kgid = "."'".$name."'"." return n;"; $data = $this->getSingle($query , 'zy'); $data1 = [ 'ICD10' => ['name' => 'ICD10' , 'text' => $data[0]['start']['properties']['ICD10'] ?? ''], 'name' => ['name' => '名称' , 'text' => $data[0]['start']['properties']['name'] ?? ''], 'tongueCondition' => ['name' => '舌象' , 'text' => $data[0]['start']['properties']['tongueCondition'] ?? ''], 'apparatus' => ['name' => '发病部位' , 'text' => $data[0]['start']['properties']['apparatus'] ?? ''], 'source' => ['name' => '数据来源' , 'text' => $data[0]['start']['properties']['source'] ?? ''], 'pulseCondition' => ['name' => '脉象' , 'text' => $data[0]['start']['properties']['pulseCondition'] ?? ''], 'dietTherapy' => ['name' => '饮食疗法' , 'text' => $data[0]['start']['properties']['dietTherapy'] ?? ''], 'symptom' => ['name' => '症见' , 'text' => $data[0]['start']['properties']['symptom'] ?? ''], 'department' => ['name' => '科室' , 'text' => $data[0]['start']['properties']['symptom'] ?? ''], 'acupuncturePoints' => ['name' => '针灸穴位' , 'text' => $data[0]['start']['properties']['department'] ?? ''], 'dialecticalName' => ['name' => '证型' , 'text' => $data[0]['start']['properties']['acupuncturePoints'] ?? ''], 'therapeuticMethod' => ['name' => '治疗方法' , 'text' => $data[0]['start']['properties']['dialecticalName'] ?? ''], ]; $data[0]['start']['properties'] = $data1; $data[0]['start']['tag'] = $tag; } else { $list = []; foreach ($data as $key => $value) { $list['ICD10'] = ['name' => 'ICD10' , 'text' => $data[$key]['start']['properties']['ICD10'] ?? '']; $list['name'] = ['name' => '名称' , 'text' => $data[$key]['start']['properties']['name'] ?? '']; $list['tongueCondition'] = ['name' => '舌象' , 'text' => $data[$key]['start']['properties']['tongueCondition'] ?? '']; $list['apparatus'] = ['name' => '发病部位' , 'text' => $data[$key]['start']['properties']['apparatus'] ?? '']; $list['source'] = ['name' => '数据来源' , 'text' => $data[$key]['start']['properties']['source'] ?? '']; $list['pulseCondition'] = ['name' => '脉象' , 'text' => $data[$key]['start']['properties']['pulseCondition'] ?? '']; $list['dietTherapy'] = ['name' => '饮食疗法' , 'text' => $data[$key]['start']['properties']['dietTherapy'] ?? '']; $list['symptom'] = ['name' => '症见' , 'text' => $data[$key]['start']['properties']['symptom'] ?? '']; $list['department'] = ['name' => '科室' , 'text' => $data[$key]['start']['properties']['department'] ?? '']; $list['acupuncturePoints'] = ['name' => '针灸穴位' , 'text' => $data[$key]['start']['properties']['acupuncturePoints'] ?? '']; $list['dialecticalName'] = ['name' => '证型' , 'text' => $data[$key]['start']['properties']['dialecticalName'] ?? '']; $list['therapeuticMethod'] = ['name' => '治疗方法' , 'text' => $data[$key]['start']['properties']['therapeuticMethod'] ?? '']; $data[$key]['start']['properties'] = $list; // 中成药关系 if($value['relationship']['type'] == 'LINKCNPATENTMEDICINE') { $listEnd = [ 'name' => ['name' => '名称' , 'text' => $data[$key]['end']['properties']['name'] ?? ''], 'classification' => ['name' => '分类' , 'text' => $data[$key]['end']['properties']['classification'] ?? ''], 'efficacy' => ['name' => '功效' , 'text' => $data[$key]['end']['properties']['efficacy'] ?? ''], 'indications' => ['name' => '主治' , 'text' => $data[$key]['end']['properties']['indications'] ?? ''], 'source' => ['name' => '数据来源' , 'text' => $data[$key]['end']['properties']['source'] ?? ''], ]; $data[$key]['end']['properties'] = $listEnd; $data[$key]['end']['tag'] = 'zcy'; } // 方剂关系 if($value['relationship']['type'] == 'LINKPRESCRIPTION') { $listEnd = [ 'name' => ['name' => '名称' , 'text' => $data[$key]['end']['properties']['name'] ?? ''], 'composition' => ['name' => '方剂组成' , 'text' => $data[$key]['end']['properties']['composition'] ?? ''], 'medicinalCrop' => ['name' => '中药' , 'text' => $data[$key]['end']['properties']['medicinalCrop'] ?? ''], 'indications' => ['name' => '主治' , 'text' => $data[$key]['end']['properties']['indications'] ?? ''], 'solution' => ['name' => '方法/解法' , 'text' => $data[$key]['end']['properties']['solution'] ?? ''], 'usageDosage' => ['name' => '用法用量' , 'text' => $data[$key]['end']['properties']['usageDosage'] ?? ''], 'source' => ['name' => '数据来源' , 'text' => $data[$key]['end']['properties']['source'] ?? ''], ]; $data[$key]['end']['properties'] = $listEnd; $data[$key]['end']['tag'] = 'fj'; } // 药膳关系 if($value['relationship']['type'] == 'LINKTONICDIET') { $listEnd = [ 'name' => ['name' => '名称' , 'text' => $data[$key]['end']['properties']['name'] ?? ''], 'composition' => ['name' => '药膳组成' , 'text' => $data[$key]['end']['properties']['composition'] ?? ''], ]; $data[$key]['end']['properties'] = $listEnd; $data[$key]['end']['tag'] = 'ys'; } // 体质关系LinkConstitution if($value['relationship']['type'] == 'LINKCONSTITUTION') { $listEnd = [ 'name' => ['name' => '名称' , 'text' => $data[$key]['end']['properties']['name'] ?? ''], 'overallFeature' => ['name' => '总体特征' , 'text' => $data[$key]['end']['properties']['overallFeature'] ?? ''], 'psychologicalFeature' => ['name' => '心理特征' , 'text' => $data[$key]['end']['properties']['psychologicalFeature'] ?? ''], 'commonPerformance' => ['name' => '常见表现' , 'text' => $data[$key]['end']['properties']['commonPerformance'] ?? ''], 'tendency' => ['name' => '发病倾向' , 'text' => $data[$key]['end']['properties']['tendency'] ?? ''], 'exercise' => ['name' => '体育锻炼' , 'text' => $data[$key]['end']['properties']['exercise'] ?? ''], 'meridianHealth' => ['name' => '经络保健' , 'text' => $data[$key]['end']['properties']['meridianHealth'] ?? ''], 'medicineRegimen' => ['name' => '药物养生' , 'text' => $data[$key]['end']['properties']['medicineRegimen'] ?? ''], 'dietTherapy' => ['name' => '宜食疗' , 'text' => $data[$key]['end']['properties']['dietTherapy'] ?? ''], 'notEat' => ['name' => '不宜吃' , 'text' => $data[$key]['end']['properties']['notEat'] ?? ''], ]; $data[$key]['end']['properties'] = $listEnd; $data[$key]['end']['tag'] = 'tj'; } } } break; case 'zy': // 中药详情图谱 $query = "match(n:CnMedicinalCrop {kgid:"."'".$name."'"."}) return n"; $data = $this->getSingle($query , 'zy'); $data1['name'] = ['name' => '名称' , 'text' => $data[0]['start']['properties']['name'] ?? '']; $data1['toxicity'] = ['name' => '毒性' , 'text' => $data[0]['start']['properties']['toxicity'] ?? '']; $data1['indications'] = ['name' => '功能主治' , 'text' => $data[0]['start']['properties']['indications'] ?? '']; $data1['source'] = ['name' => '来源' , 'text' => $data[0]['start']['properties']['source'] ?? '']; $data1['pharmacology'] = ['name' => '药理作用' , 'text' => $data[0]['start']['properties']['pharmacology'] ?? '']; $data1['includedIn'] = ['name' => '收录于' , 'text' => $data[0]['start']['properties']['includedIn'] ?? '']; $data[0]['start']['properties'] = $data1; $data[0]['start']['tag'] = 'zy'; break; case 'medicine': $query = "match(n:MedicineProduction {name:"."'".$name."'"."}) return n"; $data = $this->getSingle($query); $data1 = [ 'name' => ['name' => '名称' , 'text' =>$data[0]['start']['properties']['name'] ?? ''], 'pinyi' => ['name' => '汉语拼音' , 'text' =>$data[0]['start']['properties']['pinyin'] ?? ''], 'oldUse' => ['name' => '老人用药' , 'text' =>$data[0]['start']['properties']['oldUse'] ?? ''], 'chilldUse' => ['name' => '儿童用药' , 'text' =>$data[0]['start']['properties']['chilldUse'] ?? ''], 'medicinePregnant' => ['name' => '孕妇及哺乳期妇女用药' , 'text' =>$data[0]['start']['properties']['medicinePregnant'] ?? ''], 'usageDosage' => ['name' => '用法用量' , 'text' =>$data[0]['start']['properties']['usageDosage'] ?? ''], 'notes' => ['name' => '注意事项' , 'text' =>$data[0]['start']['properties']['notes'] ?? ''], 'periodValidity' => ['name' => '有效期' , 'text' =>$data[0]['start']['properties']['periodValidity'] ?? ''], 'indication' => ['name' => '适应症' , 'text' =>$data[0]['start']['properties']['indication'] ?? ''], 'storage' => ['name' => '贮藏' , 'text' =>$data[0]['start']['properties']['storage'] ?? ''], 'character' => ['name' => '性状' , 'text' =>$data[0]['start']['properties']['character'] ?? ''], 'contraindication' => ['name' => '禁忌' , 'text' =>$data[0]['start']['properties']['contraindication'] ?? ''], 'pharmacologyToxicology'=> ['name' => '药理毒理' , 'text' =>$data[0]['start']['properties']['pharmacologyToxicology'] ?? ''], 'specification' => ['name' => '规格' , 'text' =>$data[0]['start']['properties']['specification'] ?? ''], 'approvalNumber' => ['name' => '批准号' , 'text' =>$data[0]['start']['properties']['approvalNumber'] ?? ''], 'productionEnterprise' => ['name' => '生产企业' , 'text' =>$data[0]['start']['properties']['productionEnterprise'] ?? ''], 'relateSick' => ['name' => '相关疾病' , 'text' =>$data[0]['start']['properties']['relateSick'] ?? ''], 'untowardEffect' => ['name' => '不良反应' , 'text' =>$data[0]['start']['properties']['untowardEffect'] ?? ''], 'majorConstituent' => ['name' => '主要成分' , 'text' =>$data[0]['start']['properties']['majorConstituent'] ?? ''], ]; $data[0]['start']['properties'] = $data1; $data[0]['start']['tag'] = $tag; break; case 'inspection': $query = "match(n:Inspection {name:"."'".$name."'"."}) return n"; $data = $this->getSingle($query); $data1 = [ 'name' => ['name' => '名称' , 'text' => $data[0]['start']['properties']['name'] ?? ''], 'overview' => ['name' => '概述' , 'text' => $data[0]['start']['properties']['overview'] ?? ''], 'annotation' => ['name' => '附注' , 'text' => $data[0]['start']['properties']['annotation'] ?? ''], 'principle' => ['name' => '原理' , 'text' => $data[0]['start']['properties']['principle'] ?? ''], 'normalValue' => ['name' => '正常值' , 'text' => $data[0]['start']['properties']['normalValue'] ?? ''], 'clinicalSignificance' => ['name' => '临床表现' , 'text' => $data[0]['start']['properties']['clinicalSignificance'] ?? ''], 'reagent' => ['name' => '试剂' , 'text' => $data[0]['start']['properties']['reagent'] ?? ''], 'operation' => ['name' => '操作方法' , 'text' => $data[0]['start']['properties']['operation'] ?? ''], ]; $data[0]['start']['properties'] = $data1; $data[0]['start']['tag'] = $tag; break; case 'zcy': $query = "match(n:CnPatentMedicine {name:"."'".$name."'"."}) return n"; $data = $this->getSingle($query , 'zy'); $data1 = [ 'name' => ['name' => '名称' , 'text' => $data[0]['start']['properties']['name'] ?? ''], 'classification' => ['name' => '分类' , 'text' => $data[0]['start']['properties']['classification'] ?? ''], 'efficacy' => ['name' => '功效' , 'text' => $data[0]['start']['properties']['efficacy'] ?? ''], 'indications' => ['name' => '主治' , 'text' => $data[0]['start']['properties']['indications'] ?? ''], 'source' => ['name' => '数据来源' , 'text' => $data[0]['start']['properties']['source'] ?? ''], ]; $data[0]['start']['properties'] = $data1; $data[0]['start']['tag'] = $tag; break; case 'ys': // 中医药膳 [LinkTonicDiet 药膳关系 ] $query = "match p = (n:SickNess)-[r:LinkTonicDiet]-(m:Thing) where m.name= "."'".$name."'"." return p"; $data = $this->getZyR($query , '' , '' , ''); $dataTwo = $data; $list = []; foreach ($data as $key => $value) { $list['name'] = ['name' => '名称' , 'text' => $data[$key]['end']['properties']['name'] ?? '']; $list['composition'] = ['name' => '药膳组成' , 'text' => $data[$key]['end']['properties']['composition'] ?? '']; $listEnd['ICD10'] = ['name' => 'ICD10' , 'text' => $data[$key]['start']['properties']['ICD10'] ?? '']; $listEnd['name'] = ['name' => '名称' , 'text' => $data[$key]['start']['properties']['name'] ?? '']; $listEnd['tongueCondition'] = ['name' => '舌象' , 'text' => $data[$key]['start']['properties']['tongueCondition'] ?? '']; $listEnd['apparatus'] = ['name' => '发病部位' , 'text' => $data[$key]['start']['properties']['apparatus'] ?? '']; $listEnd['source'] = ['name' => '数据来源' , 'text' => $data[$key]['start']['properties']['source'] ?? '']; $listEnd['pulseCondition'] = ['name' => '脉象' , 'text' => $data[$key]['start']['properties']['pulseCondition'] ?? '']; $listEnd['dietTherapy'] = ['name' => '饮食疗法' , 'text' => $data[$key]['start']['properties']['dietTherapy'] ?? '']; $listEnd['symptom'] = ['name' => '症见' , 'text' => $data[$key]['start']['properties']['symptom'] ?? '']; $listEnd['department'] = ['name' => '科室' , 'text' => $data[$key]['start']['properties']['department'] ?? '']; $listEnd['acupuncturePoints'] = ['name' => '针灸穴位' , 'text' => $data[$key]['start']['properties']['acupuncturePoints'] ?? '']; $listEnd['dialecticalName'] = ['name' => '证型' , 'text' => $data[$key]['start']['properties']['dialecticalName'] ?? '']; $listEnd['therapeuticMethod'] = ['name' => '治疗方法' , 'text' => $data[$key]['start']['properties']['therapeuticMethod'] ?? '']; $listEnd['kgid'] = ['name' => 'kgid' , 'text' => $data[$key]['start']['properties']['kgid'] ?? '']; // 调换id $startIdentity = $data[$key]['end']['identity']; $endIdentity = $data[$key]['start']['identity']; $data[$key]['start']['properties'] = $list; $data[$key]['start']['tag'] = $tag; $data[$key]['start']['identity'] = $startIdentity; $data[$key]['end']['properties'] = $listEnd; $data[$key]['end']['tag'] = 'zysickness'; $data[$key]['end']['identity'] = $endIdentity; } break; case 'fj': $query = "match(n:Prescription {name:"."'".$name."'"."}) return n"; $data = $this->getSingle($query , 'zy'); $data1 = [ 'name' => ['name' => '名称' , 'text' => $data[0]['start']['properties']['name'] ?? ''], 'composition' => ['name' => '方剂组成' , 'text' => $data[0]['start']['properties']['composition'] ?? ''], 'medicinalCrop' => ['name' => '中药' , 'text' => $data[0]['start']['properties']['medicinalCrop'] ?? ''], 'indications' => ['name' => '主治' , 'text' => $data[0]['start']['properties']['indications'] ?? ''], 'solution' => ['name' => '方法/解法' , 'text' => $data[0]['start']['properties']['solution'] ?? ''], 'usageDosage' => ['name' => '用法用量' , 'text' => $data[0]['start']['properties']['usageDosage'] ?? ''], 'source' => ['name' => '数据来源' , 'text' => $data[0]['start']['properties']['source'] ?? ''], ]; $data[0]['start']['properties'] = $data1; $data[0]['start']['tag'] = $tag; break; case 'tz': $query = "match(n:Constitution {name:"."'".$name."'"."}) return n"; $data = $this->getSingle($query , 'zy'); $data1 = [ 'name' => ['name' => '名称' , 'text' => $data[0]['start']['properties']['name'] ?? ''], 'overallFeature' => ['name' => '总体特征' , 'text' => $data[0]['start']['properties']['overallFeature'] ?? ''], 'psychologicalFeature' => ['name' => '心理特征' , 'text' => $data[0]['start']['properties']['psychologicalFeature'] ?? ''], 'commonPerformance' => ['name' => '常见表现' , 'text' => $data[0]['start']['properties']['commonPerformance'] ?? ''], 'tendency' => ['name' => '发病倾向' , 'text' => $data[0]['start']['properties']['tendency'] ?? ''], 'exercise' => ['name' => '体育锻炼' , 'text' => $data[0]['start']['properties']['exercise'] ?? ''], 'meridianHealth' => ['name' => '经络保健' , 'text' => $data[0]['start']['properties']['meridianHealth'] ?? ''], 'medicineRegimen' => ['name' => '药物养生' , 'text' => $data[0]['start']['properties']['medicineRegimen'] ?? ''], 'dietTherapy' => ['name' => '宜食疗' , 'text' => $data[0]['start']['properties']['dietTherapy'] ?? ''], 'notEat' => ['name' => '不宜吃' , 'text' => $data[0]['start']['properties']['notEat'] ?? ''], ]; $data[0]['start']['properties'] = $data1; $data[0]['start']['tag'] = $tag; break; case 'xw': $query = "match(n:Acupoint {name:"."'".$name."'"."}) return n"; $data = $this->getSingle($query , 'zy'); $data1 = [ 'name' => ['name' => '名称' , 'text' => $data[0]['start']['properties']['name'] ?? ''], 'location' => ['name' => '定位' , 'text' => $data[0]['start']['properties']['location'] ?? ''], 'indications' => ['name' => '主治' , 'text' => $data[0]['start']['properties']['indications'] ?? ''], 'compatibility' => ['name' => '配伍' , 'text' => $data[0]['start']['properties']['compatibility'] ?? ''], 'acupuncture' => ['name' => '针灸法' , 'text' => $data[0]['start']['properties']['acupuncture'] ?? ''], 'notions' => ['name' => '附注' , 'text' => $data[0]['start']['properties']['notions'] ?? ''], ]; $data[0]['start']['properties'] = $data1; $data[0]['start']['tag'] = $tag; break; case 'jl': $query = "match(n:ChannelCollateral {kgid:"."'".$name."'"."}) return n"; $data = $this->getSingle($query , 'zy'); $data1 = [ 'name' => ['name' => '名称' , 'text' => $data[0]['start']['properties']['name'] ?? ''], 'indications' => ['name' => '主治' , 'text' => $data[0]['start']['properties']['indications'] ?? ''], 'channelSymptom' => ['name' => '经脉循行及其病候' , 'text' => $data[0]['start']['properties']['channelSymptom'] ?? ''], 'collateralSymptom' => ['name' => '络脉循行及其病候' , 'text' => $data[0]['start']['properties']['collateralSymptom'] ?? ''], 'divergentMeridian' => ['name' => '经别循行' , 'text' => $data[0]['start']['properties']['divergentMeridian'] ?? ''], 'aponeuroticSystem' => ['name' => '经筋循行及其病候' , 'text' => $data[0]['start']['properties']['aponeuroticSystem'] ?? ''], 'clinicalFeature' => ['name' => '经络症状主要临床表现' , 'text' => $data[0]['start']['properties']['clinicalFeature'] ?? ''], 'mechanismAnalysis' => ['name' => '经络病机分析' , 'text' => $data[0]['start']['properties']['mechanismAnalysis'] ?? ''], 'source' => ['name' => '数据来源' , 'text' => $data[0]['start']['properties']['source'] ?? ''], ]; $data[0]['start']['properties'] = $data1; $data[0]['start']['tag'] = $tag; break; case 'symptom': $query = "match p = (n:Thing)-[r:LinkDiseaseSymptom]-(m:Disease) where n.name= "."'".$name."'"." return p"; $data = $this->getXyR($query); if(empty($data)) { $query = "match(n:Symptom {name:"."'".$name."'"."}) return n"; $data = $this->getSingle($query); $data1 = [ 'name' => ['name' => '名称' , 'text' => $data[0]['start']['properties']['name'] ?? ''], 'indications' => ['name' => '主治' , 'text' => $data[0]['start']['properties']['indications'] ?? ''], 'channelSymptom' => ['name' => '经脉循行及其病候' , 'text' => $data[0]['start']['properties']['channelSymptom'] ?? ''], 'collateralSymptom' => ['name' => '络脉循行及其病候' , 'text' => $data[0]['start']['properties']['collateralSymptom'] ?? ''], 'divergentMeridian' => ['name' => '经别循行' , 'text' => $data[0]['start']['properties']['divergentMeridian'] ?? ''], 'aponeuroticSystem' => ['name' => '经筋循行及其病候' , 'text' => $data[0]['start']['properties']['aponeuroticSystem'] ?? ''], 'clinicalFeature' => ['name' => '经络症状主要临床表现' , 'text' => $data[0]['start']['properties']['clinicalFeature'] ?? ''], 'mechanismAnalysis' => ['name' => '经络病机分析' , 'text' => $data[0]['start']['properties']['mechanismAnalysis'] ?? ''], 'source' => ['name' => '数据来源' , 'text' => $data[0]['start']['properties']['source'] ?? ''], ]; $data[0]['start']['properties'] = $data1; $data[0]['start']['tag'] = $tag; } else { foreach ($data as $key => $value) { $data[$key]['start'] = $value['end']; $data[$key]['end'] = $value['start']; $data[$key]['relationship']['start'] = $value['relationship']['end']; $data[$key]['relationship']['end'] = $value['relationship']['start']; $list['name'] = ['name' => '名称' , 'text' => $data[$key]['start']['properties']['name'] ?? '']; $list['identify'] = ['name' => '识别' , 'text' => $data[$key]['start']['properties']['identify'] ?? '']; $list['abstract'] = ['name' => '摘要' , 'text' => $data[$key]['start']['properties']['abstract'] ?? '']; $list['precaution'] = ['name' => '预防措施' , 'text' => $data[$key]['start']['properties']['precaution'] ?? '']; $list['inspection'] = ['name' => '检查' , 'text' => $data[$key]['start']['properties']['inspection'] ?? '']; $list['etiology'] = ['name' => '病理' , 'text' => $data[$key]['start']['properties']['etiology'] ?? '']; $list['department'] = ['name' => '科室' , 'text' => $data[$key]['start']['properties']['department'] ?? '']; $data[$key]['start']['properties'] = $list; $data[$key]['start']['tag'] = 'symptom'; $listEnd['name'] = ['name' => '名称' , 'text' => $data[$key]['end']['properties']['name'] ?? '']; $data[$key]['end']['properties'] = $listEnd; } } break; } return $this->_json_succ($data); } // 搜索 public function search() { //if(!$this->checkIslogin()) return $this->_json_error('请登录后查看!'); $tag = Request::param('tag') ?? 'sickness'; $search = Request::param('search') ?? ''; $pn = Request::param('pn') ?? 1; $pagesize = 20; $limit = ($pn - 1) * $pagesize; if(!$tag || !$search) { return $this->_json_error('请求参数有误!'); } switch ($tag) { case "disease": $query = "match(n:Disease) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize"; $info = $this->getAboutInfo($query); $info = array_column($info , 'n'); $list = []; foreach ($info as $key => $value) { $list[$key]['sickness_name'] = $value['name']; $list[$key]['symptom'] = ['name' => '临床表现' , 'text' => $value['clinicalFeature'] ?? '' , 'active' => true]; $list[$key]['pathogenesis'] = ['name' => '病因' , 'text' => $value['pathogenesis'] ?? '' , 'active' => false]; $list[$key]['complicationsOverview'] = ['name' => '并发症' , 'text' => $value['complicationsOverview'] ?? '' , 'active' => false]; $list[$key]['inspection'] = ['name' => '辅助检查' , 'text' => $value['auxiliaryExamination'] ?? '' , 'active' => false]; $list[$key]['treatmenCommonSense'] = ['name' => '治疗' , 'text' => $value['treatment'] ?? '' , 'active' => false]; $list[$key]['diagnostiCtriage'] = ['name' => '诊断' , 'text' => $value['diagnosis'] ?? '' , 'active' => false]; } break; case "medicine": $query = "match(n:MedicineProduction) where n.name =~'.*".$search.".*' return n.name as name , n.pinyin as pinyin , n.usageDosage as usageDosage , n.notes as notes , n.periodValidity as periodValidity , n.indication as indication , n.storage as storage , n.character as character , n.approvalNumber as approvalNumber , n.productionEnterprise as productionEnterprise , n.relateSick as relateSick , n.untowardEffect as untowardEffect , n.majorConstituent as majorConstituent skip $limit limit 20"; $data = $this->getAboutInfo($query); $list = []; foreach ($data as $key => $value) { $list[$key]['sickness_name'] = $value['name']; $list[$key]['pinyi'] = ['name' => '汉语拼音' , 'text' => $value['pinyin'] , 'active' => false]; $list[$key]['usageDosage'] = ['name' => '用法用量' , 'text' => $value['usageDosage'] , 'active' => false]; $list[$key]['notes'] = ['name' => '注意事项' , 'text' => $value['notes'] , 'active' => false]; $list[$key]['periodValidity'] = ['name' => '有效期' , 'text' => $value['periodValidity'], 'active' => false]; $list[$key]['indication'] = ['name' => '适应症' , 'text' => $value['indication'], 'active' => false]; $list[$key]['storage'] = ['name' => '贮藏' , 'text' => $value['storage'], 'active' => false]; $list[$key]['character'] = ['name' => '性状' , 'text' => $value['character'], 'active' => false]; $list[$key]['approvalNumber'] = ['name' => '批准号' , 'text' => $value['approvalNumber'], 'active' => false]; $list[$key]['productionEnterprise'] = ['name' => '生产企业' , 'text' => $value['productionEnterprise'], 'active' => false]; $list[$key]['relateSick'] = ['name' => '相关疾病' , 'text' => $value['relateSick'], 'active' => false]; $list[$key]['untowardEffect'] = ['name' => '不良反应' , 'text' => $value['untowardEffect'], 'active' => false]; $list[$key]['majorConstituent'] = ['name' => '主要成分' , 'text' => $value['majorConstituent'], 'active' => true]; } break; case "sickness": $query = "match(n:SickNess) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize"; $info = $this->getAboutInfo($query); $info = array_column($info , 'n'); $list = []; foreach ($info as $key => $value) { $list[$key]['sickness_name'] = $value['name']; $list[$key]['symptom'] = ['name' => '临床表现' , 'text' => $value['symptom'] ?? '' , 'active' => true]; $list[$key]['pathogenesis'] = ['name' => '病因' , 'text' => $value['pathogenesis'] ?? '' , 'active' => false]; $list[$key]['complicationsOverview'] = ['name' => '并发症' , 'text' => $value['complicationsOverview'] ?? '' , 'active' => false]; $list[$key]['inspection'] = ['name' => '辅助检查' , 'text' => $value['inspection'] ?? '' , 'active' => false]; $list[$key]['treatmenCommonSense'] = ['name' => '治疗' , 'text' => $value['treatmenCommonSense'] ??'' , 'active' => false]; $list[$key]['diagnostiCtriage'] = ['name' => '诊断' , 'text' => $value['diagnostiCtriage'] ?? '' , 'active' => false]; } break; case "inspection": $query = "match(n:Inspection) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize"; $data = $this->getAboutInfo($query); $info = array_column($data , 'n'); foreach ($info as $key => $value) { $list[$key]['sickness_name'] = $value['name']; $list[$key]['annotation'] = ['name' => '附注' , 'text' => $value['annotation'] ?? '', 'active' => true]; $list[$key]['principle'] = ['name' => '根源' , 'text' => $value['principle'] ?? '', 'active' => false]; $list[$key]['normalValue'] = ['name' => '正常值' , 'text' => $value['normalValue'] ?? '', 'active' => false]; $list[$key]['clinicalSignificance'] = ['name' => '临床意义' , 'text' => $value['clinicalSignificance'] ?? '', 'active' => false]; $list[$key]['reagent'] = ['name' => '试剂' , 'text' => $value['reagent'] ?? '', 'active' => false]; $list[$key]['operation'] = ['name' => '操作方法' , 'text' => $value['operation'] ?? '', 'active' => false]; } break; case 'zysickness': $query = "match(n:SickNess) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $list = []; foreach ($data as $key => $value) { $list[$key]['name'] = $value['name']; $list[$key]['tongueCondition'] = ['name' => '舌象' , 'text' => $value['tongueCondition'] ?? '' , 'active' => true]; $list[$key]['apparatus'] = ['name' => '发病部位' , 'text' => $value['apparatus'] ?? '' , 'active' => false]; $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false]; $list[$key]['pulseCondition'] = ['name' => '脉象' , 'text' => $value['pulseCondition'] ?? '' , 'active' => false]; $list[$key]['dietTherapy'] = ['name' => '饮食疗法' , 'text' => $value['dietTherapy'] ?? '' , 'active' => false]; $list[$key]['symptom'] = ['name' => '症见' , 'text' => $value['symptom'] ?? '' , 'active' => false]; $list[$key]['department'] = ['name' => '科室' , 'text' => $value['department'] ?? '' , 'active' => false]; $list[$key]['acupuncturePoints'] = ['name' => '针灸穴位' , 'text' => $value['acupuncturePoints'] ?? '' , 'active' => false]; $list[$key]['dialecticalName'] = ['name' => '辩证法名' , 'text' => $value['dialecticalName'] ?? '' , 'active' => false]; } break; case 'zy': $query = "match(n:CnMedicinalCrop) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $list = []; foreach ($data as $key => $value) { $list[$key]['name'] = $value['name']; $list[$key]['toxicity'] = ['name' => '毒性' , 'text' => $value['toxicity'] ?? '' , 'active' => true]; $list[$key]['indications'] = ['name' => '适应症' , 'text' => $value['indications'] ?? '' , 'active' => false]; $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false]; $list[$key]['medicineProperty'] = ['name' => '医药物业' , 'text' => $value['medicineProperty'] ?? '' , 'active' => false]; $list[$key]['includedIn'] = ['name' => '包括在' , 'text' => $value['includedIn'] ?? '' , 'active' => false]; $list[$key]['pharmacology'] = ['name' => '药理' , 'text' => $value['pharmacology '] ?? '' , 'active' => false]; } break; case 'zcy': $query = "match(n:CnPatentMedicine) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $list = []; foreach ($data as $key => $value) { $list[$key]['name'] = $value['name']; $list[$key]['classification'] = ['name' => '实体值' , 'text' => $value['classification'] ?? '' , 'active' => true]; $list[$key]['efficacy'] = ['name' => '功效' , 'text' => $value['efficacy'] ?? '' , 'active' => false]; $list[$key]['indications'] = ['name' => '主治' , 'text' => $value['indications'] ?? '' , 'active' => false]; $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false]; } break; case 'fj': $query = "match(n:Prescription) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $list = []; foreach ($data as $key => $value) { $list[$key]['name'] = $value['name']; $list[$key]['composition'] = ['name' => '方剂组成' , 'text' => $value['composition'] ?? '' , 'active' => true]; $list[$key]['medicinalCrop'] = ['name' => '中药' , 'text' => $value['medicinalCrop'] ?? '' , 'active' => false]; $list[$key]['indications'] = ['name' => '主治' , 'text' => $value['indications'] ?? '' , 'active' => false]; $list[$key]['solution'] = ['name' => '方法/解法' , 'text' => $value['solution'] ?? '' , 'active' => false]; $list[$key]['usageDosage'] = ['name' => '用法用量' , 'text' => $value['usageDosage'] ?? '' , 'active' => false]; $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false]; } break; case 'ys': $query = "match(n:TonicDiet) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $list = []; foreach ($data as $key => $value) { $list[$key]['name'] = $value['name']; $list[$key]['composition'] = ['name' => '药膳组成' , 'text' => $value['composition'] ?? '' , 'active' => true]; } break; case 'jl': $query = "match(n:ChannelCollateral) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $list = []; foreach ($data as $key => $value) { $list[$key]['name'] = $value['name']; $list[$key]['indications'] = ['name' => '主治' , 'text' => $value['aponeuroticSystem'] ?? '' , 'active' => true]; $list[$key]['channelSymptom'] = ['name' => '经脉循行及其病候' , 'text' => $value['channelSymptom'] ?? '' , 'active' => false]; $list[$key]['collateralSymptom'] = ['name' => '络脉循行及其病候' , 'text' => $value['collateralSymptom'] ?? '' , 'active' => false]; $list[$key]['divergentMeridian'] = ['name' => '经别循行' , 'text' => $value['divergentMeridian'] ?? '' , 'active' => false]; $list[$key]['aponeuroticSystem'] = ['name' => '经筋循行及其病候' , 'text' => $value['aponeuroticSystem'] ?? '' , 'active' => false]; $list[$key]['clinicalFeature'] = ['name' => '经络症状主要临床表现' , 'text' => $value['clinicalFeature'] ?? '' , 'active' => false]; $list[$key]['mechanismAnalysis'] = ['name' => '经络病机分析' , 'text' => $value['mechanismAnalysis'] ?? '' , 'active' => false]; $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false]; $list[$key]['kgid'] = ['name' => 'kgid' , 'text' => $value['kgid'] ?? '' , 'active' => false]; } break; case 'xw': $query = "match(n:Acupoint) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize"; $data = $this->getAboutInfo($query , 'zy'); $data = array_column($data , 'n'); $list = []; foreach ($data as $key => $value) { $list[$key]['name'] = $value['name']; $list[$key]['location'] = ['name' => '定位' , 'text' => $value['location'] ?? '' , 'active' => true]; $list[$key]['indications'] = ['name' => '主治' , 'text' => $value['indications'] ?? '' , 'active' => false]; $list[$key]['compatibility'] = ['name' => '配伍' , 'text' => $value['compatibility'] ?? '' , 'active' => false]; $list[$key]['acupuncture'] = ['name' => '针灸法' , 'text' => $value['acupuncture'] ?? '' , 'active' => false]; $list[$key]['notions'] = ['name' => '附注' , 'text' => $value['notions'] ?? '' , 'active' => false]; } break; case 'symptom': $query = "match(n:Symptom) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize"; $data = $this->getAboutInfo($query); $data = array_column($data , 'n'); $list = []; foreach ($data as $key => $value) { $list[$key]['sickness_name'] = $value['name']; $list[$key]['identify'] = ['name' => '识别' , 'text' => $value['identify'] ?? '' , 'active' => true]; $list[$key]['abstract'] = ['name' => '摘要' , 'text' => $value['abstract'] ?? '' , 'active' => false]; $list[$key]['precaution'] = ['name' => '预防措施' , 'text' => $value['precaution'] ?? '' , 'active' => false]; $list[$key]['inspection'] = ['name' => '检查' , 'text' => $value['inspection'] ?? '' , 'active' => false]; $list[$key]['etiology'] = ['name' => '病理' , 'text' => $value['etiology'] ?? '' , 'active' => false]; $list[$key]['department'] = ['name' => '科室' , 'text' => $value['department'] ?? '' , 'active' => false]; } break; case "identify": $query = "match(n:Disease) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize"; $data = $this->getAboutInfo($query); $data = array_column($data , 'n'); $list = []; foreach ($data as $key => $value) { $list[$key]['sickness_name'] = $value['name']; $list[$key]['antidiastole'] = ['name' => '鉴别诊断' , 'text' => $value['antidiastole'] ?? '' , 'active' => true]; } break; } return $this->_json_succ($list); } // 问答 public function qw() { //if(!$this->checkIslogin()) return $this->_json_error('请登录后查看!'); $question = Request::param('question') ?? ''; $param = urlencode($question); $url = "http://121.43.229.91:9000/info?sen=" . $param; $data = file_get_contents($url); $arr = json_decode($data , true); $answer = ['text' => $arr['search_info'] , 'type' => 1 , 'name' => '智能客服' , 'time' => date('Y-m-d H:i:s')]; return $this->_json_succ(['answer' => $answer]); } }