Merge branch 'IRC_NewDev' into Test_IRC_Net8
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
5f9572a0ab
|
@ -4245,6 +4245,12 @@
|
|||
<param name="calculateType"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.MRIPDFFCalculateService.CalculateAvg(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
|
||||
<summary>
|
||||
计算平均值
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.OCTCalculateService.GetReadingCalculationData(IRaCIS.Core.Application.Service.Reading.Dto.GetReadingCalculationDataInDto)">
|
||||
<summary>
|
||||
获取阅片的计算数据
|
||||
|
@ -7584,6 +7590,11 @@
|
|||
任务Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Core.Application.Service.Reading.Dto.SaveTableQuestionMarkInDto">
|
||||
<summary>
|
||||
保存表格问题标记
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetPreviousOtherPicturePathInDto.QuestionType">
|
||||
<summary>
|
||||
问题类型
|
||||
|
@ -12015,6 +12026,13 @@
|
|||
<param name="inDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.ReadingImageTaskService.SaveTableQuestionMark(IRaCIS.Core.Application.Service.Reading.Dto.SaveTableQuestionMarkInDto)">
|
||||
<summary>
|
||||
保存表格问题标记
|
||||
</summary>
|
||||
<param name="inDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.ReadingImageTaskService.GetPreviousOtherPicturePath(IRaCIS.Core.Application.Service.Reading.Dto.GetPreviousOtherPicturePathInDto)">
|
||||
<summary>
|
||||
获取既往病灶的OtherPicture
|
||||
|
@ -12188,7 +12206,7 @@
|
|||
<param name="inDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.ReadingImageTaskService.FindChildQuestion(IRaCIS.Core.Application.Service.Reading.Dto.TrialReadQuestionData,System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TrialReadQuestionData},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TableQuestionTrial},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.ReadingTableQuestionAnswerInfo},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TableAnsweRowInfo},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.OrganInfo},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableQuestionAnswer},System.Boolean,System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableQuestionAnswer},System.Nullable{System.Guid})">
|
||||
<member name="M:IRaCIS.Core.Application.Service.ReadingImageTaskService.FindChildQuestion(IRaCIS.Core.Application.Service.Reading.Dto.TrialReadQuestionData,System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TrialReadQuestionData},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TableQuestionTrial},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.ReadingTableQuestionAnswerInfo},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TableAnsweRowInfo},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.OrganInfo},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableQuestionAnswer},System.Boolean,System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableQuestionAnswer},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TableQuestionMark},System.Nullable{System.Guid})">
|
||||
<summary>
|
||||
获取子元素
|
||||
</summary>
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -106,6 +106,30 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
}
|
||||
|
||||
public class TableMarkInfo
|
||||
{
|
||||
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public Guid QuestionId { get; set; }
|
||||
|
||||
public Guid? FirstAddTaskId { get; set; }
|
||||
|
||||
public QuestionType? QuestionType { get; set; }
|
||||
public string OrderMarkName { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 表格问题标记
|
||||
/// </summary>
|
||||
public Guid? RowId { get; set; }
|
||||
|
||||
public Guid? TableQuestionId { get; set; }
|
||||
|
||||
public decimal? RowIndex { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class AddTaskLesionAnswerFromLastTaskOutDto
|
||||
{
|
||||
public bool IsBaseLine { get; set; }
|
||||
|
|
|
@ -224,6 +224,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
item.TableRowInfoList = thisItemRowInfo.Select(x => new TableRowInfo()
|
||||
{
|
||||
RowId = x.Id,
|
||||
RowIndex = x.RowIndex,
|
||||
MeasureData = x.MeasureData,
|
||||
OtherMeasureData = x.OtherMeasureData,
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using DocumentFormat.OpenXml.EMMA;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Linq;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
|
@ -18,6 +20,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||
IRepository<OrganInfo> _organInfoRepository,
|
||||
IRepository<Dictionary> _dictionaryRepository,
|
||||
IRepository<ReadingTaskQuestionMark> _readingTaskQuestionMarkRepository,
|
||||
IRepository<DicomStudy> _dicomStudyRepository,
|
||||
IRepository<NoneDicomStudy> _noneDicomStudyRepository,
|
||||
IRepository<TumorAssessment_RECIST1Point1> _tumorAssessmentRepository,
|
||||
|
@ -366,8 +369,23 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
var tableQuestion = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.LesionType == LesionType.FatFraction).FirstNotNullAsync();
|
||||
|
||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == tableQuestion.Id).ToListAsync();
|
||||
var LastVisitTaskId = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit &&
|
||||
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
|
||||
x.IsAnalysisCreate == taskinfo.IsAnalysisCreate &&
|
||||
x.DoctorUserId == taskinfo.DoctorUserId &&
|
||||
x.IsSelfAnalysis == taskinfo.IsSelfAnalysis &&
|
||||
x.SubjectId == taskinfo.SubjectId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.VisitTaskNum < taskinfo.VisitTaskNum && x.TaskState == TaskState.Effect && x.ArmEnum == taskinfo.ArmEnum
|
||||
).OrderByDescending(x => x.VisitTaskNum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
List<TableMarkInfo> marks = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == LastVisitTaskId && x.RowId != null).ProjectTo<TableMarkInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
|
||||
marks.ForEach(x => {
|
||||
|
||||
x.VisitTaskId = visitTaskId;
|
||||
});
|
||||
|
||||
List<ReadingTableAnswerRowInfo> rowlist = new List<ReadingTableAnswerRowInfo>();
|
||||
List<ReadingTableQuestionAnswer> tableAnswerList = new List<ReadingTableQuestionAnswer>();
|
||||
|
||||
|
@ -375,6 +393,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
foreach (var item in dictionList)
|
||||
{
|
||||
var guid = NewId.NextGuid();
|
||||
marks.ForEach(x => {
|
||||
x.RowId = x.RowIndex == num ? guid : x.RowId;
|
||||
});
|
||||
rowlist.Add(new ReadingTableAnswerRowInfo()
|
||||
{
|
||||
FristAddTaskId= visitTaskId,
|
||||
|
@ -415,10 +436,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
}
|
||||
|
||||
|
||||
num = num++;
|
||||
num++;
|
||||
}
|
||||
await _readingTableAnswerRowInfoRepository.AddRangeAsync(rowlist);
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswerList);
|
||||
|
||||
await _readingTaskQuestionMarkRepository.AddRangeAsync(_mapper.Map<List<ReadingTaskQuestionMark>>(marks));
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
|
||||
return new AddTaskLesionAnswerFromLastTaskOutDto()
|
||||
|
@ -455,6 +478,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 自动计算
|
||||
/// </summary>
|
||||
|
@ -463,18 +488,166 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
/// <returns></returns>
|
||||
public async Task ReadingCalculate(ReadingCalculateDto inDto, List<QuestionType>? calculateType = null)
|
||||
{
|
||||
//var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == inDto.CriterionId && x.CustomCalculateMark != null).ToListAsync();
|
||||
//var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == inDto.CriterionId && x.CustomCalculateMark != null).ToListAsync();
|
||||
|
||||
await this.CalculateAvg(inDto);
|
||||
inDto = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
|
||||
var needAddList = new List<ReadingTaskQuestionAnswer>();
|
||||
List<ReadingCalculateData> calculateList = new List<ReadingCalculateData>()
|
||||
{
|
||||
// 脂肪平均
|
||||
new ReadingCalculateData (){QuestionType=QuestionType.TotalMeanFraction,GetDecimalFun=GetFatFractionAvg},
|
||||
};
|
||||
|
||||
|
||||
if (calculateType != null)
|
||||
{
|
||||
calculateList = calculateList.Where(x => calculateType.Contains(x.QuestionType)).ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach (var calculate in calculateList)
|
||||
{
|
||||
var item = inDto.QuestionInfo.FirstOrDefault(x => x.QuestionType == calculate.QuestionType);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
//计算答案
|
||||
|
||||
|
||||
#region 计算答案
|
||||
if (calculate.GetDecimalFun != null)
|
||||
{
|
||||
item.Answer = (await calculate.GetDecimalFun(inDto)).ToString();
|
||||
|
||||
}
|
||||
else if (calculate.GetDecimalNullFun != null)
|
||||
{
|
||||
var value = await calculate.GetDecimalNullFun(inDto);
|
||||
item.Answer = value == null ? "NA" : value.Value.ToString();
|
||||
}
|
||||
else if (calculate.GetStringFun != null)
|
||||
{
|
||||
item.Answer = await calculate.GetStringFun(inDto);
|
||||
}
|
||||
#endregion
|
||||
// 修改修约小数位数
|
||||
|
||||
List<ValueOfType?> valueOfTypes = new List<ValueOfType?>() {
|
||||
|
||||
ValueOfType.Decimals,
|
||||
ValueOfType.Percentage
|
||||
};
|
||||
|
||||
if (inDto.DigitPlaces != -1)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if (valueOfTypes.Contains(item.ValueType))
|
||||
{
|
||||
item.Answer = decimal.Round(decimal.Parse(item.Answer ?? "0"), inDto.DigitPlaces, MidpointRounding.AwayFromZero).ToString("F" + inDto.DigitPlaces.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
||||
{
|
||||
Answer = item.Answer,
|
||||
ReadingQuestionTrialId = item.QuestionId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
var questionIds = needAddList.Select(x => x.ReadingQuestionTrialId).ToList();
|
||||
|
||||
await _readingTaskQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => questionIds.Contains(x.ReadingQuestionTrialId) && x.VisitTaskId == inDto.VisitTaskId);
|
||||
needAddList.ForEach(x =>
|
||||
{
|
||||
x.SubjectId = inDto.SubjectId;
|
||||
x.ReadingQuestionCriterionTrialId = inDto.CriterionId;
|
||||
x.VisitTaskId = inDto.VisitTaskId;
|
||||
x.TrialId = inDto.TrialId;
|
||||
x.SubjectId = inDto.SubjectId;
|
||||
});
|
||||
|
||||
await _readingTaskQuestionAnswerRepository.AddRangeAsync(needAddList);
|
||||
|
||||
await _readingTaskQuestionAnswerRepository.SaveChangesAsync();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取脂肪分数平均值
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<decimal> GetFatFractionAvg(ReadingCalculateDto inDto)
|
||||
{
|
||||
decimal result = 0;
|
||||
var rowInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.FatFraction).SelectMany(x => x.TableRowInfoList).ToList();
|
||||
|
||||
var tableQuestionList = rowInfo.SelectMany(x => x.TableQuestionList).ToList();
|
||||
|
||||
result = tableQuestionList.Where(x => x.QuestionMark == QuestionMark.AverageValue).Average(x => x.Answer.IsNullOrEmptyReturn0());
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算平均值
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task CalculateAvg(ReadingCalculateDto inDto)
|
||||
{
|
||||
// 脂肪分数的表格问题Id
|
||||
var questionInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.FatFraction).FirstOrDefault();
|
||||
|
||||
List<ReadingTableQuestionAnswer> tableAnswers = new List<ReadingTableQuestionAnswer>();
|
||||
|
||||
|
||||
foreach (var item in questionInfo.TableRowInfoList)
|
||||
{
|
||||
var avg = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.AverageValue).FirstOrDefault();
|
||||
var avgAnswer = string.Empty;
|
||||
List<QuestionMark?> questionMarks = new List<QuestionMark?>()
|
||||
{
|
||||
QuestionMark.FirstMeasurement,
|
||||
QuestionMark.SecondMeasurement,
|
||||
QuestionMark.ThirdMeasurement,
|
||||
};
|
||||
var answers = item.TableQuestionList.Where(x => questionMarks.Contains(x.QuestionMark)).Select(x=>x.Answer).ToList();
|
||||
if (answers.Count() == 3 && !answers.Any(x => x.IsNullOrEmpty()))
|
||||
{
|
||||
var avgAnswernum= answers.Select(x=>x.IsNullOrEmptyReturn0()).Average(x=>x);
|
||||
avgAnswer = decimal.Round(avgAnswernum, inDto.DigitPlaces, MidpointRounding.AwayFromZero).ToString("F" + inDto.DigitPlaces.ToString());
|
||||
}
|
||||
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = avgAnswer,
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
QuestionId = avg.QuestionId,
|
||||
TableQuestionId = avg.TableQuestionId,
|
||||
TrialId = inDto.TrialId,
|
||||
RowIndex = avg.RowIndex,
|
||||
RowId = avg.RowId,
|
||||
|
||||
});
|
||||
|
||||
await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowId == item.RowId && x.TableQuestionId == avg.TableQuestionId);
|
||||
}
|
||||
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2272,6 +2272,31 @@ public enum SUVChangeVSBaseline
|
|||
/// </summary>
|
||||
Undetermined = 1021,
|
||||
|
||||
/// <summary>
|
||||
/// 第一次测量
|
||||
/// </summary>
|
||||
FirstMeasurement = 1101,
|
||||
|
||||
/// <summary>
|
||||
/// 第二次测量
|
||||
/// </summary>
|
||||
SecondMeasurement = 1102,
|
||||
|
||||
/// <summary>
|
||||
/// 第三次测量
|
||||
/// </summary>
|
||||
ThirdMeasurement = 1103,
|
||||
|
||||
/// <summary>
|
||||
/// 平均值
|
||||
/// </summary>
|
||||
AverageValue = 1104,
|
||||
|
||||
/// <summary>
|
||||
/// 是否可测量
|
||||
/// </summary>
|
||||
IsMeasurable = 1105,
|
||||
|
||||
/// <summary>
|
||||
/// 肝脏分段
|
||||
/// </summary>
|
||||
|
@ -2666,6 +2691,11 @@ public enum SUVChangeVSBaseline
|
|||
/// 斑块3-匹配动脉段最小FCT
|
||||
/// </summary>
|
||||
Plaque3MinFCT = 1008,
|
||||
|
||||
/// <summary>
|
||||
/// 脂肪分数总平均值
|
||||
/// </summary>
|
||||
TotalMeanFraction = 1101,
|
||||
}
|
||||
|
||||
|
||||
|
@ -2795,8 +2825,12 @@ public enum PET5PSScore
|
|||
/// <summary>
|
||||
/// 斑块数据统计
|
||||
/// </summary>
|
||||
|
||||
PatchDataStatistics = 9,
|
||||
|
||||
/// <summary>
|
||||
/// 保存表格问题标记
|
||||
/// </summary>
|
||||
SaveTableQuestionMark = 10,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -44,6 +44,15 @@ public class ReadingTaskQuestionMark : BaseAddAuditEntity
|
|||
|
||||
public Guid? OtherStudyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表格问题标记
|
||||
/// </summary>
|
||||
public Guid? RowId { get; set; }
|
||||
|
||||
public Guid? TableQuestionId { get; set; }
|
||||
|
||||
public decimal? RowIndex { get; set; }
|
||||
|
||||
[MaxLength]
|
||||
public string OtherMarkTool { get; set; } = string.Empty;
|
||||
|
||||
|
|
18252
IRaCIS.Core.Infra.EFCore/Migrations/20241223094453_tablemark.Designer.cs
generated
Normal file
18252
IRaCIS.Core.Infra.EFCore/Migrations/20241223094453_tablemark.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class tablemark : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "RowId",
|
||||
table: "ReadingTaskQuestionMark",
|
||||
type: "uniqueidentifier",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "RowIndex",
|
||||
table: "ReadingTaskQuestionMark",
|
||||
type: "uniqueidentifier",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "TableQuestionId",
|
||||
table: "ReadingTaskQuestionMark",
|
||||
type: "uniqueidentifier",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RowId",
|
||||
table: "ReadingTaskQuestionMark");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RowIndex",
|
||||
table: "ReadingTaskQuestionMark");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TableQuestionId",
|
||||
table: "ReadingTaskQuestionMark");
|
||||
}
|
||||
}
|
||||
}
|
18253
IRaCIS.Core.Infra.EFCore/Migrations/20241224030556_tablemarkc.Designer.cs
generated
Normal file
18253
IRaCIS.Core.Infra.EFCore/Migrations/20241224030556_tablemarkc.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class tablemarkc : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<decimal>(
|
||||
name: "RowIndex",
|
||||
table: "ReadingTaskQuestionMark",
|
||||
type: "decimal(18,2)",
|
||||
precision: 18,
|
||||
scale: 2,
|
||||
nullable: true,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uniqueidentifier",
|
||||
oldNullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "RowIndex",
|
||||
table: "ReadingTaskQuestionMark",
|
||||
type: "uniqueidentifier",
|
||||
nullable: true,
|
||||
oldClrType: typeof(decimal),
|
||||
oldType: "decimal(18,2)",
|
||||
oldPrecision: 18,
|
||||
oldScale: 2,
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7074,12 +7074,22 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.Property<int?>("QuestionType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid?>("RowId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<decimal?>("RowIndex")
|
||||
.HasPrecision(18, 2)
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<Guid?>("SeriesId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid?>("StudyId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid?>("TableQuestionId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("VisitTaskId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
|
|
Loading…
Reference in New Issue