/**
  * 疾病图集
  * @author gaoqing
  * @date 2016-03-25
  * @return string 视图
  */
 public function actionDisimages()
 {
     $view = "disease_images";
     $dname = $this->helpGparam('dname', "");
     $dname = trim($dname, '/');
     $domudle = $this->helpGparam('dmodule', 'tuji');
     $domudle = trim($domudle, '/');
     $pageStr = trim(trim($domudle, 'tuji'), '_');
     $page = 1;
     if (!empty($pageStr)) {
         $page = intval($pageStr);
     }
     $disease = $this->diseaseService->getDiseasesByPinyin($dname, false, false, false, false);
     //图集信息
     $icondition = ['flag' => 1, 'relid' => $disease['id']];
     $images = Image::search($icondition);
     $imagesList = $images['list'];
     //获取相关疾病图集
     $relDiseaseImages = ArticleService::getRelDiseaseImages($disease['id'], 6);
     $return_img_list = [];
     foreach ($imagesList as $k => $v) {
         $v['url'] = \librarys\helpers\utils\Url::getuploadfileUrl(1, $v['name']);
         $return_img_list[] = $v;
     }
     $params = ['disease' => $disease, 'imagesList' => $return_img_list, 'relDiseaseImages' => $relDiseaseImages];
     return $this->renderPartial($view, $params);
 }
