diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index e5cf503de..c0882ff60 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -1767,11 +1767,13 @@ - + 后端api swagger 下载项目影像 + + @@ -17494,17 +17496,17 @@ - ���� + 质疑 - һ���Ժ˲� + 一致性核查 - ���� + 复制 diff --git a/IRaCIS.Core.Application/Service/Common/TrialImageDownloadService.cs b/IRaCIS.Core.Application/Service/Common/TrialImageDownloadService.cs index faf9d5274..8cac5500d 100644 --- a/IRaCIS.Core.Application/Service/Common/TrialImageDownloadService.cs +++ b/IRaCIS.Core.Application/Service/Common/TrialImageDownloadService.cs @@ -167,13 +167,20 @@ namespace IRaCIS.Core.Application.Service /// 后端api swagger 下载项目影像 /// /// + /// + /// /// [HttpPost] [AllowAnonymous] - public async Task DownloadTrialImage(Guid trialId) + public async Task DownloadTrialImage(Guid trialId, int startIndex, int endIndex) { //找到项目里面未阅片的影像 + if (startIndex < 1 || endIndex < 1 || startIndex > endIndex) + { + return ResponseOutput.NotOk("请输入正确的下载区间"); + } + //var subjectCodeList = new List() { "05002", "07006", "07026" }; var downloadInfo = _trialRepository.Where(t => t.Id == trialId).Select(t => new @@ -249,6 +256,8 @@ namespace IRaCIS.Core.Application.Service var oldVisits = MiniExcel.Query(Path.Combine(rootFolder, "Old.xlsx")).ToList(); + Log.Logger.Warning($"数据库查询下载访视数量 - 前一批已下载访视数量:{downloadInfo.VisitList.Count} - {oldVisits.Count}"); + var acturalDownList = downloadInfo.VisitList.Where(t => !oldVisits.Any(old => old.VisitNum == t.VisitNum && old.SubjectCode == t.SubjectCode && old.VisitName.Trim().ToLower() == t.VisitName.Trim().ToLower())).ToList(); @@ -265,19 +274,25 @@ namespace IRaCIS.Core.Application.Service StreamReaderFunc = (stream) => new StreamReader(stream, Encoding.GetEncoding("gb2312")) }).ToList(); + Log.Logger.Warning($"download_log.csv访视数量:{existVisits.Count}"); + acturalDownList = acturalDownList.Where(t => !existVisits.Any(old => old.VisitNum == t.VisitNum && old.SubjectCode == t.SubjectCode && old.VisitName.Trim().ToLower() == t.VisitName.Trim().ToLower())).ToList(); } + acturalDownList = acturalDownList.Skip(startIndex - 1).Take(endIndex).ToList(); + + Log.Logger.Warning($"该区{startIndex}-{endIndex} 实际需要下载访视数量:{acturalDownList.Count}"); + #endregion var count = acturalDownList.SelectMany(t => t.NoneDicomStudyList).SelectMany(t => t.FileList).Count(); var count2 = acturalDownList.SelectMany(t => t.StudyList).SelectMany(t => t.SeriesList).SelectMany(t => t.InstancePathList).Count(); - Console.WriteLine($"下载总数量:{count}+{count2}={count + count2}"); + Log.Logger.Warning($"下载总数量:{count}+{count2}={count + count2}"); var downloadJobs = new List();