表格问题病灶

IRC_NewDev
he 2024-12-23 17:45:42 +08:00
parent e22a015fcb
commit 3cde829319
12 changed files with 18526 additions and 2 deletions

View File

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

View File

@ -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; }

View File

@ -446,6 +446,60 @@ 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
{
return this.VisitTaskId;
}
}
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 GetPreviousOtherPicturePathInDto
{
@ -996,6 +1050,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// </summary>
public string? OrderMark { get; set; }
public List<ReadingTaskQuestionMark> TableQuestionMarkList = new List<ReadingTaskQuestionMark>();
public string? OrderMarkName { get; set; }

View File

@ -83,6 +83,46 @@ namespace IRaCIS.Core.Application.Service
}
#endregion
/// <summary>
/// 保存表格问题标记
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<SaveTableQuestionMarkInDto> SaveTableQuestionMark(SaveTableQuestionMarkInDto inDto)
{
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 +974,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();

View File

@ -66,6 +66,7 @@ namespace IRaCIS.Core.Application.Service
#endregion
CreateMap<VisitTask, VisitTaskDto>();
CreateMap<SaveTableQuestionMarkInDto, ReadingTaskQuestionMark>();
CreateMap<SubmitTableQuestionInDto, ReadingTableAnswerRowInfo>()
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
.ForAllMembers(opts => opts.Condition((src, dest, srcMember) => srcMember != null));

View File

@ -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,

View File

@ -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
{
@ -455,6 +457,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
}
/// <summary>
/// 自动计算
/// </summary>
@ -463,6 +467,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// <returns></returns>
public async Task ReadingCalculate(ReadingCalculateDto inDto, List<QuestionType>? calculateType = null)
{
await this.CalculateAvg(inDto);
//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();
@ -474,7 +480,54 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// <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();
}

View File

@ -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>
@ -2795,8 +2820,12 @@ public enum PET5PSScore
/// <summary>
/// 斑块数据统计
/// </summary>
PatchDataStatistics = 9,
/// <summary>
/// 保存表格问题标记
/// </summary>
SaveTableQuestionMark = 10,
}
/// <summary>

View File

@ -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 Guid? RowIndex { get; set; }
[MaxLength]
public string OtherMarkTool { get; set; } = string.Empty;

File diff suppressed because it is too large Load Diff

View File

@ -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");
}
}
}

View File

@ -6953,12 +6953,21 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Property<int?>("QuestionType")
.HasColumnType("int");
b.Property<Guid?>("RowId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("RowIndex")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("SeriesId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("StudyId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TableQuestionId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("VisitTaskId")
.HasColumnType("uniqueidentifier");