Test.EIImageViewer
parent
5acbf9c3a5
commit
70f19fe58b
|
@ -9,7 +9,6 @@ using IRaCIS.Core.Application.Contracts;
|
||||||
using IRaCIS.Core.Infrastructure;
|
using IRaCIS.Core.Infrastructure;
|
||||||
using IRaCIS.Core.Application.Service;
|
using IRaCIS.Core.Application.Service;
|
||||||
using IRaCIS.Core.Application.ViewModel;
|
using IRaCIS.Core.Application.ViewModel;
|
||||||
using IRaCIS.Core.Application.Interfaces;
|
|
||||||
|
|
||||||
namespace IRaCIS.Application.Services
|
namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
|
@ -46,8 +45,6 @@ namespace IRaCIS.Application.Services
|
||||||
private readonly IRepository<ReadingQuestionSystem> _readingQuestionSystem;
|
private readonly IRepository<ReadingQuestionSystem> _readingQuestionSystem;
|
||||||
private readonly IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository;
|
private readonly IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository;
|
||||||
|
|
||||||
private readonly ITrialEmailNoticeConfigService _trialEmailNoticeConfigService;
|
|
||||||
|
|
||||||
|
|
||||||
public ReadingImageTaskService(
|
public ReadingImageTaskService(
|
||||||
IMapper mapper,
|
IMapper mapper,
|
||||||
|
@ -75,9 +72,7 @@ namespace IRaCIS.Application.Services
|
||||||
IRepository<ReadingQuestionCriterionTrial> readingQuestionCriterionTrialRepository,
|
IRepository<ReadingQuestionCriterionTrial> readingQuestionCriterionTrialRepository,
|
||||||
IRepository<ReadingQuestionCriterionSystem> readingQuestionCriterionSystemRepository,
|
IRepository<ReadingQuestionCriterionSystem> readingQuestionCriterionSystemRepository,
|
||||||
IRepository<ReadingQuestionSystem> ReadingQuestionSystem,
|
IRepository<ReadingQuestionSystem> ReadingQuestionSystem,
|
||||||
IRepository<ReadingQuestionTrial> readingQuestionTrialRepository,
|
IRepository<ReadingQuestionTrial> readingQuestionTrialRepository
|
||||||
|
|
||||||
ITrialEmailNoticeConfigService trialEmailNoticeConfigService
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
base._mapper = mapper;
|
base._mapper = mapper;
|
||||||
|
@ -106,8 +101,6 @@ namespace IRaCIS.Application.Services
|
||||||
this._readingQuestionCriterionSystemRepository = readingQuestionCriterionSystemRepository;
|
this._readingQuestionCriterionSystemRepository = readingQuestionCriterionSystemRepository;
|
||||||
this._readingQuestionSystem = ReadingQuestionSystem;
|
this._readingQuestionSystem = ReadingQuestionSystem;
|
||||||
this._readingQuestionTrialRepository = readingQuestionTrialRepository;
|
this._readingQuestionTrialRepository = readingQuestionTrialRepository;
|
||||||
|
|
||||||
_trialEmailNoticeConfigService = trialEmailNoticeConfigService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -345,181 +338,7 @@ namespace IRaCIS.Application.Services
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<GetReadingReportEvaluationOutDto> GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto)
|
public async Task<GetReadingReportEvaluationOutDto> GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto)
|
||||||
{
|
{
|
||||||
|
return await _readingCalculateService.GetReadingReportEvaluation(indto);
|
||||||
|
|
||||||
GetReadingReportEvaluationOutDto result = new GetReadingReportEvaluationOutDto();
|
|
||||||
|
|
||||||
result.CalculateResult = await _readingCalculateService.GetReportVerify(new GetReportVerifyInDto()
|
|
||||||
{
|
|
||||||
VisitTaskId = indto.VisitTaskId
|
|
||||||
});
|
|
||||||
|
|
||||||
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).FirstNotNullAsync();
|
|
||||||
|
|
||||||
//if (visitTaskInfo.TaskState != TaskState.Effect)
|
|
||||||
//{
|
|
||||||
// throw new BusinessValidationFailedException($"当前任务已失效!");
|
|
||||||
//}
|
|
||||||
result.ReadingTaskState = visitTaskInfo.ReadingTaskState;
|
|
||||||
var taskInfoList = await _visitTaskRepository
|
|
||||||
// 失效的只查看自己
|
|
||||||
.WhereIf(visitTaskInfo.TaskState != TaskState.Effect, x => x.Id == indto.VisitTaskId)
|
|
||||||
.Where(x => (x.SubjectId == visitTaskInfo.SubjectId && x.TaskState == TaskState.Effect
|
|
||||||
&& x.IsAnalysisCreate == visitTaskInfo.IsAnalysisCreate
|
|
||||||
&& x.IsSelfAnalysis == visitTaskInfo.IsSelfAnalysis
|
|
||||||
&& x.ArmEnum == visitTaskInfo.ArmEnum
|
|
||||||
&& x.TrialReadingCriterionId == visitTaskInfo.TrialReadingCriterionId
|
|
||||||
&& x.ReadingCategory == ReadingCategory.Visit && !x.IsAnalysisCreate && x.ReadingTaskState == ReadingTaskState.HaveSigned) || x.Id == indto.VisitTaskId
|
|
||||||
).OrderBy(x => x.VisitTaskNum).Select(x => new VisitTaskInfo()
|
|
||||||
{
|
|
||||||
BlindName = x.SourceSubjectVisit.BlindName,
|
|
||||||
IsBaseLine = x.SourceSubjectVisit.IsBaseLine,
|
|
||||||
VisitTaskId = x.Id,
|
|
||||||
TaskName = x.TaskName,
|
|
||||||
VisitTaskNum = x.VisitTaskNum,
|
|
||||||
IsCurrentTask = x.Id == indto.VisitTaskId,
|
|
||||||
|
|
||||||
}).ToListAsync();
|
|
||||||
|
|
||||||
result.VisitTaskList = taskInfoList;
|
|
||||||
|
|
||||||
var visitTaskIds = taskInfoList.Select(x => x.VisitTaskId).ToList();
|
|
||||||
|
|
||||||
var criterionId = visitTaskInfo.TrialReadingCriterionId;
|
|
||||||
var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId).ToListAsync();
|
|
||||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == criterionId).OrderBy(x => x.ShowOrder).ToListAsync();
|
|
||||||
var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId).ProjectTo<TableAnsweRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
|
||||||
|
|
||||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
|
||||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
|
||||||
|
|
||||||
|
|
||||||
// 第一级
|
|
||||||
|
|
||||||
#region 构造问题
|
|
||||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
|
||||||
{
|
|
||||||
QuestionId = x.Id,
|
|
||||||
GroupName = x.GroupName,
|
|
||||||
IsShowInDicom = x.IsShowInDicom,
|
|
||||||
Type = x.Type,
|
|
||||||
QuestionType = x.QuestionType,
|
|
||||||
LesionType = x.LesionType,
|
|
||||||
QuestionGenre = x.QuestionGenre,
|
|
||||||
DictionaryCode = x.DictionaryCode,
|
|
||||||
TypeValue = x.TypeValue,
|
|
||||||
QuestionName = x.QuestionName,
|
|
||||||
ShowOrder = x.ShowOrder,
|
|
||||||
ValueType = x.ValueType,
|
|
||||||
Unit = x.Unit,
|
|
||||||
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
// 分组
|
|
||||||
foreach (var item in questions)
|
|
||||||
{
|
|
||||||
item.Childrens = questionList.Where(x => x.GroupName == item.GroupName && x.Type != ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
|
||||||
{
|
|
||||||
GroupName = x.GroupName,
|
|
||||||
QuestionId = x.Id,
|
|
||||||
IsShowInDicom = x.IsShowInDicom,
|
|
||||||
QuestionName = x.QuestionName,
|
|
||||||
LesionType = x.LesionType,
|
|
||||||
QuestionGenre = x.QuestionGenre,
|
|
||||||
DictionaryCode = x.DictionaryCode,
|
|
||||||
Type = x.Type,
|
|
||||||
QuestionType = x.QuestionType,
|
|
||||||
TypeValue = x.TypeValue,
|
|
||||||
ShowOrder = x.ShowOrder,
|
|
||||||
OrderMark = x.OrderMark,
|
|
||||||
ValueType = x.ValueType,
|
|
||||||
Unit = x.Unit,
|
|
||||||
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
// 问题
|
|
||||||
foreach (var question in item.Childrens)
|
|
||||||
{
|
|
||||||
|
|
||||||
foreach (var task in taskInfoList)
|
|
||||||
{
|
|
||||||
|
|
||||||
question.Answer.Add(new TaskQuestionAnswer()
|
|
||||||
{
|
|
||||||
Answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
|
||||||
TaskName = task.TaskName,
|
|
||||||
VisitTaskId = task.VisitTaskId,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构造表格行数据
|
|
||||||
|
|
||||||
|
|
||||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
|
||||||
|
|
||||||
|
|
||||||
question.Childrens = rowlist.Select(x => new ReadingReportDto()
|
|
||||||
{
|
|
||||||
QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(),
|
|
||||||
SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName,
|
|
||||||
SplitOrMergeType = x.SplitOrMergeType,
|
|
||||||
LesionType = question.LesionType,
|
|
||||||
IsCanEditPosition = x.IsCanEditPosition,
|
|
||||||
RowIndex = x.RowIndex,
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
|
|
||||||
foreach (var row in question.Childrens)
|
|
||||||
{
|
|
||||||
// tableQuestion
|
|
||||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
|
||||||
{
|
|
||||||
QuestionName = x.QuestionName,
|
|
||||||
QuestionId = x.ReadingQuestionId,
|
|
||||||
TableQuestionId = x.Id,
|
|
||||||
Type = x.Type,
|
|
||||||
LesionType = question.LesionType,
|
|
||||||
TableQuestionType = x.TableQuestionType,
|
|
||||||
DictionaryCode = x.DictionaryCode,
|
|
||||||
QuestionMark = x.QuestionMark,
|
|
||||||
TypeValue = x.TypeValue,
|
|
||||||
RowIndex = row.RowIndex,
|
|
||||||
ShowOrder = x.ShowOrder,
|
|
||||||
ValueType = x.ValueType,
|
|
||||||
Unit = x.Unit,
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
|
|
||||||
foreach (var tableQuestion in row.Childrens)
|
|
||||||
{
|
|
||||||
foreach (var task in taskInfoList)
|
|
||||||
{
|
|
||||||
|
|
||||||
tableQuestion.Answer.Add(new TaskQuestionAnswer()
|
|
||||||
{
|
|
||||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
|
||||||
TaskName = task.TaskName,
|
|
||||||
VisitTaskId = task.VisitTaskId,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
result.TaskQuestions = questions;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -717,6 +536,8 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
var rowInfo = tableAnsweRowInfos.Where(y => y.RowIndex == x && y.QuestionId == item.Id).FirstOrDefault();
|
var rowInfo = tableAnsweRowInfos.Where(y => y.RowIndex == x && y.QuestionId == item.Id).FirstOrDefault();
|
||||||
|
|
||||||
|
answers.Add("BlindName", rowInfo.BlindName);
|
||||||
|
answers.Add("IsDicomReading", rowInfo.IsDicomReading.ToString());
|
||||||
answers.Add("MeasureData", rowInfo == null ? string.Empty : rowInfo.MeasureData);
|
answers.Add("MeasureData", rowInfo == null ? string.Empty : rowInfo.MeasureData);
|
||||||
answers.Add("RowIndex", x.ToString());
|
answers.Add("RowIndex", x.ToString());
|
||||||
answers.Add("RowId", rowInfo.Id.ToString());
|
answers.Add("RowId", rowInfo.Id.ToString());
|
||||||
|
@ -894,7 +715,7 @@ namespace IRaCIS.Application.Services
|
||||||
public async Task<IResponseOutput> DeleteReadingRowAnswer(DeleteReadingRowAnswerInDto inDto)
|
public async Task<IResponseOutput> DeleteReadingRowAnswer(DeleteReadingRowAnswerInDto inDto)
|
||||||
{
|
{
|
||||||
|
|
||||||
var deleteRowInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId).FirstNotNullAsync();
|
var deleteRowInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.Id == inDto.RowId).FirstNotNullAsync();
|
||||||
if (deleteRowInfo == null)
|
if (deleteRowInfo == null)
|
||||||
{
|
{
|
||||||
return ResponseOutput.Ok(true);
|
return ResponseOutput.Ok(true);
|
||||||
|
@ -906,8 +727,8 @@ namespace IRaCIS.Application.Services
|
||||||
throw new BusinessValidationFailedException($"当前病灶分裂出其他病灶或者其他病灶合并到了当前病灶,删除失败");
|
throw new BusinessValidationFailedException($"当前病灶分裂出其他病灶或者其他病灶合并到了当前病灶,删除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId);
|
await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.RowId == inDto.RowId);
|
||||||
await _readingTableAnswerRowInfoRepository.DeleteFromQueryAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId);
|
await _readingTableAnswerRowInfoRepository.DeleteFromQueryAsync(x => x.Id == inDto.RowId);
|
||||||
await _readingTableAnswerRowInfoRepository.SaveChangesAsync();
|
await _readingTableAnswerRowInfoRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
||||||
|
@ -1034,6 +855,8 @@ namespace IRaCIS.Application.Services
|
||||||
rowInfo.TrialId = inDto.TrialId;
|
rowInfo.TrialId = inDto.TrialId;
|
||||||
rowInfo.QuestionId = inDto.QuestionId;
|
rowInfo.QuestionId = inDto.QuestionId;
|
||||||
rowInfo.MeasureData = inDto.MeasureData;
|
rowInfo.MeasureData = inDto.MeasureData;
|
||||||
|
rowInfo.BlindName = inDto.BlindName;
|
||||||
|
rowInfo.IsDicomReading = inDto.IsDicomReading;
|
||||||
rowInfo.IsCurrentTaskAdd = isCurrentTaskAdd;
|
rowInfo.IsCurrentTaskAdd = isCurrentTaskAdd;
|
||||||
rowInfo.FristAddTaskNum = inDto.FristAddTaskNum;
|
rowInfo.FristAddTaskNum = inDto.FristAddTaskNum;
|
||||||
rowInfo.RowIndex = inDto.RowIndex;
|
rowInfo.RowIndex = inDto.RowIndex;
|
||||||
|
@ -1179,7 +1002,7 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
if (readingQuestionList.Count() > 0)
|
if (readingQuestionList.Count() > 0)
|
||||||
{
|
{
|
||||||
throw new BusinessValidationFailedException($" 必填问题{string.Join(',', readingQuestionList.Select(x => x.QuestionName))}的答案为空或未保存");
|
throw new BusinessValidationFailedException($" 必填问题{ string.Join(',', readingQuestionList.Select(x => x.QuestionName))}的答案为空或未保存");
|
||||||
}
|
}
|
||||||
|
|
||||||
await _readingCalculateService.VerifyVisitTaskQuestions(inDto);
|
await _readingCalculateService.VerifyVisitTaskQuestions(inDto);
|
||||||
|
@ -1376,18 +1199,6 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
|
|
||||||
await _visitTaskRepository.SaveChangesAsync();
|
await _visitTaskRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
||||||
//基于业务场景发送邮件
|
|
||||||
|
|
||||||
//await _trialEmailNoticeConfigService.BaseBusinessScenarioSendEmailAsync( visitTaskId);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue