修改im消息推送
This commit is contained in:
@@ -1478,4 +1478,78 @@ class OrderServicePackageService extends BaseService
|
||||
|
||||
return $amount_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取im消息推送中,服务包订单相关的自定义参数
|
||||
* @param string|int $inquiry_no
|
||||
* @return array
|
||||
*/
|
||||
public function getImServicePackageCloudCustomData(string|int $inquiry_no): array
|
||||
{
|
||||
$OrderServicePackageService = new OrderServicePackageService();
|
||||
|
||||
// 获取服务包订单编号-通过问诊订单id
|
||||
$order_service_no = $OrderServicePackageService->getOrderServiceNoByOrderInquiryId($inquiry_no);
|
||||
|
||||
$params = array();
|
||||
$params['order_service_no'] = $order_service_no;
|
||||
$order_service_package = OrderServicePackage::getOne($params);
|
||||
if (empty($order_service_package)){
|
||||
return [];
|
||||
}
|
||||
|
||||
// 获取服务包订单详情
|
||||
$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 [];
|
||||
}
|
||||
|
||||
// 每月问诊次数(0表示不限次)
|
||||
$monthly_frequency = $order_service_package_detail['monthly_frequency'];
|
||||
|
||||
// 获取服务包当月已问诊次数
|
||||
$month_inquiry_count = 0;
|
||||
if ($order_service_package_detail['monthly_frequency'] != 0 && !empty($order_service_package['start_time'])) {
|
||||
$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']);
|
||||
}
|
||||
|
||||
// 服务包当月剩余问诊次数
|
||||
$remaining_month_inquiry_count = $order_service_package_detail['monthly_frequency'] - $month_inquiry_count;
|
||||
|
||||
// 服务包开始时间
|
||||
if (!empty($order_service_package['start_time'])){
|
||||
$service_package_start_time = date('Y-m-d H:i',strtotime($order_service_package['start_time']));
|
||||
}
|
||||
|
||||
// 服务包结束时间
|
||||
if (!empty($order_service_package['finish_time'])){
|
||||
$service_package_finish_time = date('Y-m-d H:i',strtotime($order_service_package['finish_time']));
|
||||
}
|
||||
|
||||
// 服务包服务周期
|
||||
$service_period = $order_service_package_detail['service_period'];
|
||||
|
||||
// 药品剩余数量
|
||||
$remaining_quantity = 0;
|
||||
|
||||
// 获取服务包内所有药品
|
||||
$health_package_products = $OrderServicePackageService->getOrderServiceProduct($order_service_package_detail['package_id']);
|
||||
foreach ($health_package_products as $health_package_product) {
|
||||
// 获取服务包内某一药品的剩余数量
|
||||
$remaining_quantity = $OrderServicePackageService->getOrderServiceProductCanUseQuantity($order_service_package['order_service_id'],$health_package_product['product_id'],$health_package_product['quantity']);
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$result['monthly_frequency'] = $monthly_frequency; // 每月问诊次数(0表示不限次)
|
||||
$result['month_inquiry_count'] = $month_inquiry_count; // 获取服务包当月已问诊次数
|
||||
$result['remaining_month_inquiry_count'] = $remaining_month_inquiry_count; // 服务包当月剩余问诊次数
|
||||
$result['service_package_start_time'] = $service_package_start_time ?? ""; // 服务包开始时间
|
||||
$result['service_package_finish_time'] = $service_package_finish_time ?? ""; // 服务包结束时间
|
||||
$result['service_period'] = $service_period; // 服务包服务周期
|
||||
$result['remaining_quantity'] = $remaining_quantity; // 药品剩余数量
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user