新增处方详情接口

This commit is contained in:
2023-03-01 13:52:06 +08:00
parent 523242ff4c
commit 80b63cd73d
10 changed files with 389 additions and 23 deletions
+26 -1
View File
@@ -7,6 +7,7 @@ namespace App\Model;
use Hyperf\Contract\LengthAwarePaginatorInterface;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\Relations\HasMany;
use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\Snowflake\Concern\Snowflake;
@@ -28,8 +29,10 @@ use Hyperf\Snowflake\Concern\Snowflake;
* @property int $patient_sex 患者性别-就诊人(1:男 2:女)
* @property int $patient_age 患者年龄-就诊人
* @property string $prescription_img 处方图片
* @property string $doctor_advice 医嘱
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
* @property-read \Hyperf\Database\Model\Collection|OrderPrescriptionIcd[] $OrderPrescriptionIcd
*/
class OrderPrescription extends Model
{
@@ -43,7 +46,7 @@ class OrderPrescription extends Model
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['order_prescription_id', 'order_inquiry_id', 'doctor_id', 'pharmacist_id', 'prescription_status', 'pharmacist_audit_status', 'pharmacist_fail_reason', 'platform_audit_status', 'platform_fail_reason', 'is_delete', 'prescription_code', 'doctor_name', 'patient_name', 'patient_sex', 'patient_age', 'prescription_img', 'created_at', 'updated_at'];
protected array $fillable = ['order_prescription_id', 'order_inquiry_id', 'doctor_id', 'pharmacist_id', 'prescription_status', 'pharmacist_audit_status', 'pharmacist_fail_reason', 'platform_audit_status', 'platform_fail_reason', 'is_delete', 'prescription_code', 'doctor_name', 'patient_name', 'patient_sex', 'patient_age', 'prescription_img', 'doctor_advice', 'created_at', 'updated_at'];
protected string $primaryKey = "order_prescription_id";
@@ -55,6 +58,28 @@ class OrderPrescription extends Model
return $this->HasMany(OrderPrescriptionIcd::class, 'order_prescription_id','order_prescription_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
+93
View File
@@ -0,0 +1,93 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $order_product_id 主键id
* @property int $order_inquiry_id 订单-问诊id
* @property int $order_prescription_id 订单-处方id
* @property int $doctor_id 医生id
* @property string $order_product_no 订单编号
* @property string $escrow_trade_no 第三方支付流水号
* @property int $order_product_status 订单状态(1:待支付 2:待发货 3:已发货 4:已签收 5:已完成 6:已取消)
* @property int $pay_channel 支付渠道(1:小程序支付 2:微信扫码支付)
* @property int $pay_status 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
* @property int $cancel_reason 订单取消原因(1:主动取消 2:复核失败/库存不足 3:支付超时)
* @property string $amount_total 订单金额
* @property string $payment_amount_total 实际付款金额
* @property string $logistics_fee 运费金额
* @property string $logistics_no 物流编号
* @property string $pay_time 支付时间
* @property string $remarks 订单备注
* @property int $refund_status 商品订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭)
* @property string $cancel_remarks 订单取消备注(自动添加)
* @property int $province_id 省份id
* @property string $province 省份
* @property int $city_id 城市id
* @property string $city 城市
* @property int $county_id 区县id
* @property string $county 区县
* @property string $address 详细地址
* @property string $address_mask 详细地址(掩码)
* @property string $consignee_name 收货人姓名
* @property string $consignee_name_mask 收货人姓名(掩码)
* @property string $consignee_tel 收货人电话
* @property string $consignee_tel_mask 收货人电话(掩码)
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class OrderProduct extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'order_product';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['order_product_id', 'order_inquiry_id', 'order_prescription_id', 'doctor_id', 'order_product_no', 'escrow_trade_no', 'order_product_status', 'pay_channel', 'pay_status', 'cancel_reason', 'amount_total', 'payment_amount_total', 'logistics_fee', 'logistics_no', 'pay_time', 'remarks', 'refund_status', 'cancel_remarks', 'province_id', 'province', 'city_id', 'city', 'county_id', 'county', 'address', 'address_mask', 'consignee_name', 'consignee_name_mask', 'consignee_tel', 'consignee_tel_mask', 'created_at', 'updated_at'];
protected string $primaryKey = "order_product_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();
}
}
+99
View File
@@ -0,0 +1,99 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $product_item_id 主键id
* @property int $order_product_id 订单-商品订单id
* @property int $order_inquiry_id 订单-问诊id
* @property int $order_prescription_id 订单-处方id
* @property int $product_id 商品id
* @property string $product_name 商品名称
* @property string $product_price 商品价格
* @property string $product_platform_code 商品处方平台编码
* @property int $amount 数量
* @property string $manufacturer 生产厂家
* @property string $product_cover_img 商品封面图
* @property string $product_spec 商品规格
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class OrderProductItem extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'order_product_item';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['product_item_id', 'order_product_id', 'order_inquiry_id', 'order_prescription_id', 'product_id', 'product_name', 'product_price', 'product_platform_code', 'amount', 'manufacturer', 'product_cover_img', 'product_spec', 'created_at', 'updated_at'];
protected string $primaryKey = "product_item_id";
/**
* 关联商品表
*/
public function Product(): HasOne
{
return $this->hasOne(Product::class, 'product_id', 'product_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();
}
/**
* 获取数据-关联商品表
* @param array $params
* @param array $fields
* @return Collection|array
*/
public static function getWithProductList(array $params = [], array $fields = ['*']): Collection|array
{
return self::with([
"Product"
])
->where($params)
->get($fields);
}
}