diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 09e99d02f..23369e100 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -445,6 +445,61 @@ + + + 项目ID + + + + + 名称 + + + + + 临床级别 + + + + + 上传方式 + + + + + 项目ID + + + + + 名称 + + + + + 临床级别 + + + + + 上传方式 + + + + + 系统的ClinicalDataSetId + + + + + 创建时间 + + + + + 创建人 + + 项目Id @@ -465,24 +520,9 @@ 项目ID - + - 页码 - - - - - 每页大小 - - - - - 排序字段 - - - - - 排序字段 + 名称 @@ -3149,6 +3189,39 @@ + + + 临床数据配置 + + + + + 新增或者修改 + + + + + + + 分页获取 + + + + + + + 将系统配置添加到项目配置 + + + + + + + 删除 + + + + 临床数据 原表 diff --git a/IRaCIS.Core.Application/Service/Reading/ClinicalDataSetService.cs b/IRaCIS.Core.Application/Service/Reading/ClinicalDataSetService.cs new file mode 100644 index 000000000..9733582e6 --- /dev/null +++ b/IRaCIS.Core.Application/Service/Reading/ClinicalDataSetService.cs @@ -0,0 +1,111 @@ +using IRaCIS.Application.Interfaces; +using IRaCIS.Core.Infra.EFCore; +using IRaCIS.Core.Domain.Share; +using IRaCIS.Core.Application.Filter; +using Microsoft.AspNetCore.Mvc; +using IRaCIS.Core.Application.Service.WorkLoad.DTO; +using Microsoft.AspNetCore.Authorization; +using IRaCIS.Core.Application.Auth; +using IRaCIS.Core.Application.Service.Reading.Dto; +using IRaCIS.Core.Domain.Share.Reading; +using MassTransit; + +namespace IRaCIS.Application.Services +{ + /// + /// 临床数据配置 + /// + [ApiExplorerSettings(GroupName = "Reading")] + public class ClinicalDataSetService : BaseService + { + + public IRepository _subjectVisitRepository; + private readonly IRepository _clinicalDataRepository; + private readonly IRepository _clinicalDataSetRepository; + private readonly IRepository _previousPDFRepository; + + public ClinicalDataSetService(IRepository subjectVisitRepository, + IRepository clinicalDataRepository, + IRepository ClinicalDataSetRepository, + IRepository previousPDFRepository + ) + { + _subjectVisitRepository = subjectVisitRepository; + _clinicalDataRepository = clinicalDataRepository; + _clinicalDataSetRepository = ClinicalDataSetRepository; + this._previousPDFRepository = previousPDFRepository; + } + + + /// + /// 新增或者修改 + /// + /// + /// + [HttpPost] + public async Task AddOrUpdateClinicalDataSet(ClinicalDataSetAddOrEdit indto) + { + var entity = await _clinicalDataSetRepository.InsertOrUpdateAsync(indto,true); + return ResponseOutput.Ok(entity.Id.ToString()); + } + + /// + /// 分页获取 + /// + /// + /// + [HttpPost] + public async Task> GetClinicalDataSetList(ClinicalDataQuery query) + { + var readquery = _clinicalDataSetRepository.AsQueryable() + .Where( x => x.TrialId == query.TrialId) + .WhereIf(query.ClinicalDataSetName!=string.Empty,x=>x.ClinicalDataSetName.Contains(query.ClinicalDataSetName)) + .ProjectTo(_mapper.ConfigurationProvider); + var pageList = await readquery.ToPagedListAsync(query.PageIndex, query.PageSize, query.SortField == null ? "CreateTime" : query.SortField, + query.Asc); + + return pageList; + } + + + /// + /// 将系统配置添加到项目配置 + /// + /// + /// + [HttpPost] + public async Task AddTrialClinicalDataSet(AddTrialClinicalDataSetInDto inDto) + { + var trialSystemIds =await _clinicalDataSetRepository.Where(x => x.TrialId == inDto.TrialId && x.SystemClinicalDataSetId != null).Select(x => x.SystemClinicalDataSetId.Value).ToListAsync(); + var needAddids = inDto.Ids.Except(trialSystemIds).ToList(); + var systemDataList =await _clinicalDataSetRepository.Where(x => needAddids.Contains(x.Id)).ToListAsync(); + List dataSets = systemDataList.Select(x => new ClinicalDataSet() + { + Id= NewId.NextGuid(), + SystemClinicalDataSetId=x.Id, + ClinicalDataSetName=x.ClinicalDataSetName, + ClinicalDataLevel=x.ClinicalDataLevel, + ClinicalUploadType=x.ClinicalUploadType, + TrialId=inDto.TrialId, + }).ToList(); + await _clinicalDataSetRepository.AddRangeAsync(dataSets); + var result= await _clinicalDataSetRepository.SaveChangesAsync(); + return ResponseOutput.Ok(result); + } + + + + + /// + /// 删除 + /// + /// + /// + [HttpDelete("{id:guid}")] + public async Task DeleteClinicalSetData(Guid id) + { + await _clinicalDataSetRepository.DeleteFromQueryAsync(x=>x.Id== id,true); + return ResponseOutput.Result(true); + } + } +} diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ClinicalDataServiceViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ClinicalDataServiceViewModel.cs index 2e597b94f..bf88343ae 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ClinicalDataServiceViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ClinicalDataServiceViewModel.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; @@ -13,11 +14,81 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto } + public class ClinicalDataSetAddOrEdit + { + public Guid? Id { get; set; } + + /// + /// 项目ID + /// + public Guid? TrialId { get; set; } + + + /// + /// 名称 + /// + public string ClinicalDataSetName { get; set; } + + /// + /// 临床级别 + /// + public ClinicalLevel ClinicalDataLevel { get; set; } + + + /// + /// 上传方式 + /// + public ClinicalUploadType ClinicalUploadType { get; set; } + } + public class ClinicalDataView : ClinicalData { } + public class ClinicalDataSetView + { + public Guid Id { get; set; } + + /// + /// 项目ID + /// + public Guid? TrialId { get; set; } + + + /// + /// 名称 + /// + public string ClinicalDataSetName { get; set; } + + /// + /// 临床级别 + /// + public ClinicalLevel ClinicalDataLevel { get; set; } + + + /// + /// 上传方式 + /// + public ClinicalUploadType ClinicalUploadType { get; set; } + + + /// + /// 系统的ClinicalDataSetId + /// + public Guid? SystemClinicalDataSetId { get; set; } + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + + /// + /// 创建人 + /// + public Guid CreateUserId { get; set; } + } + public class ClinicalDataInDto { /// @@ -35,34 +106,24 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public Guid VisitOrReadId { get; set; } } - public class ClinicalDataQuery + public class ClinicalDataQuery:PageInput { /// /// 项目ID /// public Guid? TrialId { get; set; } - - /// - /// 页码 + /// 名称 /// - public int PageIndex { get; set; } = 1; + public string ClinicalDataSetName { get; set; }=string.Empty; - /// - /// 每页大小 - /// - public int PageSize { get; set; } = 10; + } + public class AddTrialClinicalDataSetInDto + { + public List Ids { get; set; } = new List(); - /// - /// 排序字段 - /// - public string? SortField { get; set; } - - /// - /// 排序字段 - /// - public bool SortAsc { get; set; } = true; + public Guid TrialId { get; set; } } } diff --git a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs index 107afd587..3bb9d7538 100644 --- a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs @@ -25,8 +25,12 @@ namespace IRaCIS.Core.Application.Service CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + CreateMap(); + CreateMap(); + CreateMap().ReverseMap(); CreateMap(); diff --git a/IRaCIS.Core.Domain/Reading/ClinicalDataSet.cs b/IRaCIS.Core.Domain/Reading/ClinicalDataSet.cs new file mode 100644 index 000000000..68e7b259c --- /dev/null +++ b/IRaCIS.Core.Domain/Reading/ClinicalDataSet.cs @@ -0,0 +1,63 @@ + + +using System; +using IRaCIS.Core.Domain.Share; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using IRaCIS.Core.Domain.Share.Reading; + +namespace IRaCIS.Core.Domain.Models +{ + /// + /// 临床资料配置 + /// + [Table("ClinicalDataSet")] + public class ClinicalDataSet : Entity, IAuditAdd + { + + /// + /// 项目ID + /// + public Guid? TrialId { get; set; } + + + /// + /// 名称 + /// + public string ClinicalDataSetName { get; set; } + + /// + /// 临床级别 + /// + public ClinicalLevel ClinicalDataLevel { get; set; } + + + /// + /// 上传方式 + /// + public ClinicalUploadType ClinicalUploadType { get; set; } + + + /// + /// 系统的ClinicalDataSetId + /// + public Guid? SystemClinicalDataSetId { get; set; } + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + + /// + /// 创建人 + /// + public Guid CreateUserId { get; set; } + + } + + + + + + +} diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 9c0718c28..4489563e3 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -183,6 +183,7 @@ namespace IRaCIS.Core.Infra.EFCore public virtual DbSet ReadModule { get; set; } public virtual DbSet ReadModuleView { get; set; } + public virtual DbSet ClinicalDataSet { get; set; } public virtual DbSet ClinicalData { get; set; }