NeojApiMasterWeb.php 126 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652
  1. <?php
  2. namespace app\controller;
  3. require_once app()->getRootPath().'vendor/autoload.php';
  4. use Neoxygen\NeoClient\ClientBuilder;
  5. use think\facade\Request;
  6. use app\model\ClinicalTrial;
  7. use app\model\ClinicalPathway;
  8. class NeojApiMasterWeb extends CommonTwoController
  9. {
  10. // 菜单栏
  11. public function index()
  12. {
  13. //if(!$this->checkIslogin()) return $this->_json_error('请登录后查看!');
  14. // 西医科普疾病
  15. $query = "match(n:SickNess) where n.departmentLevel1 is not null return distinct n.departmentLevel1 as departmentLevel1";
  16. $departmentLevel1 = $this->getAboutInfo($query);
  17. $list = [];
  18. foreach ($departmentLevel1 as $key => $value) {
  19. $list[$key]['departmentLevel1'] = $value['departmentLevel1'];
  20. $query1 = "match(n:SickNess{departmentLevel1 : "."'".$value["departmentLevel1"]."'"."}) return distinct n.departmentLevel2 as departmentLevel2";
  21. $qdata1 = $this->getAboutInfo($query1);
  22. foreach ($qdata1 as $key1 => $value1) {
  23. $qdata1[$key1]['tag'] = 'sickness';
  24. }
  25. $list[$key]['departmentLevel2']['name'] = $qdata1;
  26. }
  27. // 西医科室疾病
  28. $query2 = "match(n:Disease) where n.departmentLevel1 is not null return distinct n.departmentLevel1 as departmentLevel1";
  29. $departmentLevel = $this->getAboutInfo($query2);
  30. $listt = [];
  31. foreach ($departmentLevel as $key => $value) {
  32. $listt[$key]['departmentLevel1'] = $value['departmentLevel1'];
  33. $query11 = "match(n:Disease{departmentLevel1 : "."'".$value["departmentLevel1"]."'"."}) return distinct n.departmentLevel2 as departmentLevel2";
  34. $qqdata1 = $this->getAboutInfo($query11);
  35. foreach ($qqdata1 as $key11 => $value11) {
  36. $qqdata1[$key11]['tag'] = 'disease';
  37. }
  38. $listt[$key]['departmentLevel2']['name'] = $qqdata1;
  39. }
  40. // 西医科室疾病
  41. $query2 = "match(n:Disease) where n.departmentLevel1 is not null return distinct n.departmentLevel1 as departmentLevel1";
  42. $data2 = $this->getAboutInfo($query2);
  43. foreach ($data2 as $key2 => $value2)
  44. {
  45. $data2[$key2]['tag'] = 'disease';
  46. }
  47. // 中医疾病
  48. $query1 = "match(n:SickNess) where n.department is not null return distinct n.department as departmentLevel2";
  49. $data = $this->getAboutInfo($query1 , 'zy');
  50. unset($data[20]);
  51. unset($data[5]);
  52. $listzy[0]['departmentLevel1']['name'] = '中医科室';
  53. $listzy[0]['departmentLevel2']['name'] = $data;
  54. $lists = [
  55. ['knowledge_base_name' => '西医知识库'],
  56. ['knowledge_base_name' => '中医知识库'],
  57. ['knowledge_base_name' => '文献和指南']
  58. ];
  59. foreach ($lists as $k => $v)
  60. {
  61. // 西医知识库
  62. $lists[0]['subordinate'] = [
  63. ['name' => '疾病'] ,
  64. ['name' => '症状体征' , 'tag' => 'symptom'],
  65. ['name' => '药品' , 'tag' => 'medicine'],
  66. ['name' => '检查' , 'tag' => 'inspection'],
  67. ['name' => '鉴别诊断(误诊)' , 'tag' => 'identify'],
  68. ['name' => '临床试验' , 'tag' => 'clinicTrial'],
  69. ['name' => '临床路径' , 'tag' => 'clinicalPathway'],
  70. ];
  71. // 中医知识库
  72. $lists[1]['subordinate'] = [
  73. ['name' => '疾病' , 'tag' => 'zysickness'] ,
  74. ['name' => '中成药' , 'tag' => 'zcy'] ,
  75. ['name' => '经络' , 'tag' => 'jl'] ,
  76. ['name' => '中药' , 'tag' => 'zy'] ,
  77. ['name' => '中医药膳' , 'tag' => 'ys'] ,
  78. ['name' => '方剂' , 'tag' => 'fj'] ,
  79. ['name' => '体质' , 'tag' => 'tz'] ,
  80. ['name' => '穴位' , 'tag' => 'xw']
  81. ];
  82. // 指南和文献
  83. $lists[2]['subordinate'] = [
  84. ['name' => '文献' , 'tag' => 'document'] ,
  85. ['name' => '指南' , 'tag' => 'guide']
  86. ];
  87. }
  88. // 中医疾病科室
  89. $zysicknessQuery = "match(n:SickNess) return distinct n.department as departmentLevel2";
  90. $zydeparment = $this->getAboutInfo($zysicknessQuery , 'zy');
  91. foreach ($zydeparment as $zyk => $zyvalue)
  92. {
  93. $zydeparment[$zyk]['tag'] = 'zysickness';
  94. $zydquery = "match(n:SickNess {department:"."'".$zyvalue['departmentLevel2']."'"."}) return distinct n.name as name";
  95. $datazyd = $this->getAboutInfo($zydquery , 'zy');
  96. foreach ($datazyd as $zydk => $zydv) {
  97. $datazyd[$zydk]['tag'] = 'zysickness';
  98. }
  99. $zydeparment[$zyk]['subordinate'] = $datazyd;
  100. unset($zydeparment[20]);
  101. unset($zydeparment[21]);
  102. }
  103. foreach ($lists as $kk => $v)
  104. {
  105. $lists[0]['subordinate'][0]['subordinate'] = [['name' => '西医科普疾病'] , ['name' => '西医科室疾病']];
  106. }
  107. // 获取中成药分类
  108. $cnquery = "match(n:CnPatentMedicine) where n.classification is not null return distinct n.classification as name";
  109. $cndata = $this->getAboutInfo($cnquery , 'zy');
  110. foreach ($cndata as $cnkey => $cnvalue)
  111. {
  112. $cndata[$cnkey]['tag'] = 'zcy';
  113. }
  114. // 获取经络分类
  115. $cnjlquery = "match(n:ChannelCollateral) where n.name is not null return distinct n.name as name";
  116. $cnjldata = $this->getAboutInfo($cnjlquery , 'zy');
  117. foreach ($cnjldata as $cnjlkey => $cnvalue)
  118. {
  119. $cnjldata[$cnjlkey]['tag'] = 'jl';
  120. }
  121. // 获取西医症状体征分类(部位)
  122. $locationquery = "match(n:Location) return distinct n.name as name";
  123. $cnlodata = $this->getAboutInfo($locationquery);
  124. foreach ($cnlodata as $cnlokey => $cnvalue)
  125. {
  126. $cnlodata[$cnlokey]['tag'] = 'symptom';
  127. }
  128. foreach ($lists as $kkk => $vvv)
  129. {
  130. $lists[0]['subordinate'][0]['subordinate'][0]['department'] = $list;
  131. //$lists[0]['subordinate'][0]['subordinate'][1]['department'][0]['departmentLevel1'] = '医疗疾病科室';
  132. $lists[0]['subordinate'][0]['subordinate'][1]['department'] = $listt;
  133. $lists[0]['subordinate'][1]['subordinate'] = $cnlodata; // 西医部位
  134. $lists[1]['subordinate'][0]['subordinate'][0]['name'] = '中医科室疾病';
  135. $lists[1]['subordinate'][0]['subordinate'][1]['name'] = '中医ICD10疾病';
  136. //$lists[1]['subordinate'][0]['subordinate'][0]['department'][0]['departmentLevel1'] = '中医科室';
  137. $lists[1]['subordinate'][0]['subordinate'][0]['department'] = $zydeparment;
  138. $lists[1]['subordinate'][0]['subordinate'][1]['department'] = $this->getIcdSickness();
  139. $lists[1]['subordinate'][1]['subordinate'] = $cndata;
  140. $lists[1]['subordinate'][2]['subordinate'] = $cnjldata; // 经络
  141. }
  142. return $this->_json_succ($lists);
  143. }
  144. // 中医icd分类
  145. public function getIcdSickness()
  146. {
  147. $query = "match(n:Thing) where n.level1 is not null return distinct n.level1 as level";
  148. $data = $this->getAboutInfo($query , 'zy');
  149. foreach ($data as $key => $value) {
  150. $query1 = "match(n:Thing {level1:"."'".$value["level"]."'"."}) return distinct n.level2 as level2";
  151. $data1 = $this->getAboutInfo($query1 , 'zy');
  152. $data[$key]['subordinate'] = $data1;
  153. foreach ($data1 as $kk => $vv) {
  154. //$query2 = "match(n:Thing {level2:"."'".$vv["level2"]."'"."}) return distinct n.name as name order by name";
  155. $vv['level2'] = substr($vv['level2'] , 0 , 3);
  156. $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";
  157. $data2 = $this->getAboutInfo($query2 , 'zy');
  158. foreach ($data2 as $k => $v) {
  159. $data2[$k]['tag'] = 'icd10';
  160. $data2[$k]['name'] = $v['name'];
  161. }
  162. $data[$key]['subordinate'][$kk]['subordinate'] = $data2;
  163. }
  164. }
  165. return $data;
  166. }
  167. // 中医知识库列表
  168. public function getZyList()
  169. {
  170. //if(!$this->checkIslogin()) return $this->_json_error('请登录后查看!');
  171. $tag = Request::param('tag');
  172. $pn = Request::param('pn') ?? 1;
  173. $limit = ($pn - 1) * 30;
  174. switch ($tag) {
  175. case 'zysickness':
  176. $query = "match(n:SickNess) return n skip $limit limit 20";
  177. $data = $this->getAboutInfo($query , 'zy');
  178. $data = array_column($data , 'n');
  179. $query_count = "match(n:SickNess) return count(n) as count";
  180. $count = $this->getTotalCount($query_count , 'zy');
  181. $list = [];
  182. foreach ($data as $key => $value) {
  183. $list[$key]['name'] = $value['dialecticalName'];
  184. $list[$key]['symptom'] = ['name' => '症见' , 'text' => $value['symptom'] ?? '' , 'active' => true];
  185. $list[$key]['tongueCondition'] = ['name' => '舌象' , 'text' => $value['tongueCondition'] ?? '' , 'active' => false];
  186. $list[$key]['apparatus'] = ['name' => '发病部位' , 'text' => $value['apparatus'] ?? '' , 'active' => false];
  187. $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false];
  188. $list[$key]['pulseCondition'] = ['name' => '脉象' , 'text' => $value['pulseCondition'] ?? '' , 'active' => false];
  189. $list[$key]['dietTherapy'] = ['name' => '饮食疗法' , 'text' => $value['dietTherapy'] ?? '' , 'active' => false];
  190. $list[$key]['department'] = ['name' => '科室' , 'text' => $value['department'] ?? '' , 'active' => false];
  191. $list[$key]['acupuncturePoints'] = ['name' => '针灸穴位' , 'text' => $value['acupuncturePoints'] ?? '' , 'active' => false];
  192. $list[$key]['dialecticalName'] = ['name' => '辩证法名' , 'text' => $value['dialecticalName'] ?? '' , 'active' => false];
  193. }
  194. break;
  195. case 'zy':
  196. $query = "match(n:CnMedicinalCrop) return n skip $limit limit 20";
  197. $data = $this->getAboutInfo($query , 'zy');
  198. $data = array_column($data , 'n');
  199. $query_count = "match(n:CnMedicinalCrop) return count(n) as count";
  200. $count = $this->getTotalCount($query_count , 'zy');
  201. $list = [];
  202. foreach ($data as $key => $value) {
  203. $list[$key]['name'] = $value['name'];
  204. $list[$key]['toxicity'] = ['name' => '毒性' , 'text' => $value['toxicity'] ?? '' , 'active' => true];
  205. $list[$key]['indications'] = ['name' => '功能主治' , 'text' => $value['indications'] ?? '' , 'active' => false];
  206. $list[$key]['source'] = ['name' => '来源' , 'text' => $value['source'] ?? '' , 'active' => false];
  207. $list[$key]['medicineProperty'] = ['name' => '药性' , 'text' => $value['medicineProperty'] ?? '' , 'active' => false];
  208. $list[$key]['includedIn'] = ['name' => '收录于' , 'text' => $value['includedIn'] ?? '' , 'active' => false];
  209. $list[$key]['pharmacology'] = ['name' => '药理作用' , 'text' => $value['pharmacology '] ?? '' , 'active' => false];
  210. $list[$key]['kgid'] = ['name' => 'kgid' , 'text' => $value['kgid'] ?? '' , 'active' => false];
  211. }
  212. break;
  213. case 'zcy':
  214. $query = "match(n:CnPatentMedicine) return n skip $limit limit 20";
  215. $data = $this->getAboutInfo($query , 'zy');
  216. $data = array_column($data , 'n');
  217. $query_count = "match(n:CnPatentMedicine) return count(n) as count";
  218. $count = $this->getTotalCount($query_count , 'zy');
  219. $list = [];
  220. foreach ($data as $key => $value) {
  221. $list[$key]['name'] = $value['name'];
  222. $list[$key]['classification'] = ['name' => '实体值' , 'text' => $value['classification'] ?? '' , 'active' => true];
  223. $list[$key]['efficacy'] = ['name' => '功效' , 'text' => $value['efficacy'] ?? '' , 'active' => false];
  224. $list[$key]['indications'] = ['name' => '主治' , 'text' => $value['indications'] ?? '' , 'active' => false];
  225. $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false];
  226. }
  227. break;
  228. case 'ys':
  229. $query = "match(n:TonicDiet) return n skip $limit limit 20";
  230. $data = $this->getAboutInfo($query , 'zy');
  231. $data = array_column($data , 'n');
  232. $query_count = "match(n:TonicDiet) return count(n) as count";
  233. $count = $this->getTotalCount($query_count , 'zy');
  234. $list = [];
  235. foreach ($data as $key => $value) {
  236. $list[$key]['name'] = $value['name'];
  237. $list[$key]['composition'] = ['name' => '药膳组成' , 'text' => $value['composition'] ?? '' , 'active' => true];
  238. }
  239. break;
  240. case 'fj':
  241. $query = "match(n:Prescription) return n skip $limit limit 20";
  242. $data = $this->getAboutInfo($query , 'zy');
  243. $data = array_column($data , 'n');
  244. $query_count = "match(n:Prescription) return count(n) as count";
  245. $count = $this->getTotalCount($query_count , 'zy');
  246. $list = [];
  247. foreach ($data as $key => $value) {
  248. $list[$key]['name'] = $value['name'];
  249. $list[$key]['composition'] = ['name' => '方剂组成' , 'text' => $value['composition'] ?? '' , 'active' => true];
  250. $list[$key]['medicinalCrop'] = ['name' => '中药' , 'text' => $value['medicinalCrop'] ?? '' , 'active' => false];
  251. $list[$key]['indications'] = ['name' => '主治' , 'text' => $value['indications'] ?? '' , 'active' => false];
  252. $list[$key]['solution'] = ['name' => '方法/解法' , 'text' => $value['solution'] ?? '' , 'active' => false];
  253. $list[$key]['usageDosage'] = ['name' => '用法用量' , 'text' => $value['usageDosage'] ?? '' , 'active' => false];
  254. $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false];
  255. }
  256. break;
  257. case 'tz':
  258. $query = "match(n:Constitution) return n skip $limit limit 20";
  259. $data = $this->getAboutInfo($query , 'zy');
  260. $data = array_column($data , 'n');
  261. $query_count = "match(n:Constitution) return count(n) as count";
  262. $count = $this->getTotalCount($query_count , 'zy');
  263. $list = [];
  264. foreach ($data as $key => $value) {
  265. $list[$key]['name'] = $value['name'];
  266. $list[$key]['overallFeature'] = ['name' => '总体特征' , 'text' => $value['overallFeature'] ?? '' , 'active' => true];
  267. $list[$key]['psychologicalFeature'] = ['name' => '心理特征' , 'text' => $value['medicinalCrop'] ?? '' , 'active' => false];
  268. $list[$key]['commonPerformance'] = ['name' => '常见表现' , 'text' => $value['indications'] ?? '' , 'active' => false];
  269. $list[$key]['tendency'] = ['name' => '发病倾向' , 'text' => $value['tendency'] ?? '' , 'active' => false];
  270. $list[$key]['exercise'] = ['name' => '体育锻炼' , 'text' => $value['exercise'] ?? '' , 'active' => false];
  271. $list[$key]['meridianHealth'] = ['name' => '经络保健' , 'text' => $value['meridianHealth'] ?? '' , 'active' => false];
  272. $list[$key]['medicineRegimen'] = ['name' => '药物养生' , 'text' => $value['medicineRegimen'] ?? '' , 'active' => false];
  273. $list[$key]['dietTherapy'] = ['name' => '宜食疗' , 'text' => $value['medicineRegimen'] ?? '' , 'active' => false];
  274. $list[$key]['notEat'] = ['name' => '不宜吃' , 'text' => $value['medicineRegimen'] ?? '' , 'active' => false];
  275. }
  276. break;
  277. case 'xw':
  278. $query = "match(n:Acupoint) return n skip $limit limit 20";
  279. $data = $this->getAboutInfo($query , 'zy');
  280. $data = array_column($data , 'n');
  281. $query_count = "match(n:Acupoint) return count(n) as count";
  282. $count = $this->getTotalCount($query_count , 'zy');
  283. $list = [];
  284. foreach ($data as $key => $value) {
  285. $list[$key]['name'] = $value['name'];
  286. $list[$key]['location'] = ['name' => '定位' , 'text' => $value['location'] ?? '' , 'active' => true];
  287. $list[$key]['indications'] = ['name' => '主治' , 'text' => $value['indications'] ?? '' , 'active' => false];
  288. $list[$key]['compatibility'] = ['name' => '配伍' , 'text' => $value['compatibility'] ?? '' , 'active' => false];
  289. $list[$key]['acupuncture'] = ['name' => '针灸法' , 'text' => $value['acupuncture'] ?? '' , 'active' => false];
  290. $list[$key]['notions'] = ['name' => '附注' , 'text' => $value['notions'] ?? '' , 'active' => false];
  291. }
  292. break;
  293. }
  294. return $this->_json_succ(['list' => $list , 'count' => $count]);
  295. }
  296. // 获取左侧栏目下拉信息
  297. public function getSickNessByDpm()
  298. {
  299. //if(!$this->checkIslogin()) return $this->_json_error('请登录后查看!');
  300. $department = Request::param('department') ?? '';
  301. $pn = Request::param('pn') ?? 1;
  302. $pagesize = 20;
  303. $limit = ($pn - 1) * $pagesize;
  304. $tag = Request::param('tag') ?? 'sickness'; // sickness 科普 disease 医疗
  305. $list = [];
  306. switch ($tag)
  307. {
  308. case "sickness":
  309. $query = "match(n:SickNess{departmentLevel2 : "."'".$department."'"."}) return
  310. n.name as name , n.complicationsOverview as complicationsOverview , n.pathogenesis as pathogenesis ,
  311. n.treatmenCommonSense as treatmenCommonSense , n.inspection as inspection , n.symptom as symptom , n.diagnostiCtriage as diagnostiCtriage
  312. skip $limit limit 20";
  313. // $query = "match(n:SickNess{departmentLevel2 : "."'".$department."'"."}) return n skip $limit limit 30";
  314. $sickess = $this->getAboutInfo($query);
  315. $query_count = "match(n:SickNess{departmentLevel2 : "."'".$department."'"."}) return count(n) as count";
  316. $count = $this->getTotalCount($query_count);
  317. foreach ($sickess as $key => $value) {
  318. $list[$key]['sickness_name'] = $value['name'];
  319. $list[$key]['symptom'] = ['name' => '临床表现' , 'text' => $value['symptom'] ?? '' , 'active' => true];
  320. $list[$key]['pathogenesis'] = ['name' => '病因' , 'text' => $value['pathogenesis'] ?? '' , 'active' => false];
  321. $list[$key]['complicationsOverview'] = ['name' => '并发症' , 'text' => $value['complicationsOverview'] ?? '' , 'active' => false];
  322. $list[$key]['inspection'] = ['name' => '辅助检查' , 'text' => $value['inspection'] ?? '', 'active' => false];
  323. $list[$key]['treatmenCommonSense'] = ['name' => '治疗' , 'text' => $value['treatmenCommonSense'] ?? '' , 'active' => false];
  324. $list[$key]['diagnostiCtriage'] = ['name' => '诊断' , 'text' => $value['diagnostiCtriage'] ?? '', 'active' => false];
  325. }
  326. break;
  327. case "disease":
  328. $query = "match(n:Disease{departmentLevel2 : "."'".$department."'"."}) return n.name as name,
  329. n.clinicalFeature as clinicalFeature , n.pathogenesis as pathogenesis , n.complicationsOverview as complicationsOverview ,
  330. n.auxiliaryExamination as auxiliaryExamination , n.treatment as treatment , n.diagnosis as diagnosis
  331. skip $limit limit 20";
  332. $sickess = $this->getAboutInfo($query);
  333. $query_count = "match(n:Disease) where n.departmentLevel2 =~'.*".$department.".*' return count(n) as count";
  334. $count = $this->getTotalCount($query_count);
  335. foreach ($sickess as $key => $value) {
  336. $list[$key]['sickness_name'] = $value['name'];
  337. $list[$key]['symptom'] = ['name' => '临床表现' , 'text' => $value['clinicalFeature'] ?? '', 'active' => true];
  338. $list[$key]['pathogenesis'] = ['name' => '病因' , 'text' => $value['pathogenesis'] ?? '', 'active' => false];
  339. $list[$key]['complicationsOverview'] = ['name' => '并发症' , 'text' => $value['complicationsOverview'] ?? '' , 'active' => false];
  340. $list[$key]['inspection'] = ['name' => '辅助检查' , 'text' => $value['auxiliaryExamination'] ?? '' , 'active' => false];
  341. $list[$key]['treatmenCommonSense'] = ['name' => '治疗' , 'text' => $value['treatment'] ?? '', 'active' => false];
  342. $list[$key]['diagnostiCtriage'] = ['name' => '诊断' , 'text' => $value['diagnosis'] ?? '', 'active' => false];
  343. }
  344. break;
  345. case "medicine":
  346. $query = "match(n:MedicineProduction) return
  347. n.name as name , n.pinyin as pinyin , n.usageDosage as usageDosage ,
  348. n.notes as notes , n.periodValidity as periodValidity ,
  349. n.indication as indication , n.storage as storage , n.character as character ,
  350. n.approvalNumber as approvalNumber ,
  351. n.productionEnterprise as productionEnterprise , n.relateSick as relateSick , n.untowardEffect as untowardEffect ,
  352. n.majorConstituent as majorConstituent
  353. skip $limit limit 20";
  354. $data = $this->getAboutInfo($query);
  355. $query_count = "match(n:MedicineProduction) return count(n) as count";
  356. $count = $this->getTotalCount($query_count);
  357. foreach ($data as $key => $value) {
  358. $list[$key]['sickness_name'] = $value['name'];
  359. $list[$key]['pinyi'] = ['name' => '汉语拼音' , 'text' => $value['pinyin'] , 'active' => false];
  360. $list[$key]['usageDosage'] = ['name' => '用法用量' , 'text' => $value['usageDosage'] , 'active' => false];
  361. $list[$key]['notes'] = ['name' => '注意事项' , 'text' => $value['notes'] , 'active' => false];
  362. $list[$key]['periodValidity'] = ['name' => '有效期' , 'text' => $value['periodValidity'], 'active' => false];
  363. $list[$key]['indication'] = ['name' => '适应症' , 'text' => $value['indication'], 'active' => false];
  364. $list[$key]['storage'] = ['name' => '贮藏' , 'text' => $value['storage'], 'active' => false];
  365. $list[$key]['character'] = ['name' => '性状' , 'text' => $value['character'], 'active' => false];
  366. $list[$key]['approvalNumber'] = ['name' => '批准号' , 'text' => $value['approvalNumber'], 'active' => false];
  367. $list[$key]['productionEnterprise'] = ['name' => '生产企业' , 'text' => $value['productionEnterprise'], 'active' => false];
  368. $list[$key]['relateSick'] = ['name' => '相关疾病' , 'text' => $value['relateSick'], 'active' => false];
  369. $list[$key]['untowardEffect'] = ['name' => '不良反应' , 'text' => $value['untowardEffect'], 'active' => false];
  370. $list[$key]['majorConstituent'] = ['name' => '主要成分' , 'text' => $value['majorConstituent'], 'active' => true];
  371. }
  372. break;
  373. case "inspection":
  374. $query = "match (n:Inspection) return
  375. n.name as name , n.annotation as annotation , n.principle as principle , n.normalValue as normalValue ,
  376. n.clinicalSignificance as clinicalSignificance , n.reagent as reagent , n.operation as operation
  377. skip $limit limit 20";
  378. $data = $this->getAboutInfo($query);
  379. $query_count = "match (n:Inspection) return count(n) as count";
  380. $count = $this->getTotalCount($query_count);
  381. foreach ($data as $key => $value) {
  382. $list[$key]['sickness_name'] = $value['name'];
  383. $list[$key]['annotation'] = ['name' => '附注' , 'text' => $value['annotation'] ?? '' , 'active' => true];
  384. $list[$key]['principle'] = ['name' => '根源' , 'text' => $value['principle'] ?? '' , 'active' => false];
  385. $list[$key]['normalValue'] = ['name' => '正常值' , 'text' => $value['normalValue'] ?? '' , 'active' => false];
  386. $list[$key]['clinicalSignificance'] = ['name' => '临床意义' , 'text' => $value['clinicalSignificance'] ?? '' , 'active' => false];
  387. $list[$key]['reagent'] = ['name' => '试剂' , 'text' => $value['reagent'] ?? '' , 'active' => false];
  388. $list[$key]['operation'] = ['name' => '操作方法' , 'text' => $value['operation'] ?? '' , 'active' => false];
  389. }
  390. break;
  391. case "zysickness":
  392. $query = "match (n:SickNess {name:"."'".$department."'"."}) return n skip $limit limit 20";
  393. $data = $this->getAboutInfo($query , 'zy');
  394. $data = array_column($data , 'n');
  395. $query_count = "match (n:SickNess {name:"."'".$department."'"."}) return count(n) as count";
  396. $count = $this->getTotalCount($query_count , 'zy');
  397. foreach ($data as $key => $value) {
  398. $list[$key]['sickness_name'] = $value['dialecticalName'];
  399. //$list[$key]['name'] = ['name' => '疾病名称' , 'text' => $value['name'] ?? '' , 'active' => false];
  400. $list[$key]['symptom'] = ['name' => '症见' , 'text' => $value['symptom'] ?? '' , 'active' => true];
  401. $list[$key]['apparatus'] = ['name' => '发病部位' , 'text' => $value['apparatus'] ?? '' , 'active' => false];
  402. $list[$key]['dialecticalName'] = ['name' => '证型' , 'text' => $value['dialecticalName'] ?? '' , 'active' => false];
  403. $list[$key]['tongueCondition'] = ['name' => '舌象' , 'text' => $value['tongueCondition'] ?? '' , 'active' => false];
  404. $list[$key]['pulseCondition'] = ['name' => '脉象' , 'text' => $value['pulseCondition'] ?? '' , 'active' => false];
  405. $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false];
  406. $list[$key]['therapeuticMethod'] = ['name' => '治法原则' , 'text' => $value['therapeuticMethod'] ?? '' , 'active' => false];
  407. $list[$key]['cnPatentMedicine'] = ['name' => '中成药' , 'text' => $value['cnPatentMedicine'] ?? '' , 'active' => false];
  408. $list[$key]['dietTherapy'] = ['name' => '中医食疗法' , 'text' => $value['dietTherapy'] ?? '' , 'active' => false];
  409. $list[$key]['tonicDiet'] = ['name' => '中医药膳' , 'text' => $value['tonicDiet'] ?? '' , 'active' => false];
  410. $list[$key]['acupuncturePoints'] = ['name' => '针灸穴位' , 'text' => $value['acupuncturePoints'] ?? '' , 'active' => false];
  411. $list[$key]['kgid'] = ['name' => 'kgid' , 'text' => $value['kgid'] ?? '' , 'active' => false];
  412. }
  413. break;
  414. case "icd10":
  415. $query = "match (n:SickNess {ICD10:"."'".$department."'"."}) return n skip $limit limit 20";
  416. $data = $this->getAboutInfo($query , 'zy');
  417. $data = array_column($data , 'n');
  418. $query_count = "match (n:SickNess {name:"."'".$department."'"."}) return count(n) as count";
  419. $count = $this->getTotalCount($query_count , 'zy');
  420. foreach ($data as $key => $value) {
  421. $list[$key]['sickness_name'] = $value['dialecticalName'];
  422. //$list[$key]['name'] = ['name' => '疾病名称' , 'text' => $value['name'] ?? '' , 'active' => false];
  423. $list[$key]['symptom'] = ['name' => '症见' , 'text' => $value['symptom'] ?? '' , 'active' => true];
  424. $list[$key]['apparatus'] = ['name' => '发病部位' , 'text' => $value['apparatus'] ?? '' , 'active' => false];
  425. $list[$key]['dialecticalName'] = ['name' => '证型' , 'text' => $value['dialecticalName'] ?? '' , 'active' => false];
  426. $list[$key]['tongueCondition'] = ['name' => '舌象' , 'text' => $value['tongueCondition'] ?? '' , 'active' => false];
  427. $list[$key]['pulseCondition'] = ['name' => '脉象' , 'text' => $value['pulseCondition'] ?? '' , 'active' => false];
  428. $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false];
  429. $list[$key]['therapeuticMethod'] = ['name' => '治法原则' , 'text' => $value['therapeuticMethod'] ?? '' , 'active' => false];
  430. $list[$key]['cnPatentMedicine'] = ['name' => '中成药' , 'text' => $value['cnPatentMedicine'] ?? '' , 'active' => false];
  431. $list[$key]['dietTherapy'] = ['name' => '中医食疗法' , 'text' => $value['dietTherapy'] ?? '' , 'active' => false];
  432. $list[$key]['tonicDiet'] = ['name' => '中医药膳' , 'text' => $value['tonicDiet'] ?? '' , 'active' => false];
  433. $list[$key]['acupuncturePoints'] = ['name' => '针灸穴位' , 'text' => $value['acupuncturePoints'] ?? '' , 'active' => false];
  434. $list[$key]['kgid'] = ['name' => 'kgid' , 'text' => $value['kgid'] ?? '' , 'active' => false];
  435. }
  436. break;
  437. case "zcy":
  438. $query = "match(n:CnPatentMedicine {classification:"."'".$department."'"."}) return n skip $limit limit 20";
  439. $data = $this->getAboutInfo($query , 'zy');
  440. $data = array_column($data , 'n');
  441. $query_count = "match(n:CnPatentMedicine {classification:"."'".$department."'"."}) return count(n) as count";
  442. $count = $this->getTotalCount($query_count , 'zy');
  443. $list = [];
  444. foreach ($data as $key => $value) {
  445. $list[$key]['name'] = $value['name'];
  446. $list[$key]['classification'] = ['name' => '实体值' , 'text' => $value['classification'] ?? '' , 'active' => true];
  447. $list[$key]['efficacy'] = ['name' => '功效' , 'text' => $value['efficacy'] ?? '' , 'active' => false];
  448. $list[$key]['indications'] = ['name' => '主治' , 'text' => $value['indications'] ?? '' , 'active' => false];
  449. $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false];
  450. }
  451. break;
  452. case "jl":
  453. $query = "match(n:ChannelCollateral {name:"."'".$department."'"."}) return n skip $limit limit 20";
  454. $data = $this->getAboutInfo($query , 'zy');
  455. $data = array_column($data , 'n');
  456. $query_count = "match(n:ChannelCollateral {name:"."'".$department."'"."}) return count(n) as count";
  457. $count = $this->getTotalCount($query_count , 'zy');
  458. $list = [];
  459. foreach ($data as $key => $value)
  460. {
  461. $list[$key]['name'] = $value['name'];
  462. $list[$key]['indications'] = ['name' => '主治' , 'text' => $value['aponeuroticSystem'] ?? '' , 'active' => true];
  463. $list[$key]['channelSymptom'] = ['name' => '经脉循行及其病候' , 'text' => $value['channelSymptom'] ?? '' , 'active' => false];
  464. $list[$key]['collateralSymptom'] = ['name' => '络脉循行及其病候' , 'text' => $value['collateralSymptom'] ?? '' , 'active' => false];
  465. $list[$key]['divergentMeridian'] = ['name' => '经别循行' , 'text' => $value['divergentMeridian'] ?? '' , 'active' => false];
  466. $list[$key]['aponeuroticSystem'] = ['name' => '经筋循行及其病候' , 'text' => $value['aponeuroticSystem'] ?? '' , 'active' => false];
  467. $list[$key]['clinicalFeature'] = ['name' => '经络症状主要临床表现' , 'text' => $value['clinicalFeature'] ?? '' , 'active' => false];
  468. $list[$key]['mechanismAnalysis'] = ['name' => '经络病机分析' , 'text' => $value['mechanismAnalysis'] ?? '' , 'active' => false];
  469. $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false];
  470. $list[$key]['kgid'] = ['name' => 'kgid' , 'text' => $value['kgid'] ?? '' , 'active' => false];
  471. }
  472. break;
  473. case "symptom":
  474. $query = "match(n:Thing)-[r:LinkLocation]-(m:Symptom) where n.name="."'".$department."'"." return m skip $limit limit $pagesize";
  475. $data = $this->getAboutInfo($query);
  476. $data = array_column($data , 'm');
  477. $query_count = "match(n:Thing)-[r:LinkLocation]-(m:Symptom) where n.name="."'".$department."'"." return count(m) as count";
  478. $count = $this->getTotalCount($query_count);
  479. $list = [];
  480. foreach ($data as $key => $value)
  481. {
  482. $list[$key]['sickness_name'] = $value['name'];
  483. $list[$key]['identify'] = ['name' => '识别' , 'text' => $value['identify'] ?? '' , 'active' => true];
  484. $list[$key]['abstract'] = ['name' => '摘要' , 'text' => $value['abstract'] ?? '' , 'active' => false];
  485. $list[$key]['precaution'] = ['name' => '预防措施' , 'text' => $value['precaution'] ?? '' , 'active' => false];
  486. $list[$key]['inspection'] = ['name' => '检查' , 'text' => $value['inspection'] ?? '' , 'active' => false];
  487. $list[$key]['etiology'] = ['name' => '病理' , 'text' => $value['etiology'] ?? '' , 'active' => false];
  488. $list[$key]['department'] = ['name' => '科室' , 'text' => $value['department'] ?? '' , 'active' => false];
  489. }
  490. break;
  491. case "identify":
  492. $query = "match (n:Disease) where n.antidiastole is not null return
  493. n.name as name , n.antidiastole as antidiastole
  494. skip $limit limit 20";
  495. $data = $this->getAboutInfo($query);
  496. $query_count = "match (n:Disease) return count(n) as count";
  497. $count = $this->getTotalCount($query_count);
  498. foreach ($data as $key => $value) {
  499. $list[$key]['sickness_name'] = $value['name'];
  500. $list[$key]['antidiastole'] = ['name' => '鉴别诊断' , 'text' => $value['antidiastole'] ?? '' , 'active' => true];
  501. }
  502. break;
  503. case "clinicalPathway":
  504. $like = Request::param('like_name') ?? '';
  505. if($like) {
  506. $ClinicalPathway = ClinicalPathway::where("clinical_pathway" , "like" , "%$like%" )->limit($limit , $pagesize)->select();
  507. $count = ClinicalPathway::where("clinical_pathway" , "like" , "%$like%" )->count();
  508. } else {
  509. $ClinicalPathway = ClinicalPathway::limit($limit , $pagesize)->select();
  510. $count = ClinicalPathway::count();
  511. }
  512. foreach ($ClinicalPathway as $key => $value) {
  513. $ClinicalPathway[$key]['file'] = $this->checkDocPdfIsExist('https://zskweb.jiankangche.cn/lcfiles/pdf2/lcpdf/lc/'.$value['clinical_pathway'].'.pdf');
  514. }
  515. return $this->_json_succ(['list' => $ClinicalPathway , 'count' => $count]);
  516. break;
  517. case "clinicTrial":
  518. $like = Request::param('like_name') ?? '';
  519. if($like) {
  520. $ClinicalTrial = ClinicalTrial::where("drug_name" , "like" , "%$like%" )
  521. ->whereOr("adaptation_disease" , "like" , "%$like%" )
  522. ->whereOr("experimental_popular_topic" , "like" , "%$like%" )
  523. ->limit($limit , $pagesize)->select();
  524. $count = ClinicalTrial::where("drug_name" , "like" , "%$like%" )->count();
  525. } else {
  526. $ClinicalTrial = ClinicalTrial::limit($limit , $pagesize)->select();
  527. $count = ClinicalTrial::count();
  528. }
  529. foreach ($ClinicalTrial as $key => $value) {
  530. $ClinicalTrial[$key]['file'] = $this->checkDocPdfIsExist('https://zskweb.jiankangche.cn/lcfiles/pdf2/docs/'.$value['register_number'].'.pdf');
  531. }
  532. return $this->_json_succ(['list' => $ClinicalTrial , 'count' => $count]);
  533. break;
  534. default:
  535. return $this->_json_error('请求有误!');
  536. break;
  537. }
  538. return $this->_json_succ(['list' => $list , 'count' => $count]);
  539. }
  540. private function checkDocPdfIsExist($url)
  541. {
  542. $check = get_headers($url);
  543. if(strstr($check[0] , '200')) {
  544. return $url;
  545. }
  546. return "";
  547. }
  548. private function getSicknessComplication($name , $tag)
  549. {
  550. $querydisease = "match p = (n:Disease)-[r:DiseaseComplication]->(m:Thing) where n.name= "."'".$name."'"." return p";
  551. $querysickness = "match p = (n:SickNess)-[r:SicknessComplication]->(m:Thing) where n.name= "."'".$name."'"." return p";
  552. $query = $tag == 'sickness' ? $querysickness : $querydisease;
  553. $result = $this->getComplication($query);
  554. if(!empty($result)) {
  555. foreach ($result as $key => $value) {
  556. if($name == $value['properties']) {
  557. unset($result[$key]);
  558. }
  559. }
  560. $complications = array_column($result , 'properties') ?? '';
  561. return ['name' => $complications , 'tag' => $tag];
  562. } else {
  563. return $complications = [];
  564. }
  565. }
  566. private function getZyRelationship($kgid , $tag)
  567. {
  568. $name = $kgid ?? '4d839135f8627092b95602acf6dbb5237fadab9419bc88f2199ad7fe2d90ae31';
  569. switch ($tag) {
  570. case "fj":
  571. $query = "match p = (n:SickNess)-[r:LinkPrescription]->(m:Thing) where n.kgid= "."'".$name."'"." return p";
  572. break;
  573. case "ys":
  574. $query = "match p = (n:SickNess)-[r:LinkTonicDiet]->(m:Thing) where n.kgid= "."'".$name."'"." return p";
  575. break;
  576. case "zcy":
  577. $query = "match p = (n:SickNess)-[r:LinkCnPatentMedicine]->(m:Thing) where n.kgid= "."'".$name."'"." return p";
  578. break;
  579. }
  580. $result = $this->getComplication($query , 'zy');
  581. $arr = array_column($result , 'properties') ?? '';
  582. if(empty($arr)) {
  583. return '';
  584. }
  585. return ['name' => $arr , 'tag' => $tag];
  586. }
  587. // 详情
  588. public function sickNessDetail()
  589. {
  590. //if(!$this->checkIslogin()) return $this->_json_error('请登录后查看!');
  591. $sickness = Request::param('sickness');
  592. $tag = Request::param('tag') ?? 'sickness';
  593. switch ($tag)
  594. {
  595. case "sickness":
  596. $query = "match(n:SickNess{name:"."'".$sickness."'"."})-[r:LInkeMedicineSickness]-(m:Medicine) return m.name as name limit 10";
  597. $medicine = $this->getAboutInfo($query);
  598. if($medicine) {
  599. $medicine = array_column($medicine , 'name');
  600. //$medicine = join(',' , $medicine);
  601. $medicine = ['name' => $medicine , 'tag' => 'medicine'];
  602. }
  603. $query_1 = "match(n:SickNess{name : "."'".$sickness."'"."}) return n";
  604. $info = array_column($this->getAboutInfo($query_1) , 'n');
  605. $data = [
  606. 'sickness_name' => ['name' => '名称' , 'text' => $info[0]['name'] ??''],
  607. 'alias' => ['name' => '疾病别名' , 'text' => $info[0]['alias'] ?? ''],
  608. 'ICD10' => ['name' => 'ICD10' , 'text' => $info[0]['ICD10'] ?? ''],
  609. 'department' => ['name' => '疾病类别' , 'text' => $info[0]['department'] ?? ''],
  610. 'complication' => ['name' => '并发症' , 'text' => $this->getSicknessComplication($sickness , 'sickness') ?? ''],
  611. 'medicine' => ['name' => '相关药品' , 'text' => $medicine ?? ''] ,
  612. 'introduction' => ['name' => '疾病概述' , 'text' => $info[0]['introduction'] ?? ''],
  613. 'epidemiology' => ['name' => '流行病学' , 'text' => $info[0]['epidemiology'] ?? ''],
  614. 'suitableFood' => ['name' => '宜吃食物' , 'text' => $info[0]['suitableFood'] ?? ''],
  615. 'notEat' => ['name' => '忌吃食物' , 'text' => $info[0]['notEat'] ?? ''],
  616. 'diagnostiCtriage' => ['name' => '诊断鉴别' , 'text' => $info[0]['diagnostiCtriage'] ?? ''],
  617. 'precaution' => ['name' => '预防' , 'text' => $info[0]['precaution'] ?? ''],
  618. 'nursingInfo' => ['name' => '护理信息' , 'text' => $info[0]['nursingInfo'] ?? ''],
  619. 'warmPrompt' => ['name' => '温馨提示' , 'text' => $info[0]['warmPrompt'] ?? ''],
  620. 'recommendedRecipe' => ['name' => '推荐食谱' , 'text' => $info[0]['recommendedRecipe'] ?? ''],
  621. 'treatmentOverview' => ['name' => '治疗概述' , 'text' => $info[0]['treatmentOverview'] ?? ''],
  622. 'inspection' => ['name' => '检查' , 'text' => $info[0]['inspection'] ?? ''],
  623. 'treatmenCommonSense' => ['name' => '治疗常识' , 'text' => $info[0]['treatmenCommonSense'] ?? ''],
  624. 'pathogenesis' => ['name' => '病因' , 'text' => $info[0]['pathogenesis'] ?? ''],
  625. 'basicKnowledgel' => ['name' => '基本常识' , 'text' => $info[0]['basicKnowledgel'] ?? ''],
  626. 'dietHealth' => ['name' => '饮食保健' , 'text' => $info[0]['dietHealth'] ?? ''],
  627. 'symptom' => ['name' => '证型' , 'text' => $info[0]['symptom'] ?? ''],
  628. 'complicationsOverview' => ['name' => '并发症概述', 'text' => $info[0]['complicationsOverview'] ?? ''],
  629. 'treatmentInfo' => ['name' => '治疗信息' , 'text' => $info[0]['treatmentInfo'] ?? ''],
  630. ];
  631. break;
  632. case "disease":
  633. $query = "match(n:Disease{name : "."'".$sickness."'"."}) return n";
  634. $info = array_column($this->getAboutInfo($query) , 'n');
  635. $query1 = "match(n:Thing)-[r:LinkMedicineDisease]-(m:Disease {name:"."'".$sickness."'"."}) return n.name as name limit 10";
  636. $medicine = $this->getAboutInfo($query1) ?? '';
  637. if($medicine) {
  638. $medicine = array_column($medicine , 'name');
  639. $medicine = ['name' => $medicine , 'tag' => 'medicine'];
  640. }
  641. $query2 = "match (n:Disease)-[r:LinkInspection]-(m:Thing) where n.name= "."'".$sickness."'"." return m.name as name limit 10";
  642. $inspection = $this->getAboutInfo($query2) ?? '';
  643. if($inspection) {
  644. $inspection = array_column($inspection , 'name');
  645. $inspection = ['name' => $inspection , 'tag' => 'inspection'];
  646. }
  647. $data = [
  648. 'sickness_name' => ['name' => '名称' , 'text' => $info[0]['name'] ??''],
  649. 'alias' => ['name' => '疾病别名' , 'text' => $info[0]['alias'] ?? ''],
  650. 'icd' => ['name' => 'ICD号' , 'text' => $info[0]['icd'] ?? ''],
  651. 'department' => ['name' => '疾病类别' , 'text' => $info[0]['department'] ?? ''],
  652. 'complication' => ['name' => '并发症' , 'text' => $this->getSicknessComplication($sickness , 'disease') ?? ''],
  653. 'epidemiology' => ['name' => '流行病学' , 'text' => $info[0]['epidemiology'] ?? ''],
  654. 'nameEn' => ['name' => '英文名称' , 'text' => $info[0]['nameEn'] ?? ''],
  655. 'sickOverview' => ['name' => '疾病概述' , 'text' => $info[0]['sickOverview'] ?? ''],
  656. 'clinicalFeature' => ['name' => '临床表现' , 'text' => $info[0]['clinicalFeature'] ?? ''],
  657. 'diagnosis' => ['name' => '诊断' , 'text' => $info[0]['diagnosis'] ?? ''],
  658. 'treatment' => ['name' => '治疗' , 'text' => $info[0]['treatment'] ?? ''],
  659. 'regularMedication' => ['name' => '相关药品' , 'text' => $medicine ?? []],
  660. 'pathogenesis' => ['name' => '发病机制' , 'text' => $info[0]['pathogenesis'] ?? ''],
  661. 'inspection' => ['name' => '相关检查' , 'text' => $inspection ?? []],
  662. 'laboratoryInspection' => ['name' => '实验室检查' , 'text' => $info[0]['laboratoryInspection'] ?? ''],
  663. 'etiology' => ['name' => '病因' , 'text' => $info[0]['etiology'] ?? ''],
  664. 'auxiliaryExamination' => ['name' => '其他辅助检查' , 'text' => $info[0]['auxiliaryExamination'] ?? ''],
  665. 'prognosis' => ['name' => '预后' , 'text' => $info[0]['prognosis'] ?? ''],
  666. 'complicationsOverview' => ['name' => '并发症概述' , 'text' => $info[0]['complicationsOverview'] ?? ''],
  667. 'precaution' => ['name' => '预防' , 'text' => $info[0]['precaution'] ?? ''],
  668. ];
  669. break;
  670. case "medicine":
  671. $query = "match(n:MedicineProduction {name : "."'".$sickness."'"."}) return n";
  672. $data = array_column($this->getAboutInfo($query) , 'n');
  673. $data = [
  674. 'sickness_name' => ['name' => '名称' , 'text' => $data[0]['name'] ??''],
  675. 'pinyi' => ['name' => '汉语拼音' , 'text' => $data[0]['pinyin'] ?? ''],
  676. 'oldUse' => ['name' => '老人用药' , 'text' => $data[0]['oldUse'] ?? ''],
  677. 'chilldUse' => ['name' => '儿童用药' , 'text' => $data[0]['chilldUse'] ?? ''],
  678. 'medicinePregnant' => ['name' => '孕妇及哺乳期妇女用药' , 'text' => $data[0]['medicinePregnant'] ?? ''],
  679. 'usageDosage' => ['name' => '用法用量' , 'text' => $data[0]['usageDosage'] ?? ''],
  680. 'notes' => ['name' => '注意事项' , 'text' => $data[0]['notes'] ?? ''],
  681. 'periodValidity' => ['name' => '有效期' , 'text' => $data[0]['periodValidity'] ?? ''],
  682. 'indication' => ['name' => '适应症' , 'text' => $data[0]['indication'] ?? ''],
  683. 'storage' => ['name' => '贮藏' , 'text' => $data[0]['storage'] ?? ''],
  684. 'character' => ['name' => '性状' , 'text' => $data[0]['character'] ?? ''],
  685. 'contraindication' => ['name' => '禁忌' , 'text' => $data[0]['contraindication'] ?? ''],
  686. 'pharmacologyToxicology'=> ['name' => '药理毒理' , 'text' => $data[0]['pharmacologyToxicology'] ?? ''],
  687. 'specification' => ['name' => '规格' , 'text' => $data[0]['specification'] ?? ''],
  688. 'approvalNumber' => ['name' => '批准号' , 'text' => $data[0]['approvalNumber'] ?? ''],
  689. 'productionEnterprise' => ['name' => '生产企业' , 'text' => $data[0]['productionEnterprise'] ?? ''],
  690. 'relateSick' => ['name' => '相关疾病' , 'text' => $data[0]['relateSick'] ?? ''],
  691. 'untowardEffect' => ['name' => '不良反应' , 'text' => $data[0]['untowardEffect'] ?? ''],
  692. 'majorConstituent' => ['name' => '主要成分' , 'text' => $data[0]['majorConstituent'] ?? ''],
  693. ];
  694. break;
  695. case "inspection":
  696. $query = "match (n:Inspection {name : "."'".$sickness."'"."}) return n";
  697. $data = array_column($this->getAboutInfo($query) , 'n');
  698. $data = [
  699. 'sickness_name' => ['name' => '名称' , 'text' => $data[0]['name'] ?? ''],
  700. 'overview' => ['name' => '概述' , 'text' => $data[0]['overview'] ?? ''],
  701. 'annotation' => ['name' => '附注' , 'text' => $data[0]['annotation'] ?? ''],
  702. 'principle' => ['name' => '原理' , 'text' => $data[0]['principle'] ?? ''],
  703. 'normalValue' => ['name' => '正常值' , 'text' => $data[0]['normalValue'] ?? ''],
  704. 'clinicalSignificance' => ['name' => '临床意义' , 'text' => $data[0]['clinicalSignificance'] ?? ''],
  705. 'reagent' => ['name' => '试剂' , 'text' => $data[0]['reagent'] ?? ''],
  706. 'operation' => ['name' => '操作方法' , 'text' => $data[0]['operation'] ?? ''],
  707. ];
  708. break;
  709. case "zysickness":
  710. case "icd10":
  711. $query = "match(n:SickNess {kgid:"."'".$sickness."'"."}) return n";
  712. $data = $this->getAboutInfo($query , 'zy');
  713. $data = array_column($data , 'n');
  714. $data = [
  715. 'dialecticalName' => ['name' => '证型' , 'text' => $data[0]['dialecticalName'] ?? ''],
  716. 'ICD10' => ['name' => 'ICD10' , 'text' => $data[0]['ICD10'] ?? ''],
  717. 'sickness_name' => ['name' => '名称' , 'text' => $data[0]['name'] ?? ''],
  718. 'fj' => ['name' => '方剂' , 'text' => $this->getZyRelationship($data[0]['kgid'] , 'fj') ?? ''],
  719. 'ys' => ['name' => '药膳' , 'text' => $this->getZyRelationship($data[0]['kgid'] , 'ys') ?? ''],
  720. 'zcy' => ['name' => '中成药' , 'text' => $this->getZyRelationship($data[0]['kgid'] , 'zcy') ?? ''],
  721. 'tongueCondition' => ['name' => '舌象' , 'text' => $data[0]['tongueCondition'] ?? ''],
  722. 'apparatus' => ['name' => '发病部位' , 'text' => $data[0]['apparatus'] ?? ''],
  723. 'source' => ['name' => '数据来源' , 'text' => $data[0]['source'] ?? ''],
  724. 'pulseCondition' => ['name' => '脉象' , 'text' => $data[0]['pulseCondition'] ?? ''],
  725. 'dietTherapy' => ['name' => '饮食疗法' , 'text' => $data[0]['dietTherapy'] ?? ''],
  726. 'symptom' => ['name' => '症见' , 'text' => $data[0]['symptom'] ?? ''],
  727. 'department' => ['name' => '科室' , 'text' => $data[0]['department'] ?? ''],
  728. 'acupuncturePoints' => ['name' => '针灸穴位' , 'text' => $data[0]['acupuncturePoints'] ?? ''],
  729. 'therapeuticMethod' => ['name' => '治疗方法' , 'text' => $data[0]['therapeuticMethod'] ?? ''],
  730. 'kgid' => ['name' => 'kgid' , 'text' => $data[0]['kgid'] ?? ''],
  731. ];
  732. break;
  733. case "zy":
  734. // 中药详情
  735. $query = "match(n:CnMedicinalCrop {kgid:"."'".$sickness."'"."}) return n";
  736. $data = $this->getAboutInfo($query , 'zy');
  737. $data = array_column($data , 'n');
  738. $data = [
  739. 'sickness_name' => ['name' => '名称' , 'text' => $data[0]['name'] ?? ''],
  740. 'toxicity' => ['name' => '毒性' , 'text' => $data[0]['toxicity'] ?? ''],
  741. 'indications' => ['name' => '功能主治' , 'text' => $data[0]['indications'] ?? ''],
  742. 'source' => ['name' => '来源' , 'text' => $data[0]['source'] ?? ''],
  743. 'medicineProperty' => ['name' => '药理作用' , 'text' => $data[0]['medicineProperty'] ?? ''],
  744. 'includedIn' => ['name' => '收录于' , 'text' => $data[0]['includedIn'] ?? ''],
  745. 'kgid' => ['name' => 'kgid' , 'text' => $data[0]['kgid'] ?? ''],
  746. ];
  747. break;
  748. case "zcy":
  749. $query = "match(n:CnPatentMedicine {name:"."'".$sickness."'"."}) return n";
  750. $data = $this->getAboutInfo($query , 'zy');
  751. $data = array_column($data , 'n');
  752. $data = [
  753. 'sickness_name' => ['name' => '名称' , 'text' => $data[0]['name'] ?? ''],
  754. 'classification' => ['name' => '分类' , 'text' => $data[0]['classification'] ?? ''],
  755. 'efficacy' => ['name' => '功效' , 'text' => $data[0]['efficacy'] ?? ''],
  756. 'indications' => ['name' => '主治' , 'text' => $data[0]['indications'] ?? ''],
  757. 'source' => ['name' => '数据来源' , 'text' => $data[0]['source'] ?? ''],
  758. ];
  759. break;
  760. case "fj":
  761. $query = "match(n:Prescription {name:"."'".$sickness."'"."}) return n";
  762. $data = $this->getAboutInfo($query , 'zy');
  763. $data = array_column($data , 'n');
  764. $data = [
  765. 'sickness_name' => ['name' => '名称' , 'text' => $data[0]['name'] ?? ''],
  766. 'composition' => ['name' => '方剂组成' , 'text' => $data[0]['composition'] ?? ''],
  767. 'medicinalCrop' => ['name' => '中药' , 'text' => $data[0]['medicinalCrop'] ?? ''],
  768. 'indications' => ['name' => '主治' , 'text' => $data[0]['indications'] ?? ''],
  769. 'solution' => ['name' => '方法/解法' , 'text' => $data[0]['solution'] ?? ''],
  770. 'usageDosage' => ['name' => '用法用量' , 'text' => $data[0]['usageDosage'] ?? ''],
  771. 'source' => ['name' => '数据来源' , 'text' => $data[0]['source'] ?? ''],
  772. ];
  773. break;
  774. case "ys":
  775. // 中医药膳
  776. $query = "match(n:TonicDiet {name:"."'".$sickness."'"."}) return n";
  777. $data = $this->getAboutInfo($query , 'zy');
  778. $data = array_column($data , 'n');
  779. // 获取药膳对应疾病 LinkTonicDiet
  780. $query1 = "match(n:Thing{name:"."'".$sickness."'"."})-[r:LinkTonicDiet]-(m:SickNess) return m.name as name , m.kgid as kgid limit 10";
  781. $getSicknessByLinkTonicDiet = $this->getAboutInfo($query1 , 'zy');
  782. foreach ($getSicknessByLinkTonicDiet as $key => $value) {
  783. $getSicknessByLinkTonicDiet[$key]['name'] = $getSicknessByLinkTonicDiet[$key]['name'].'-'. $getSicknessByLinkTonicDiet[$key]['kgid'];
  784. }
  785. if($getSicknessByLinkTonicDiet) {
  786. $sickNesss = array_column($getSicknessByLinkTonicDiet , 'name');
  787. foreach ($sickNesss as $k => $v) {
  788. $array = explode('-' , $v);
  789. $sickNessses[] = ['name' => $array[0] , 'kgid' => $array[1]];
  790. }
  791. $sickNesss = ['name' => $sickNessses , 'tag' => 'zysickness'];
  792. } else {
  793. $sickNesss = [];
  794. }
  795. $data = [
  796. 'sickness_name' => ['name' => '名称' , 'text' => $data[0]['name'] ?? ''],
  797. 'composition' => ['name' => '药膳组成' , 'text' => $data[0]['composition'] ?? ''],
  798. 'sickness' => ['name' => '疾病' , 'text' => $sickNesss]
  799. ];
  800. break;
  801. case 'tz':
  802. $query = "match(n:Constitution {name:"."'".$sickness."'"."}) return n";
  803. $data = $this->getAboutInfo($query , 'zy');
  804. $data = array_column($data , 'n');
  805. $data = [
  806. 'sickness_name' => ['name' => '名称' , 'text' => $data[0]['name'] ?? ''],
  807. 'overallFeature' => ['name' => '总体特征' , 'text' => $data[0]['overallFeature'] ?? ''],
  808. 'psychologicalFeature' => ['name' => '心理特征' , 'text' => $data[0]['psychologicalFeature'] ?? ''],
  809. 'commonPerformance' => ['name' => '常见表现' , 'text' => $data[0]['commonPerformance'] ?? ''],
  810. 'tendency' => ['name' => '发病倾向' , 'text' => $data[0]['tendency'] ?? ''],
  811. 'exercise' => ['name' => '体育锻炼' , 'text' => $data[0]['exercise'] ?? ''],
  812. 'meridianHealth' => ['name' => '经络保健' , 'text' => $data[0]['meridianHealth'] ?? ''],
  813. 'medicineRegimen' => ['name' => '药物养生' , 'text' => $data[0]['medicineRegimen'] ?? ''],
  814. 'dietTherapy' => ['name' => '宜食疗' , 'text' => $data[0]['dietTherapy'] ?? ''],
  815. 'notEat' => ['name' => '不宜吃' , 'text' => $data[0]['notEat'] ?? ''],
  816. ];
  817. break;
  818. case 'jl':
  819. $query = "match(n:ChannelCollateral {kgid:"."'".$sickness."'"."}) return n";
  820. $data = $this->getAboutInfo($query , 'zy');
  821. $data = array_column($data , 'n');
  822. $data = [
  823. 'sickness_name' => ['name' => '经络' , 'text' => $data[0]['name'] ?? ''],
  824. 'indications' => ['name' => '主治' , 'text' => $data[0]['indications'] ?? ''],
  825. 'channelSymptom' => ['name' => '经脉循行及其病候' , 'text' => $data[0]['channelSymptom'] ?? ''],
  826. 'collateralSymptom' => ['name' => '络脉循行及其病候' , 'text' => $data[0]['collateralSymptom'] ?? ''],
  827. 'divergentMeridian' => ['name' => '经别循行' , 'text' => $data[0]['divergentMeridian'] ?? ''],
  828. 'aponeuroticSystem' => ['name' => '经筋循行及其病候' , 'text' => $data[0]['aponeuroticSystem'] ?? ''],
  829. 'clinicalFeature' => ['name' => '经络症状主要临床表现', 'text' => $data[0]['clinicalFeature'] ?? ''],
  830. 'mechanismAnalysis' => ['name' => '经络病机分析' , 'text' => $data[0]['mechanismAnalysis'] ?? ''],
  831. 'source' => ['name' => '数据来源' , 'text' => $data[0]['source'] ?? ''],
  832. ];
  833. break;
  834. case 'xw':
  835. $query = "match(n:Acupoint {name:"."'".$sickness."'"."}) return n";
  836. $data = $this->getAboutInfo($query , 'zy');
  837. $data = array_column($data , 'n');
  838. $data = [
  839. 'sickness_name' => ['name' => '穴位' , 'text' => $data[0]['name'] ?? ''],
  840. 'location' => ['name' => '定位' , 'text' => $data[0]['location'] ?? ''],
  841. 'indications' => ['name' => '主治' , 'text' => $data[0]['indications'] ?? ''],
  842. 'compatibility' => ['name' => '配伍' , 'text' => $data[0]['compatibility'] ?? ''],
  843. 'acupuncture' => ['name' => '针灸法' , 'text' => $data[0]['acupuncture'] ?? ''],
  844. 'notions' => ['name' => '附注' , 'text' => $data[0]['notions'] ?? ''],
  845. ];
  846. break;
  847. case "symptom":
  848. $query = "match(n:Symptom {name:"."'".$sickness."'"."}) return n";
  849. $data = $this->getAboutInfo($query);
  850. $data = array_column($data , 'n');
  851. // 医疗症状关系
  852. $query1 = "match(n:Thing)-[r:LinkDiseaseSymptom]-(m:Disease) where n.name="."'".$sickness."'"." return m.name as name";
  853. $data2 = $this->getAboutInfo($query1) ?? '';
  854. if($data2) {
  855. $diseaseSymptoms = array_column($data2 , 'name');
  856. $diseaseSymptoms = ['name' => $diseaseSymptoms , 'tag' => 'disease'];
  857. }
  858. $data = [
  859. 'sickness_name' => ['name' => '名称' , 'text' => $data[0]['name'] ?? ''],
  860. 'identify' => ['name' => '识别' , 'text' => $data[0]['identify'] ?? ''],
  861. 'abstract' => ['name' => '摘要' , 'text' => $data[0]['abstract'] ?? ''],
  862. 'precaution' => ['name' => '预防措施' , 'text' => $data[0]['precaution'] ?? ''],
  863. 'inspection' => ['name' => '检查' , 'text' => $data[0]['inspection'] ?? ''],
  864. 'diseaseSymptoms' => ['name' => '症状疾病' , 'text' => $diseaseSymptoms ?? []],
  865. 'etiology' => ['name' => '病理' , 'text' => $data[0]['etiology'] ?? ''],
  866. 'department' => ['name' => '科室' , 'text' => $data[0]['department'] ?? ''],
  867. ];
  868. break;
  869. }
  870. return $this->_json_succ($data);
  871. }
  872. // 详情图谱
  873. public function detailGraph()
  874. {
  875. //if(!$this->checkIslogin()) return $this->_json_error('请登录后查看!');
  876. $tag = Request::param('tag') ?? 'disease';
  877. $name = Request::param('name') ?? '肠道革兰阴性杆菌脑膜炎';
  878. switch ($tag)
  879. {
  880. case 'disease':
  881. $query = "match p = (n:Disease)-[r:DiseaseComplication]-(m:Thing) where n.name= "."'".$name."'"." return p";
  882. $query1 = "match p1 = (n:Disease)-[r:LinkMedicineDisease]-(m:Thing) where n.name= "."'".$name."'"." return p1";
  883. $query2 = "match p2 = (n:Disease)-[r:LinkInspection]-(m:Thing) where n.name= "."'".$name."'"." return p2";
  884. $data = $this->getXyR($query , $query1 , $query2);
  885. $list = [];
  886. foreach ($data as $key => $value) {
  887. $list['icd'] = ['name' => 'ICD' , 'text' => $data[$key]['start']['properties']['icd'] ?? ''];
  888. $list['name'] = ['name' => '名称' , 'text' => $data[$key]['start']['properties']['name'] ?? ''];
  889. $list['alias'] = ['name' => '疾病别名' , 'text' => $data[$key]['start']['properties']['alias'] ?? ''];
  890. $list['department'] = ['name' => '疾病类别' , 'text' => $data[$key]['start']['properties']['department'] ?? ''];
  891. $list['complication'] = ['name' => '并发症' , 'text' => $data[$key]['start']['properties']['complication'] ?? ''];
  892. $list['epidemiology'] = ['name' => '流行病学' , 'text' => $data[$key]['start']['properties']['epidemiology'] ?? ''];
  893. $list['nameEn'] = ['name' => '英文名称' , 'text' => $data[$key]['start']['properties']['nameEn'] ?? ''];
  894. $list['sickOverview'] = ['name' => '疾病概述' , 'text' => $data[$key]['start']['properties']['sickOverview'] ?? ''];
  895. $list['clinicalFeature'] = ['name' => '临床表现' , 'text' => $data[$key]['start']['properties']['clinicalFeature'] ?? ''];
  896. $list['diagnosis'] = ['name' => '诊断' , 'text' => $data[$key]['start']['properties']['diagnosis'] ?? ''];
  897. $list['treatment'] = ['name' => '治疗' , 'text' => $data[$key]['start']['properties']['treatment'] ?? ''];
  898. $list['regularMedication'] = ['name' => '相关药品' , 'text' => $data[$key]['start']['properties']['regularMedication'] ?? ''];
  899. $list['pathogenesis'] = ['name' => '发病机制' , 'text' => $data[$key]['start']['properties']['pathogenesis'] ?? ''];
  900. $list['inspection'] = ['name' => '相关检查' , 'text' => $data[$key]['start']['properties']['inspection'] ?? ''];
  901. $list['laboratoryInspection'] = ['name' => '实验室检查' , 'text' => $data[$key]['start']['properties']['laboratoryInspection'] ?? ''];
  902. $list['etiology'] = ['name' => '病因' , 'text' => $data[$key]['start']['properties']['etiology'] ?? ''];
  903. $list['auxiliaryExamination'] = ['name' => '其他辅助检查' , 'text' => $data[$key]['start']['properties']['auxiliaryExamination'] ?? ''];
  904. $list['prognosis'] = ['name' => '预后' , 'text' => $data[$key]['start']['properties']['prognosis'] ?? ''];
  905. $list['complicationsOverview'] = ['name' => '并发症概述' , 'text' => $data[$key]['start']['properties']['complicationsOverview'] ?? ''];
  906. $list['precaution'] = ['name' => '预防' , 'text' => $data[$key]['start']['properties']['precaution'] ?? ''];
  907. $data[$key]['start']['properties'] = $list;
  908. $data[$key]['start']['tag'] = $tag;
  909. if($value['relationship']['type'] == 'DISEASECOMPLICATION') {
  910. $listEnd = [
  911. 'name' => ['name' => '疾病名称' , 'text' => $data[$key]['end']['properties']['name']],
  912. ];
  913. $data[$key]['end']['properties'] = $listEnd;
  914. $data[$key]['end']['tag'] = $tag;
  915. }
  916. if($value['relationship']['type'] == 'LINKMEDICINEDISEASE') {
  917. $listEnd = [
  918. 'name' => ['name' => '名称' , 'text' =>$data[$key]['end']['properties']['name'] ?? ''],
  919. 'pinyi' => ['name' => '汉语拼音' , 'text' =>$data[$key]['end']['properties']['pinyin'] ?? ''],
  920. 'oldUse' => ['name' => '老人用药' , 'text' =>$data[$key]['end']['properties']['oldUse'] ?? ''],
  921. 'chilldUse' => ['name' => '儿童用药' , 'text' =>$data[$key]['end']['properties']['chilldUse'] ?? ''],
  922. 'medicinePregnant' => ['name' => '孕妇及哺乳期妇女用药' , 'text' =>$data[$key]['end']['properties']['medicinePregnant'] ?? ''],
  923. 'usageDosage' => ['name' => '用法用量' , 'text' =>$data[$key]['end']['properties']['usageDosage'] ?? ''],
  924. 'notes' => ['name' => '注意事项' , 'text' =>$data[$key]['end']['properties']['notes'] ?? ''],
  925. 'periodValidity' => ['name' => '有效期' , 'text' =>$data[$key]['end']['properties']['periodValidity'] ?? ''],
  926. 'indication' => ['name' => '适应症' , 'text' =>$data[$key]['end']['properties']['indication'] ?? ''],
  927. 'storage' => ['name' => '贮藏' , 'text' =>$data[$key]['end']['properties']['storage'] ?? ''],
  928. 'character' => ['name' => '性状' , 'text' =>$data[$key]['end']['properties']['character'] ?? ''],
  929. 'contraindication' => ['name' => '禁忌' , 'text' =>$data[$key]['end']['properties']['contraindication'] ?? ''],
  930. 'pharmacologyToxicology'=> ['name' => '药理毒理' , 'text' =>$data[$key]['end']['properties']['pharmacologyToxicology'] ?? ''],
  931. 'specification' => ['name' => '规格' , 'text' =>$data[$key]['end']['properties']['specification'] ?? ''],
  932. 'approvalNumber' => ['name' => '批准号' , 'text' =>$data[$key]['end']['properties']['approvalNumber'] ?? ''],
  933. 'productionEnterprise' => ['name' => '生产企业' , 'text' =>$data[$key]['end']['properties']['productionEnterprise'] ?? ''],
  934. 'relateSick' => ['name' => '相关疾病' , 'text' =>$data[$key]['end']['properties']['relateSick'] ?? ''],
  935. 'untowardEffect' => ['name' => '不良反应' , 'text' =>$data[$key]['end']['properties']['untowardEffect'] ?? ''],
  936. 'majorConstituent' => ['name' => '主要成分' , 'text' =>$data[$key]['end']['properties']['majorConstituent'] ?? ''],
  937. ];
  938. $data[$key]['end']['properties'] = $listEnd;
  939. $data[$key]['end']['tag'] = 'medicine';
  940. }
  941. if($value['relationship']['type'] == 'LINKINSPECTION') {
  942. $listEnd = [
  943. 'name' => ['name' => '名称' , 'text' => $data[$key]['end']['properties']['name'] ?? ''],
  944. 'overview' => ['name' => '概述' , 'text' => $data[$key]['end']['properties']['overview'] ?? ''],
  945. 'annotation' => ['name' => '附注' , 'text' => $data[$key]['end']['properties']['annotation'] ?? ''],
  946. 'principle' => ['name' => '原理' , 'text' => $data[$key]['end']['properties']['principle'] ?? ''],
  947. 'normalValue' => ['name' => '正常值' , 'text' => $data[$key]['end']['properties']['normalValue'] ?? ''],
  948. 'clinicalSignificance' => ['name' => '临床意义' , 'text' => $data[$key]['end']['properties']['clinicalSignificance'] ?? ''],
  949. 'reagent' => ['name' => '试剂' , 'text' => $data[$key]['end']['properties']['reagent'] ?? ''],
  950. 'operation' => ['name' => '操作方法' , 'text' => $data[$key]['end']['properties']['operation'] ?? ''],
  951. ];
  952. $data[$key]['end']['properties'] = $listEnd;
  953. $data[$key]['end']['tag'] = 'inspection';
  954. }
  955. }
  956. break;
  957. case 'sickness':
  958. $query = "match p = (n:SickNess)-[r:SicknessComplication]-(m:Thing) where n.name= "."'".$name."'"." return p";
  959. $query1 = "match p1 = (n:SickNess)-[r:LInkeMedicineSickness]-(m:Thing) where n.name= "."'".$name."'"." return p1";
  960. $data = $this->getXyR($query , $query1);
  961. $list = [];
  962. foreach ($data as $key => $value) {
  963. $list['ICD10'] = ['name' => 'ICD10' , 'text' => $data[$key]['start']['properties']['ICD10'] ?? ''];
  964. $list['name'] = ['name' => '名称' , 'text' => $data[$key]['start']['properties']['name'] ?? ''];
  965. $list['alias'] = ['name' => '疾病别名' , 'text' => $data[$key]['start']['properties']['alias'] ?? ''];
  966. $list['department'] = ['name' => '疾病类别' , 'text' => $data[$key]['start']['properties']['department'] ?? ''];
  967. $list['complication'] = ['name' => '并发症' , 'text' => $data[$key]['start']['properties']['complication'] ?? ''];
  968. $list['introduction'] = ['name' => '疾病概述' , 'text' => $data[$key]['start']['properties']['introduction'] ?? ''];
  969. $list['epidemiology'] = ['name' => '流行病学' , 'text' => $data[$key]['start']['properties']['epidemiology'] ?? ''];
  970. $list['suitableFood'] = ['name' => '宜吃食物' , 'text' => $data[$key]['start']['properties']['suitableFood'] ?? ''];
  971. $list['notEat'] = ['name' => '忌吃食物' , 'text' => $data[$key]['start']['properties']['notEat'] ?? ''];
  972. $list['diagnostiCtriage'] = ['name' => '诊断鉴别' , 'text' => $data[$key]['start']['properties']['diagnostiCtriage'] ?? ''];
  973. $list['precaution'] = ['name' => '预防' , 'text' => $data[$key]['start']['properties']['precaution'] ?? ''];
  974. $list['nursingInfo'] = ['name' => '护理信息' , 'text' => $data[$key]['start']['properties']['nursingInfo'] ?? ''];
  975. $list['warmPrompt'] = ['name' => '温馨提示' , 'text' => $data[$key]['start']['properties']['warmPrompt'] ?? ''];
  976. $list['recommendedRecipe'] = ['name' => '推荐食谱' , 'text' => $data[$key]['start']['properties']['recommendedRecipe'] ?? ''];
  977. $list['treatmentOverview'] = ['name' => '治疗概述' , 'text' => $data[$key]['start']['properties']['treatmentOverview'] ?? ''];
  978. $list['inspection'] = ['name' => '检查' , 'text' => $data[$key]['start']['properties']['inspection'] ?? ''];
  979. $list['treatmenCommonSense'] = ['name' => '治疗常识' , 'text' => $data[$key]['start']['properties']['treatmenCommonSense'] ?? ''];
  980. $list['pathogenesis'] = ['name' => '病因' , 'text' => $data[$key]['start']['properties']['pathogenesis'] ?? ''];
  981. $list['basicKnowledgel'] = ['name' => '基本常识' , 'text' => $data[$key]['start']['properties']['basicKnowledgel'] ?? ''];
  982. $list['dietHealth'] = ['name' => '饮食保健' , 'text' => $data[$key]['start']['properties']['dietHealth'] ?? ''];
  983. $list['symptom'] = ['name' => '检查' , 'text' => $data[$key]['start']['properties']['symptom'] ?? ''];
  984. $list['complicationsOverview'] = ['name' => '并发症概述' , 'text' => $data[$key]['start']['properties']['complicationsOverview'] ?? ''];
  985. $list['treatmentInfo'] = ['name' => '治疗信息' , 'text' => $data[$key]['start']['properties']['treatmentInfo'] ?? ''];
  986. $data[$key]['start']['properties'] = $list;
  987. $data[$key]['start']['tag'] = $tag;
  988. if($data[$key]['relationship']['type'] == 'SICKNESSCOMPLICATION') {
  989. $listEnd['name'] = ['name' => '疾病名称' , 'text' => $data[$key]['end']['properties']['name']];
  990. $data[$key]['end']['properties'] = $listEnd;
  991. $data[$key]['end']['tag'] = $tag;
  992. }
  993. if($data[$key]['relationship']['type'] == 'LINKEMEDICINESICKNESS') {
  994. $listEnd = [
  995. 'name' => ['name' => '名称' , 'text' =>$data[$key]['end']['properties']['name'] ?? ''],
  996. 'pinyi' => ['name' => '汉语拼音' , 'text' =>$data[$key]['end']['properties']['pinyin'] ?? ''],
  997. 'oldUse' => ['name' => '老人用药' , 'text' =>$data[$key]['end']['properties']['oldUse'] ?? ''],
  998. 'chilldUse' => ['name' => '儿童用药' , 'text' =>$data[$key]['end']['properties']['chilldUse'] ?? ''],
  999. 'medicinePregnant' => ['name' => '孕妇及哺乳期妇女用药' , 'text' =>$data[$key]['end']['properties']['medicinePregnant'] ?? ''],
  1000. 'usageDosage' => ['name' => '用法用量' , 'text' =>$data[$key]['end']['properties']['usageDosage'] ?? ''],
  1001. 'notes' => ['name' => '注意事项' , 'text' =>$data[$key]['end']['properties']['notes'] ?? ''],
  1002. 'periodValidity' => ['name' => '有效期' , 'text' =>$data[$key]['end']['properties']['periodValidity'] ?? ''],
  1003. 'indication' => ['name' => '适应症' , 'text' =>$data[$key]['end']['properties']['indication'] ?? ''],
  1004. 'storage' => ['name' => '贮藏' , 'text' =>$data[$key]['end']['properties']['storage'] ?? ''],
  1005. 'character' => ['name' => '性状' , 'text' =>$data[$key]['end']['properties']['character'] ?? ''],
  1006. 'contraindication' => ['name' => '禁忌' , 'text' =>$data[$key]['end']['properties']['contraindication'] ?? ''],
  1007. 'pharmacologyToxicology'=> ['name' => '药理毒理' , 'text' =>$data[$key]['end']['properties']['pharmacologyToxicology'] ?? ''],
  1008. 'specification' => ['name' => '规格' , 'text' =>$data[$key]['end']['properties']['specification'] ?? ''],
  1009. 'approvalNumber' => ['name' => '批准号' , 'text' =>$data[$key]['end']['properties']['approvalNumber'] ?? ''],
  1010. 'productionEnterprise' => ['name' => '生产企业' , 'text' =>$data[$key]['end']['properties']['productionEnterprise'] ?? ''],
  1011. 'relateSick' => ['name' => '相关疾病' , 'text' =>$data[$key]['end']['properties']['relateSick'] ?? ''],
  1012. 'untowardEffect' => ['name' => '不良反应' , 'text' =>$data[$key]['end']['properties']['untowardEffect'] ?? ''],
  1013. 'majorConstituent' => ['name' => '主要成分' , 'text' =>$data[$key]['end']['properties']['majorConstituent'] ?? ''],
  1014. ];
  1015. $data[$key]['end']['properties'] = $listEnd;
  1016. $data[$key]['end']['tag'] = 'medicine';
  1017. }
  1018. }
  1019. break;
  1020. case 'zysickness':
  1021. case 'icd10':
  1022. $query = "match p = (n:SickNess)-[r:LinkCnPatentMedicine]-(m:Thing) where n.kgid= "."'".$name."'"." return p";
  1023. $query1 = "match p1 = (n:SickNess)-[r:LinkConstitution]-(m:Thing) where n.kgid= "."'".$name."'"." return p1";
  1024. $query2 = "match p2 = (n:SickNess)-[r:LinkPrescription]-(m:Thing) where n.kgid= "."'".$name."'"." return p2";
  1025. $query3 = "match p3 = (n:SickNess)-[r:LinkTonicDiet]-(m:Thing) where n.kgid= "."'".$name."'"." return p3";
  1026. $data = $this->getZyR($query , $query1 , $query2 , $query3);
  1027. if(empty($data) ) {
  1028. $query = "match(n:SickNess) where n.kgid = "."'".$name."'"." return n;";
  1029. $data = $this->getSingle($query , 'zy');
  1030. $data1 = [
  1031. 'ICD10' => ['name' => 'ICD10' , 'text' => $data[0]['start']['properties']['ICD10'] ?? ''],
  1032. 'name' => ['name' => '名称' , 'text' => $data[0]['start']['properties']['name'] ?? ''],
  1033. 'tongueCondition' => ['name' => '舌象' , 'text' => $data[0]['start']['properties']['tongueCondition'] ?? ''],
  1034. 'apparatus' => ['name' => '发病部位' , 'text' => $data[0]['start']['properties']['apparatus'] ?? ''],
  1035. 'source' => ['name' => '数据来源' , 'text' => $data[0]['start']['properties']['source'] ?? ''],
  1036. 'pulseCondition' => ['name' => '脉象' , 'text' => $data[0]['start']['properties']['pulseCondition'] ?? ''],
  1037. 'dietTherapy' => ['name' => '饮食疗法' , 'text' => $data[0]['start']['properties']['dietTherapy'] ?? ''],
  1038. 'symptom' => ['name' => '症见' , 'text' => $data[0]['start']['properties']['symptom'] ?? ''],
  1039. 'department' => ['name' => '科室' , 'text' => $data[0]['start']['properties']['symptom'] ?? ''],
  1040. 'acupuncturePoints' => ['name' => '针灸穴位' , 'text' => $data[0]['start']['properties']['department'] ?? ''],
  1041. 'dialecticalName' => ['name' => '证型' , 'text' => $data[0]['start']['properties']['acupuncturePoints'] ?? ''],
  1042. 'therapeuticMethod' => ['name' => '治疗方法' , 'text' => $data[0]['start']['properties']['dialecticalName'] ?? ''],
  1043. ];
  1044. $data[0]['start']['properties'] = $data1;
  1045. $data[0]['start']['tag'] = $tag;
  1046. } else {
  1047. $list = [];
  1048. foreach ($data as $key => $value) {
  1049. $list['ICD10'] = ['name' => 'ICD10' , 'text' => $data[$key]['start']['properties']['ICD10'] ?? ''];
  1050. $list['name'] = ['name' => '名称' , 'text' => $data[$key]['start']['properties']['name'] ?? ''];
  1051. $list['tongueCondition'] = ['name' => '舌象' , 'text' => $data[$key]['start']['properties']['tongueCondition'] ?? ''];
  1052. $list['apparatus'] = ['name' => '发病部位' , 'text' => $data[$key]['start']['properties']['apparatus'] ?? ''];
  1053. $list['source'] = ['name' => '数据来源' , 'text' => $data[$key]['start']['properties']['source'] ?? ''];
  1054. $list['pulseCondition'] = ['name' => '脉象' , 'text' => $data[$key]['start']['properties']['pulseCondition'] ?? ''];
  1055. $list['dietTherapy'] = ['name' => '饮食疗法' , 'text' => $data[$key]['start']['properties']['dietTherapy'] ?? ''];
  1056. $list['symptom'] = ['name' => '症见' , 'text' => $data[$key]['start']['properties']['symptom'] ?? ''];
  1057. $list['department'] = ['name' => '科室' , 'text' => $data[$key]['start']['properties']['department'] ?? ''];
  1058. $list['acupuncturePoints'] = ['name' => '针灸穴位' , 'text' => $data[$key]['start']['properties']['acupuncturePoints'] ?? ''];
  1059. $list['dialecticalName'] = ['name' => '证型' , 'text' => $data[$key]['start']['properties']['dialecticalName'] ?? ''];
  1060. $list['therapeuticMethod'] = ['name' => '治疗方法' , 'text' => $data[$key]['start']['properties']['therapeuticMethod'] ?? ''];
  1061. $data[$key]['start']['properties'] = $list;
  1062. // 中成药关系
  1063. if($value['relationship']['type'] == 'LINKCNPATENTMEDICINE') {
  1064. $listEnd = [
  1065. 'name' => ['name' => '名称' , 'text' => $data[$key]['end']['properties']['name'] ?? ''],
  1066. 'classification' => ['name' => '分类' , 'text' => $data[$key]['end']['properties']['classification'] ?? ''],
  1067. 'efficacy' => ['name' => '功效' , 'text' => $data[$key]['end']['properties']['efficacy'] ?? ''],
  1068. 'indications' => ['name' => '主治' , 'text' => $data[$key]['end']['properties']['indications'] ?? ''],
  1069. 'source' => ['name' => '数据来源' , 'text' => $data[$key]['end']['properties']['source'] ?? ''],
  1070. ];
  1071. $data[$key]['end']['properties'] = $listEnd;
  1072. $data[$key]['end']['tag'] = 'zcy';
  1073. }
  1074. // 方剂关系
  1075. if($value['relationship']['type'] == 'LINKPRESCRIPTION') {
  1076. $listEnd = [
  1077. 'name' => ['name' => '名称' , 'text' => $data[$key]['end']['properties']['name'] ?? ''],
  1078. 'composition' => ['name' => '方剂组成' , 'text' => $data[$key]['end']['properties']['composition'] ?? ''],
  1079. 'medicinalCrop' => ['name' => '中药' , 'text' => $data[$key]['end']['properties']['medicinalCrop'] ?? ''],
  1080. 'indications' => ['name' => '主治' , 'text' => $data[$key]['end']['properties']['indications'] ?? ''],
  1081. 'solution' => ['name' => '方法/解法' , 'text' => $data[$key]['end']['properties']['solution'] ?? ''],
  1082. 'usageDosage' => ['name' => '用法用量' , 'text' => $data[$key]['end']['properties']['usageDosage'] ?? ''],
  1083. 'source' => ['name' => '数据来源' , 'text' => $data[$key]['end']['properties']['source'] ?? ''],
  1084. ];
  1085. $data[$key]['end']['properties'] = $listEnd;
  1086. $data[$key]['end']['tag'] = 'fj';
  1087. }
  1088. // 药膳关系
  1089. if($value['relationship']['type'] == 'LINKTONICDIET') {
  1090. $listEnd = [
  1091. 'name' => ['name' => '名称' , 'text' => $data[$key]['end']['properties']['name'] ?? ''],
  1092. 'composition' => ['name' => '药膳组成' , 'text' => $data[$key]['end']['properties']['composition'] ?? ''],
  1093. ];
  1094. $data[$key]['end']['properties'] = $listEnd;
  1095. $data[$key]['end']['tag'] = 'ys';
  1096. }
  1097. // 体质关系LinkConstitution
  1098. if($value['relationship']['type'] == 'LINKCONSTITUTION') {
  1099. $listEnd = [
  1100. 'name' => ['name' => '名称' , 'text' => $data[$key]['end']['properties']['name'] ?? ''],
  1101. 'overallFeature' => ['name' => '总体特征' , 'text' => $data[$key]['end']['properties']['overallFeature'] ?? ''],
  1102. 'psychologicalFeature' => ['name' => '心理特征' , 'text' => $data[$key]['end']['properties']['psychologicalFeature'] ?? ''],
  1103. 'commonPerformance' => ['name' => '常见表现' , 'text' => $data[$key]['end']['properties']['commonPerformance'] ?? ''],
  1104. 'tendency' => ['name' => '发病倾向' , 'text' => $data[$key]['end']['properties']['tendency'] ?? ''],
  1105. 'exercise' => ['name' => '体育锻炼' , 'text' => $data[$key]['end']['properties']['exercise'] ?? ''],
  1106. 'meridianHealth' => ['name' => '经络保健' , 'text' => $data[$key]['end']['properties']['meridianHealth'] ?? ''],
  1107. 'medicineRegimen' => ['name' => '药物养生' , 'text' => $data[$key]['end']['properties']['medicineRegimen'] ?? ''],
  1108. 'dietTherapy' => ['name' => '宜食疗' , 'text' => $data[$key]['end']['properties']['dietTherapy'] ?? ''],
  1109. 'notEat' => ['name' => '不宜吃' , 'text' => $data[$key]['end']['properties']['notEat'] ?? ''],
  1110. ];
  1111. $data[$key]['end']['properties'] = $listEnd;
  1112. $data[$key]['end']['tag'] = 'tj';
  1113. }
  1114. }
  1115. }
  1116. break;
  1117. case 'zy':
  1118. // 中药详情图谱
  1119. $query = "match(n:CnMedicinalCrop {kgid:"."'".$name."'"."}) return n";
  1120. $data = $this->getSingle($query , 'zy');
  1121. $data1['name'] = ['name' => '名称' , 'text' => $data[0]['start']['properties']['name'] ?? ''];
  1122. $data1['toxicity'] = ['name' => '毒性' , 'text' => $data[0]['start']['properties']['toxicity'] ?? ''];
  1123. $data1['indications'] = ['name' => '功能主治' , 'text' => $data[0]['start']['properties']['indications'] ?? ''];
  1124. $data1['source'] = ['name' => '来源' , 'text' => $data[0]['start']['properties']['source'] ?? ''];
  1125. $data1['pharmacology'] = ['name' => '药理作用' , 'text' => $data[0]['start']['properties']['pharmacology'] ?? ''];
  1126. $data1['includedIn'] = ['name' => '收录于' , 'text' => $data[0]['start']['properties']['includedIn'] ?? ''];
  1127. $data[0]['start']['properties'] = $data1;
  1128. $data[0]['start']['tag'] = 'zy';
  1129. break;
  1130. case 'medicine':
  1131. $query = "match(n:MedicineProduction {name:"."'".$name."'"."}) return n";
  1132. $data = $this->getSingle($query);
  1133. $data1 = [
  1134. 'name' => ['name' => '名称' , 'text' =>$data[0]['start']['properties']['name'] ?? ''],
  1135. 'pinyi' => ['name' => '汉语拼音' , 'text' =>$data[0]['start']['properties']['pinyin'] ?? ''],
  1136. 'oldUse' => ['name' => '老人用药' , 'text' =>$data[0]['start']['properties']['oldUse'] ?? ''],
  1137. 'chilldUse' => ['name' => '儿童用药' , 'text' =>$data[0]['start']['properties']['chilldUse'] ?? ''],
  1138. 'medicinePregnant' => ['name' => '孕妇及哺乳期妇女用药' , 'text' =>$data[0]['start']['properties']['medicinePregnant'] ?? ''],
  1139. 'usageDosage' => ['name' => '用法用量' , 'text' =>$data[0]['start']['properties']['usageDosage'] ?? ''],
  1140. 'notes' => ['name' => '注意事项' , 'text' =>$data[0]['start']['properties']['notes'] ?? ''],
  1141. 'periodValidity' => ['name' => '有效期' , 'text' =>$data[0]['start']['properties']['periodValidity'] ?? ''],
  1142. 'indication' => ['name' => '适应症' , 'text' =>$data[0]['start']['properties']['indication'] ?? ''],
  1143. 'storage' => ['name' => '贮藏' , 'text' =>$data[0]['start']['properties']['storage'] ?? ''],
  1144. 'character' => ['name' => '性状' , 'text' =>$data[0]['start']['properties']['character'] ?? ''],
  1145. 'contraindication' => ['name' => '禁忌' , 'text' =>$data[0]['start']['properties']['contraindication'] ?? ''],
  1146. 'pharmacologyToxicology'=> ['name' => '药理毒理' , 'text' =>$data[0]['start']['properties']['pharmacologyToxicology'] ?? ''],
  1147. 'specification' => ['name' => '规格' , 'text' =>$data[0]['start']['properties']['specification'] ?? ''],
  1148. 'approvalNumber' => ['name' => '批准号' , 'text' =>$data[0]['start']['properties']['approvalNumber'] ?? ''],
  1149. 'productionEnterprise' => ['name' => '生产企业' , 'text' =>$data[0]['start']['properties']['productionEnterprise'] ?? ''],
  1150. 'relateSick' => ['name' => '相关疾病' , 'text' =>$data[0]['start']['properties']['relateSick'] ?? ''],
  1151. 'untowardEffect' => ['name' => '不良反应' , 'text' =>$data[0]['start']['properties']['untowardEffect'] ?? ''],
  1152. 'majorConstituent' => ['name' => '主要成分' , 'text' =>$data[0]['start']['properties']['majorConstituent'] ?? ''],
  1153. ];
  1154. $data[0]['start']['properties'] = $data1;
  1155. $data[0]['start']['tag'] = $tag;
  1156. break;
  1157. case 'inspection':
  1158. $query = "match(n:Inspection {name:"."'".$name."'"."}) return n";
  1159. $data = $this->getSingle($query);
  1160. $data1 = [
  1161. 'name' => ['name' => '名称' , 'text' => $data[0]['start']['properties']['name'] ?? ''],
  1162. 'overview' => ['name' => '概述' , 'text' => $data[0]['start']['properties']['overview'] ?? ''],
  1163. 'annotation' => ['name' => '附注' , 'text' => $data[0]['start']['properties']['annotation'] ?? ''],
  1164. 'principle' => ['name' => '原理' , 'text' => $data[0]['start']['properties']['principle'] ?? ''],
  1165. 'normalValue' => ['name' => '正常值' , 'text' => $data[0]['start']['properties']['normalValue'] ?? ''],
  1166. 'clinicalSignificance' => ['name' => '临床表现' , 'text' => $data[0]['start']['properties']['clinicalSignificance'] ?? ''],
  1167. 'reagent' => ['name' => '试剂' , 'text' => $data[0]['start']['properties']['reagent'] ?? ''],
  1168. 'operation' => ['name' => '操作方法' , 'text' => $data[0]['start']['properties']['operation'] ?? ''],
  1169. ];
  1170. $data[0]['start']['properties'] = $data1;
  1171. $data[0]['start']['tag'] = $tag;
  1172. break;
  1173. case 'zcy':
  1174. $query = "match(n:CnPatentMedicine {name:"."'".$name."'"."}) return n";
  1175. $data = $this->getSingle($query , 'zy');
  1176. $data1 = [
  1177. 'name' => ['name' => '名称' , 'text' => $data[0]['start']['properties']['name'] ?? ''],
  1178. 'classification' => ['name' => '分类' , 'text' => $data[0]['start']['properties']['classification'] ?? ''],
  1179. 'efficacy' => ['name' => '功效' , 'text' => $data[0]['start']['properties']['efficacy'] ?? ''],
  1180. 'indications' => ['name' => '主治' , 'text' => $data[0]['start']['properties']['indications'] ?? ''],
  1181. 'source' => ['name' => '数据来源' , 'text' => $data[0]['start']['properties']['source'] ?? ''],
  1182. ];
  1183. $data[0]['start']['properties'] = $data1;
  1184. $data[0]['start']['tag'] = $tag;
  1185. break;
  1186. case 'ys':
  1187. // 中医药膳 [LinkTonicDiet 药膳关系 ]
  1188. $query = "match p = (n:SickNess)-[r:LinkTonicDiet]-(m:Thing) where m.name= "."'".$name."'"." return p";
  1189. $data = $this->getZyR($query , '' , '' , '');
  1190. $dataTwo = $data;
  1191. $list = [];
  1192. foreach ($data as $key => $value) {
  1193. $list['name'] = ['name' => '名称' , 'text' => $data[$key]['end']['properties']['name'] ?? ''];
  1194. $list['composition'] = ['name' => '药膳组成' , 'text' => $data[$key]['end']['properties']['composition'] ?? ''];
  1195. $listEnd['ICD10'] = ['name' => 'ICD10' , 'text' => $data[$key]['start']['properties']['ICD10'] ?? ''];
  1196. $listEnd['name'] = ['name' => '名称' , 'text' => $data[$key]['start']['properties']['name'] ?? ''];
  1197. $listEnd['tongueCondition'] = ['name' => '舌象' , 'text' => $data[$key]['start']['properties']['tongueCondition'] ?? ''];
  1198. $listEnd['apparatus'] = ['name' => '发病部位' , 'text' => $data[$key]['start']['properties']['apparatus'] ?? ''];
  1199. $listEnd['source'] = ['name' => '数据来源' , 'text' => $data[$key]['start']['properties']['source'] ?? ''];
  1200. $listEnd['pulseCondition'] = ['name' => '脉象' , 'text' => $data[$key]['start']['properties']['pulseCondition'] ?? ''];
  1201. $listEnd['dietTherapy'] = ['name' => '饮食疗法' , 'text' => $data[$key]['start']['properties']['dietTherapy'] ?? ''];
  1202. $listEnd['symptom'] = ['name' => '症见' , 'text' => $data[$key]['start']['properties']['symptom'] ?? ''];
  1203. $listEnd['department'] = ['name' => '科室' , 'text' => $data[$key]['start']['properties']['department'] ?? ''];
  1204. $listEnd['acupuncturePoints'] = ['name' => '针灸穴位' , 'text' => $data[$key]['start']['properties']['acupuncturePoints'] ?? ''];
  1205. $listEnd['dialecticalName'] = ['name' => '证型' , 'text' => $data[$key]['start']['properties']['dialecticalName'] ?? ''];
  1206. $listEnd['therapeuticMethod'] = ['name' => '治疗方法' , 'text' => $data[$key]['start']['properties']['therapeuticMethod'] ?? ''];
  1207. $listEnd['kgid'] = ['name' => 'kgid' , 'text' => $data[$key]['start']['properties']['kgid'] ?? ''];
  1208. // 调换id
  1209. $startIdentity = $data[$key]['end']['identity'];
  1210. $endIdentity = $data[$key]['start']['identity'];
  1211. $data[$key]['start']['properties'] = $list;
  1212. $data[$key]['start']['tag'] = $tag;
  1213. $data[$key]['start']['identity'] = $startIdentity;
  1214. $data[$key]['end']['properties'] = $listEnd;
  1215. $data[$key]['end']['tag'] = 'zysickness';
  1216. $data[$key]['end']['identity'] = $endIdentity;
  1217. }
  1218. break;
  1219. case 'fj':
  1220. $query = "match(n:Prescription {name:"."'".$name."'"."}) return n";
  1221. $data = $this->getSingle($query , 'zy');
  1222. $data1 = [
  1223. 'name' => ['name' => '名称' , 'text' => $data[0]['start']['properties']['name'] ?? ''],
  1224. 'composition' => ['name' => '方剂组成' , 'text' => $data[0]['start']['properties']['composition'] ?? ''],
  1225. 'medicinalCrop' => ['name' => '中药' , 'text' => $data[0]['start']['properties']['medicinalCrop'] ?? ''],
  1226. 'indications' => ['name' => '主治' , 'text' => $data[0]['start']['properties']['indications'] ?? ''],
  1227. 'solution' => ['name' => '方法/解法' , 'text' => $data[0]['start']['properties']['solution'] ?? ''],
  1228. 'usageDosage' => ['name' => '用法用量' , 'text' => $data[0]['start']['properties']['usageDosage'] ?? ''],
  1229. 'source' => ['name' => '数据来源' , 'text' => $data[0]['start']['properties']['source'] ?? ''],
  1230. ];
  1231. $data[0]['start']['properties'] = $data1;
  1232. $data[0]['start']['tag'] = $tag;
  1233. break;
  1234. case 'tz':
  1235. $query = "match(n:Constitution {name:"."'".$name."'"."}) return n";
  1236. $data = $this->getSingle($query , 'zy');
  1237. $data1 = [
  1238. 'name' => ['name' => '名称' , 'text' => $data[0]['start']['properties']['name'] ?? ''],
  1239. 'overallFeature' => ['name' => '总体特征' , 'text' => $data[0]['start']['properties']['overallFeature'] ?? ''],
  1240. 'psychologicalFeature' => ['name' => '心理特征' , 'text' => $data[0]['start']['properties']['psychologicalFeature'] ?? ''],
  1241. 'commonPerformance' => ['name' => '常见表现' , 'text' => $data[0]['start']['properties']['commonPerformance'] ?? ''],
  1242. 'tendency' => ['name' => '发病倾向' , 'text' => $data[0]['start']['properties']['tendency'] ?? ''],
  1243. 'exercise' => ['name' => '体育锻炼' , 'text' => $data[0]['start']['properties']['exercise'] ?? ''],
  1244. 'meridianHealth' => ['name' => '经络保健' , 'text' => $data[0]['start']['properties']['meridianHealth'] ?? ''],
  1245. 'medicineRegimen' => ['name' => '药物养生' , 'text' => $data[0]['start']['properties']['medicineRegimen'] ?? ''],
  1246. 'dietTherapy' => ['name' => '宜食疗' , 'text' => $data[0]['start']['properties']['dietTherapy'] ?? ''],
  1247. 'notEat' => ['name' => '不宜吃' , 'text' => $data[0]['start']['properties']['notEat'] ?? ''],
  1248. ];
  1249. $data[0]['start']['properties'] = $data1;
  1250. $data[0]['start']['tag'] = $tag;
  1251. break;
  1252. case 'xw':
  1253. $query = "match(n:Acupoint {name:"."'".$name."'"."}) return n";
  1254. $data = $this->getSingle($query , 'zy');
  1255. $data1 = [
  1256. 'name' => ['name' => '名称' , 'text' => $data[0]['start']['properties']['name'] ?? ''],
  1257. 'location' => ['name' => '定位' , 'text' => $data[0]['start']['properties']['location'] ?? ''],
  1258. 'indications' => ['name' => '主治' , 'text' => $data[0]['start']['properties']['indications'] ?? ''],
  1259. 'compatibility' => ['name' => '配伍' , 'text' => $data[0]['start']['properties']['compatibility'] ?? ''],
  1260. 'acupuncture' => ['name' => '针灸法' , 'text' => $data[0]['start']['properties']['acupuncture'] ?? ''],
  1261. 'notions' => ['name' => '附注' , 'text' => $data[0]['start']['properties']['notions'] ?? ''],
  1262. ];
  1263. $data[0]['start']['properties'] = $data1;
  1264. $data[0]['start']['tag'] = $tag;
  1265. break;
  1266. case 'jl':
  1267. $query = "match(n:ChannelCollateral {kgid:"."'".$name."'"."}) return n";
  1268. $data = $this->getSingle($query , 'zy');
  1269. $data1 = [
  1270. 'name' => ['name' => '名称' , 'text' => $data[0]['start']['properties']['name'] ?? ''],
  1271. 'indications' => ['name' => '主治' , 'text' => $data[0]['start']['properties']['indications'] ?? ''],
  1272. 'channelSymptom' => ['name' => '经脉循行及其病候' , 'text' => $data[0]['start']['properties']['channelSymptom'] ?? ''],
  1273. 'collateralSymptom' => ['name' => '络脉循行及其病候' , 'text' => $data[0]['start']['properties']['collateralSymptom'] ?? ''],
  1274. 'divergentMeridian' => ['name' => '经别循行' , 'text' => $data[0]['start']['properties']['divergentMeridian'] ?? ''],
  1275. 'aponeuroticSystem' => ['name' => '经筋循行及其病候' , 'text' => $data[0]['start']['properties']['aponeuroticSystem'] ?? ''],
  1276. 'clinicalFeature' => ['name' => '经络症状主要临床表现' , 'text' => $data[0]['start']['properties']['clinicalFeature'] ?? ''],
  1277. 'mechanismAnalysis' => ['name' => '经络病机分析' , 'text' => $data[0]['start']['properties']['mechanismAnalysis'] ?? ''],
  1278. 'source' => ['name' => '数据来源' , 'text' => $data[0]['start']['properties']['source'] ?? ''],
  1279. ];
  1280. $data[0]['start']['properties'] = $data1;
  1281. $data[0]['start']['tag'] = $tag;
  1282. break;
  1283. case 'symptom':
  1284. $query = "match p = (n:Thing)-[r:LinkDiseaseSymptom]-(m:Disease) where n.name= "."'".$name."'"." return p";
  1285. $data = $this->getXyR($query);
  1286. if(empty($data)) {
  1287. $query = "match(n:Symptom {name:"."'".$name."'"."}) return n";
  1288. $data = $this->getSingle($query);
  1289. $data1 = [
  1290. 'name' => ['name' => '名称' , 'text' => $data[0]['start']['properties']['name'] ?? ''],
  1291. 'indications' => ['name' => '主治' , 'text' => $data[0]['start']['properties']['indications'] ?? ''],
  1292. 'channelSymptom' => ['name' => '经脉循行及其病候' , 'text' => $data[0]['start']['properties']['channelSymptom'] ?? ''],
  1293. 'collateralSymptom' => ['name' => '络脉循行及其病候' , 'text' => $data[0]['start']['properties']['collateralSymptom'] ?? ''],
  1294. 'divergentMeridian' => ['name' => '经别循行' , 'text' => $data[0]['start']['properties']['divergentMeridian'] ?? ''],
  1295. 'aponeuroticSystem' => ['name' => '经筋循行及其病候' , 'text' => $data[0]['start']['properties']['aponeuroticSystem'] ?? ''],
  1296. 'clinicalFeature' => ['name' => '经络症状主要临床表现' , 'text' => $data[0]['start']['properties']['clinicalFeature'] ?? ''],
  1297. 'mechanismAnalysis' => ['name' => '经络病机分析' , 'text' => $data[0]['start']['properties']['mechanismAnalysis'] ?? ''],
  1298. 'source' => ['name' => '数据来源' , 'text' => $data[0]['start']['properties']['source'] ?? ''],
  1299. ];
  1300. $data[0]['start']['properties'] = $data1;
  1301. $data[0]['start']['tag'] = $tag;
  1302. } else {
  1303. foreach ($data as $key => $value)
  1304. {
  1305. $data[$key]['start'] = $value['end'];
  1306. $data[$key]['end'] = $value['start'];
  1307. $data[$key]['relationship']['start'] = $value['relationship']['end'];
  1308. $data[$key]['relationship']['end'] = $value['relationship']['start'];
  1309. $list['name'] = ['name' => '名称' , 'text' => $data[$key]['start']['properties']['name'] ?? ''];
  1310. $list['identify'] = ['name' => '识别' , 'text' => $data[$key]['start']['properties']['identify'] ?? ''];
  1311. $list['abstract'] = ['name' => '摘要' , 'text' => $data[$key]['start']['properties']['abstract'] ?? ''];
  1312. $list['precaution'] = ['name' => '预防措施' , 'text' => $data[$key]['start']['properties']['precaution'] ?? ''];
  1313. $list['inspection'] = ['name' => '检查' , 'text' => $data[$key]['start']['properties']['inspection'] ?? ''];
  1314. $list['etiology'] = ['name' => '病理' , 'text' => $data[$key]['start']['properties']['etiology'] ?? ''];
  1315. $list['department'] = ['name' => '科室' , 'text' => $data[$key]['start']['properties']['department'] ?? ''];
  1316. $data[$key]['start']['properties'] = $list;
  1317. $data[$key]['start']['tag'] = 'symptom';
  1318. $listEnd['name'] = ['name' => '名称' , 'text' => $data[$key]['end']['properties']['name'] ?? ''];
  1319. $data[$key]['end']['properties'] = $listEnd;
  1320. }
  1321. }
  1322. break;
  1323. }
  1324. return $this->_json_succ($data);
  1325. }
  1326. // 搜索
  1327. public function search()
  1328. {
  1329. //if(!$this->checkIslogin()) return $this->_json_error('请登录后查看!');
  1330. $tag = Request::param('tag') ?? 'sickness';
  1331. $search = Request::param('search') ?? '';
  1332. $pn = Request::param('pn') ?? 1;
  1333. $pagesize = 20;
  1334. $limit = ($pn - 1) * $pagesize;
  1335. if(!$tag || !$search) {
  1336. return $this->_json_error('请求参数有误!');
  1337. }
  1338. switch ($tag) {
  1339. case "disease":
  1340. $query = "match(n:Disease) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize";
  1341. $info = $this->getAboutInfo($query);
  1342. $info = array_column($info , 'n');
  1343. $list = [];
  1344. foreach ($info as $key => $value) {
  1345. $list[$key]['sickness_name'] = $value['name'];
  1346. $list[$key]['symptom'] = ['name' => '临床表现' , 'text' => $value['clinicalFeature'] ?? '' , 'active' => true];
  1347. $list[$key]['pathogenesis'] = ['name' => '病因' , 'text' => $value['pathogenesis'] ?? '' , 'active' => false];
  1348. $list[$key]['complicationsOverview'] = ['name' => '并发症' , 'text' => $value['complicationsOverview'] ?? '' , 'active' => false];
  1349. $list[$key]['inspection'] = ['name' => '辅助检查' , 'text' => $value['auxiliaryExamination'] ?? '' , 'active' => false];
  1350. $list[$key]['treatmenCommonSense'] = ['name' => '治疗' , 'text' => $value['treatment'] ?? '' , 'active' => false];
  1351. $list[$key]['diagnostiCtriage'] = ['name' => '诊断' , 'text' => $value['diagnosis'] ?? '' , 'active' => false];
  1352. }
  1353. break;
  1354. case "medicine":
  1355. $query = "match(n:MedicineProduction) where n.name =~'.*".$search.".*' return
  1356. n.name as name , n.pinyin as pinyin , n.usageDosage as usageDosage ,
  1357. n.notes as notes , n.periodValidity as periodValidity ,
  1358. n.indication as indication , n.storage as storage , n.character as character ,
  1359. n.approvalNumber as approvalNumber ,
  1360. n.productionEnterprise as productionEnterprise , n.relateSick as relateSick ,
  1361. n.untowardEffect as untowardEffect , n.majorConstituent as majorConstituent
  1362. skip $limit limit 20";
  1363. $data = $this->getAboutInfo($query);
  1364. $list = [];
  1365. foreach ($data as $key => $value) {
  1366. $list[$key]['sickness_name'] = $value['name'];
  1367. $list[$key]['pinyi'] = ['name' => '汉语拼音' , 'text' => $value['pinyin'] , 'active' => false];
  1368. $list[$key]['usageDosage'] = ['name' => '用法用量' , 'text' => $value['usageDosage'] , 'active' => false];
  1369. $list[$key]['notes'] = ['name' => '注意事项' , 'text' => $value['notes'] , 'active' => false];
  1370. $list[$key]['periodValidity'] = ['name' => '有效期' , 'text' => $value['periodValidity'], 'active' => false];
  1371. $list[$key]['indication'] = ['name' => '适应症' , 'text' => $value['indication'], 'active' => false];
  1372. $list[$key]['storage'] = ['name' => '贮藏' , 'text' => $value['storage'], 'active' => false];
  1373. $list[$key]['character'] = ['name' => '性状' , 'text' => $value['character'], 'active' => false];
  1374. $list[$key]['approvalNumber'] = ['name' => '批准号' , 'text' => $value['approvalNumber'], 'active' => false];
  1375. $list[$key]['productionEnterprise'] = ['name' => '生产企业' , 'text' => $value['productionEnterprise'], 'active' => false];
  1376. $list[$key]['relateSick'] = ['name' => '相关疾病' , 'text' => $value['relateSick'], 'active' => false];
  1377. $list[$key]['untowardEffect'] = ['name' => '不良反应' , 'text' => $value['untowardEffect'], 'active' => false];
  1378. $list[$key]['majorConstituent'] = ['name' => '主要成分' , 'text' => $value['majorConstituent'], 'active' => true];
  1379. }
  1380. break;
  1381. case "sickness":
  1382. $query = "match(n:SickNess) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize";
  1383. $info = $this->getAboutInfo($query);
  1384. $info = array_column($info , 'n');
  1385. $list = [];
  1386. foreach ($info as $key => $value) {
  1387. $list[$key]['sickness_name'] = $value['name'];
  1388. $list[$key]['symptom'] = ['name' => '临床表现' , 'text' => $value['symptom'] ?? '' , 'active' => true];
  1389. $list[$key]['pathogenesis'] = ['name' => '病因' , 'text' => $value['pathogenesis'] ?? '' , 'active' => false];
  1390. $list[$key]['complicationsOverview'] = ['name' => '并发症' , 'text' => $value['complicationsOverview'] ?? '' , 'active' => false];
  1391. $list[$key]['inspection'] = ['name' => '辅助检查' , 'text' => $value['inspection'] ?? '' , 'active' => false];
  1392. $list[$key]['treatmenCommonSense'] = ['name' => '治疗' , 'text' => $value['treatmenCommonSense'] ??'' , 'active' => false];
  1393. $list[$key]['diagnostiCtriage'] = ['name' => '诊断' , 'text' => $value['diagnostiCtriage'] ?? '' , 'active' => false];
  1394. }
  1395. break;
  1396. case "inspection":
  1397. $query = "match(n:Inspection) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize";
  1398. $data = $this->getAboutInfo($query);
  1399. $info = array_column($data , 'n');
  1400. foreach ($info as $key => $value) {
  1401. $list[$key]['sickness_name'] = $value['name'];
  1402. $list[$key]['annotation'] = ['name' => '附注' , 'text' => $value['annotation'] ?? '', 'active' => true];
  1403. $list[$key]['principle'] = ['name' => '根源' , 'text' => $value['principle'] ?? '', 'active' => false];
  1404. $list[$key]['normalValue'] = ['name' => '正常值' , 'text' => $value['normalValue'] ?? '', 'active' => false];
  1405. $list[$key]['clinicalSignificance'] = ['name' => '临床意义' , 'text' => $value['clinicalSignificance'] ?? '', 'active' => false];
  1406. $list[$key]['reagent'] = ['name' => '试剂' , 'text' => $value['reagent'] ?? '', 'active' => false];
  1407. $list[$key]['operation'] = ['name' => '操作方法' , 'text' => $value['operation'] ?? '', 'active' => false];
  1408. }
  1409. break;
  1410. case 'zysickness':
  1411. $query = "match(n:SickNess) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize";
  1412. $data = $this->getAboutInfo($query , 'zy');
  1413. $data = array_column($data , 'n');
  1414. $list = [];
  1415. foreach ($data as $key => $value) {
  1416. $list[$key]['name'] = $value['name'];
  1417. $list[$key]['tongueCondition'] = ['name' => '舌象' , 'text' => $value['tongueCondition'] ?? '' , 'active' => true];
  1418. $list[$key]['apparatus'] = ['name' => '发病部位' , 'text' => $value['apparatus'] ?? '' , 'active' => false];
  1419. $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false];
  1420. $list[$key]['pulseCondition'] = ['name' => '脉象' , 'text' => $value['pulseCondition'] ?? '' , 'active' => false];
  1421. $list[$key]['dietTherapy'] = ['name' => '饮食疗法' , 'text' => $value['dietTherapy'] ?? '' , 'active' => false];
  1422. $list[$key]['symptom'] = ['name' => '症见' , 'text' => $value['symptom'] ?? '' , 'active' => false];
  1423. $list[$key]['department'] = ['name' => '科室' , 'text' => $value['department'] ?? '' , 'active' => false];
  1424. $list[$key]['acupuncturePoints'] = ['name' => '针灸穴位' , 'text' => $value['acupuncturePoints'] ?? '' , 'active' => false];
  1425. $list[$key]['dialecticalName'] = ['name' => '辩证法名' , 'text' => $value['dialecticalName'] ?? '' , 'active' => false];
  1426. }
  1427. break;
  1428. case 'zy':
  1429. $query = "match(n:CnMedicinalCrop) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize";
  1430. $data = $this->getAboutInfo($query , 'zy');
  1431. $data = array_column($data , 'n');
  1432. $list = [];
  1433. foreach ($data as $key => $value) {
  1434. $list[$key]['name'] = $value['name'];
  1435. $list[$key]['toxicity'] = ['name' => '毒性' , 'text' => $value['toxicity'] ?? '' , 'active' => true];
  1436. $list[$key]['indications'] = ['name' => '适应症' , 'text' => $value['indications'] ?? '' , 'active' => false];
  1437. $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false];
  1438. $list[$key]['medicineProperty'] = ['name' => '医药物业' , 'text' => $value['medicineProperty'] ?? '' , 'active' => false];
  1439. $list[$key]['includedIn'] = ['name' => '包括在' , 'text' => $value['includedIn'] ?? '' , 'active' => false];
  1440. $list[$key]['pharmacology'] = ['name' => '药理' , 'text' => $value['pharmacology '] ?? '' , 'active' => false];
  1441. }
  1442. break;
  1443. case 'zcy':
  1444. $query = "match(n:CnPatentMedicine) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize";
  1445. $data = $this->getAboutInfo($query , 'zy');
  1446. $data = array_column($data , 'n');
  1447. $list = [];
  1448. foreach ($data as $key => $value) {
  1449. $list[$key]['name'] = $value['name'];
  1450. $list[$key]['classification'] = ['name' => '实体值' , 'text' => $value['classification'] ?? '' , 'active' => true];
  1451. $list[$key]['efficacy'] = ['name' => '功效' , 'text' => $value['efficacy'] ?? '' , 'active' => false];
  1452. $list[$key]['indications'] = ['name' => '主治' , 'text' => $value['indications'] ?? '' , 'active' => false];
  1453. $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false];
  1454. }
  1455. break;
  1456. case 'fj':
  1457. $query = "match(n:Prescription) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize";
  1458. $data = $this->getAboutInfo($query , 'zy');
  1459. $data = array_column($data , 'n');
  1460. $list = [];
  1461. foreach ($data as $key => $value) {
  1462. $list[$key]['name'] = $value['name'];
  1463. $list[$key]['composition'] = ['name' => '方剂组成' , 'text' => $value['composition'] ?? '' , 'active' => true];
  1464. $list[$key]['medicinalCrop'] = ['name' => '中药' , 'text' => $value['medicinalCrop'] ?? '' , 'active' => false];
  1465. $list[$key]['indications'] = ['name' => '主治' , 'text' => $value['indications'] ?? '' , 'active' => false];
  1466. $list[$key]['solution'] = ['name' => '方法/解法' , 'text' => $value['solution'] ?? '' , 'active' => false];
  1467. $list[$key]['usageDosage'] = ['name' => '用法用量' , 'text' => $value['usageDosage'] ?? '' , 'active' => false];
  1468. $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false];
  1469. }
  1470. break;
  1471. case 'ys':
  1472. $query = "match(n:TonicDiet) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize";
  1473. $data = $this->getAboutInfo($query , 'zy');
  1474. $data = array_column($data , 'n');
  1475. $list = [];
  1476. foreach ($data as $key => $value) {
  1477. $list[$key]['name'] = $value['name'];
  1478. $list[$key]['composition'] = ['name' => '药膳组成' , 'text' => $value['composition'] ?? '' , 'active' => true];
  1479. }
  1480. break;
  1481. case 'jl':
  1482. $query = "match(n:ChannelCollateral) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize";
  1483. $data = $this->getAboutInfo($query , 'zy');
  1484. $data = array_column($data , 'n');
  1485. $list = [];
  1486. foreach ($data as $key => $value) {
  1487. $list[$key]['name'] = $value['name'];
  1488. $list[$key]['indications'] = ['name' => '主治' , 'text' => $value['aponeuroticSystem'] ?? '' , 'active' => true];
  1489. $list[$key]['channelSymptom'] = ['name' => '经脉循行及其病候' , 'text' => $value['channelSymptom'] ?? '' , 'active' => false];
  1490. $list[$key]['collateralSymptom'] = ['name' => '络脉循行及其病候' , 'text' => $value['collateralSymptom'] ?? '' , 'active' => false];
  1491. $list[$key]['divergentMeridian'] = ['name' => '经别循行' , 'text' => $value['divergentMeridian'] ?? '' , 'active' => false];
  1492. $list[$key]['aponeuroticSystem'] = ['name' => '经筋循行及其病候' , 'text' => $value['aponeuroticSystem'] ?? '' , 'active' => false];
  1493. $list[$key]['clinicalFeature'] = ['name' => '经络症状主要临床表现' , 'text' => $value['clinicalFeature'] ?? '' , 'active' => false];
  1494. $list[$key]['mechanismAnalysis'] = ['name' => '经络病机分析' , 'text' => $value['mechanismAnalysis'] ?? '' , 'active' => false];
  1495. $list[$key]['source'] = ['name' => '数据来源' , 'text' => $value['source'] ?? '' , 'active' => false];
  1496. $list[$key]['kgid'] = ['name' => 'kgid' , 'text' => $value['kgid'] ?? '' , 'active' => false];
  1497. }
  1498. break;
  1499. case 'xw':
  1500. $query = "match(n:Acupoint) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize";
  1501. $data = $this->getAboutInfo($query , 'zy');
  1502. $data = array_column($data , 'n');
  1503. $list = [];
  1504. foreach ($data as $key => $value) {
  1505. $list[$key]['name'] = $value['name'];
  1506. $list[$key]['location'] = ['name' => '定位' , 'text' => $value['location'] ?? '' , 'active' => true];
  1507. $list[$key]['indications'] = ['name' => '主治' , 'text' => $value['indications'] ?? '' , 'active' => false];
  1508. $list[$key]['compatibility'] = ['name' => '配伍' , 'text' => $value['compatibility'] ?? '' , 'active' => false];
  1509. $list[$key]['acupuncture'] = ['name' => '针灸法' , 'text' => $value['acupuncture'] ?? '' , 'active' => false];
  1510. $list[$key]['notions'] = ['name' => '附注' , 'text' => $value['notions'] ?? '' , 'active' => false];
  1511. }
  1512. break;
  1513. case 'symptom':
  1514. $query = "match(n:Symptom) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize";
  1515. $data = $this->getAboutInfo($query);
  1516. $data = array_column($data , 'n');
  1517. $list = [];
  1518. foreach ($data as $key => $value) {
  1519. $list[$key]['sickness_name'] = $value['name'];
  1520. $list[$key]['identify'] = ['name' => '识别' , 'text' => $value['identify'] ?? '' , 'active' => true];
  1521. $list[$key]['abstract'] = ['name' => '摘要' , 'text' => $value['abstract'] ?? '' , 'active' => false];
  1522. $list[$key]['precaution'] = ['name' => '预防措施' , 'text' => $value['precaution'] ?? '' , 'active' => false];
  1523. $list[$key]['inspection'] = ['name' => '检查' , 'text' => $value['inspection'] ?? '' , 'active' => false];
  1524. $list[$key]['etiology'] = ['name' => '病理' , 'text' => $value['etiology'] ?? '' , 'active' => false];
  1525. $list[$key]['department'] = ['name' => '科室' , 'text' => $value['department'] ?? '' , 'active' => false];
  1526. }
  1527. break;
  1528. case "identify":
  1529. $query = "match(n:Disease) where n.name =~'.*".$search.".*' return n skip $limit limit $pagesize";
  1530. $data = $this->getAboutInfo($query);
  1531. $data = array_column($data , 'n');
  1532. $list = [];
  1533. foreach ($data as $key => $value) {
  1534. $list[$key]['sickness_name'] = $value['name'];
  1535. $list[$key]['antidiastole'] = ['name' => '鉴别诊断' , 'text' => $value['antidiastole'] ?? '' , 'active' => true];
  1536. }
  1537. break;
  1538. }
  1539. return $this->_json_succ($list);
  1540. }
  1541. // 问答
  1542. public function qw()
  1543. {
  1544. //if(!$this->checkIslogin()) return $this->_json_error('请登录后查看!');
  1545. $question = Request::param('question') ?? '';
  1546. $param = urlencode($question);
  1547. $url = "http://121.43.229.91:9000/info?sen=" . $param;
  1548. $data = file_get_contents($url);
  1549. $arr = json_decode($data , true);
  1550. $answer = ['text' => $arr['search_info'] , 'type' => 1 , 'name' => '智能客服' , 'time' => date('Y-m-d H:i:s')];
  1551. return $this->_json_succ(['answer' => $answer]);
  1552. }
  1553. }