Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Glprep::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['glprep_id' => SORT_DESC]]]);
     $query->joinWith(['idPreparat']);
     $this->load($params);
     // Отображает список препаратов глаукомного пациента в его карте
     if (isset($params['id'])) {
         $Glaukuchet = Glaukuchet::findOne(['id_patient' => $params['id']]);
         $query->andFilterWhere(['id_glaukuchet' => empty($Glaukuchet) ? -1 : $Glaukuchet->primaryKey]);
     } else {
         $query->andFilterWhere(['id_glaukuchet' => -1]);
     }
     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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['glprep_id' => $this->glprep_id, 'id_glaukuchet' => $this->id_glaukuchet, 'id_preparat' => $this->id_preparat, 'glprep_rlocat' => $this->glprep_rlocat]);
     $query->andFilterWhere(['LIKE', 'idPreparat.preparat_name', $this->getAttribute('idPreparat.preparat_name')]);
     Proc::AssignRelatedAttributes($dataProvider, ['idPreparat.preparat_name']);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 public function delete()
 {
     $result = parent::delete();
     if ($result) {
         // При изменении препаратов, менять пользователя и дату изменения в карте глаукомного пациента
         Glaukuchet::findOne($this->id_glaukuchet)->UpdateChangeAttributes();
     }
     return $result;
 }
Ejemplo n.º 3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Glaukuchet::find();
     // add conditions that should always apply here
     $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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['glaukuchet_id' => $this->glaukuchet_id, 'glaukuchet_uchetbegin' => $this->glaukuchet_uchetbegin, 'glaukuchet_detect' => $this->glaukuchet_detect, 'glaukuchet_deregdate' => $this->glaukuchet_deregdate, 'glaukuchet_deregreason' => $this->glaukuchet_deregreason, 'glaukuchet_stage' => $this->glaukuchet_stage, 'glaukuchet_operdate' => $this->glaukuchet_operdate, 'glaukuchet_invalid' => $this->glaukuchet_invalid, 'glaukuchet_lastvisit' => $this->glaukuchet_lastvisit, 'glaukuchet_lastmetabol' => $this->glaukuchet_lastmetabol, 'id_patient' => $this->id_patient, 'id_employee' => $this->id_employee, 'id_class_mkb' => $this->id_class_mkb]);
     $query->andFilterWhere(['like', 'glaukuchet_comment', $this->glaukuchet_comment]);
     return $dataProvider;
 }
