/** * 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; }
public function actionDailyReport($event_ref) { $ward = Yii::$app->user->identity->ward; $event = NurseEvent::findOne($event_ref); $ward_name = Ward::find()->where('code=:code', [':code' => $ward])->one(); $patient = NursePatient::find()->where('event_ref=:event_ref and disc_type=0', [':event_ref' => $event_ref])->orderBy('bed_type desc,bed_no asc')->all(); return $this->renderPartial('daily_report', ['patient' => $patient, 'event' => $event, 'ward_name' => $ward_name]); }