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