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

95 lines
2.8 KiB
PHP

<?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 string $doctor_sign_image_path 医生签名图片oss地址
* @property string $pharmacist_sign_image_path 药师签名图片oss地址
* @property string $hospital_sign_image_path 医院签名图片oss地址
* @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', 'doctor_sign_image_path', 'pharmacist_sign_image_path', 'hospital_sign_image_path', '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);
}
}