Beispiel #2
0
 public static function getsymptom($params)
 {
     $symptomObj = new ModelSymptom();
     $symptomContentObj = new ModelSymptomContent();
     $pinyin_initial = $params['pinyin_initial'];
     $condition = ["{{%symptom}}.pinyin_initial" => $pinyin_initial];
     $info = $symptomObj->getSymptomByCondition($condition, [], 1, 0);
     $res = $info[0];
     if (empty($info)) {
         //如果不存在抛出404
         return self::result(404, '找不到数据');
     }
     //处理缩略图
     $thumb = empty($res['thumbnail']) ? '/patients/styles/images/dise_02.jpg' : \librarys\helpers\utils\Url::getuploadfileUrl(2, $res['thumbnail']);
     $res['thumbnail'] = $thumb;
     //处理基本信息
     if (isset($params['fileds'])) {
         if (strpos($params['fileds'], ',') === false) {
             $column = $params['fileds'];
         } else {
             $column = explode(',', $params['fileds']);
         }
         $tmpCont = $symptomContentObj->getSymptomContentById($column, $res['id']);
         if (is_array($column)) {
             //如果是多个字段
             foreach ($column as $v) {
                 $res[$v] = str_replace("\n", "<br>", $tmpCont[$v]);
             }
         } else {
             $res['content'] = str_replace("\n", "<br>", $tmpCont[$column]);
         }
     }
     //处理相关文章
     if (isset($params['relarticles']) && $params['relarticles'] == 1) {
         $symptomid = $res['id'];
         $self = new self();
         $arts = $self->getRightInfo($symptomid, ['disease', 'articles']);
         foreach ($arts as $k => $v) {
             $res[$k] = $v;
         }
     }
     return self::result(200, '获取数据成功', $res);
 }
 /**
  * 疾病症状 首页
  */
 public function actionIndex()
 {
     $pinyin = $this->helpGquery('pinyin');
     $result = $this->getColumn(['cause', 'examine', 'diagnose', 'goodfood', 'relieve'], $pinyin);
     //获取基本信息及字段对应信息
     $relieve = $result;
     $name = $result['info']['name'];
     $symptomid = $result['info']['id'];
     //症状基本信息
     $symptom['id'] = $symptomid;
     $symptom['info'] = $result['info'];
     $symptom['content'] = $result['info']['description'];
     $symptom['pinyin_initial'] = $pinyin;
     $symptom['thumbnail'] = $result['info']['thumbnail'];
     $symptom['imgPath'] = '/images/';
     $symptom['symptomContent'] = $result;
     //症状首页缩略图信息
     //默认图片
     $defaultThumb = \yii\helpers\Url::to("@domain") . '/images/dise_02.jpg';
     $symptom['thumb']['src'] = empty($symptom['thumbnail']) ? $defaultThumb : \librarys\helpers\utils\Url::getuploadfileUrl(2, $symptom['thumbnail']);
     //        $thumbCondition = [
     //            'relid' => $symptomid,
     //            'flag' => 2,
     //            'weight' => 1,
     //        ];
     //        $imgArr = $this->relate->getImage($thumbCondition);
     //        if (count($imgArr) > 0) {
     //            $symptom['thumb'] = $imgArr[0]; //症状首页缩略图
     //            $symptom['thumb']['src'] = $symptom['imgPath'] . $symptom['thumb']['name'];
     //        } else {
     //            $symptom['thumb'] = [
     //                'src' => '/images/dise_02.jpg',
     //                'name' => '默认图片',
     //            ];
     //        }
     //相关问答 15条sql语句
     $cacheKey = 'frontend_symptom_index_xgwd';
     $parms = ['id' => $symptomid, 'name' => $name];
     $questions = $this->cacheHelper->getCache($cacheKey, $parms);
     $symptom['questions'] = $questions['list'];
     //右侧公用信息
     $rightTmp = $this->getRightInfo($symptomid);
     foreach ($rightTmp as $k => $v) {
         $symptom[$k] = $v;
     }
     //伴随症状 省略号显示
     if (isset($symptom['disease'])) {
         $relDisease = $symptom['disease']['relDisease'];
         $relSymptom = $symptom['disease']['relSymptom'];
         $diseaseSymptomCustom = [];
         if (!empty($relDisease)) {
             //如果有关联疾病
             foreach ($relDisease as $k => $v) {
                 $pinyin = $v['pinyin_initial'];
                 //伴随症状 省略号显示
                 $diseaseSymptomCustom[$pinyin] = $this->fitwidthdata($relSymptom[$pinyin], 21);
                 //就诊科室 省略号显示
                 $departTmp = explode(' ', $v['treat_department']);
                 $diseaseDepartmentCustom[$k] = $this->fitwidthdata($departTmp, 9);
             }
         } else {
             $diseaseSymptomCustom = '';
             $diseaseDepartmentCustom = '';
         }
         $symptom['diseaseSymptomCustom'] = $diseaseSymptomCustom;
         $symptom['diseaseDepartmentCustom'] = $diseaseDepartmentCustom;
     }
     return $this->render('index', ['symptom' => $symptom]);
 }
 /**
  * 首页
  * @author gaoqing
  * @date 2016-03-21
  * @return string 视图
  */
 public function actionIndex()
 {
     $view = "index";
     $obj_diseaseService = new DiseaseService();
     //1、疾病的信息(根据疾病的 dname, 获取疾病信息)
     $disease = $obj_diseaseService->getDiseasesByPinyin($this->params['dname'], false, true, true, true);
     $disease['alias_arr'] = [];
     if (!empty($disease['alias'])) {
         $disease['alias_arr'] = $this->explodeStr($disease['alias']);
     }
     //2、获取 4 条症状信息
     //        $symptoms = [];
     //        if ($this->isNotNull($disease['tsymptom'])){
     //            $symptoms = array_slice($disease['tsymptom'], 0, 4);
     //        }
     //3、获取全面解读部分数据
     $allReads = CacheHelper::getCache('frontend_disease_index_wzjd', ['id' => $disease['id']]);
     //4、关注问题
     $asks = CacheHelper::getCache('frontend_disease_index_gzwt', ['id' => $disease['id'], 'keywords' => $disease['keywords']]);
     //得到当前病 对应到 9939_com_v2sns wd_keshi 表中的 id 值
     //        $v2snsKeshiID = $obj_diseaseService->getKeshiIDByName($disease['name']);
     //医生信息
     $doctors = $this->getDoctors();
     //得到热词部分
     //        $hotWords = $this->letterHotWordsBatch($disease['name']);
     //        $model['randWords'] = $hotWords;
     $disease['thumb'] = empty($disease['thumb']) ? '/images/dise_02.jpg' : \librarys\helpers\utils\Url::getuploadfileUrl(1, $disease['thumb']);
     $params = ['disease' => $disease, 'allReads' => $allReads, 'asks' => $asks, 'doctors' => $doctors];
     return $this->render($view, $params);
 }
 /**
  * 症状图集
  * lc 2016-4-1
  * @return string 视图
  */
 public function actionSymimages()
 {
     $view = "symptom_images";
     $dname = $this->helpGparam('dname', "");
     $dname = trim($dname, '/');
     $domudle = $this->helpGparam('dmodule', 'tuji');
     $domudle = trim($domudle, '/');
     $pageStr = trim(trim($domudle, 'tuji'), '_');
     $page = 1;
     if (!empty($pageStr)) {
         $page = intval($pageStr);
     }
     $condition = ["{{%symptom}}.pinyin_initial" => $dname];
     $disease = $this->symptom->getSymptomByCondition($condition, [], 1, 0);
     if (!isset($disease) || empty($disease)) {
         throw new NotFoundHttpException("当前访问的页面不存在!");
     }
     $disease = $disease[0];
     if (!empty($disease)) {
         $symptomContent = SymptomContent::find()->select('examine')->where(['id' => $disease['id']])->asArray(true)->one();
         if (isset($symptomContent) && !empty($symptomContent)) {
             $disease = array_merge($disease, $symptomContent);
         }
     }
     //图集信息
     $icondition = ['flag' => 2, 'relid' => $disease['id']];
     $size = 1;
     $paging = $this->helpPaging('pager')->setSize($size)->setPageSetSize(9)->setUrlFormat('/' . $dname . '/tuji_%d' . '/')->setCurrentClass('cupat');
     $offset = $paging->getOffset();
     $images = Image::search($icondition, $offset, $size, 'id DESC', true);
     $imagesList = $images['list'];
     $paging->setTotal($images['total']);
     //获取相关疾病文章
     $relArtsAndAsks = CacheHelper::getCache('frontend_symptom_detail_xgwz', ['title' => $disease['name'], 'id' => $disease['id'], 'diseaseid' => $disease['id'], 'pinyin' => $disease['pinyin']]);
     $relArticles = $relArtsAndAsks['relArticles'];
     //相关问答
     $asks = $relArtsAndAsks['relAsks'];
     //大家还在找部分
     $stillFind = $this->getStillFindDatas($disease['name']);
     //右侧:最新文章
     $lastestArticles = $this->getLatestArticles();
     $return_img_list = [];
     foreach ($imagesList as $k => $v) {
         $v['url'] = \librarys\helpers\utils\Url::getuploadfileUrl(2, $v['name']);
         $return_img_list[] = $v;
     }
     $params = ['disease' => $disease, 'imagesList' => $return_img_list, 'relArticles' => $relArticles, 'paging' => $paging, 'asks' => $asks, 'lastestArticles' => $lastestArticles, 'stillFind' => $stillFind];
     return $this->render($view, $params);
 }
