diff --git a/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs b/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs index bd002e8e..ad3a6515 100644 --- a/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs +++ b/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs @@ -7,6 +7,7 @@ using MiniExcelLibs; using MiniExcelLibs.OpenXml; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using NPOI.HSSF.UserModel; namespace IRaCIS.Core.Application.Service; @@ -123,4 +124,94 @@ public static class ExcelExportHelper #endregion } + + + + public static async Task DataExport_NpoiTestAsync(string code, object data, IRepository _commonDocumentRepository, IWebHostEnvironment _hostEnvironment, IDictionaryService? _dictionaryService = null, Type? translateType = null, CriterionType? criterionType = null) + { + //判断是否有字典翻译 + + if (_dictionaryService != null && translateType != null) + { + //一个值 对应不同的字典翻译 + var needTranslatePropertyList = translateType.GetProperties().Where(t => t.IsDefined(typeof(DictionaryTranslateAttribute), true)) + .SelectMany(c => + c.GetCustomAttributes(typeof(DictionaryTranslateAttribute), false).Select(f => (DictionaryTranslateAttribute?)f).Where(t => t.CriterionType == criterionType || t.CriterionType == null).Select(k => new { c.Name, k.DicParentCode }) + ).ToList(); + + //字典表查询出所有需要翻译的数据 + + var translateDataList = await _dictionaryService.GetBasicDataSelect(needTranslatePropertyList.Select(t => t.DicParentCode).Distinct().ToArray()); + + var dic = JsonConvert.DeserializeObject>(data.ToJsonNotIgnoreNull()); + + foreach (var key in dic.Keys) + { + //是数组 那么找到对应的属性 进行翻译 + if (dic[key].GetType().IsAssignableFrom(typeof(JArray))) + { + + var newObjList = new List(); + var no = 1; + + foreach (var item in dic[key] as JArray) + { + var itemDic = JsonConvert.DeserializeObject>(item.ToJsonNotIgnoreNull()); + + foreach (var needTranslateProperty in needTranslatePropertyList) + { + var beforeValue = itemDic[needTranslateProperty.Name]?.ToString(); + + itemDic[needTranslateProperty.Name] = translateDataList[needTranslateProperty.DicParentCode].Where(t => t.Code.ToLower() == beforeValue?.ToLower()).FirstOrDefault()?.ValueCN ?? String.Empty; + } + + itemDic.Add("No", no++); + newObjList.Add(itemDic); + } + + dic[key] = newObjList; + + } + } + + + data = dic; + + + } + + + + + + var (physicalPath, fileNmae) = await FileStoreHelper.GetCommonDocPhysicalFilePathAsync(_hostEnvironment, _commonDocumentRepository, code); + + + //模板路径 + var tplPath = physicalPath; + + #region MiniExcel + + var memoryStream = new MemoryStream(); + + var config = new OpenXmlConfiguration() + { + IgnoreTemplateParameterMissing = true, + }; + + await MiniExcel.SaveAsByTemplateAsync(memoryStream, tplPath, data, config); + + memoryStream.Seek(0, SeekOrigin.Begin); + + + return memoryStream; + + //var wb = new HSSFWorkbook(memoryStream); + + //var sheet = wb.GetSheetAt(0); + + + #endregion + } + } \ No newline at end of file diff --git a/IRaCIS.Core.Application/Helper/FileStoreHelper.cs b/IRaCIS.Core.Application/Helper/FileStoreHelper.cs index bfd3d412..0656f480 100644 --- a/IRaCIS.Core.Application/Helper/FileStoreHelper.cs +++ b/IRaCIS.Core.Application/Helper/FileStoreHelper.cs @@ -430,9 +430,13 @@ public static class FileStoreHelper Directory.CreateDirectory(path); } - var physicalPath = Path.Combine(path, instanceId.ToString() + ".dcm"); + var physicalPath = Path.Combine(path, instanceId.ToString() ); - var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TrialDataFolder}/{trialId}/{siteId}/{subjectId}/{subjectVisitId}/{StaticData.Folder.DicomFolder}/{studyId}/{instanceId}.dcm"; + var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TrialDataFolder}/{trialId}/{siteId}/{subjectId}/{subjectVisitId}/{StaticData.Folder.DicomFolder}/{studyId}/{instanceId}"; + + //var physicalPath = Path.Combine(path, instanceId.ToString() + ".dcm"); + + //var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TrialDataFolder}/{trialId}/{siteId}/{subjectId}/{subjectVisitId}/{StaticData.Folder.DicomFolder}/{studyId}/{instanceId}.dcm"; return (physicalPath, relativePath); } diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj index 3339706c..449c86de 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj @@ -97,7 +97,7 @@ true - + diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 288f1914..d12a61ff 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -5236,6 +5236,26 @@ TaskMedicalReviewQuery 列表查询参数模型 + + + 阅片工具 + + + + + 任务展示访视 读片任务显示是否顺序 + + + + + 阅片是否显示受试者信息 + + + + + IR阅片页面是否可以查看既往任务结果 + + VisitTaskView 列表视图模型 diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs index fcf7dc84..d749b56f 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs @@ -51,10 +51,65 @@ namespace IRaCIS.Core.Application.ViewModel public bool IsPMSetBack { get; set; } + #region 标准配置 public string TrialReadingCriterionId { get; set; } public string TrialReadingCriterionName { get; set; } + + + /// + /// 阅片工具 + /// + public ReadingTool? ReadingTool { get; set; } + + /// + /// 任务展示访视 读片任务显示是否顺序 + /// + public bool IsReadingTaskViewInOrder { get; set; } = true; + + + /// + /// 阅片是否显示受试者信息 + /// + public bool IsReadingShowSubjectInfo { get; set; } = false; + + /// + /// IR阅片页面是否可以查看既往任务结果 + /// + public bool IsReadingShowPreviousResults { get; set; } = false; + + public int? DigitPlaces { get; set; } = 2; + + + ///// + ///// 仲裁对象 + ///// + //public ArbitrationRule ArbitrationRule { get; set; } = ArbitrationRule.Reading; + + + ///// + ///// 阅片模式 + ///// + //public ReadingMethod ReadingType { get; set; } = ReadingMethod.Double; + + ///// + ///// 全局阅片 + ///// + //public bool IsGlobalReading { get; set; } = true; + + ///// + ///// 仲裁阅片 + ///// + //public bool IsArbitrationReading { get; set; } = true; + + + ///// + ///// 肿瘤学阅片 原字段 IsClinicalReading + ///// + //public bool IsOncologyReading { get; set; } + #endregion + } diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/Interface/IStudyDTFService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/Interface/IStudyDTFService.cs deleted file mode 100644 index a29b14fa..00000000 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/Interface/IStudyDTFService.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using IRaCIS.Core.Application.Contracts.Dicom.DTO; -using IRaCIS.Core.Infrastructure.Extention; - -namespace IRaCIS.Core.Application.Contracts.Image -{ - public interface IStudyDTFService - { - IResponseOutput AddStudyDTF(StudyDTFAddOrUpdateCommand studyDtfAddOrUpdate); - IResponseOutput DeleteStudyDTF(Guid studyDTFId ); - - List GetStudyDtfdtos(Guid triaId, string studyInstanceUid); - - } -} \ No newline at end of file