新增接口 获取服务包关联问诊订单消息内页基础数据
This commit is contained in:
parent
df935b6c82
commit
b1ee69453b
@ -173,4 +173,15 @@ class InquiryController extends AbstractController
|
||||
$data = $InquiryService->getInquiryVideoMessageBasic();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务包关联问诊订单消息内页基础数据
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getInquiryServiceMessageBasic(): ResponseInterface
|
||||
{
|
||||
$InquiryService = new InquiryService();
|
||||
$data = $InquiryService->getInquiryServiceMessageBasic();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@ -29,6 +29,9 @@ use App\Model\OrderInquiryVideoRecord;
|
||||
use App\Model\OrderInquiryVideoReservation;
|
||||
use App\Model\OrderPrescription;
|
||||
use App\Model\OrderProductCoupon;
|
||||
use App\Model\OrderServicePackage;
|
||||
use App\Model\OrderServicePackageDetail;
|
||||
use App\Model\OrderServicePackageInquiry;
|
||||
use App\Model\PatientFamily;
|
||||
use App\Model\PatientFamilyHealth;
|
||||
use App\Model\PatientFamilyPersonal;
|
||||
@ -1468,6 +1471,95 @@ class InquiryService extends BaseService
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务包关联问诊订单消息内页基础数据
|
||||
* @return array
|
||||
*/
|
||||
public function getInquiryServiceMessageBasic(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
$order_inquiry_id = $this->request->route('order_inquiry_id');
|
||||
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry_id;
|
||||
$order_inquiry = OrderInquiry::getOne($params);
|
||||
if (empty($order_inquiry)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "订单错误");
|
||||
}
|
||||
|
||||
$order_inquiry = $order_inquiry->toArray();
|
||||
|
||||
if ($user_info['user_type'] == 1) {
|
||||
if ($order_inquiry['patient_id'] != $user_info['client_user_id']) {
|
||||
return success();
|
||||
}
|
||||
}
|
||||
|
||||
if ($user_info['user_type'] == 2) {
|
||||
if ($order_inquiry['doctor_id'] != $user_info['client_user_id']) {
|
||||
return success();
|
||||
}
|
||||
}
|
||||
|
||||
// 获取问诊订单关联服务包
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
$order_service_package_inquiry = OrderServicePackageInquiry::getOne($params);
|
||||
if (empty($order_service_package_inquiry)){
|
||||
return success();
|
||||
}
|
||||
|
||||
// 获取用户当前购买的服务包
|
||||
$params = array();
|
||||
$params['user_id'] = $user_info['user_id'];
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['order_service_no'] = $order_service_package_inquiry['order_service_no'];
|
||||
$order_service_package = OrderServicePackage::getOne($params);
|
||||
if (empty($order_service_package)) {
|
||||
return success();
|
||||
}
|
||||
|
||||
// 检测服务包订单订单状态
|
||||
if ($order_service_package['order_service_status'] == 1) {
|
||||
return success();
|
||||
}
|
||||
|
||||
if ($order_service_package['order_service_status'] == 2) {
|
||||
return success();
|
||||
}
|
||||
|
||||
// 获取服务包订单详情
|
||||
$params = array();
|
||||
$params['order_service_no'] = $order_service_package['order_service_no'];
|
||||
$order_service_package_detail = OrderServicePackageDetail::getOne($params);
|
||||
if (empty($order_service_package_detail)) {
|
||||
return success();
|
||||
}
|
||||
|
||||
// 获取当月已问诊次数
|
||||
// 3.5号购买,每月2次问诊次数。今天5.3,属于第几个月,这个月的开始时间和结束时间
|
||||
$month_inquiry_count = 0;
|
||||
if ($order_service_package_detail['monthly_frequency'] != 0 && !empty($order_service_package['start_time'])) {
|
||||
// 获取服务包当月已问诊次数
|
||||
$OrderServicePackageService = new OrderServicePackageService();
|
||||
$month_inquiry_count = $OrderServicePackageService->getCurrentMonthInquiryCount($order_service_package['start_time'],$order_service_package['order_service_type'],$order_service_package['user_id'], $order_service_package['doctor_id']);
|
||||
}
|
||||
|
||||
// 处理剩余服务天数
|
||||
$finish_day = null;
|
||||
if (!empty($order_service_package['finish_time'])){
|
||||
$finish_day = ceil((strtotime($order_service_package['finish_time']) - time()) / 60 / 60 / 24);
|
||||
}
|
||||
|
||||
|
||||
$result = array();
|
||||
$result['finish_time'] = $finish_day; // 剩余服务天数
|
||||
$result['month_inquiry_count'] = $month_inquiry_count; // 服务包当月已问诊次数
|
||||
$result['monthly_frequency'] = $order_service_package_detail['monthly_frequency']; // 每月次数(0表示不限次)
|
||||
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生未接诊订单数量
|
||||
* @param string $doctor_id 医生id
|
||||
|
||||
@ -957,6 +957,9 @@ Router::addGroup('/im', function () {
|
||||
|
||||
// 获取视频问诊消息内页基础数据
|
||||
Router::get('/video/{order_inquiry_id:\d+}', [InquiryController::class, 'getInquiryVideoMessageBasic']);
|
||||
|
||||
// 获取服务包关联问诊订单消息内页基础数据
|
||||
Router::get('/service/{order_inquiry_id:\d+}', [InquiryController::class, 'getInquiryServiceMessageBasic']);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user