コード例 #1
0
ファイル: KhoaSearch.php プロジェクト: anhnt36/yii2-clinic
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Khoa::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]);
     $query->andFilterWhere(['like', 'tenKhoa', $this->tenKhoa])->andFilterWhere(['like', 'moTa', $this->moTa]);
     return $dataProvider;
 }
コード例 #2
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]);
 }
コード例 #3
0
 /**
  * Finds the Khoa model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Khoa the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Khoa::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #4
0
ファイル: index.php プロジェクト: anhnt36/yii2-clinic
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('Tạo bệnh án', ['create?hoso=' . $_GET['hoso']], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['id', 'maHS', ['label' => 'Đề xuất khám', 'format' => 'raw', 'value' => function ($data) {
    $array = array();
    $arrayBA = explode(' ', $data->deXuatKham);
    $khoa = \app\models\Khoa::find()->all();
    foreach ($khoa as $k) {
        if (in_array($k->id, $arrayBA)) {
            $array[] = $k->tenKhoa;
        }
    }
    return implode(',</br />', $array);
}], 'ketLuanBA:ntext', 'lichHen', ['label' => 'Viện phí', 'format' => 'raw', 'value' => function ($data) {
    $url = "vienphi/create?benhan={$data->id}";
    return Html::a('Viện phí', $url, ['title' => 'Go']);
}], ['label' => 'In hóa đơn', 'format' => 'raw', 'value' => function ($data) {
    $model1 = \app\models\Vienphi::findOne(['maBA' => $data->id]);
    if (!empty($model1)) {
        $url = "vienphi/inhoadon?benhan={$data->id}";
        return Html::a('In hóa đơn', $url, ['title' => 'Go']);
    } else {
コード例 #5
0
ファイル: index.php プロジェクト: anhnt36/yii2-clinic
/* @var $this yii\web\View */
/* @var $searchModel app\models\PhongkhamSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Phòng khám';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="phongkham-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('Tạo phòng khám', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['id', 'maKhoa', 'tenPK', ['label' => 'Thuộc khoa', 'format' => 'raw', 'value' => function ($data) {
    $url = \app\models\Khoa::findOne(['id' => $data->maKhoa]);
    return $url->tenKhoa;
}], 'moTa:ntext', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>