Ejemplo n.º 4
0
 /**
  * Deletes an existing Patient model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param string $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     if (Yii::$app->request->isAjax) {
         $transaction = Yii::$app->db->beginTransaction();
         try {
             $Glaukuchet = Glaukuchet::findOne(['id_patient' => $id]);
             if (!empty($Glaukuchet)) {
                 Glprep::deleteAll(['id_glaukuchet' => $Glaukuchet->primaryKey]);
                 Glaukuchet::deleteAll(['id_patient' => $id]);
             }
             echo $this->findModel($id)->delete();
             $transaction->commit();
         } catch (Exception $e) {
             $transaction->rollBack();
             throw new Exception($e->getMessage());
         }
     }
 }
Ejemplo n.º 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getGlaukuchets()
 {
     return $this->hasOne(Glaukuchet::className(), ['id_patient' => 'patient_id'])->from(['glaukuchets' => Glaukuchet::tableName()]);
 }
Ejemplo n.º 6
0
 public static function VariablesValues($attribute, $value = NULL)
 {
     $values = ['patient_pol' => Patient::VariablesValues($attribute), 'fias_city' => [$value => Fias::GetCityByAOGUID($value)], 'fias_street' => [$value => Fias::GetStreetByAOGUID($value)], 'glaukuchet_detect' => Glaukuchet::VariablesValues($attribute), 'glaukuchet_deregreason' => Glaukuchet::VariablesValues($attribute), 'glaukuchet_stage' => Glaukuchet::VariablesValues($attribute), 'glaukuchet_invalid' => Glaukuchet::VariablesValues($attribute), 'glaukuchet_id_employee' => [$value => Employee::getEmployeeByID($value)], 'employee_id_person' => [$value => Authuser::getAuthuserByID($value)], 'employee_id_dolzh' => [$value => Dolzh::getDolzhByID($value)], 'employee_id_podraz' => [$value => Podraz::getPodrazByID($value)], 'employee_id_build' => [$value => Build::getBuildByID($value)], 'glprep_id_preparat' => [$value => Preparat::getPreparatByID($value)], 'glprep_rlocat' => Glprep::VariablesValues($attribute)];
     return isset($values[$attribute]) ? $values[$attribute] : NULL;
 }
Ejemplo n.º 7
0
use yii\helpers\Url;
use app\models\Base\Patient;
use app\models\Glauk\Glaukuchet;
/* @var $this yii\web\View */
/* @var $searchModel app\models\Patient\GlaukPatientSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Пациенты';
$this->params['breadcrumbs'] = Proc::Breadcrumbs($this, ['addfirst' => ['label' => 'Регистр глаукомных пациентов', 'url' => Url::toRoute('Base/patient/glaukindex')], 'clearbefore' => true]);
?>
<div class="patient-glaukindex">
    <?php 
$patient_pol = Patient::VariablesValues('patient_pol');
$glaukuchet_detect = Glaukuchet::VariablesValues('glaukuchet_detect');
$glaukuchet_deregreason = Glaukuchet::VariablesValues('glaukuchet_deregreason');
$glaukuchet_stage = Glaukuchet::VariablesValues('glaukuchet_stage');
$glaukuchet_invalid = Glaukuchet::VariablesValues('glaukuchet_invalid');
echo DynaGrid::widget(Proc::DGopts(['options' => ['id' => 'patientglaukgrid'], 'columns' => Proc::DGcols(['buttonsfirst' => true, 'columns' => ['patient_fam', 'patient_im', 'patient_ot', ['attribute' => 'patient_dr', 'format' => 'date'], ['attribute' => 'patient_pol', 'filter' => $patient_pol, 'value' => function ($model) use($patient_pol) {
    return isset($patient_pol[$model->patient_pol]) ? $patient_pol[$model->patient_pol] : '';
}, 'visible' => false], ['attribute' => 'idFias.fias_city', 'visible' => false], ['attribute' => 'idFias.fias_street', 'visible' => false], ['attribute' => 'patient_dom', 'visible' => false], ['attribute' => 'patient_korp', 'visible' => false], ['attribute' => 'patient_kvartira', 'visible' => false], ['attribute' => 'glaukuchets.glaukuchet_uchetbegin', 'format' => 'date', 'visible' => false], ['attribute' => 'glaukuchets.glaukuchet_detect', 'filter' => $glaukuchet_detect, 'value' => function ($model) use($glaukuchet_detect) {
    return isset($glaukuchet_detect[$model->glaukuchets->glaukuchet_detect]) ? $glaukuchet_detect[$model->glaukuchets->glaukuchet_detect] : '';
}, 'visible' => false], ['attribute' => 'glaukuchets.glaukuchet_deregdate', 'format' => 'date', 'visible' => false], ['attribute' => 'glaukuchets.glaukuchet_deregreason', 'filter' => $glaukuchet_deregreason, 'value' => function ($model) use($glaukuchet_deregreason) {
    return isset($glaukuchet_deregreason[$model->glaukuchets->glaukuchet_deregreason]) ? $glaukuchet_deregreason[$model->glaukuchets->glaukuchet_deregreason] : '';
}, 'visible' => false], ['attribute' => 'glaukuchets.glaukuchet_stage', 'filter' => $glaukuchet_stage, 'value' => function ($model) use($glaukuchet_stage) {
    return isset($glaukuchet_stage[$model->glaukuchets->glaukuchet_stage]) ? $glaukuchet_stage[$model->glaukuchets->glaukuchet_stage] : '';
}, 'visible' => false], ['attribute' => 'glaukuchets.glaukuchet_operdate', 'format' => 'date', 'visible' => false], ['attribute' => 'glaukuchets.glaukuchet_invalid', 'filter' => $glaukuchet_invalid, 'value' => function ($model) use($glaukuchet_invalid) {
    return isset($glaukuchet_invalid[$model->glaukuchets->glaukuchet_invalid]) ? $glaukuchet_invalid[$model->glaukuchets->glaukuchet_invalid] : '';
}, 'visible' => false], ['attribute' => 'glaukuchets.glaukuchet_lastvisit', 'format' => 'date'], ['attribute' => 'glaukuchets.glaukuchet_lastmetabol', 'format' => 'date', 'visible' => false], ['attribute' => 'glaukuchets.idEmployee.idperson.auth_user_fullname', 'label' => 'ФИО врача'], ['attribute' => 'glaukuchets.idEmployee.iddolzh.dolzh_name', 'label' => 'Специальность врача', 'visible' => false], ['attribute' => 'glaukuchets.idEmployee.idpodraz.podraz_name', 'label' => 'Подразделение врача', 'visible' => false], ['attribute' => 'glaukuchets.idEmployee.idbuild.build_name', 'label' => 'Местонахождение врача'], ['attribute' => 'glaukuchets.idClassMkb.code', 'visible' => false], ['attribute' => 'glaukuchets.idClassMkb.name', 'visible' => false], ['attribute' => 'glaukuchets.glpreps.glaukuchet_preparats', 'filter' => false, 'value' => function ($model) {
    $a = '';
    return isset($model->glaukuchets->glpreps[0]->glaukuchet_preparats) ? $model->glaukuchets->glpreps[0]->glaukuchet_preparats : '';
}, 'headerOptions' => ['attr_fullname' => 'glaukuchets.glpreps.glaukuchet_preparats'], 'visible' => false], ['attribute' => 'patient_username', 'visible' => false], ['attribute' => 'patient_lastchange', 'format' => 'datetime', 'visible' => false], ['attribute' => 'glaukuchets.glaukuchet_username', 'visible' => false], ['attribute' => 'glaukuchets.glaukuchet_lastchange', 'format' => 'datetime', 'visible' => false]], 'buttons' => array_merge(Yii::$app->user->can('GlaukUserPermission') ? ['update' => function ($url, $model, $key) {
    $customurl = Url::to(['Base/patient/update', 'id' => $model->primarykey, 'patienttype' => 'glauk']);