Files
xk-api-yii/common/models/DoctorInfo.php
2024-09-19 11:32:39 +08:00

83 lines
1.9 KiB
PHP

<?php
namespace common\models;
use yii\behaviors\TimestampBehavior;
use yii\db\ActiveRecord;
class DoctorInfo extends \common\modelsgii\DoctorInfo
{
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::class,['id'=>'title_id']);
}
//关联科室
public function getDepart()
{
return $this->hasOne(Department::class,['id'=>'depart_id'])->select('id,name,pid');
}
//关联医院
public function getHospital()
{
return $this->hasOne(Hospital::class,['id'=>'hospital_id']);
}
//关联院区
public function getYard()
{
return $this->hasOne(HospitalYard::class,['id'=>'yard_id']);
}
//关联用户
public function getUser()
{
return $this->hasOne(ServiceUser::class,['id'=>'su_id']);
}
//关联服务
public function getService()
{
return $this->hasOne(DoctorService::class,['su_id'=>'su_id']);
}
//关联医生执业信息
public function getDocPracticing()
{
return $this->hasOne(DoctorPracticing::class,['su_id'=>'su_id']);
}
public function getServiceUser()
{
return $this->hasOne(ServiceUser::class,['id'=>'su_id']);
}
//关联门店信息
public function getStore()
{
return $this->hasOne(Store::class,['id'=>'store_id'])->via('storeDoctor');
}
//关联门店医生信息
public function getStoreDoctor()
{
return $this->hasOne(StoreDoctor::class,['su_id'=>'su_id']);
}
}