diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 79a8da350..eaea5299b 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -4388,86 +4388,132 @@ - + 获取获取系统阅片标准下拉 - + 获取系统问题标准 - + 获取系统问题标准下拉 - + 新增修改系统问题标准 - + 删除系统问题标准 - + 设置系统问题标准是否完成配置 - + 获取项目裁判信息 - + 新增修改项目问题标准(项目) - + 设置项目标准是否完成配置 - + 获取项目问题标准(项目) - + 删除项目问题标准(项目) - + 设置项目裁判信息 + + + 新增修改项目标准分页 + + + + + + + 删除标准分页 + + + + + + + 添加系统数据到项目里面 + + + + + + 获取疗效对照 + + + + + + 获取疗效对照 + + + + + + 新增修改疗效对照 + + + + + + + 删除疗效对照 + + + + 项目外部人员 录入流程相关 @@ -6159,21 +6205,11 @@ 是否显示详情 - - - 评估结果 - - 评估原因 - - - 是否显示详情 - - 表单类型 @@ -7069,34 +7105,6 @@ - - - 删除项目字典 - - - - - - - 获取待添加的项目字典数据 - - - - - - - 批量添加项目字典 - - - - - - - 获取项目字典 - - - - 获取子项数组 @@ -8257,6 +8265,20 @@ 阅片问题.标准 + + + 获取标准字典 + + + + + + + 设置标准字典 + + + + 获取系统问题分组 @@ -8381,52 +8403,13 @@ - - - 新增修改项目标准分页 - - - - - - - 删除标准分页 - - - - - - - 获取疗效对照 - - - - - - 获取疗效对照 - - - - - - 新增修改疗效对照 - - - - - - - 删除疗效对照 - - - - 复制一个系统标准到另一系统标准 + diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs index d7da1fefe..0026b0ff0 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs @@ -1,372 +1,376 @@ -//using Microsoft.AspNetCore.Mvc; -//using IRaCIS.Core.Application.Interfaces; -//using IRaCIS.Core.Application.ViewModel; -//using IRaCIS.Core.Infra.EFCore.Common; -//using MassTransit; -//using IRaCIS.Core.Infrastructure; -//using IRaCIS.Core.Domain.Share; -//using IRaCIS.Core.Application.Service.Reading.Dto; -//using Panda.DynamicWebApi.Attributes; +using Microsoft.AspNetCore.Mvc; +using IRaCIS.Core.Application.Interfaces; +using IRaCIS.Core.Application.ViewModel; +using IRaCIS.Core.Infra.EFCore.Common; +using MassTransit; +using IRaCIS.Core.Infrastructure; +using IRaCIS.Core.Domain.Share; +using IRaCIS.Core.Application.Service.Reading.Dto; +using Panda.DynamicWebApi.Attributes; -//namespace IRaCIS.Core.Application.Service -//{ +namespace IRaCIS.Core.Application.Service.RC +{ -// [ApiExplorerSettings(GroupName = "Reading")] -// public class ReadingQuestionService : BaseService -// { + [ApiExplorerSettings(GroupName = "Reading")] + public class ReadingQuestionService : BaseService + { -// //private readonly IRepository _subjectVisitRepository; -// private readonly IRepository _readingQuestionCriterionSystemRepository; -// private readonly IRepository _readingQuestionCriterionTrialRepository; -// //private readonly IRepository _readingQuestionSystemRepository; -// private readonly IRepository _readingQuestionTrialRepository; -// //private readonly IRepository _clinicalDataTrialSetRepository; -// //private readonly IRepository _clinicalDataSystemSetRepository; -// //private readonly IRepository _dictionaryRepository; -// //private readonly IRepository _readingTableQuestionTrialRepository; -// //private readonly IRepository _readingCriterionPageRepository; -// //private readonly IRepository _trialRepository; -// //private readonly IRepository _tumorAssessmentRepository; -// //private readonly IRepository _organInfoRepository; -// //private readonly IRepository _readingTableQuestionSystemRepository; -// private readonly IRepository _readingTaskQuestionAnswer; -// //private readonly IRepository _previousPDFRepository; - -// public ReadingQuestionService( -// IRepository readingQuestionCriterionSystemRepository, -// IRepository readingQuestionCriterionTrialRepository, -// //IRepository readingQuestionSystemRepository, -// IRepository readingQuestionTrialRepository, -// //IRepository ClinicalDataTrialSetRepository, -// //IRepository ClinicalDataSystemSetRepository, -// //IRepository dictionaryRepository, -// //IRepository readingTableQuestionTrialRepository, -// //IRepository readingCriterionPageRepository, -// //IRepository trialRepository, -// //IRepository tumorAssessmentRepository, -// //IRepository organInfoRepository, -// //IRepository readingTableQuestionSystemRepository, -// IRepository readingTaskQuestionAnswer -// //IRepository previousPDFRepository -// //IRepository subjectVisitRepository, - -// ) -// { -// //this._subjectVisitRepository = subjectVisitRepository; -// this._readingQuestionCriterionSystemRepository = readingQuestionCriterionSystemRepository; -// this._readingQuestionCriterionTrialRepository = readingQuestionCriterionTrialRepository; -// //this._readingQuestionSystemRepository = readingQuestionSystemRepository; -// this._readingQuestionTrialRepository = readingQuestionTrialRepository; -// //this._clinicalDataTrialSetRepository = ClinicalDataTrialSetRepository; -// //this._clinicalDataSystemSetRepository = ClinicalDataSystemSetRepository; -// //this._dictionaryRepository = dictionaryRepository; -// //this._readingTableQuestionTrialRepository = readingTableQuestionTrialRepository; -// //this._readingCriterionPageRepository = readingCriterionPageRepository; -// //this._trialRepository = trialRepository; -// //this._tumorAssessmentRepository = tumorAssessmentRepository; -// //this._organInfoRepository = organInfoRepository; -// //this._readingTableQuestionSystemRepository = readingTableQuestionSystemRepository; -// this._readingTaskQuestionAnswer = readingTaskQuestionAnswer; -// //this._previousPDFRepository = previousPDFRepository; -// } + private readonly IRepository _readingQuestionCriterionSystemRepository; + private readonly IRepository _readingQuestionCriterionTrialRepository; + private readonly IRepository _readingQuestionTrialRepository; -// #region 系统标准 -// /// -// /// 获取获取系统阅片标准下拉 -// /// -// /// -// [HttpPost] -// public async Task> GetSystemCriterionList() -// { -// List result = await _readingQuestionCriterionSystemRepository.Select(x => new GetSystemCriterionListOutDto() -// { + private readonly IRepository _readingTaskQuestionAnswer; + private readonly IRepository _readingCriterionPageRepository; -// CriterionId = x.Id, -// CriterionName = x.CriterionName, - -// }).ToListAsync(); - -// return result; -// } - -// /// -// /// 获取系统问题标准 -// /// -// /// -// [HttpPost] -// public async Task> GetReadingQuestionCriterionSystemList(ReadingQuestionCriterionSystemViewInDto inDto) -// { -// //await AddSystemQuestionCriterion(); -// var query = _readingQuestionCriterionSystemRepository.AsQueryable() -// .WhereIf(!inDto.CriterionName.IsNullOrEmpty(), x => x.CriterionName.Contains(inDto.CriterionName)) -// .ProjectTo(_mapper.ConfigurationProvider); - -// return await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField.IsNullOrEmpty() ? nameof(ReadingQuestionCriterionSystemView.ShowOrder) : inDto.SortField, -// inDto.Asc); -// } - -// /// -// /// 获取系统问题标准下拉 -// /// -// /// -// [HttpPost] -// public async Task> GetSystemCriterionSelectList() -// { -// var criterionList = await _readingQuestionCriterionSystemRepository.AsQueryable() -// .OrderBy(x => x.ShowOrder) -// .Select(x => new GetSystemCriterionSelectDto() -// { -// Id = x.Id, -// CriterionName = x.CriterionName, - -// }).ToListAsync(); -// return criterionList; -// } - -// /// -// /// 新增修改系统问题标准 -// /// -// /// -// /// -// [HttpPost] -// public async Task AddOrUpdateReadingQuestionCriterionSystem(AddOrUpdateReadingQuestionCriterionSystemInDto indto) -// { -// var entity = await _readingQuestionCriterionSystemRepository.InsertOrUpdateAsync(indto, true); - -// if (indto.Id != null) -// { -// await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(x => x.ReadingQuestionCriterionSystemId == indto.Id, x => new ReadingQuestionCriterionTrial() -// { -// CriterionName = indto.CriterionName, -// CriterionType = indto.CriterionType, - -// }); -// } -// return ResponseOutput.Ok(entity.Id.ToString()); -// } - -// /// -// /// 删除系统问题标准 -// /// -// /// -// /// -// [HttpDelete("{id:guid}")] -// public async Task DeleteReadingQuestionCriterionSystem(Guid id) -// { + public ReadingQuestionService( + IRepository readingQuestionCriterionSystemRepository, + IRepository readingQuestionCriterionTrialRepository, + IRepository readingQuestionTrialRepository, + IRepository readingTaskQuestionAnswer, + IRepository readingCriterionPageRepository -// if (await _readingQuestionCriterionTrialRepository.AnyAsync(x => x.IsConfirm && x.ReadingQuestionCriterionSystemId == id)) -// { -// throw new BusinessValidationFailedException("当前标准被引用过了,不可以删除"); -// } + ) + { + this._readingQuestionCriterionSystemRepository = readingQuestionCriterionSystemRepository; + this._readingQuestionCriterionTrialRepository = readingQuestionCriterionTrialRepository; + this._readingQuestionTrialRepository = readingQuestionTrialRepository; -// await _readingQuestionCriterionSystemRepository.DeleteFromQueryAsync(t => t.Id == id); -// var success = await _readingQuestionCriterionSystemRepository.SaveChangesAsync(); -// return ResponseOutput.Result(success); -// } + this._readingCriterionPageRepository = readingCriterionPageRepository; + + this._readingTaskQuestionAnswer = readingTaskQuestionAnswer; + } + + + #region 系统标准 + /// + /// 获取获取系统阅片标准下拉 + /// + /// + [HttpPost] + public async Task> GetSystemCriterionList() + { + List result = await _readingQuestionCriterionSystemRepository.Select(x => new GetSystemCriterionListOutDto() + { + + CriterionId = x.Id, + CriterionName = x.CriterionName, + + }).ToListAsync(); + + return result; + } + + /// + /// 获取系统问题标准 + /// + /// + [HttpPost] + public async Task> GetReadingQuestionCriterionSystemList(ReadingQuestionCriterionSystemViewInDto inDto) + { + //await AddSystemQuestionCriterion(); + var query = _readingQuestionCriterionSystemRepository.AsQueryable() + .WhereIf(!inDto.CriterionName.IsNullOrEmpty(), x => x.CriterionName.Contains(inDto.CriterionName)) + .ProjectTo(_mapper.ConfigurationProvider); + + return await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField.IsNullOrEmpty() ? nameof(ReadingQuestionCriterionSystemView.ShowOrder) : inDto.SortField, + inDto.Asc); + } + + /// + /// 获取系统问题标准下拉 + /// + /// + [HttpPost] + public async Task> GetSystemCriterionSelectList() + { + var criterionList = await _readingQuestionCriterionSystemRepository.AsQueryable() + .OrderBy(x => x.ShowOrder) + .Select(x => new GetSystemCriterionSelectDto() + { + Id = x.Id, + CriterionName = x.CriterionName, + + }).ToListAsync(); + return criterionList; + } + + /// + /// 新增修改系统问题标准 + /// + /// + /// + [HttpPost] + public async Task AddOrUpdateReadingQuestionCriterionSystem(AddOrUpdateReadingQuestionCriterionSystemInDto indto) + { + var entity = await _readingQuestionCriterionSystemRepository.InsertOrUpdateAsync(indto, true); + + if (indto.Id != null) + { + await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(x => x.ReadingQuestionCriterionSystemId == indto.Id, x => new ReadingQuestionCriterionTrial() + { + CriterionName = indto.CriterionName, + CriterionType = indto.CriterionType, + + }); + } + return ResponseOutput.Ok(entity.Id.ToString()); + } + + /// + /// 删除系统问题标准 + /// + /// + /// + [HttpDelete("{id:guid}")] + public async Task DeleteReadingQuestionCriterionSystem(Guid id) + { + + + if (await _readingQuestionCriterionTrialRepository.AnyAsync(x => x.IsConfirm && x.ReadingQuestionCriterionSystemId == id)) + { + throw new BusinessValidationFailedException("当前标准被引用过了,不可以删除"); + } + + await _readingQuestionCriterionSystemRepository.DeleteFromQueryAsync(t => t.Id == id); + var success = await _readingQuestionCriterionSystemRepository.SaveChangesAsync(); + return ResponseOutput.Result(success); + } -// /// -// /// 设置系统问题标准是否完成配置 -// /// -// /// -// /// -// public async Task SetSystemReadingQuestionCriterionIsCompleteConfig(SetSystemReadingQuestionCriterionIsIsCompleteConfig inDto) -// { + /// + /// 设置系统问题标准是否完成配置 + /// + /// + /// + public async Task SetSystemReadingQuestionCriterionIsCompleteConfig(SetSystemReadingQuestionCriterionIsIsCompleteConfig inDto) + { -// if (!inDto.IsCompleteConfig) -// { -// var trialCriterionIds = await _readingQuestionCriterionTrialRepository.Where(x => x.ReadingQuestionCriterionSystemId == inDto.Id).Select(x => x.Id).ToListAsync(); -// if (await _readingTaskQuestionAnswer.AnyAsync(x => trialCriterionIds.Contains(x.ReadingQuestionCriterionTrialId))) -// { -// return ResponseOutput.NotOk("此标准在项目里面已被使用,操作失败"); -// } -// } + if (!inDto.IsCompleteConfig) + { + var trialCriterionIds = await _readingQuestionCriterionTrialRepository.Where(x => x.ReadingQuestionCriterionSystemId == inDto.Id).Select(x => x.Id).ToListAsync(); + if (await _readingTaskQuestionAnswer.AnyAsync(x => trialCriterionIds.Contains(x.ReadingQuestionCriterionTrialId))) + { + return ResponseOutput.NotOk("此标准在项目里面已被使用,操作失败"); + } + } -// var systemCriterion = await _readingQuestionCriterionSystemRepository.Where(x => x.Id == inDto.Id).AsNoTracking().FirstOrDefaultAsync(); + var systemCriterion = await _readingQuestionCriterionSystemRepository.Where(x => x.Id == inDto.Id).AsNoTracking().FirstOrDefaultAsync(); -// var confirmTime = systemCriterion.ConfirmTime; + var confirmTime = systemCriterion.ConfirmTime; -// if (inDto.IsCompleteConfig) -// { -// confirmTime = DateTime.Now; -// } + if (inDto.IsCompleteConfig) + { + confirmTime = DateTime.Now; + } -// await _readingQuestionCriterionSystemRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionSystem() -// { -// IsCompleteConfig = inDto.IsCompleteConfig, -// ConfirmTime = confirmTime, -// }); + await _readingQuestionCriterionSystemRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionSystem() + { + IsCompleteConfig = inDto.IsCompleteConfig, + ConfirmTime = confirmTime, + }); -// if (inDto.IsCompleteConfig) -// { -// //await SynchronizeSystemCriterion(inDto.Id); -// } -// else -// { -// await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(x => x.ReadingQuestionCriterionSystemId == inDto.Id, x => new ReadingQuestionCriterionTrial() -// { -// IsCompleteConfig = inDto.IsCompleteConfig -// }); -// } -// var result = await _readingQuestionCriterionSystemRepository.SaveChangesAsync(); + if (inDto.IsCompleteConfig) + { + //await SynchronizeSystemCriterion(inDto.Id); + } + else + { + await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(x => x.ReadingQuestionCriterionSystemId == inDto.Id, x => new ReadingQuestionCriterionTrial() + { + IsCompleteConfig = inDto.IsCompleteConfig + }); + } + var result = await _readingQuestionCriterionSystemRepository.SaveChangesAsync(); -// return ResponseOutput.Ok(result); -// } + return ResponseOutput.Ok(result); + } -// #endregion + #endregion -// #region 项目标准 + #region 项目标准 -// /// -// /// 获取项目裁判信息 -// /// -// /// -// /// -// [HttpPost] -// public async Task GetTrialJudgyInfo(GetTrialJudgyInfoInDto inDto) -// { -// GetTrialJudgyInfoOutDto result = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).Select(x => new GetTrialJudgyInfoOutDto -// { -// TrialId = x.TrialId, -// IsReadingTaskViewInOrder = x.IsReadingTaskViewInOrder, -// ArbitrationRule = x.ArbitrationRule, -// IsArbitrationReading = x.IsArbitrationReading + /// + /// 获取项目裁判信息 + /// + /// + /// + [HttpPost] + public async Task GetTrialJudgyInfo(GetTrialJudgyInfoInDto inDto) + { + GetTrialJudgyInfoOutDto result = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).Select(x => new GetTrialJudgyInfoOutDto + { + TrialId = x.TrialId, + IsReadingTaskViewInOrder = x.IsReadingTaskViewInOrder, + ArbitrationRule = x.ArbitrationRule, + IsArbitrationReading = x.IsArbitrationReading -// }).FirstNotNullAsync(); + }).FirstNotNullAsync(); -// return result; -// } + return result; + } -// /// -// /// 新增修改项目问题标准(项目) -// /// -// /// -// /// -// [HttpPost] -// public async Task AddOrUpdateReadingQuestionCriterionTrial(AddOrUpdateReadingQuestionCriterionTrialInDto indto) -// { + /// + /// 新增修改项目问题标准(项目) + /// + /// + /// + [HttpPost] + public async Task AddOrUpdateReadingQuestionCriterionTrial(AddOrUpdateReadingQuestionCriterionTrialInDto indto) + { -// var entity = await _readingQuestionCriterionTrialRepository.InsertOrUpdateAsync(indto, true); -// return ResponseOutput.Ok(entity.Id.ToString()); -// } + var entity = await _readingQuestionCriterionTrialRepository.InsertOrUpdateAsync(indto, true); + return ResponseOutput.Ok(entity.Id.ToString()); + } -// /// -// /// 设置项目标准是否完成配置 -// /// -// /// -// /// -// public async Task SetTrialReadingQuestionCriterionIsIsCompleteConfig(SetSystemReadingQuestionCriterionIsIsCompleteConfig inDto) -// { -// await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionTrial() -// { -// IsCompleteConfig = inDto.IsCompleteConfig -// }); + /// + /// 设置项目标准是否完成配置 + /// + /// + /// + public async Task SetTrialReadingQuestionCriterionIsIsCompleteConfig(SetSystemReadingQuestionCriterionIsIsCompleteConfig inDto) + { + await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionTrial() + { + IsCompleteConfig = inDto.IsCompleteConfig + }); -// var result = await _readingQuestionCriterionTrialRepository.SaveChangesAsync(); + var result = await _readingQuestionCriterionTrialRepository.SaveChangesAsync(); -// return ResponseOutput.Ok(result); -// } + return ResponseOutput.Ok(result); + } -// /// -// /// 获取项目问题标准(项目) -// /// -// /// -// [HttpPost] -// public async Task> GetReadingQuestionCriterionTrialList(ReadingQuestionCriterionTrialViewInDto inDto) -// { -// //await AddSystemDataToTrila(inDto.TrialId); -// var query = _readingQuestionCriterionTrialRepository.AsQueryable() -// .Where(x => x.TrialId == inDto.TrialId) -// .Where(x => (x.ReadingQuestionCriterionSystemId != null && x.IsEnable) || x.ReadingQuestionCriterionSystemId == null) -// .WhereIf(!inDto.CriterionName.IsNullOrEmpty(), x => x.CriterionName.Contains(inDto.CriterionName)) + /// + /// 获取项目问题标准(项目) + /// + /// + [HttpPost] + public async Task> GetReadingQuestionCriterionTrialList(ReadingQuestionCriterionTrialViewInDto inDto) + { + //await AddSystemDataToTrila(inDto.TrialId); + var query = _readingQuestionCriterionTrialRepository.AsQueryable() + .Where(x => x.TrialId == inDto.TrialId) + .Where(x => (x.ReadingQuestionCriterionSystemId != null && x.IsEnable) || x.ReadingQuestionCriterionSystemId == null) + .WhereIf(!inDto.CriterionName.IsNullOrEmpty(), x => x.CriterionName.Contains(inDto.CriterionName)) -// .ProjectTo(_mapper.ConfigurationProvider); -// return await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField.IsNullOrEmpty() ? nameof(ReadingQuestionCriterionTrialView.ShowOrder) : inDto.SortField, -// inDto.Asc); -// } + .ProjectTo(_mapper.ConfigurationProvider); + return await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField.IsNullOrEmpty() ? nameof(ReadingQuestionCriterionTrialView.ShowOrder) : inDto.SortField, + inDto.Asc); + } -// /// -// /// 删除项目问题标准(项目) -// /// -// /// -// /// -// [HttpDelete("{id:guid}")] -// public async Task DeleteReadingQuestionCriterionTrial(Guid id) -// { -// await _readingQuestionCriterionTrialRepository.DeleteFromQueryAsync(t => t.Id == id); -// var success = await _readingQuestionCriterionTrialRepository.SaveChangesAsync(); -// return ResponseOutput.Result(success); -// } + /// + /// 删除项目问题标准(项目) + /// + /// + /// + [HttpDelete("{id:guid}")] + public async Task DeleteReadingQuestionCriterionTrial(Guid id) + { + await _readingQuestionCriterionTrialRepository.DeleteFromQueryAsync(t => t.Id == id); + var success = await _readingQuestionCriterionTrialRepository.SaveChangesAsync(); + return ResponseOutput.Result(success); + } -// /// -// /// 设置项目裁判信息 -// /// -// /// -// /// -// [HttpPost] -// public async Task SetTrialJudgyInfo(SetTrialJudgyInfoInDto inDto) -// { + /// + /// 设置项目裁判信息 + /// + /// + /// + [HttpPost] + public async Task SetTrialJudgyInfo(SetTrialJudgyInfoInDto inDto) + { -// var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == inDto.TrialId && x.Id == inDto.TrialReadingCriterionId).FirstOrDefaultAsync(); + var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == inDto.TrialId && x.Id == inDto.TrialReadingCriterionId).FirstOrDefaultAsync(); -// var judgeCount = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialCriterion.Id && x.IsJudgeQuestion) -// .WhereIf(trialCriterion.FormType == FormType.SinglePage, x => x.ReadingCriterionPageId == null) -// .WhereIf(trialCriterion.FormType == FormType.MultiplePage, x => x.ReadingCriterionPageId != null).CountAsync(); + var judgeCount = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialCriterion.Id && x.IsJudgeQuestion) + .WhereIf(trialCriterion.FormType == FormType.SinglePage, x => x.ReadingCriterionPageId == null) + .WhereIf(trialCriterion.FormType == FormType.MultiplePage, x => x.ReadingCriterionPageId != null).CountAsync(); -// if (judgeCount == 0 && (inDto.ArbitrationRule == ArbitrationRule.Visit || inDto.ArbitrationRule == ArbitrationRule.Reading)) -// { -// throw new BusinessValidationFailedException("无裁判问题却有仲裁对象,操作失败"); -// } -// await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(inDto.TrialReadingCriterionId, x => new ReadingQuestionCriterionTrial() -// { -// ArbitrationRule = inDto.ArbitrationRule, -// //IsArbitrationReading = inDto.IsArbitrationReading, -// }); + if (judgeCount == 0 && (inDto.ArbitrationRule == ArbitrationRule.Visit || inDto.ArbitrationRule == ArbitrationRule.Reading)) + { + throw new BusinessValidationFailedException("无裁判问题却有仲裁对象,操作失败"); + } + await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(inDto.TrialReadingCriterionId, x => new ReadingQuestionCriterionTrial() + { + ArbitrationRule = inDto.ArbitrationRule, + //IsArbitrationReading = inDto.IsArbitrationReading, + }); -// var result = await _readingQuestionCriterionTrialRepository.SaveChangesAsync(); -// return ResponseOutput.Ok(result); -// } + var result = await _readingQuestionCriterionTrialRepository.SaveChangesAsync(); + return ResponseOutput.Ok(result); + } -// #endregion + #endregion -// /// -// /// 添加系统数据到项目里面 -// /// -// /// -// [NonDynamicMethod] -// private async Task AddSystemDataToTrila(Guid trialId) -// { -// var trialUsrSystemIds = _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == trialId && x.ReadingQuestionCriterionSystemId != null) -// .Select(x => x.ReadingQuestionCriterionSystemId); -// var trialCriterionNames = _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == trialId) -// .Select(x => x.CriterionName); -// List needAddCriterionList = await _readingQuestionCriterionSystemRepository.Where(x => !trialUsrSystemIds.Contains(x.Id) && x.IsEnable && !trialCriterionNames.Contains(x.CriterionName)).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + #region 项目阅片标准问题分页 -// List needAddQuestionList = new List(); -// needAddCriterionList.ForEach(x => -// { -// //x.IsEnable = false; -// x.TrialId = trialId; -// x.ReadingQuestionCriterionSystemId = x.Id; -// x.Id = NewId.NextGuid(); -// // 同步问题暂时注释 -// //List readingQuestionTrialList = new List(); -// //SetChildParentQuestion(criterion.Id, trialId, systemQuestionList, readingQuestionTrialList); -// //needAddQuestionList.AddRange(readingQuestionTrialList); -// }); -// await _readingQuestionCriterionTrialRepository.AddRangeAsync(needAddCriterionList); -// await _readingQuestionTrialRepository.AddRangeAsync(needAddQuestionList); -// await _readingQuestionTrialRepository.SaveChangesAsync(); -// } + /// + /// 新增修改项目标准分页 + /// + /// + /// + [HttpPost] + public async Task AddOrUpdateReadingCriterionPage(ReadingCriterionPageAddOrEdit addOrEditReadingCriterionPage) + { -// } -//} + var entity = await _readingCriterionPageRepository.InsertOrUpdateAsync(addOrEditReadingCriterionPage, true); + return ResponseOutput.Ok(entity.Id.ToString()); + + } + + /// + /// 删除标准分页 + /// + /// + /// + [HttpDelete("{Id:guid}")] + public async Task DeleteReadingCriterionPage(Guid Id) + { + var success = await _readingCriterionPageRepository.DeleteFromQueryAsync(t => t.Id == Id, true); + return ResponseOutput.Ok(); + } + + + #endregion + + + /// + /// 添加系统数据到项目里面 + /// + /// + [NonDynamicMethod] + private async Task AddSystemDataToTrila(Guid trialId) + { + var trialUsrSystemIds = _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == trialId && x.ReadingQuestionCriterionSystemId != null) + .Select(x => x.ReadingQuestionCriterionSystemId); + var trialCriterionNames = _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == trialId) + .Select(x => x.CriterionName); + List needAddCriterionList = await _readingQuestionCriterionSystemRepository.Where(x => !trialUsrSystemIds.Contains(x.Id) && x.IsEnable && !trialCriterionNames.Contains(x.CriterionName)).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + + List needAddQuestionList = new List(); + needAddCriterionList.ForEach(x => + { + //x.IsEnable = false; + x.TrialId = trialId; + x.ReadingQuestionCriterionSystemId = x.Id; + x.Id = NewId.NextGuid(); + // 同步问题暂时注释 + //List readingQuestionTrialList = new List(); + //SetChildParentQuestion(criterion.Id, trialId, systemQuestionList, readingQuestionTrialList); + //needAddQuestionList.AddRange(readingQuestionTrialList); + }); + await _readingQuestionCriterionTrialRepository.AddRangeAsync(needAddCriterionList); + await _readingQuestionTrialRepository.AddRangeAsync(needAddQuestionList); + await _readingQuestionTrialRepository.SaveChangesAsync(); + } + + } +} diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/TumorAssessmentService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/TumorAssessmentService.cs index c3983d1bd..596d025bf 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/TumorAssessmentService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/TumorAssessmentService.cs @@ -1,140 +1,91 @@ -//using Microsoft.AspNetCore.Mvc; -//using IRaCIS.Core.Application.Interfaces; -//using IRaCIS.Core.Application.ViewModel; -//using IRaCIS.Core.Infra.EFCore.Common; -//using MassTransit; -//using IRaCIS.Core.Infrastructure; -//using IRaCIS.Core.Domain.Share; -//using IRaCIS.Core.Application.Service.Reading.Dto; -//using Panda.DynamicWebApi.Attributes; +using Microsoft.AspNetCore.Mvc; +using IRaCIS.Core.Application.Interfaces; +using IRaCIS.Core.Application.ViewModel; +using IRaCIS.Core.Infra.EFCore.Common; +using MassTransit; +using IRaCIS.Core.Infrastructure; +using IRaCIS.Core.Domain.Share; +using IRaCIS.Core.Application.Service.Reading.Dto; +using Panda.DynamicWebApi.Attributes; -//namespace IRaCIS.Core.Application.Service -//{ +namespace IRaCIS.Core.Application.Service.TA +{ -// [ApiExplorerSettings(GroupName = "Reading")] -// public class ReadingQuestionService : BaseService -// { - -// //private readonly IRepository _subjectVisitRepository; -// private readonly IRepository _readingQuestionCriterionSystemRepository; -// private readonly IRepository _readingQuestionCriterionTrialRepository; -// //private readonly IRepository _readingQuestionSystemRepository; -// private readonly IRepository _readingQuestionTrialRepository; -// //private readonly IRepository _clinicalDataTrialSetRepository; -// //private readonly IRepository _clinicalDataSystemSetRepository; -// //private readonly IRepository _dictionaryRepository; -// //private readonly IRepository _readingTableQuestionTrialRepository; -// //private readonly IRepository _readingCriterionPageRepository; -// //private readonly IRepository _trialRepository; -// //private readonly IRepository _tumorAssessmentRepository; -// //private readonly IRepository _organInfoRepository; -// //private readonly IRepository _readingTableQuestionSystemRepository; -// private readonly IRepository _readingTaskQuestionAnswer; -// //private readonly IRepository _previousPDFRepository; - -// public ReadingQuestionService( -// IRepository readingQuestionCriterionSystemRepository, -// IRepository readingQuestionCriterionTrialRepository, -// //IRepository readingQuestionSystemRepository, -// IRepository readingQuestionTrialRepository, -// //IRepository ClinicalDataTrialSetRepository, -// //IRepository ClinicalDataSystemSetRepository, -// //IRepository dictionaryRepository, -// //IRepository readingTableQuestionTrialRepository, -// //IRepository readingCriterionPageRepository, -// //IRepository trialRepository, -// //IRepository tumorAssessmentRepository, -// //IRepository organInfoRepository, -// //IRepository readingTableQuestionSystemRepository, -// IRepository readingTaskQuestionAnswer -// //IRepository previousPDFRepository -// //IRepository subjectVisitRepository, - -// ) -// { -// //this._subjectVisitRepository = subjectVisitRepository; -// this._readingQuestionCriterionSystemRepository = readingQuestionCriterionSystemRepository; -// this._readingQuestionCriterionTrialRepository = readingQuestionCriterionTrialRepository; -// //this._readingQuestionSystemRepository = readingQuestionSystemRepository; -// this._readingQuestionTrialRepository = readingQuestionTrialRepository; -// //this._clinicalDataTrialSetRepository = ClinicalDataTrialSetRepository; -// //this._clinicalDataSystemSetRepository = ClinicalDataSystemSetRepository; -// //this._dictionaryRepository = dictionaryRepository; -// //this._readingTableQuestionTrialRepository = readingTableQuestionTrialRepository; -// //this._readingCriterionPageRepository = readingCriterionPageRepository; -// //this._trialRepository = trialRepository; -// //this._tumorAssessmentRepository = tumorAssessmentRepository; -// //this._organInfoRepository = organInfoRepository; -// //this._readingTableQuestionSystemRepository = readingTableQuestionSystemRepository; -// this._readingTaskQuestionAnswer = readingTaskQuestionAnswer; -// //this._previousPDFRepository = previousPDFRepository; -// } + [ApiExplorerSettings(GroupName = "Reading")] + public class ReadingQuestionService : BaseService + { + private readonly IRepository _tumorAssessmentRepository; + + public ReadingQuestionService( IRepository tumorAssessmentRepository ) + { + this._tumorAssessmentRepository = tumorAssessmentRepository; + } -// /// -// /// 获取疗效对照 -// /// -// /// -// [HttpPost] -// public async Task> GetTumorAssessmentList(GetTumorAssessmentListInDto inDto) -// { -// var result = await _tumorAssessmentRepository -// .Where(x => x.CriterionId == inDto.CriterionId) -// .WhereIf(inDto.OverallEfficacy != null, x => x.OverallEfficacy == inDto.OverallEfficacy) -// .WhereIf(inDto.TargetLesion != null, x => x.TargetLesion == inDto.TargetLesion) -// .WhereIf(inDto.NonTargetLesions != null, x => x.NonTargetLesions == inDto.NonTargetLesions) -// .WhereIf(inDto.NewLesion != null, x => x.NewLesion == inDto.NewLesion) -// .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); -// return result; -// } + /// + /// 获取疗效对照 + /// + /// + [HttpPost] + public async Task> GetTumorAssessmentList(GetTumorAssessmentListInDto inDto) + { + var result = await _tumorAssessmentRepository + .Where(x => x.CriterionId == inDto.CriterionId) + .WhereIf(inDto.OverallEfficacy != null, x => x.OverallEfficacy == inDto.OverallEfficacy) + .WhereIf(inDto.TargetLesion != null, x => x.TargetLesion == inDto.TargetLesion) + .WhereIf(inDto.NonTargetLesions != null, x => x.NonTargetLesions == inDto.NonTargetLesions) + .WhereIf(inDto.NewLesion != null, x => x.NewLesion == inDto.NewLesion) + .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + return result; + } -// /// -// /// 获取疗效对照 -// /// -// /// -// [HttpPost] -// public async Task> GetTumorAssessmentPageList(GetTumorAssessmentListInDto inQuery) -// { -// var query = _tumorAssessmentRepository -// .Where(x => x.CriterionId == inQuery.CriterionId) -// .WhereIf(inQuery.OverallEfficacy != null, x => x.OverallEfficacy == inQuery.OverallEfficacy) -// .WhereIf(inQuery.TargetLesion != null, x => x.TargetLesion == inQuery.TargetLesion) -// .WhereIf(inQuery.NonTargetLesions != null, x => x.NonTargetLesions == inQuery.NonTargetLesions) -// .WhereIf(inQuery.NewLesion != null, x => x.NewLesion == inQuery.NewLesion) -// .ProjectTo(_mapper.ConfigurationProvider); + /// + /// 获取疗效对照 + /// + /// + [HttpPost] + public async Task> GetTumorAssessmentPageList(GetTumorAssessmentListInDto inQuery) + { + var query = _tumorAssessmentRepository + .Where(x => x.CriterionId == inQuery.CriterionId) + .WhereIf(inQuery.OverallEfficacy != null, x => x.OverallEfficacy == inQuery.OverallEfficacy) + .WhereIf(inQuery.TargetLesion != null, x => x.TargetLesion == inQuery.TargetLesion) + .WhereIf(inQuery.NonTargetLesions != null, x => x.NonTargetLesions == inQuery.NonTargetLesions) + .WhereIf(inQuery.NewLesion != null, x => x.NewLesion == inQuery.NewLesion) + .ProjectTo(_mapper.ConfigurationProvider); -// return await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TumorAssessmentView.Id) : inQuery.SortField, inQuery.Asc); -// } + return await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TumorAssessmentView.Id) : inQuery.SortField, inQuery.Asc); + } -// /// -// /// 新增修改疗效对照 -// /// -// /// -// /// -// [HttpPost] -// public async Task AddOrUpdateTumorAssessment(AddOrUpdateTumorAssessmentInDto indto) -// { + /// + /// 新增修改疗效对照 + /// + /// + /// + [HttpPost] + public async Task AddOrUpdateTumorAssessment(AddOrUpdateTumorAssessmentInDto indto) + { -// var entity = await _tumorAssessmentRepository.InsertOrUpdateAsync(indto, true); + var entity = await _tumorAssessmentRepository.InsertOrUpdateAsync(indto, true); -// return ResponseOutput.Ok(entity.Id.ToString()); + return ResponseOutput.Ok(entity.Id.ToString()); -// } + } -// /// -// /// 删除疗效对照 -// /// -// /// -// /// -// [HttpDelete("{Id:guid}")] -// public async Task DeleteTumorAssessment(Guid Id) -// { -// await _tumorAssessmentRepository.DeleteFromQueryAsync(t => t.Id == Id); -// var success = await _tumorAssessmentRepository.SaveChangesAsync(); -// return ResponseOutput.Result(success); -// } + /// + /// 删除疗效对照 + /// + /// + /// + [HttpDelete("{Id:guid}")] + public async Task DeleteTumorAssessment(Guid Id) + { + await _tumorAssessmentRepository.DeleteFromQueryAsync(t => t.Id == Id); + var success = await _tumorAssessmentRepository.SaveChangesAsync(); + return ResponseOutput.Result(success); + } -// } -//} \ No newline at end of file + } +} \ No newline at end of file diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs index f20528fcf..aafb7c1f8 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs @@ -129,270 +129,6 @@ namespace IRaCIS.Application.Services #endregion - #region 系统标准 - /// - /// 获取获取系统阅片标准下拉 - /// - /// - [HttpPost] - public async Task> GetSystemCriterionList() - { - List result = await _readingQuestionCriterionSystemRepository.Select(x => new GetSystemCriterionListOutDto() - { - - CriterionId = x.Id, - CriterionName = x.CriterionName, - - }).ToListAsync(); - - return result; - } - - /// - /// 获取系统问题标准 - /// - /// - [HttpPost] - public async Task> GetReadingQuestionCriterionSystemList(ReadingQuestionCriterionSystemViewInDto inDto) - { - //await AddSystemQuestionCriterion(); - var query = _readingQuestionCriterionSystemRepository.AsQueryable() - .WhereIf(!inDto.CriterionName.IsNullOrEmpty(), x => x.CriterionName.Contains(inDto.CriterionName)) - .ProjectTo(_mapper.ConfigurationProvider); - - return await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField.IsNullOrEmpty() ? nameof(ReadingQuestionCriterionSystemView.ShowOrder) : inDto.SortField, - inDto.Asc); - } - - /// - /// 获取系统问题标准下拉 - /// - /// - [HttpPost] - public async Task> GetSystemCriterionSelectList() - { - var criterionList = await _readingQuestionCriterionSystemRepository.AsQueryable() - .OrderBy(x => x.ShowOrder) - .Select(x => new GetSystemCriterionSelectDto() - { - Id = x.Id, - CriterionName = x.CriterionName, - - }).ToListAsync(); - return criterionList; - } - - /// - /// 新增修改系统问题标准 - /// - /// - /// - [HttpPost] - public async Task AddOrUpdateReadingQuestionCriterionSystem(AddOrUpdateReadingQuestionCriterionSystemInDto indto) - { - var entity = await _readingQuestionCriterionSystemRepository.InsertOrUpdateAsync(indto, true); - - if (indto.Id != null) - { - await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(x => x.ReadingQuestionCriterionSystemId == indto.Id, x => new ReadingQuestionCriterionTrial() - { - CriterionName = indto.CriterionName, - CriterionType = indto.CriterionType, - - }); - } - return ResponseOutput.Ok(entity.Id.ToString()); - } - - /// - /// 删除系统问题标准 - /// - /// - /// - [HttpDelete("{id:guid}")] - public async Task DeleteReadingQuestionCriterionSystem(Guid id) - { - - - if (await _readingQuestionCriterionTrialRepository.AnyAsync(x => x.IsConfirm && x.ReadingQuestionCriterionSystemId == id)) - { - throw new BusinessValidationFailedException("当前标准被引用过了,不可以删除"); - } - - await _readingQuestionCriterionSystemRepository.DeleteFromQueryAsync(t => t.Id == id); - var success = await _readingQuestionCriterionSystemRepository.SaveChangesAsync(); - return ResponseOutput.Result(success); - } - - - - /// - /// 设置系统问题标准是否完成配置 - /// - /// - /// - public async Task SetSystemReadingQuestionCriterionIsCompleteConfig(SetSystemReadingQuestionCriterionIsIsCompleteConfig inDto) - { - - if (!inDto.IsCompleteConfig) - { - var trialCriterionIds = await _readingQuestionCriterionTrialRepository.Where(x => x.ReadingQuestionCriterionSystemId == inDto.Id).Select(x => x.Id).ToListAsync(); - if (await _readingTaskQuestionAnswer.AnyAsync(x => trialCriterionIds.Contains(x.ReadingQuestionCriterionTrialId))) - { - return ResponseOutput.NotOk("此标准在项目里面已被使用,操作失败"); - } - } - - var systemCriterion = await _readingQuestionCriterionSystemRepository.Where(x => x.Id == inDto.Id).AsNoTracking().FirstOrDefaultAsync(); - - var confirmTime = systemCriterion.ConfirmTime; - - if (inDto.IsCompleteConfig) - { - confirmTime = DateTime.Now; - } - - await _readingQuestionCriterionSystemRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionSystem() - { - IsCompleteConfig = inDto.IsCompleteConfig, - ConfirmTime = confirmTime, - }); - - if (inDto.IsCompleteConfig) - { - //await SynchronizeSystemCriterion(inDto.Id); - } - else - { - await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(x => x.ReadingQuestionCriterionSystemId == inDto.Id, x => new ReadingQuestionCriterionTrial() - { - IsCompleteConfig = inDto.IsCompleteConfig - }); - } - var result = await _readingQuestionCriterionSystemRepository.SaveChangesAsync(); - - return ResponseOutput.Ok(result); - } - - - #endregion - - #region 项目标准 - - /// - /// 获取项目裁判信息 - /// - /// - /// - [HttpPost] - public async Task GetTrialJudgyInfo(GetTrialJudgyInfoInDto inDto) - { - GetTrialJudgyInfoOutDto result = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).Select(x => new GetTrialJudgyInfoOutDto - { - TrialId = x.TrialId, - IsReadingTaskViewInOrder = x.IsReadingTaskViewInOrder, - ArbitrationRule = x.ArbitrationRule, - IsArbitrationReading = x.IsArbitrationReading - - }).FirstNotNullAsync(); - - return result; - } - - /// - /// 新增修改项目问题标准(项目) - /// - /// - /// - [HttpPost] - public async Task AddOrUpdateReadingQuestionCriterionTrial(AddOrUpdateReadingQuestionCriterionTrialInDto indto) - { - - var entity = await _readingQuestionCriterionTrialRepository.InsertOrUpdateAsync(indto, true); - return ResponseOutput.Ok(entity.Id.ToString()); - } - - - - /// - /// 设置项目标准是否完成配置 - /// - /// - /// - public async Task SetTrialReadingQuestionCriterionIsIsCompleteConfig(SetSystemReadingQuestionCriterionIsIsCompleteConfig inDto) - { - await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionTrial() - { - IsCompleteConfig = inDto.IsCompleteConfig - }); - - var result = await _readingQuestionCriterionTrialRepository.SaveChangesAsync(); - - return ResponseOutput.Ok(result); - } - - /// - /// 获取项目问题标准(项目) - /// - /// - [HttpPost] - public async Task> GetReadingQuestionCriterionTrialList(ReadingQuestionCriterionTrialViewInDto inDto) - { - await AddSystemDataToTrila(inDto.TrialId); - var query = _readingQuestionCriterionTrialRepository.AsQueryable() - .Where(x => x.TrialId == inDto.TrialId) - .Where(x => (x.ReadingQuestionCriterionSystemId != null && x.IsEnable) || x.ReadingQuestionCriterionSystemId == null) - .WhereIf(!inDto.CriterionName.IsNullOrEmpty(), x => x.CriterionName.Contains(inDto.CriterionName)) - - .ProjectTo(_mapper.ConfigurationProvider); - return await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField.IsNullOrEmpty() ? nameof(ReadingQuestionCriterionTrialView.ShowOrder) : inDto.SortField, - inDto.Asc); - } - - /// - /// 删除项目问题标准(项目) - /// - /// - /// - [HttpDelete("{id:guid}")] - public async Task DeleteReadingQuestionCriterionTrial(Guid id) - { - await _readingQuestionCriterionTrialRepository.DeleteFromQueryAsync(t => t.Id == id); - var success = await _readingQuestionCriterionTrialRepository.SaveChangesAsync(); - return ResponseOutput.Result(success); - } - - /// - /// 设置项目裁判信息 - /// - /// - /// - [HttpPost] - public async Task SetTrialJudgyInfo(SetTrialJudgyInfoInDto inDto) - { - - var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == inDto.TrialId && x.Id == inDto.TrialReadingCriterionId).FirstOrDefaultAsync(); - - var judgeCount = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialCriterion.Id && x.IsJudgeQuestion) - .WhereIf(trialCriterion.FormType == FormType.SinglePage, x => x.ReadingCriterionPageId == null) - .WhereIf(trialCriterion.FormType == FormType.MultiplePage, x => x.ReadingCriterionPageId != null).CountAsync(); - - if (judgeCount == 0 && (inDto.ArbitrationRule == ArbitrationRule.Visit || inDto.ArbitrationRule == ArbitrationRule.Reading)) - { - throw new BusinessValidationFailedException("无裁判问题却有仲裁对象,操作失败"); - } - await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(inDto.TrialReadingCriterionId, x => new ReadingQuestionCriterionTrial() - { - ArbitrationRule = inDto.ArbitrationRule, - //IsArbitrationReading = inDto.IsArbitrationReading, - }); - - var result = await _trialRepository.SaveChangesAsync(); - return ResponseOutput.Ok(result); - } - - - #endregion #region 系统标准问题 @@ -780,104 +516,9 @@ namespace IRaCIS.Application.Services #endregion - #region 项目阅片标准问题分页 - - /// - /// 新增修改项目标准分页 - /// - /// - /// - [HttpPost] - public async Task AddOrUpdateReadingCriterionPage(ReadingCriterionPageAddOrEdit addOrEditReadingCriterionPage) - { - - var entity = await _readingCriterionPageRepository.InsertOrUpdateAsync(addOrEditReadingCriterionPage, true); - return ResponseOutput.Ok(entity.Id.ToString()); - - } - - /// - /// 删除标准分页 - /// - /// - /// - [HttpDelete("{Id:guid}")] - public async Task DeleteReadingCriterionPage(Guid Id) - { - var success = await _readingCriterionPageRepository.DeleteFromQueryAsync(t => t.Id == Id, true); - return ResponseOutput.Ok(); - } - #endregion - #region 疗效对照表 - - /// - /// 获取疗效对照 - /// - /// - [HttpPost] - public async Task> GetTumorAssessmentList(GetTumorAssessmentListInDto inDto) - { - var result = await _tumorAssessmentRepository - .Where(x => x.CriterionId == inDto.CriterionId) - .WhereIf(inDto.OverallEfficacy != null, x => x.OverallEfficacy == inDto.OverallEfficacy) - .WhereIf(inDto.TargetLesion != null, x => x.TargetLesion == inDto.TargetLesion) - .WhereIf(inDto.NonTargetLesions != null, x => x.NonTargetLesions == inDto.NonTargetLesions) - .WhereIf(inDto.NewLesion != null, x => x.NewLesion == inDto.NewLesion) - .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); - return result; - } - - /// - /// 获取疗效对照 - /// - /// - [HttpPost] - public async Task> GetTumorAssessmentPageList(GetTumorAssessmentListInDto inQuery) - { - var query = _tumorAssessmentRepository - .Where(x => x.CriterionId == inQuery.CriterionId) - .WhereIf(inQuery.OverallEfficacy != null, x => x.OverallEfficacy == inQuery.OverallEfficacy) - .WhereIf(inQuery.TargetLesion != null, x => x.TargetLesion == inQuery.TargetLesion) - .WhereIf(inQuery.NonTargetLesions != null, x => x.NonTargetLesions == inQuery.NonTargetLesions) - .WhereIf(inQuery.NewLesion != null, x => x.NewLesion == inQuery.NewLesion) - .ProjectTo(_mapper.ConfigurationProvider); - - return await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TumorAssessmentView.Id) : inQuery.SortField, inQuery.Asc); - } - - - /// - /// 新增修改疗效对照 - /// - /// - /// - [HttpPost] - public async Task AddOrUpdateTumorAssessment(AddOrUpdateTumorAssessmentInDto indto) - { - - var entity = await _tumorAssessmentRepository.InsertOrUpdateAsync(indto, true); - - return ResponseOutput.Ok(entity.Id.ToString()); - - } - - /// - /// 删除疗效对照 - /// - /// - /// - [HttpDelete("{Id:guid}")] - public async Task DeleteTumorAssessment(Guid Id) - { - await _tumorAssessmentRepository.DeleteFromQueryAsync(t => t.Id == Id); - var success = await _tumorAssessmentRepository.SaveChangesAsync(); - return ResponseOutput.Result(success); - } - - #endregion /// @@ -885,6 +526,7 @@ namespace IRaCIS.Application.Services /// /// /// + /// [HttpPost] public async Task CopySystemCriterionData(CopySystemCriterionDataInDto inDto) { @@ -1534,5 +1176,374 @@ namespace IRaCIS.Application.Services #endregion + #region 移动到其他服务 废弃 + + //#region 项目阅片标准问题分页 + + ///// + ///// 新增修改项目标准分页 + ///// + ///// + ///// + //[HttpPost] + //public async Task AddOrUpdateReadingCriterionPage(ReadingCriterionPageAddOrEdit addOrEditReadingCriterionPage) + //{ + + // var entity = await _readingCriterionPageRepository.InsertOrUpdateAsync(addOrEditReadingCriterionPage, true); + // return ResponseOutput.Ok(entity.Id.ToString()); + + //} + + ///// + ///// 删除标准分页 + ///// + ///// + ///// + //[HttpDelete("{Id:guid}")] + //public async Task DeleteReadingCriterionPage(Guid Id) + //{ + // var success = await _readingCriterionPageRepository.DeleteFromQueryAsync(t => t.Id == Id, true); + // return ResponseOutput.Ok(); + //} + + + //#endregion + + //#region 疗效对照表 + + ///// + ///// 获取疗效对照 + ///// + ///// + //[HttpPost] + //public async Task> GetTumorAssessmentList(GetTumorAssessmentListInDto inDto) + //{ + // var result = await _tumorAssessmentRepository + // .Where(x => x.CriterionId == inDto.CriterionId) + // .WhereIf(inDto.OverallEfficacy != null, x => x.OverallEfficacy == inDto.OverallEfficacy) + // .WhereIf(inDto.TargetLesion != null, x => x.TargetLesion == inDto.TargetLesion) + // .WhereIf(inDto.NonTargetLesions != null, x => x.NonTargetLesions == inDto.NonTargetLesions) + // .WhereIf(inDto.NewLesion != null, x => x.NewLesion == inDto.NewLesion) + // .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + // return result; + //} + + ///// + ///// 获取疗效对照 + ///// + ///// + //[HttpPost] + //public async Task> GetTumorAssessmentPageList(GetTumorAssessmentListInDto inQuery) + //{ + // var query = _tumorAssessmentRepository + // .Where(x => x.CriterionId == inQuery.CriterionId) + // .WhereIf(inQuery.OverallEfficacy != null, x => x.OverallEfficacy == inQuery.OverallEfficacy) + // .WhereIf(inQuery.TargetLesion != null, x => x.TargetLesion == inQuery.TargetLesion) + // .WhereIf(inQuery.NonTargetLesions != null, x => x.NonTargetLesions == inQuery.NonTargetLesions) + // .WhereIf(inQuery.NewLesion != null, x => x.NewLesion == inQuery.NewLesion) + // .ProjectTo(_mapper.ConfigurationProvider); + + // return await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TumorAssessmentView.Id) : inQuery.SortField, inQuery.Asc); + //} + + + ///// + ///// 新增修改疗效对照 + ///// + ///// + ///// + //[HttpPost] + //public async Task AddOrUpdateTumorAssessment(AddOrUpdateTumorAssessmentInDto indto) + //{ + + // var entity = await _tumorAssessmentRepository.InsertOrUpdateAsync(indto, true); + + // return ResponseOutput.Ok(entity.Id.ToString()); + + //} + + ///// + ///// 删除疗效对照 + ///// + ///// + ///// + //[HttpDelete("{Id:guid}")] + //public async Task DeleteTumorAssessment(Guid Id) + //{ + // await _tumorAssessmentRepository.DeleteFromQueryAsync(t => t.Id == Id); + // var success = await _tumorAssessmentRepository.SaveChangesAsync(); + // return ResponseOutput.Result(success); + //} + + //#endregion + + + + //#region 系统标准 + ///// + ///// 获取获取系统阅片标准下拉 + ///// + ///// + //[HttpPost] + //public async Task> GetSystemCriterionList() + //{ + // List result = await _readingQuestionCriterionSystemRepository.Select(x => new GetSystemCriterionListOutDto() + // { + + // CriterionId = x.Id, + // CriterionName = x.CriterionName, + + // }).ToListAsync(); + + // return result; + //} + + ///// + ///// 获取系统问题标准 + ///// + ///// + //[HttpPost] + //public async Task> GetReadingQuestionCriterionSystemList(ReadingQuestionCriterionSystemViewInDto inDto) + //{ + // //await AddSystemQuestionCriterion(); + // var query = _readingQuestionCriterionSystemRepository.AsQueryable() + // .WhereIf(!inDto.CriterionName.IsNullOrEmpty(), x => x.CriterionName.Contains(inDto.CriterionName)) + // .ProjectTo(_mapper.ConfigurationProvider); + + // return await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField.IsNullOrEmpty() ? nameof(ReadingQuestionCriterionSystemView.ShowOrder) : inDto.SortField, + // inDto.Asc); + //} + + ///// + ///// 获取系统问题标准下拉 + ///// + ///// + //[HttpPost] + //public async Task> GetSystemCriterionSelectList() + //{ + // var criterionList = await _readingQuestionCriterionSystemRepository.AsQueryable() + // .OrderBy(x => x.ShowOrder) + // .Select(x => new GetSystemCriterionSelectDto() + // { + // Id = x.Id, + // CriterionName = x.CriterionName, + + // }).ToListAsync(); + // return criterionList; + //} + + ///// + ///// 新增修改系统问题标准 + ///// + ///// + ///// + //[HttpPost] + //public async Task AddOrUpdateReadingQuestionCriterionSystem(AddOrUpdateReadingQuestionCriterionSystemInDto indto) + //{ + // var entity = await _readingQuestionCriterionSystemRepository.InsertOrUpdateAsync(indto, true); + + // if (indto.Id != null) + // { + // await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(x => x.ReadingQuestionCriterionSystemId == indto.Id, x => new ReadingQuestionCriterionTrial() + // { + // CriterionName = indto.CriterionName, + // CriterionType = indto.CriterionType, + + // }); + // } + // return ResponseOutput.Ok(entity.Id.ToString()); + //} + + ///// + ///// 删除系统问题标准 + ///// + ///// + ///// + //[HttpDelete("{id:guid}")] + //public async Task DeleteReadingQuestionCriterionSystem(Guid id) + //{ + + + // if (await _readingQuestionCriterionTrialRepository.AnyAsync(x => x.IsConfirm && x.ReadingQuestionCriterionSystemId == id)) + // { + // throw new BusinessValidationFailedException("当前标准被引用过了,不可以删除"); + // } + + // await _readingQuestionCriterionSystemRepository.DeleteFromQueryAsync(t => t.Id == id); + // var success = await _readingQuestionCriterionSystemRepository.SaveChangesAsync(); + // return ResponseOutput.Result(success); + //} + + + + ///// + ///// 设置系统问题标准是否完成配置 + ///// + ///// + ///// + //public async Task SetSystemReadingQuestionCriterionIsCompleteConfig(SetSystemReadingQuestionCriterionIsIsCompleteConfig inDto) + //{ + + // if (!inDto.IsCompleteConfig) + // { + // var trialCriterionIds = await _readingQuestionCriterionTrialRepository.Where(x => x.ReadingQuestionCriterionSystemId == inDto.Id).Select(x => x.Id).ToListAsync(); + // if (await _readingTaskQuestionAnswer.AnyAsync(x => trialCriterionIds.Contains(x.ReadingQuestionCriterionTrialId))) + // { + // return ResponseOutput.NotOk("此标准在项目里面已被使用,操作失败"); + // } + // } + + // var systemCriterion = await _readingQuestionCriterionSystemRepository.Where(x => x.Id == inDto.Id).AsNoTracking().FirstOrDefaultAsync(); + + // var confirmTime = systemCriterion.ConfirmTime; + + // if (inDto.IsCompleteConfig) + // { + // confirmTime = DateTime.Now; + // } + + // await _readingQuestionCriterionSystemRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionSystem() + // { + // IsCompleteConfig = inDto.IsCompleteConfig, + // ConfirmTime = confirmTime, + // }); + + // if (inDto.IsCompleteConfig) + // { + // //await SynchronizeSystemCriterion(inDto.Id); + // } + // else + // { + // await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(x => x.ReadingQuestionCriterionSystemId == inDto.Id, x => new ReadingQuestionCriterionTrial() + // { + // IsCompleteConfig = inDto.IsCompleteConfig + // }); + // } + // var result = await _readingQuestionCriterionSystemRepository.SaveChangesAsync(); + + // return ResponseOutput.Ok(result); + //} + + + //#endregion + + //#region 项目标准 + + ///// + ///// 获取项目裁判信息 + ///// + ///// + ///// + //[HttpPost] + //public async Task GetTrialJudgyInfo(GetTrialJudgyInfoInDto inDto) + //{ + // GetTrialJudgyInfoOutDto result = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).Select(x => new GetTrialJudgyInfoOutDto + // { + // TrialId = x.TrialId, + // IsReadingTaskViewInOrder = x.IsReadingTaskViewInOrder, + // ArbitrationRule = x.ArbitrationRule, + // IsArbitrationReading = x.IsArbitrationReading + + // }).FirstNotNullAsync(); + + // return result; + //} + + ///// + ///// 新增修改项目问题标准(项目) + ///// + ///// + ///// + //[HttpPost] + //public async Task AddOrUpdateReadingQuestionCriterionTrial(AddOrUpdateReadingQuestionCriterionTrialInDto indto) + //{ + + // var entity = await _readingQuestionCriterionTrialRepository.InsertOrUpdateAsync(indto, true); + // return ResponseOutput.Ok(entity.Id.ToString()); + //} + + + + ///// + ///// 设置项目标准是否完成配置 + ///// + ///// + ///// + //public async Task SetTrialReadingQuestionCriterionIsIsCompleteConfig(SetSystemReadingQuestionCriterionIsIsCompleteConfig inDto) + //{ + // await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionTrial() + // { + // IsCompleteConfig = inDto.IsCompleteConfig + // }); + + // var result = await _readingQuestionCriterionTrialRepository.SaveChangesAsync(); + + // return ResponseOutput.Ok(result); + //} + + ///// + ///// 获取项目问题标准(项目) + ///// + ///// + //[HttpPost] + //public async Task> GetReadingQuestionCriterionTrialList(ReadingQuestionCriterionTrialViewInDto inDto) + //{ + // await AddSystemDataToTrila(inDto.TrialId); + // var query = _readingQuestionCriterionTrialRepository.AsQueryable() + // .Where(x => x.TrialId == inDto.TrialId) + // .Where(x => (x.ReadingQuestionCriterionSystemId != null && x.IsEnable) || x.ReadingQuestionCriterionSystemId == null) + // .WhereIf(!inDto.CriterionName.IsNullOrEmpty(), x => x.CriterionName.Contains(inDto.CriterionName)) + + // .ProjectTo(_mapper.ConfigurationProvider); + // return await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField.IsNullOrEmpty() ? nameof(ReadingQuestionCriterionTrialView.ShowOrder) : inDto.SortField, + // inDto.Asc); + //} + + ///// + ///// 删除项目问题标准(项目) + ///// + ///// + ///// + //[HttpDelete("{id:guid}")] + //public async Task DeleteReadingQuestionCriterionTrial(Guid id) + //{ + // await _readingQuestionCriterionTrialRepository.DeleteFromQueryAsync(t => t.Id == id); + // var success = await _readingQuestionCriterionTrialRepository.SaveChangesAsync(); + // return ResponseOutput.Result(success); + //} + + ///// + ///// 设置项目裁判信息 + ///// + ///// + ///// + //[HttpPost] + //public async Task SetTrialJudgyInfo(SetTrialJudgyInfoInDto inDto) + //{ + + // var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == inDto.TrialId && x.Id == inDto.TrialReadingCriterionId).FirstOrDefaultAsync(); + + // var judgeCount = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialCriterion.Id && x.IsJudgeQuestion) + // .WhereIf(trialCriterion.FormType == FormType.SinglePage, x => x.ReadingCriterionPageId == null) + // .WhereIf(trialCriterion.FormType == FormType.MultiplePage, x => x.ReadingCriterionPageId != null).CountAsync(); + + // if (judgeCount == 0 && (inDto.ArbitrationRule == ArbitrationRule.Visit || inDto.ArbitrationRule == ArbitrationRule.Reading)) + // { + // throw new BusinessValidationFailedException("无裁判问题却有仲裁对象,操作失败"); + // } + // await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(inDto.TrialReadingCriterionId, x => new ReadingQuestionCriterionTrial() + // { + // ArbitrationRule = inDto.ArbitrationRule, + // //IsArbitrationReading = inDto.IsArbitrationReading, + // }); + + // var result = await _trialRepository.SaveChangesAsync(); + // return ResponseOutput.Ok(result); + //} + + + //#endregion + #endregion + } } \ No newline at end of file