NeojApi.php 129 KB

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