Exemple #1
0
 public function actionCount($id)
 {
     $physician = Physician::findOne($id);
     if ($physician !== null) {
         return json_encode($physician->getCountAvailableTimeByDates());
     }
 }
Exemple #2
0
 public function import()
 {
     if ($this->validate()) {
         if ($handle = fopen($this->file->tempName, 'r')) {
             ini_set('max_execution_time', 6000);
             while ($data = fgetcsv($handle, 1000, ',')) {
                 $physician_snils = preg_replace('/[^0-9]/', '', $data[1]);
                 if (empty($physician_snils)) {
                     continue;
                 }
                 $physician = Physician::findOne(['snils' => $physician_snils]);
                 if ($physician === null) {
                     $physician = new Physician();
                     $physician->specialty_id = 1;
                     $physician->snils = $physician_snils;
                     $physician->last_name = 'Необходимо заполнить';
                     $physician->first_name = 'Необходимо заполнить';
                     $physician->patronymic = 'Необходимо заполнить';
                     $physician->save();
                 }
                 if (isset($physician->physician_id)) {
                     $last_name = mb_convert_case(trim($data[2]), MB_CASE_TITLE);
                     $first_name = mb_convert_case(trim($data[3]), MB_CASE_TITLE);
                     $patronymic = mb_convert_case(trim($data[4]), MB_CASE_TITLE);
                     $birth_date = trim($data[5]);
                     $policy = trim($data[6]);
                     $patient = Patient::findOne(['policy' => $policy]);
                     if ($patient === null) {
                         $patient = new Patient();
                         $patient->physician_id = $physician->physician_id;
                         $patient->policy = $policy;
                         $patient->last_name = $last_name;
                         $patient->first_name = $first_name;
                         $patient->patronymic = $patronymic;
                         $patient->birth_date = date('Y-m-d', strtotime($birth_date));
                         $patient->save();
                     }
                 }
             }
             fclose($handle);
             return true;
         }
     }
     return false;
 }
Exemple #3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Physician::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(['physician_id' => $this->physician_id, 'specialty_id' => $this->specialty_id, 'snils' => $this->snils, 'not_accept' => $this->not_accept, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'last_name', $this->last_name])->andFilterWhere(['like', 'first_name', $this->first_name])->andFilterWhere(['like', 'patronymic', $this->patronymic]);
     return $dataProvider;
 }
 /**
  * @param integer $physicianId
  * @return mixed
  */
 public function actionUpdate($physicianId)
 {
     $physician = Physician::findOne($physicianId);
     $receptions = Reception::findAll(['physician_id' => $physicianId]);
     if (Yii::$app->request->post('Reception') !== null) {
         Reception::deleteAll(['physician_id' => $physicianId]);
         foreach (Yii::$app->request->post('Reception') as $item) {
             $model = new Reception();
             $model->physician_id = $physicianId;
             $model->locality_id = $item['locality'];
             $model->weekday = $item['weekday'];
             $model->hour = (int) $item['hour'];
             $model->minute = (int) $item['minute'];
             $model->save();
         }
         return $this->redirect(['/appointment/physician/view', 'id' => $physicianId]);
     } else {
         $codes = [];
         foreach ($physician->receptions as $reception) {
             $codes[] = $reception->code;
         }
         return $this->render('update', ['model' => new Reception(), 'physician' => $physician, 'codes' => $codes]);
     }
 }
Exemple #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPhysicians()
 {
     return $this->hasMany(Physician::className(), ['specialty_id' => 'specialty_id']);
 }
Exemple #6
0
<div class="patient-form">

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

    <?php 
echo $form->field($model, 'blocked')->checkbox();
?>

    <?php 
echo $form->field($model, 'locality_id')->dropDownList(Locality::getList());
?>

    <?php 
echo $form->field($model, 'physician_id')->dropDownList(\app\modules\appointment\models\Physician::getList());
?>

    <?php 
echo $form->field($model, 'policy')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'last_name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'first_name')->textInput(['maxlength' => true]);
?>

    <?php 
Exemple #7
0
                    <?php 
echo $form->field($model, 'specialty_id')->dropDownList(Specialty::getList($patient->physicianSpecialty), ['prompt' => '-'])->label(false);
?>
                </div>
            </div>

            <div class="col-sm-6 physician" style="display: none;">
                <div class="well">
                    <h4><?php 
echo $model->getAttributeLabel('physician_id');
?>
</h4>

                    <?php 
echo $form->field($model, 'physician_id')->dropDownList(Physician::getList(null, $patient->physician_id), ['prompt' => '-'])->label(false);
?>
                </div>
            </div>

            <div class="col-sm-6 date" style="display: none;">
                <div class="well">
                    <h4><?php 
echo $model->getAttributeLabel('date');
?>
</h4>

                    <?php 
echo $form->field($model, 'date')->widget(DatePicker::className(), ['inline' => true, 'dateFormat' => 'dd.MM.yyyy', 'clientOptions' => ['minDate' => date('d.m.Y', strtotime('+3 days')), 'maxDate' => date('d.m.Y', strtotime('+10 days')), 'onSelect' => new JsExpression('
                                function () {
                                    $.ajax({
 /**
  * Finds the Physician model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Physician the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Physician::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #9
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPhysician()
 {
     return $this->hasOne(Physician::className(), ['physician_id' => 'physician_id']);
 }
Exemple #10
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPhysicians()
 {
     return $this->hasMany(Physician::className(), ['physician_id' => 'physician_id'])->viaTable('physician_locality', ['locality_id' => 'locality_id']);
 }