diff --git a/IRaCIS.Core.Application/Helper/Attribute/DictionaryTranslateAttribute.cs b/IRaCIS.Core.Application/Helper/Attribute/DictionaryTranslateAttribute.cs index 855bdac4..27403ece 100644 --- a/IRaCIS.Core.Application/Helper/Attribute/DictionaryTranslateAttribute.cs +++ b/IRaCIS.Core.Application/Helper/Attribute/DictionaryTranslateAttribute.cs @@ -17,17 +17,39 @@ namespace IRaCIS.Core.Application.Helper public CriterionType? CriterionType { get; set; } + + //是否翻译依赖其他属性 + public bool IsTranslateDenpendOtherProperty =>!string.IsNullOrWhiteSpace(DependPropertyName); + + public string DependPropertyName { get; set; }=string.Empty; + + public string DependPropertyValueStr { get; set; } = string.Empty; + + // 普通翻译的字典 public DictionaryTranslateAttribute(string dicParentCode) { DicParentCode = dicParentCode; } + //针对不同的标准 翻译的字典不一样 public DictionaryTranslateAttribute(string dicParentCode, CriterionType criterionType ) { DicParentCode = dicParentCode; CriterionType = criterionType; } + + //针对业务某个属性的值 不一样 用的翻译字典不一样 + + public DictionaryTranslateAttribute(string dicParentCode,string dependPropertyName, string dependPropertyValueStr) + { + DicParentCode = dicParentCode; + + DependPropertyName = dependPropertyName; + + DependPropertyValueStr = dependPropertyValueStr; + + } } } diff --git a/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs b/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs index ad3a6515..e1d1703b 100644 --- a/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs +++ b/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs @@ -30,7 +30,8 @@ public static class ExcelExportHelper //一个值 对应不同的字典翻译 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 }) + c.GetCustomAttributes(typeof(DictionaryTranslateAttribute), false).Select(f => (DictionaryTranslateAttribute?)f).Where(t => t.CriterionType == criterionType || t.CriterionType == null) + .Select(k => new { c.Name, k.DicParentCode ,k.IsTranslateDenpendOtherProperty, k.DependPropertyName,k.DependPropertyValueStr}) ).ToList(); @@ -58,10 +59,25 @@ public static class ExcelExportHelper foreach (var needTranslateProperty in needTranslatePropertyList) { - var beforeValue = itemDic[needTranslateProperty.Name]?.ToString(); + //翻译的属性依赖其他属性 + if(needTranslateProperty.IsTranslateDenpendOtherProperty) + { + if (item[needTranslateProperty.DependPropertyName]?.ToString().ToLower() == needTranslateProperty.DependPropertyValueStr.ToLower()) + { + var beforeValue = itemDic[needTranslateProperty.Name]?.ToString(); + + itemDic[needTranslateProperty.Name] = translateDataList[needTranslateProperty.DicParentCode].Where(t => t.Code.ToLower() == beforeValue?.ToLower()).FirstOrDefault()?.ValueCN ?? String.Empty; + } + } + //普通翻译 或者某一标准翻译 + else + { + var beforeValue = itemDic[needTranslateProperty.Name]?.ToString(); - itemDic[needTranslateProperty.Name] = translateDataList[needTranslateProperty.DicParentCode].Where(t => t.Code.ToLower() == beforeValue?.ToLower()).FirstOrDefault()?.ValueCN ?? String.Empty; + itemDic[needTranslateProperty.Name] = translateDataList[needTranslateProperty.DicParentCode].Where(t => t.Code.ToLower() == beforeValue?.ToLower()).FirstOrDefault()?.ValueCN ?? String.Empty; + } + } diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs index d120f046..f5f98fb9 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs @@ -597,6 +597,8 @@ namespace IRaCIS.Core.Application.Contracts public bool? IsSelfAnalysis { get; set; } //自身一致性分析任务特有 + + [DictionaryTranslateAttribute("YesOrNo")] public bool? IsAnalysisDiffToOriginalData { get; set; } @@ -612,13 +614,20 @@ namespace IRaCIS.Core.Application.Contracts public Arm ArmEnum { get; set; } public string UserName { get; set; } + + + public bool IsBaseline { get; set; } + + + [DictionaryTranslateAttribute("ExistDisease", nameof(SelftAnalysisExport.IsBaseline),"true")] + [DictionaryTranslateAttribute("OverallAssessment", nameof(SelftAnalysisExport.IsBaseline), "false")] public string EvaluateResult { get; set; } + [DictionaryTranslateAttribute("ExistDisease", nameof(SelftAnalysisExport.IsBaseline), "true")] + [DictionaryTranslateAttribute("OverallAssessment", nameof(SelftAnalysisExport.IsBaseline), "false")] public string AgainEvaluateResult { get; set; } = String.Empty; } - - public class OverallTumorEvaluationExport { public String TrialSiteCode { get; set; } = String.Empty; @@ -686,25 +695,29 @@ namespace IRaCIS.Core.Application.Contracts //病灶编号 public string LessionCode { get; set; } - + + [DictionaryTranslateAttribute("LesionType")] //病灶类型 public string LessionType { get; set; } + + + //是否淋巴结 + [DictionaryTranslateAttribute("IsLymph")] + public string IsLymph { get; set; } + //所在部位 public string LessionLocation { get; set; } + //所在器官 + [DictionaryTranslate("OrganType")] public string LessionOrgan { get; set; } - - //是否淋巴结 - public string IsLymph { get; set; } - //部位描述 public string BodyPartDescription { get; set; } //测量值 - public string MeasurementResult { get; set; } - + //public string MeasurementResult { get; set; } //长径 public string LongDiameter { get; set; } @@ -712,6 +725,7 @@ namespace IRaCIS.Core.Application.Contracts //短径 public string ShortDiameter { get; set; } + [DictionaryTranslateAttribute("TargetState")] //病灶状态 public string LessionState { get; set; } diff --git a/IRaCIS.Core.Application/Service/QC/QCListService.cs b/IRaCIS.Core.Application/Service/QC/QCListService.cs index ec012934..4e86bb57 100644 --- a/IRaCIS.Core.Application/Service/QC/QCListService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCListService.cs @@ -479,8 +479,8 @@ namespace IRaCIS.Core.Application.Image.QA var subjectQuerybal= _repository.Where(t => t.TrialId == queryVisitTask.TrialId && t.TaskState == TaskState.Effect && t.IsSelfAnalysis == true).Select(t => t.SubjectId).Distinct(); - var allList = await _repository.Where(t => t.TrialId == queryVisitTask.TrialId && t.TaskState == TaskState.Effect && subjectQuerybal.Contains(t.SubjectId)) - .Where(t => t.IsSelfAnalysis == true || t.IsSelfAnalysis == null) //一致性分析的结果 + 正常任务的结果 + var allList = await _repository.Where(t => t.TrialId == queryVisitTask.TrialId && t.TaskState == TaskState.Effect && subjectQuerybal.Contains(t.SubjectId) && t.ReadingCategory == ReadingCategory.Visit) + .Where(t => t.IsSelfAnalysis == true || t.IsSelfAnalysis == null) //一致性分析的结果 + 正常任务的结果 + 仅仅访视的结果 //.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId) //.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState) @@ -502,25 +502,27 @@ namespace IRaCIS.Core.Application.Image.QA .WhereIf(queryVisitTask.EndAllocateDate != null, t => t.AllocateTime < queryVisitTask.EndAllocateDate!.Value.AddDays(1)) .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); - + var list = allList.Where(t => t.IsSelfAnalysis == null).OrderBy(t => t.TrialSiteCode).ThenBy(t => t.SubjectCode).ThenBy(t => t.VisitTaskNum).ToList(); //To do 根据任务Id 找对评估结果,这里需要考虑标准 以及对应的翻译 - - - - - + //基线和访视的评估结果翻译枚举 分别对应着 foreach (var item in list) { //找到一致性分析的结果 var origenalTask = allList.Where(t => t.IsSelfAnalysis == true && t.SubjectCode == item.SubjectCode && t.VisitTaskNum == item.VisitTaskNum && t.TaskName == t.TaskName).FirstOrDefault(); + + //因为基线的评估结果是 是否存在疾病 而 其他访视的结果是 整体肿瘤评估结果 是用不同的枚举翻译的 所以这里手动翻译 不把翻译逻辑耦合到通用的翻译代码里面 在此特殊处理 + item.AgainEvaluateResult = origenalTask?.EvaluateResult ?? String.Empty ; + //将自身一致性分析的字段 赋值到访视任务这个字段 + item.IsAnalysisDiffToOriginalData = origenalTask.IsAnalysisDiffToOriginalData; + } @@ -528,7 +530,7 @@ namespace IRaCIS.Core.Application.Image.QA exportInfo.List = list; - return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialMedicalReviewList_Export, exportInfo, "", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(TaskMedicalReviewExportDto)); + return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialMedicalReviewList_Export, exportInfo, "", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(SelftAnalysisExport)); } @@ -547,8 +549,8 @@ namespace IRaCIS.Core.Application.Image.QA var subjectQuerybal = _repository.Where(t => t.TrialId == queryVisitTask.TrialId && t.TaskState == TaskState.Effect && t.IsSelfAnalysis == false).Select(t => t.SubjectId).Distinct(); - var allList = await _repository.Where(t => t.TrialId == queryVisitTask.TrialId && t.TaskState == TaskState.Effect && subjectQuerybal.Contains(t.SubjectId)) - .Where(t => t.IsSelfAnalysis == false || t.IsSelfAnalysis == null) //一致性分析的结果 + 正常任务的结果 + var allList = await _repository.Where(t => t.TrialId == queryVisitTask.TrialId && t.TaskState == TaskState.Effect && subjectQuerybal.Contains(t.SubjectId) &&t.ReadingCategory==ReadingCategory.Visit) + .Where(t => t.IsSelfAnalysis == false || t.IsSelfAnalysis == null) //一致性分析的结果 + 正常任务的结果 +仅仅访视的结果 //.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId) //.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState) @@ -748,7 +750,7 @@ namespace IRaCIS.Core.Application.Image.QA if (criterionType == CriterionType.RECIST1Pointt1) { - var list = await query.ProjectTo(_mapper.ConfigurationProvider, new { criterionType = criterionType }).ToListAsync(); + var list = await query.ProjectTo(_mapper.ConfigurationProvider, new { criterionType = criterionType, isEn_Us=_userInfo.IsEn_Us }).ToListAsync(); var exportList = list.SelectMany(c => @@ -759,20 +761,22 @@ namespace IRaCIS.Core.Application.Image.QA var clone = c.Clone(); clone.LessionCode = u.LessionCode; clone.LessionType = u.LessionType; - clone.LessionLocation = u.LessionLocation; - clone.LessionOrgan = u.LessionOrgan; + clone.IsLymph = u.IsLymph; + clone.LessionLocation = u.LessionLocation; + clone.LessionOrgan = u.LessionOrgan; clone.BodyPartDescription = u.BodyPartDescription; - clone.MeasurementResult = u.MeasurementResult; + + //clone.MeasurementResult = u.MeasurementResult; clone.LongDiameter = u.LongDiameter; clone.ShortDiameter = u.ShortDiameter; clone.LessionState = u.LessionState; return clone; }); - }); - exportInfo.List = list; + }).ToList(); + exportInfo.List = exportList; return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialMedicalReviewList_Export, exportInfo, "", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(RECIST1Point1DetailedOfEvaluatedLesionExport), criterionType); diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index 90e0db27..cdced0ca 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -1895,7 +1895,8 @@ namespace IRaCIS.Core.Application.Image.QA { session.CreateDirectory(targetPath); } - + + foreach (var studyFolder in studyFolders) { var targetFolder = Path.Combine(targetPath, studyFolder.Name); diff --git a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs index cfe2a531..52c29699 100644 --- a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs @@ -16,6 +16,8 @@ namespace IRaCIS.Core.Application.Service #region 导出列表 + var isEn_Us = false; + CreateMap(); CreateMap() .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode)) @@ -131,8 +133,13 @@ namespace IRaCIS.Core.Application.Service .ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.Subject.TrialSite.TrialSiteCode)) .ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code)) - .ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName)); + .ForMember(o => o.IsBaseline, t => t.MapFrom(u => u.SourceSubjectVisit.IsBaseLine)) + .ForMember(o => o.EvaluateResult, t => t.MapFrom(u => + u.SourceSubjectVisit.IsBaseLine? u.ReadingTaskQuestionAnswerList.Where(c => c.ReadingQuestionTrial.QuestionType == QuestionType.ExistDisease).FirstOrDefault().Answer + : u.ReadingTaskQuestionAnswerList.Where(c => c.ReadingQuestionTrial.QuestionType == QuestionType.Tumor).FirstOrDefault().Answer )) + .ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName)); + CriterionType? criterionType = null; CreateMap() @@ -159,21 +166,34 @@ namespace IRaCIS.Core.Application.Service .ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName)); - //CreateMap().IncludeBase() - // .ForMember(o => o.LesionList, t => t.MapFrom(u => u.LesionList)); + CreateMap().IncludeBase() + .ForMember(o => o.LesionList, t => t.MapFrom(u => u.LesionList)); - //CreateMap() - // .ForMember(o => o.LessionCode, t => t.MapFrom(u => u.RowMark)) - // .ForMember(o => o.LessionType, t => t.MapFrom(u => u.ReadingQuestionTrial.QuestionName)) - // .ForMember(o => o.IsLymph, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.IsLymph).FirstOrDefault().Answer)) + CreateMap() + .ForMember(o => o.LessionCode, t => t.MapFrom(u => u.RowMark)) + .ForMember(o => o.LessionType, t => t.MapFrom(u =>(int?) u.ReadingQuestionTrial.LesionType)) + .ForMember(o => o.IsLymph, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.IsLymph).FirstOrDefault().Answer)) - // .ForMember(o => o.LessionLocation, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.Location).FirstOrDefault().Answer)) - // .ForMember(o => o.LessionOrgan, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.Organ).FirstOrDefault().Answer)) - // .ForMember(o => o.BodyPartDescription, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.Part).FirstOrDefault().Answer)) - // .ForMember(o => o.MeasurementResult, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.Location).FirstOrDefault().Answer)) - // .ForMember(o => o.LongDiameter, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.MajorAxis).FirstOrDefault().Answer)) - // .ForMember(o => o.ShortDiameter, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.ShortAxis).FirstOrDefault().Answer)) - // .ForMember(o => o.LessionState, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State).FirstOrDefault().Answer)); + //位置可能是自己填写的 + .ForMember(o => o.LessionLocation, t => + //t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.Location).FirstOrDefault().Answer) + t.MapFrom(u => u.OrganInfo.IsCanEditPosition? + u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.Location).FirstOrDefault().Answer: isEn_Us ? u.OrganInfo.TULATEN : u.OrganInfo.TULAT) + ) + .ForMember(o => o.LessionOrgan, t => + //t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.Organ).FirstOrDefault().Answer) + t.MapFrom(u => isEn_Us ? (int?)u.OrganInfo.OrganType : (int?) u.OrganInfo.OrganType) + ) + .ForMember(o => o.BodyPartDescription, t => + //t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.Part).FirstOrDefault().Answer) + t.MapFrom(u => isEn_Us? u.OrganInfo.PartEN : u.OrganInfo.Part) + + ) + + //.ForMember(o => o.MeasurementResult, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.Location).FirstOrDefault().Answer)) + .ForMember(o => o.LongDiameter, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.MajorAxis).FirstOrDefault().Answer)) + .ForMember(o => o.ShortDiameter, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.ShortAxis).FirstOrDefault().Answer)) + .ForMember(o => o.LessionState, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State).FirstOrDefault().Answer)); #endregion diff --git a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableAnswerRowInfo.cs b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableAnswerRowInfo.cs index d4e835fd..2bd50cdc 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableAnswerRowInfo.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingFormAnswer/ReadingTableAnswerRowInfo.cs @@ -8,6 +8,7 @@ using IRaCIS.Core.Domain.Share; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; namespace IRaCIS.Core.Domain.Models { @@ -134,10 +135,13 @@ namespace IRaCIS.Core.Domain.Models /// public Guid? OrganInfoId { get; set; } - /// - /// 窗宽WW - /// - public decimal? WW { get; set; } + [ForeignKey("OrganInfoId")] + public OrganInfo OrganInfo { get; set; } + + /// + /// 窗宽WW + /// + public decimal? WW { get; set; } /// /// 窗位WL