修正获取医生评价

This commit is contained in:
2023-03-14 10:37:24 +08:00
parent c8c58b83be
commit a801c11121
4 changed files with 217 additions and 82 deletions
+30 -12
View File
@@ -550,7 +550,7 @@ class PatientOrderService extends BaseService
$data['order_product_status'] = 5;
$data['cancel_time'] = date("Y-m-d H:i:s",time());
$data['cancel_reason'] = 1; // 订单取消原因(1:主动取消 2:复核失败/库存不足 3:支付超时
$data['cancel_remarks'] = "主动取消";
$data['cancel_remarks'] = 2; // 取消订单原因(1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时)
$data['updated_at'] = date("Y-m-d H:i:s",time());
$params = array();
@@ -769,18 +769,26 @@ class PatientOrderService extends BaseService
return fail(HttpEnumCode::HTTP_ERROR,"收货地址错误");
}
$amount_total = 0;
$coupon_amount_total = 0;
$logistics_fee = 0; // 运费金额
// 检测药品是否存在,库存是否足够,获取订单金额
foreach ($order_prescription_product as $value){
$params = array();
$params['product_id'] = $value['product_id'];
$product = Product::getOne($params);
if (empty($product)){
return fail(HttpEnumCode::HTTP_ERROR,"处方存在未知药品");
$product = Product::getWithAmountOne($params);
if (empty($product)) {
Db::rollBack();
return fail(HttpEnumCode::HTTP_ERROR, "处方存在未知药品");
}
// 检测商品库存
if (!empty($product['ProductPlatformAmount'])) {
if ($value['prescription_product_num'] > $product['ProductPlatformAmount']['real_stock']) {
// 此处是否需要特殊返回
Db::rollBack();
return fail(HttpEnumCode::HTTP_ERROR, "意向药品库存不足");
}
}
$amount_total += $product['product_price'];
@@ -882,9 +890,6 @@ class PatientOrderService extends BaseService
return fail(HttpEnumCode::SERVER_ERROR, $e->getMessage());
}
return success();
}
@@ -987,7 +992,7 @@ class PatientOrderService extends BaseService
// 获取处方药品信息
$params = array();
$params['order_prescription_id'] = $order_prescription['order_prescription_id'];
$order_prescription_product = OrderPrescriptionProduct::getWithProductList($params);
$order_prescription_product = OrderPrescriptionProduct::getList($params);
if (empty($order_prescription_product)){
return fail(HttpEnumCode::SERVER_ERROR);
}
@@ -996,9 +1001,22 @@ class PatientOrderService extends BaseService
$coupon_amount_total = 0;
$logistics_fee = 0; // 运费金额
foreach ($order_prescription_product as $item){
if (!empty($item['Product']['product_price'])){
$amount_total += $item['Product']['product_price'];
$params = array();
$params['product_id'] = $item['product_id'];
$product = Product::getWithAmountOne($params);
if (empty($product)) {
return fail(HttpEnumCode::HTTP_ERROR, "处方存在未知药品");
}
// 检测商品库存
if (!empty($product['ProductPlatformAmount'])) {
if ($item['prescription_product_num'] > $product['ProductPlatformAmount']['real_stock']) {
// 库存不足
continue;
}
}
$amount_total += $product['product_price'];
}
// 获取运费金额