Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing

This commit is contained in:
he
2024-10-22 11:15:29 +08:00
16 changed files with 268 additions and 117 deletions
@@ -55,8 +55,10 @@ public class ProjectExceptionFilter(ILogger<ProjectExceptionFilter> _logger, ISt
var errorInfo = $"Exception: {exception.Message}[{exception.StackTrace}]" + (exception.InnerException != null ? $" InnerException: {exception.InnerException.Message}[{exception.InnerException.StackTrace}]" : "");
_logger.LogError(errorInfo);
//_logger.LogError(exception, exception.Message);
}
else
{
@@ -63,6 +63,10 @@ public class SystemEmailSendConfig
public string CompanyShortNameCN { get; set; } = string.Empty;
public bool IsEnv_US { get; set; }
public bool IsOpenErrorNoticeEmail { get; set; }
public List<string> ErrorNoticeEmailList { get; set; } =new List<string>();
}
public class SystemEmailSendConfigView
@@ -798,13 +798,6 @@
<param name="_trialRepository"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Common.ExcelExportService.GetTrialReadingCriterionCanExportDocumentList(System.Guid)">
<summary>
获取阅片标准可以导出的列表
</summary>
<param name="trialReadingCriterionId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Common.ExcelExportService.GetOverallTumorEvaluationList_Export(IRaCIS.Core.Application.ViewModel.VisitTaskQuery,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CommonDocument},IRaCIS.Application.Interfaces.IDictionaryService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial})">
<summary>
整体肿瘤评估 (目前仅仅 RECIST1.1 多个标准一个接口 Excel 列是一样的 )
@@ -836,6 +829,13 @@
<param name="_trialRepository"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Common.ExcelExportService.GetTrialReadingCriterionCanExportDocumentList(System.Guid)">
<summary>
获取阅片标准可以导出的列表
</summary>
<param name="trialReadingCriterionId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Common.ExcelExportService.GetCommonJudgeEvaluationList_Export(IRaCIS.Core.Application.ViewModel.VisitTaskQuery,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CommonDocument},IRaCIS.Application.Interfaces.IDictionaryService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial})">
<summary>
裁判阅片明细表
@@ -31,7 +31,7 @@ namespace IRaCIS.Core.Application.Service.Common
IRepository<SystemDocConfirmedUser> _systemDocConfirmedUserRepository,
IRepository<TrialDocNeedConfirmedUserType> _trialDocNeedConfirmedUserTypeRepository,
IRepository<TrialDocConfirmedUser> _trialDocConfirmedUserRepository,
IRepository<Subject> _subjectRepository,
IRepository<Subject> _subjectRepository,
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IWebHostEnvironment _hostEnvironment) : BaseService
{
@@ -1590,56 +1590,18 @@ namespace IRaCIS.Core.Application.Service.Common
//评估病灶明细
DetailedOfEvaluatedLesion = 3,
CommonReading_Export = 4,
CommonReadingDetail_Export = 5,
CommonJudgeReadingDetail_Export = 6,
VisitJudgeRatio_Export = 7,
ReadingPeriodJudgeRatio_Export = 8,
}
/// <summary>
/// 获取阅片标准可以导出的列表
/// </summary>
/// <param name="trialReadingCriterionId"></param>
/// <returns></returns>
public async Task<List<ExportDocumentDes>> GetTrialReadingCriterionCanExportDocumentList(Guid trialReadingCriterionId)
{
var list = new List<ExportDocumentDes>();
var criterion = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == trialReadingCriterionId).Select(t => new { t.CriterionType, t.CriterionName }).FirstNotNullAsync();
list.Add(new ExportDocumentDes() { Code = StaticData.Export.CommonReading_Export, ExportCatogory = ExportCatogory.OverallTumorEvaluation });
list.Add(new ExportDocumentDes() { Code = StaticData.Export.CommonReadingDetail_Export, ExportCatogory = ExportCatogory.OverallTumorEvaluation });
list.Add(new ExportDocumentDes() { Code = StaticData.Export.CommonJudgeReadingDetail_Export, ExportCatogory = ExportCatogory.OverallTumorEvaluation });
if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB)
{
list.Add(new ExportDocumentDes() { Code = StaticData.Export.OverallTumorEvaluation_Export, ExportCatogory = ExportCatogory.OverallTumorEvaluation });
list.Add(new ExportDocumentDes() { Code = StaticData.Export.RECIST1Point1EvaluationOfTumorEfficacy_Export, ExportCatogory = ExportCatogory.EvaluationOfTumorEfficacy });
list.Add(new ExportDocumentDes() { Code = StaticData.Export.RECIST1Point1DetailedOfEvaluatedLesion_Export, ExportCatogory = ExportCatogory.DetailedOfEvaluatedLesion });
}
else if (criterion.CriterionType == CriterionType.PCWG3)
{
list.Add(new ExportDocumentDes() { Code = StaticData.Export.OverallTumorEvaluation_Export, ExportCatogory = ExportCatogory.OverallTumorEvaluation });
list.Add(new ExportDocumentDes() { Code = StaticData.Export.PCWG3Point1DetailedOfEvaluatedLesion_Export, ExportCatogory = ExportCatogory.DetailedOfEvaluatedLesion });
}
else if (criterion.CriterionType == CriterionType.IRECIST1Point1)
{
list.Add(new ExportDocumentDes() { Code = StaticData.Export.OverallTumorEvaluation_Export, ExportCatogory = ExportCatogory.OverallTumorEvaluation });
list.Add(new ExportDocumentDes() { Code = StaticData.Export.IRECIST1Point1EvaluationOfTumorEfficacy_Export, ExportCatogory = ExportCatogory.DetailedOfEvaluatedLesion });
}
else if (criterion.CriterionType == CriterionType.Lugano2014)
{
list.Add(new ExportDocumentDes() { Code = StaticData.Export.OverallTumorEvaluation_Export, ExportCatogory = ExportCatogory.OverallTumorEvaluation });
list.Add(new ExportDocumentDes() { Code = StaticData.Export.Lugano2014EvaluationOfTumorEfficacy_Export, ExportCatogory = ExportCatogory.DetailedOfEvaluatedLesion });
}
var result = _commonDocumentRepository.Where(t => list.Select(c => c.Code).Contains(t.Code)).Select(c => new ExportDocumentDes() { Code = c.Code, FileName = _userInfo.IsEn_Us ? c.Name : c.NameCN }).ToList();
foreach (var item in list)
{
item.FileName = result.Where(t => t.Code == item.Code).FirstOrDefault()?.FileName;
}
return list;
}
public List<T> DealJudgeMark<T>(ArbitrationRule arbitrationRule, IEnumerable<T> list) where T : OverallTumorEvaluationExport
{
@@ -1802,7 +1764,7 @@ namespace IRaCIS.Core.Application.Service.Common
return await ExcelExportHelper.DataExportAsync(StaticData.Export.OverallTumorEvaluation_Export, exportInfo, $"{exportInfo.ResearchProgramNo}_{exportInfo.CriterionName}", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(OverallTumorEvaluationExport), criterion.CriterionType);
}
/// <summary>
@@ -2034,6 +1996,75 @@ namespace IRaCIS.Core.Application.Service.Common
#endregion
#region
/// <summary>
/// 获取阅片标准可以导出的列表
/// </summary>
/// <param name="trialReadingCriterionId"></param>
/// <returns></returns>
public async Task<List<ExportDocumentDes>> GetTrialReadingCriterionCanExportDocumentList(Guid trialReadingCriterionId)
{
var list = new List<ExportDocumentDes>();
var criterion = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == trialReadingCriterionId).Select(t => new { t.CriterionType, t.CriterionName, t.ArbitrationRule }).FirstNotNullAsync();
list.Add(new ExportDocumentDes() { Code = StaticData.Export.CommonReading_Export, ExportCatogory = ExportCatogory.CommonReading_Export });
list.Add(new ExportDocumentDes() { Code = StaticData.Export.CommonReadingDetail_Export, ExportCatogory = ExportCatogory.CommonReadingDetail_Export });
list.Add(new ExportDocumentDes() { Code = StaticData.Export.CommonJudgeReadingDetail_Export, ExportCatogory = ExportCatogory.CommonJudgeReadingDetail_Export });
switch (criterion.ArbitrationRule)
{
case ArbitrationRule.None:
break;
case ArbitrationRule.Visit:
list.Add(new ExportDocumentDes() { Code = StaticData.Export.VisitJudgeRatio_Export, ExportCatogory = ExportCatogory.VisitJudgeRatio_Export });
break;
case ArbitrationRule.Reading:
list.Add(new ExportDocumentDes() { Code = StaticData.Export.ReadingPeriodJudgeRatio_Export, ExportCatogory = ExportCatogory.ReadingPeriodJudgeRatio_Export });
break;
case ArbitrationRule.NA:
break;
default:
break;
}
//if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB)
//{
// list.Add(new ExportDocumentDes() { Code = StaticData.Export.OverallTumorEvaluation_Export, ExportCatogory = ExportCatogory.OverallTumorEvaluation });
// list.Add(new ExportDocumentDes() { Code = StaticData.Export.RECIST1Point1EvaluationOfTumorEfficacy_Export, ExportCatogory = ExportCatogory.EvaluationOfTumorEfficacy });
// list.Add(new ExportDocumentDes() { Code = StaticData.Export.RECIST1Point1DetailedOfEvaluatedLesion_Export, ExportCatogory = ExportCatogory.DetailedOfEvaluatedLesion });
//}
//else if (criterion.CriterionType == CriterionType.PCWG3)
//{
// list.Add(new ExportDocumentDes() { Code = StaticData.Export.OverallTumorEvaluation_Export, ExportCatogory = ExportCatogory.OverallTumorEvaluation });
// list.Add(new ExportDocumentDes() { Code = StaticData.Export.PCWG3Point1DetailedOfEvaluatedLesion_Export, ExportCatogory = ExportCatogory.DetailedOfEvaluatedLesion });
//}
//else if (criterion.CriterionType == CriterionType.IRECIST1Point1)
//{
// list.Add(new ExportDocumentDes() { Code = StaticData.Export.OverallTumorEvaluation_Export, ExportCatogory = ExportCatogory.OverallTumorEvaluation });
// list.Add(new ExportDocumentDes() { Code = StaticData.Export.IRECIST1Point1EvaluationOfTumorEfficacy_Export, ExportCatogory = ExportCatogory.DetailedOfEvaluatedLesion });
//}
//else if (criterion.CriterionType == CriterionType.Lugano2014)
//{
// list.Add(new ExportDocumentDes() { Code = StaticData.Export.OverallTumorEvaluation_Export, ExportCatogory = ExportCatogory.OverallTumorEvaluation });
// list.Add(new ExportDocumentDes() { Code = StaticData.Export.Lugano2014EvaluationOfTumorEfficacy_Export, ExportCatogory = ExportCatogory.DetailedOfEvaluatedLesion });
//}
var result = _commonDocumentRepository.Where(t => list.Select(c => c.Code).Contains(t.Code)).Select(c => new ExportDocumentDes() { Code = c.Code, FileName = _userInfo.IsEn_Us ? c.Name : c.NameCN }).ToList();
foreach (var item in list)
{
item.FileName = result.Where(t => t.Code == item.Code).FirstOrDefault()?.FileName;
}
return list;
}
[HttpPost]
public async Task<IActionResult> GetCommonEvaluationList_Export(VisitTaskQuery inQuery,
[FromServices] IRepository<CommonDocument> _commonDocumentRepository,
@@ -2044,7 +2075,7 @@ namespace IRaCIS.Core.Application.Service.Common
var criterion = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == inQuery.TrialReadingCriterionId).Select(t => new { t.CriterionType, t.CriterionName, t.ArbitrationRule }).FirstNotNullAsync();
var list = await _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsAnalysisCreate == false && (t.TaskState == TaskState.Effect && t.TaskState==TaskState.Freeze))
var list = await _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsAnalysisCreate == false && (t.TaskState == TaskState.Effect && t.TaskState == TaskState.Freeze))
//访视和全局查询已签名完成的,裁判可以是未签名,未完成的
.Where(t => (t.ReadingTaskState == ReadingTaskState.HaveSigned && (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global)) || (t.ReadingCategory == ReadingCategory.Judge))
@@ -2066,10 +2097,12 @@ namespace IRaCIS.Core.Application.Service.Common
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.Subject.Code.Contains(inQuery.SubjectCode))
.WhereIf(inQuery.BeginAllocateDate != null, t => t.AllocateTime > inQuery.BeginAllocateDate)
.WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime < inQuery.EndAllocateDate!.Value.AddDays(1))
.ProjectTo<CommonEvaluationExport>(_mapper.ConfigurationProvider, new { readingExportType=inQuery.ReadingExportType, criterionType = criterion.CriterionType, arbitrationRule = criterion.ArbitrationRule, trialReadingCriterionId = inQuery.TrialReadingCriterionId, isEn_Us = _userInfo.IsEn_Us }).ToListAsync();
.ProjectTo<CommonEvaluationExport>(_mapper.ConfigurationProvider, new { readingExportType = inQuery.ReadingExportType, criterionType = criterion.CriterionType, arbitrationRule = criterion.ArbitrationRule, trialReadingCriterionId = inQuery.TrialReadingCriterionId, isEn_Us = _userInfo.IsEn_Us }).ToListAsync();
list = list.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum).ToList();
var export_Template = StaticData.Export.CommonReading_Export;
if (inQuery.ReadingExportType == ReadingExportType.JudgeReadingDetailResult)
{
//R1 R2 两个人的访视都阅片完成了才可以,去除只有一个人阅片完成的访视
@@ -2077,6 +2110,12 @@ namespace IRaCIS.Core.Application.Service.Common
//找到只有一个人阅片的受试者 和访视
var exceptVisit = list.GroupBy(t => new { t.SubjectCode, t.TaskName }).Where(g => g.Count() == 1).Select(g => new { g.Key.SubjectCode, g.Key.TaskName }).ToList();
list = list.Where(t => !exceptVisit.Any(ev => ev.SubjectCode == t.SubjectCode && ev.TaskName == t.TaskName)).ToList();
export_Template = StaticData.Export.CommonJudgeReadingDetail_Export;
}
if (inQuery.ReadingExportType == ReadingExportType.ReadingDetailResult)
{
export_Template = StaticData.Export.CommonReadingDetail_Export;
}
var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo<ExcelExportInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
@@ -2088,17 +2127,20 @@ namespace IRaCIS.Core.Application.Service.Common
exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list.Where(t => t.ReadingCategory != ReadingCategory.Global).ToList(), _userInfo.TimeZoneId);
exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId);
var dynamicColumnConfig = new DynamicColumnConfig() { AutoColumnTitleRowIndex = 2, AutoColumnStartIndex = 6,
var dynamicColumnConfig = new DynamicColumnConfig()
{
AutoColumnTitleRowIndex = 2,
AutoColumnStartIndex = 6,
TempalteLastColumnIndex = 8,
DynamicItemDicName = "TranslateDicName",
DynamicItemValueName = "QuestionValue",
DynamicListName = "QuestionAnswerList",
RemoveColunmIndexList = new List<int>() { 1, 7 },
RemoveColunmIndexList = new List<int>() { },
ColumnNameList = list.FirstOrDefault()?.QuestionAnswerList.Select(t => t.QuestionName).ToList() ?? new List<string>(),
TranslateDicNameList = list.FirstOrDefault()?.QuestionAnswerList.Select(t => t.TranslateDicName).ToList() ?? new List<string>()
};
var (memoryStream, fileName) = await ExcelExportHelper.DataExport_NpoiTestAsync(StaticData.Export.CommonReading_Export, exportInfo, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(CommonEvaluationExport), criterion.CriterionType, dynamicColumnConfig);
var (memoryStream, fileName) = await ExcelExportHelper.DataExport_NpoiTestAsync(export_Template, exportInfo, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(CommonEvaluationExport), criterion.CriterionType, dynamicColumnConfig);
return new FileStreamResult(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
@@ -2184,7 +2226,7 @@ namespace IRaCIS.Core.Application.Service.Common
//每次查询必须是单标准的
var criterion = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == inQuery.TrialReadingCriterionId).Select(t => new { t.CriterionType, t.CriterionName, t.ArbitrationRule }).FirstNotNullAsync();
var trialReadingCriterionId = inQuery.TrialReadingCriterionId;
Expression<Func<VisitTask, bool>> comonTaskFilter = u => u.TrialId == inQuery.TrialId && u.IsAnalysisCreate == false && u.TaskState == TaskState.Effect && u.TrialReadingCriterionId == trialReadingCriterionId;
@@ -2219,13 +2261,13 @@ namespace IRaCIS.Core.Application.Service.Common
FullName = g.Key.FullName,
//访视产生裁判的访视数量
TotalJudgeCount = g.Where(t => t.JudgeVisitTaskId != null && t.JudgeVisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).Count(),
TotalJudgeCount = g.Where(t => t.JudgeVisitTaskId != null && t.JudgeVisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).Count(),
JudgeAgreeCount = g.Where(t => t.JudgeVisitTaskId != null && t.JudgeVisitTask.JudgeResultTaskId == t.Id).Count(),
});
exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(doctorList, _userInfo.TimeZoneId);
return await ExcelExportHelper.DataExportAsync(StaticData.Export.VisitJudgeRatio_Export, exportInfo, $"{exportInfo.ResearchProgramNo}_{exportInfo.CriterionName}", _commonDocumentRepository, _hostEnvironment);
-6
View File
@@ -33,12 +33,6 @@ using System.Text;
namespace IRaCIS.Core.Application.Service
{
[ApiExplorerSettings(GroupName = "Institution")]
public class TestService(IRepository<Dictionary> _dicRepository,
IRepository<Trial> _trialRepository,