Merge branch 'IRC_NewDev' into Test_IRC_Net8
continuous-integration/drone/push Build is passing

This commit is contained in:
he
2024-12-26 11:12:00 +08:00
15 changed files with 36997 additions and 11 deletions
@@ -394,6 +394,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public class TableRowInfo
{
public Guid RowId { get; set; }
public decimal RowIndex { get; set; }
public decimal FristAddTaskNum { get; set; }
@@ -446,6 +446,65 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
}
/// <summary>
/// 保存表格问题标记
/// </summary>
public class SaveTableQuestionMarkInDto
{
public string Answer { get; set; }
public Guid VisitTaskId { get; set; }
public Guid QuestionId { get; set; }
public Guid? InstanceId { get; set; }
public Guid? SeriesId { get; set; }
public Guid? StudyId { get; set; }
public string MarkTool { get; set; } = string.Empty;
public string PicturePath { get; set; } = string.Empty;
public int? NumberOfFrames { get; set; }
public string MeasureData { get; set; } = string.Empty;
public Guid? FirstAddTaskId { get; set; }
public QuestionType? QuestionType { get; set; }
public string OrderMarkName { get; set; } = string.Empty;
public Guid? OtherInstanceId { get; set; }
public Guid? OtherSeriesId { get; set; }
public Guid? OtherStudyId { get; set; }
public Guid? RowId { get; set; }
[NotDefault]
public Guid TableQuestionId { get; set; }
[NotDefault]
public decimal RowIndex { get; set; }
public string OtherMarkTool { get; set; } = string.Empty;
public string OtherPicturePath { get; set; } = string.Empty;
public int? OtherNumberOfFrames { get; set; }
public string OtherMeasureData { get; set; } = string.Empty;
}
public class TableQuestionMark: SaveTableQuestionMarkInDto
{
public new Guid? TableQuestionId { get; set; }
public new decimal? RowIndex { get; set; }
}
public class GetPreviousOtherPicturePathInDto
{
@@ -991,6 +1050,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
{
public Guid Id { get; set; }
public Guid? TableQuestionId { get; set; }
/// <summary>
/// 序号标记
/// </summary>
@@ -15,6 +15,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using NPOI.POIFS.Properties;
using NPOI.SS.Formula.Functions;
using Panda.DynamicWebApi.Attributes;
@@ -83,6 +84,48 @@ namespace IRaCIS.Core.Application.Service
}
#endregion
/// <summary>
/// 保存表格问题标记
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<SaveTableQuestionMarkInDto> SaveTableQuestionMark(SaveTableQuestionMarkInDto inDto)
{
inDto.FirstAddTaskId = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.TableQuestionId == inDto.TableQuestionId && x.RowId == inDto.RowId).Select(x => x.FirstAddTaskId).FirstOrDefaultAsync();
inDto.FirstAddTaskId=inDto.FirstAddTaskId==null?inDto.VisitTaskId:inDto.FirstAddTaskId;
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x =>x.VisitTaskId==inDto.VisitTaskId&&x.QuestionId==inDto.QuestionId&& x.RowId == inDto.RowId.Value && x.TableQuestionId == inDto.TableQuestionId);
await _readingTableQuestionAnswerRepository.AddAsync(new ReadingTableQuestionAnswer()
{
Answer = inDto.Answer,
QuestionId = inDto.QuestionId,
TableQuestionId = inDto.TableQuestionId,
VisitTaskId = inDto.VisitTaskId,
TrialId = visitTaskInfo.TrialId,
RowIndex = inDto.RowIndex,
RowId = inDto.RowId.Value,
});
await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x=>x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId && x.RowId == inDto.RowId.Value && x.TableQuestionId == inDto.TableQuestionId);
var readingTaskQuestionMark = _mapper.Map<ReadingTaskQuestionMark>(inDto);
await _readingTaskQuestionMarkRepository.AddAsync(readingTaskQuestionMark);
await _readingTaskQuestionMarkRepository.SaveChangesAsync();
await _readingCalculateService.CalculateTask(new CalculateTaskInDto()
{
IsChangeOtherTask = false,
VisitTaskId = inDto.VisitTaskId,
ComputationTrigger = ComputationTrigger.SaveTableQuestionMark,
});
return inDto;
}
/// <summary>
/// 获取既往病灶的OtherPicture
/// </summary>
@@ -934,7 +977,12 @@ namespace IRaCIS.Core.Application.Service
.ToListAsync();
//var tableQuestionMarkList = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
//result.ForEach(x =>
//{
// x.TableQuestionMarkList = tableQuestionMarkList.Where(y => y.RowId == x.RowId).ToList();
//});
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).ProjectTo<VisitTaskDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
@@ -963,6 +1011,7 @@ namespace IRaCIS.Core.Application.Service
x.IsFirstChangeTask = x.VisitTaskId == inDto.VisitTaskId;
});
result.AddRange(questionMark);
result= result.OrderBy(x=>x.RowIndex).ThenBy(x => x.OrderMarkName).ToList();
return result;
}
@@ -1085,6 +1134,7 @@ namespace IRaCIS.Core.Application.Service
{
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).FirstNotNullAsync();
var tableQuestionMarkList = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.TaskId).ProjectTo<TableQuestionMark>(_mapper.ConfigurationProvider).ToListAsync();
var qusetionList = await _readingQuestionTrialRepository
.Where(x => x.IsShowInDicom)
.WhereIf(inDto.QuestionClassify != null, x => x.QuestionClassify == inDto.QuestionClassify)
@@ -1260,7 +1310,7 @@ namespace IRaCIS.Core.Application.Service
var pageGroupList = newPageQusetionList.Where(x => x.Type == ReadingQestionType.Group).ToList();
pageGroupList.ForEach(x =>
{
FindChildQuestion(x, newPageQusetionList, tableQuestionList, inDto.TableAnswers, inDto.TableAnsweRowInfos, inDto.OrganInfos, baseLineTableAnswer, isFirstChangeTask, lastTaskTableAnswer, inDto.TaskId);
FindChildQuestion(x, newPageQusetionList, tableQuestionList, inDto.TableAnswers, inDto.TableAnsweRowInfos, inDto.OrganInfos, baseLineTableAnswer, isFirstChangeTask, lastTaskTableAnswer, tableQuestionMarkList, inDto.TaskId);
});
page.Childrens = pageGroupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count == 0)).ToList();
@@ -1277,7 +1327,7 @@ namespace IRaCIS.Core.Application.Service
groupList = qusetionList.Where(x => x.Type == ReadingQestionType.Group).ToList();
groupList.ForEach(x =>
{
FindChildQuestion(x, qusetionList, tableQuestionList, inDto.TableAnswers, inDto.TableAnsweRowInfos, inDto.OrganInfos, baseLineTableAnswer, isFirstChangeTask, lastTaskTableAnswer, inDto.TaskId);
FindChildQuestion(x, qusetionList, tableQuestionList, inDto.TableAnswers, inDto.TableAnsweRowInfos, inDto.OrganInfos, baseLineTableAnswer, isFirstChangeTask, lastTaskTableAnswer, tableQuestionMarkList, inDto.TaskId);
});
groupList = groupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count == 0)).ToList();
@@ -1304,7 +1354,7 @@ namespace IRaCIS.Core.Application.Service
/// <param name="isFirstChangeTask"></param>
/// <param name="lastTaskTableAnswer"></param>
/// <param name="TaskId"></param>
private async void FindChildQuestion(TrialReadQuestionData item, List<TrialReadQuestionData> questionlists, List<TableQuestionTrial> tableQuestionLists, List<ReadingTableQuestionAnswerInfo> tableAnswers, List<TableAnsweRowInfo> tableAnsweRowInfos, List<OrganInfo> organInfos, List<ReadingTableQuestionAnswer> baseLineTableAnswer, bool isFirstChangeTask, List<ReadingTableQuestionAnswer> lastTaskTableAnswer, Guid? TaskId)
private async void FindChildQuestion(TrialReadQuestionData item, List<TrialReadQuestionData> questionlists, List<TableQuestionTrial> tableQuestionLists, List<ReadingTableQuestionAnswerInfo> tableAnswers, List<TableAnsweRowInfo> tableAnsweRowInfos, List<OrganInfo> organInfos, List<ReadingTableQuestionAnswer> baseLineTableAnswer, bool isFirstChangeTask, List<ReadingTableQuestionAnswer> lastTaskTableAnswer, List<TableQuestionMark> TableQuestionMarkList, Guid? TaskId)
{
item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (x.GroupId == item.Id && x.ParentId == null)).ToList();
item.TableQuestions = new TrialReadTableQuestion();
@@ -1428,6 +1478,12 @@ namespace IRaCIS.Core.Application.Service
answers.Add("OtherNumberOfFrames", rowInfo == null || rowInfo.OtherNumberOfFrames == null ? string.Empty : rowInfo.OtherNumberOfFrames.ToString());
answers.Add("OtherMarkTool", rowInfo == null || rowInfo.OtherMarkTool == null ? string.Empty : rowInfo.OtherMarkTool.ToString());
answers.Add("RowIndex", x.ToString());
JsonSerializerSettings settings = new JsonSerializerSettings
{
FloatParseHandling = FloatParseHandling.Double,
};
answers.Add("TableQuestionMarkList", rowInfo == null ? "[]" : JsonConvert.SerializeObject(TableQuestionMarkList.Where(x=>x.RowId== rowInfo.Id).ToList(), settings));
answers.Add("RowId", rowInfo == null ? string.Empty : rowInfo.Id.ToString());
answers.Add("MarkTool", rowInfo.MarkTool);
answers.Add("StudyId", rowInfo.StudyId.ToString());
@@ -1459,7 +1515,7 @@ namespace IRaCIS.Core.Application.Service
{
item.Childrens.ForEach(x =>
{
FindChildQuestion(x, questionlists, tableQuestionLists, tableAnswers, tableAnsweRowInfos, organInfos, baseLineTableAnswer, isFirstChangeTask, lastTaskTableAnswer, TaskId);
FindChildQuestion(x, questionlists, tableQuestionLists, tableAnswers, tableAnsweRowInfos, organInfos, baseLineTableAnswer, isFirstChangeTask, lastTaskTableAnswer, TableQuestionMarkList, TaskId);
});
}
}
@@ -64,8 +64,11 @@ namespace IRaCIS.Core.Application.Service
CreateMap<SystemClinicalTableQuestion, ClinicalTablePreviewDto>();
CreateMap<TrialClinicalTableQuestion, ClinicalTablePreviewDto>();
#endregion
CreateMap<TableMarkInfo, ReadingTaskQuestionMark>();
CreateMap<ReadingTaskQuestionMark, TableMarkInfo>();
CreateMap<VisitTask, VisitTaskDto>();
CreateMap<SaveTableQuestionMarkInDto, ReadingTaskQuestionMark>();
CreateMap<ReadingTaskQuestionMark, TableQuestionMark>();
CreateMap<SubmitTableQuestionInDto, ReadingTableAnswerRowInfo>()
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
.ForAllMembers(opts => opts.Condition((src, dest, srcMember) => srcMember != null));