稽查修改

IRC_NewDev
he 2024-04-12 16:03:30 +08:00
parent 2be9daa443
commit 2a51de03b7
4 changed files with 140 additions and 116 deletions

View File

@ -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)
{

View File

@ -51,10 +51,12 @@ namespace IRaCIS.Core.Domain.Share
Guid? BatchId { get; set; }
bool IsNotNeedInspection { get; set; }
/// <summary>
/// 字符串形式 标识时区
/// </summary>
string TimeZoneId { get; }
/// <summary>
/// 字符串形式 标识时区
/// </summary>
string TimeZoneId { get; }
}
}

View File

@ -298,7 +298,12 @@ namespace IRaCIS.Core.Domain.Share
get; set;
}
}
/// <summary>
/// 是否不需要记录稽查
/// </summary>
public bool IsNotNeedInspection { get; set; } = false;
}
public static class ClaimAttributes
{

View File

@ -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<UnitData> 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<ReadingTaskQuestionAnswer>(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<UnitData> 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<ReadingTaskQuestionAnswer>(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
}
);
}
}
}