示例#1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Patient::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['pid' => 'SORT_DESC']]]);
     if (isset($_GET['PatientSearch']) && !($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $dataProvider->query->joinWith('ampurs');
     $dataProvider->query->joinWith('tambons');
     $dataProvider->query->joinWith('hospcodes');
     $dataProvider->query->joinWith('discharge');
     $query->andFilterWhere(['pid' => $this->pid, 'birth' => $this->birth, 'date_addmit' => $this->date_addmit, 'date_discharge' => $this->date_discharge, 'admit_day' => $this->admit_day, 'age' => $this->age, 'd_update' => $this->d_update]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'hn', $this->hn])->andFilterWhere(['like', 'sex', $this->sex])->andFilterWhere(['like', 'an', $this->an])->andFilterWhere(['like', 'cid', $this->cid])->andFilterWhere(['like', 'chospital.hospname', $this->hospcode])->andFilterWhere(['like', 'ward', $this->ward])->andFilterWhere(['like', 'pdx', $this->pdx])->andFilterWhere(['like', 'cdischarce_type.discharge_name', $this->discharge_type])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'village', $this->village])->andFilterWhere(['like', 'ctambon.tambonname', $this->tambon])->andFilterWhere(['like', 'campur.ampurname', $this->amphur])->andFilterWhere(['like', 'province', $this->province])->andFilterWhere(['like', 'note1', $this->note1])->andFilterWhere(['like', 'note2', $this->note2])->andFilterWhere(['like', 'note3', $this->note3])->andFilterWhere(['like', 'note4', $this->note4]);
     return $dataProvider;
 }
示例#2
0
文件: Patient.php 项目: bmanop20/com
 public function getPName($hn)
 {
     $model = Patient::find()->where(['hn' => $hn])->one();
     $name = @$model->pname . @$model->fname . '  ' . @$model->lname;
     return $name;
 }
示例#3
0
 /**
  * Finds the Patient model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Patient the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Patient::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }