98 lines
3.2 KiB
PHP
98 lines
3.2 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 $order_service_case_id 主键id
|
||
* @property int $user_id 用户id
|
||
* @property int $patient_id 患者id
|
||
* @property int $order_id 订单id
|
||
* @property int $order_service_id 订单-服务包id
|
||
* @property int $family_id 家庭成员id
|
||
* @property int $disease_class_id 疾病分类id-系统
|
||
* @property int $relation 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 )
|
||
* @property int $status 状态(1:正常 2:删除)
|
||
* @property string $name 患者名称
|
||
* @property int $sex 患者性别(0:未知 1:男 2:女)
|
||
* @property int $age 患者年龄
|
||
* @property string $disease_class_name 疾病名称-系统
|
||
* @property string $diagnosis_date 确诊日期
|
||
* @property string $disease_desc 病情描述(主诉)
|
||
* @property string $diagnose_images 复诊凭证(多个使用逗号分隔)
|
||
* @property int $is_allergy_history 是否存在过敏史(0:否 1:是)
|
||
* @property string $allergy_history 过敏史描述
|
||
* @property int $is_family_history 是否存在家族病史(0:否 1:是)
|
||
* @property string $family_history 家族病史描述
|
||
* @property int $is_pregnant 是否备孕、妊娠、哺乳期(0:否 1:是)
|
||
* @property string $pregnant 备孕、妊娠、哺乳期描述
|
||
* @property Carbon $created_at 创建时间
|
||
* @property Carbon $updated_at 修改时间
|
||
*/
|
||
class OrderServicePackageCase extends Model
|
||
{
|
||
use Snowflake;
|
||
|
||
/**
|
||
* The table associated with the model.
|
||
*/
|
||
protected ?string $table = 'order_service_package_case';
|
||
|
||
/**
|
||
* The attributes that are mass assignable.
|
||
*/
|
||
protected array $fillable = ['order_service_case_id', 'user_id', 'patient_id', 'order_id', 'order_service_id', 'family_id', 'disease_class_id', 'relation', 'status', 'name', 'sex', 'age', 'disease_class_name', 'diagnosis_date', 'disease_desc', 'diagnose_images', 'is_allergy_history', 'allergy_history', 'is_family_history', 'family_history', 'is_pregnant', 'pregnant', 'created_at', 'updated_at'];
|
||
|
||
protected string $primaryKey = "order_service_case_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 OrderServicePackageCase|\Hyperf\Database\Model\Model
|
||
*/
|
||
public static function addOrderServicePackageCase(array $data): \Hyperf\Database\Model\Model|OrderServicePackageCase
|
||
{
|
||
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);
|
||
}
|
||
}
|