Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Acs::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => 'DESC']]]);
     $dataProvider->sort->attributes['fullName'] = ['asc' => ['name' => SORT_ASC, 'surname' => SORT_ASC], 'desc' => ['name' => SORT_DESC, 'surname' => SORT_DESC], 'label' => 'ชื่อ - นามสกุล', 'default' => SORT_ASC];
     if (isset($_GET['AcsSearch']) && !($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     /*$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(['id' => $this->id, 'date' => $this->date, 'hn' => $this->hn, 'sex' => $this->sex, 'age' => $this->age, 'time2hos' => $this->time2hos, 'byems' => $this->byems, 'timetired' => $this->timetired, 'timeekg' => $this->timeekg, 'timeekghos' => $this->timeekghos, 'result_ekg' => $this->result_ekg, 'sbp' => $this->sbp, 'dbp' => $this->dbp, 'p' => $this->p, 'o2' => $this->o2, 'morphin' => $this->morphin, 'isdnsl' => $this->isdnsl, 'statin' => $this->statin, 'enalapri' => $this->enalapri, 'betablocker' => $this->betablocker, 'enoxapa' => $this->enoxapa, 'asaplavix' => $this->asaplavix, 'asaintime' => $this->asaintime, 'streptok' => $this->streptok, 'steptokinase' => $this->steptokinase, 'skhour' => $this->skhour, 'timereferout' => $this->timereferout, 'timehosbeforerefer' => $this->timehosbeforerefer, 'time_sk' => $this->time_sk]);
     $query->andFilterWhere(['like', 'depart', $this->depart])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'surname', $this->surname])->andFilterWhere(['like', 'condis1', $this->condis1])->andFilterWhere(['like', 'condis2', $this->condis2])->andFilterWhere(['like', 'condis3', $this->condis3])->andFilterWhere(['like', 'diagnosis', $this->diagnosis])->andFilterWhere(['like', 'refer_result', $this->refer_result])->andFilterWhere(['like', 'result_reply_loeihos', $this->result_reply_loeihos])->andFilterWhere(['like', 'result', $this->result]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 /**
  * Finds the Acs model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Acs the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Acs::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 3
0
Archivo: index.php Proyecto: poykub/wph
?>

    <p>
        <?php 
echo Html::a('บันทึกข้อมูลใหม่', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
$columns = [['attribute' => 'id', 'width' => '30px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'date', 'filterType' => GridView::FILTER_DATE, 'format' => 'raw', 'width' => '150px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'hn', 'width' => '100px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'depart', 'filter' => \app\models\Acs::itemsAlias('depart'), 'value' => function ($model) {
    return $model->departName;
}, 'width' => '120px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'fullName', 'headerOptions' => ['style' => 'text-align:center'], 'width' => '160px'], ['attribute' => 'sex', 'filter' => \app\models\Acs::itemsAlias('sex'), 'value' => function ($model) {
    return $model->sexName;
}, 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center', 'width' => '80px'], ['attribute' => 'age', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'time2hos', 'headerOptions' => ['style' => 'text-align:center']], ['attribute' => 'result_ekg', 'filter' => \app\models\Acs::itemsAlias('resultekg'), 'value' => function ($model) {
    return $model->ResultEkgName;
}, 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center', 'width' => '130px'], ['attribute' => 'diagnosis', 'filter' => \app\models\Acs::itemsAlias('diagnosis'), 'value' => function ($model) {
    return $model->diagnosisName;
}, 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center', 'width' => '140px'], ['attribute' => 'result', 'headerOptions' => ['style' => 'text-align:center'], 'filter' => \app\models\Acs::itemsAlias('result'), 'value' => function ($model) {
    return $model->resultName;
}, 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center', 'width' => '140px'], ['class' => 'kartik\\grid\\ActionColumn', 'dropdown' => false, 'vAlign' => 'middle', 'template' => '{view} {update} {delete}', 'buttons' => ['view' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', ['view', 'id' => $model->id], ['title' => 'ดูรายละเอียด', 'data-toggle' => 'tooltip']);
}, 'update' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', ['update', 'id' => $model->id], ['title' => 'แก้ไขรายละเอียด', 'data-toggle' => 'tooltip']);
}, 'delete' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', ['delete', 'id' => $model->id], ['title' => 'ลบรายการ', 'data-toggle' => 'tooltip', 'data-method' => 'post', 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?')]);
}]]];
echo DynaGrid::widget(['columns' => $columns, 'storage' => DynaGrid::TYPE_SESSION, 'theme' => 'panel-default', 'enableMultiSort' => false, 'gridOptions' => ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pjax' => true, 'hover' => true, 'panel' => ['heading' => '<h3 class="panel-title">รายการ</h3>', 'before' => '{dynagrid}']], 'options' => ['id' => 'dynagrid-1'], 'showSort' => false]);
?>

</div>