/**
  * 根据疾病的拼音简写,得到疾病的信息
  * @author gaoqing
  * @date 2016-03-23
  * @param String $pyInitial 疾病的拼音简写
  * @return array 疾病的信息集
  */
 public function getDiseasesByPinyin($pyInitial)
 {
     $disease = [];
     if ($this->isNotNull($pyInitial)) {
         //疾病基本信息
         $diseaseBasic = Disease::find()->where(['pinyin_initial' => $pyInitial])->asArray(true)->one();
         //疾病详细信息
         $diseaseContent = [];
         if ($this->isNotNull($diseaseBasic)) {
             $diseaseContent = DiseaseContent::find()->where(['id' => $diseaseBasic['id']])->asArray(true)->one();
         }
         if ($this->isNotNull($diseaseBasic) && $this->isNotNull($diseaseContent)) {
             $diseaseContentApp = $diseaseContent;
             foreach ($diseaseContentApp as $key => $content) {
                 $diseaseContentApp[$key] = String::cutString($content, 35);
             }
             $disease = array_merge($diseaseBasic, $diseaseContent);
             $disease['content_app'] = $diseaseContentApp;
         }
     }
     if (!isset($disease) || empty($disease)) {
         throw new NotFoundHttpException("当前访问的页面不存在!");
     }
     return $disease;
 }
Exemple #2
0
 /**
  * 根据疾病id,查询疾病及相关疾病信息
  * @author gaoqing
  * 2016年1月19日
  * @param int $id 疾病id
  * @return array 疾病及相关疾病信息
  */
 public function getDiseaseById($id)
 {
     $diseaseAndRel = [];
     //查询疾病信息
     $disease = Disease::find()->select(["id", "name", "alias", "description", "treat_department", "typical_symptom", "pinyin_initial"])->where(["id" => $id])->asArray(true)->one();
     //查询疾病详细信息
     $diseaseContent = DiseaseContent::find()->where(["id" => $id])->asArray(true)->one();
     //所属科室
     $diseaseDepartment = $this->getDepsByDisID($id);
     //相关疾病
     $diseaseDisease = $this->getDiseaseDisByDisid($id);
     //相关症状
     $diseaseSymptom = $this->symptom->getSymptomsByDisid($id);
     //疾病图集
     $diseaseImage = $this->image->getImagesByDiseaseid($id);
     $diseaseAndRel['disease'] = $disease;
     $diseaseAndRel['diseaseContent'] = $diseaseContent;
     $diseaseAndRel['diseaseDepartment'] = $diseaseDepartment;
     $diseaseAndRel['diseaseDisease'] = $diseaseDisease;
     $diseaseAndRel['diseaseSymptom'] = $diseaseSymptom;
     $diseaseAndRel['diseaseImage'] = $diseaseImage;
     return $diseaseAndRel;
 }