69 lines
1.7 KiB
PHP
69 lines
1.7 KiB
PHP
<?php
|
|
namespace common\models;
|
|
|
|
use yii\behaviors\TimestampBehavior;
|
|
use yii\db\ActiveRecord;
|
|
|
|
class UserPatient extends \common\modelsgii\UserPatient
|
|
{
|
|
public function behaviors()
|
|
{
|
|
return [
|
|
[
|
|
'class' => TimestampBehavior::class,
|
|
'attributes' => [
|
|
ActiveRecord::EVENT_BEFORE_INSERT => ['created_at','updated_at'],
|
|
ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
|
|
],
|
|
],
|
|
];
|
|
}
|
|
|
|
//就诊人问诊健康信息
|
|
public function getHealthInquiry()
|
|
{
|
|
return $this->hasOne(UserPatientHealthInquiry::className(),['user_patient_id'=>'id'])->andWhere([
|
|
'is_delete' => 0
|
|
]);
|
|
}
|
|
|
|
//中药处方
|
|
public function getChinPrescrip()
|
|
{
|
|
return $this->hasOne(PrescriptionChinese::class,['up_id'=>'id']);
|
|
}
|
|
//西药处方
|
|
public function getWestPrescrip()
|
|
{
|
|
return $this->hasOne(PrescriptionWest::class,['up_id'=>'id']);
|
|
}
|
|
|
|
//处方
|
|
public function getPrescrip()
|
|
{
|
|
return $this->hasOne(Prescription::class,['up_id'=>'id']);
|
|
}
|
|
|
|
// 用户
|
|
public function getUser()
|
|
{
|
|
return $this->hasOne(User::class,['user_id'=>'id']);
|
|
}
|
|
// 挂号
|
|
public function getRegister()
|
|
{
|
|
return $this->hasOne(Register::class,['user_patient_id'=>'id']);
|
|
}
|
|
|
|
// 病历
|
|
public function getCase()
|
|
{
|
|
return $this->hasMany(UserPatientCase::class,['user_patient_id'=>'id']);
|
|
}
|
|
|
|
//健康信息
|
|
public function getHealth()
|
|
{
|
|
return $this->hasOne(UserPatientHealthInquiry::class,['user_patient_id'=>'id']);
|
|
}
|
|
} |