初始化仓库
This commit is contained in:
49
common/models/HospitalDepartmentIntro.php
Normal file
49
common/models/HospitalDepartmentIntro.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use yii\behaviors\TimestampBehavior;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class HospitalDepartmentIntro extends \common\modelsgii\HospitalDepartmentIntro
|
||||
{
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'class' => TimestampBehavior::class,
|
||||
'attributes' => [
|
||||
ActiveRecord::EVENT_BEFORE_INSERT => ['created_at','updated_at'],
|
||||
ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取科室信息
|
||||
* @return \yii\db\ActiveQuery
|
||||
*/
|
||||
public function getDepartment()
|
||||
{
|
||||
return $this->hasMany(HospitalDepartment::className(),['id'=>'department_id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分院信息
|
||||
* @return \yii\db\ActiveQuery
|
||||
*/
|
||||
public function getYard()
|
||||
{
|
||||
return $this->hasOne(HospitalYard::className(),['id'=>'yard_id'])->select('id,name');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分院医生信息
|
||||
* @return \yii\db\ActiveQuery
|
||||
*/
|
||||
public function getDoctor()
|
||||
{
|
||||
return $this->hasMany(DoctorInfo::className(),['yard_id'=>'yard_id','depart_id'=>'department_id']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user