Test.EIImageViewer
he 2023-02-13 10:09:29 +08:00
commit d5f72ca7de
7 changed files with 129 additions and 48 deletions

View File

@ -17,17 +17,39 @@ namespace IRaCIS.Core.Application.Helper
public CriterionType? CriterionType { get; set; } 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) public DictionaryTranslateAttribute(string dicParentCode)
{ {
DicParentCode = dicParentCode; DicParentCode = dicParentCode;
} }
//针对不同的标准 翻译的字典不一样
public DictionaryTranslateAttribute(string dicParentCode, CriterionType criterionType ) public DictionaryTranslateAttribute(string dicParentCode, CriterionType criterionType )
{ {
DicParentCode = dicParentCode; DicParentCode = dicParentCode;
CriterionType = criterionType; CriterionType = criterionType;
} }
//针对业务某个属性的值 不一样 用的翻译字典不一样
public DictionaryTranslateAttribute(string dicParentCode,string dependPropertyName, string dependPropertyValueStr)
{
DicParentCode = dicParentCode;
DependPropertyName = dependPropertyName;
DependPropertyValueStr = dependPropertyValueStr;
}
} }
} }

View File

@ -30,7 +30,8 @@ public static class ExcelExportHelper
//一个值 对应不同的字典翻译 //一个值 对应不同的字典翻译
var needTranslatePropertyList = translateType.GetProperties().Where(t => t.IsDefined(typeof(DictionaryTranslateAttribute), true)) var needTranslatePropertyList = translateType.GetProperties().Where(t => t.IsDefined(typeof(DictionaryTranslateAttribute), true))
.SelectMany(c => .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(); ).ToList();
@ -58,10 +59,25 @@ public static class ExcelExportHelper
foreach (var needTranslateProperty in needTranslatePropertyList) 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;
}
} }

View File

