更新初级版本
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\tcm\Diagnosis;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
/**
|
||||
* 诊单查看记录模型
|
||||
*/
|
||||
class DiagnosisViewRecord extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $name = 'diagnosis_view_records';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
/**
|
||||
* @notes 关联用户
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(User::class, 'id', 'user_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 关联诊单
|
||||
*/
|
||||
public function diagnosis()
|
||||
{
|
||||
return $this->hasOne(Diagnosis::class, 'id', 'diagnosis_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 关联患者
|
||||
*/
|
||||
public function patient()
|
||||
{
|
||||
return $this->hasOne(User::class, 'id', 'patient_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 关联分享用户
|
||||
*/
|
||||
public function shareUser()
|
||||
{
|
||||
return $this->hasOne(User::class, 'id', 'share_user_id');
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ use app\common\enum\user\UserEnum;
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\service\FileService;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
use app\common\model\DiagnosisViewRecord;
|
||||
/**
|
||||
* 用户模型
|
||||
* Class User
|
||||
@@ -172,5 +172,16 @@ class User extends BaseModel
|
||||
return $sn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 关联患者表
|
||||
* @return \think\model\relation\HasOne
|
||||
* @author 段誉
|
||||
* @date 2022/9/22 16:03
|
||||
*/
|
||||
public function diagnosis()
|
||||
{
|
||||
return $this->belongsTo(DiagnosisViewRecord::class, 'id', 'user_id');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user