diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 16d3f9cc9..bd37cfbab 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -1475,17 +1475,147 @@ 阅片期名称 - + 标准ID - + 标准 - + + + 是否启用 + + + + + + + + + + Id + + + + + 系统标准Id + + + + + 类型 + + + + + 父问题触发 + + + + + 问题名称 + + + + + 是否是必须 + + + + + 排序 + + + + + 父问题ID + + + + + 类型值 + + + + + 系统标准Id + + + + + 类型 + + + + + 问题名称 + + + + + Id + + + + + 系统标准Id + + + + + 类型 + + + + + 父问题触发 + + + + + 问题名称 + + + + + 是否是必须 + + + + + 排序 + + + + + 父问题ID + + + + + 类型值 + + + + + 返回的对象 + + + + + 标准ID + + + + + 标准 + + + 是否启用 @@ -3796,13 +3926,46 @@ 阅片问题.标准 - + - 新增修改 + 新增修改系统问题标准 + + + 获取系统问题标准 + + + + + + 删除系统问题标准 + + + + + + + 新增修改系统问题 + + + + + + + 获取系统问题 + + + + + + 删除系统问题 + + + + 生成的阅片模块(在大列表上展示的) 阅片期 diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingClinicalDataDto.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingClinicalDataDto.cs index 4eb201e89..0c9c40644 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingClinicalDataDto.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingClinicalDataDto.cs @@ -294,16 +294,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// 对象ID /// [Required(ErrorMessage = "ReadingId为null")] - public Guid ReadingId { get; set; } + public Guid? ReadingId { get; set; } [Required(ErrorMessage = "SubjectId为null")] - public Guid SubjectId { get; set; } + public Guid? SubjectId { get; set; } /// /// 是否是访视 /// [Required(ErrorMessage = "IsVisit为null")] - public bool IsVisit { get; set; } + public bool? IsVisit { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs new file mode 100644 index 000000000..fdaddcbea --- /dev/null +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs @@ -0,0 +1,183 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IRaCIS.Core.Application.Service.Reading.Dto +{ + public class AddOrUpdateReadingQuestionCriterionSystemInDto + { + public Guid? Id { get; set; } + + /// + /// 标准ID + /// + public Guid CriterionId { get; set; } + + /// + /// 标准 + /// + public string CriterionName { get; set; } + + /// + /// 是否启用 + /// + public bool IsEnable { get; set; } + } + + /// + /// + /// + public class ReadingQuestionCriterionSystemViewInDto:PageInput + { + public string CriterionName { get; set; } + } + + + public class ReadingQuestionSystemView + { + /// + /// Id + /// + public Guid Id { get; set; } + + /// + /// 系统标准Id + /// + public Guid ReadingQuestionCriterionSystem { get; set; } + + /// + /// 类型 + /// + public string Type { get; set; } + + /// + /// 父问题触发 + /// + public string ParentTriggerValue { get; set; } + + /// + /// 问题名称 + /// + public string QuestionName { get; set; } + + /// + /// 是否是必须 + /// + public bool IsRequired { get; set; } + + /// + /// 排序 + /// + public int ShowOrder { get; set; } + + /// + /// 父问题ID + /// + public Guid? ParentId { get; set; } + + + /// + /// 类型值 + /// + public string TypeValue { get; set; } + + public bool IsEnable { get; set; } + } + + public class ReadingQuestionSystemViewInDto : PageInput + { + /// + /// 系统标准Id + /// + [Required(ErrorMessage = "ReadingQuestionCriterionSystemId为null")] + public Guid ReadingQuestionCriterionSystemId { get; set; } + + /// + /// 类型 + /// + public string Type { get; set; } = string.Empty; + + + /// + /// 问题名称 + /// + public string QuestionName { get; set; } = string.Empty; + } + + public class AddOrUpdateReadingQuestionSystemInDto + { + /// + /// Id + /// + public Guid? Id { get; set; } + + /// + /// 系统标准Id + /// + public Guid ReadingQuestionCriterionSystem { get; set; } + + /// + /// 类型 + /// + public string Type { get; set; } + + /// + /// 父问题触发 + /// + public string ParentTriggerValue { get; set; } = string.Empty; + + /// + /// 问题名称 + /// + public string QuestionName { get; set; } + + /// + /// 是否是必须 + /// + public bool IsRequired { get; set; } = false; + + /// + /// 排序 + /// + public int ShowOrder { get; set; } = 0; + + /// + /// 父问题ID + /// + public Guid? ParentId { get; set; } + + + /// + /// 类型值 + /// + public string TypeValue { get; set; } + + public bool IsEnable { get; set; } = false; + } + + public class ReadingQuestionCriterionSystemView + { + /// + /// 返回的对象 + /// + public Guid Id { get; set; } + + /// + /// 标准ID + /// + public Guid CriterionId { get; set; } + + /// + /// 标准 + /// + public string CriterionName { get; set; } + + /// + /// 是否启用 + /// + public bool IsEnable { get; set; } + } +} diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingClinicalDataService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingClinicalDataService.cs index 404b00066..81b713e19 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingClinicalDataService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingClinicalDataService.cs @@ -149,8 +149,8 @@ namespace IRaCIS.Application.Services var usedIdsQuery = _readingClinicalDataRepository.Where(x => x.ReadingId == inDto.ReadingId && x.Id != inDto.ReadingClinicalDataId).Select(x => x.ClinicalDataTrialSetId); List clinicalList = await _clinicalDataTrialSetRepository.Where(x=>x.TrialId==inDto.TrialId&&x.IsConfirm&&x.ClinicalDataSetName!= "既往局部治疗史") .Where(x=> !usedIdsQuery.Contains(x.Id)) - .WhereIf(inDto.IsVisit,x=>x.ClinicalDataLevel == ClinicalLevel.Subject||x.ClinicalDataLevel== ClinicalLevel.SubjectVisit) - .WhereIf(!inDto.IsVisit, x => x.ClinicalDataLevel == ClinicalLevel.Subject || x.ClinicalDataLevel == ClinicalLevel.Read) + .WhereIf(inDto.IsVisit.Value,x=>x.ClinicalDataLevel == ClinicalLevel.Subject||x.ClinicalDataLevel== ClinicalLevel.SubjectVisit) + .WhereIf(!inDto.IsVisit.Value, x => x.ClinicalDataLevel == ClinicalLevel.Subject || x.ClinicalDataLevel == ClinicalLevel.Read) .Select(x => new GetTrialClinicalDataSelectOutDto() { diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs index ea01fb5bb..0c8f6f24b 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs @@ -10,6 +10,7 @@ using IRaCIS.Core.Application.Service.Reading.Dto; using IRaCIS.Core.Domain.Share.Reading; using MassTransit; using IRaCIS.Core.Application.Service.Reading; +using IRaCIS.Core.Infra.EFCore.Common; namespace IRaCIS.Application.Services { @@ -21,42 +22,113 @@ namespace IRaCIS.Application.Services { public IRepository _subjectVisitRepository; - + private readonly IRepository _readingQuestionCriterionSystemRepository; + private readonly IRepository _readingQuestionSystemRepository; private readonly IRepository _clinicalDataTrialSetRepository; private readonly IRepository _clinicalDataSystemSetRepository; private readonly IRepository _previousPDFRepository; public ReadingQuestionService(IRepository subjectVisitRepository, - + + IRepository readingQuestionCriterionSystemRepository, + IRepository readingQuestionSystemRepository, IRepository ClinicalDataTrialSetRepository, IRepository ClinicalDataSystemSetRepository, IRepository previousPDFRepository ) { _subjectVisitRepository = subjectVisitRepository; - + this._readingQuestionCriterionSystemRepository = readingQuestionCriterionSystemRepository; + this._readingQuestionSystemRepository = readingQuestionSystemRepository; _clinicalDataTrialSetRepository = ClinicalDataTrialSetRepository; _clinicalDataSystemSetRepository = ClinicalDataSystemSetRepository; this._previousPDFRepository = previousPDFRepository; } - - - /// - /// 新增修改 + /// 新增修改系统问题标准 /// /// /// [HttpPost] public async Task AddOrUpdateReadingQuestionCriterionSystem(AddOrUpdateReadingQuestionCriterionSystemInDto indto) { - var entity = await _clinicalDataTrialSetRepository.InsertOrUpdateAsync(indto,true); + var entity = await _readingQuestionCriterionSystemRepository.InsertOrUpdateAsync(indto,true); return ResponseOutput.Ok(entity.Id.ToString()); } - + /// + /// 获取系统问题标准 + /// + /// + [HttpPost] + public async Task> GetReadingQuestionCriterionSystemList(ReadingQuestionCriterionSystemViewInDto inDto) + { + 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 == null ? nameof(ReadingQuestionCriterionSystemView.CriterionName) : inDto.SortField, + inDto.Asc); + } + + /// + /// 删除系统问题标准 + /// + /// + /// + [HttpDelete("{readingQuestionCriterionSystemId:guid}")] + public async Task DeleteReadingQuestionCriterionSystem(Guid readingQuestionCriterionSystemId) + { + await _readingQuestionCriterionSystemRepository.DeleteFromQueryAsync(t => t.Id == readingQuestionCriterionSystemId); + var success = await _readingQuestionCriterionSystemRepository.SaveChangesAsync(); + return ResponseOutput.Result(success); + } + + + + /// + /// 新增修改系统问题 + /// + /// + /// + [HttpPost] + public async Task AddOrUpdateReadingQuestionSystem(AddOrUpdateReadingQuestionSystemInDto indto) + { + var entity = await _readingQuestionSystemRepository.InsertOrUpdateAsync(indto, true); + return ResponseOutput.Ok(entity.Id.ToString()); + } + + /// + /// 获取系统问题 + /// + /// + [HttpPost] + public async Task> GetReadingQuestionSystemList(ReadingQuestionSystemViewInDto inDto) + { + var query = _readingQuestionSystemRepository.AsQueryable() + .Where(x=>x.ReadingQuestionCriterionSystemId==inDto.ReadingQuestionCriterionSystemId) + .WhereIf(!inDto.QuestionName.IsNullOrEmpty(), x => x.QuestionName.Contains(inDto.QuestionName)) + .WhereIf(!inDto.Type.IsNullOrEmpty(), x => x.Type.Contains(inDto.Type)) + .ProjectTo(_mapper.ConfigurationProvider); + return await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField == null ? nameof(ReadingQuestionSystemView.QuestionName) : inDto.SortField, + inDto.Asc); + } + + /// + /// 删除系统问题 + /// + /// + /// + [HttpDelete("{readingQuestionSystemId:guid}")] + public async Task DeleteReadingQuestionSystem(Guid readingQuestionSystemId) + { + await _readingQuestionSystemRepository.DeleteFromQueryAsync(t => t.Id == readingQuestionSystemId); + var success = await _readingQuestionSystemRepository.SaveChangesAsync(); + return ResponseOutput.Result(success); + } + + + - } } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionViewModel.cs b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionViewModel.cs deleted file mode 100644 index 046a7091e..000000000 --- a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionViewModel.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace IRaCIS.Core.Application.Service.Reading -{ - public class AddOrUpdateReadingQuestionCriterionSystemInDto - { - public Guid? Id { get; set; } - - /// - /// 标准ID - /// - public Guid CriterionId { get; set; } - - /// - /// 标准 - /// - public string CriterionName { get; set; } - - /// - /// 是否启用 - /// - public bool IsEnable { get; set; } - } -} diff --git a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs index 83058e06b..635d5d2cf 100644 --- a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs @@ -28,7 +28,6 @@ namespace IRaCIS.Core.Application.Service //.ForMember(d => d.FileCount, u => u.MapFrom(s => s.ReadingClinicalDataPDFList.Count())); CreateMap(); - //.ForMember(d => d.SiteNames, u => u.MapFrom(s => s.ReadingPeriodSites.SelectMany(x => x.Site.SiteName).ToList())); @@ -51,7 +50,8 @@ namespace IRaCIS.Core.Application.Service CreateMap(); #region 阅片问题 - + CreateMap(); + CreateMap(); #endregion diff --git a/IRaCIS.Core.Domain/Reading/ReadingQuestionSystem.cs b/IRaCIS.Core.Domain/Reading/ReadingQuestionSystem.cs new file mode 100644 index 000000000..acb791c6e --- /dev/null +++ b/IRaCIS.Core.Domain/Reading/ReadingQuestionSystem.cs @@ -0,0 +1,80 @@ + + +using System; +using IRaCIS.Core.Domain.Share; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using IRaCIS.Core.Domain.Share.Reading; +using System.Collections.Generic; + +namespace IRaCIS.Core.Domain.Models +{ + /// + /// 系统阅片问题 + /// + [Table("ReadingQuestionSystem")] + public class ReadingQuestionSystem : Entity, IAuditAdd + { + /// + /// 系统标准Id + /// + public Guid ReadingQuestionCriterionSystemId { get; set; } + + /// + /// 类型 + /// + public string Type { get; set; } + + /// + /// 父问题触发 + /// + public string ParentTriggerValue { get; set; } + + /// + /// 问题名称 + /// + public string QuestionName { get; set; } + + /// + /// 是否是必须 + /// + public bool IsRequired { get; set; } + + /// + /// 排序 + /// + public int ShowOrder { get; set; } + + /// + /// 父问题ID + /// + public Guid? ParentId { get; set; } + + + /// + /// 类型值 + /// + public string TypeValue { get; set; } + + public bool IsEnable { get; set; } + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + + /// + /// 创建人 + /// + public Guid CreateUserId { get; set; } + + + + } + + + + + + +} diff --git a/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs b/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs index b1c5c369e..e9db09029 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs @@ -41,6 +41,20 @@ namespace IRaCIS.Core.Infra.EFCore.Common } + public static bool IsNullOrEmpty(this string value) + { + if (value == null || value == string.Empty) + { + return true; + } + else + { + return false; + } + } + + + /// /// 获取DisplayName /// diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 20144bd1b..7458d5e30 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -184,6 +184,8 @@ namespace IRaCIS.Core.Infra.EFCore public virtual DbSet ReadingQuestionCriterionSystem { get; set; } + public virtual DbSet ReadingQuestionSystem { get; set; } + public virtual DbSet ReadingClinicalDataView { get; set; } public virtual DbSet ReadingClinicalDataPDF { get; set; }