Uat_Study
he 2022-09-01 14:03:05 +08:00
parent 102a6f851a
commit ca3c818ac7
5 changed files with 179 additions and 4 deletions

View File

@ -28,6 +28,12 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public int ShowOrder { get; set; } public int ShowOrder { get; set; }
/// <summary>
/// 是否显示在Dicom阅片中
/// </summary>
public bool IsShowInDicom { get; set; } = false;
public int RowIndex { get; set; } public int RowIndex { get; set; }
public string GroupName { get; set; } public string GroupName { get; set; }
@ -52,6 +58,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public Guid VisitTaskId { get; set; } public Guid VisitTaskId { get; set; }
public string Answer { get; set; } public string Answer { get; set; }
} }
@ -141,6 +149,36 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public string TaskName { get; set; } public string TaskName { get; set; }
public decimal VisitTaskNum { get; set; } public decimal VisitTaskNum { get; set; }
public bool IsCurrentTask { get; set; }
}
public class ChangeDicomReadingQuestionAnswerInDto
{
public Guid VisitTaskId { get; set; }
public List<ChangeDicomReadingQuestionAnswerDto> Answers { get; set; }
}
public class ChangeDicomReadingQuestionAnswerDto
{
public Guid Id { get; set; }
public string Answer { get; set; }
}
public class DicomReadingQuestionAnswer : ReadingQuestionTrial
{
public string Answer { get; set; }
public List<DicomReadingQuestionAnswer> Childrens = new List<DicomReadingQuestionAnswer>();
}
public class GetDicomReadingQuestionAnswerInDto
{
public Guid VisitTaskId { get; set; }
public Guid TrialId { get; set; }
} }
public class GetReadingReportEvaluationInDto public class GetReadingReportEvaluationInDto
@ -205,6 +243,51 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public List<GetTrialReadingQuestionOutDto> RelationQuestions { get; set; } = new List<GetTrialReadingQuestionOutDto>(); public List<GetTrialReadingQuestionOutDto> RelationQuestions { get; set; } = new List<GetTrialReadingQuestionOutDto>();
} }
public class GetTableAnswerRowInfoOutDto
{
public Guid Id { get; set; }
/// <summary>
/// QuestionId
/// </summary>
public Guid QuestionId { get; set; }
/// <summary>
/// VisitTaskId
/// </summary>
public Guid VisitTaskId { get; set; }
/// <summary>
/// TrialId
/// </summary>
public Guid TrialId { get; set; }
/// <summary>
/// InstanceId
/// </summary>
public Guid? InstanceId { get; set; }
/// <summary>
/// SeriesId
/// </summary>
public Guid? SeriesId { get; set; }
/// <summary>
/// RowIndex
/// </summary>
public int RowIndex { get; set; }
/// <summary>
/// MeasureData
/// </summary>
public string MeasureData { get; set; }
public int ShowOrder { get; set; }
}
public class GetTableAnswerRowInfoInDto public class GetTableAnswerRowInfoInDto
{ {
public Guid VisitTaskId { get; set; } public Guid VisitTaskId { get; set; }

View File

@ -17,7 +17,7 @@ namespace IRaCIS.Core.Application.Service
/// <summary> /// <summary>
/// 阅片计算 /// 阅片计算
/// </summary> /// </summary>
[NonDynamicWebApi]
[ApiExplorerSettings(GroupName = "Reading")] [ApiExplorerSettings(GroupName = "Reading")]
public class ReadingCalculateService : BaseService, IReadingCalculateService public class ReadingCalculateService : BaseService, IReadingCalculateService
{ {
@ -57,6 +57,7 @@ namespace IRaCIS.Core.Application.Service
/// </summary> /// </summary>
/// <param name="inDto"></param> /// <param name="inDto"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost]
public async Task CalculateTask(CalculateTaskInDto inDto) public async Task CalculateTask(CalculateTaskInDto inDto)
{ {
var visitTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync(); var visitTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();

View File

@ -108,6 +108,75 @@ namespace IRaCIS.Application.Services
#region 表格问题相关 #region 表格问题相关
/// <summary>
/// 修改Dicom阅片问题
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> ChangeDicomReadingQuestionAnswer(ChangeDicomReadingQuestionAnswerInDto inDto)
{
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
var criterionId = await _readingQuestionCriterionTrialRepository.Where(x => x.IsConfirm && x.TrialId == taskInfo.TrialId).Select(x => x.Id).FirstOrDefaultAsync();
var questionIds = inDto.Answers.Select(x => x.Id).ToList();
await _readingTaskQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && questionIds.Contains(x.ReadingQuestionTrialId));
var needAddAnswer = inDto.Answers.Select(x => new ReadingTaskQuestionAnswer()
{
Answer = x.Answer,
SubjectId = taskInfo.SubjectId,
ReadingQuestionCriterionTrialId = criterionId,
ReadingQuestionTrialId = x.Id,
TrialId = taskInfo.TrialId,
VisitTaskId = inDto.VisitTaskId,
}).ToList();
await _readingTaskQuestionAnswerRepository.AddRangeAsync(needAddAnswer);
await _readingTaskQuestionAnswerRepository.SaveChangesAsync();
return ResponseOutput.Ok(true);
}
/// <summary>
/// 获取DIcom阅片问题答案
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<List<DicomReadingQuestionAnswer>> GetDicomReadingQuestionAnswer(GetDicomReadingQuestionAnswerInDto inDto)
{
var criterionId = await _readingQuestionCriterionTrialRepository.Where(x => x.IsConfirm && x.TrialId == inDto.TrialId).Select(x => x.Id).FirstOrDefaultAsync();
var questions = await _readingQuestionTrialRepository.Where(x => x.IsShowInDicom && x.ReadingQuestionCriterionTrialId == criterionId)
.ProjectTo<DicomReadingQuestionAnswer>(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync();
var answers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
var result = questions.Where(x => x.Type == "group").ToList();
foreach (var item in result)
{
GetDicomReadingAnswer(item, questions, answers);
}
return result;
}
private void GetDicomReadingAnswer(DicomReadingQuestionAnswer item,List<DicomReadingQuestionAnswer> questions,List<ReadingTaskQuestionAnswer> answers)
{
item.Answer = answers.Where(x => x.ReadingQuestionTrialId == item.Id).Select(x => x.Answer).FirstIsNullReturnEmpty();
item.Childrens = questions.Where(x => x.ParentId == item.Id || (x.GroupName == item.GroupName && x.ParentId == null)).ToList();
foreach (var question in item.Childrens)
{
GetDicomReadingAnswer(question, questions, answers);
}
}
/// <summary> /// <summary>
/// 获取阅片报告 /// 获取阅片报告
/// </summary> /// </summary>
@ -128,6 +197,8 @@ namespace IRaCIS.Application.Services
VisitTaskId = x.Id, VisitTaskId = x.Id,
TaskName = x.TaskName, TaskName = x.TaskName,
VisitTaskNum = x.VisitTaskNum, VisitTaskNum = x.VisitTaskNum,
IsCurrentTask=x.Id==indto.VisitTaskId,
}).ToListAsync(); }).ToListAsync();
result.VisitTaskList = taskInfoList; result.VisitTaskList = taskInfoList;
@ -150,8 +221,10 @@ namespace IRaCIS.Application.Services
{ {
QuestionId = x.Id, QuestionId = x.Id,
GroupName = x.GroupName, GroupName = x.GroupName,
IsShowInDicom=x.IsShowInDicom,
QuestionName = x.QuestionName, QuestionName = x.QuestionName,
ShowOrder = x.ShowOrder, ShowOrder = x.ShowOrder,
}).ToList(); }).ToList();
// 分组 // 分组
@ -161,6 +234,7 @@ namespace IRaCIS.Application.Services
{ {
GroupName = x.GroupName, GroupName = x.GroupName,
QuestionId = x.Id, QuestionId = x.Id,
IsShowInDicom = x.IsShowInDicom,
QuestionName = x.QuestionName, QuestionName = x.QuestionName,
ShowOrder = x.ShowOrder, ShowOrder = x.ShowOrder,
OrderMark=x.OrderMark, OrderMark=x.OrderMark,
@ -248,10 +322,11 @@ namespace IRaCIS.Application.Services
/// (QuestionId) 可为空 /// (QuestionId) 可为空
/// </remarks> /// </remarks>
/// <returns></returns> /// <returns></returns>
public async Task<List<ReadingTableAnswerRowInfo>> GetTableAnswerRowInfoList(GetTableAnswerRowInfoInDto inDto) public async Task<List<GetTableAnswerRowInfoOutDto>> GetTableAnswerRowInfoList(GetTableAnswerRowInfoInDto inDto)
{ {
return await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId) return await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId)
.WhereIf(inDto.QuestionId != null, x => x.QuestionId == inDto.QuestionId) .WhereIf(inDto.QuestionId != null, x => x.QuestionId == inDto.QuestionId)
.ProjectTo<GetTableAnswerRowInfoOutDto>(_mapper.ConfigurationProvider).OrderBy(x=>x.ShowOrder).ThenBy(x=>x.RowIndex)
.ToListAsync(); .ToListAsync();
} }

