修改查询

This commit is contained in:
2024-12-27 11:32:17 +08:00
parent c06681f379
commit 7853614d2d
34 changed files with 237 additions and 165 deletions
@@ -73,7 +73,7 @@ namespace IRaCIS.Core.Application.Service.Common
var list = await _trialUseRoleRepository.Where(t => t.TrialId == param.TrialId).IgnoreQueryFilters()
.WhereIf(param.UserTypeId != null, t => t.UserRole.UserTypeId == param.UserTypeId)
.WhereIf(!string.IsNullOrWhiteSpace(param.UserName), t => t.UserRole.UserName.Contains(param.UserName))
.WhereIf(!string.IsNullOrWhiteSpace(param.UserName), t => t.UserRole.IdentityUser.UserName.Contains(param.UserName))
.WhereIf(param.IsDeleted != null, t => t.IsDeleted == param.IsDeleted)
.WhereIf(!string.IsNullOrWhiteSpace(param.OrganizationName),
@@ -124,7 +124,7 @@ namespace IRaCIS.Core.Application.Service.Common
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator,
t => t.UserId == _userInfo.UserRoleId)
.WhereIf(!string.IsNullOrWhiteSpace(param.UserKeyInfo), t => (t.UserRole.FullName).Contains(param.UserKeyInfo)
|| t.UserRole.UserName.Contains(param.UserKeyInfo) || t.UserRole.EMail.Contains(param.UserKeyInfo))
|| t.UserRole.IdentityUser.UserName.Contains(param.UserKeyInfo) || t.UserRole.IdentityUser.EMail.Contains(param.UserKeyInfo))
.ProjectTo<SiteUserExportDTO>(_mapper.ConfigurationProvider).ToListAsync();
@@ -225,7 +225,7 @@ namespace IRaCIS.Core.Application.Service.Common
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.ExperimentName), o => o.ExperimentName.Contains(inQuery.ExperimentName))
.WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OP, t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId && t.IsDeleted == false) && t.IsDeleted == false)
.WhereIf(inQuery.CriterionType != null, o => o.TrialReadingCriterionList.Any(t => t.CriterionType == inQuery.CriterionType && t.IsSigned && t.IsConfirm))
.WhereIf(!string.IsNullOrEmpty(inQuery.PM_EMail), o => o.TrialUserList.Any(t => t.UserRole.EMail.Contains(inQuery.PM_EMail) && (t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM)))
.WhereIf(!string.IsNullOrEmpty(inQuery.PM_EMail), o => o.TrialUserList.Any(t => t.UserRole.IdentityUser.EMail.Contains(inQuery.PM_EMail) && (t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM)))
.Select(t => new TrialToBeDoneDto()
{
TrialId = t.Id,
@@ -286,7 +286,7 @@ namespace IRaCIS.Core.Application.Service.Common
IR_ReadingCriterionList = isIR ? t.TrialReadingCriterionList.Where(t => t.IsConfirm && t.IsSigned).OrderBy(t => t.CriterionName).Select(t => t.CriterionName).ToList() : null,
IR_PMEmailList = isIR ? t.TrialUserList.Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM).OrderBy(t => t.UserRole.EMail).Select(t => t.UserRole.EMail).ToList() : null,
IR_PMEmailList = isIR ? t.TrialUserList.Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM).OrderBy(t => t.UserRole.IdentityUser.EMail).Select(t => t.UserRole.IdentityUser.EMail).ToList() : null,
IR_TotalReadCount = isIR ? t.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count() : 0,
@@ -376,7 +376,7 @@ namespace IRaCIS.Core.Application.Service.Common
//ConfirmUserId = confirm.ConfirmUserId,
ConfirmTime = confirm.ConfirmTime,
RealName = trialUser.UserRole.FullName,
UserName = trialUser.UserRole.UserName,
UserName = trialUser.UserRole.IdentityUser.UserName,
UserTypeId = trialUser.UserRole.UserTypeId,
UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
@@ -410,7 +410,7 @@ namespace IRaCIS.Core.Application.Service.Common
//ConfirmUserId = confirm.ConfirmUserId,
ConfirmTime = confirm.ConfirmTime,
RealName = trialUser.UserRole.FullName,
UserName = trialUser.UserRole.UserName,
UserName = trialUser.UserRole.IdentityUser.UserName,
UserTypeId = trialUser.UserRole.UserTypeId,
UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
@@ -818,7 +818,7 @@ namespace IRaCIS.Core.Application.Service.Common
.WhereIf(inQuery.SubjectVisitId != null, t => t.SubjectId == inQuery.SubjectVisitId)
.WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId)
.WhereIf(inQuery.IsDicom != null, t => t.IsDicom == inQuery.IsDicom)
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.Uploader), t => t.CreateUserRole.UserName.Contains(inQuery.Uploader))
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.Uploader), t => t.CreateUserRole.IdentityUser.UserName.Contains(inQuery.Uploader))
.WhereIf(inQuery.IsSuccess != null, t => t.IsSuccess == inQuery.IsSuccess)
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.StudyCode), t => t.StudyCode.Contains(inQuery.StudyCode))
.Select(t => new UnionStudyMonitorExportDto()
@@ -835,7 +835,7 @@ namespace IRaCIS.Core.Application.Service.Common
IsDicom = t.IsDicom,
Uploader = t.CreateUserRole.UserName,
Uploader = t.CreateUserRole.IdentityUser.UserName,
IP = t.IP,
@@ -1233,7 +1233,7 @@ namespace IRaCIS.Core.Application.Service.Common
var query = _trialImageDownloadRepository.Where(t => t.TrialId == inQuery.TrialId)
.WhereIf(inQuery.SubjectCode.IsNotNullOrEmpty(), t => t.SubjectCode.Contains(inQuery.SubjectCode))
.WhereIf(inQuery.IP.IsNotNullOrEmpty(), t => t.IP.Contains(inQuery.IP))
.WhereIf(inQuery.Name.IsNotNullOrEmpty(), t => t.CreateUserRole.UserName.Contains(inQuery.Name) || t.CreateUserRole.FullName.Contains(inQuery.Name))
.WhereIf(inQuery.Name.IsNotNullOrEmpty(), t => t.CreateUserRole.IdentityUser.UserName.Contains(inQuery.Name) || t.CreateUserRole.FullName.Contains(inQuery.Name))
.WhereIf(inQuery.ImageType != null, t => t.ImageType == inQuery.ImageType)
.WhereIf(inQuery.UserType != null, t => t.CreateUserRole.UserTypeEnum == inQuery.UserType)
.WhereIf(inQuery.IsSuccess != null, t => t.IsSuccess == inQuery.IsSuccess)
@@ -32,7 +32,7 @@ namespace IRaCIS.Core.Application.Service
Task SiteSurveyUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl);
Task ExternalUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl);
Task ExternalUserJoinEmail(Guid trialId, Guid userId,string userTypes, string baseUrl, string rootUrl);
Task<(Guid identityUserId, Guid userRoleId)> DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl);
@@ -429,15 +429,13 @@ namespace IRaCIS.Core.Application.Service
}
//外部用户 加入项目
public async Task ExternalUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl)
public async Task ExternalUserJoinEmail(Guid trialId, Guid userId, string userTypes, string baseUrl, string rootUrl)
{
var trialInfo = (await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId)).IfNullThrowException();
var sysUserInfo = (await _identityUserRepository.Where(t => t.Id == userId).FirstOrDefaultAsync()).IfNullThrowException();
var userTypes = await _userRoleRepository.Where(t => t.IdentityUserId == sysUserInfo.Id).Select(t => t.UserTypeRole.UserTypeShortName).ToListAsync();
var messageToSend = new MimeMessage();
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
//收件地址
@@ -473,7 +471,7 @@ namespace IRaCIS.Core.Application.Service
trialInfo.ResearchProgramNo,
trialInfo.TrialCode,
sysUserInfo.UserName,
string.Join(',', userTypes),
userTypes,
sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl
);
@@ -533,7 +531,7 @@ namespace IRaCIS.Core.Application.Service
trialInfo.ExperimentName,
trialInfo.ResearchProgramNo,
trialInfo.TrialCode,
sysUserInfo.UserName,
sysUserInfo.UserName,
string.Join(',', userTypes),
sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl
);
@@ -100,7 +100,7 @@ namespace IRaCIS.Core.Application.Service
CreateMap<TrialImageDownload, TrialImageDownloadExportDto>()
.ForMember(d => d.UserFullName, u => u.MapFrom(s => s.CreateUserRole.FullName))
.ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.CreateUserRole.UserTypeEnum))
.ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUserRole.UserName))
.ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.UserName))
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteCode));