diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 62dcea97d..6934ed6bb 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -8462,6 +8462,13 @@ + + + 一键添加默认医学审核问题 + + + + 从系统里面选择问题添加到项目里面 diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingMedicineQuestionViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingMedicineQuestionViewModel.cs index e2e9128a2..730a1fec2 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingMedicineQuestionViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingMedicineQuestionViewModel.cs @@ -91,7 +91,16 @@ namespace IRaCIS.Core.Application.ViewModel { public Guid SystemQuestionId { get; set; } } - public class AddTrialDataFromSystemInDto + + public class AddDefaultQuestionsInDto + { + public Guid TrialId { get; set; } + + [NotDefault] + public Guid TrialReadingCriterionId { get; set; } + } + + public class AddTrialDataFromSystemInDto { public Guid TrialId { get; set; } diff --git a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs index a82e5e672..31252ff65 100644 --- a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs @@ -6,6 +6,8 @@ using IRaCIS.Core.Infrastructure; using IRaCIS.Core.Application.Contracts; using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Application.Filter; +using DocumentFormat.OpenXml.Office2010.Excel; +using System.Linq.Dynamic.Core; namespace IRaCIS.Core.Application.Service { @@ -491,13 +493,86 @@ namespace IRaCIS.Core.Application.Service return ResponseOutput.Result(true); } + /// + /// 一键添加默认医学审核问题 + /// + /// + /// + [HttpPost] + public async Task AddDefaultQuestions(AddDefaultQuestionsInDto inDto) + { + if (await _readingMedicineTrialQuestionRepository.AnyAsync(x => x.TrialReadingCriterionId == inDto.TrialReadingCriterionId)) + { + throw new BusinessValidationFailedException(_localizer["Medicine_ExistsMedicineQuestion"]); + } + var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).FirstNotNullAsync(); + List needAddCategory = new List() { ReadingCategory.Visit }; + if(criterionInfo.IsReadingPeriod) + { + needAddCategory.Add(ReadingCategory.Global); + } + if (criterionInfo.IsArbitrationReading) + { + needAddCategory.Add(ReadingCategory.Judge); + } + if (criterionInfo.IsOncologyReading) + { + needAddCategory.Add(ReadingCategory.Oncology); + } - /// - /// 从系统里面选择问题添加到项目里面 - /// - /// - /// - [HttpPost] + var maxOrder = await _readingMedicineTrialQuestionRepository.Where(x => x.TrialId == inDto.TrialId && x.TrialReadingCriterionId == inDto.TrialReadingCriterionId).OrderByDescending(x => x.ShowOrder).Select(x => x.ShowOrder).FirstOrDefaultAsync(); + List needList = await _readingMedicineSystemQuestionRepository + .WhereIf(_userInfo.IsEn_Us, x => x.LanguageType == LanguageType.English) + .WhereIf(!_userInfo.IsEn_Us, x => x.LanguageType == LanguageType.Chinese) + .Where(x => x.CriterionTypeEnum == criterionInfo.CriterionType && needAddCategory.Contains(x.ReadingCategory)) + .Select(x => new TrialDataFromSystem() + { + Id = NewId.NextGuid(), + ShowOrder = x.ShowOrder, + IsEnable = x.IsEnable, + LanguageType = x.LanguageType, + IsRequired = x.IsRequired, + QuestionName = x.QuestionName, + TrialReadingCriterionId = inDto.TrialReadingCriterionId, + Type = x.Type, + ParentId = x.ParentId, + SystemQuestionId = x.Id, + ReadingCategory = x.ReadingCategory, + TypeValue = x.TypeValue, + TrialId = inDto.TrialId, + }).ToListAsync(); + + needList.ForEach(x => { + maxOrder++; + x.ShowOrder = maxOrder; + }); + + foreach (var item in needList.Where(x => x.ParentId != null)) + { + var parent = needList.Where(x => x.SystemQuestionId == item.ParentId).FirstOrDefault(); + if (parent == null) + { + item.ParentId = null; + item.ParentTriggerValue = String.Empty; + } + else + { + item.ParentId = parent.Id; + } + } + + await _readingMedicineTrialQuestionRepository.AddRangeAsync(_mapper.Map>(needList)); + var result = await _readingMedicineTrialQuestionRepository.SaveChangesAsync(); + return ResponseOutput.Result(result); + + } + + /// + /// 从系统里面选择问题添加到项目里面 + /// + /// + /// + [HttpPost] public async Task AddTrialDataFromSystem(AddTrialDataFromSystemInDto inDto) { // 直接写?? diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index d99d8d493..c80d3e13e 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -1756,9 +1756,9 @@ namespace IRaCIS.Application.Services { await VerifyTaskIsSign(inDto.VisitTaskId); + var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync(); - - var deleteRowInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.Id == inDto.RowId).FirstOrDefaultAsync(); + var deleteRowInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.Id == inDto.RowId).FirstOrDefaultAsync(); if (deleteRowInfo == null) { @@ -1903,7 +1903,23 @@ namespace IRaCIS.Application.Services VisitTaskId = inDto.VisitTaskId, ComputationTrigger=ComputationTrigger.Lesion, }); - return ResponseOutput.Ok(true); + + + switch (taskinfo.TrialReadingCriterion.CriterionType) + { + case CriterionType.Lugano2014: + if (deleteRowInfo.RowIndex % 1 != 0) + { + await _luganoCalculateService.CalculateTargetLesionStatus(new CalculateTargetLesionStatusInDto() + { + QuestionId = inDto.QuestionId, + VisitTaskId = inDto.VisitTaskId, + RowNumber = deleteRowInfo.RowIndex + }); + } + break; + } + return ResponseOutput.Ok(true); } diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs index 57a6dce9a..5b6489826 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs @@ -1094,6 +1094,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate ); } + await _readingTableQuestionAnswerRepository.SaveChangesAsync(); } }