@ -597,6 +597,8 @@ namespace IRaCIS.Core.Application.Contracts
public bool? IsSelfAnalysis { get; set; } public bool? IsSelfAnalysis { get; set; }
//自身一致性分析任务特有 //自身一致性分析任务特有
[DictionaryTranslateAttribute("YesOrNo")]
public bool? IsAnalysisDiffToOriginalData { get; set; } public bool? IsAnalysisDiffToOriginalData { get; set; }
@ -612,13 +614,20 @@ namespace IRaCIS.Core.Application.Contracts
public Arm ArmEnum { get; set; } public Arm ArmEnum { get; set; }
public string UserName { 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; } 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 string AgainEvaluateResult { get; set; } = String.Empty;
} }
public class OverallTumorEvaluationExport public class OverallTumorEvaluationExport
{ {
public String TrialSiteCode { get; set; } = String.Empty; public String TrialSiteCode { get; set; } = String.Empty;
@ -687,24 +696,28 @@ namespace IRaCIS.Core.Application.Contracts
public string LessionCode { get; set; } public string LessionCode { get; set; }
[DictionaryTranslateAttribute("LesionType")]
//病灶类型 //病灶类型
public string LessionType { get; set; } public string LessionType { get; set; }
//是否淋巴结
[DictionaryTranslateAttribute("IsLymph")]
public string IsLymph { get; set; }
//所在部位 //所在部位
public string LessionLocation { get; set; } public string LessionLocation { get; set; }
//所在器官 //所在器官
[DictionaryTranslate("OrganType")]
public string LessionOrgan { get; set; } public string LessionOrgan { get; set; }
//是否淋巴结
public string IsLymph { get; set; }
//部位描述 //部位描述
public string BodyPartDescription { get; set; } public string BodyPartDescription { get; set; }
//测量值 //测量值
public string MeasurementResult { get; set; } //public string MeasurementResult { get; set; }
//长径 //长径
public string LongDiameter { get; set; } public string LongDiameter { get; set; }
@ -712,6 +725,7 @@ namespace IRaCIS.Core.Application.Contracts
//短径 //短径
public string ShortDiameter { get; set; } public string ShortDiameter { get; set; }
[DictionaryTranslateAttribute("TargetState")]
//病灶状态 //病灶状态
public string LessionState { get; set; } public string LessionState { get; set; }

View File

@ -479,8 +479,8 @@ namespace IRaCIS.Core.Application.Image.QA
var subjectQuerybal= _repository.Where<VisitTask>(t => t.TrialId == queryVisitTask.TrialId && t.TaskState == TaskState.Effect && t.IsSelfAnalysis == true).Select(t => t.SubjectId).Distinct(); var subjectQuerybal= _repository.Where<VisitTask>(t => t.TrialId == queryVisitTask.TrialId && t.TaskState == TaskState.Effect && t.IsSelfAnalysis == true).Select(t => t.SubjectId).Distinct();
var allList = await _repository.Where<VisitTask>(t => t.TrialId == queryVisitTask.TrialId && t.TaskState == TaskState.Effect && subjectQuerybal.Contains(t.SubjectId)) var allList = await _repository.Where<VisitTask>(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) //一致性分析的结果 + 正常任务的结果 .Where(t => t.IsSelfAnalysis == true || t.IsSelfAnalysis == null) //一致性分析的结果 + 正常任务的结果 + 仅仅访视的结果
//.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId) //.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId)
//.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState) //.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState)
@ -508,19 +508,21 @@ namespace IRaCIS.Core.Application.Image.QA
//To do 根据任务Id 找对评估结果,这里需要考虑标准 以及对应的翻译 //To do 根据任务Id 找对评估结果,这里需要考虑标准 以及对应的翻译
//基线和访视的评估结果翻译枚举 分别对应着
foreach (var item in list) 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(); 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.AgainEvaluateResult = origenalTask?.EvaluateResult ?? String.Empty ;
//将自身一致性分析的字段 赋值到访视任务这个字段
item.IsAnalysisDiffToOriginalData = origenalTask.IsAnalysisDiffToOriginalData;
} }
@ -528,7 +530,7 @@ namespace IRaCIS.Core.Application.Image.QA
exportInfo.List = list; 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<VisitTask>(t => t.TrialId == queryVisitTask.TrialId && t.TaskState == TaskState.Effect && t.IsSelfAnalysis == false).Select(t => t.SubjectId).Distinct(); var subjectQuerybal = _repository.Where<VisitTask>(t => t.TrialId == queryVisitTask.TrialId && t.TaskState == TaskState.Effect && t.IsSelfAnalysis == false).Select(t => t.SubjectId).Distinct();
var allList = await _repository.Where<VisitTask>(t => t.TrialId == queryVisitTask.TrialId && t.TaskState == TaskState.Effect && subjectQuerybal.Contains(t.SubjectId)) var allList = await _repository.Where<VisitTask>(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) //一致性分析的结果 + 正常任务的结果 .Where(t => t.IsSelfAnalysis == false || t.IsSelfAnalysis == null) //一致性分析的结果 + 正常任务的结果 +仅仅访视的结果
//.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId) //.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId)
//.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState) //.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState)
@ -748,7 +750,7 @@ namespace IRaCIS.Core.Application.Image.QA
if (criterionType == CriterionType.RECIST1Pointt1) if (criterionType == CriterionType.RECIST1Pointt1)
{ {
var list = await query.ProjectTo<RECIST1Point1DetailedOfEvaluatedLesionExport>(_mapper.ConfigurationProvider, new { criterionType = criterionType }).ToListAsync(); var list = await query.ProjectTo<RECIST1Point1DetailedOfEvaluatedLesionExport>(_mapper.ConfigurationProvider, new { criterionType = criterionType, isEn_Us=_userInfo.IsEn_Us }).ToListAsync();
var exportList = list.SelectMany(c => var exportList = list.SelectMany(c =>
@ -759,20 +761,22 @@ namespace IRaCIS.Core.Application.Image.QA
var clone = c.Clone(); var clone = c.Clone();
clone.LessionCode = u.LessionCode; clone.LessionCode = u.LessionCode;
clone.LessionType = u.LessionType; clone.LessionType = u.LessionType;
clone.LessionLocation = u.LessionLocation;
clone.LessionOrgan = u.LessionOrgan;
clone.IsLymph = u.IsLymph; clone.IsLymph = u.IsLymph;
clone.LessionLocation = u.LessionLocation;
clone.LessionOrgan = u.LessionOrgan;
clone.BodyPartDescription = u.BodyPartDescription; clone.BodyPartDescription = u.BodyPartDescription;
clone.MeasurementResult = u.MeasurementResult;
//clone.MeasurementResult = u.MeasurementResult;
clone.LongDiameter = u.LongDiameter; clone.LongDiameter = u.LongDiameter;
clone.ShortDiameter = u.ShortDiameter; clone.ShortDiameter = u.ShortDiameter;
clone.LessionState = u.LessionState; clone.LessionState = u.LessionState;
return clone; return clone;
}); });
}); }).ToList();
exportInfo.List = list; exportInfo.List = exportList;
return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialMedicalReviewList_Export, exportInfo, "", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(RECIST1Point1DetailedOfEvaluatedLesionExport), criterionType); return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialMedicalReviewList_Export, exportInfo, "", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(RECIST1Point1DetailedOfEvaluatedLesionExport), criterionType);

