Диплом: Автоматизация обработки заявок в "ГБУЗ Городская клиническая больница №52 ДЗМ"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
111
andWhere ('request.date_reg >= :date1 and request.date_reg <
:date2')->
groupby (['user.id', 'user.last_name', 'user.first_name',
'user.middle_name'])->
orderby('user.last_name, user.first_name, user.middle_name')->
//orderby('user.organization_name')->
params ([':date1'=>$User->report_date_1, ':date2'=>$User-
>report_date_2])
;
$dataProvider = new ActiveDataProvider([
'query' => $Q
,
]);
return $this->render('report-clients', [
'dataProvider' => $dataProvider,
'ReportParams' => User::findOne(Yii::$app->user-
>identity->id),
]);
}
public function actionServicesStat()
{
Yii::$app->user->identity->AccessAdminManager;
$User = User::find()->where (['id'=> Yii::$app->user->identity-
>id])->one();
$Q = new Yii\db\Query ();
112
$Q->select([
'service.id',
'service.title',
'service.cost',
'sum(request_service.amount) as service_count',
'sum(request_service.amount)*service.cost as
service_total',
])->
from(['service', 'request_service', 'request'])->
andWhere ('service.id = request_service.id_service')->
andWhere ('request.id = request_service.id_request')->
andWhere ('request.date_reg >= :date1 and request.date_reg <
:date2')->
groupby (['service.id', 'service.title', 'service.cost'])->
orderby('service.title')->
params ([':date1'=>$User->report_date_1, ':date2'=>$User-
>report_date_2])
;
$dataProvider = new ActiveDataProvider([
'query' => $Q
,
]);
return $this->render('report-services-stat', [
'dataProvider' => $dataProvider,
113
'ReportParams' => User::findOne(Yii::$app->user-
>identity->id),
]);
}
public function actionClaimStat()
{
Yii::$app->user->identity->AccessAdminManager;
$User = User::find()->where (['id'=> Yii::$app->user->identity-
>id])->one();
$Q = new Yii\db\Query ();
$Q->select([
'claim_type.id',
'claim_type.title',
'count(claim_type.id) as claim_count',
'sum(if(request_claim.closed,1,0)) as
closed_claim_count',
'sum(if(request_claim.closed,0,1)) as
open_claim_count',
])->
from(['claim_type', 'request_claim', 'request'])->
andWhere ('claim_type.id = request_claim.id_claim_type')->
andWhere ('request.id = request_claim.id_request')->
114
andWhere ('request.date_reg >= :date1 and request.date_reg <
:date2')->
groupby (['claim_type.id', 'claim_type.title'])->
orderby('claim_type.title')->
params ([':date1'=>$User->report_date_1, ':date2'=>$User-
>report_date_2])
;
$dataProvider = new ActiveDataProvider([
'query' => $Q
,
]);
return $this->render('report-claim-stat', [
'dataProvider' => $dataProvider,
'ReportParams' => User::findOne(Yii::$app->user-
>identity->id),
]);
}
/**
* Finds the Request model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Request the loaded model
* @throws NotFoundHttpException if the model cannot be found
115
*/
protected function findModel($id)
{
if (($model = Request::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}
RequestController.php
<?php
namespace app\controllers;
use Yii;
use app\models\Request;
use app\models\RequestSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
/**
* RequestController implements the CRUD actions for Request model.
*/
class RequestController extends Controller
{
public function behaviors()
116
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'actions' => ['index', 'view', 'create', 'update',
'delete'],
'allow' => true,
'roles' => ['@'],
],
],
],
];
}
/**
* Lists all Request models.
* @return mixed
*/
public function actionIndex()
117
{
Yii::$app->user->identity->accessAdminManagerClient;
$searchModel = new RequestSearch();
if (Yii::$app->user->identity->isClient)
{
$searchModel->id_client = Yii::$app->user->identity->id;
}
$dataProvider = $searchModel->search(Yii::$app->request-
>queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Request model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
Yii::$app->user->identity->accessAdminManagerClient;
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
118
* Creates a new Request model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
Yii::$app->user->identity->accessAdminManagerClient;
$model = new Request();
if (Yii::$app->user->identity->isClient)
{
$model->id_client = Yii::$app->user->identity->id;
}
if (!Yii::$app->user->identity->isClient)
{
$model->id_user = Yii::$app->user->identity->id;
}
if ($model->load(Yii::$app->request->post()) && $model->save())
{
if (empty ($model->date_reg))
{
$model->date_reg = date("Y-m-d H:i:s");
$model->save();
}
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render(Yii::$app->user->identity->isClient ? 'client_create'
: 'create', [
119
'model' => $model,
]);
}
}
/**
* Updates an existing Request model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
Yii::$app->user->identity->accessAdminManagerClient;
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save())
{
if (!Yii::$app->user->identity->isClient)
{
if (empty($model->id_user))
{
$model->id_user = Yii::$app->user->identity-
>id;
$model->save();
}
}
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render(Yii::$app->user->identity->isClient ?
'client_update' : 'update', [
120
'model' => $model,
]);
}
}
/**
* Deletes an existing Request model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
Yii::$app->user->identity->accessAdminManagerClient;
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Request model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Request the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Request::findOne($id)) !== null)
{
if (Yii::$app->user->identity->isClient)

Смотрите также:

"Автоматизация обработки заявок ООО "Проектно-Строительная Компания"
"Автоматизация процесса аттестации персонала для ООО "Нэт Бай Нэт Холдинг"
"Анализ интернет-активности конкурентов ( на примере конкурентов "Газпром нефть")
"Бухгалтерский учёт и аудит расчётов с подотчётними лицами в организации на примере ООО "ЛОЦ 10""
«Психологическое сопровождение персонала в организации на примере ООО «Крокус»
Cовершенствование деловой оценки персонала в организации (на примере ООО "Даймонд кейтеринг развитие")
IPO - инструмент финансирования деятельности организации. На примере ПАО «Нефтяная компания «Лукойл»
PR как средство продвижения организации (на примере ПАО "Тамбовский завод "Комсомолец им. Н.С. Артемова")
PR-коммуникации в сфере общественного питания (на примере кафе-кондитерской «Cream Cheese»)
SMM как средство повышения эффективности работы учреждений социокультурной сферы (на примере Малого театра)