92 lines
2.8 KiB
PHP
92 lines
2.8 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace App\Model;
|
||
|
||
|
||
|
||
use Hyperf\Snowflake\Concern\Snowflake;
|
||
|
||
/**
|
||
* @property int $doctor_info_id 主键
|
||
* @property int $user_id 用户id
|
||
* @property int $doctor_id 医生id
|
||
* @property int $card_type 类型(1:身份证 2:护照 3:港澳通行证 4:台胞证)
|
||
* @property string $card_name 证件姓名
|
||
* @property string $card_name_mask 证件姓名(掩码)
|
||
* @property string $card_num 证件号码
|
||
* @property string $card_num_mask 证件号码(掩码)
|
||
* @property string $license_cert 医师执业证(逗号分隔)
|
||
* @property string $qualification_cert 医师资格证(逗号分隔)
|
||
* @property string $qualification_cert_num 医师资格证号(逗号分隔)
|
||
* @property string $work_cert 医师工作证(逗号分隔)
|
||
* @property string $multi_point_images 多点执业备案信息(逗号分隔)
|
||
* @property string $id_card_front 身份证正面图片
|
||
* @property string $id_card_back 身份证背面图片
|
||
* @property string $sign_image 签名图片
|
||
* @property string $register_cert 电子注册证图片
|
||
* @property \Carbon\Carbon $created_at 创建时间
|
||
* @property \Carbon\Carbon $updated_at 修改时间
|
||
*/
|
||
class UserDoctorInfo extends Model
|
||
{
|
||
use Snowflake;
|
||
|
||
/**
|
||
* The table associated with the model.
|
||
*/
|
||
protected ?string $table = 'user_doctor_info';
|
||
|
||
/**
|
||
* The attributes that are mass assignable.
|
||
*/
|
||
protected array $fillable = ['doctor_info_id', 'user_id', 'doctor_id', 'card_type', 'card_name', 'card_name_mask', 'card_num', 'card_num_mask', 'license_cert', 'qualification_cert', 'qualification_cert_num', 'work_cert', 'multi_point_images', 'id_card_front', 'id_card_back', 'sign_image', 'register_cert', 'created_at', 'updated_at'];
|
||
|
||
protected string $primaryKey = "doctor_info_id";
|
||
|
||
/**
|
||
* 获取单条
|
||
* @param array $params
|
||
* @param array $fields
|
||
* @return object|null
|
||
*/
|
||
public static function getOne(array $params, array $fields = ['*']): object|null
|
||
{
|
||
return self::where($params)->first($fields);
|
||
}
|
||
|
||
|
||
|
||
/**
|
||
* 新增医生详情-批量
|
||
* @param array $data 新增数据
|
||
* @return \Hyperf\Database\Model\Model|UserDoctorInfo
|
||
*/
|
||
public static function addUserDoctorInfo(array $data): \Hyperf\Database\Model\Model|UserDoctorInfo
|
||
{
|
||
return self::create($data);
|
||
}
|
||
|
||
/**
|
||
* 修改医生详情
|
||
* @param array $params
|
||
* @param array $data
|
||
* @return int
|
||
*/
|
||
public static function editUserDoctorInfo(array $params = [], array $data = []): int
|
||
{
|
||
return self::where($params)->update($data);
|
||
}
|
||
|
||
/**
|
||
* 获取是否存在
|
||
* @param array $params
|
||
* @return bool
|
||
*/
|
||
public static function getExists(array $params): bool
|
||
{
|
||
return self::where($params)->exists();
|
||
}
|
||
}
|