コード例 #1
0
ファイル: BenhanSearch.php プロジェクト: anhnt36/yii2-clinic
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Benhan::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(['id' => $this->id, 'maHS' => $this->maHS, 'lichHen' => $this->lichHen, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'deXuatKham', $this->deXuatKham])->andFilterWhere(['like', 'ketLuanBA', $this->ketLuanBA]);
     return $dataProvider;
 }
コード例 #2
0
ファイル: view.php プロジェクト: anhnt36/yii2-clinic
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model app\models\Vienphi */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Viện phí', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<a href='javascript:history.go(-1)' class="btn btn-warning">Quay lại trang trước</a>
<a href='<?php 
echo Yii::$app->request->baseUrl;
?>
/benhan?hoso=
<?php 
echo \app\models\Benhan::findOne(['id' => $model->maBA])->maHS;
?>
' class='btn btn-success'>Danh sách bệnh án
</a>

<div class="vienphi-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
コード例 #3
0
ファイル: _form.php プロジェクト: anhnt36/yii2-clinic
/* @var $model app\models\Bnpk */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="bnpk-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
$all = \app\models\Phongkham::find()->all();
$array = array();
$arrayBA = array();
if (!empty($_GET['benhan'])) {
    $benhan = \app\models\Benhan::findOne(['id' => $_GET['benhan']]);
    $arrayBA = explode(' ', $benhan->deXuatKham);
}
//    var_dump($arrayBA);
foreach ($all as $phongkham) {
    if (in_array($phongkham->maKhoa, $arrayBA)) {
        $array["{$phongkham->id}"] = $phongkham->tenPK;
    }
}
echo $form->field($model, 'maPK')->dropDownList($array);
?>

    <?php 
echo $form->field($model, 'ketQua')->textarea(['rows' => 6]);
?>
コード例 #4
0
 /**
  * Deletes an existing Benhnhan model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $noitru = Noitru::findOne(['maBN' => $id]);
     if (!empty($noitru)) {
         Noitru::findOne(['maBN' => $id])->delete();
     }
     $maHS = Hoso::findOne(['maBN' => $id])->id;
     $benhan = Benhan::find()->all();
     foreach ($benhan as $ba) {
         if ($ba->maHS == $maHS) {
             Benhan::findOne(['id' => $ba->id])->delete();
         }
     }
     Hoso::findOne(['maBN' => $id])->delete();
     $this->findModel($id)->delete();
     return $this->redirect(['index']);
 }
コード例 #5
0
 /**
  * Finds the Benhan model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Benhan the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Benhan::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #6
0
 public function actionStatistics($bieudo)
 {
     if ($bieudo == 'tonghop') {
         $tonghop = array();
         $tonghop['Số lượng hồ sơ bệnh nhân lưu trong hệ thống'] = count(Benhnhan::find()->all());
         $tonghop['Số lượng bệnh nhân nội trú'] = count(Noitru::find()->all());
         $tonghop['Số lượng nhân viên'] = count(Nhanvien::find()->all());
         $tonghop['Số lượng phòng khám'] = count(Phongkham::find()->all());
         $tonghop['Số lượng khoa'] = count(Khoa::find()->all());
         return $this->render('statistics', ['tonghop' => $tonghop]);
     }
     if ($bieudo == 'benhnhan') {
         $count = array();
         $count['0'] = 0;
         $count['1'] = 0;
         $count['2'] = 0;
         $count['3'] = 0;
         $array = $this->actionThang();
         $benhan = Benhan::find()->all();
         foreach ($benhan as $ba) {
             if (date('m', $ba->created_at) == $array['0']) {
                 $count['0'] = $count[0] + 1;
             }
             if (date('m', $ba->created_at) == $array['1']) {
                 $count['1']++;
             }
             if (date('m', $ba->created_at) == $array['2']) {
                 $count['2']++;
             }
             if (date('m', $ba->created_at) == $array['3']) {
                 $count['3']++;
             }
         }
         return $this->render('statisticsBN', ['thang' => $array, 'value' => $count]);
     }
     $khoa = Khoa::find()->all();
     $dskhoa = array();
     $dsmakhoa = array();
     $count = array();
     $j = 0;
     foreach ($khoa as $k) {
         $dskhoa["{$j}"] = $k->tenKhoa;
         $dsmakhoa["{$j}"] = $k->id;
         $count["{$j}"] = 0;
         $j++;
     }
     $thang = 0;
     $now = getdate();
     if ($now['mon'] == 1) {
         $thang = 12;
     } else {
         $thang = $now['mon'];
     }
     $benhan = Benhan::find()->all();
     foreach (Bnpk::find()->all() as $lk) {
         if (date('m', $lk->ngayKham == $thang)) {
             for ($i = 0; $i < count($khoa); $i++) {
                 if (Phongkham::findOne(['id' => $lk->maPK])->maKhoa == $dsmakhoa["{$i}"]) {
                     $count["{$i}"]++;
                 }
             }
         }
     }
     return $this->render('statisticsLK', ['thang' => $thang, 'dskhoa' => $dskhoa, 'value' => $count, 'count' => $j]);
 }
コード例 #7
0
ファイル: view.php プロジェクト: anhnt36/yii2-clinic
<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model app\models\Benhan */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Benhans', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<a href='javascript:history.go(-1)' class="btn btn-warning">Quay lại trang trước</a>
<a href="<?php 
echo Yii::$app->request->baseUrl;
?>
/benhan?hoso=<?php 
echo \app\models\Benhan::findOne(['id' => $_GET['id']])->maHS;
?>
"  class="btn btn-success">Danh sách bệnh án</a>
<div class="benhnhan-view">

<div class="benhan-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>