修正获取处方详情接口返回数据

This commit is contained in:
2023-03-01 15:55:25 +08:00
parent 5a4fcaaf7f
commit e047f4971c
9 changed files with 138 additions and 20 deletions
+33 -5
View File
@@ -6,6 +6,7 @@ namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
@@ -31,10 +32,37 @@ class OrderPrescriptionIcd extends Model
*/
protected array $fillable = ['prescription_icd_id', 'order_prescription_id', 'icd_id', 'icd_name', 'icd_code', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['prescription_icd_id' => 'integer', 'order_prescription_id' => 'integer', 'icd_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "prescription_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
* @return bool
*/
public static function getExists(array $params): bool
{
return self::where($params)->exists();
}
}