封装获取服务包当前月时间区间方法,增加获取患者服务包订单服务权益详情返回字段
This commit is contained in:
parent
70ef1ae117
commit
bd5c1a1cd3
@ -1121,4 +1121,36 @@ class OrderServicePackageService extends BaseService
|
||||
|
||||
return $month_inquiry_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务包当前月时间区间
|
||||
* @param string $start_time
|
||||
* @return array
|
||||
*/
|
||||
public function getCurrentMonthDate(string $start_time): array
|
||||
{
|
||||
$current_month_start_date = 0; // 当前所属月开始时间
|
||||
$current_month_finish_date = 0; // 当前所属月结束时间
|
||||
|
||||
// 获取开启服务日期和今日的相差天数
|
||||
$diff = abs(time() - strtotime($start_time));
|
||||
$diff_days = ceil($diff / (60 * 60 * 24)); // 转换为天数
|
||||
|
||||
// 获取当前月次
|
||||
$month_time = ceil($diff_days / 30);
|
||||
|
||||
$days = (int)$month_time * 30;
|
||||
|
||||
// 当前所属月开始时间
|
||||
$current_month_finish_date = date('Y-m-d 23:59:59', strtotime($start_time . " +$days days"));
|
||||
|
||||
// 当前所属月结束时间
|
||||
$current_month_start_date = date('Y-m-d 00:00:00', strtotime($current_month_finish_date . "-30 days"));
|
||||
|
||||
$result = array();
|
||||
$result['current_month_start_date'] = $current_month_start_date;
|
||||
$result['current_month_finish_date'] = $current_month_finish_date;
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -2893,6 +2893,11 @@ class PatientOrderService extends BaseService
|
||||
// 获取药品剩余数量
|
||||
}
|
||||
|
||||
// 处理当月时间
|
||||
$current_month_date = $OrderServicePackageService->getCurrentMonthDate($order_service_package['start_time']);
|
||||
$result['order_service_package']['current_month_start_date'] = $current_month_date['current_month_start_date'];
|
||||
$result['order_service_package']['current_month_finish_date'] = $current_month_date['current_month_finish_date'];
|
||||
|
||||
return success($result);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user