/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = NursePatient::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['pt_ref' => $this->pt_ref, 'event_ref' => $this->event_ref, 'bed_type' => $this->bed_type, 'bed_no' => $this->bed_no, 'admit_type' => $this->admit_type, 'disc_type' => $this->disc_type, 'disability' => $this->disability, 'operate' => $this->operate, 'prepare' => $this->prepare, 'cpr' => $this->cpr, 'uti' => $this->uti, 'vap' => $this->vap, 'phleb' => $this->phleb, 'cutdown' => $this->cutdown, 'doctor' => $this->doctor, 'inp_id' => $this->inp_id, 'lastupdate' => $this->lastupdate]); $query->andFilterWhere(['like', 'hn', $this->hn])->andFilterWhere(['like', 'an', $this->an])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'surname', $this->surname])->andFilterWhere(['like', 'pt_type', $this->pt_type])->andFilterWhere(['like', 'dx1', $this->dx1]); return $dataProvider; }
/** * Finds the NursePatient model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return NursePatient the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = NursePatient::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }