Example #1
0
 public function actionDel()
 {
     $Doctor = new Doctor();
     $Doctor->set_prop_from_arr($_REQUEST);
     $Doctor->hosp_id = $this->_user['hosp_id'];
     $ar['get'] = $Doctor->del();
     Core::encode_echo($ar);
 }
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Doctor::create(['firstname' => $faker->firstName, 'lastname' => $faker->lastName, 'email' => $faker->email, 'address1' => $faker->streetName, 'address2' => $faker->streetAddress, 'city' => $faker->city, 'state' => $faker->streetName, 'country' => $faker->country]);
     }
 }
Example #3
0
 public function actionLogin()
 {
     $t = \Yii::$app->request->post('t');
     $ar = [];
     $ar['t'] = $t;
     if ($t == 'adm') {
         $Adm = new Adm();
         $Adm->set_prop_from_arr($_REQUEST);
         $Adm->login();
     }
     if ($t == 'doctor') {
         $Doctor = new Doctor();
         $Doctor->set_prop_from_arr($_REQUEST);
         $Doctor->login();
     }
     Core::encode_echo($ar);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $doctor = Doctor::find($id);
     if (!$doctor) {
         return response()->json(['error' => ['message' => "Doctor doesn't exists"]], 404);
     }
     return response()->json(['data' => $doctor->toArray()], 200);
 }
Example #5
0
 public function actionSet()
 {
     $Mam = new Mam();
     $Mam->set_prop_from_arr($_REQUEST);
     $user = Doctor::getInstance()->get(\Yii::$app->user->id);
     $Mam->hosp_id = $user['hosp_id'];
     $Mam->doctor_id = $user['id'];
     $Mam->set();
     if (Core::hasError() === false) {
         $ar['success_txt'] = 'Запись успешно сохранена';
     }
     Core::encode_echo($ar);
 }
Example #6
0
 public function actionDel($id)
 {
     $result = array();
     $model = Doctor::findOne($id);
     if (Record::find()->where('doctor_id=' . $id . '')->exists()) {
         $model->enabled = 0;
         $model->update();
         $result['status'] = 1;
         $result['message'] = '该医生已关联数据,不能删除,已经禁用!';
     } else {
         $model->delete();
         $result['status'] = 1;
         $result['message'] = '删除成功';
     }
     return $this->renderJson($result);
 }
Example #7
0
 public function getDoctor()
 {
     return $this->hasOne(Doctor::className(), ['id' => 'doctor_id']);
 }
Example #8
0
 public function actionDoctorDel()
 {
     $Doctor = new Doctor();
     $Doctor->set_prop_from_arr($_REQUEST);
     $ar['get'] = $Doctor->del();
     Core::encode_echo($ar);
 }
Example #9
0
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="name_o" class="col-sm-8 control-label">Заметки</label>

                            <div class="col-sm-16">
                                <input value="" type="text" class="form-control" id="note" name="note"
                                       placeholder="Заметки">
                            </div>
                        </div>
                    </fieldset>

                    <fieldset class="sm">
                        <legend>Права</legend>
                        <?php 
foreach (\app\models\Doctor::getInstance()->perm_ar as $item) {
    ?>
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" id="perm_<?php 
    echo $item['id'];
    ?>
" name="perm[]"
                                           value="<?php 
    echo $item['id'];
    ?>
"> <?php 
    echo $item['title'];
    ?>
                                </label>
                            </div>
Example #10
0
 public function actionAppointment()
 {
     $listDepartment = ArrayHelper::map(Department::find()->where('enabled<>0')->all(), 'id', 'name');
     $listChannel = ArrayHelper::map(Channel::find()->where('enabled<>0')->all(), 'id', 'name');
     $listDoctor = ArrayHelper::map(Doctor::find()->where('enabled<>0')->all(), 'id', 'name');
     $listUser = ArrayHelper::map(User::find()->where('enabled<>0')->all(), 'id', 'username');
     return $this->render('appointment', ['model' => new Record(), 'listDepartment' => $listDepartment, 'listChannel' => $listChannel, 'listDoctor' => $listDoctor, 'listUser' => $listUser]);
 }
Example #11
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Doctor::truncate();
     Model::unguard();
     $this->call('DoctorsTableSeeder');
 }