82 lines
2.1 KiB
PHP
82 lines
2.1 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace App\Model;
|
||
|
||
|
||
|
||
use Carbon\Carbon;
|
||
use Hyperf\Database\Model\Collection;
|
||
use Hyperf\Snowflake\Concern\Snowflake;
|
||
|
||
/**
|
||
* @property int $difficult_consultation_id 主键id
|
||
* @property int $doctor_id 医生id
|
||
* @property string $service_content 服务内容
|
||
* @property string $service_process 服务流程
|
||
* @property int $service_period 服务周期
|
||
* @property int $service_rounds 服务回合数(0表示不限次)
|
||
* @property Carbon $created_at 创建时间
|
||
* @property Carbon $updated_at 修改时间
|
||
*/
|
||
class DoctorConfigDifficultConsultation extends Model
|
||
{
|
||
use Snowflake;
|
||
|
||
/**
|
||
* The table associated with the model.
|
||
*/
|
||
protected ?string $table = 'doctor_config_difficult_consultation';
|
||
|
||
/**
|
||
* The attributes that are mass assignable.
|
||
*/
|
||
protected array $fillable = ['difficult_consultation_id', 'doctor_id', 'service_content', 'service_process', 'service_period', 'service_rounds', 'created_at', 'updated_at'];
|
||
|
||
protected string $primaryKey = "difficult_consultation_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 $params
|
||
* @param array $fields
|
||
* @return Collection|array
|
||
*/
|
||
public static function getList(array $params, array $fields = ['*']): Collection|array
|
||
{
|
||
return self::where($params)->get($fields);
|
||
}
|
||
|
||
/**
|
||
* 新增
|
||
* @param array $data
|
||
* @return DoctorConfigDifficultConsultation|\Hyperf\Database\Model\Model
|
||
*/
|
||
public static function addDoctorConfigDifficultConsultation(array $data): \Hyperf\Database\Model\Model|DoctorConfigDifficultConsultation
|
||
{
|
||
return self::create($data);
|
||
}
|
||
|
||
/**
|
||
* 修改
|
||
* @param array $params
|
||
* @param array $data
|
||
* @return int
|
||
*/
|
||
public static function edit(array $params = [], array $data = []): int
|
||
{
|
||
return self::where($params)->update($data);
|
||
}
|
||
}
|