View File

@ -1896,6 +1896,7 @@ namespace IRaCIS.Core.Application.Image.QA
session.CreateDirectory(targetPath); session.CreateDirectory(targetPath);
} }
foreach (var studyFolder in studyFolders) foreach (var studyFolder in studyFolders)
{ {
var targetFolder = Path.Combine(targetPath, studyFolder.Name); var targetFolder = Path.Combine(targetPath, studyFolder.Name);

View File

@ -16,6 +16,8 @@ namespace IRaCIS.Core.Application.Service
#region 导出列表 #region 导出列表
var isEn_Us = false;
CreateMap<Trial, ExcelExportInfo>(); CreateMap<Trial, ExcelExportInfo>();
CreateMap<SubjectVisit, CRCVisitExportDTO>() CreateMap<SubjectVisit, CRCVisitExportDTO>()
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode)) .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode))
@ -131,6 +133,11 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.Subject.TrialSite.TrialSiteCode)) .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.SubjectCode, t => t.MapFrom(u => u.Subject.Code))
.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)); .ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName));
@ -159,21 +166,34 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName)); .ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName));
//CreateMap<VisitTask, RECIST1Point1DetailedOfEvaluatedLesionExport>().IncludeBase<VisitTask, RECIST1Point1EvaluationOfTumorEfficacyExport>() CreateMap<VisitTask, RECIST1Point1DetailedOfEvaluatedLesionExport>().IncludeBase<VisitTask, RECIST1Point1EvaluationOfTumorEfficacyExport>()
// .ForMember(o => o.LesionList, t => t.MapFrom(u => u.LesionList)); .ForMember(o => o.LesionList, t => t.MapFrom(u => u.LesionList));
//CreateMap<ReadingTableAnswerRowInfo, RECIST1Point1LessionInfo>() CreateMap<ReadingTableAnswerRowInfo, RECIST1Point1LessionInfo>()
// .ForMember(o => o.LessionCode, t => t.MapFrom(u => u.RowMark)) .ForMember(o => o.LessionCode, t => t.MapFrom(u => u.RowMark))
// .ForMember(o => o.LessionType, t => t.MapFrom(u => u.ReadingQuestionTrial.QuestionName)) .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.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.LessionLocation, t =>
// .ForMember(o => o.BodyPartDescription, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.Part).FirstOrDefault().Answer)) //t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.Location).FirstOrDefault().Answer)
// .ForMember(o => o.MeasurementResult, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.Location).FirstOrDefault().Answer)) t.MapFrom(u => u.OrganInfo.IsCanEditPosition?
// .ForMember(o => o.LongDiameter, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.MajorAxis).FirstOrDefault().Answer)) u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.QuestionMark == QuestionMark.Location).FirstOrDefault().Answer: isEn_Us ? u.OrganInfo.TULATEN : u.OrganInfo.TULAT)
// .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.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 #endregion

View File

@ -8,6 +8,7 @@ using IRaCIS.Core.Domain.Share;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
namespace IRaCIS.Core.Domain.Models namespace IRaCIS.Core.Domain.Models
{ {
@ -134,10 +135,13 @@ namespace IRaCIS.Core.Domain.Models
/// </summary> /// </summary>
public Guid? OrganInfoId { get; set; } public Guid? OrganInfoId { get; set; }
/// <summary> [ForeignKey("OrganInfoId")]
/// 窗宽WW public OrganInfo OrganInfo { get; set; }
/// </summary>
public decimal? WW { get; set; } /// <summary>
/// 窗宽WW
/// </summary>
public decimal? WW { get; set; }
/// <summary> /// <summary>
/// 窗位WL /// 窗位WL