surat/frontend/modules/register/models/FlowConsultSearch.php

1 line
2.6 KiB
PHP
Raw Normal View History

2024-12-25 03:04:59 +00:00
<?php namespace frontend\modules\register\models; use common\models\FlowConsult; use yii\base\Model; use yii\data\ActiveDataProvider; use yii\db\Expression; /** * FlowConsultSearch represents the model behind the search form of `common\models\FlowConsult`. */ class FlowConsultSearch extends FlowConsult { public $patient_name; /** * {@inheritdoc} */ public function rules() { return [ [['id', 'pathologist1_id', 'pathologist2_id', 'diagnosis_by', 'status', 'flow_diagnosis_id', 'created_at', 'updated_at', 'created_by', 'updated_by'], 'integer'], [['id_case', 'remark', 'patient_name'], 'safe'], ]; } /** * {@inheritdoc} */ public function scenarios() { // bypass scenarios() implementation in the parent class return Model::scenarios(); } /** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = FlowConsult::find()->with(['caseFlow']); // add conditions that should always apply here $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; } // grid filtering conditions $query->andFilterWhere([ 'flow_diagnosis_id.id' => $this->id, 'flow_diagnosis_id.pathologist1_id' => $this->pathologist1_id, 'flow_diagnosis_id.pathologist2_id' => $this->pathologist2_id, 'flow_diagnosis_id.diagnosis_by' => $this->diagnosis_by, 'flow_diagnosis_id.status' => $this->status, 'flow_diagnosis_id.flow_diagnosis_id' => $this->flow_diagnosis_id, 'flow_diagnosis_id.created_at' => $this->created_at, 'flow_diagnosis_id.updated_at' => $this->updated_at, 'flow_diagnosis_id.created_by' => $this->created_by, 'flow_diagnosis_id.updated_by' => $this->updated_by, ]); $query->andFilterWhere(['like', 'flow_diagnosis_id.id_case', $this->id_case]) ->andFilterWhere(['like', 'flow_diagnosis_id.remark', $this->remark]) ->andFilterWhere(['like', new Expression('CONCAT(case_flow.given_name,case_flow.surname)'), $this->patient_name]); return $dataProvider; } }