/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = SepsisShock::find(); //->orderBy(['(id)' => SORT_DESC]) $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => 'DESC']], 'pagination' => ['pageSize' => 20]]); $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; } if (!is_null($this->time2hos) && strpos($this->time2hos, ' - ') !== false) { list($start_date, $end_date) = explode(' - ', $this->time2hos); $query->andFilterWhere(['between', 'time2hos', $start_date, $end_date]); $this->time2hos = null; } $query->andFilterWhere(['id' => $this->id, 'hn' => $this->hn, 'admit_date' => $this->admit_date, 'time2hos' => $this->time2hos, 'timehc' => $this->timehc, 'timecbc' => $this->timecbc, 'timeatb' => $this->timeatb, 'shock_refer' => $this->shock_refer, 'time_septic_shock' => $this->time_septic_shock]); $query->andFilterWhere(['like', 'cause_sepsis', $this->cause_sepsis])->andFilterWhere(['like', 'complications1', $this->complications1])->andFilterWhere(['like', 'complications2', $this->complications2])->andFilterWhere(['like', 'complications3', $this->complications3])->andFilterWhere(['like', 'shock6hr', $this->shock6hr])->andFilterWhere(['like', 'reason_refer1', $this->reason_refer1])->andFilterWhere(['like', 'reason_refer2', $this->reason_refer2])->andFilterWhere(['like', 'record_io_2hr', $this->record_io_2hr])->andFilterWhere(['like', 'iv_fluid', $this->iv_fluid])->andFilterWhere(['like', 'sepsis_type', $this->sepsis_type])->andFilterWhere(['like', 'ward_key', $this->ward_key]); //->andFilterWhere(['like', 'CausesepsisName', $this->CausesepsisName]); return $dataProvider; }
<p> <?php echo Html::a('บันทึกข้อมูลใหม่', ['create'], ['class' => 'btn btn-success']); ?> <?php /*<?= Html::a('ระบบรายงาน', ['report'], ['class' => 'btn btn-info']) ?> */ ?> </p> <?php $columns = [['attribute' => 'id', 'width' => '30px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'hn', 'width' => '120px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'time2hos', 'format' => 'html', 'width' => '80px', 'headerOptions' => ['style' => 'text-align:center'], 'filterType' => \kartik\grid\GridView::FILTER_DATE_RANGE, 'filterWidgetOptions' => ['presetDropdown' => false, 'language' => 'th', 'pluginOptions' => ['format' => 'dd-M-yyyy H:ii P', 'separator' => ' TO ', 'opens' => 'left'], 'pluginEvents' => ["apply.daterangepicker" => "function() { apply_filter('date') }"]]], ['attribute' => 'cause_sepsis', 'filter' => \app\models\SepsisShock::itemAilas('causesepsis'), 'value' => function ($model) { return $model->CausesepsisName; }, 'width' => '160px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'ward_key', 'filter' => \app\models\SepsisShock::itemAilas('ward'), 'value' => function ($model) { return $model->wardName; }, 'width' => '160px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'reason_refer1', 'filter' => \app\models\SepsisShock::itemAilas('reasonrefer1'), 'value' => function ($model) { return $model->reasonrefer1Name; }, 'width' => '160px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'reason_refer2', 'filter' => \app\models\SepsisShock::itemAilas('reasonrefer2'), 'value' => function ($model) { return $model->reasonrefer2Name; }, 'width' => '160px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['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', 'ต้องการลบรายการนี้?')]); }]]]; echo DynaGrid::widget(['columns' => $columns, 'storage' => DynaGrid::TYPE_SESSION, 'theme' => 'panel-default', 'enableMultiSort' => true, 'gridOptions' => ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pjax' => true, 'panel' => ['heading' => '<h3 class="panel-title">รายการ Sepsis</h3>', 'defaultPageSize' => 20]], 'options' => ['id' => 'dynagrid-1'], 'showSort' => true]); ?> </div> <script type="text/javascript"> function apply_filter() {
<?php use yii\helpers\Html; use yii\widgets\DetailView; use app\models\SepsisShock; /* @var $this yii\web\View */ /* @var $model app\models\SepsisShock */ $this->title = 'กำลังดูรายการ ' . $model->id; $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Sepsis Shocks'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="sepsis-shock-view"> <p> <?php echo Html::a(Yii::t('app', 'กลับสู่หน้าหลัก'), ['index'], ['class' => 'btn btn-warning']); ?> <?php echo Html::a(Yii::t('app', 'แก้ไข'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Yii::t('app', 'ลบรายการนี้'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['hn', 'time2hos:datetime', 'timehc:datetime', 'timeatb:datetime', 'CausesepsisName', ['attribute' => 'ภาวะแทรกซ้อน 1', 'value' => $model->complications1 === null ? '' : SepsisShock::itemAilas('complications', $model->complications1)], ['attribute' => 'ภาวะแทรกซ้อน 2', 'value' => $model->complications2 === null ? '' : SepsisShock::itemAilas('complications', $model->complications2)], ['attribute' => 'ภาวะแทรกซ้อน 3', 'value' => $model->complications3 === null ? '' : SepsisShock::itemAilas('complications', $model->complications3)], ['attribute' => 'ถ้า shock มีปัสสาวะออกที่ 6ชม. > BW/2/hr หรือไม่', 'value' => $model->shock6hr === null ? '' : SepsisShock::itemAilas('shock6hr', $model->shock6hr)], ['attribute' => 'ถ้า shock มีการ refer หรือไม่', 'value' => $model->shock_refer === null ? '' : SepsisShock::itemAilas('shockrefer', $model->shock_refer)], ['attribute' => 'เหตุผลในการ Refer', 'value' => $model->reason_refer1 === null ? '' : SepsisShock::itemAilas('reasonrefer1', $model->reason_refer1)], ['attribute' => 'สาเหตุในการ Refer', 'value' => $model->reason_refer2 === null ? '' : SepsisShock::itemAilas('reasonrefer2', $model->reason_refer2)], ['attribute' => 'Record I/O ทันใน2ชม และครบ', 'value' => $model->record_io_2hr === null ? '' : SepsisShock::itemAilas('ivfluid', $model->record_io_2hr)], ['attribute' => 'IV fluid 1500-3000 ทันเวลา6ชม', 'value' => $model->iv_fluid === null ? '' : SepsisShock::itemAilas('ivfluid', $model->iv_fluid)], 'sepsis_type', 'other_comment:text']]); ?> </div>
</div> <div class="col-md-4"> <?php echo $form->field($model, 'iv_fluid')->widget(Select2::classname(), ['data' => $model->itemIvfluid, 'options' => ['placeholder' => '-----'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> <div class="col-md-4"> <div class="well"> <?php /*= $form->field($model, 'sepsis_type')->inline(true)->checkboxList([ '1' => 'Zevier Sepsis', '2' => 'Sepsis Shock' ]) */ ?> <?php echo $form->field($model, 'sepsis_type')->inline()->checkboxList(SepsisShock::itemAilas('sepsistype')); ?> </div> <?php /* echo $form->field($model, 'time_septic_shock')->widget(DatePicker::classname(), [ 'options' => ['placeholder' => 'เลือกวันที่ ...'], 'language' => 'th', 'pluginOptions' => [ 'autoclose' => true, 'format' => 'yyyy-mm-dd', 'todayHighlight' => true ] ]);*/ ?> </div>
/** * Finds the SepsisShock model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return SepsisShock the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = SepsisShock::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }