diff --git a/IRaCIS.Core.API/Controllers/UploadController.cs b/IRaCIS.Core.API/Controllers/UploadController.cs index 30e373e3..f1ea5b06 100644 --- a/IRaCIS.Core.API/Controllers/UploadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadController.cs @@ -111,6 +111,66 @@ namespace IRaCIS.Core.API.Controllers return ResponseOutput.Ok(); } + + /// + /// 上传通用文档 比如一致性核查的 比如导出的excel 模板 + /// + /// + [HttpPost("CommonDocument/UploadCommonDoc/{fileType}/{moduleType}")] + [DisableRequestSizeLimit] + [DisableFormValueModelBinding] + public async Task UploadCommonDoc(string fileType,string moduleType) + { + var boundary = HeaderUtilities.RemoveQuotes(MediaTypeHeaderValue.Parse(Request.ContentType).Boundary).Value; + + var reader = new MultipartReader(boundary, HttpContext.Request.Body); + + var section = await reader.ReadNextSectionAsync(); + + while (section != null) + { + var hasContentDispositionHeader = ContentDispositionHeaderValue.TryParse(section.ContentDisposition, out var contentDisposition); + + if (hasContentDispositionHeader) + { + + DealCommonStorePath(fileType, moduleType, contentDisposition.FileName.Value, out string serverFilePath, out string relativePath); + + await WriteFileAsync(section.Body, serverFilePath); + + //仅仅返回一个文件,如果多文件上传 在最后返回多个路径 + return ResponseOutput.Ok(new + { + FilePath = relativePath, + FullFilePath = relativePath + "?access_token=" + _userInfo.UserToken + }); + + } + section = await reader.ReadNextSectionAsync(); + } + return ResponseOutput.Ok(); + } + + private void DealCommonStorePath(string fileType, string moduleType, string fileRealName, out string serverFilePath, out string relativePath) + { + var rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).FullName; + //上传根路径 + var _fileStorePath = Path.Combine(rootPath, StaticData.CommonFileFolder); + + //文件类型路径处理 + var uploadFolderPath = Path.Combine(_fileStorePath, moduleType, fileType); + if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath); + + + var fileNameEX = Path.GetExtension(fileRealName); + var trustedFileNameForFileStorage = Guid.NewGuid().ToString() + fileNameEX; + + relativePath = $"/{StaticData.CommonFileFolder}/{moduleType}/{fileType}/{trustedFileNameForFileStorage}"; + + serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage); + } + + private void DealSysTemStorePath( string type, string fileRealName, out string serverFilePath, out string relativePath) { var rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).FullName; diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml index dab7da8b..c94caeea 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.xml +++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml @@ -180,6 +180,12 @@ + + + 上传通用文档 比如一致性核查的 比如导出的excel 模板 + + + 上传临床数据 diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 8e2cd6ce..058c044d 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -34,6 +34,354 @@ 主要为了 处理项目结束 锁库,不允许操作 + + + CommonDocumentService + + + + + FrontAuditConfigService + + + + + 获取列表 + + + + + + + 新增或者修改 + + + + + + + 删除 + + + + + + 指定资源Id,渲染Dicom检查的Jpeg预览图像 + Dicom检查的Id + + + + 获取某个检查的关联检查列表(该受试者在这个想项目下的所有检查) + 点击检查检查列表中的一个检查获取对应的序列列表(调用之前的接口:/series/list/,根据StudyId,获取访视的序列列表) + + + + + 指定资源Id,获取Dicom检查信息 + Dicom检查的Id + + + + 批量验证 检查是否可以上传 并告知原因 + + + + + SystemAnonymizationService + + + + + 子类 + + + + + 创建人名称 + + + + + 项目名称 + + + + + 中心名称 + + + + + 受试者Code + + + + + 访视名称 + + + + + 角色名称 + + + + + 中心Code + + + + + 项目编码 + + + + + 配置 基础逻辑信息 + + + + + 配置流程 + + + + + 配置加急信息 + + + + + 用户 签名某个文档 Dto + + + + + 功能模块 + + + + + 盲态访视名 + + + + + 项目iD + + + + + 中心 + + + + + 受试者 + + + + + 访视 + + + + + 操作类型 + + + + + 子类 + + + + + 修改原因 + + + + + 是否有签名 + + + + + 通用逻辑封装 + + 方法参数 + 添加稽查 + 用户签名 + 委托 + 方法返回的结果 + 添加状态的对象 + + + + + 映射 SiteId SubjectId SubjectVisitId TrialId 最开始没有 需要特殊处理 + + + + + + 验证用户签名信息 /// + + + 添加签名记录 /// + + + + 添加稽查记录 + + 添加对象 + 签名Id + 初始化状态对象 + + + + + 设置项目以及名称 + + + + + + + 项目外部人员 录入流程相关 + + + + + 添加和更新接口 已验证邮箱和账户类型不允许添加重复项 + + + + + + + 勾选用户 批量发送邮件 + + + + + + 不带Token 访问 用户选择 参与 不参与 Id: TrialExternalUserId + + + + + + + 不带Token 访问 Site调研用户 加入项目 Id: TrialSiteSurveyUserId + + + + + + + 不带Token 访问 页面获取项目基本信息 和参与情况 (已经确认了 就不允许再次确认) Id: TrialExternalUserId/TrialSiteSurveyUserId + + + + + + + 加入项目 + + + + + + + + TrialUserPreparation Service + + + + + 项目下 人员邀请 加入列表 + + + + + + + 不带Token访问 加入项目 记录 同意与否 + + + + + + + 用户加入项目 + + + + + + CommonDocumentView 列表视图模型 + + + CommonDocumentQuery 列表查询参数模型 + + + CommonDocumentAddOrEdit 列表查询参数模型 + + + FrontAuditConfigView 列表视图模型 + + + FrontAuditConfigQuery 列表查询参数模型 + + + Value + + + ValueCN + + + Description + + + Code + + + OptTypeId + + + ChildrenTypeId + + + FrontAuditConfigAddOrEdit 列表查询参数模型 + + + SystemAnonymizationView 列表视图模型 + + + SystemAnonymizationQuery 列表查询参数模型 + + + SystemAnonymizationAddOrEdit 列表查询参数模型 + + + TrialExternalUserView 列表视图模型 + + + TrialExternalUserQuery 列表查询参数模型 + + + TrialExternalUserAddOrEdit 列表查询参数模型 + + + TrialUserPreparation View 列表视图模型 + + + TrialUserPreparation Query 列表查询参数模型 + + + TrialUserPreparation AddOrEdit 列表查询参数模型 + EmailNoticeConfigView 列表视图模型 @@ -490,340 +838,11 @@ 是否有 入组评估确认 - - FrontAuditConfigView 列表视图模型 - - - FrontAuditConfigQuery 列表查询参数模型 - - - Value - - - ValueCN - - - Description - - - Code - - - OptTypeId - - - ChildrenTypeId - - - FrontAuditConfigAddOrEdit 列表查询参数模型 - - - SystemAnonymizationView 列表视图模型 - - - SystemAnonymizationQuery 列表查询参数模型 - - - SystemAnonymizationAddOrEdit 列表查询参数模型 - - - TrialExternalUserView 列表视图模型 - - - TrialExternalUserQuery 列表查询参数模型 - - - TrialExternalUserAddOrEdit 列表查询参数模型 - - - TrialUserPreparation View 列表视图模型 - - - TrialUserPreparation Query 列表查询参数模型 - - - TrialUserPreparation AddOrEdit 列表查询参数模型 - - + - FrontAuditConfigService + ICommonDocumentService - - - 获取列表 - - - - - - - 新增或者修改 - - - - - - - 删除 - - - - - - 指定资源Id,渲染Dicom检查的Jpeg预览图像 - Dicom检查的Id - - - - 获取某个检查的关联检查列表(该受试者在这个想项目下的所有检查) - 点击检查检查列表中的一个检查获取对应的序列列表(调用之前的接口:/series/list/,根据StudyId,获取访视的序列列表) - - - - - 指定资源Id,获取Dicom检查信息 - Dicom检查的Id - - - - 批量验证 检查是否可以上传 并告知原因 - - - - - SystemAnonymizationService - - - - - 子类 - - - - - 创建人名称 - - - - - 项目名称 - - - - - 中心名称 - - - - - 受试者Code - - - - - 访视名称 - - - - - 角色名称 - - - - - 中心Code - - - - - 项目编码 - - - - - 配置 基础逻辑信息 - - - - - 配置流程 - - - - - 配置加急信息 - - - - - 用户 签名某个文档 Dto - - - - - 功能模块 - - - - - 盲态访视名 - - - - - 项目iD - - - - - 中心 - - - - - 受试者 - - - - - 访视 - - - - - 操作类型 - - - - - 子类 - - - - - 修改原因 - - - - - 是否有签名 - - - - - 通用逻辑封装 - - 方法参数 - 添加稽查 - 用户签名 - 委托 - 方法返回的结果 - 添加状态的对象 - - - - - 映射 SiteId SubjectId SubjectVisitId TrialId 最开始没有 需要特殊处理 - - - - - - 验证用户签名信息 /// - - - 添加签名记录 /// - - - - 添加稽查记录 - - 添加对象 - 签名Id - 初始化状态对象 - - - - - 设置项目以及名称 - - - - - - - 项目外部人员 录入流程相关 - - - - - 添加和更新接口 已验证邮箱和账户类型不允许添加重复项 - - - - - - - 勾选用户 批量发送邮件 - - - - - - 不带Token 访问 用户选择 参与 不参与 Id: TrialExternalUserId - - - - - - - 不带Token 访问 Site调研用户 加入项目 Id: TrialSiteSurveyUserId - - - - - - - 不带Token 访问 页面获取项目基本信息 和参与情况 (已经确认了 就不允许再次确认) Id: TrialExternalUserId/TrialSiteSurveyUserId - - - - - - - 加入项目 - - - - - - - - TrialUserPreparation Service - - - - - 项目下 人员邀请 加入列表 - - - - - - - 不带Token访问 加入项目 记录 同意与否 - - - - - - - 用户加入项目 - - - - IFrontAuditConfigService diff --git a/IRaCIS.Core.Application/Service/Common/CommonDocumentService.cs b/IRaCIS.Core.Application/Service/Common/CommonDocumentService.cs new file mode 100644 index 00000000..bb391aa1 --- /dev/null +++ b/IRaCIS.Core.Application/Service/Common/CommonDocumentService.cs @@ -0,0 +1,57 @@ +//-------------------------------------------------------------------- +// 此代码由T4模板自动生成 byzhouhang 20210918 +// 生成时间 2022-03-31 13:18:56 +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +//-------------------------------------------------------------------- + +using IRaCIS.Core.Domain.Models; +using Microsoft.AspNetCore.Mvc; +using IRaCIS.Core.Application.Interfaces; +using IRaCIS.Core.Application.ViewModel; +namespace IRaCIS.Core.Application.Service +{ + /// + /// CommonDocumentService + /// + [ApiExplorerSettings(GroupName = "Common")] + public class CommonDocumentService : BaseService, ICommonDocumentService + { + + private readonly IRepository _commonDocumentRepository; + + public CommonDocumentService(IRepository commonDocumentRepository) + { + _commonDocumentRepository = commonDocumentRepository; + } + + [HttpPost] + public async Task> GetCommonDocumentList(CommonDocumentQuery queryCommonDocument) + { + + + var commonDocumentQueryable = _commonDocumentRepository.ProjectTo(_mapper.ConfigurationProvider); + + return await commonDocumentQueryable.ToListAsync(); + } + + + public async Task AddOrUpdateCommonDocument(CommonDocumentAddOrEdit addOrEditCommonDocument) + { + var verifyExp1 = new EntityVerifyExp() + { + VerifyExp = t => t.Code == addOrEditCommonDocument.Code, + VerifyMsg = "Document Code Can not Repeat." + }; + + var entity = await _commonDocumentRepository.InsertOrUpdateAsync(addOrEditCommonDocument, true, verifyExp1); + + return ResponseOutput.Ok(entity.Id.ToString()); + + } + + + + + + } +} diff --git a/IRaCIS.Core.Application/Service/Common/DTO/CommonDocumentViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/CommonDocumentViewModel.cs new file mode 100644 index 00000000..acbdb683 --- /dev/null +++ b/IRaCIS.Core.Application/Service/Common/DTO/CommonDocumentViewModel.cs @@ -0,0 +1,52 @@ +//-------------------------------------------------------------------- +// 此代码由T4模板自动生成 byzhouhang 20210918 +// 生成时间 2022-03-31 13:18:48 +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +//-------------------------------------------------------------------- +using System; +using IRaCIS.Core.Domain.Share; +using System.Collections.Generic; +namespace IRaCIS.Core.Application.ViewModel +{ + /// CommonDocumentView 列表视图模型 + public class CommonDocumentView : CommonDocumentAddOrEdit + { + + //public string FileType { get; set; } = String.Empty; + //public string ModuleType { get; set; } = String.Empty; + + + + public DateTime CreateTime { get; set; } + public DateTime UpdateTime { get; set; } + + } + + ///CommonDocumentQuery 列表查询参数模型 + public class CommonDocumentQuery + { + public Guid? FileTypeId { get; set; } + public Guid? ModuleId { get; set; } + public string Name { get; set; } = String.Empty; + + public string Code { get; set; } = String.Empty; + + } + + /// CommonDocumentAddOrEdit 列表查询参数模型 + public class CommonDocumentAddOrEdit + { + public Guid? Id { get; set; } + public string Name { get; set; } = String.Empty; + public string Path { get; set; } = String.Empty; + public string Description { get; set; } = String.Empty; + public bool IsDeleted { get; set; } + public string Code { get; set; } = String.Empty; + public Guid FileTypeId { get; set; } + public Guid ModuleId { get; set; } + } + + +} + + diff --git a/IRaCIS.Core.Application/Service/Common/Interface/ICommonDocumentService.cs b/IRaCIS.Core.Application/Service/Common/Interface/ICommonDocumentService.cs new file mode 100644 index 00000000..94d984bc --- /dev/null +++ b/IRaCIS.Core.Application/Service/Common/Interface/ICommonDocumentService.cs @@ -0,0 +1,24 @@ +//-------------------------------------------------------------------- +// 此代码由T4模板自动生成 byzhouhang 20210918 +// 生成时间 2022-03-31 13:18:53 +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +//-------------------------------------------------------------------- + +using IRaCIS.Core.Application.ViewModel; +namespace IRaCIS.Core.Application.Interfaces +{ + /// + /// ICommonDocumentService + /// + public interface ICommonDocumentService + { + + + Task> GetCommonDocumentList(CommonDocumentQuery queryCommonDocument); + + Task AddOrUpdateCommonDocument(CommonDocumentAddOrEdit addOrEditCommonDocument); + + + + } +} diff --git a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs index 7df030f8..3895cd7f 100644 --- a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs @@ -42,6 +42,12 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(o => o.ParentCode, t => t.MapFrom(u => u.Parent.Code)); + + CreateMap(); + + CreateMap().ReverseMap(); + + } } diff --git a/IRaCIS.Core.Domain.Share/_StaticData.cs b/IRaCIS.Core.Domain.Share/_StaticData.cs index 60bd0409..6cd5c90f 100644 --- a/IRaCIS.Core.Domain.Share/_StaticData.cs +++ b/IRaCIS.Core.Domain.Share/_StaticData.cs @@ -27,6 +27,8 @@ public static readonly string NoneDicomFolder = "NoneDicom"; public static readonly string UploadFileFolder = "UploadFile"; public static readonly string TreatmenthistoryFolder = "Treatmenthistory"; + public static readonly string CommonFileFolder = "CommonFileFolder"; + diff --git a/IRaCIS.Core.Domain/Common/CommonDocument.cs b/IRaCIS.Core.Domain/Common/CommonDocument.cs new file mode 100644 index 00000000..96c12014 --- /dev/null +++ b/IRaCIS.Core.Domain/Common/CommonDocument.cs @@ -0,0 +1,89 @@ + +//-------------------------------------------------------------------- +// 此代码由T4模板自动生成 byzhouhang 20210918 +// 生成时间 2022-03-31 13:18:42 +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +using System; +using IRaCIS.Core.Domain.Share; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace IRaCIS.Core.Domain.Models +{ + /// + ///CommonDocument + /// + [Table("CommonDocument")] + public class CommonDocument : Entity, IAuditUpdate, IAuditAdd + { + + + + /// + /// Name + /// + [Required] + public string Name { get; set; } + + /// + /// Path + /// + [Required] + public string Path { get; set; } + + /// + /// CreateTime + /// + [Required] + public DateTime CreateTime { get; set; } + + /// + /// CreateUserId + /// + [Required] + public Guid CreateUserId { get; set; } + + /// + /// UpdateTime + /// + [Required] + public DateTime UpdateTime { get; set; } + + /// + /// UpdateUserId + /// + [Required] + public Guid UpdateUserId { get; set; } + + /// + /// Description + /// + [Required] + public string Description { get; set; } + + /// + /// IsDeleted + /// + [Required] + public bool IsDeleted { get; set; } + + /// + /// Code + /// + [Required] + public string Code { get; set; } + + /// + /// FileTypeId + /// + [Required] + public Guid FileTypeId { get; set; } + + /// + /// ModuleId + /// + [Required] + public Guid ModuleId { get; set; } + + } + +} diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 83c9a881..192e1eef 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -264,6 +264,9 @@ namespace IRaCIS.Core.Infra.EFCore public virtual DbSet FrontAuditConfig { get; set; } + public virtual DbSet CommonDocument { get; set; } + + public override int SaveChanges() diff --git a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs index 6040884d..742760f5 100644 --- a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs +++ b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs @@ -42,7 +42,7 @@ namespace IRaCIS.Core.Infra.EFCore foreach (var verifyItem in verify.Where(t => t.verifyType != VerifyEnum.OnlyUpdate && t.IsVerify)) { - if (await _dbSet.AnyAsync(verifyItem.VerifyExp).ConfigureAwait(false)) + if (await _dbSet.IgnoreQueryFilters().AnyAsync(verifyItem.VerifyExp).ConfigureAwait(false)) { throw new BusinessValidationFailedException(verifyItem.VerifyMsg); } @@ -66,21 +66,21 @@ namespace IRaCIS.Core.Infra.EFCore { if (verifyItem.verifyType == VerifyEnum.OnlyUpdate) { - if (await _dbSet.AnyAsync(verifyItem.VerifyExp).ConfigureAwait(false)) + if (await _dbSet.IgnoreQueryFilters().AnyAsync(verifyItem.VerifyExp).ConfigureAwait(false)) { throw new BusinessValidationFailedException(verifyItem.VerifyMsg); } } else if (verifyItem.verifyType == VerifyEnum.Both) { - if (await _dbSet.AnyAsync(verifyItem.VerifyExp.And(t => t.Id != entity.Id)).ConfigureAwait(false)) + if (await _dbSet.IgnoreQueryFilters().AnyAsync(verifyItem.VerifyExp.And(t => t.Id != entity.Id)).ConfigureAwait(false)) { throw new BusinessValidationFailedException(verifyItem.VerifyMsg); } } } - var dbEntity = await _dbSet.FirstOrDefaultAsync(t => t.Id == entity.Id).ConfigureAwait(false); + var dbEntity = await _dbSet.IgnoreQueryFilters().FirstOrDefaultAsync(t => t.Id == entity.Id).ConfigureAwait(false); var dbBeforEntity = dbEntity.Clone(); diff --git a/IRaCIS.Core.Test/DbHelper.ttinclude b/IRaCIS.Core.Test/DbHelper.ttinclude index 4f92609a..aefde2e0 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.181.144,14333\\MSSQLExpress14;Database=IRaCIS_New;User ID=sa;Password=dev123456DEV;"; public static readonly string DbDatabase = "IRaCIS_New"; //ַ,ƴ - public static readonly string TableName = "FrontAuditConfig"; + public static readonly string TableName = "CommonDocument"; //ļ service Ƿҳ } #>