修改处方商品
This commit is contained in:
@@ -7,8 +7,8 @@ namespace App\Model;
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Database\Model\Model;
|
||||
use Hyperf\Database\Model\Relations\HasOne;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $prescription_product_id 主键id
|
||||
@@ -30,6 +30,8 @@ use Hyperf\Database\Model\Relations\HasOne;
|
||||
*/
|
||||
class OrderPrescriptionProduct extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
@@ -41,6 +43,7 @@ class OrderPrescriptionProduct extends Model
|
||||
protected array $fillable = ['prescription_product_id', 'order_prescription_id', 'product_id', 'use_status', 'prescription_product_num', 'product_name', 'product_spec', 'license_number', 'manufacturer', 'single_unit', 'single_use', 'packaging_unit', 'frequency_use', 'available_days', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "prescription_product_id";
|
||||
|
||||
/**
|
||||
* 关联商品表
|
||||
*/
|
||||
@@ -82,20 +85,29 @@ class OrderPrescriptionProduct extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据-关联商品表
|
||||
* 限制数量
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return Collection|array
|
||||
* 新增
|
||||
* @param array $data
|
||||
* @return \Hyperf\Database\Model\Model|OrderPrescriptionProduct
|
||||
*/
|
||||
public static function getWithProductLimit(array $params = [], array $fields = ['*']): Collection|array
|
||||
public static function addOrderPrescriptionProduct(array $data): \Hyperf\Database\Model\Model|OrderPrescriptionProduct
|
||||
{
|
||||
return self::with([
|
||||
"Product"
|
||||
])
|
||||
->where($params)
|
||||
->limit(10)
|
||||
->get($fields);
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
public static function edit(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param array $params
|
||||
* @return int|mixed
|
||||
*/
|
||||
public static function deleteOrderPrescriptionProduct(array $params): mixed
|
||||
{
|
||||
return self::where($params)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,42 +125,19 @@ class OrderPrescriptionProduct extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param array $params
|
||||
* @return int|mixed
|
||||
*/
|
||||
public static function deleteOrderPrescriptionProduct(array $params): mixed
|
||||
{
|
||||
return self::where($params)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param array $data
|
||||
* @return Model|OrderPrescriptionProduct
|
||||
*/
|
||||
public static function addOrderPrescriptionProduct(array $data): Model|OrderPrescriptionProduct
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息-单条
|
||||
* 获取数据-关联商品表
|
||||
* 限制数量
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getWithProductList(array $params, array $fields = ['*']): object|null
|
||||
public static function getWithProductLimit(array $params = [], array $fields = ['*']): Collection|array
|
||||
{
|
||||
return self::with([
|
||||
'Product'
|
||||
"Product"
|
||||
])
|
||||
->where($params)->first($fields);
|
||||
|
||||
}
|
||||
|
||||
public static function edit(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
->where($params)
|
||||
->limit(10)
|
||||
->get($fields);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,4 +107,9 @@ class OrderProductItem extends Model
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
public static function edit(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,9 +81,9 @@ class PatientFamily extends Model
|
||||
/**
|
||||
* 新增数据
|
||||
* @param array $data
|
||||
* @return Model|PatientFamily
|
||||
* @return \Hyperf\Database\Model\Model|PatientFamily
|
||||
*/
|
||||
public static function addPatientFamily(array $data = []): Model|PatientFamily
|
||||
public static function addPatientFamily(array $data = []): \Hyperf\Database\Model\Model|PatientFamily
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user