diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml index d0ea724ec..87aed4ebc 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.xml +++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml @@ -175,7 +175,8 @@ 上传临床数据 - + + diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 9756f57b0..dd2f698ba 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -552,6 +552,41 @@ 排序字段 + + + 项目ID + + + + + 阅片期名称 + + + + + 阅片范围 + + + + + 截止日期 + + + + + 截止访视 + + + + + 访视计划ID + + + + + 是否生效 + + 项目ID diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingPeriodSetViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingPeriodSetViewModel.cs index 576851e0d..9a305e05b 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingPeriodSetViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingPeriodSetViewModel.cs @@ -1,4 +1,5 @@ -using System; +using IRaCIS.Core.Domain.Share.Reading; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,11 +7,49 @@ using System.Threading.Tasks; namespace IRaCIS.Core.Application.Service.Reading.Dto { - public class ReadingPeriodSetAddOrEdit : ReadingPeriodSet + public class ReadingPeriodSetAddOrEdit { public new Guid? Id { get; set; } - } + /// + /// 项目ID + /// + public Guid? TrialId { get; set; } + + /// + /// 阅片期名称 + /// + public string ReadingPeriodName { get; set; } + + /// + /// 阅片范围 + /// + public ReadingScopeEnum? ReadingScope { get; set; } + + /// + /// 截止日期 + /// + public DateTime ExpirationDate { get; set; } + + /// + /// 截止访视 + /// + public decimal? ExpirationVisit { get; set; } + + /// + /// 访视计划ID + /// + public Guid? VisitStageId { get; set; } + + /// + /// 是否生效 + /// + public int? IsTakeEffect { get; set; } + + + public List SiteIds { get; set; } = new List(); + + } public class ReadingPeriodSetView : ReadingPeriodSet diff --git a/IRaCIS.Core.Application/Service/Reading/PreviousPDFService.cs b/IRaCIS.Core.Application/Service/Reading/PreviousPDFService.cs index 02b20448d..2403eae3b 100644 --- a/IRaCIS.Core.Application/Service/Reading/PreviousPDFService.cs +++ b/IRaCIS.Core.Application/Service/Reading/PreviousPDFService.cs @@ -65,6 +65,7 @@ namespace IRaCIS.Application.Services x.FileName, x.UploadType, x.Id, + }).ToListAsync(); return list; } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingPeriodSetService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingPeriodSetService.cs index 32eb50839..de96b8af3 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingPeriodSetService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingPeriodSetService.cs @@ -38,8 +38,31 @@ namespace IRaCIS.Application.Services [HttpPost] public async Task AddOrUpdateReadingPeriodSet(ReadingPeriodSetAddOrEdit addOrEditReadingPeriodSet) { - var entity = await _repository.InsertOrUpdateAsync(addOrEditReadingPeriodSet, true); - return ResponseOutput.Ok(entity.Id.ToString()); + if (addOrEditReadingPeriodSet.Id == null) + { + var entity = _mapper.Map(addOrEditReadingPeriodSet); + entity.ReadingPeriodSites = addOrEditReadingPeriodSet.SiteIds.Select(x => new ReadingPeriodSite() + { + ReadingPeriodSetId = entity.Id, + SiteId = x, + }).ToList(); + + await _readingPeriodSetRepository.AddAsync(entity, true); + return ResponseOutput.Ok(); + } + else + { + var entity = (await _readingPeriodSetRepository.Where(t => t.Id == addOrEditReadingPeriodSet.Id, true).Include(t => t.ReadingPeriodSites).FirstOrDefaultAsync()).IfNullThrowException(); + _mapper.Map(addOrEditReadingPeriodSet, entity); + entity.ReadingPeriodSites = addOrEditReadingPeriodSet.SiteIds.Select(x => new ReadingPeriodSite() + { + ReadingPeriodSetId = entity.Id, + SiteId = x, + }).ToList(); + var success = await _readingPeriodSetRepository.SaveChangesAsync(); + return ResponseOutput.Ok(); + + } } /// diff --git a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs index 3d02b35c6..c90c840fe 100644 --- a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs @@ -11,7 +11,8 @@ namespace IRaCIS.Core.Application.Service { public ReadingConfig() { - CreateMap().ReverseMap(); + CreateMap(); + CreateMap(); @@ -23,6 +24,11 @@ namespace IRaCIS.Core.Application.Service CreateMap(); + + + + + } } diff --git a/IRaCIS.Core.Domain/Reading/ReadingPeriodSet.cs b/IRaCIS.Core.Domain/Reading/ReadingPeriodSet.cs index fbd2d6fbd..ff2bc4e71 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingPeriodSet.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingPeriodSet.cs @@ -5,6 +5,7 @@ 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 { @@ -30,11 +31,6 @@ namespace IRaCIS.Core.Domain.Models /// public ReadingScopeEnum? ReadingScope { get; set; } - /// - /// 中心ID - /// - public Guid? SiteId { get; set; } - /// /// 截止日期 /// @@ -65,6 +61,7 @@ namespace IRaCIS.Core.Domain.Models /// public Guid CreateUserId { get; set; } + public List ReadingPeriodSites { get; set; } = new List(); } diff --git a/IRaCIS.Core.Domain/Reading/ReadingPeriodSite.cs b/IRaCIS.Core.Domain/Reading/ReadingPeriodSite.cs index d44ba3285..cb6828163 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingPeriodSite.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingPeriodSite.cs @@ -16,8 +16,9 @@ namespace IRaCIS.Core.Domain.Models { /// - /// 项目ID + ///阅片期配置ID /// + public Guid? ReadingPeriodSetId { get; set; } /// @@ -35,6 +36,8 @@ namespace IRaCIS.Core.Domain.Models /// public Guid CreateUserId { get; set; } + public ReadingPeriodSet ReadingPeriodSet { get; set; } + }