View File

@ -51,6 +51,19 @@ namespace IRaCIS.Core.Application.Service
#region 阅片问题 #region 阅片问题
// 忽略列
CreateMap<ReadingQuestionTrial, DicomReadingQuestionAnswer>()
.ForMember(dest => dest.ReadingCriterionPage, opt => opt.Ignore())
.ForMember(dest => dest.ParentReadingQuestionTrial, opt => opt.Ignore())
.ForMember(dest => dest.RelevanceReadingQuestionTrial, opt => opt.Ignore())
.ForMember(dest => dest.ReadingQuestionCriterionTrial, opt => opt.Ignore());
CreateMap<ReadingTableAnswerRowInfo, GetTableAnswerRowInfoOutDto>()
.ForMember(d => d.ShowOrder, u => u.MapFrom(s => s.ReadingQuestionTrial.ShowOrder));
CreateMap<ReadingTableQuestionTrial, TableQuestionTrial>(); CreateMap<ReadingTableQuestionTrial, TableQuestionTrial>();
CreateMap<ReadingTableQuestionAnswer, ReadingTableQuestionAnswerInfo>() CreateMap<ReadingTableQuestionAnswer, ReadingTableQuestionAnswerInfo>()
.ForMember(d => d.ShowOrder, u => u.MapFrom(s => s.ReadingQuestionTrial.ShowOrder)); .ForMember(d => d.ShowOrder, u => u.MapFrom(s => s.ReadingQuestionTrial.ShowOrder));

View File

@ -61,7 +61,10 @@ namespace IRaCIS.Core.Domain.Models
/// </summary> /// </summary>
public Guid CreateUserId { get; set; } public Guid CreateUserId { get; set; }
} [ForeignKey("QuestionId")]
public ReadingQuestionTrial ReadingQuestionTrial { get; set; }
}
} }