diff --git a/api/service/orderServicePackage.go b/api/service/orderServicePackage.go index 0922781..7c25e3e 100644 --- a/api/service/orderServicePackage.go +++ b/api/service/orderServicePackage.go @@ -99,20 +99,30 @@ func (r *OrderServicePackageService) GetOrderServicePackageDetailInfo(orderServi // 加载服务包订单关联病例数据 g.LoadOrderServicePackageCase(orderServicePackageCase) - // 获取服务包当前月时间区间 - CurrentMonthStartDate, CurrentMonthFinishDate, err := r.getOrderServicePackageCurrentMonthDate(g.StartTime) - g.CurrentMonthStartDate = CurrentMonthStartDate.Format("2006年01月02日 15时04分") - g.CurrentMonthFinishDate = CurrentMonthFinishDate.Format("2006年01月02日 15时04分") + if g.OrderServiceStatus == 3 || g.OrderServiceStatus == 4 || g.OrderServiceStatus == 5 { + if !g.StartTime.IsEmpty() { + // 获取服务包当前月时间区间 + CurrentMonthStartDate, CurrentMonthFinishDate, err := r.getOrderServicePackageCurrentMonthDate(g.StartTime) + g.CurrentMonthStartDate = CurrentMonthStartDate.Format("2006年01月02日 15时04分") + g.CurrentMonthFinishDate = CurrentMonthFinishDate.Format("2006年01月02日 15时04分") - // 获取服务包当月已问诊次数 - g.MonthInquiryCount, err = r.GetCurrentMonthInquiryCount(g.OrderServiceType, orderServicePackage.UserId, orderServicePackage.DoctorId, CurrentMonthStartDate, CurrentMonthFinishDate) - if err != nil { - return nil, err + // 检测问诊是否服务包首次问诊 + isFirst, err := r.isFirstInquiryServicePackage(g.OrderServiceNo) + if isFirst { + g.MonthInquiryCount = 1 + } else { + // 获取服务包当月已问诊次数 + g.MonthInquiryCount, err = r.GetCurrentMonthInquiryCount(g.OrderServiceType, orderServicePackage.UserId, orderServicePackage.DoctorId, CurrentMonthStartDate, CurrentMonthFinishDate) + if err != nil { + return nil, err + } + } + + // 获取服务包当月剩余问诊次数 + g.RemainingInquiryCount = r.GetRemainingInquiryCount(orderServicePackageDetail.MonthlyFrequency, g.MonthInquiryCount) + } } - // 获取服务包当月剩余问诊次数 - g.RemainingInquiryCount = r.GetRemainingInquiryCount(orderServicePackageDetail.MonthlyFrequency, g.MonthInquiryCount) - // 健康包数据 if orderServicePackage.OrderServiceType == 1 { if g.OrderServiceStatus == 3 || g.OrderServiceStatus == 4 || g.OrderServiceStatus == 5 {