修改一版

Uat_Study
he 2022-07-19 15:40:23 +08:00
parent 537510c15a
commit 20746f4be9
4 changed files with 136 additions and 20 deletions

View File

@ -1431,6 +1431,16 @@
文件路径
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GlobalQuestionInfo.TypeValue">
<summary>
类型值
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GlobalQuestionInfo.Type">
<summary>
类型
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.Reading.Dto.GetTrialConfirmCriterionListOutDto">
<summary>
返回对象
@ -5619,6 +5629,13 @@
IR影像阅片
</summary>
</member>
<member name="M:IRaCIS.Application.Services.ReadingImageTaskService.SaveGlobalReadingInfo(IRaCIS.Core.Application.Service.Reading.Dto.SaveGlobalReadingInfoInDto)">
<summary>
保存全局阅片结果
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Application.Services.ReadingImageTaskService.GetGlobalReadingInfo(IRaCIS.Core.Application.Service.Reading.Dto.GetGlobalReadingInfoInDto)">
<summary>
获取全局阅片信息

View File

@ -8,6 +8,28 @@ using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Service.Reading.Dto
{
public class SaveGlobalReadingInfoInDto
{
public Guid VisitTaskId { get; set; }
public Guid SubjectId { get; set; }
public Guid TrialId { get; set; }
public List<SaveGlobalReadingQuestion> QuestionList { get; set; }
}
public class SaveGlobalReadingQuestion
{
public Guid? QuestionId { get; set; }
public Guid visitTaskId { get; set; }
public string Answer { get; set; }
}
public class GetGlobalReadingInfoInDto
{
@ -43,7 +65,15 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public string Answer { get; set; }
public bool IsBeforeQuestion { get; set; }
/// <summary>
/// 类型值
/// </summary>
public string TypeValue { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; }
}
public class GetReadingImgOutDto

View File

@ -34,6 +34,7 @@ namespace IRaCIS.Application.Services
private readonly IReadingClinicalDataService _readingClinicalDataService;
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
private readonly IRepository<Subject> _subjectRepository;
private readonly IRepository<ReadingGlobalTaskInfo> _readingGlobalTaskInfoRepository;
private readonly IRepository<ReadingCriterionPage> _readingCriterionPageRepository;
private readonly IRepository<ReadingJudgeInfo> _readingJudgeInfoRepository;
private readonly IRepository<ReadModule> _readModuleRepository;
@ -51,6 +52,7 @@ namespace IRaCIS.Application.Services
IReadingClinicalDataService readingClinicalDataService,
IRepository<SubjectVisit> subjectVisitRepository,
IRepository<Subject> subjectRepository,
IRepository<ReadingGlobalTaskInfo> readingGlobalTaskInfoRepository,
IRepository<ReadingCriterionPage> readingCriterionPageRepository,
IRepository<ReadingJudgeInfo> readingJudgeInfoRepository,
IRepository<ReadModule> readModuleRepository,
@ -67,6 +69,7 @@ namespace IRaCIS.Application.Services
this._readingClinicalDataService = readingClinicalDataService;
this._subjectVisitRepository = subjectVisitRepository;
this._subjectRepository = subjectRepository;
this._readingGlobalTaskInfoRepository = readingGlobalTaskInfoRepository;
this._readingCriterionPageRepository = readingCriterionPageRepository;
this._readingJudgeInfoRepository = readingJudgeInfoRepository;
this._readModuleRepository = readModuleRepository;
@ -75,6 +78,31 @@ namespace IRaCIS.Application.Services
this._readingQuestionTrialRepository = readingQuestionTrialRepository;
}
/// <summary>
/// 保存全局阅片结果
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> SaveGlobalReadingInfo(SaveGlobalReadingInfoInDto inDto)
{
await _readingGlobalTaskInfoRepository.BatchDeleteNoTrackingAsync(x => x.GlobalTaskId == inDto.VisitTaskId);
await _readingGlobalTaskInfoRepository.AddRangeAsync(inDto.QuestionList.Select(x => new ReadingGlobalTaskInfo()
{
Answer=x.Answer,
QuestionId=x.QuestionId,
SubjectId=inDto.SubjectId,
GlobalTaskId=inDto.VisitTaskId,
TaskId=x.visitTaskId,
TrialId=inDto.TrialId,
}).ToList());
var result = await _readingGlobalTaskInfoRepository.SaveChangesAsync();
return ResponseOutput.Ok(result);
}
/// <summary>
/// 获取全局阅片信息
/// </summary>
@ -84,10 +112,66 @@ namespace IRaCIS.Application.Services
public async Task<GetGlobalReadingInfoOutDto> GetGlobalReadingInfo(GetGlobalReadingInfoInDto inDto)
{
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
if (taskInfo.ReadingCategory != ReadingCategory.Global)
{
throw new BusinessValidationFailedException("当前任务不是全局阅片任务");
}
GetGlobalReadingInfoOutDto result = new GetGlobalReadingInfoOutDto() {
VisitTaskId = inDto.VisitTaskId,
};
//List < GlobalVisitInfo >
result.TaskList = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit &&
x.SubjectId == taskInfo.SubjectId && x.ArmEnum == taskInfo.ArmEnum && x.VisitTaskNum < taskInfo.VisitTaskNum)
.OrderBy(x => x.VisitTaskNum).Select(x => new GlobalVisitInfo()
{
VisitName = x.SourceSubjectVisit.VisitName,
VisitTaskId = x.Id,
VisitId = x.SourceSubjectVisitId.Value,
BeforeQuestionList = x.ReadingTaskQuestionAnswerList.Where(y => y.ReadingQuestionTrial.IsJudgeQuestion).OrderBy(y => y.ReadingQuestionTrial.ShowOrder)
.Select(y => new GlobalQuestionInfo()
{
QuestionId = y.ReadingQuestionTrialId,
QuestionName = y.ReadingQuestionTrial.QuestionName,
Type=y.ReadingQuestionTrial.Type,
TypeValue=y.ReadingQuestionTrial.TypeValue,
Answer = y.Answer
}).ToList()
}).ToListAsync();
return new GetGlobalReadingInfoOutDto();
var globalReadingQuestion = await _readingGlobalTaskInfoRepository.Where(x => x.GlobalTaskId == inDto.VisitTaskId).ToListAsync();
result.TaskList.ForEach(x =>
{
x.AfterQuestionList = x.BeforeQuestionList.GroupJoin(
globalReadingQuestion
, l => new { a = l.QuestionId, b = x.VisitTaskId }
, r => new { a = r.QuestionId, b = r.TaskId }
, (l, r) => new { question=l, global=r })
.SelectMany(lr => lr.global.DefaultIfEmpty(), (lr, r) => new GlobalQuestionInfo
{
Answer = lr.global == null ? string.Empty : lr.global.Select(x=>x.Answer).FirstOrDefault(),
QuestionId =lr.question.QuestionId,
QuestionName=lr.question.QuestionName,
Type = lr.question.Type,
TypeValue = lr.question.TypeValue,
}).ToList();
var reason = new GlobalQuestionInfo()
{
Answer = globalReadingQuestion.Where(y => y.TaskId == x.VisitId && y.QuestionId == null).Select(x => x.Answer).FirstOrDefault() ?? String.Empty,
QuestionName="原因"
};
x.AfterQuestionList.Add(reason);
});
return result;
}
@ -140,7 +224,7 @@ namespace IRaCIS.Application.Services
VisitTaskId = x.Id,
TaskBlindName=x.TaskBlindName,
ReadingCategory = x.ReadingCategory,
VisistId = x.SourceSubjectVisitId != null ? x.SourceSubjectVisitId.Value : x.ReadModule.SubjectVisitId,
VisistId = x.SourceSubjectVisitId != null ? x.SourceSubjectVisitId.Value : x.ReadModule==null? default(Guid) : x.ReadModule.SubjectVisitId,
VisitNum = x.VisitTaskNum,
}).OrderBy(x => x.VisitNum).ThenBy(x => x.ReadingCategory);
@ -160,7 +244,7 @@ namespace IRaCIS.Application.Services
VisitTaskId = x.Id,
TaskBlindName = x.TaskBlindName,
ReadingCategory = x.ReadingCategory,
VisistId = x.SourceSubjectVisitId != null ? x.SourceSubjectVisitId.Value : x.ReadModule.SubjectVisitId,
VisistId = x.SourceSubjectVisitId != null ? x.SourceSubjectVisitId.Value : x.ReadModule == null ? default(Guid) : x.ReadModule.SubjectVisitId,
VisitNum = x.VisitTaskNum,
SubjectId =x.SubjectId,
SubjectCode=x.Subject.Code,

View File

@ -34,21 +34,6 @@ namespace IRaCIS.Core.Domain.Models
public string Answer { get; set; }
/// <summary>
/// 问题类型
/// </summary>
public int AnswerType { get; set; }
/// <summary>
/// 访视ID
/// </summary>
public Guid VisitId { get; set; }
/// <summary>
/// 访视num
/// </summary>
public decimal VisitNum { get; set; }
/// <summary>
/// CreateTime
/// </summary>