更新项目部分结构,新增加DB
This commit is contained in:
50
common/models/oldDb/HospitalDepartmentIntro.php
Normal file
50
common/models/oldDb/HospitalDepartmentIntro.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace common\models\oldDb;
|
||||
|
||||
use common\models\HospitalDepartment;
|
||||
use yii\behaviors\TimestampBehavior;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class HospitalDepartmentIntro extends \common\modelsgii\oldDb\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