初始化仓库
This commit is contained in:
47
common/models/ServInfo.php
Normal file
47
common/models/ServInfo.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use yii\behaviors\TimestampBehavior;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class ServInfo extends \common\modelsgii\ServInfo
|
||||
{
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'class' => TimestampBehavior::class,
|
||||
'attributes' => [
|
||||
ActiveRecord::EVENT_BEFORE_INSERT => ['created_at','updated_at'],
|
||||
ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
//关联职称
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->hasOne(DoctorTitle::className(),['id'=>'title_id']);
|
||||
}
|
||||
|
||||
//关联科室
|
||||
public function getDepart()
|
||||
{
|
||||
return $this->hasOne(HospitalDepartment::className(),['id'=>'depart_id']);
|
||||
}
|
||||
|
||||
//关联医院
|
||||
public function getHospital()
|
||||
{
|
||||
return $this->hasOne(Hospital::className(),['id'=>'hospital_id']);
|
||||
}
|
||||
|
||||
//关联院区
|
||||
public function getYard()
|
||||
{
|
||||
return $this->hasOne(HospitalYard::className(),['id'=>'yard_id']);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user