diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs index 8e12973fc..ff52664e5 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs @@ -8,7 +8,61 @@ using System.Threading.Tasks; namespace IRaCIS.Core.Application.Service.Reading.Dto { + public class ReadingTableQuestionSystemView + { + public Guid Id { get; set; } + public Guid ReadingQuestionId { get; set; } + public string Type { get; set; } + public Guid? ParentId { get; set; } + public string ParentTriggerValue { get; set; } + public string QuestionName { get; set; } + public int IsRequired { get; set; } + public int ShowOrder { get; set; } + public string TypeValue { get; set; } + public bool IsEnable { get; set; } + public DateTime CreateTime { get; set; } + public Guid CreateUserId { get; set; } + public string Remark { get; set; } + public Guid? RelevanceId { get; set; } + public string RelevanceValue { get; set; } + public int ShowQuestion { get; set; } + public int? MaxQuestionCount { get; set; } + public string DataTableName { get; set; } + public string DataTableColumn { get; set; } + } + + public class ReadingTableQuestionSystemQuery + { + + + public Guid ReadingQuestionId { get; set; } + + } + + /// ReadingTableQuestionSystemAddOrEdit 列表查询参数模型 + public class ReadingTableQuestionSystemAddOrEdit + { + public Guid Id { get; set; } + public Guid ReadingQuestionId { get; set; } + public string Type { get; set; } + public Guid? ParentId { get; set; } + public string ParentTriggerValue { get; set; } + public string QuestionName { get; set; } + public int IsRequired { get; set; } + public int ShowOrder { get; set; } + public string TypeValue { get; set; } + public bool IsEnable { get; set; } + public DateTime CreateTime { get; set; } + public Guid CreateUserId { get; set; } + public string Remark { get; set; } + public Guid? RelevanceId { get; set; } + public string RelevanceValue { get; set; } + public int ShowQuestion { get; set; } + public int? MaxQuestionCount { get; set; } + public string DataTableName { get; set; } + public string DataTableColumn { get; set; } + } public class ReadingCriterionPageView { @@ -484,6 +538,21 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public Guid? ReadingCriterionPageId { get; set; } } + + public class GetReadingTableOtherQuestionSystemInDto + { + /// + /// 表格父问题的ID + /// + [NotDefault] + public Guid ReadingQuestionId { get; set; } + + /// + /// 当前ID + /// + public Guid? Id { get; set; } + } + public class GetTrialCriterionOtherQuestionInDto { [NotDefault] diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs index 75374245c..3507f03a7 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs @@ -33,7 +33,7 @@ namespace IRaCIS.Application.Services private readonly IRepository _dictionaryRepository; private readonly IRepository _readingCriterionPageRepository; private readonly IRepository _trialRepository; - + private readonly IRepository _readingTableQuestionSystemRepository; private readonly IRepository _readingTaskQuestionAnswer; private readonly IRepository _previousPDFRepository; @@ -48,7 +48,7 @@ namespace IRaCIS.Application.Services IRepository dictionaryRepository, IRepository readingCriterionPageRepository, IRepository trialRepository, - + IRepository readingTableQuestionSystemRepository, IRepository readingTaskQuestionAnswer, IRepository previousPDFRepository ) @@ -63,11 +63,89 @@ namespace IRaCIS.Application.Services this._dictionaryRepository = dictionaryRepository; this._readingCriterionPageRepository = readingCriterionPageRepository; this._trialRepository = trialRepository; - + this._readingTableQuestionSystemRepository = readingTableQuestionSystemRepository; this._readingTaskQuestionAnswer = readingTaskQuestionAnswer; this._previousPDFRepository = previousPDFRepository; } + + /// + /// 获取系统的表格问题 + /// + /// + /// + public async Task> GetReadingTableQuestionSystemList(ReadingTableQuestionSystemQuery inDto) + { + + + var readingTableQuestionSystemQueryable = _readingTableQuestionSystemRepository + .Where(x=>x.ReadingQuestionId==inDto.ReadingQuestionId).ProjectTo(_mapper.ConfigurationProvider); + + var result=await readingTableQuestionSystemQueryable.ToListAsync(); + return result; + } + + + /// + /// 新增修改系统表格问题 + /// + /// + /// + public async Task AddOrUpdateReadingTableQuestionSystem(ReadingTableQuestionSystemAddOrEdit addOrEditReadingTableQuestionSystem) + { + + var entity = await _readingTableQuestionSystemRepository.InsertOrUpdateAsync(addOrEditReadingTableQuestionSystem, true); + + return ResponseOutput.Ok(entity.Id.ToString()); + + } + + + /// + /// 删除系统表格问题 + /// + /// + /// + [HttpDelete("{Id:guid}")] + public async Task DeleteReadingTableQuestionSystem(Guid Id) + { + if(await _readingTableQuestionSystemRepository.AnyAsync(x=>x.ParentId==Id||x.RelevanceId==Id)) + { + return ResponseOutput.NotOk("当前问题存在子问题 删除失败"); + } + + await _readingTableQuestionSystemRepository.BatchDeleteNoTrackingAsync(t => t.Id == Id); + var success= await _readingTableQuestionSystemRepository.SaveChangesAsync(); + return ResponseOutput.Result(success); + } + + + /// + /// 获取系统表格其他问题 + /// + /// + /// + [HttpPost] + public async Task> GetReadingTableOtherQuestionSystem(GetReadingTableOtherQuestionSystemInDto inDto) + { + var types = new List() + { + "select","radio" + }; + var questionList = await _readingTableQuestionSystemRepository.Where(x => x.ReadingQuestionId == inDto.ReadingQuestionId) + .Where(x => types.Contains(x.Type)) + .WhereIf(inDto.Id != null, x => x.Id != inDto.Id && x.ParentId != inDto.Id) + + .Select(x => new CriterionOtherQuestionOutDto() + { + QuestionId = x.Id, + QuestionName = x.QuestionName, + TypeValue = x.TypeValue, + }).ToListAsync(); + + return questionList; + } + /// /// 设置项目裁判信息 /// diff --git a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs index 03965230a..f08039714 100644 --- a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs @@ -51,8 +51,10 @@ namespace IRaCIS.Core.Application.Service #region 阅片问题 + CreateMap(); + CreateMap(); + - CreateMap(); CreateMap(); diff --git a/IRaCIS.Core.Domain/Reading/ReadingTableQuestionSystem.cs b/IRaCIS.Core.Domain/Reading/ReadingTableQuestionSystem.cs new file mode 100644 index 000000000..59e291eb3 --- /dev/null +++ b/IRaCIS.Core.Domain/Reading/ReadingTableQuestionSystem.cs @@ -0,0 +1,112 @@ + +//-------------------------------------------------------------------- +// 此代码由T4模板自动生成 byzhouhang 20210918 +// 生成时间 2022-08-11 14:15:27 +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +using System; +using IRaCIS.Core.Domain.Share; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace IRaCIS.Core.Domain.Models +{ + /// + ///系统表格问题 + /// + [Table("ReadingTableQuestionSystem")] + public class ReadingTableQuestionSystem : Entity, IAuditAdd + { + + /// + /// 问题ID + /// + public Guid ReadingQuestionId { get; set; } + + /// + /// Type + /// + public string Type { get; set; } + + /// + /// ParentId + /// + public Guid? ParentId { get; set; } + + /// + ///父问题触发值 + /// + public string ParentTriggerValue { get; set; } + + /// + /// 问题名称 + /// + public string QuestionName { get; set; } + + /// + /// IsRequired + /// + public int IsRequired { get; set; } + + /// + /// 排序号 + /// + public int ShowOrder { get; set; } + + /// + /// 值 + /// + public string TypeValue { get; set; } + + /// + /// 是否启用 + /// + public bool IsEnable { get; set; } + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + + /// + /// 创建用户 + /// + public Guid CreateUserId { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + + /// + /// 显示父问题 + /// + public Guid? RelevanceId { get; set; } + + /// + /// 显示父问题的值 + /// + public string RelevanceValue { get; set; } + + /// + /// 是否显示 + /// + public int ShowQuestion { get; set; } + + /// + /// 最大问题数 + /// + public int? MaxQuestionCount { get; set; } + + /// + /// 数据表名称 + /// + public string DataTableName { get; set; } + + /// + /// 数据列 + /// + public string DataTableColumn { get; set; } + + } + + +} diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 0c1c92605..3eb7f2c51 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -202,6 +202,8 @@ namespace IRaCIS.Core.Infra.EFCore #region Reading + + public virtual DbSet ReadingTableQuestionSystem { get; set; } public virtual DbSet ReadingPeriodSet { get; set; } public virtual DbSet ReadingTaskQuestionAnswer { get; set; } diff --git a/IRaCIS.Core.Test/DbHelper.ttinclude b/IRaCIS.Core.Test/DbHelper.ttinclude index e25d06801..0196c8474 100644 --- a/IRaCIS.Core.Test/DbHelper.ttinclude +++ b/IRaCIS.Core.Test/DbHelper.ttinclude @@ -4,7 +4,7 @@ public static readonly string ConnectionString = "Server=123.56.94.154,1433\\MSSQLSERVER;Database=IRaCIS_New_Tet;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true"; public static readonly string DbDatabase = "IRaCIS_New_Tet"; //ַ,ƴ - public static readonly string TableName = "ReadingOncologyTaskInfo"; + public static readonly string TableName = "ReadingTableQuestionSystem"; //ļ service Ƿҳ } #>