新增处方详情接口
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Services;
|
||||
|
||||
use App\Model\OrderPrescription;
|
||||
use App\Model\OrderProductItem;
|
||||
use Hyperf\Contract\LengthAwarePaginatorInterface;
|
||||
|
||||
class OrderPrescriptionService extends BaseService
|
||||
@@ -57,4 +58,40 @@ class OrderPrescriptionService extends BaseService
|
||||
return OrderPrescription::getPage($params, $fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取处方订单中开方商品数据
|
||||
* @param string|int $order_inquiry_id
|
||||
* @param string|int $order_prescription_id
|
||||
* @return array
|
||||
*/
|
||||
public function getproductList(string|int $order_inquiry_id ,string|int $order_prescription_id): array
|
||||
{
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry_id;
|
||||
$params['order_prescription_id'] = $order_prescription_id;
|
||||
$order_product_items = OrderProductItem::getWithProductList($params);
|
||||
if(empty($order_product_items)){
|
||||
return [];
|
||||
}
|
||||
|
||||
$result = [];
|
||||
|
||||
foreach ($order_product_items as $order_product_item){
|
||||
$data = array();
|
||||
$data['product_item_id'] = $order_product_item['product_item_id'];
|
||||
$data['product_id'] = $order_product_item['product_id'];
|
||||
$data['amount'] = $order_product_item['amount'];
|
||||
$data['product_cover_img'] = addAliyunOssWebsite($order_product_item['product_cover_img']);
|
||||
$data['single_unit'] = $order_product_item['Product']['single_unit'];
|
||||
$data['single_use'] = $order_product_item['Product']['single_use'];
|
||||
$data['packaging_unit'] = $order_product_item['Product']['packaging_unit'];
|
||||
$data['frequency_use'] = $order_product_item['Product']['frequency_use'];
|
||||
|
||||
$result[] = $data;
|
||||
}
|
||||
|
||||
unset($order_product_items);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user