Esempio n. 1
0
 public function actionIndex()
 {
     $ward = Yii::$app->user->identity->ward;
     $team = WorkloadTeam::find()->where('ward = :ward', [':ward' => $ward])->all();
     //        $event = NurseEvent::findOne($event_ref);
     $ward_name = Ward::find()->where('code=:code', [':code' => $ward])->one();
     $sql = "SELECT  bed.ward\n,     bed.team_name\n,     bed.bed_type\n,     bed.bed_no\n,     patient.patient_name\n,     patient.pt_type\n,     bed.team_ref\n\nFROM   (SELECT  a.ward\n,     a.team_name\n,     b.bed_type\n,     b.bed_no\n,     b.ref\n,     a.ref as team_ref\n\nFROM   workload_team  a\nRIGHT JOIN  workload_bed  b  ON  a.ref = b.team_ref\n\nWHERE   a.ward  =  '" . $ward . "')    bed\nLEFT OUTER JOIN (SELECT  c.bed_type\n,        c.bed_no\n,        CONCAT(c.title,c.`name`,'  ',c.surname)  patient_name\n,        c.pt_type\nFROM      nurse_patient   c\nWHERE      c.event_ref  =  \n(SELECT  MAX(ref)   \nFROM  nurse_event \nWHERE ward = '" . $ward . "'  AND  patient_flag = '1' and disc_type=0))  patient \nON bed.bed_type  =  patient.bed_type\nAND bed.bed_no   =  patient.bed_no\nORDER BY bed.ref,bed.bed_no";
     //        $patient = NursePatient::findBySql($sql)->all();
     //        print_r($patient);
     $command = Yii::$app->db->createCommand($sql);
     $patient = $command->queryAll();
     //var_dump($patient);
     //echo $sql;
     return $this->render('index', ['patient' => $patient, 'team' => $team]);
 }
 public function actionDailyReport($event_ref)
 {
     $ward = Yii::$app->user->identity->ward;
     $event = NurseEvent::findOne($event_ref);
     $ward_name = Ward::find()->where('code=:code', [':code' => $ward])->one();
     $patient = NursePatient::find()->where('event_ref=:event_ref and disc_type=0', [':event_ref' => $event_ref])->orderBy('bed_type desc,bed_no asc')->all();
     return $this->renderPartial('daily_report', ['patient' => $patient, 'event' => $event, 'ward_name' => $ward_name]);
 }
Esempio n. 3
0
 public function getWard($ward)
 {
     $item = Ward::find()->where('code = :ward', [':ward' => $ward])->one();
     return $item->ward;
 }
Esempio n. 4
0
 public function getOfficeData()
 {
     return @$this->hasOne(Ward::className(), ['code' => 'infect_ward']);
 }
Esempio n. 5
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\models\LibDisease;
use yii\helpers\ArrayHelper;
use app\models\Ward;
use kartik\date\DatePicker;
use app\models\LibIcposition;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $model app\models\WorkloadIc */
/* @var $form yii\widgets\ActiveForm */
$lib_disease = ArrayHelper::map(LibDisease::find()->all(), 'ref', 'disease');
$lib_ward = ArrayHelper::map(Ward::find()->all(), 'code', 'ward');
$lib_icposition = ArrayHelper::map(LibIcposition::find()->all(), 'ref', 'name');
?>
<!--<ul class="nav nav-tabs">
  <li role="presentation" class="active"><a href="#">IC</a></li>
  <li role="presentation"><a href="#">GCS</a></li>
  <li role="presentation"><a href="#">Key Muscle</a></li>
</ul>-->
<div class="workload-ic-form">
     <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['label' => 'ตำแหน่ง', 'options' => ['class' => 'col-sm-2'], 'attribute' => 'positionName'], ['label' => 'เชื้อสาเหตุ', 'options' => ['class' => 'col-sm-4'], 'attribute' => 'diseaseName'], ['label' => 'รายละเอียด', 'options' => ['class' => 'col-sm-2'], 'attribute' => 'type'], ['label' => 'หน่วยงาน', 'options' => ['class' => 'col-sm-2'], 'attribute' => 'officeName'], ['label' => 'วันที่เกิด', 'options' => ['class' => 'col-sm-2'], 'attribute' => 'infect_date'], ['class' => 'yii\\grid\\ActionColumn', 'options' => ['class' => 'col-sm-1'], 'header' => 'ลบ', 'template' => '{delete}']]]);
?>

    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">เพิ่มข้อมูลการเฝ้าระวัง</h3>
        </div>
Esempio n. 6
0
 /**
  * Get districts that belong to the city/province by city_id
  *
  * @param int $id City id
  *
  * @return \Illuminate\Support\Collection $collection
  */
 protected function _getWardsByCityId($id)
 {
     $dbRaw = DB::raw("id, CONCAT(type, ' ', name) as name");
     $wards = Ward::where('district_id', $id)->select($dbRaw)->orderBy('name')->get();
     return $wards;
 }