hospital-applets-api/app/Model/OrderPrescriptionFile.php

93 lines
2.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $prescription_file_id 主键id
* @property int $order_prescription_id 订单-处方id
* @property string $doctor_ca_file_id 医生签章pdf文件id可请求ca下载
* @property string $hospital_ca_file_id 医院签章pdf文件id可请求ca下载
* @property string $prescription_img_oss_path 签章img文件oss路径
* @property string $prescription_pdf_oss_path 签章pdf文件oss路径
* @property int $is_converted_pdf 是否已转换pdf为图片(0:否 1:是)
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class OrderPrescriptionFile extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'order_prescription_file';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['prescription_file_id', 'order_prescription_id', 'doctor_ca_file_id', 'hospital_ca_file_id', 'prescription_img_oss_path', 'prescription_pdf_oss_path', 'is_converted_pdf', 'created_at', 'updated_at'];
protected string $primaryKey = "prescription_file_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 Builder[]|Collection
*/
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();
}
/**
* 修改
* @param array $params
* @param array $data
* @return int
*/
public static function edit(array $params = [], array $data = []): int
{
return self::where($params)->update($data);
}
/**
* 新增
* @param array $data
* @return \Hyperf\Database\Model\Model|OrderPrescriptionFile
*/
public static function addOrderPrescriptionFile(array $data): \Hyperf\Database\Model\Model|OrderPrescriptionFile
{
return self::create($data);
}
}