diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 6066874cf..e12056965 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -1431,6 +1431,16 @@
文件路径
+
+
+ 类型值
+
+
+
+
+ 类型
+
+
返回对象
@@ -5619,6 +5629,13 @@
IR影像阅片
+
+
+ 保存全局阅片结果
+
+
+
+
获取全局阅片信息
diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs
index e87fc3a3c..6ff4e8b2d 100644
--- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs
+++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs
@@ -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 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; }
+ ///
+ /// 类型值
+ ///
+ public string TypeValue { get; set; }
+
+ ///
+ /// 类型
+ ///
+ public string Type { get; set; }
}
public class GetReadingImgOutDto
diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs
index 6c17d44b1..3b79a002b 100644
--- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs
+++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs
@@ -34,6 +34,7 @@ namespace IRaCIS.Application.Services
private readonly IReadingClinicalDataService _readingClinicalDataService;
private readonly IRepository _subjectVisitRepository;
private readonly IRepository _subjectRepository;
+ private readonly IRepository _readingGlobalTaskInfoRepository;
private readonly IRepository _readingCriterionPageRepository;
private readonly IRepository _readingJudgeInfoRepository;
private readonly IRepository _readModuleRepository;
@@ -51,6 +52,7 @@ namespace IRaCIS.Application.Services
IReadingClinicalDataService readingClinicalDataService,
IRepository subjectVisitRepository,
IRepository subjectRepository,
+ IRepository readingGlobalTaskInfoRepository,
IRepository readingCriterionPageRepository,
IRepository readingJudgeInfoRepository,
IRepository 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;
}
+ ///
+ /// 保存全局阅片结果
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task 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);
+
+ }
+
+
///
/// 获取全局阅片信息
///
@@ -84,10 +112,66 @@ namespace IRaCIS.Application.Services
public async Task 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,
diff --git a/IRaCIS.Core.Domain/Reading/ReadingGlobalTaskInfo.cs b/IRaCIS.Core.Domain/Reading/ReadingGlobalTaskInfo.cs
index c1727dd41..924cd5419 100644
--- a/IRaCIS.Core.Domain/Reading/ReadingGlobalTaskInfo.cs
+++ b/IRaCIS.Core.Domain/Reading/ReadingGlobalTaskInfo.cs
@@ -34,21 +34,6 @@ namespace IRaCIS.Core.Domain.Models
public string Answer { get; set; }
- ///
- /// 问题类型
- ///
- public int AnswerType { get; set; }
-
- ///
- /// 访视ID
- ///
- public Guid VisitId { get; set; }
-
- ///
- /// 访视num
- ///
- public decimal VisitNum { get; set; }
-
///
/// CreateTime
///