diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/General/ReadingCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/General/ReadingCalculateService.cs index 348d0815e..d8b7d3d82 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/General/ReadingCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/General/ReadingCalculateService.cs @@ -95,6 +95,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate public async Task CalculateTask(CalculateTaskInDto inDto) { + _userInfo.IsNotNeedInspection = true; var service = await this.GetService(inDto.VisitTaskId); if (service != null) { diff --git a/IRaCIS.Core.Infra.EFCore/AuthUser/IUserInfo.cs b/IRaCIS.Core.Infra.EFCore/AuthUser/IUserInfo.cs index eb4448cec..b2970b619 100644 --- a/IRaCIS.Core.Infra.EFCore/AuthUser/IUserInfo.cs +++ b/IRaCIS.Core.Infra.EFCore/AuthUser/IUserInfo.cs @@ -51,10 +51,12 @@ namespace IRaCIS.Core.Domain.Share Guid? BatchId { get; set; } + bool IsNotNeedInspection { get; set; } - /// - /// 字符串形式 标识时区 - /// - string TimeZoneId { get; } + + /// + /// 字符串形式 标识时区 + /// + string TimeZoneId { get; } } } diff --git a/IRaCIS.Core.Infra.EFCore/AuthUser/UserInfo.cs b/IRaCIS.Core.Infra.EFCore/AuthUser/UserInfo.cs index 61521c667..d101ec1b7 100644 --- a/IRaCIS.Core.Infra.EFCore/AuthUser/UserInfo.cs +++ b/IRaCIS.Core.Infra.EFCore/AuthUser/UserInfo.cs @@ -298,7 +298,12 @@ namespace IRaCIS.Core.Domain.Share get; set; } - } + + /// + /// 是否不需要记录稽查 + /// + public bool IsNotNeedInspection { get; set; } = false; + } public static class ClaimAttributes { diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 0ad3d6c38..5b6274db0 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -2697,120 +2697,136 @@ namespace IRaCIS.Core.Infra.EFCore.Common //保存影像质量 多条记录,只记录一条稽查 if (entitys.Any(x => x.Entity.GetType() == typeof(ReadingTaskQuestionAnswer))) { - // 保存影像质量 、 修改整体肿瘤评估结果 、 非dicom 保存访视阅片结果 、附加评估 - if (_userInfo.RequestUrl == "ReadingImageTask/changeDicomReadingQuestionAnswer" - || _userInfo.RequestUrl == "ReadingImageTask/saveImageQuality" - || _userInfo.RequestUrl.Contains("SaveTaskQuestion") - || _userInfo.RequestUrl == "ReadingImageTask/saveVisitTaskQuestions" - || _userInfo.RequestUrl == "ReadingImageTask/changeCalculationAnswer" - || _userInfo.RequestUrl == "ReadingImageTask/submitTaskAdditionalQuestion") + //判断是否不需要记录稽查 + if (_userInfo.IsNotNeedInspection) { - var type = AuditOpt.Add; - - List unitDataList = (await _dbContext.Dictionary.Where(x => x.Parent.Code == "ValueUnit").Where(x => x.Code != "0").ToListAsync()).Select(x => new UnitData() - { - - Unit = (ValueUnit)int.Parse(x.Code), - UnitName = x.Value.ToString(), - }).ToList(); - var extraIdentification = string.Empty; - - //具体的答案 - var taskQuestionAnswerList = entitys.Where(x => x.Entity.GetType() == typeof(ReadingTaskQuestionAnswer)).Select(t => t.Entity as ReadingTaskQuestionAnswer).ToList(); - - //获取问题名称 组合成数组 - var quesionList = await _dbContext.ReadingQuestionTrial.Where(t => taskQuestionAnswerList.Select(k => k.ReadingQuestionTrialId).Contains(t.Id)).IgnoreQueryFilters().Select(t => new - { - t.QuestionName, - t.QuestionEnName, - QuestionId = t.Id, - t.DictionaryCode, - t.Unit, - t.ShowOrder, - AnswerType = t.Type, - }).OrderBy(t => t.ShowOrder).ToListAsync(); - - - var firstEntity = taskQuestionAnswerList.First(); - - var cloneEntity = firstEntity.Clone(); - - - - //保证Id 唯一 - cloneEntity.Id = IdentifierHelper.CreateGuid(firstEntity.ReadingQuestionCriterionTrialId.ToString(), firstEntity.ReadingQuestionTrialId.ToString(), firstEntity.VisitTaskId.ToString()); - - - dynamic tableQuesionAndAnswerList = null; - //自定义特有标识 - if (await _dbContext.ReadingQuestionCriterionTrial.AnyAsync(t => t.Id == firstEntity.ReadingQuestionCriterionTrialId && t.CriterionType == CriterionType.SelfDefine)) - { - extraIdentification = "/Self"; - - //还会把病灶问题答案更新 - - var tableQuestionAnswerList = entitys.Where(x => x.Entity.GetType() == typeof(ReadingTableQuestionAnswer)).Select(t => t.Entity as ReadingTableQuestionAnswer).ToList(); - - - //获取表格问题名称 组合成数组 - var tableQuesionList = await _dbContext.ReadingTableQuestionTrial.Where(t => tableQuestionAnswerList.Select(k => k.TableQuestionId).Contains(t.Id)).Select(t => - new - { - TrialReadingCriterionId = t.ReadingQuestionTrial.ReadingQuestionCriterionTrialId, //标准Id - Type = t.ReadingQuestionTrial.QuestionName, //病灶类型 - t.ReadingQuestionTrial.Unit, - t.ReadingQuestionTrial.CustomUnit, - t.DictionaryCode, - t.QuestionName, - t.QuestionEnName, - QuestionId = t.Id, - t.ShowOrder, - AnswerType = t.Type, - }) - .OrderBy(t => t.ShowOrder).ToListAsync(); - - tableQuesionAndAnswerList = tableQuestionAnswerList.Join(tableQuesionList, t => t.TableQuestionId, u => u.QuestionId, (t, u) => - new - { - //如果问题类型是附件 特殊处理 方便前端解析 - Answer = u.AnswerType == "upload" ? "❄❅❆❇❈❉❊" + t.Answer : t.Answer, - u.QuestionName, - u.QuestionEnName, - u.DictionaryCode, - u.ShowOrder, - t.RowId - } - ).OrderBy(t => t.RowId).ThenBy(t => t.ShowOrder).ToList(); - - - - } - - await InsertInspection(cloneEntity, type, x => new InspectionConvertDTO() - { - VisitTaskId = x.VisitTaskId, - - ObjectRelationParentId = x.VisitTaskId, - - TrialReadingCriterionId = x.ReadingQuestionCriterionTrialId, - - ExtraIndentification = extraIdentification, - - }, new - { - QuestionAnswerList = taskQuestionAnswerList.Join(quesionList, - t => t.ReadingQuestionTrialId, - u => u.QuestionId, - (t, u) => - new { Answer = u.AnswerType == "upload" ? "❄❅❆❇❈❉❊" + t.Answer : t.Answer + unitDataList.Where(y => y.Unit == u.Unit).Select(x => x.UnitName).FirstIsNullReturnEmpty() - , u.DictionaryCode, u.QuestionName, u.QuestionEnName, u.ShowOrder }).OrderBy(t => t.ShowOrder).ToList() - , - TableQuestionAndAnswerList = tableQuesionAndAnswerList - } - ); - + _userInfo.IsNotNeedInspection = false; } + else + { + // 保存影像质量 、 修改整体肿瘤评估结果 、 非dicom 保存访视阅片结果 、附加评估 + if (_userInfo.RequestUrl == "ReadingImageTask/changeDicomReadingQuestionAnswer" + || _userInfo.RequestUrl == "ReadingImageTask/saveImageQuality" + || _userInfo.RequestUrl.Contains("SaveTaskQuestion") + || _userInfo.RequestUrl == "ReadingImageTask/saveVisitTaskQuestions" + || _userInfo.RequestUrl == "ReadingImageTask/changeCalculationAnswer" + || _userInfo.RequestUrl == "ReadingImageTask/submitTaskAdditionalQuestion") + { + var type = AuditOpt.Add; + + List unitDataList = (await _dbContext.Dictionary.Where(x => x.Parent.Code == "ValueUnit").Where(x => x.Code != "0").ToListAsync()).Select(x => new UnitData() + { + + Unit = (ValueUnit)int.Parse(x.Code), + UnitName = x.Value.ToString(), + }).ToList(); + var extraIdentification = string.Empty; + + //具体的答案 + var taskQuestionAnswerList = entitys.Where(x => x.Entity.GetType() == typeof(ReadingTaskQuestionAnswer)).Select(t => t.Entity as ReadingTaskQuestionAnswer).ToList(); + + //获取问题名称 组合成数组 + var quesionList = await _dbContext.ReadingQuestionTrial.Where(t => taskQuestionAnswerList.Select(k => k.ReadingQuestionTrialId).Contains(t.Id)).IgnoreQueryFilters().Select(t => new + { + t.QuestionName, + t.QuestionEnName, + QuestionId = t.Id, + t.DictionaryCode, + t.Unit, + t.ShowOrder, + AnswerType = t.Type, + }).OrderBy(t => t.ShowOrder).ToListAsync(); + + + var firstEntity = taskQuestionAnswerList.First(); + + var cloneEntity = firstEntity.Clone(); + + + + //保证Id 唯一 + cloneEntity.Id = IdentifierHelper.CreateGuid(firstEntity.ReadingQuestionCriterionTrialId.ToString(), firstEntity.ReadingQuestionTrialId.ToString(), firstEntity.VisitTaskId.ToString()); + + + dynamic tableQuesionAndAnswerList = null; + //自定义特有标识 + if (await _dbContext.ReadingQuestionCriterionTrial.AnyAsync(t => t.Id == firstEntity.ReadingQuestionCriterionTrialId && t.CriterionType == CriterionType.SelfDefine)) + { + extraIdentification = "/Self"; + + //还会把病灶问题答案更新 + + var tableQuestionAnswerList = entitys.Where(x => x.Entity.GetType() == typeof(ReadingTableQuestionAnswer)).Select(t => t.Entity as ReadingTableQuestionAnswer).ToList(); + + + //获取表格问题名称 组合成数组 + var tableQuesionList = await _dbContext.ReadingTableQuestionTrial.Where(t => tableQuestionAnswerList.Select(k => k.TableQuestionId).Contains(t.Id)).Select(t => + new + { + TrialReadingCriterionId = t.ReadingQuestionTrial.ReadingQuestionCriterionTrialId, //标准Id + Type = t.ReadingQuestionTrial.QuestionName, //病灶类型 + t.ReadingQuestionTrial.Unit, + t.ReadingQuestionTrial.CustomUnit, + t.DictionaryCode, + t.QuestionName, + t.QuestionEnName, + QuestionId = t.Id, + t.ShowOrder, + AnswerType = t.Type, + }) + .OrderBy(t => t.ShowOrder).ToListAsync(); + + tableQuesionAndAnswerList = tableQuestionAnswerList.Join(tableQuesionList, t => t.TableQuestionId, u => u.QuestionId, (t, u) => + new + { + //如果问题类型是附件 特殊处理 方便前端解析 + Answer = u.AnswerType == "upload" ? "❄❅❆❇❈❉❊" + t.Answer : t.Answer, + u.QuestionName, + u.QuestionEnName, + u.DictionaryCode, + u.ShowOrder, + t.RowId + } + ).OrderBy(t => t.RowId).ThenBy(t => t.ShowOrder).ToList(); + + + + } + + await InsertInspection(cloneEntity, type, x => new InspectionConvertDTO() + { + VisitTaskId = x.VisitTaskId, + + ObjectRelationParentId = x.VisitTaskId, + + TrialReadingCriterionId = x.ReadingQuestionCriterionTrialId, + + ExtraIndentification = extraIdentification, + + }, new + { + QuestionAnswerList = taskQuestionAnswerList.Join(quesionList, + t => t.ReadingQuestionTrialId, + u => u.QuestionId, + (t, u) => + new { + Answer = u.AnswerType == "upload" ? "❄❅❆❇❈❉❊" + t.Answer : t.Answer + unitDataList.Where(y => y.Unit == u.Unit).Select(x => x.UnitName).FirstIsNullReturnEmpty() + , + u.DictionaryCode, + u.QuestionName, + u.QuestionEnName, + u.ShowOrder + }).OrderBy(t => t.ShowOrder).ToList() + , + TableQuestionAndAnswerList = tableQuesionAndAnswerList + } + ); + + + } + } + }