diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index f9c0576a8..51d2273ca 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -1155,162 +1155,8 @@ namespace IRaCIS.Application.Services } #endregion - #region 获取阅片非Dicom文件 - /// - /// 获取阅片非Dicom文件 - /// - /// - /// - [HttpPost] - public async Task<(List, object)> GetReadingImageFile(GetReadingImgInDto inDto) - { - var task = await GetNextTask(new GetNextTaskInDto() - { - TrialId = inDto.TrialId, - SubjectId = inDto.SubjectId, - VisistTaskId = inDto.VisistTaskId, - }); - List visitIds = new List(); - if (task.ReadingCategory == ReadingCategory.Visit) - { - visitIds.Add(task.VisistId); - } - else - { - // 阅片期取前面所有的图像 - visitIds.AddRange(await _subjectVisitRepository.Where(x => x.VisitNum <= task.VisitNum && x.SubjectId == task.SubjectId).Select(x => x.Id).ToListAsync()); - } - List result = await _noneDicomStudyRepository.Where(t => visitIds.Contains(t.SubjectVisitId)) - .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken }).ToListAsync(); - - var taskinfo=await _visitTaskRepository.Where(x=>x.Id==inDto.VisistTaskId).FirstNotNullAsync(); - - var trialInfo = await _trialRepository.Where(x => x.Id == inDto.TrialId).Select(x => new - { - x.ClinicalInformationTransmissionEnum, - }).FirstOrDefaultAsync(); - - - var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskinfo.TrialReadingCriterionId).Select(x => new - { - x.IsReadingShowPreviousResults, - x.IsReadingShowSubjectInfo, - x.CriterionName, - x.Id, - x.ReadingTool, - - }).FirstOrDefaultAsync(); - - - bool isExistsClinicalData = false; - if (trialInfo.ClinicalInformationTransmissionEnum == 1) - { - isExistsClinicalData = (await _readingClinicalDataService.GetClinicalDataList(new GetReadingOrTaskClinicalDataListInDto() - { - - SubjectId = task.SubjectId, - TrialId = inDto.TrialId, - VisitTaskId = task.VisitTaskId, - })).Count() > 0; - } - - - var taskInfo = await _visitTaskRepository.Where(x => x.Id == task.VisitTaskId).FirstNotNullAsync(); - - return (result, new - { - VisitTaskId = task.VisitTaskId, - SubjectId = task.SubjectId, - SubjectCode = taskInfo.BlindSubjectCode.IsNullOrEmpty() ? task.SubjectCode : taskInfo.BlindSubjectCode, - ReadingCategory = task.ReadingCategory, - TaskBlindName = task.TaskBlindName, - IsReadingShowPreviousResults = criterionInfo.IsReadingShowPreviousResults, - IsReadingShowSubjectInfo = criterionInfo.IsReadingShowSubjectInfo, - IsExistsClinicalData = isExistsClinicalData, - TrialCriterionName= criterionInfo.CriterionName, - TrialCriterionId = criterionInfo.Id - - }); - } - #endregion - - #region 找子问题 - /// - /// 找子问题 - /// - /// - /// - /// - [NonDynamicMethod] - public void FindChildQuestion(GetTrialReadingQuestionOutDto item, List questionlists, List tableQuestions) - { - item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == ReadingQestionType.Group && x.Type != ReadingQestionType.Group && x.ParentId == null && x.GroupName == item.GroupName)).ToList(); - - - item.Childrens.AddRange(tableQuestions.Where(x => x.ReadingQuestionId == item.Id).Select(x => new GetTrialReadingQuestionOutDto - { - Childrens = new List(), - ShowOrder = x.ShowOrder, - GroupName = string.Empty, - Id = x.Id, - Type = x.Type, - DictionaryCode=x.DictionaryCode, - TableQuestionType = x.TableQuestionType, - DependParentId = x.DependParentId, - IsDepend = x.IsDepend, - QuestionMark = x.QuestionMark, - QuestionGenre=x.QuestionGenre, - TypeValue = x.TypeValue, - RelevanceId = x.RelevanceId, - IsRequired = x.IsRequired, - RelevanceValue = x.RelevanceValue, - ImageCount = 0, - ParentId = item.Id, - DataTableColumn = x.DataTableColumn, - LesionType = item.LesionType, - QuestionName = x.QuestionName, - RelationQuestions = tableQuestions.Where(z => (z.DependParentId ?? default(Guid)) == x.Id).Select(x => new GetTrialReadingQuestionOutDto - { - Childrens = new List(), - ShowOrder = x.ShowOrder, - GroupName = string.Empty, - Id = x.Id, - Type = x.Type, - QuestionGenre=x.QuestionGenre, - TableQuestionType = x.TableQuestionType, - DependParentId = x.DependParentId, - DictionaryCode = x.DictionaryCode, - IsDepend = x.IsDepend, - QuestionMark = x.QuestionMark, - TypeValue = x.TypeValue, - RelevanceId = x.RelevanceId, - RelevanceValue = x.RelevanceValue, - ImageCount = 0, - ParentId = item.Id, - DataTableColumn = x.DataTableColumn, - LesionType = item.LesionType, - QuestionName = x.QuestionName, - RelationQuestions = new List(), - Remark = x.Remark, - - }).ToList(), - Remark = x.Remark, - - })); - if (item.Childrens != null && item.Childrens.Count != 0) - { - item.Childrens.ForEach(x => - { - this.FindChildQuestion(x, questionlists, tableQuestions); - }); - } - } - - - #endregion - #region 阅片任务 提交填写表单 @@ -1480,21 +1326,7 @@ namespace IRaCIS.Application.Services return result; } - /// - /// 提交访视阅片问题 - /// - /// - /// - [NonDynamicMethod] - public async Task SubmitVisitTaskQuestions(SubmitVisitTaskQuestionsInDto inDto) - { - await VerifyTaskIsSign(inDto.VisitTaskId); - await this.SaveVisitTaskQuestions(inDto); - - - await this.SubmitTaskChangeState(inDto.VisitTaskId); - return ResponseOutput.Ok(true); - } + /// /// 提交Dicom阅片信息 diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingNoDicomTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingNoDicomTaskService.cs new file mode 100644 index 000000000..f81cdf29e --- /dev/null +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingNoDicomTaskService.cs @@ -0,0 +1,194 @@ +using IRaCIS.Core.Domain.Share; +using Microsoft.AspNetCore.Mvc; +using IRaCIS.Core.Application.Service.Reading.Dto; +using MassTransit; +using IRaCIS.Core.Infra.EFCore.Common; +using Panda.DynamicWebApi.Attributes; +using AutoMapper; +using IRaCIS.Core.Application.Contracts; +using IRaCIS.Core.Infrastructure; +using Newtonsoft.Json; +using IRaCIS.Core.Application.Service; +using IRaCIS.Core.Application.ViewModel; + +namespace IRaCIS.Application.Services +{ + + /// + /// 非Dicom + /// + public partial class ReadingImageTaskService : BaseService, IReadingImageTaskService + { + /// + /// 提交访视阅片问题 + /// + /// + /// + [NonDynamicMethod] + public async Task SubmitVisitTaskQuestions(SubmitVisitTaskQuestionsInDto inDto) + { + await VerifyTaskIsSign(inDto.VisitTaskId); + await this.SaveVisitTaskQuestions(inDto); + + + await this.SubmitTaskChangeState(inDto.VisitTaskId); + return ResponseOutput.Ok(true); + } + + #region 获取阅片非Dicom文件 + /// + /// 获取阅片非Dicom文件 + /// + /// + /// + [HttpPost] + public async Task<(List, object)> GetReadingImageFile(GetReadingImgInDto inDto) + { + var task = await GetNextTask(new GetNextTaskInDto() + { + TrialId = inDto.TrialId, + SubjectId = inDto.SubjectId, + VisistTaskId = inDto.VisistTaskId, + }); + List visitIds = new List(); + if (task.ReadingCategory == ReadingCategory.Visit) + { + visitIds.Add(task.VisistId); + } + else + { + // 阅片期取前面所有的图像 + visitIds.AddRange(await _subjectVisitRepository.Where(x => x.VisitNum <= task.VisitNum && x.SubjectId == task.SubjectId).Select(x => x.Id).ToListAsync()); + } + List result = await _noneDicomStudyRepository.Where(t => visitIds.Contains(t.SubjectVisitId)) + .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken }).ToListAsync(); + + var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisistTaskId).FirstNotNullAsync(); + + var trialInfo = await _trialRepository.Where(x => x.Id == inDto.TrialId).Select(x => new + { + x.ClinicalInformationTransmissionEnum, + }).FirstOrDefaultAsync(); + + + var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskinfo.TrialReadingCriterionId).Select(x => new + { + x.IsReadingShowPreviousResults, + x.IsReadingShowSubjectInfo, + x.CriterionName, + x.Id, + x.ReadingTool, + + }).FirstOrDefaultAsync(); + + + bool isExistsClinicalData = false; + if (trialInfo.ClinicalInformationTransmissionEnum == 1) + { + isExistsClinicalData = (await _readingClinicalDataService.GetClinicalDataList(new GetReadingOrTaskClinicalDataListInDto() + { + + SubjectId = task.SubjectId, + TrialId = inDto.TrialId, + VisitTaskId = task.VisitTaskId, + })).Count() > 0; + } + + + var taskInfo = await _visitTaskRepository.Where(x => x.Id == task.VisitTaskId).FirstNotNullAsync(); + + return (result, new + { + VisitTaskId = task.VisitTaskId, + SubjectId = task.SubjectId, + SubjectCode = taskInfo.BlindSubjectCode.IsNullOrEmpty() ? task.SubjectCode : taskInfo.BlindSubjectCode, + ReadingCategory = task.ReadingCategory, + TaskBlindName = task.TaskBlindName, + IsReadingShowPreviousResults = criterionInfo.IsReadingShowPreviousResults, + IsReadingShowSubjectInfo = criterionInfo.IsReadingShowSubjectInfo, + IsExistsClinicalData = isExistsClinicalData, + TrialCriterionName = criterionInfo.CriterionName, + TrialCriterionId = criterionInfo.Id + + }); + } + #endregion + + + + #region 找子问题 + /// + /// 找子问题 + /// + /// + /// + /// + [NonDynamicMethod] + public void FindChildQuestion(GetTrialReadingQuestionOutDto item, List questionlists, List tableQuestions) + { + item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == ReadingQestionType.Group && x.Type != ReadingQestionType.Group && x.ParentId == null && x.GroupName == item.GroupName)).ToList(); + + + item.Childrens.AddRange(tableQuestions.Where(x => x.ReadingQuestionId == item.Id).Select(x => new GetTrialReadingQuestionOutDto + { + Childrens = new List(), + ShowOrder = x.ShowOrder, + GroupName = string.Empty, + Id = x.Id, + Type = x.Type, + DictionaryCode = x.DictionaryCode, + TableQuestionType = x.TableQuestionType, + DependParentId = x.DependParentId, + IsDepend = x.IsDepend, + QuestionMark = x.QuestionMark, + QuestionGenre = x.QuestionGenre, + TypeValue = x.TypeValue, + RelevanceId = x.RelevanceId, + IsRequired = x.IsRequired, + RelevanceValue = x.RelevanceValue, + ImageCount = 0, + ParentId = item.Id, + DataTableColumn = x.DataTableColumn, + LesionType = item.LesionType, + QuestionName = x.QuestionName, + RelationQuestions = tableQuestions.Where(z => (z.DependParentId ?? default(Guid)) == x.Id).Select(x => new GetTrialReadingQuestionOutDto + { + Childrens = new List(), + ShowOrder = x.ShowOrder, + GroupName = string.Empty, + Id = x.Id, + Type = x.Type, + QuestionGenre = x.QuestionGenre, + TableQuestionType = x.TableQuestionType, + DependParentId = x.DependParentId, + DictionaryCode = x.DictionaryCode, + IsDepend = x.IsDepend, + QuestionMark = x.QuestionMark, + TypeValue = x.TypeValue, + RelevanceId = x.RelevanceId, + RelevanceValue = x.RelevanceValue, + ImageCount = 0, + ParentId = item.Id, + DataTableColumn = x.DataTableColumn, + LesionType = item.LesionType, + QuestionName = x.QuestionName, + RelationQuestions = new List(), + Remark = x.Remark, + + }).ToList(), + Remark = x.Remark, + + })); + if (item.Childrens != null && item.Childrens.Count != 0) + { + item.Childrens.ForEach(x => + { + this.FindChildQuestion(x, questionlists, tableQuestions); + }); + } + } + + + #endregion + } +} diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs index f7adcd7d6..b92c1fd1a 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs @@ -137,7 +137,6 @@ namespace IRaCIS.Core.Application public async Task GetCriterionReadingInfo(GetTrialReadingInfoInDto inDto) { - var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).FirstNotNullAsync(); if (trialCriterion.SynchronizeOriginalTime == null && trialCriterion.ReadingQuestionCriterionSystemId != null) { @@ -173,15 +172,14 @@ namespace IRaCIS.Core.Application [HttpPost] public async Task GetOncologySet(GetOncologySetInDto inDto) { - + var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).FirstOrDefaultAsync(); - return new GetOncologySetOutDto { EvaluationReason = trialCriterion.EvaluationReason.IsNullOrEmpty()? ReadingCommon.EvaluationReason : trialCriterion.EvaluationReason, OncologyAssessIds = await _readingCriterionDictionaryRepository.Where(x => x.CriterionId == inDto.TrialReadingCriterionId && x.ParentCode == "OncologyAssess").Select(x => x.DictionaryId).ToListAsync(), - IsSystemCriterion= trialCriterion.ReadingQuestionCriterionSystemId!=null, + IsSystemCriterion= trialCriterion.ReadingQuestionCriterionSystemId!=null, IsSign = trialCriterion.ReadingInfoSignTime != null, }; }