From 484ad67152d9b722e05778f8b6bdb7ac9d98202f Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 8 Jun 2023 10:35:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=E7=9A=84=E5=AF=BC=E5=87=BA=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 66 ++++---- .../Service/Common/ExcelExportService.cs | 159 ++++++++++++++++++ .../DTO/TrialSiteUserSurveyViewModel.cs | 6 +- .../TrialSiteUser/DTO/UserTrialViewModel.cs | 20 ++- .../TrialSiteUser/TrialMaintenanceService.cs | 57 ++++--- .../Service/TrialSiteUser/TrialSiteService.cs | 142 ++++++++-------- 6 files changed, 314 insertions(+), 136 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 62d5a29ed..ab840c866 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -467,6 +467,43 @@ 系统模板文档配置表 + + + 项目参与人员导出 + + + + + + + + + + + + Site用户列表导出 + + + + + + + + + + + + Site用户汇总表导出 + + + + + + + + + + 影像上传列表 只导出已上传状态的访视记录 @@ -9476,26 +9513,6 @@ 指定资源Id,渲染Dicom序列的Jpeg预览图像 Dicom序列的Id - - - Site用户列表导出 - - - - - - - - - Site用户汇总表导出 - - - - - - - - Pannel 进去 SiteTab @@ -11773,15 +11790,6 @@ 最新工作量 (已确定的)[New] - - - 项目参与人员导出 - - - - - - Setting页面 获取项目参与人员列表 diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index 243781f70..33cc8d6a6 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -4,6 +4,7 @@ using DocumentFormat.OpenXml.Spreadsheet; using IRaCIS.Application.Contracts; using IRaCIS.Application.Interfaces; using IRaCIS.Core.Application.Contracts; +using IRaCIS.Core.Application.Contracts.DTO; using IRaCIS.Core.Application.Service.Reading.Dto; using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Domain.Share; @@ -29,9 +30,167 @@ namespace IRaCIS.Core.Application.Service.Common public class ExcelExportService : BaseService { + + #region 后续需要移动过来 + + + + /// + /// 项目参与人员导出 + /// + /// + /// + /// + /// + /// + /// + /// + [HttpPost] + [AllowAnonymous] + public async Task TrialUserListExport(TrialMaintenanceExportQuery param, + [FromServices] IRepository _commonDocumentRepository, + [FromServices] IDictionaryService _dictionaryService, + [FromServices] IRepository _trialRepository, + [FromServices] IRepository _trialUseRepository + + ) + { + + + var exportInfo = (await _trialRepository.Where(t => t.Id == param.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); + + exportInfo.List = await _trialUseRepository.Where(t => t.TrialId == param.TrialId).IgnoreQueryFilters() + .WhereIf(param.UserTypeId != null, t => t.User.UserTypeId == param.UserTypeId) + .WhereIf(!string.IsNullOrWhiteSpace(param.UserName), t => t.User.UserName.Contains(param.UserName)) + + .WhereIf(param.IsDeleted != null, t => t.IsDeleted == param.IsDeleted) + .WhereIf(!string.IsNullOrWhiteSpace(param.OrganizationName), + t => t.User.OrganizationName.Contains(param.OrganizationName)) + .WhereIf(!string.IsNullOrWhiteSpace(param.UserRealName), + t => (t.User.FullName).Contains(param.UserRealName)) + .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + + + exportInfo.IsEn_US = _userInfo.IsEn_Us; + + return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialUserList_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(TrialMaintenanceDTO)); + + } + + /// + /// Site用户列表导出 + /// + /// + /// + /// + /// + /// + /// + /// + [HttpPost] + [AllowAnonymous] + public async Task TrialSiteUserListExport(SiteCRCExportQueryDTO param, + [FromServices] IRepository _commonDocumentRepository, + [FromServices] IDictionaryService _dictionaryService, + [FromServices] IRepository _trialRepository, + [FromServices] IRepository _trialSiteUserRepository + ) + { + + + var exportInfo = (await _trialRepository.Where(t => t.Id == param.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); + + exportInfo.List = await _trialSiteUserRepository.Where(t => t.TrialId == param.TrialId).IgnoreQueryFilters() + .WhereIf(param.IsDeleted != null, t => t.IsDeleted == param.IsDeleted) + .WhereIf(!string.IsNullOrWhiteSpace(param.SiteName), t => t.Site.SiteName.Contains(param.SiteName)) + .WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteAliasName), + t => t.TrialSite.TrialSiteAliasName.Contains(param.TrialSiteAliasName)) + .WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteCode), + t => t.TrialSite.TrialSiteCode.Contains(param.TrialSiteCode)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, + t => t.UserId == _userInfo.Id) + .WhereIf(!string.IsNullOrWhiteSpace(param.UserKeyInfo), t => (t.User.FullName).Contains(param.UserKeyInfo) + || t.User.UserName.Contains(param.UserKeyInfo) || t.User.EMail.Contains(param.UserKeyInfo)) + + .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + + exportInfo.IsEn_US = _userInfo.IsEn_Us; + return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialSiteUserList_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(SiteUserExportDTO)); + + } + + /// + /// Site用户汇总表导出 + /// + /// + /// + /// + /// + /// + /// + /// + /// + [HttpPost] + [AllowAnonymous] + public async Task TrialSiteUserSummaryListExport(TrialSiteUserSurveyExportQueryDto queryParam, + [FromServices] IRepository _commonDocumentRepository, + [FromServices] IRepository _trialSiteSurveyRepository, + [FromServices] IRepository _trialSiteUserSurveyRepository, + [FromServices] IRepository _trialRepository, + [FromServices] IDictionaryService _dictionaryService + ) + { + + var data = (await _trialRepository.Where(t => t.Id == queryParam.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); + + var groupSelectIdQuery = + _trialSiteSurveyRepository.Where(t => t.TrialId == queryParam.TrialId) + .WhereIf(queryParam.SiteId != null, t => t.SiteId == queryParam.SiteId) + .WhereIf(!string.IsNullOrEmpty(queryParam.FormWriterKeyInfo), t => (t.UserName).Contains(queryParam.FormWriterKeyInfo) || t.Email.Contains(queryParam.FormWriterKeyInfo) || t.Phone.Contains(queryParam.FormWriterKeyInfo)) + .GroupBy(t => t.SiteId) + .Select(g => g.OrderByDescending(u => u.CreateTime).Select(t => t.Id).First()); + + + var query = _trialSiteUserSurveyRepository + .Where(t => groupSelectIdQuery.Contains(t.TrialSiteSurveyId)) + .WhereIf(queryParam.UserTypeId != null, t => t.UserTypeId == queryParam.UserTypeId) + .WhereIf(queryParam.IsGenerateAccount != null, t => t.IsGenerateAccount == queryParam.IsGenerateAccount) + .WhereIf(queryParam.TrialRoleNameId != null, t => t.TrialRoleNameId == queryParam.TrialRoleNameId) + .WhereIf(queryParam.State != null && queryParam.State != TrialSiteUserStateEnum.OverTime, t => t.InviteState == queryParam.State) + .WhereIf(queryParam.State != null && queryParam.State == TrialSiteUserStateEnum.OverTime, t => t.InviteState == TrialSiteUserStateEnum.HasSend && t.ExpireTime < DateTime.Now) + .WhereIf(!string.IsNullOrEmpty(queryParam.UserName), t => (t.LastName + " / " + t.FirstName).Contains(queryParam.UserName)) + .WhereIf(!string.IsNullOrEmpty(queryParam.OrganizationName), t => t.OrganizationName.Contains(queryParam.OrganizationName)) + .ProjectTo(_mapper.ConfigurationProvider); + + data.List = await query.ToListAsync(); + + + + var exportInfo = data; + + exportInfo.IsEn_US = _userInfo.IsEn_Us; + return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialSiteUserSummary_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(TrialSiteUserSummaryDto)); + + } + + + #endregion + + + + + #region 导表查询 + + + + + + + + /// /// 影像上传列表 只导出已上传状态的访视记录 /// diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs index a4fa5be1b..5a5bbf060 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs @@ -3,6 +3,7 @@ // 生成时间 2021-12-23 13:21:04 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 //-------------------------------------------------------------------- +using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Domain.Share; using Newtonsoft.Json; @@ -24,13 +25,14 @@ namespace IRaCIS.Core.Application.Contracts public DateTime? ExpireTime { get; set; } + [DictionaryTranslateAttribute("YesOrNo")] public bool? IsJoin { get; set; } public DateTime? ConfirmTime { get; set; } public string RejectReason { get; set; } = string.Empty; - + [DictionaryTranslateAttribute("researchUserState")] public TrialSiteUserStateEnum State { get @@ -89,6 +91,8 @@ namespace IRaCIS.Core.Application.Contracts public string LastName { get; set; } = string.Empty; public string Phone { get; set; } = string.Empty; public string Email { get; set; } = string.Empty; + + [DictionaryTranslateAttribute("YesOrNo")] public bool IsGenerateAccount { get; set; } public Guid TrialRoleNameId { get; set; } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs index 4350eaa76..962b31a45 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs @@ -5,6 +5,7 @@ using Magicodes.ExporterAndImporter.Core; using MiniExcelLibs.Attributes; using Newtonsoft.Json; using IRaCIS.Core.Application.Contracts; +using IRaCIS.Core.Application.Helper; namespace IRaCIS.Application.Contracts { @@ -17,6 +18,8 @@ namespace IRaCIS.Application.Contracts [JsonIgnore] public string State => IsDeleted ? "退出" : "加入"; + + [DictionaryTranslateAttribute("IsUserExitTrial")] public bool IsDeleted { get; set; } [ExcelFormat("yyyy-MM-dd hh:mm:ss")] @@ -53,14 +56,16 @@ namespace IRaCIS.Application.Contracts public class TrialMaintenanceDTO : UserTrialCommand { - [JsonIgnore] - public int No { get; set; } + //[JsonIgnore] + //public int No { get; set; } //For MiniExcel ExcelFormat public string State => IsDeleted ? "退出" : "加入"; [ValueMapping(text: "退出", true)] [ValueMapping(text: "加入", false)] + + [DictionaryTranslateAttribute("IsUserExitTrial")] public bool IsDeleted { get; set; } [ExporterHeader(Format = "yyyy-mm-DD hh:mm:ss")] @@ -135,8 +140,6 @@ namespace IRaCIS.Application.Contracts } public class SiteUserExportDTO : UserTrialDTO { - [JsonIgnore] - public int No { get; set; } public string TrialSiteCode { get; set; } = String.Empty; public string TrialSiteAliasName { get; set; } = String.Empty; @@ -151,17 +154,18 @@ namespace IRaCIS.Application.Contracts public class TrialSiteUserSummaryDto: TrialSiteUserSurveyView { - [JsonIgnore] - public int No { get; set; } + public string TrialSiteCode { get; set; } = String.Empty; public string TrialSiteAliasName { get; set; } = String.Empty; public string UserRealName => LastName + " / " + FirstName; - public string IsGenerateAccountStr => IsGenerateAccount ? "是" : "否"; - public string StateStr => State.GetDescription(); + //public string IsGenerateAccountStr => IsGenerateAccount ? "是" : "否"; + + + //public string StateStr => State.GetDescription(); } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs index 6227a1864..a3bf27dd1 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs @@ -8,6 +8,7 @@ using IRaCIS.Core.Application.Service; using Microsoft.AspNetCore.Authorization; using IRaCIS.Core.Application.Auth; +using IRaCIS.Core.Application.Contracts; namespace IRaCIS.Application.Services { @@ -17,45 +18,49 @@ namespace IRaCIS.Application.Services private readonly IRepository _trialUseRepository; private readonly IRepository _trialRepository; + public TrialMaintenanceService(IRepository trialUseRepository, IRepository trialRepository) { _trialUseRepository = trialUseRepository; _trialRepository = trialRepository; } - /// - /// 项目参与人员导出 - /// - /// - /// - /// - /// - [HttpPost] - [AllowAnonymous] - public async Task TrialUserListExport(TrialMaintenanceExportQuery param, [FromServices] IRepository _commonDocumentRepository) - { - var exportInfo = (await _trialRepository.Where(t => t.Id == param.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); + #region 移动废弃 - exportInfo.TrialUserList = await _trialUseRepository.Where(t => t.TrialId == param.TrialId).IgnoreQueryFilters() - .WhereIf(param.UserTypeId != null, t => t.User.UserTypeId == param.UserTypeId) - .WhereIf(!string.IsNullOrWhiteSpace(param.UserName), t => t.User.UserName.Contains(param.UserName)) + ///// + ///// 项目参与人员导出 + ///// + ///// + ///// + ///// + ///// + //[HttpPost] + //[AllowAnonymous] + //public async Task TrialUserListExport(TrialMaintenanceExportQuery param, [FromServices] IRepository _commonDocumentRepository, [FromServices] IDictionaryService _dictionaryService) + //{ - .WhereIf(param.IsDeleted != null, t => t.IsDeleted == param.IsDeleted) - .WhereIf(!string.IsNullOrWhiteSpace(param.OrganizationName), - t => t.User.OrganizationName.Contains(param.OrganizationName)) - .WhereIf(!string.IsNullOrWhiteSpace(param.UserRealName), - t => (t.User.FullName).Contains(param.UserRealName)) - .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + // var exportInfo = (await _trialRepository.Where(t => t.Id == param.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); - var no = 1; - exportInfo.TrialUserList.ForEach(t => t.No = no++); + // exportInfo.List = await _trialUseRepository.Where(t => t.TrialId == param.TrialId).IgnoreQueryFilters() + // .WhereIf(param.UserTypeId != null, t => t.User.UserTypeId == param.UserTypeId) + // .WhereIf(!string.IsNullOrWhiteSpace(param.UserName), t => t.User.UserName.Contains(param.UserName)) - exportInfo.IsEn_US = _userInfo.IsEn_Us; + // .WhereIf(param.IsDeleted != null, t => t.IsDeleted == param.IsDeleted) + // .WhereIf(!string.IsNullOrWhiteSpace(param.OrganizationName), + // t => t.User.OrganizationName.Contains(param.OrganizationName)) + // .WhereIf(!string.IsNullOrWhiteSpace(param.UserRealName), + // t => (t.User.FullName).Contains(param.UserRealName)) + // .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); - return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialUserList_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment); - } + // exportInfo.IsEn_US = _userInfo.IsEn_Us; + + // return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialUserList_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(TrialMaintenanceDTO)); + + //} + #endregion + diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs index b476e5629..2171c3c04 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs @@ -8,6 +8,7 @@ using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.Service; using Microsoft.AspNetCore.Authorization; using IRaCIS.Core.Application.Auth; +using IRaCIS.Application.Interfaces; namespace IRaCIS.Core.Application.Services { @@ -29,95 +30,92 @@ namespace IRaCIS.Core.Application.Services } - #region 导出列表 + #region 移动废弃 - /// - /// Site用户列表导出 - /// - /// - /// - /// - /// - [HttpPost] - [AllowAnonymous] - public async Task TrialSiteUserListExport(SiteCRCExportQueryDTO param, [FromServices] IRepository _commonDocumentRepository) - { + ///// + ///// Site用户列表导出 + ///// + ///// + ///// + ///// + ///// + //[HttpPost] + //[AllowAnonymous] + //public async Task TrialSiteUserListExport(SiteCRCExportQueryDTO param, [FromServices] IRepository _commonDocumentRepository, [FromServices] IDictionaryService _dictionaryService) + //{ - var exportInfo = (await _trialRepository.Where(t => t.Id == param.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); + // var exportInfo = (await _trialRepository.Where(t => t.Id == param.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); - exportInfo.TrialSiteUserList = await _trialSiteUserRepository.Where(t => t.TrialId == param.TrialId).IgnoreQueryFilters() - .WhereIf(param.IsDeleted != null, t => t.IsDeleted == param.IsDeleted) - .WhereIf(!string.IsNullOrWhiteSpace(param.SiteName), t => t.Site.SiteName.Contains(param.SiteName)) - .WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteAliasName), - t => t.TrialSite.TrialSiteAliasName.Contains(param.TrialSiteAliasName)) - .WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteCode), - t => t.TrialSite.TrialSiteCode.Contains(param.TrialSiteCode)) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, - t => t.UserId == _userInfo.Id) - .WhereIf(!string.IsNullOrWhiteSpace(param.UserKeyInfo), t => (t.User.FullName).Contains(param.UserKeyInfo) - || t.User.UserName.Contains(param.UserKeyInfo) || t.User.EMail.Contains(param.UserKeyInfo)) + // exportInfo.List = await _trialSiteUserRepository.Where(t => t.TrialId == param.TrialId).IgnoreQueryFilters() + // .WhereIf(param.IsDeleted != null, t => t.IsDeleted == param.IsDeleted) + // .WhereIf(!string.IsNullOrWhiteSpace(param.SiteName), t => t.Site.SiteName.Contains(param.SiteName)) + // .WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteAliasName), + // t => t.TrialSite.TrialSiteAliasName.Contains(param.TrialSiteAliasName)) + // .WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteCode), + // t => t.TrialSite.TrialSiteCode.Contains(param.TrialSiteCode)) + // .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, + // t => t.UserId == _userInfo.Id) + // .WhereIf(!string.IsNullOrWhiteSpace(param.UserKeyInfo), t => (t.User.FullName).Contains(param.UserKeyInfo) + // || t.User.UserName.Contains(param.UserKeyInfo) || t.User.EMail.Contains(param.UserKeyInfo)) - .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + // .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); - var no = 1; - exportInfo.TrialSiteUserList.ForEach(t => t.No = no++); - exportInfo.IsEn_US = _userInfo.IsEn_Us; - return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialSiteUserList_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment); + // exportInfo.IsEn_US = _userInfo.IsEn_Us; + // return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialSiteUserList_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment,_dictionaryService,typeof(SiteUserExportDTO)); - } + //} - /// - /// Site用户汇总表导出 - /// - /// - /// - /// - /// - /// - /// - [HttpPost] - [AllowAnonymous] - public async Task TrialSiteUserSummaryListExport(TrialSiteUserSurveyExportQueryDto queryParam, - [FromServices] IRepository _commonDocumentRepository, - [FromServices] IRepository _trialSiteSurveyRepository, - [FromServices] IRepository _trialSiteUserSurveyRepository - ) - { + ///// + ///// Site用户汇总表导出 + ///// + ///// + ///// + ///// + ///// + ///// + ///// + ///// + //[HttpPost] + //[AllowAnonymous] + //public async Task TrialSiteUserSummaryListExport(TrialSiteUserSurveyExportQueryDto queryParam, + // [FromServices] IRepository _commonDocumentRepository, + // [FromServices] IRepository _trialSiteSurveyRepository, + // [FromServices] IRepository _trialSiteUserSurveyRepository + // , [FromServices] IDictionaryService _dictionaryService + //) + //{ - var data = (await _trialRepository.Where(t => t.Id == queryParam.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); + // var data = (await _trialRepository.Where(t => t.Id == queryParam.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); - var groupSelectIdQuery = - _trialSiteSurveyRepository.Where(t => t.TrialId == queryParam.TrialId) - .WhereIf(queryParam.SiteId != null, t => t.SiteId == queryParam.SiteId) - .WhereIf(!string.IsNullOrEmpty(queryParam.FormWriterKeyInfo), t => (t.UserName).Contains(queryParam.FormWriterKeyInfo) || t.Email.Contains(queryParam.FormWriterKeyInfo) || t.Phone.Contains(queryParam.FormWriterKeyInfo)) - .GroupBy(t => t.SiteId) - .Select(g => g.OrderByDescending(u => u.CreateTime).Select(t => t.Id).First()); + // var groupSelectIdQuery = + // _trialSiteSurveyRepository.Where(t => t.TrialId == queryParam.TrialId) + // .WhereIf(queryParam.SiteId != null, t => t.SiteId == queryParam.SiteId) + // .WhereIf(!string.IsNullOrEmpty(queryParam.FormWriterKeyInfo), t => (t.UserName).Contains(queryParam.FormWriterKeyInfo) || t.Email.Contains(queryParam.FormWriterKeyInfo) || t.Phone.Contains(queryParam.FormWriterKeyInfo)) + // .GroupBy(t => t.SiteId) + // .Select(g => g.OrderByDescending(u => u.CreateTime).Select(t => t.Id).First()); - var query = _trialSiteUserSurveyRepository - .Where(t => groupSelectIdQuery.Contains(t.TrialSiteSurveyId)) - .WhereIf(queryParam.UserTypeId != null, t => t.UserTypeId == queryParam.UserTypeId) - .WhereIf(queryParam.IsGenerateAccount != null, t => t.IsGenerateAccount == queryParam.IsGenerateAccount) - .WhereIf(queryParam.TrialRoleNameId != null, t => t.TrialRoleNameId == queryParam.TrialRoleNameId) - .WhereIf(queryParam.State != null && queryParam.State != TrialSiteUserStateEnum.OverTime, t => t.InviteState == queryParam.State) - .WhereIf(queryParam.State != null && queryParam.State == TrialSiteUserStateEnum.OverTime, t => t.InviteState == TrialSiteUserStateEnum.HasSend && t.ExpireTime < DateTime.Now) - .WhereIf(!string.IsNullOrEmpty(queryParam.UserName), t => (t.LastName + " / " + t.FirstName).Contains(queryParam.UserName)) - .WhereIf(!string.IsNullOrEmpty(queryParam.OrganizationName), t => t.OrganizationName.Contains(queryParam.OrganizationName)) - .ProjectTo(_mapper.ConfigurationProvider); + // var query = _trialSiteUserSurveyRepository + // .Where(t => groupSelectIdQuery.Contains(t.TrialSiteSurveyId)) + // .WhereIf(queryParam.UserTypeId != null, t => t.UserTypeId == queryParam.UserTypeId) + // .WhereIf(queryParam.IsGenerateAccount != null, t => t.IsGenerateAccount == queryParam.IsGenerateAccount) + // .WhereIf(queryParam.TrialRoleNameId != null, t => t.TrialRoleNameId == queryParam.TrialRoleNameId) + // .WhereIf(queryParam.State != null && queryParam.State != TrialSiteUserStateEnum.OverTime, t => t.InviteState == queryParam.State) + // .WhereIf(queryParam.State != null && queryParam.State == TrialSiteUserStateEnum.OverTime, t => t.InviteState == TrialSiteUserStateEnum.HasSend && t.ExpireTime < DateTime.Now) + // .WhereIf(!string.IsNullOrEmpty(queryParam.UserName), t => (t.LastName + " / " + t.FirstName).Contains(queryParam.UserName)) + // .WhereIf(!string.IsNullOrEmpty(queryParam.OrganizationName), t => t.OrganizationName.Contains(queryParam.OrganizationName)) + // .ProjectTo(_mapper.ConfigurationProvider); - data.TrialSiteUserList = await query.ToListAsync(); + // data.List = await query.ToListAsync(); - var exportInfo = data; + // var exportInfo = data; - //处理翻译 - var no = 1; - exportInfo.TrialSiteUserList.ForEach(t => t.No = no++); - exportInfo.IsEn_US = _userInfo.IsEn_Us; - return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialSiteUserSummary_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment); + // exportInfo.IsEn_US = _userInfo.IsEn_Us; + // return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialSiteUserSummary_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment,_dictionaryService,typeof(TrialSiteUserSummaryDto)); - } + //} From e66edbf2c726d5fce9b7a5cadbc0a6ec9b32eec4 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 8 Jun 2023 11:28:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=A0=E9=99=A4sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Domain/SQLFile/20230606号.sql | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 IRaCIS.Core.Domain/SQLFile/20230606号.sql diff --git a/IRaCIS.Core.Domain/SQLFile/20230606号.sql b/IRaCIS.Core.Domain/SQLFile/20230606号.sql deleted file mode 100644 index a4ff35eb7..000000000 --- a/IRaCIS.Core.Domain/SQLFile/20230606号.sql +++ /dev/null @@ -1,22 +0,0 @@ - -update FrontAuditConfig set Identification='' where Identification is NULL - ---新增字段 - -ALTER TABLE [dbo].[Trial] ADD [AttendedReviewerTypes] varchar(255) COLLATE Chinese_PRC_CI_AS DEFAULT '' NOT NULL -GO - -ALTER TABLE [dbo].[Trial] ADD [DeclarationTypes] varchar(255) COLLATE Chinese_PRC_CI_AS DEFAULT '' NOT NULL -GO - - ---维护sql -UPDATE Trial SET AttendedReviewerTypes = '|' + CAST(AttendedReviewerType AS VARCHAR(10)) + '|' - -update Trial set DeclarationTypes ='|' + (select Code from Dictionary where Id= Trial.DeclarationTypeId) + '|' - - ---验证sql -select DISTINCT AttendedReviewerType ,AttendedReviewerTypes, DeclarationTypeId, Dictionary.Code,DeclarationTypes,Dictionary.[Value] from Trial inner join Dictionary on Trial.DeclarationTypeId=Dictionary.Id - -