新增获取处方列表

This commit is contained in:
2023-02-22 10:36:50 +08:00
parent 7604576cd3
commit 5432819d20
2 changed files with 136 additions and 11 deletions
+76
View File
@@ -0,0 +1,76 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $icd_id 主键id
* @property string $icd_name 疾病分类名称
* @property string $icd_code icd编码
* @property string $icd_spell icd简拼
* @property int $icd_status 状态(0:删除 1:正常)
* @property int $icd_enable 是否启用(0:否 1:是)
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class DiseaseClassIcd extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'disease_class_icd';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['icd_id', 'icd_name', 'icd_code', 'icd_spell', 'icd_status', 'icd_enable', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['icd_id' => 'integer', 'icd_status' => 'integer', 'icd_enable' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "icd_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 $params
* @param int|string $limit
* @param array $fields
* @return Collection|array
*/
public static function getLimit(array $params = [],int|string $limit = 5, array $fields = ['*']): Collection|array
{
return self::where($params)->limit($limit)->get($fields);
}
}