diff --git a/IRaCIS.Core.Application/Service/Doctor/AttachmentService.cs b/IRaCIS.Core.Application/Service/Doctor/AttachmentService.cs index cee94899e..cca070af8 100644 --- a/IRaCIS.Core.Application/Service/Doctor/AttachmentService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/AttachmentService.cs @@ -105,23 +105,23 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task> GetTrialAttachments(GetTrialAttachmentsInDto inDto) { - var doctorIds =await _enrollRepository.Where(x => x.TrialId == inDto.TrialId && x.EnrollStatus >= EnrollStatus.InviteIntoGroup).Select(x => x.DoctorId).ToListAsync(); + var dicList=await _dictionaryRepository.Where(x => x.Parent.Code == "CertificateFileType").Select(x=>x.Code).ToListAsync(); - var ids = doctorIds.Select(x=>(Guid?)x).ToList(); var attachmentList = await _attachmentrepository + .Where(a =>a.Doctor.EnrollList.Any(x=>x.TrialId == inDto.TrialId && x.EnrollStatus >= EnrollStatus.InviteIntoGroup)|| a.TrialId == inDto.TrialId) .WhereIf(inDto.DoctorId!=null,x=>x.DoctorId==inDto.DoctorId) .WhereIf(inDto.IsAuthorizedView != null, x => x.IsAuthorizedView == inDto.IsAuthorizedView) .WhereIf(inDto.Type.IsNotNullOrEmpty(), x => x.Type == inDto.Type) .WhereIf(inDto.FileName.IsNotNullOrEmpty(), x => inDto.FileName.Contains(x.FileName)) .Where(a => dicList.Contains(a.Type)||a.Type==string.Empty) - .Where(a => ids.Contains(a.DoctorId) || a.TrialId == inDto.TrialId) + - .ProjectTo(_mapper.ConfigurationProvider).ToPagedListAsync(inDto); + .ProjectTo(_mapper.ConfigurationProvider, new { TrialId = inDto.TrialId }).ToPagedListAsync(inDto); return attachmentList; diff --git a/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs b/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs index 70cd9293e..cb4a52055 100644 --- a/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs @@ -13,6 +13,8 @@ namespace IRaCIS.Core.Application.Service { var isEn_Us = false; + Guid TrialId = Guid.Empty; + // 从 DateTime 映射到 DateOnly CreateMap().ConvertUsing(dt => DateOnly.FromDateTime(dt)); @@ -76,7 +78,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.ChineseName, u => u.MapFrom(t => t.Doctor.ChineseName)) .ForMember(d => d.FirstName, u => u.MapFrom(t => t.Doctor.FirstName)) .ForMember(d => d.LastName, u => u.MapFrom(t => t.Doctor.LastName)) - .ForMember(d => d.UserName, u => u.MapFrom(t => t.Doctor.UserRole.UserName)) + .ForMember(d => d.UserName, u => u.MapFrom(t => t.Doctor.EnrollList.Where(y=>y.TrialId== TrialId).Select(x=>x.DoctorUser.UserName).First())) ; CreateMap(); CreateMap();