/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = ClnDiagnose::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(['DIAGNOSE_GEN_NO' => $this->DIAGNOSE_GEN_NO, 'TRAN_INJ_GEN_NO' => $this->TRAN_INJ_GEN_NO, 'SPORT_GEN_NO' => $this->SPORT_GEN_NO, 'BOND_GEN_NO' => $this->BOND_GEN_NO, 'CAUSE_GEN_NO' => $this->CAUSE_GEN_NO, 'VERSION' => $this->VERSION, 'UPDATE_DATE' => $this->UPDATE_DATE, 'CREATE_DATE' => $this->CREATE_DATE]); $query->andFilterWhere(['like', 'DIAGNOSE_TYPE', $this->DIAGNOSE_TYPE])->andFilterWhere(['like', 'CAUSE_OTHER', $this->CAUSE_OTHER])->andFilterWhere(['like', 'DIAGNOSE', $this->DIAGNOSE])->andFilterWhere(['like', 'DOCTOR_NAME', $this->DOCTOR_NAME])->andFilterWhere(['like', 'UPDATE_BY', $this->UPDATE_BY])->andFilterWhere(['like', 'CREATE_BY', $this->CREATE_BY]); return $dataProvider; }
/** * Updates an existing ClnTranInj model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); $modelClnDiagnose = ClnDiagnose::findOne(['TRAN_INJ_GEN_NO' => $id]); $sportItems = ArrayHelper::map(ClnSport::find()->all(), 'SPORT_GEN_NO', 'SPORT_NAME'); $causeItems = ArrayHelper::map(ClnCauseInj::find()->all(), 'CAUSE_GEN_NO', 'CAUSE_NAME'); $bondItems = ArrayHelper::map(ClnBoundaryInj::find()->all(), 'BOND_GEN_NO', 'BOND_NAME'); $searchClnMedicineTestSearchModel = new \app\models\ClnMedicineTestSearch(); $queryParams = array(); $queryParams = Yii::$app->request->queryParams; $queryParams['ClnMedicineTestSearch']['TRAN_INJ_GEN_NO'] = $id; $dataClnMedicineTestProvider = $searchClnMedicineTestSearchModel->search($queryParams); //Yii::$app->request->queryParams); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->TRAN_INJ_GEN_NO]); } else { return $this->render('update', ['model' => $model, 'modelClnDiagnose' => $modelClnDiagnose, 'sportItems' => $sportItems, 'causeItems' => $causeItems, 'bondItems' => $bondItems, 'searchClnMedicineTestSearchModel' => $searchClnMedicineTestSearchModel, 'dataClnMedicineTestProvider' => $dataClnMedicineTestProvider]); } }
/** * Finds the ClnDiagnose model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return ClnDiagnose the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = ClnDiagnose::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }