示例#1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = ClnRegister::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(['REGISTER_GEN_NO' => $this->REGISTER_GEN_NO, 'REG_CODE' => $this->REG_CODE, 'REG_YEAR' => $this->REG_YEAR, 'TITLE_GEN_NO' => $this->TITLE_GEN_NO, 'VERSION' => $this->VERSION, 'UPDATE_DATE' => $this->UPDATE_DATE, 'CREATE_DATE' => $this->CREATE_DATE]);
     $query->andFilterWhere(['like', 'NAME', $this->NAME])->andFilterWhere(['like', 'SNAME', $this->SNAME])->andFilterWhere(['like', 'SEX', $this->SEX])->andFilterWhere(['like', 'AGE', $this->AGE])->andFilterWhere(['like', 'ADDRESS', $this->ADDRESS])->andFilterWhere(['like', 'TEL', $this->TEL])->andFilterWhere(['like', 'OCCUPATION', $this->OCCUPATION])->andFilterWhere(['like', 'PLACE_OCCUPATION', $this->PLACE_OCCUPATION])->andFilterWhere(['like', 'TEL_OCCUPATION', $this->TEL_OCCUPATION])->andFilterWhere(['like', 'TYPE_CARD', $this->TYPE_CARD])->andFilterWhere(['like', 'ID_CARD', $this->ID_CARD])->andFilterWhere(['like', 'ALLERGIC', $this->ALLERGIC])->andFilterWhere(['like', 'SHOW_REG_NO', $this->SHOW_REG_NO])->andFilterWhere(['like', 'SHOW_NAME', $this->SHOW_NAME])->andFilterWhere(['like', 'UPDATE_BY', $this->UPDATE_BY])->andFilterWhere(['like', 'CREATE_BY', $this->CREATE_BY]);
     return $dataProvider;
 }
示例#2
0
 /**
  * Finds the ClnRegister model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return ClnRegister the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = ClnRegister::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getClnRegister()
 {
     return $this->hasOne(ClnRegister::className(), ['REGISTER_GEN_NO' => 'REGISTER_GEN_NO']);
 }
 /**
  * Updates an existing ClnTranInjTest 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') ;
     $clnRegisterModel = ClnRegister::findOne(['REGISTER_GEN_NO' => $model->REGISTER_GEN_NO]);
     $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);
     $searchClnTranInjRespSearchModel = new \app\models\ClnTranInjRespSearch();
     $queryParams = array();
     $queryParams = Yii::$app->request->queryParams;
     $queryParams['ClnTranInjRespSearch']['TRAN_INJ_GEN_NO'] = $id;
     $dataClnTranInjRespProvider = $searchClnTranInjRespSearchModel->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]);
     if ($model->load(Yii::$app->request->post())) {
         if ($model->save()) {
             $data['result'] = 'success';
             $data['result_desc'] = print_r(Yii::$app->request->post(), 1);
         } else {
             $data['result'] = 'error';
         }
         header('Content-type: application/json');
         echo json_encode($data);
     } else {
         return $this->render('update', ['model' => $model, 'clnRegisterModel' => $clnRegisterModel, 'searchClnMedicineTestSearchModel' => $searchClnMedicineTestSearchModel, 'dataClnMedicineTestProvider' => $dataClnMedicineTestProvider, 'searchClnTranInjRespSearchModel' => $searchClnTranInjRespSearchModel, 'dataClnTranInjRespProvider' => $dataClnTranInjRespProvider]);
     }
 }