/** * Finds the Patient model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Patient the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Patient::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getIdPatient() { return $this->hasOne(Patient::className(), ['patient_id' => 'id_patient'])->from(['idPatient' => Patient::tableName()]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Patient::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['glaukuchets.glaukuchet_lastchange' => SORT_DESC]]]); $this->glaukRelations($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; } $this->glaukFilter($query); $this->glaukSort($dataProvider); $this->glaukDopfilter($query); return $dataProvider; }
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; }
\Yii::$app->getView()->registerJsFile(Yii::$app->request->baseUrl . '/js/patientglaukfilter.js'); use yii\helpers\Html; use kartik\dynagrid\DynaGrid; use app\func\Proc; 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) {
/** * @return \yii\db\ActiveQuery */ public function getPatients() { return $this->hasOne(Patient::className(), ['id_fias' => 'AOGUID'])->from(['patients' => Patient::tableName()]); }