41 lines
789 B
PHP
41 lines
789 B
PHP
<?php
|
|
|
|
namespace app\common\model\tcm;
|
|
|
|
use app\common\model\BaseModel;
|
|
|
|
/**
|
|
* 患者TRTC账号模型
|
|
* Class PatientTrtc
|
|
* @package app\common\model\tcm
|
|
*/
|
|
class PatientTrtc extends BaseModel
|
|
{
|
|
protected $name = 'tcm_patient_trtc';
|
|
|
|
/**
|
|
* @notes 关联诊单
|
|
*/
|
|
public function diagnosis()
|
|
{
|
|
return $this->hasMany('app\common\model\tcm\Diagnosis', 'patient_id', 'patient_id');
|
|
}
|
|
|
|
/**
|
|
* @notes 检查是否过期
|
|
*/
|
|
public function isExpired(): bool
|
|
{
|
|
return $this->expire_time > 0 && $this->expire_time < time();
|
|
}
|
|
|
|
/**
|
|
* @notes 更新最后登录时间
|
|
*/
|
|
public function updateLastLogin(): bool
|
|
{
|
|
$this->last_login_time = time();
|
|
return $this->save();
|
|
}
|
|
}
|