diff --git a/IRaCIS.Core.Application/Helper/FileDocProcess/ExcelExportHelper.cs b/IRaCIS.Core.Application/Helper/FileDocProcess/ExcelExportHelper.cs index 6c6a4acae..5c740d0a5 100644 --- a/IRaCIS.Core.Application/Helper/FileDocProcess/ExcelExportHelper.cs +++ b/IRaCIS.Core.Application/Helper/FileDocProcess/ExcelExportHelper.cs @@ -18,6 +18,7 @@ using NPOI.HSSF.UserModel; using NPOI.SS.Formula.Functions; using NPOI.SS.UserModel; using NPOI.XSSF.UserModel; +using SharpCompress.Common; using System.Collections; using System.Globalization; using Xceed.Document.NET; @@ -870,17 +871,16 @@ public static class ExcelExportHelper //模板路径 var tplPath = physicalPath; - #region 根据中英文 删除模板sheet - - // 打开模板文件 - var templateFile = new FileStream(tplPath, FileMode.Open, FileAccess.Read); // 获取文件流 var templateStream = new MemoryStream(); - templateFile.CopyTo(templateStream); - templateStream.Seek(0, SeekOrigin.Begin); - var workbook = new XSSFWorkbook(templateStream); + #region 根据中英文 删除模板sheet + + // 打开模板文件 + var templateFileStream = new FileStream(tplPath, FileMode.Open, FileAccess.Read); + + var workbook = new XSSFWorkbook(templateFileStream); int sheetCount = workbook.NumberOfSheets; @@ -985,14 +985,8 @@ public static class ExcelExportHelper } } - using (var memoryStream2 = new MemoryStream()) - { - workbook.Write(memoryStream2, true); - - memoryStream2.Seek(0, SeekOrigin.Begin); - - templateStream = memoryStream2; - } + workbook.Write(templateStream, leaveOpen: true); + templateStream.Position = 0; } @@ -1099,6 +1093,63 @@ public static class ExcelExportHelper //模板路径 var tplPath = physicalPath; + var templateStream = new MemoryStream(); + + + #region npoi 移除某一行 + var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US; + + if (isEn_US) + { + // 打开模板文件 + using var templateFileStream = new FileStream(tplPath, FileMode.Open, FileAccess.Read); + + using var workbook = new XSSFWorkbook(templateFileStream); + + int sheetCount = workbook.NumberOfSheets; + + int removeRowIndex = 1; // 要删除的行(0-based) + + for (int i = 0; i < sheetCount; i++) + { + var sheet = workbook.GetSheetAt(i); + + // 2️ 删除行 + var row = sheet.GetRow(removeRowIndex); + if (row != null) + { + sheet.RemoveRow(row); + } + + // 3️ 上移后续行 + if (removeRowIndex < sheet.LastRowNum) + { + sheet.ShiftRows( + removeRowIndex + 1, + sheet.LastRowNum, + -1, + true, // copyRowHeight + false // resetOriginalRowHeight + ); + } + } + + workbook.Write(templateStream, leaveOpen: true); + templateStream.Position = 0; + } + else + { + using (var fs = new FileStream(tplPath, FileMode.Open, FileAccess.Read)) + { + fs.CopyTo(templateStream); + } + + templateStream.Position = 0; + } + + + #endregion + var memoryStream = new MemoryStream(); @@ -1107,7 +1158,7 @@ public static class ExcelExportHelper IgnoreTemplateParameterMissing = true, }; - await MiniExcel.SaveAsByTemplateAsync(memoryStream, tplPath, data, config); + await MiniExcel.SaveAsByTemplateAsync(memoryStream, templateStream.ToArray(), data, config); memoryStream.Seek(0, SeekOrigin.Begin); diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 5c2392e45..2537cbd5e 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -17,6 +17,7 @@ using MassTransit; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Newtonsoft.Json; +using System.Linq; using System.Linq.Dynamic.Core; using Subject = IRaCIS.Core.Domain.Models.Subject; @@ -2559,8 +2560,11 @@ public class VisitTaskService(IRepository _visitTaskRepository, //删除序列数据 await _subjectCriteriaEvaluationVisitStudyFilterRepository.BatchDeleteNoTrackingAsync(t => t.TrialReadingCriterion.CriterionType == CriterionType.RECIST1Pointt1_MB && t.SubjectVisit.SubjectId == task.SubjectId && t.SubjectVisitId == task.SourceSubjectVisitId); + + otherVisitIdList = otherVisitIdList.Where(t => t != task.SourceSubjectVisitId.Value).ToList(); } + //BM后续访视 ,筛选状态不变,任务生成状态重置(实际该访视任务状态 可能是重阅重置了或者失效了,需要后续生成,或者取消分配了,需要后续重新分配) await _subjectCriteriaEvaluationVisitFilterRepository.UpdatePartialFromQueryAsync(t => t.TrialReadingCriterion.CriterionType == CriterionType.RECIST1Pointt1_MB && t.SubjectVisit.SubjectId == task.SubjectId && otherVisitIdList.Contains(t.SubjectVisitId), diff --git a/IRaCIS.Core.Application/Service/Common/Export/TumorExportService.cs b/IRaCIS.Core.Application/Service/Common/Export/TumorExportService.cs index dd8ce3cd5..f08d03e6c 100644 --- a/IRaCIS.Core.Application/Service/Common/Export/TumorExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/Export/TumorExportService.cs @@ -601,18 +601,21 @@ public class Tumor_CDISC_ExportService(IRepository t.SubjectCode == task.SubjectCode && t.ARM_TumorNo == $"{task.ArmEnumStr}_{lesion.LessionCode}")) { - tu.BodyPart = _userInfo.IsEn_Us ? trialOrganDic[lesion.OrganInfoId.Value].PartEN : trialOrganDic[lesion.OrganInfoId.Value].Part; + var tu = CreatNewTUExport(task, lesion, visitIndexNoDic, translateDataList, isEn_Us); + + if (lesion.OrganInfoId.HasValue) + { + tu.BodyPart = _userInfo.IsEn_Us ? trialOrganDic[lesion.OrganInfoId.Value].PartEN : trialOrganDic[lesion.OrganInfoId.Value].Part; + } + + + Fill_Resisit_Lugano_TUExport(tu, lesion); + + tuList.Add(tu); } - - Fill_Resisit_Lugano_TUExport(tu, lesion); - - tuList.Add(tu); - #endregion diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index 77b1c03ab..bb5a73685 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -862,7 +862,7 @@ namespace IRaCIS.Core.Application.Service if (isRemember) { await _fusionCache.SetAsync(CacheKeys.UserMFAVerifyPass(identityUserId, _userInfo.BrowserFingerprint), _userInfo.BrowserFingerprint, TimeSpan.FromMinutes(_serviceVerifyConfigConfig.UserMFAVerifyMinutes)); - + Log.Logger.Warning($"MFA登录记录:{_userInfo.UserName} 浏览器标识: {_userInfo.BrowserFingerprint} 设置缓存分钟{_serviceVerifyConfigConfig.UserMFAVerifyMinutes}"); } @@ -1176,15 +1176,20 @@ namespace IRaCIS.Core.Application.Service if (_verifyConfig.CurrentValue.OpenLoginMFA) { + if ((await _fusionCache.GetOrDefaultAsync(CacheKeys.UserMFAVerifyPass(identityUserId, _userInfo.BrowserFingerprint), "")) == _userInfo.BrowserFingerprint) { userLoginReturnModel.IsMFA = false; + + Log.Logger.Warning($"MFA登录:{userName} 浏览器标识: {_userInfo.BrowserFingerprint},判断缓存里存在 "); } else { //MFA 发送邮件 userLoginReturnModel.IsMFA = true; + + Log.Logger.Warning($"MFA登录:{userName} 浏览器标识: {_userInfo.BrowserFingerprint} 判断缓存已经不存在"); } var email = userLoginReturnModel.BasicInfo.EMail;