diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 67f9d175b..f465875b6 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -17516,17 +17516,17 @@
- ����
+ 质疑
- һ���Ժ˲�
+ 一致性核查
- ����
+ 复制
diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/SystemAnonymizationService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/SystemAnonymizationService.cs
index a923cb9e8..1ade0ca55 100644
--- a/IRaCIS.Core.Application/Service/ImageAndDoc/SystemAnonymizationService.cs
+++ b/IRaCIS.Core.Application/Service/ImageAndDoc/SystemAnonymizationService.cs
@@ -4,6 +4,7 @@
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
+using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using Microsoft.AspNetCore.Mvc;
@@ -13,7 +14,7 @@ namespace IRaCIS.Core.Application.Service
/// SystemAnonymizationService
///
[ApiExplorerSettings(GroupName = "Image")]
- public class SystemAnonymizationService(IRepository _systemAnonymizationRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ISystemAnonymizationService
+ public class SystemAnonymizationService(IRepository _systemAnonymizationRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService, ISystemAnonymizationService
{
@@ -37,6 +38,7 @@ namespace IRaCIS.Core.Application.Service
var entity = await _systemAnonymizationRepository.InsertOrUpdateAsync(addOrEditSystemAnonymization, true);
+ await _fusionCache.SetAsync(CacheKeys.SystemAnonymization, CacheHelper.GetSystemAnonymizationListAsync(_systemAnonymizationRepository), TimeSpan.FromDays(7));
return ResponseOutput.Ok(entity.Id.ToString());
diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs
index 470a32ecc..d1c8d8653 100644
--- a/IRaCIS.Core.Application/TestService.cs
+++ b/IRaCIS.Core.Application/TestService.cs
@@ -1,4 +1,5 @@
using Aliyun.OSS;
+using ClosedXML.Excel;
using FellowOakDicom;
using FellowOakDicom.Imaging;
using IRaCIS.Application.Contracts;
@@ -56,6 +57,126 @@ namespace IRaCIS.Core.Application.Service
{
public static int IntValue = 100;
+ static string ReplaceText(string text, Dictionary replaceRules)
+ {
+ foreach (var rule in replaceRules)
+ {
+ text = text.Replace(rule.Key, rule.Value, StringComparison.OrdinalIgnoreCase);
+ }
+
+ return text;
+ }
+ public async Task ExcelReplaceKeyWord()
+ {
+ string folderPath = @"C:\Users\PC\Downloads\SystemData(1)\SystemData\DataTemplate";
+
+ var replaceRules = new Dictionary
+ {
+ ["受试者"] = "试验参与者",
+ ["Subject"] = "Participant"
+ };
+
+ foreach (var file in Directory.GetFiles(folderPath, "*.xlsx", SearchOption.AllDirectories))
+ {
+ Console.WriteLine($"处理文件:{file}");
+
+ using var workbook = new XLWorkbook(file);
+
+ bool changed = false;
+
+ foreach (var ws in workbook.Worksheets.ToList())
+ {
+ #region Sheet名称
+
+ var originalName = ws.Name;
+
+ string newSheetName = ReplaceText(originalName, replaceRules);
+
+ if (newSheetName != ws.Name)
+ {
+ ws.Name = newSheetName;
+ changed = true;
+
+ Console.WriteLine($"Sheet重命名:{originalName}->{newSheetName}");
+ }
+
+ #endregion
+
+ #region 单元格内容
+
+ var usedCells = ws.CellsUsed();
+
+ foreach (var cell in usedCells)
+ {
+ if (cell.IsEmpty())
+ {
+ continue;
+ }
+
+ string value = cell.GetString();
+
+ if (value.Contains("{{") || (value.Contains("}}")))
+ {
+ continue;
+ }
+
+ string newValue = ReplaceText(value, replaceRules);
+
+ if (value != newValue)
+ {
+ cell.Value = newValue;
+ changed = true;
+
+ Console.WriteLine($"单元格内容替换:{value}->{newValue}");
+ }
+ }
+
+ #endregion
+
+ #region 公式(可选)
+
+ //foreach (var cell in ws.CellsUsed(c => c.HasFormula))
+ //{
+ // var formula = cell.FormulaA1;
+
+ // var newFormula = ReplaceText(formula, replaceRules);
+
+ // if (formula != newFormula)
+ // {
+ // cell.FormulaA1 = newFormula;
+ // changed = true;
+ // }
+ //}
+
+ #endregion
+ }
+
+ if (changed)
+ {
+ workbook.Save();
+
+ Console.WriteLine($"已保存:{file}");
+ }
+
+ // 文件名替换
+ var fileName = Path.GetFileName(file);
+ var newFileName = ReplaceText(fileName, replaceRules);
+
+ if (fileName != newFileName)
+ {
+ var newPath = Path.Combine(
+ Path.GetDirectoryName(file)!,
+ newFileName);
+
+ File.Move(file, newPath, true);
+
+ Console.WriteLine($"文件重命名:{fileName} -> {newFileName}");
+ }
+ }
+
+
+ return ResponseOutput.Ok();
+ }
public class ModelVerifyCommand