From 1bbdcd6ae6ebf13ddbe6131a133d268d762a896e Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Fri, 14 Jun 2024 15:09:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8C=85=E5=BD=93=E6=9C=88=E5=B7=B2=E9=97=AE?= =?UTF-8?q?=E8=AF=8A=E6=AC=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/service/orderServicePackage.go | 32 ++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 11 deletions(-) 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 {