From 93b74ccef3fdf7b029b2f5cdc2f720d11b711eab Mon Sep 17 00:00:00 2001
From: he <10978375@qq.com>
Date: Fri, 12 Aug 2022 16:39:44 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Reading/ReadingMedicineQuestionService.cs | 62 +++++++++++++++++--
1 file changed, 58 insertions(+), 4 deletions(-)
diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingMedicineQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingMedicineQuestionService.cs
index cdf51ec42..7cc34a1bc 100644
--- a/IRaCIS.Core.Application/Service/Reading/ReadingMedicineQuestionService.cs
+++ b/IRaCIS.Core.Application/Service/Reading/ReadingMedicineQuestionService.cs
@@ -305,13 +305,16 @@ namespace IRaCIS.Core.Application.Service
///
- /// 确认医学审核问题
+ /// 验证医学审核问题
///
+ ///
///
- public async Task ConfirmReadingMedicineQuestion(ConfirmReadingMedicineQuestionInDto inDto)
+ ///
+ public async Task VerifyReadingMedicineQuestion(ConfirmReadingMedicineQuestionInDto inDto)
{
var readingMedicineQuestionList = await _readingMedicineTrialQuestionRepository.Where(x => x.TrialId == inDto.TrialId)
- .Select(x => new TrialQuestion() {
+ .Select(x => new TrialQuestion()
+ {
Id = x.Id,
ReadingCategory = x.ReadingCategory,
ParentShowOrder = (int?)x.ParentQuestion.ShowOrder,
@@ -341,7 +344,7 @@ namespace IRaCIS.Core.Application.Service
throw new BusinessValidationFailedException("当前项目启用了全局阅片,但未配置全局医学审核问题");
}
- if (trialInfo.IsArbitrationReading??false && !readingMedicineQuestionList.Any(x => x.ReadingCategory == ReadingCategory.Judge))
+ if (trialInfo.IsArbitrationReading ?? false && !readingMedicineQuestionList.Any(x => x.ReadingCategory == ReadingCategory.Judge))
{
throw new BusinessValidationFailedException("当前项目启用了仲裁阅片,但未配置仲裁医学审核问题");
}
@@ -351,6 +354,57 @@ namespace IRaCIS.Core.Application.Service
throw new BusinessValidationFailedException("当前项目启用了肿瘤学阅片,但未配置肿瘤学医学审核问题");
}
+ return ResponseOutput.Ok();
+
+ }
+
+ ///
+ /// 确认医学审核问题
+ ///
+ ///
+ public async Task ConfirmReadingMedicineQuestion(ConfirmReadingMedicineQuestionInDto inDto)
+ {
+ var readingMedicineQuestionList = await _readingMedicineTrialQuestionRepository.Where(x => x.TrialId == inDto.TrialId)
+ .Select(x => new TrialQuestion()
+ {
+ Id = x.Id,
+ ReadingCategory = x.ReadingCategory,
+ ParentShowOrder = (int?)x.ParentQuestion.ShowOrder,
+ ShowOrder = x.ShowOrder,
+ }).ToListAsync();
+ if (readingMedicineQuestionList.Count == 0)
+ {
+ throw new BusinessValidationFailedException("当前未添加医学审核问题。请先添加医学审核问题,再进行确认。");
+ }
+
+ if (readingMedicineQuestionList.Count() != readingMedicineQuestionList.Select(t => t.ShowOrder).Distinct().Count())
+ {
+ throw new BusinessValidationFailedException("影像医学审核问题显示序号不能重复。");
+ }
+
+
+ if (readingMedicineQuestionList.Where(t => t.ParentShowOrder != null).Any(t => t.ParentShowOrder > t.ShowOrder))
+ {
+ throw new BusinessValidationFailedException("父问题的显示序号要比子问题的显示序号小,请确认。");
+ }
+
+
+ var trialInfo = await _trialRepository.Where(x => x.Id == inDto.TrialId).FirstNotNullAsync();
+
+ if (trialInfo.IsGlobalReading && !readingMedicineQuestionList.Any(x => x.ReadingCategory == ReadingCategory.Global))
+ {
+ throw new BusinessValidationFailedException("当前项目启用了全局阅片,但未配置全局医学审核问题");
+ }
+
+ if (trialInfo.IsArbitrationReading ?? false && !readingMedicineQuestionList.Any(x => x.ReadingCategory == ReadingCategory.Judge))
+ {
+ throw new BusinessValidationFailedException("当前项目启用了仲裁阅片,但未配置仲裁医学审核问题");
+ }
+
+ if (trialInfo.IsClinicalReading && !readingMedicineQuestionList.Any(x => x.ReadingCategory == ReadingCategory.Oncology))
+ {
+ throw new BusinessValidationFailedException("当前项目启用了肿瘤学阅片,但未配置肿瘤学医学审核问题");
+ }
await _readingMedicineTrialQuestionRepository.BatchUpdateNoTrackingAsync(x => x.TrialId == inDto.TrialId, x => new ReadingMedicineTrialQuestion()