Beispiel #6
0
        </div>
        <!--相关资讯-->
        <div class="a_info">
            <?php 
if (isset($model['articles'])) {
    ?>
            <ul class="newlis">
                <li>
                <?php 
    $i = 1;
    foreach ($model['articles'] as $v) {
        $articleTitle = $v['title'];
        $articleShortTitle = String::cutString($articleTitle, 20, '...');
        $articleDate = date('Y-m-d', $v['updatetime']);
        //                    $articleUrl = Url::to(["/article/{$v['id']}.shtml"]);
        $articleUrl = \librarys\helpers\utils\Url::getdisarticleUrl($v);
        ?>
                        <dl>
                            <dd><span><?php 
        echo $articleDate;
        ?>
</span><a href="<?php 
        echo $articleUrl;
        ?>
" title="<?php 
        echo $articleTitle;
        ?>
"><?php 
        echo $articleShortTitle;
        ?>
</a></dd>
Beispiel #7
0
 /**
  * app 端 【疾病模块】首页接口数据
  * @author gaoqing
  * @date 2016-09-08
  * @return string json 格式的数据
  */
 public static function index($condition)
 {
     //1、疾病的信息(根据疾病的 dname, 获取疾病信息)
     $disease = self::getDiseasesByPinyin($condition['dname'], false, true, true, true);
     array_walk($disease, function (&$value, $key) {
         if (empty($value)) {
             $value = '';
         }
     });
     $disease['inspect_short'] = String::cutString($disease['inspect'], 20);
     $disease['alias_arr'] = [];
     if (!empty($disease['alias'])) {
         $disease['alias_arr'] = self::explodeStr($disease['alias']);
     }
     //2、获取 4 条症状信息
     $symptoms = [];
     if (self::isNotNull($disease['tsymptom'])) {
         $symptoms = array_slice($disease['tsymptom'], 0, 4);
     }
     //3、获取全面解读部分数据
     $allReads = CacheHelper::getCache('frontend_disease_index_wzjd', ['id' => $disease['id'], 'name' => $disease['name']]);
     if (!empty($allReads)) {
         foreach ($allReads as $module => $allRead) {
             $subRead = [];
             foreach ($allRead as $index => $val) {
                 if ($index < 2) {
                     $val['app_url'] = \Yii::getAlias('@app_domain') . '/article/' . date('Y/md', $val['inputtime']) . '/' . $val['id'] . '.shtml';
                     $subRead[] = $val;
                 }
             }
             $allReads[$module] = $subRead;
         }
     }
     $disease['thumb'] = empty($disease['thumb']) ? '/images/dise_02.jpg' : \librarys\helpers\utils\Url::getuploadfileUrl(1, $disease['thumb']);
     $params = ['disease' => $disease, 'symptoms' => $symptoms, 'allReads' => $allReads];
     return ['code' => 200, 'message' => '数据响应成功', 'data' => $params];
 }
Beispiel #8
0
    <?php 
$n = 0;
foreach ($model['randWords']['words'] as $k => $v) {
    $letter = strtoupper($k);
    $isshow = $n == 0 ? '' : 'disn';
    ?>
    <div class="lett-tab-<?php 
    echo $letter;
    ?>
 hotwords <?php 
    echo $isshow;
    ?>
">
        <?php 
    foreach ($v as $vv) {
        $url = \librarys\helpers\utils\Url::getkeywordsUrl($vv);
        ?>
        <a href="<?php 
        echo $url;
        ?>
" title="<?php 
        echo $vv['keywords'];
        ?>
"><?php 
        echo $vv['keywords'];
        ?>
</a>
        <?php 
    }
    ?>
    </div>
 /**
  * 疾病症状 首页
  */
 public function actionIndex()
 {
     $pinyin = $this->helpGquery('pinyin');
     $result = $this->getColumn(['cause', 'examine', 'diagnose', 'goodfood', 'relieve'], $pinyin);
     //获取基本信息及字段对应信息
     $relieve = $result;
     $name = $result['info']['name'];
     $symptomid = $result['info']['id'];
     //默认图片
     $defaultThumb = \yii\helpers\Url::to("@domain") . '/images/dise_02.jpg';
     //症状基本信息
     $model['id'] = $symptomid;
     $model['info'] = $result['info'];
     $model['content'] = $result['info']['description'];
     $model['pinyin_initial'] = $pinyin;
     $model['thumbnail'] = $result['info']['thumbnail'];
     $model['imgPath'] = '/images/';
     //设置title,keywords,description
     $this->setMeta($name, 'index');
     $model['thumb']['src'] = empty($model['thumbnail']) ? $defaultThumb : \librarys\helpers\utils\Url::getuploadfileUrl(2, $model['thumbnail']);
     //相关问答 15条sql语句
     //        $questions = Search::search_ask($name, 0, 5);
     $cacheKey = 'frontend_symptom_index_xgwd';
     $parms = ['id' => $symptomid, 'name' => $name];
     $questions = $this->cacheHelper->getCache($cacheKey, $parms);
     $model['questions'] = $questions['list'];
     //左侧四个医生随机
     $leftQuankeDoctorIds = array_rand($this->quankeDoctors, 4);
     $leftQuankeDoctors = [];
     $ids = $this->quankeDoctors;
     foreach ($leftQuankeDoctorIds as $v) {
         $docIds[] = $ids[$v];
     }
     $tmp = implode(',', $docIds);
     $leftQuankeDoctors = $this->doctor->getDoctorById(implode(',', $docIds));
     $model['leftQuankeDoctors'] = $leftQuankeDoctors;
     //症状自查下方4个文章模块
     $model['symptomContent'] = $result;
     $model['prevent'] = $relieve;
     //底部随机词
     $randWords = $this->letterHotWordsBatch($name);
     $model['randWords'] = $randWords;
     //右侧公用信息
     $rightTmp = $this->getRightInfo($symptomid);
     //        print_r($rightTmp);
     //        exit;
     foreach ($rightTmp as $k => $v) {
         $model[$k] = $v;
     }
     //伴随症状 省略号显示
     if (isset($model['disease'])) {
         $relDisease = $model['disease']['relDisease'];
         $relSymptom = $model['disease']['relSymptom'];
         $diseaseSymptomCustom = [];
         if (!empty($relDisease)) {
             //如果有关联疾病
             foreach ($relDisease as $k => $v) {
                 $pinyin = $v['pinyin_initial'];
                 //伴随症状 省略号显示
                 $diseaseSymptomCustom[$pinyin] = $this->fitwidthdata($relSymptom[$pinyin], 21);
                 //就诊科室 省略号显示
                 $departTmp = explode(' ', $v['treat_department']);
                 $diseaseDepartmentCustom[$k] = $this->fitwidthdata($departTmp, 9);
             }
         } else {
             $diseaseSymptomCustom = '';
             $diseaseDepartmentCustom = '';
         }
         $model['diseaseSymptomCustom'] = $diseaseSymptomCustom;
         $model['diseaseDepartmentCustom'] = $diseaseDepartmentCustom;
     }
     //        print_r($diseaseDepartmentCustom);
     //        exit;
     //$this->fitwidthdata();
     return $this->render('index', ['model' => $model]);
 }