This commit is contained in:
2023-03-13 13:49:31 +08:00
parent 802a5081fb
commit 6d2c0374a3
6 changed files with 245 additions and 6 deletions
+5
View File
@@ -253,8 +253,13 @@ class PatientDoctorService extends BaseService
$result['doctor_inquiry_config'] = $doctor_inquiry_config;
}
// 获取医生已选择专长
$UserDoctorService = new UserDoctorService();
$result['doctor_expertise'] = $UserDoctorService->getDoctorSelectedExpertise($user_doctor['doctor_id']);
// 好评率-超过5个已结束的订单后展示
$result['praise_rate'] = ceil($user_doctor['praise_rate'] * 0.05 * 100) / 100;
// 响应时间-超过5个已结束的订单后展示
$result['avg_response_time'] = ceil($user_doctor['avg_response_time'] * 0.05 * 100) / 100 * 60;
+106 -2
View File
@@ -8,9 +8,11 @@ use App\Model\Hospital;
use App\Model\OrderInquiry;
use App\Model\OrderInquiryCase;
use App\Model\OrderPrescription;
use App\Model\OrderPrescriptionProduct;
use App\Model\OrderProduct;
use App\Model\OrderProductItem;
use App\Model\UserDoctor;
use App\Model\UserShipAddress;
use Extend\Wechat\WechatPay;
use Hyperf\DbConnection\Db;
use Psr\Container\ContainerExceptionInterface;
@@ -734,7 +736,12 @@ class PatientOrderService extends BaseService
return success($order_prescription);
}
public function getPatientPrescriptionOrderInfo(){
/**
* 获取处方订单详情
* @return array
*/
public function getPatientPrescriptionOrderInfo(): array
{
$user_info = $this->request->getAttribute("userInfo") ?? [];
$order_prescription_id = $this->request->route('order_prescription_id');
@@ -743,6 +750,7 @@ class PatientOrderService extends BaseService
$fields = [
'order_prescription_id',
'prescription_status',
'prescription_img',
];
$params = array();
$params['order_prescription_id'] = $order_prescription_id;
@@ -750,6 +758,102 @@ class PatientOrderService extends BaseService
$params['pharmacist_audit_status'] = 1;
$params['platform_audit_status'] = 1;
$params['is_delete'] = 0;
$order_prescription = OrderPrescription::getWithOne($params);
$order_prescription = OrderPrescription::getOne($params,$fields);
if (empty($order_prescription)){
return fail();
}
$order_prescription['prescription_img'] = addAliyunOssWebsite($order_prescription['prescription_img']);
return success($order_prescription->toArray());
}
/**
* 获取处方订单支付页详情
* 我这边一直到6-7月份才能走得开。目前这几个月项目都正在开发中,没办法离开,也不好。
* @return array
*/
public function getPatientPrescriptionOrderPayInfo(): array
{
$user_info = $this->request->getAttribute("userInfo") ?? [];
$order_prescription_id = $this->request->route('order_prescription_id');
$fields = [
"order_prescription_id"
];
$params = array();
$params['order_prescription_id'] = $order_prescription_id;
$params['patient_id'] = $user_info['client_user_id'];
$params['is_delete'] = 0;
$order_prescription = OrderPrescription::getOne($params,$fields);
if (empty($order_prescription)){
return fail();
}
// 验证处方状态
if ($order_prescription['prescription_status'] == 1){
return fail(HttpEnumCode::HTTP_ERROR,"处方未审核");
}
if ($order_prescription['prescription_status'] == 3){
return fail(HttpEnumCode::HTTP_ERROR,"处方已失效");
}
if ($order_prescription['prescription_status'] == 4){
return fail(HttpEnumCode::HTTP_ERROR,"处方已使用");
}
// 获取处方药品信息
$params = array();
$params['order_prescription_id'] = $order_prescription['order_prescription_id'];
$order_prescription_product = OrderPrescriptionProduct::getWithProductList($params);
if (empty($order_prescription_product)){
return fail(HttpEnumCode::SERVER_ERROR);
}
$amount_total = 0;
$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'];
}
}
// 获取运费金额
// 实际支付金额
$payment_amount_total = $amount_total + $logistics_fee;
// 获取收货地址
$params = array();
$params['user_id'] = $user_info['user_id'];
$user_ship_addresss = UserShipAddress::getList($params);
foreach ($user_ship_addresss as $item){
if ($item['is_default'] == 1){
$user_ship_address = $item;
}
}
// 无默认地址,选择第一个
if (empty($user_ship_address)){
$user_ship_address = $user_ship_addresss[0] ?? [];
}
$result = array();
$result['amount_total'] = $amount_total;
$result['coupon_amount_total'] = $coupon_amount_total;
$result['payment_amount_total'] = $payment_amount_total;
$result['logistics_fee'] = $logistics_fee;
$result['user_ship_address'] = $user_ship_address;
return success($result);
}
public function deletePatientPrescriptionOrder(){
}
}