123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505 |
- <?php
- namespace App\Admin\Controllers;
- use App\Http\Controllers\Controller;
- use App\Model\Xyzsk;
- use Encore\Admin\Show;
- use Encore\Admin\Form;
- use Encore\Admin\Grid;
- use Encore\Admin\Facades\Admin;
- use Encore\Admin\Layout\Content;
- use Encore\Admin\Controllers\ModelForm;
- use Illuminate\Support\Facades\Request;
- class XyzskController extends Controller
- {
- use ModelForm;
- public function index()
- {
- return Admin::content(function (Content $content) {
- $content->header('西医知识库');
- $content->description('列表');
- $content->body($this->grid());
- });
- }
- public function create()
- {
- return Admin::content(function (Content $content) {
- $content->header('西医知识库');
- $content->description('新增');
- $content->body($this->form());
- });
- }
- public function edit($id)
- {
- return Admin::content(function (Content $content) use ($id) {
- $content->header('西医知识库');
- $content->description();
- $content->body($this->form($id)->edit($id));
- });
- }
- protected function show($id)
- {
- $xyzsk = new Xyzsk();
- $show = new Show($xyzsk->findOrFail($id));
- $show->field('name' , '名称');
- $label = $xyzsk->getlabel($id);
- switch ($label) {
- case 'SickNess':
- $show->field('alias' , '疾病别名');
- $show->field('ICD10' , 'ICD10');
- $show->field('department' , '疾病类别');
- $show->field('introduction' , '疾病概述');
- $show->field('epidemiology' , '流行病学');
- $show->field('suitableFood' , '宜吃食物');
- $show->field('notEat' , '忌吃食物');
- $show->field('diagnostiCtriage' , '诊断鉴别');
- $show->field('precaution' , '预防');
- $show->field('nursingInfo' , '护理信息');
- $show->field('warmPrompt' , '温馨提示');
- $show->field('recommendedRecipe' , '推荐食谱');
- $show->field('treatmentOverview' , '治疗概述');
- $show->field('pathogenesis' , '病因');
- $show->field('basicKnowledgel' , '基本常识');
- $show->field('dietHealth' , '饮食保健');
- $show->field('symptom' , '证型');
- $show->field('complicationsOverview', '并发症概述');
- $show->field('treatmentInfo' , '治疗信息');
- break;
- case 'Disease':
- $show->field('nameEn' , '英文名称');
- $show->field('alias' , '疾病别名');
- $show->field('icd' , 'ICD号');
- $show->field('department' , '疾病类别');
- $show->field('epidemiology' , '流行病学');
- $show->field('sickOverview' , '疾病概述');
- $show->field('clinicalFeature' , '临床表现');
- $show->field('diagnosis' , '诊断');
- $show->field('treatment' , '治疗');
- $show->field('pathogenesis' , '发病机制');
- $show->field('inspection' , '相关检查');
- $show->field('laboratoryInspection' , '实验室检查');
- $show->field('b' , '病因');
- $show->field('auxiliaryExamination' , '其他辅助检查');
- $show->field('prognosis' , '预后');
- $show->field('complicationsOverview', '并发症概述');
- $show->field('precaution' , '预防');
- break;
- case 'Medicine':
- $show->field('pinyi' , '汉语拼音');
- $show->field('oldUse' , '老人用药');
- $show->field('chilldUse' , '儿童用药');
- $show->field('medicinePregnant' , '孕妇及哺乳期妇女用药');
- $show->field('usageDosage' , '用法用量');
- $show->field('notes' , '注意事项');
- $show->field('periodValidity' , '有效期');
- $show->field('indication' , '适应症');
- $show->field('storage' , '贮藏');
- $show->field('character' , '性状');
- $show->field('contraindication' , '禁忌');
- $show->field('pharmacologyToxicology' , '药理毒理');
- $show->field('specification' , '规格');
- $show->field('approvalNumber' , '批准号');
- $show->field('productionEnterprise' , '生产企业');
- $show->field('relateSick' , '相关疾病');
- $show->field('untowardEffect' , '不良反应');
- $show->field('majorConstituent' , '主要成分');
- break;
- case 'Inspection':
- $show->field('overview' , '概述');
- $show->field('annotation' , '附注');
- $show->field('principle' , '原理');
- $show->field('normalValue' , '正常值');
- $show->field('clinicalSignificance' , '临床意义');
- $show->field('reagent' , '试剂');
- $show->field('operation' , '操作方法');
- break;
- case 'Document':
- $show->field('abstract' , '摘要');
- $show->field('year' , '年份');
- break;
- case 'Guide':
- $show->field('enTitle' , '英文标题');
- $show->field('abstract' , '摘要');
- $show->field('source' , '数据来源');
- $show->field('constitutor' , '制定者');
- $show->field('year' , '年份');
- break;
- }
- $show->field('dateModified' , '日期');
- return $show;
- }
- /**
- * store resource
- */
- public function store()
- {
- $data = Request::except(['_token' , '_previous_' , 's']);
- foreach ($data as $key => $value)
- {
- if($data[$key])
- {
- if($data[$key] != strip_tags($data[$key])) {
- $data[$key] = htmlspecialchars($data[$key]);
- }
- }
- }
- $url = "https://zskweb.jiankangche.cn/neo4j/create_node";
- $ch = curl_init();
- $header = array(
- 'Content-Type:'.'application/json; charset=UTF-8'
- );
- curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($data));
- $result = curl_exec($ch);
- curl_close($ch);
- $result = json_decode($result , true);
- //dd($result);
- if(0 == $result['code']) {
- admin_success('消息提示', '保存成功!');
- return back();
- } else {
- admin_error('消息提示', '保存失败!');
- return back();
- }
- }
- public function update($id)
- {
- $data = Request::except(['_token' , '_previous_' , 's']);
- foreach ($data as $key => $value)
- {
- if($data[$key])
- {
- if($data[$key] != strip_tags($data[$key])) {
- $data[$key] = htmlspecialchars($data[$key]);
- }
- }
- }
- $data['id'] = $id;
- $result = (new xyzsk())->save($data);
- if('failure' === $result) {
- admin_error('消息提示', '保存失败!');
- return back();
- } else {
- admin_success('消息提示', '保存成功!');
- return back();
- }
- }
- protected function form($id = '')
- {
- if($id) {
- $label = (new xyzsk())->getlabel($id);
- // 编辑
- switch ($label) {
- case 'SickNess':
- return Admin::form(Xyzsk::class, function (Form $form) {
- $form->text('name' , '名称');
- $form->text('alias' , '疾病别名');
- $form->text('ICD10' , 'ICD10');
- $form->text('department' , '疾病类别');
- $form->editor('introduction' , '疾病概述');
- $form->editor('epidemiology' , '流行病学');
- $form->editor('suitableFood' , '宜吃食物');
- $form->editor('notEat' , '忌吃食物');
- $form->editor('diagnostiCtriage' , '诊断鉴别');
- $form->editor('precaution' , '预防');
- $form->editor('nursingInfo' , '护理信息');
- $form->editor('warmPrompt' , '温馨提示');
- $form->editor('recommendedRecipe' , '推荐食谱');
- $form->editor('treatmentOverview' , '治疗概述');
- $form->editor('pathogenesis' , '病因');
- $form->editor('basicKnowledgel' , '基本常识');
- $form->editor('dietHealth' , '饮食保健');
- $form->editor('symptom' , '证型');
- $form->editor('complicationsOverview', '并发症概述');
- $form->editor('treatmentInfo' , '治疗信息');
- });
- break;
- case 'Disease';
- return Admin::form(Xyzsk::class, function (Form $form) {
- $form->text('name' , '名称');
- $form->text('nameEn' , '英文名称');
- $form->text('alias' , '疾病别名');
- $form->text('icd' , 'ICD号');
- $form->text('department' , '疾病类别');
- $form->editor('epidemiology' , '流行病学');
- $form->editor('sickOverview' , '疾病概述');
- $form->editor('clinicalFeature' , '临床表现');
- $form->editor('diagnosis' , '诊断');
- $form->editor('treatment' , '治疗');
- $form->editor('pathogenesis' , '发病机制');
- $form->editor('inspection' , '相关检查');
- $form->editor('laboratoryInspection' , '实验室检查');
- $form->editor('etiology' , '病因');
- $form->editor('auxiliaryExamination' , '其他辅助检查');
- $form->editor('prognosis' , '预后');
- $form->editor('complicationsOverview' , '并发症概述');
- $form->editor('precaution' , '预防');
- });
- break;
- case 'Medicine';
- return Admin::form(Xyzsk::class, function (Form $form) {
- $form->text('name' , '名称');
- $form->text('pinyi' , '汉语拼音');
- $form->text('oldUse' , '老人用药');
- $form->text('chilldUse' , '儿童用药');
- $form->text('medicinePregnant' , '孕妇及哺乳期妇女用药');
- $form->text('usageDosage' , '用法用量');
- $form->text('notes' , '注意事项');
- $form->text('periodValidity' , '有效期');
- $form->text('indication' , '适应症');
- $form->text('storage' , '贮藏');
- $form->text('character' , '性状');
- $form->text('contraindication' , '禁忌');
- $form->text('pharmacologyToxicology' , '药理毒理');
- $form->text('specification' , '规格');
- $form->text('approvalNumber' , '批准号');
- $form->text('productionEnterprise' , '生产企业');
- $form->text('relateSick' , '相关疾病');
- $form->text('untowardEffect' , '不良反应');
- $form->text('majorConstituent' , '主要成分');
- });
- break;
- case 'Inspection':
- return Admin::form(Xyzsk::class, function (Form $form) {
- $form->text('name' , '名称');
- $form->text('annotation' , '附注');
- $form->text('principle' , '原理');
- $form->text('normalValue' , '正常值');
- $form->text('clinicalSignificance' , '临床意义');
- $form->text('reagent' , '试剂');
- $form->text('operation' , '操作方法');
- });
- break;
- case 'Document';
- return Admin::form(Xyzsk::class, function (Form $form) {
- $form->text('abstract' , '摘要');
- $form->text('year' , '年份');
- });
- break;
- case 'Guide';
- return Admin::form(Xyzsk::class, function (Form $form) {
- $form->text('name' , '名称');
- //$form->text('enTitle' , '英文标题');
- $form->textarea('abstract' , '摘要');
- $form->textarea('source' , '数据来源');
- $form->textarea('constitutor' , '制定者');
- $form->text('year' , '年份');
- });
- break;
- case 'Symptom':
- return Admin::form(Xyzsk::class, function (Form $form) {
- $form->text('name' , '名称');
- $form->text('identify' , '识别');
- $form->text('abstract' , '摘要');
- $form->text('precaution' , '预防措施');
- $form->text('inspection' , '检查');
- $form->text('etiology' , '病理');
- });
- break;
- }
- } else {
- if(stripos($url = $_SERVER['HTTP_REFERER'] , 'label') !== false) {
- $urlDeail = parse_url($url);
- $query = $urlDeail['query'];
- $queryArr = explode('=', $query);
- $label = $queryArr[1];
- return Admin::form(Xyzsk::class, function (Form $form) use ($label) {
- $form->select('label' , '标签')->options([$label => $label])->required();
- switch ($label) {
- case 'SickNess':
- $form->text('name' , '名称');
- $form->text('alias' , '疾病别名');
- $form->text('ICD10' , 'ICD10');
- $form->text('department' , '疾病类别');
- $form->editor('introduction' , '疾病概述');
- $form->editor('epidemiology' , '流行病学');
- $form->editor('suitableFood' , '宜吃食物');
- $form->editor('notEat' , '忌吃食物');
- $form->editor('diagnostiCtriage' , '诊断鉴别');
- $form->editor('precaution' , '预防');
- $form->editor('nursingInfo' , '护理信息');
- $form->editor('warmPrompt' , '温馨提示');
- $form->editor('recommendedRecipe' , '推荐食谱');
- $form->editor('treatmentOverview' , '治疗概述');
- $form->editor('pathogenesis' , '病因');
- $form->editor('basicKnowledgel' , '基本常识');
- $form->editor('dietHealth' , '饮食保健');
- $form->editor('symptom' , '证型');
- $form->editor('complicationsOverview', '并发症概述');
- $form->editor('treatmentInfo' , '治疗信息');
- break;
- case 'Disease':
- $form->text('name' , '名称');
- $form->text('nameEn' , '英文名称');
- $form->text('alias' , '疾病别名');
- $form->text('icd' , 'ICD号');
- $form->text('department' , '疾病类别');
- $form->editor('sickOverview' , '疾病概述');
- $form->editor('epidemiology' , '流行病学');
- $form->editor('clinicalFeature' , '临床表现');
- $form->editor('diagnosis' , '诊断');
- $form->editor('treatment' , '治疗');
- $form->editor('pathogenesis' , '发病机制');
- $form->editor('inspection' , '相关检查');
- $form->editor('laboratoryInspection' , '实验室检查');
- $form->editor('etiology' , '病因');
- $form->editor('auxiliaryExamination' , '其他辅助检查');
- $form->editor('prognosis' , '预后');
- $form->editor('complicationsOverview' , '并发症概述');
- $form->editor('precaution' , '预防');
- break;
- case 'Medicine':
- $form->text('name' , '名称');
- $form->text('pinyi' , '汉语拼音');
- $form->text('oldUse' , '老人用药');
- $form->text('chilldUse' , '儿童用药');
- $form->text('medicinePregnant' , '孕妇及哺乳期妇女用药');
- $form->text('usageDosage' , '用法用量');
- $form->text('notes' , '注意事项');
- $form->text('periodValidity' , '有效期');
- $form->text('indication' , '适应症');
- $form->text('storage' , '贮藏');
- $form->text('character' , '性状');
- $form->text('contraindication' , '禁忌');
- $form->text('pharmacologyToxicology' , '药理毒理');
- $form->text('specification' , '规格');
- $form->text('approvalNumber' , '批准号');
- $form->text('productionEnterprise' , '生产企业');
- $form->text('relateSick' , '相关疾病');
- $form->text('untowardEffect' , '不良反应');
- $form->text('majorConstituent' , '主要成分');
- break;
- case 'Inspection':
- $form->text('name' , '名称');
- $form->text('annotation' , '附注');
- $form->text('principle' , '原理');
- $form->text('normalValue' , '正常值');
- $form->text('clinicalSignificance' , '临床意义');
- $form->text('reagent' , '试剂');
- $form->text('operation' , '操作方法');
- break;
- case 'Document':
- $form->text('abstract' , '摘要');
- $form->text('year' , '年份');
- break;
- case 'Guide':
- $form->text('name' , '名称');
- $form->text('enTitle' , '英文标题');
- $form->text('abstract' , '摘要');
- $form->text('source' , '数据来源');
- $form->text('constitutor' , '制定者');
- $form->text('year' , '年份');
- break;
- case 'Symptom':
- $form->text('name' , '名称');
- $form->text('identify' , '识别');
- $form->text('abstract' , '摘要');
- $form->text('precaution' , '预防措施');
- $form->text('inspection' , '检查');
- $form->text('etiology' , '病理');
- break;
- }
- });
- }
- }
- }
- // Grid
- protected function grid()
- {
- return Admin::grid(Xyzsk::class, function (Grid $grid) {
- $label = request('label') ?? 'SickNess';
- //$grid->id('Id')->setAttributes(['style' => 'font-family:PMingLiU;']);
- $grid->name('名称')->setAttributes(['style' => 'font-family:PMingLiU;']);
- switch ($label) {
- case 'SickNess':
- $grid->alias('疾病别名')->setAttributes(['style' => 'font-family:PMingLiU;']);
- $grid->ICD10('ICD10')->setAttributes(['style' => 'font-family:PMingLiU;']);
- $grid->department('疾病类别')->setAttributes(['style' => 'font-family:PMingLiU;']);
- break;
- case 'Disease':
- $grid->alias('疾病别名')->setAttributes(['style' => 'font-family:PMingLiU;']);
- $grid->icd('icd')->setAttributes(['style' => 'font-family:PMingLiU;']);
- $grid->department('疾病类别')->setAttributes(['style' => 'font-family:PMingLiU;']);
- break;
- case 'Medicine':
- $grid->pinyi('汉语拼音')->setAttributes(['style' => 'font-family:PMingLiU;']);
- $grid->indication('适应症')->setAttributes(['style' => 'font-family:PMingLiU;']);
- $grid->majorConstituent('主要成分')->setAttributes(['style' => 'font-family:PMingLiU;']);
- break;
- case 'Inspection':
- $grid->overview('概述')->setAttributes(['style' => 'font-family:PMingLiU;']);
- $grid->annotation('附注')->setAttributes(['style' => 'font-family:PMingLiU;']);
- $grid->operation('操作方法')->setAttributes(['style' => 'font-family:PMingLiU;']);
- break;
- case 'Document':
- $grid->abstract('摘要')->setAttributes(['style' => 'font-family:PMingLiU;']);
- $grid->year('年份')->setAttributes(['style' => 'font-family:PMingLiU;']);
- break;
- case 'Guide':
- $grid->enTitle('英文标题')->setAttributes(['style' => 'font-family:PMingLiU;']);
- $grid->year('年份')->setAttributes(['style' => 'font-family:PMingLiU;']);
- break;
- case 'Symptom':
- $grid->identify('识别');
- $grid->abstract('摘要');
- $grid->precaution('预防措施');
- $grid->inspection('检查');
- $grid->etiology('病理');
- break;
- }
- $grid->dateModified('日期')->setAttributes(['style' => 'font-family:PMingLiU;']);
- //$grid->classification();
- $grid->paginate(20);
- //$grid->disableCreateButton();
- // 禁用导出数据按钮
- $grid->actions(function ($actions) {
- // $actions->disableView();
- // $actions->disableEdit();
- $actions->disableDelete();
- //$actions->add(new Update());
- //dd($actions->row);
- });
- $grid->disableExport();
- $grid->filter(function ($filter) {
- $filter->disableIdFilter();
- $filter->like('name' , '输入搜索名称');
- });
- });
- }
- }
|