Index.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace app\controller;
  3. use app\model\Category;
  4. use app\model\CdssXyDisease;
  5. use app\model\Illness;
  6. use app\model\Symptom;
  7. use app\model\ZskWords;
  8. use think\facade\Db;
  9. use think\facade\Request;
  10. use Fukuball\Jieba\Jieba;
  11. use Fukuball\Jieba\Finalseg;
  12. //Jieba::init();
  13. //Finalseg::init();
  14. class Index extends CommonTwoController
  15. {
  16. public function index( )
  17. {
  18. $question = Request::param('question') ?? '';
  19. $url = "http://3.15.12.98:5000/chat?content=".$question;
  20. $result = file_get_contents($url);
  21. return $this->_json_succ($result);
  22. }
  23. // Index Category
  24. public function category()
  25. {
  26. if(!$this->checkIslogin()) return $this->_json_error('请登录' , 777);
  27. return $this->_json_succ(Category::make_tree(Category::select()));
  28. }
  29. // 某分类下all
  30. public function getAllIllnessByPid()
  31. {
  32. if(!$this->checkIslogin()) return $this->_json_error('请登录' , 777);
  33. $pid = Request::param('id') ?? '';
  34. $field = 'id , clinical_manifestation , pathogeny , complication , auxiliary , diagnose , cure';
  35. $data = Illness::field($field)->where(['category' => $pid])->select();
  36. return $this->_json_succ($data);
  37. }
  38. // 单个
  39. public function singleIllness()
  40. {
  41. if(!$this->checkIslogin()) return $this->_json_error('请登录' , 777);
  42. $id = Request::param('id') ?? '';
  43. $field = 'id , illness_name , illness_as_name , icd_number , medicinal , illness_desc , epidemiology';
  44. $data = Illness::field($field)->where(['id' => $id])->find();
  45. return $this->_json_succ($data);
  46. }
  47. }