@@ -16,7 +16,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Trial")]
|
||||
public class TaskMedicalReviewRuleService(IRepository<TaskMedicalReviewRule> _taskMedicalReviewRuleRepository,
|
||||
IRepository<TrialUser> _trialUserRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITaskMedicalReviewRuleService
|
||||
IRepository<TrialUserRole> _trialUserRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITaskMedicalReviewRuleService
|
||||
{
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
var taskTaskMedicalReviewRuleQueryable = _taskMedicalReviewRuleRepository.Where(t => t.TrialId == inQuery.TrialId)
|
||||
.ProjectTo<TaskMedicalReviewRuleView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var isHaveMIM = await _trialUserRepository.AnyAsync(t => t.User.UserTypeEnum == Domain.Share.UserTypeEnum.MIM && t.TrialId == inQuery.TrialId);
|
||||
var isHaveMIM = await _trialUserRepository.AnyAsync(t => t.UserRole.UserTypeEnum == Domain.Share.UserTypeEnum.MIM && t.TrialId == inQuery.TrialId);
|
||||
|
||||
return (await taskTaskMedicalReviewRuleQueryable.ToListAsync(), new { IsHaveMIM = isHaveMIM });
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Trial")]
|
||||
public class TaskMedicalReviewService(IRepository<TaskMedicalReview> _taskMedicalReviewRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRepository,
|
||||
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITaskMedicalReviewService
|
||||
{
|
||||
@@ -328,7 +328,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
[HttpGet("{trialId:guid}")]
|
||||
public async Task<List<UserSimpleInfo>> GetMIMUserList(Guid trialId)
|
||||
{
|
||||
var query = _trialUserRepository.Where(t => (t.User.UserTypeEnum == Domain.Share.UserTypeEnum.MIM || t.User.UserTypeEnum == Domain.Share.UserTypeEnum.MC) && t.TrialId == trialId).Select(t => t.User).ProjectTo<UserSimpleInfo>(_mapper.ConfigurationProvider);
|
||||
var query = _trialUserRepository.Where(t => (t.UserRole.UserTypeEnum == Domain.Share.UserTypeEnum.MIM || t.UserRole.UserTypeEnum == Domain.Share.UserTypeEnum.MC) && t.TrialId == trialId).Select(t => t.UserRole).ProjectTo<UserSimpleInfo>(_mapper.ConfigurationProvider);
|
||||
|
||||
return await query.ToListAsync();
|
||||
}
|
||||
|
||||
@@ -1512,7 +1512,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
||||
|
||||
var isSPMJoinReReadingApproval = _trialRepository.Any(t => t.Id == trialId && t.IsSPMJoinReReadingApproval);
|
||||
|
||||
var hasSPMOrCPM = await _trialRepository.Where(t => t.Id == trialId).SelectMany(t => t.TrialUserList).AnyAsync(t => t.User.UserTypeEnum == UserTypeEnum.SPM || t.User.UserTypeEnum == UserTypeEnum.CPM);
|
||||
var hasSPMOrCPM = await _trialRepository.Where(t => t.Id == trialId).SelectMany(t => t.TrialUserList).AnyAsync(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM);
|
||||
|
||||
var isSPMjoin = isSPMJoinReReadingApproval && hasSPMOrCPM;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
{
|
||||
|
||||
[ApiExplorerSettings(GroupName = "Common")]
|
||||
public class ExcelExportService(IRepository<TrialUser> _trialUserRepository,
|
||||
public class ExcelExportService(IRepository<TrialUserRole> _trialUserRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository,
|
||||
IRepository<SystemDocNeedConfirmedUserType> _systemDocNeedConfirmedUserTypeRepository,
|
||||
@@ -54,7 +54,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
/// <param name="_commonDocumentRepository"></param>
|
||||
/// <param name="_dictionaryService"></param>
|
||||
/// <param name="_trialRepository"></param>
|
||||
/// <param name="_trialUseRepository"></param>
|
||||
/// <param name="_trialUseRoleRepository"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
[HttpPost]
|
||||
@@ -63,7 +63,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
[FromServices] IRepository<CommonDocument> _commonDocumentRepository,
|
||||
[FromServices] IDictionaryService _dictionaryService,
|
||||
[FromServices] IRepository<Trial> _trialRepository,
|
||||
[FromServices] IRepository<TrialUser> _trialUseRepository
|
||||
[FromServices] IRepository<TrialUserRole> _trialUseRoleRepository
|
||||
|
||||
)
|
||||
{
|
||||
@@ -71,15 +71,15 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
|
||||
var exportInfo = (await _trialRepository.Where(t => t.Id == param.TrialId).IgnoreQueryFilters().ProjectTo<ExcelExportInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
var 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))
|
||||
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(param.IsDeleted != null, t => t.IsDeleted == param.IsDeleted)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(param.OrganizationName),
|
||||
t => t.User.OrganizationName.Contains(param.OrganizationName))
|
||||
t => t.UserRole.OrganizationName.Contains(param.OrganizationName))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(param.UserRealName),
|
||||
t => (t.User.FullName).Contains(param.UserRealName))
|
||||
t => (t.UserRole.FullName).Contains(param.UserRealName))
|
||||
.ProjectTo<TrialMaintenanceDTO>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId);
|
||||
@@ -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.User.EMail.Contains(inQuery.PM_EMail) && (t.User.UserTypeEnum == UserTypeEnum.ProjectManager || t.User.UserTypeEnum == UserTypeEnum.APM)))
|
||||
.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)))
|
||||
.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.User.UserTypeEnum == UserTypeEnum.ProjectManager || t.User.UserTypeEnum == UserTypeEnum.APM).OrderBy(t => t.User.EMail).Select(t => t.User.EMail).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_TotalReadCount = isIR ? t.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count() : 0,
|
||||
|
||||
@@ -350,8 +350,8 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
var trialDocQuery = from trialDocumentNeedConfirmedUserType in _trialDocNeedConfirmedUserTypeRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId)
|
||||
join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId)
|
||||
.WhereIf(inQuery.UserId != null, t => t.UserId == inQuery.UserId)
|
||||
.WhereIf(inQuery.UserTypeId != null, t => t.User.UserTypeId == inQuery.UserTypeId)
|
||||
on trialDocumentNeedConfirmedUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId
|
||||
.WhereIf(inQuery.UserTypeId != null, t => t.UserRole.UserTypeId == inQuery.UserTypeId)
|
||||
on trialDocumentNeedConfirmedUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId
|
||||
|
||||
join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on
|
||||
new { trialUser.UserId, TrialDocumentId = trialDocumentNeedConfirmedUserType.TrialDocumentId } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
||||
@@ -375,10 +375,10 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
|
||||
//ConfirmUserId = confirm.ConfirmUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
RealName = trialUser.User.FullName,
|
||||
UserName = trialUser.User.UserName,
|
||||
UserTypeId = trialUser.User.UserTypeId,
|
||||
UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName,
|
||||
RealName = trialUser.UserRole.FullName,
|
||||
UserName = trialUser.UserRole.UserName,
|
||||
UserTypeId = trialUser.UserRole.UserTypeId,
|
||||
UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
||||
|
||||
//FullFilePath = trialDocumentNeedConfirmedUserType.TrialDocument.Path
|
||||
};
|
||||
@@ -389,7 +389,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
|
||||
join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId)
|
||||
.WhereIf(inQuery.UserId != null, t => t.UserId == inQuery.UserId)
|
||||
on needConfirmEdUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId
|
||||
on needConfirmEdUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId
|
||||
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmEdUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
||||
from confirm in cc.DefaultIfEmpty()
|
||||
select new TrainingRecordExportDTO()
|
||||
@@ -409,10 +409,10 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
|
||||
//ConfirmUserId = confirm.ConfirmUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
RealName = trialUser.User.FullName,
|
||||
UserName = trialUser.User.UserName,
|
||||
UserTypeId = trialUser.User.UserTypeId,
|
||||
UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName,
|
||||
RealName = trialUser.UserRole.FullName,
|
||||
UserName = trialUser.UserRole.UserName,
|
||||
UserTypeId = trialUser.UserRole.UserTypeId,
|
||||
UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
||||
|
||||
//FullFilePath = needConfirmEdUserType.SystemDocument.Path
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
public class EmailSendService(IRepository<TrialEmailNoticeConfig> _trialEmailNoticeConfigRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<TrialSiteUser> _trialSiteUserRepository,
|
||||
IOptionsMonitor<SystemEmailSendConfig> _SystemEmailSendConfig, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IEmailSendService
|
||||
@@ -144,7 +144,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
var allUserTypeEnumList = toUserTypeEnumList.Union(copyUserTypeEnumList).Distinct().ToList();
|
||||
|
||||
var allUserList = await _trialUserRepository.Where(t => t.TrialId == trialId && allUserTypeEnumList.Contains(t.User.UserTypeEnum)).Select(t => new { t.UserId, t.User.EMail, t.User.FullName, t.User.UserTypeEnum }).ToListAsync();
|
||||
var allUserList = await _trialUserRepository.Where(t => t.TrialId == trialId && allUserTypeEnumList.Contains(t.UserRole.UserTypeEnum)).Select(t => new { t.UserId, t.UserRole.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum }).ToListAsync();
|
||||
|
||||
|
||||
var toUserList = allUserList.Where(t => toUserTypeEnumList.Contains(t.UserTypeEnum))
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace IRaCIS.Core.Application.Services
|
||||
IRepository<SystemDocNeedConfirmedUserType> _systemDocNeedConfirmedUserTypeRepository,
|
||||
IRepository<TrialDocNeedConfirmedUserType> _trialDocNeedConfirmedUserTypeRepository,
|
||||
IRepository<SystemDocument> _systemDocumentRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRepository,
|
||||
IRepository<TrialDocConfirmedUser> _trialDocConfirmedUserRepository,
|
||||
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITrialDocumentService
|
||||
{
|
||||
@@ -82,10 +82,10 @@ namespace IRaCIS.Core.Application.Services
|
||||
//IsConfirmed = confirm.ConfirmTime != null,
|
||||
ConfirmUserId = confirm.ConfirmUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
RealName = trialUser.User.FullName,
|
||||
UserName = trialUser.User.UserName,
|
||||
UserTypeId = trialUser.User.UserTypeId,
|
||||
UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName
|
||||
RealName = trialUser.UserRole.FullName,
|
||||
UserName = trialUser.UserRole.UserName,
|
||||
UserTypeId = trialUser.UserRole.UserTypeId,
|
||||
UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName
|
||||
|
||||
};
|
||||
|
||||
@@ -224,7 +224,7 @@ namespace IRaCIS.Core.Application.Services
|
||||
.WhereIf(!_userInfo.IsAdmin, t => t.SystemDocument.IsDeleted == false || (t.SystemDocument.IsDeleted == true && t.SystemDocument.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId)))
|
||||
|
||||
join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId && t.UserId == _userInfo.UserRoleId)
|
||||
on needConfirmedUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId
|
||||
on needConfirmedUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId
|
||||
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmedUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
||||
from confirm in cc.DefaultIfEmpty()
|
||||
select new UnionDocumentWithConfirmInfoView()
|
||||
@@ -246,10 +246,10 @@ namespace IRaCIS.Core.Application.Services
|
||||
//IsConfirmed = confirm.ConfirmTime != null,
|
||||
ConfirmUserId = confirm.ConfirmUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
RealName = trialUser.User.FullName,
|
||||
UserName = trialUser.User.UserName,
|
||||
UserTypeId = trialUser.User.UserTypeId,
|
||||
UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName
|
||||
RealName = trialUser.UserRole.FullName,
|
||||
UserName = trialUser.UserRole.UserName,
|
||||
UserTypeId = trialUser.UserRole.UserTypeId,
|
||||
UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName
|
||||
};
|
||||
|
||||
//项目文档查询
|
||||
@@ -278,10 +278,10 @@ namespace IRaCIS.Core.Application.Services
|
||||
//IsConfirmed = confirm.ConfirmTime != null,
|
||||
ConfirmUserId = confirm.ConfirmUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
RealName = trialUser.User.FullName,
|
||||
UserName = trialUser.User.UserName,
|
||||
UserTypeId = trialUser.User.UserTypeId,
|
||||
UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName
|
||||
RealName = trialUser.UserRole.FullName,
|
||||
UserName = trialUser.UserRole.UserName,
|
||||
UserTypeId = trialUser.UserRole.UserTypeId,
|
||||
UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName
|
||||
|
||||
};
|
||||
|
||||
@@ -392,8 +392,8 @@ namespace IRaCIS.Core.Application.Services
|
||||
var trialDocQuery = from trialDocumentNeedConfirmedUserType in _trialDocNeedConfirmedUserTypeRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId)
|
||||
join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId)
|
||||
.WhereIf(inQuery.UserId != null, t => t.UserId == inQuery.UserId)
|
||||
.WhereIf(inQuery.UserTypeId != null, t => t.User.UserTypeId == inQuery.UserTypeId)
|
||||
on trialDocumentNeedConfirmedUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId
|
||||
.WhereIf(inQuery.UserTypeId != null, t => t.UserRole.UserTypeId == inQuery.UserTypeId)
|
||||
on trialDocumentNeedConfirmedUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId
|
||||
|
||||
join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on
|
||||
new { trialUser.UserId, TrialDocumentId = trialDocumentNeedConfirmedUserType.TrialDocumentId } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
||||
@@ -417,10 +417,10 @@ namespace IRaCIS.Core.Application.Services
|
||||
|
||||
ConfirmUserId = confirm.ConfirmUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
RealName = trialUser.User.FullName,
|
||||
UserName = trialUser.User.UserName,
|
||||
UserTypeId = trialUser.User.UserTypeId,
|
||||
UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName,
|
||||
RealName = trialUser.UserRole.FullName,
|
||||
UserName = trialUser.UserRole.UserName,
|
||||
UserTypeId = trialUser.UserRole.UserTypeId,
|
||||
UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
||||
|
||||
FullFilePath = trialDocumentNeedConfirmedUserType.TrialDocument.Path
|
||||
};
|
||||
@@ -431,7 +431,7 @@ namespace IRaCIS.Core.Application.Services
|
||||
|
||||
join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId)
|
||||
.WhereIf(inQuery.UserId != null, t => t.UserId == inQuery.UserId)
|
||||
on needConfirmEdUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId
|
||||
on needConfirmEdUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId
|
||||
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmEdUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
||||
from confirm in cc.DefaultIfEmpty()
|
||||
select new UnionDocumentWithConfirmInfoView()
|
||||
@@ -451,10 +451,10 @@ namespace IRaCIS.Core.Application.Services
|
||||
|
||||
ConfirmUserId = confirm.ConfirmUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
RealName = trialUser.User.FullName,
|
||||
UserName = trialUser.User.UserName,
|
||||
UserTypeId = trialUser.User.UserTypeId,
|
||||
UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName,
|
||||
RealName = trialUser.UserRole.FullName,
|
||||
UserName = trialUser.UserRole.UserName,
|
||||
UserTypeId = trialUser.UserRole.UserTypeId,
|
||||
UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
||||
|
||||
FullFilePath = needConfirmEdUserType.SystemDocument.Path
|
||||
};
|
||||
@@ -493,7 +493,7 @@ namespace IRaCIS.Core.Application.Services
|
||||
public async Task<List<TrialUserDto>> GetTrialUserSelect(Guid trialId)
|
||||
{
|
||||
return await _trialUserRepository.Where(t => t.TrialId == trialId)
|
||||
.Select(t => new TrialUserDto() { UserId = t.UserId, RealName = t.User.FullName, UserName = t.User.UserName })
|
||||
.Select(t => new TrialUserDto() { UserId = t.UserId, RealName = t.UserRole.FullName, UserName = t.UserRole.UserName })
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
@@ -778,16 +778,16 @@ namespace IRaCIS.Core.Application.Services
|
||||
.Select(t => new TrialUserUnionDocumentView()
|
||||
{
|
||||
UserId = t.UserId,
|
||||
UserName = t.User.UserName,
|
||||
RealName = t.User.FullName,
|
||||
UserTypeShortName = t.User.UserTypeRole.UserTypeShortName,
|
||||
TrialDocumentCount = t.Trial.TrialDocumentList.Count(u => u.NeedConfirmedUserTypeList.Any(k => k.NeedConfirmUserTypeId == t.User.UserTypeId)),
|
||||
UserName = t.UserRole.UserName,
|
||||
RealName = t.UserRole.FullName,
|
||||
UserTypeShortName = t.UserRole.UserTypeRole.UserTypeShortName,
|
||||
TrialDocumentCount = t.Trial.TrialDocumentList.Count(u => u.NeedConfirmedUserTypeList.Any(k => k.NeedConfirmUserTypeId == t.UserRole.UserTypeId)),
|
||||
TrialDocumentConfirmedCount = t.Trial.TrialDocumentList.SelectMany(u => u.TrialDocConfirmedUserList).Count(k => k.ConfirmUserId == t.UserId),
|
||||
SystemDocumentConfirmedCount = t.User.SystemDocConfirmedList.Count(),
|
||||
SystemDocumentConfirmedCount = t.UserRole.SystemDocConfirmedList.Count(),
|
||||
//这样写不行
|
||||
//SystemDocumentCount = _systemDocumentRepository.Where(s => s.NeedConfirmedUserTypeList.Any(kk => kk.NeedConfirmUserTypeId == t.User.UserTypeId))
|
||||
// .WhereIf(!_userInfo.IsAdmin, s => s.IsAbandon == false || (s.IsAbandon == true && s.SystemDocConfirmedUserList.Any(uu => uu.ConfirmUserId == t.UserId))).Count()
|
||||
SystemDocumentCount = t.User.UserTypeRole.SystemDocNeedConfirmedUserTypeList.Where(cc => cc.NeedConfirmUserTypeId == t.User.UserTypeId).Select(y => y.SystemDocument).Count()
|
||||
SystemDocumentCount = t.UserRole.UserTypeRole.SystemDocNeedConfirmedUserTypeList.Where(cc => cc.NeedConfirmUserTypeId == t.UserRole.UserTypeId).Select(y => y.SystemDocument).Count()
|
||||
});
|
||||
|
||||
return query.ToList();
|
||||
@@ -837,7 +837,7 @@ namespace IRaCIS.Core.Application.Services
|
||||
SignViewMinimumMinutes = t.SignViewMinimumMinutes,
|
||||
|
||||
DocumentConfirmedUserCount = t.TrialDocConfirmedUserList.Count(),
|
||||
DocumentUserCount = t.Trial.TrialUserList.Count(cc => t.NeedConfirmedUserTypeList.Any(k => k.NeedConfirmUserTypeId == cc.User.UserTypeId))
|
||||
DocumentUserCount = t.Trial.TrialUserList.Count(cc => t.NeedConfirmedUserTypeList.Any(k => k.NeedConfirmUserTypeId == cc.UserRole.UserTypeId))
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
IRepository<TaskMedicalReview> _taskMedicalReviewRepository,
|
||||
IRepository<ReadingGlobalTaskInfo> _readingGlobalTaskInfoRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRepository,
|
||||
IRepository<TrialEmailNoticeUser> _trialEmailNoticeUserRepository,
|
||||
IRepository<Subject> _subjectRepository,
|
||||
IRepository<ReadModule> _readModuleRepository,
|
||||
@@ -300,7 +300,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
var answer = "否";
|
||||
var isNeedSend = true;
|
||||
var minUserIdList = _trialUserRepository.Where(t => t.User.UserTypeEnum == Domain.Share.UserTypeEnum.MIM && t.TrialId == taskInfo.TrialId).Select(t => t.UserId).ToList();
|
||||
var minUserIdList = _trialUserRepository.Where(t => t.UserRole.UserTypeEnum == Domain.Share.UserTypeEnum.MIM && t.TrialId == taskInfo.TrialId).Select(t => t.UserId).ToList();
|
||||
|
||||
|
||||
|
||||
@@ -1199,7 +1199,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
public async Task<List<TrialUserType>> GetTrialUserTypeSelectList(Guid trialId)
|
||||
{
|
||||
|
||||
var query = _trialUserRepository.Where(t => t.TrialId == trialId, false, true).IgnoreQueryFilters().Select(t => t.User.UserTypeRole).Distinct()
|
||||
var query = _trialUserRepository.Where(t => t.TrialId == trialId, false, true).IgnoreQueryFilters().Select(t => t.UserRole.UserTypeRole).Distinct()
|
||||
|
||||
.ProjectTo<TrialUserType>(_mapper.ConfigurationProvider);
|
||||
|
||||
@@ -1222,13 +1222,13 @@ namespace IRaCIS.Core.Application.Service
|
||||
var userTypeList = trialEmailNoticeConfig.TrialEmailNoticeUserList.Select(t => t.UserType).ToList();
|
||||
|
||||
|
||||
var query = _trialUserRepository.Where(t => t.TrialId == trialId && userTypeList.Contains(t.User.UserTypeEnum), false, true).IgnoreQueryFilters()
|
||||
var query = _trialUserRepository.Where(t => t.TrialId == trialId && userTypeList.Contains(t.UserRole.UserTypeEnum), false, true).IgnoreQueryFilters()
|
||||
.Select(t => new TrialSelectUser()
|
||||
{
|
||||
UserId = t.UserId,
|
||||
UserName = t.User.UserName,
|
||||
RealName = t.User.FullName,
|
||||
UserTypeEnum = t.User.UserTypeEnum
|
||||
UserName = t.UserRole.UserName,
|
||||
RealName = t.UserRole.FullName,
|
||||
UserTypeEnum = t.UserRole.UserTypeEnum
|
||||
}).Distinct();
|
||||
|
||||
return await query.ToListAsync();
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
// .ForMember(d => d.RealName, c => c.MapFrom(t => t.User.LastName + " / " + t.User.FirstName));
|
||||
|
||||
|
||||
CreateMap<TrialUser, TrialDocumentUserConfirmView>();
|
||||
CreateMap<TrialUserRole, TrialDocumentUserConfirmView>();
|
||||
|
||||
CreateMap<BatchAddTrialEmailNoticeConfig, TrialEmailNoticeConfig>();
|
||||
|
||||
@@ -78,11 +78,11 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
CreateMap<TrialEmailNoticeConfigAddOrEdit, TrialEmailNoticeConfig>();
|
||||
|
||||
CreateMap<TrialUser, TrialUserSelct>()
|
||||
.ForMember(d => d.Phone, c => c.MapFrom(t => t.User.Phone))
|
||||
.ForMember(d => d.Email, c => c.MapFrom(t => t.User.EMail))
|
||||
.ForMember(d => d.RealName, c => c.MapFrom(t => t.User.FullName))
|
||||
.ForMember(d => d.UserName, c => c.MapFrom(t => t.User.UserName));
|
||||
CreateMap<TrialUserRole, TrialUserSelct>()
|
||||
.ForMember(d => d.Phone, c => c.MapFrom(t => t.UserRole.Phone))
|
||||
.ForMember(d => d.Email, c => c.MapFrom(t => t.UserRole.EMail))
|
||||
.ForMember(d => d.RealName, c => c.MapFrom(t => t.UserRole.FullName))
|
||||
.ForMember(d => d.UserName, c => c.MapFrom(t => t.UserRole.UserName));
|
||||
|
||||
|
||||
CreateMap<TrialEmailNoticeUser, EmailUserInfoDto>();
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
public class UserService(IRepository<UserRole> _userRoleRepository,
|
||||
IMailVerificationService _mailVerificationService,
|
||||
IRepository<VerificationCode> _verificationCodeRepository,
|
||||
IRepository<TrialUser> _userTrialRepository,
|
||||
IRepository<TrialUserRole> _userTrialRepository,
|
||||
IRepository<UserLog> _userLogRepository,
|
||||
IRepository<UserPassWordLog> _userPassWordLogRepository,
|
||||
IDistributedLockProvider _distributedLockProvider,
|
||||
|
||||
@@ -16,8 +16,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
CreateMap<UserTypeMenu, MenuTreeNode>().IncludeMembers(t => t.Menu);
|
||||
|
||||
|
||||
|
||||
CreateMap<UserCommand, UserRole>().ForMember(d => d.UserCode, x => x.Ignore());
|
||||
CreateMap<UserCommand, IdentityUser>().ForMember(d => d.UserCode, x => x.Ignore());
|
||||
CreateMap<UserType, UserTypeMenuAddOrEdit>().ReverseMap()
|
||||
.ForMember(t => t.UserTypeMenuList, u => u.MapFrom(c => c.MenuIds))
|
||||
.ForMember(t => t.UserTypeGroupList, u => u.MapFrom(c => c.UserTypeGroupIdList));
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
IRepository<TrialQCQuestionAnswer> _trialQCQuestionAnswerRepository,
|
||||
IRepository<TrialQCQuestion> _trialQCQuestionRepository,
|
||||
IRepository<DicomStudy> _dicomStudyRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRepository,
|
||||
IRepository<DicomSeries> _dicomSeriesRepository,
|
||||
IRepository<NoneDicomStudy> _noneDicomStudyRepository,
|
||||
IRepository<QCChallenge> _qcChallengeRepository,
|
||||
@@ -584,10 +584,10 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
public async Task<List<QCChanllengeCreatorDto>> GetQCChallengeCreatorList(Guid trialId)
|
||||
{
|
||||
|
||||
return await _trialUserRepository.Where(t => t.TrialId == trialId && t.User.UserTypeEnum == UserTypeEnum.IQC).Select(t => new QCChanllengeCreatorDto()
|
||||
return await _trialUserRepository.Where(t => t.TrialId == trialId && t.UserRole.UserTypeEnum == UserTypeEnum.IQC).Select(t => new QCChanllengeCreatorDto()
|
||||
{
|
||||
CreatorRealName = t.User.FullName,
|
||||
Creator = t.User.UserName,
|
||||
CreatorRealName = t.UserRole.FullName,
|
||||
Creator = t.UserRole.UserName,
|
||||
CreateUserId = t.UserId
|
||||
}).ToListAsync();
|
||||
|
||||
@@ -601,10 +601,10 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
[HttpGet("{trialId:guid}")]
|
||||
public async Task<List<ParticipantDTO>> GetQCParticipantList(Guid trialId)
|
||||
{
|
||||
return await _trialUserRepository.Where(t => t.TrialId == trialId && (t.User.UserTypeEnum == UserTypeEnum.IQC || t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator)).Select(t => new ParticipantDTO()
|
||||
return await _trialUserRepository.Where(t => t.TrialId == trialId && (t.UserRole.UserTypeEnum == UserTypeEnum.IQC || t.UserRole.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator)).Select(t => new ParticipantDTO()
|
||||
{
|
||||
HandleUserRealName = t.User.FullName,
|
||||
HandleUser = t.User.UserName,
|
||||
HandleUserRealName = t.UserRole.FullName,
|
||||
HandleUser = t.UserRole.UserName,
|
||||
HandleUserId = t.UserId
|
||||
}).ToListAsync();
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<SCPPatient> _scpPatientRepository,
|
||||
IRepository<SCPStudy> _scpStudyRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRepository,
|
||||
IRepository<ReadModule> _readModuleRepository,
|
||||
IRepository<DicomInstance> _dicomInstanceRepository,
|
||||
IRepository<TrialQCQuestionAnswer> _trialQCQuestionAnswerRepository,
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
IRepository<TrialSite> _trialSiteRepository,
|
||||
IRepository<Doctor> _doctorRepository,
|
||||
IRepository<VerificationCode> _verificationCodeRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRepository,
|
||||
IRepository<TrialSiteUser> _trialSiteUserRepository,
|
||||
IDistributedLockProvider _distributedLockProvider,
|
||||
ITokenService _tokenService,
|
||||
@@ -687,7 +687,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)
|
||||
{
|
||||
var isTrialSPMJoin = await _trialRepository.AnyAsync(t => t.Id == trialSiteSubmitBackCommand.TrialId && t.IsSPMJoinSiteSurvey);
|
||||
var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == trialSiteSubmitBackCommand.TrialId && t.Trial.TrialUserList.Any(u => u.User.UserTypeEnum == UserTypeEnum.SPM || u.User.UserTypeEnum == UserTypeEnum.CPM));
|
||||
var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == trialSiteSubmitBackCommand.TrialId && t.Trial.TrialUserList.Any(u => u.UserRole.UserTypeEnum == UserTypeEnum.SPM || u.UserRole.UserTypeEnum == UserTypeEnum.CPM));
|
||||
|
||||
var isSPMjoin= isTrialSPMJoin && hasSPMOrCPM;
|
||||
|
||||
@@ -811,7 +811,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.Undefined || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator)
|
||||
{
|
||||
var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == trialId && t.Trial.TrialUserList.Any(u => u.User.UserTypeEnum == UserTypeEnum.SPM || u.User.UserTypeEnum == UserTypeEnum.CPM));
|
||||
var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == trialId && t.Trial.TrialUserList.Any(u => u.UserRole.UserTypeEnum == UserTypeEnum.SPM || u.UserRole.UserTypeEnum == UserTypeEnum.CPM));
|
||||
|
||||
var isTrialSPMJoin = await _trialRepository.AnyAsync(t => t.Id == trialId && t.IsSPMJoinSiteSurvey);
|
||||
|
||||
@@ -953,14 +953,14 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
var findTrialUser = await _trialUserRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.UserId == userId, true);
|
||||
if (findTrialUser == null)
|
||||
{
|
||||
await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now });
|
||||
await _trialUserRepository.AddAsync(new TrialUserRole() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now });
|
||||
|
||||
await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl);
|
||||
|
||||
}
|
||||
else if (findTrialUser.IsDeleted == true)
|
||||
{
|
||||
await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUser()
|
||||
await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUserRole()
|
||||
{
|
||||
IsDeleted = false,
|
||||
DeletedTime = null,
|
||||
@@ -1073,14 +1073,14 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
var findTrialUser = await _trialUserRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.UserId == userId, true);
|
||||
if (findTrialUser == null)
|
||||
{
|
||||
await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now });
|
||||
await _trialUserRepository.AddAsync(new TrialUserRole() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now });
|
||||
|
||||
await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, baseUrl, routeUrl);
|
||||
|
||||
}
|
||||
else if (findTrialUser.IsDeleted == true)
|
||||
{
|
||||
await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUser()
|
||||
await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUserRole()
|
||||
{
|
||||
IsDeleted = false,
|
||||
DeletedTime = null,
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
IRepository<Hospital> _hospitalRepository,
|
||||
IRepository<EnrollDetail> _enrollDetailRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<TrialUser> _userTrialRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IStatisticsService
|
||||
IRepository<TrialUserRole> _userTrialRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IStatisticsService
|
||||
{
|
||||
|
||||
|
||||
@@ -371,7 +371,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
||||
Expression<Func<UserRole, bool>> userLambda = x => true;
|
||||
Expression<Func<TrialUser, bool>> userTrialLambda = x => true;
|
||||
Expression<Func<TrialUserRole, bool>> userTrialLambda = x => true;
|
||||
if (!string.IsNullOrEmpty(param.UserInfo))
|
||||
{
|
||||
var userInfo = param.UserInfo.Trim();
|
||||
@@ -438,7 +438,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
public List<UserParticipateTrialDetail> GetParticipateTrialList(Guid userId)
|
||||
{
|
||||
|
||||
Expression<Func<TrialUser, bool>> userTrialLambda = x => x.UserId == userId;
|
||||
Expression<Func<TrialUserRole, bool>> userTrialLambda = x => x.UserId == userId;
|
||||
|
||||
var userTypeEnum = _userInfo.UserTypeEnumStr;
|
||||
var loginUserId = _userInfo.UserRoleId;
|
||||
@@ -463,7 +463,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
CROName = cro.CROName,
|
||||
Expedited = trial.Expedited,
|
||||
Indication = trial.Indication,
|
||||
UserType = userTrial.User.UserTypeRole.UserTypeShortName,
|
||||
UserType = userTrial.UserRole.UserTypeRole.UserTypeShortName,
|
||||
TrialId = trial.Id
|
||||
|
||||
};
|
||||
|
||||
@@ -174,6 +174,8 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
[NotDefault]
|
||||
public Guid SystemUserId { get; set; }
|
||||
|
||||
public Guid UserTypeId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1381,7 +1381,7 @@ namespace IRaCIS.Core.Application
|
||||
.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.User.EMail.Contains(inQuery.PM_EMail) && (t.User.UserTypeEnum == UserTypeEnum.ProjectManager || t.User.UserTypeEnum == UserTypeEnum.APM)))
|
||||
.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)))
|
||||
.Select(t => new TrialToBeDoneDto()
|
||||
{
|
||||
TrialId = t.Id,
|
||||
@@ -1442,7 +1442,7 @@ namespace IRaCIS.Core.Application
|
||||
|
||||
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.User.UserTypeEnum == UserTypeEnum.ProjectManager || t.User.UserTypeEnum == UserTypeEnum.APM).OrderBy(t => t.User.EMail).Select(t => t.User.EMail).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_TotalReadCount = isIR ? t.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count() : 0,
|
||||
|
||||
@@ -1476,54 +1476,54 @@ namespace IRaCIS.Core.Application
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput<List<TrialUserToBeDoneDto>>> GetTrialUserToBeDoneList(TrialUserToBeDoneQuery inQuery,
|
||||
[FromServices] IRepository<TrialUser> _trialUserRepository)
|
||||
[FromServices] IRepository<TrialUserRole> _trialUserRepository)
|
||||
{
|
||||
|
||||
var query = _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId)
|
||||
.Select(t => new TrialUserToBeDoneDto()
|
||||
{
|
||||
UserName = t.User.UserName,
|
||||
FullName = t.User.FullName,
|
||||
UserType = t.User.UserTypeEnum,
|
||||
UserName = t.UserRole.UserName,
|
||||
FullName = t.UserRole.FullName,
|
||||
UserType = t.UserRole.UserTypeEnum,
|
||||
|
||||
//SPM 阅片人筛选
|
||||
ReviewerSelect_SPM_ToBeApprovalCount =
|
||||
(t.User.UserTypeEnum == UserTypeEnum.SPM || t.User.UserTypeEnum == UserTypeEnum.CPM) ?
|
||||
(t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM) ?
|
||||
t.Trial.EnrollList.Where(u => u.EnrollStatus == EnrollStatus.HasCommittedToCRO).Count() : 0,
|
||||
|
||||
//PM 阅片人确认
|
||||
ReviewerSelect_PM_ToBeConfirmCount =
|
||||
(t.User.UserTypeEnum == UserTypeEnum.APM || t.User.UserTypeEnum == UserTypeEnum.ProjectManager) ?
|
||||
(t.UserRole.UserTypeEnum == UserTypeEnum.APM || t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager) ?
|
||||
t.Trial.EnrollList.Where(u => u.EnrollStatus == EnrollStatus.InviteIntoGroup).Count() : 0,
|
||||
|
||||
//CRC 重传 --区分人
|
||||
ImageUpload_CRC_ToBeReUploadCount =
|
||||
(t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.User.UserTypeEnum == UserTypeEnum.CRA) ?
|
||||
(t.UserRole.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.UserRole.UserTypeEnum == UserTypeEnum.CRA) ?
|
||||
t.Trial.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == t.UserId))
|
||||
.Where(u => u.SubmitState == SubmitStateEnum.ToSubmit && u.IsPMBackOrReReading).Count() : 0,
|
||||
|
||||
//CRC加急待提交 需确认?--区分人
|
||||
ImageUpload_CRC_ToBeSubmitCount =
|
||||
(t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.User.UserTypeEnum == UserTypeEnum.CRA) ?
|
||||
(t.UserRole.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.UserRole.UserTypeEnum == UserTypeEnum.CRA) ?
|
||||
t.Trial.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == t.UserId))
|
||||
.Where(u => u.SubmitState == SubmitStateEnum.ToSubmit).Count() : 0,
|
||||
|
||||
// QC IQC 待领取
|
||||
QC_IQC_ToBeClaimedCount =
|
||||
(t.User.UserTypeEnum == UserTypeEnum.IQC) ?
|
||||
(t.UserRole.UserTypeEnum == UserTypeEnum.IQC) ?
|
||||
t.Trial.SubjectVisitList.Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.UserRoleId && u.ReviewAuditUserId == null))).Count() : 0,
|
||||
|
||||
|
||||
// CRC 质疑待回复 --区分人
|
||||
QC_CRC_ToBeDealedCount =
|
||||
(t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.User.UserTypeEnum == UserTypeEnum.CRA) ?
|
||||
(t.UserRole.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.UserRole.UserTypeEnum == UserTypeEnum.CRA) ?
|
||||
t.Trial.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == t.UserId))
|
||||
.SelectMany(c => c.QCChallengeList).Where(u => u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC).Count() : 0,
|
||||
|
||||
|
||||
//IQC 质疑待处理 --区分人
|
||||
QC_IQC_ToBeDealedCount =
|
||||
(t.User.UserTypeEnum == UserTypeEnum.IQC) ?
|
||||
(t.UserRole.UserTypeEnum == UserTypeEnum.IQC) ?
|
||||
t.Trial.SubjectVisitList.SelectMany(c => c.QCChallengeList)
|
||||
.Where(u => u.CreateUserId == t.UserId && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count() : 0,
|
||||
|
||||
@@ -1531,33 +1531,33 @@ namespace IRaCIS.Core.Application
|
||||
|
||||
// IQC 待审核
|
||||
QC_IQC_ToBeReviewedCount =
|
||||
(t.User.UserTypeEnum == UserTypeEnum.IQC) ?
|
||||
(t.UserRole.UserTypeEnum == UserTypeEnum.IQC) ?
|
||||
t.Trial.SubjectVisitList.Where(u => u.CurrentActionUserId == t.UserId).Count() : 0,
|
||||
|
||||
|
||||
|
||||
//PM 核查待处理
|
||||
Check_PM_ToBeDealedCount =
|
||||
(t.User.UserTypeEnum == UserTypeEnum.APM || t.User.UserTypeEnum == UserTypeEnum.ProjectManager) ?
|
||||
(t.UserRole.UserTypeEnum == UserTypeEnum.APM || t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager) ?
|
||||
t.Trial.SubjectVisitList.Where(u => u.CheckState == CheckStateEnum.ToCheck).Count() : 0,
|
||||
|
||||
//PM 质疑待处理
|
||||
Check_PM_ToBeReplyedCount =
|
||||
(t.User.UserTypeEnum == UserTypeEnum.APM || t.User.UserTypeEnum == UserTypeEnum.ProjectManager) ?
|
||||
(t.UserRole.UserTypeEnum == UserTypeEnum.APM || t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager) ?
|
||||
t.Trial.SubjectVisitList.Where(u => u.CheckState == CheckStateEnum.CVIng &&
|
||||
u.CheckChallengeDialogList.OrderByDescending(t => t.CreateTime).First().UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count() : 0,
|
||||
|
||||
|
||||
// CRC 核查 质疑待处理 --区分人
|
||||
Check_CRC_ToBeDealedCount =
|
||||
(t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.User.UserTypeEnum == UserTypeEnum.CRA) ?
|
||||
(t.UserRole.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.UserRole.UserTypeEnum == UserTypeEnum.CRA) ?
|
||||
t.Trial.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == t.UserId))
|
||||
.Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply).Count() : 0,
|
||||
|
||||
|
||||
//IR 未读 --区分人
|
||||
Reading_IR_UnReadCount =
|
||||
(t.User.UserTypeEnum == UserTypeEnum.IndependentReviewer) ?
|
||||
(t.UserRole.UserTypeEnum == UserTypeEnum.IndependentReviewer) ?
|
||||
t.Trial.VisitTaskList
|
||||
.Where(c => c.DoctorUserId == t.UserId && c.ReadingTaskState != ReadingTaskState.HaveSigned && c.TaskState == TaskState.Effect)
|
||||
// 前序 不存在 未一致性核查未通过的
|
||||
@@ -1570,30 +1570,30 @@ namespace IRaCIS.Core.Application
|
||||
|
||||
//SPM PM重阅审批
|
||||
Reading_SPM_ToBeApprovalCount =
|
||||
(t.User.UserTypeEnum == UserTypeEnum.SPM || t.User.UserTypeEnum == UserTypeEnum.CPM) ?
|
||||
(t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM) ?
|
||||
t.Trial.VisitTaskReReadingList.Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed).Count() : 0,
|
||||
|
||||
//PM IR重阅审批
|
||||
Reading_PM_ToBeApprovalCount =
|
||||
(t.User.UserTypeEnum == UserTypeEnum.APM || t.User.UserTypeEnum == UserTypeEnum.ProjectManager) ?
|
||||
(t.UserRole.UserTypeEnum == UserTypeEnum.APM || t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager) ?
|
||||
t.Trial.VisitTaskReReadingList.Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed).Count() : 0,
|
||||
|
||||
//IR 医学审核 --区分人
|
||||
Medical_IR_ToBeDealedCount =
|
||||
(t.User.UserTypeEnum == UserTypeEnum.IndependentReviewer) ?
|
||||
(t.UserRole.UserTypeEnum == UserTypeEnum.IndependentReviewer) ?
|
||||
t.Trial.TaskMedicalReviewList
|
||||
.Where(c => c.IsClosedDialog == false && c.VisitTask.DoctorUserId == t.UserId && c.IsInvalid == false)
|
||||
.Where(u => u.ReadingMedicalReviewDialogList.OrderByDescending(l => l.CreateTime).First().UserTypeEnumInt == (int)UserTypeEnum.MIM).Count() : 0,
|
||||
|
||||
|
||||
Medical_MIM_ToBeDealedCount =
|
||||
(t.User.UserTypeEnum == UserTypeEnum.MIM) ?
|
||||
(t.UserRole.UserTypeEnum == UserTypeEnum.MIM) ?
|
||||
t.Trial.TaskMedicalReviewList
|
||||
.Where(t => t.IsClosedDialog == false)
|
||||
.Where(u => u.ReadingMedicalReviewDialogList.OrderByDescending(l => l.CreateTime).First().UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer).Count() : 0,
|
||||
|
||||
Medical_MIM_ToBeReviewedCount =
|
||||
(t.User.UserTypeEnum == UserTypeEnum.MIM) ?
|
||||
(t.UserRole.UserTypeEnum == UserTypeEnum.MIM) ?
|
||||
t.Trial.TaskMedicalReviewList
|
||||
.Where(t => t.IsClosedDialog == false && t.IsInvalid == false)
|
||||
.Where(u => !u.IsInvalid && u.AuditState != MedicalReviewAuditState.HaveSigned).Count() : 0
|
||||
|
||||
@@ -22,7 +22,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
[ApiExplorerSettings(GroupName = "Trial")]
|
||||
public class TrialExternalUserService(IRepository<TrialExternalUser> _trialExternalUseRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<IdentityUser> _identityUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<UserType> _userTypeRepository,
|
||||
IMailVerificationService _mailVerificationService,
|
||||
@@ -64,7 +65,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
using (await @lock.AcquireAsync())
|
||||
{
|
||||
var existSysUser = await _userRoleRepository.FirstOrDefaultAsync(t => t.EMail == addOrEditTrialExternalUser.Email && t.UserTypeId == addOrEditTrialExternalUser.UserTypeId);
|
||||
var existSysUser = await _identityUserRepository.Where(t => t.EMail == addOrEditTrialExternalUser.Email, true).Include(t => t.UserRoleList).FirstOrDefaultAsync();
|
||||
|
||||
if (existSysUser != null)
|
||||
{
|
||||
@@ -93,13 +94,12 @@ namespace IRaCIS.Core.Application.Service
|
||||
await _trialExternalUseRepository.AddAsync(addEntity);
|
||||
|
||||
|
||||
var existUser = await _userRoleRepository.FirstOrDefaultAsync(t => t.EMail == addOrEditTrialExternalUser.Email && t.UserTypeId == addOrEditTrialExternalUser.UserTypeId);
|
||||
var trialType = await _trialRepository.Where(t => t.Id == addOrEditTrialExternalUser.TrialId).Select(t => t.TrialType).FirstOrDefaultAsync();
|
||||
|
||||
if (existUser != null)
|
||||
if (existSysUser != null)
|
||||
{
|
||||
addEntity.IsSystemUser = true;
|
||||
addEntity.SystemUserId = existUser.Id;
|
||||
addEntity.SystemUserId = existSysUser.Id;
|
||||
|
||||
}
|
||||
else
|
||||
@@ -107,7 +107,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
//生成账户 并插入
|
||||
|
||||
var generateUser = _mapper.Map<UserRole>(addOrEditTrialExternalUser);
|
||||
var generateUser = _mapper.Map<IdentityUser>(addOrEditTrialExternalUser);
|
||||
|
||||
if (trialType == TrialType.NoneOfficial)
|
||||
{
|
||||
@@ -124,20 +124,24 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
generateUser.UserName = generateUser.UserCode;
|
||||
|
||||
generateUser.UserTypeEnum = _userTypeRepository.Where(t => t.Id == generateUser.UserTypeId).Select(t => t.UserTypeEnum).First();
|
||||
|
||||
generateUser.Password = MD5Helper.Md5(IRCEmailPasswordHelper.GenerateRandomPassword(10));
|
||||
|
||||
generateUser.Status = UserStateEnum.Disable;
|
||||
|
||||
var newAddUser = await _userRoleRepository.AddAsync(generateUser);
|
||||
var addRole = _mapper.Map<UserRole>(generateUser);
|
||||
addRole.UserTypeEnum = _userTypeRepository.Where(t => t.Id == addOrEditTrialExternalUser.UserTypeId).Select(t => t.UserTypeEnum).First();
|
||||
addRole.UserTypeId = addOrEditTrialExternalUser.UserTypeId;
|
||||
|
||||
generateUser.UserRoleList = new List<UserRole>() { addRole };
|
||||
|
||||
var newAddUser = await _identityUserRepository.AddAsync(generateUser);
|
||||
|
||||
addEntity.IsSystemUser = false;
|
||||
addEntity.SystemUserId = newAddUser.Id;
|
||||
|
||||
|
||||
existUser = newAddUser;
|
||||
existSysUser = newAddUser;
|
||||
|
||||
}
|
||||
|
||||
@@ -146,7 +150,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
if (trialType == TrialType.OfficialTrial || trialType == TrialType.Training)
|
||||
{
|
||||
|
||||
if (existUser.IsTestUser)
|
||||
if (existSysUser.IsTestUser)
|
||||
{
|
||||
//---正式类型 、培训类型的项目 不允许加入测试用户
|
||||
throw new BusinessValidationFailedException(_localizer["TrialExternalUser_TestUserNotAllowed"]);
|
||||
@@ -157,7 +161,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
if (trialType == TrialType.NoneOfficial)
|
||||
{
|
||||
|
||||
if (existUser.IsTestUser == false)
|
||||
if (existSysUser.IsTestUser == false)
|
||||
{
|
||||
//---测试项目 不允许加入正式用户
|
||||
throw new BusinessValidationFailedException(_localizer["TrialExternalUser_FormalUserNotAllowed"]);
|
||||
@@ -185,7 +189,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
Id = addEntity.Id,
|
||||
Email=addEntity.Email,
|
||||
IsSystemUser=addEntity.IsSystemUser,
|
||||
SystemUserId=addEntity.SystemUserId
|
||||
SystemUserId=addEntity.SystemUserId,
|
||||
UserTypeId=addOrEditTrialExternalUser.UserTypeId
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -243,7 +248,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
foreach (var userInfo in sendEmail.SendUsers)
|
||||
{
|
||||
var userId = userInfo.SystemUserId;
|
||||
|
||||
var userTypeId = userInfo.UserTypeId;
|
||||
|
||||
|
||||
|
||||
@@ -251,7 +256,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId, true))
|
||||
{
|
||||
|
||||
await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now });
|
||||
await _trialUserRepository.AddAsync(new TrialUserRole() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now });
|
||||
|
||||
await _userRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new UserRole() { Status = UserStateEnum.Enable });
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
[ApiExplorerSettings(GroupName = "Trial")]
|
||||
public class TrialMaintenanceService(IRepository<TrialUser> _trialUseRepository,
|
||||
public class TrialMaintenanceService(IRepository<TrialUserRole> _trialUseRoleRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<TrialSiteUser> _trialSiteUserRepository,
|
||||
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||
@@ -18,8 +18,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
[HttpGet]
|
||||
public async Task<List<TrialUserBasicInfo>> GetTrialUserList(Guid trialId)
|
||||
{
|
||||
return await _trialUseRepository.Where(t => t.TrialId == trialId, ignoreQueryFilters: true)
|
||||
.Select(t => new TrialUserBasicInfo() { FullName = t.User.FullName, UserId = t.UserId, UserTypeId = t.User.UserTypeId, UserName = t.User.UserName })
|
||||
return await _trialUseRoleRepository.Where(t => t.TrialId == trialId, ignoreQueryFilters: true)
|
||||
.Select(t => new TrialUserBasicInfo() { FullName = t.UserRole.FullName, UserId = t.UserId, UserTypeId = t.UserRole.UserTypeId, UserName = t.UserRole.UserName })
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
@@ -32,13 +32,13 @@ namespace IRaCIS.Core.Application.Service
|
||||
public async Task<PageOutput<TrialMaintenanceDTO>> GetMaintenanceUserList(TrialMaintenanceQuery inQuery)
|
||||
{
|
||||
|
||||
var query = _trialUseRepository.Where(t => t.TrialId == inQuery.TrialId).IgnoreQueryFilters()
|
||||
.WhereIf(inQuery.UserTypeId != null, t => t.User.UserTypeId == inQuery.UserTypeId)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserName), t => t.User.UserName.Contains(inQuery.UserName))
|
||||
var query = _trialUseRoleRepository.Where(t => t.TrialId == inQuery.TrialId).IgnoreQueryFilters()
|
||||
.WhereIf(inQuery.UserTypeId != null, t => t.UserRole.UserTypeId == inQuery.UserTypeId)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserName), t => t.UserRole.UserName.Contains(inQuery.UserName))
|
||||
|
||||
.WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.OrganizationName), t => t.User.OrganizationName.Contains(inQuery.OrganizationName))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserRealName), t => (t.User.FullName).Contains(inQuery.UserRealName))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.OrganizationName), t => t.UserRole.OrganizationName.Contains(inQuery.OrganizationName))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserRealName), t => (t.UserRole.FullName).Contains(inQuery.UserRealName))
|
||||
.ProjectTo<TrialMaintenanceDTO>(_mapper.ConfigurationProvider);
|
||||
|
||||
return await query.ToPagedListAsync(inQuery, nameof(TrialMaintenanceDTO.UpdateTime));
|
||||
@@ -55,11 +55,11 @@ namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
// 最开始过滤site已经选择的用户 现在又改回去。。。
|
||||
|
||||
var query = _trialUseRepository.Where(t => t.TrialId == inQuery.TrialId).IgnoreQueryFilters()
|
||||
.Where(t => t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.User.UserTypeEnum == UserTypeEnum.CRA)
|
||||
.WhereIf(inQuery.UserTypeId != null, t => t.User.UserTypeId == inQuery.UserTypeId)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserRealName), t => (t.User.FullName).Contains(inQuery.UserRealName))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.OrganizationName), t => t.User.OrganizationName.Contains(inQuery.OrganizationName))
|
||||
var query = _trialUseRoleRepository.Where(t => t.TrialId == inQuery.TrialId).IgnoreQueryFilters()
|
||||
.Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.UserRole.UserTypeEnum == UserTypeEnum.CRA)
|
||||
.WhereIf(inQuery.UserTypeId != null, t => t.UserRole.UserTypeId == inQuery.UserTypeId)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserRealName), t => (t.UserRole.FullName).Contains(inQuery.UserRealName))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.OrganizationName), t => t.UserRole.OrganizationName.Contains(inQuery.OrganizationName))
|
||||
.ProjectTo<AssginSiteCRCListDTO>(_mapper.ConfigurationProvider, new { trialSiteId = inQuery.TrialSiteId });
|
||||
|
||||
return await query.ToPagedListAsync(inQuery);
|
||||
@@ -119,9 +119,9 @@ namespace IRaCIS.Core.Application.Service
|
||||
public async Task<IResponseOutput> AddTrialUsers(TrialUserAddCommand[] userTrialCommands)
|
||||
{
|
||||
|
||||
var addArray = _mapper.Map<TrialUser[]>(userTrialCommands);
|
||||
var addArray = _mapper.Map<TrialUserRole[]>(userTrialCommands);
|
||||
|
||||
var trialUsers = await _trialUseRepository.AddRangeAsync(addArray);
|
||||
var trialUsers = await _trialUseRoleRepository.AddRangeAsync(addArray);
|
||||
|
||||
foreach (var item in trialUsers)
|
||||
{
|
||||
@@ -129,7 +129,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
}
|
||||
|
||||
|
||||
var success = await _trialUseRepository.SaveChangesAsync();
|
||||
var success = await _trialUseRoleRepository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Result(success);
|
||||
}
|
||||
@@ -141,7 +141,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
[HttpPut]
|
||||
public async Task<IResponseOutput> UpdateTrialUser(UpdateTrialUserCommand updateTrialUserCommand)
|
||||
{
|
||||
var trialUser = await _trialUseRepository.Where(t => t.Id == updateTrialUserCommand.Id, true, true).FirstOrDefaultAsync();
|
||||
var trialUser = await _trialUseRoleRepository.Where(t => t.Id == updateTrialUserCommand.Id, true, true).FirstOrDefaultAsync();
|
||||
|
||||
if (trialUser == null) return Null404NotFound(trialUser);
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
_mapper.Map(updateTrialUserCommand, trialUser);
|
||||
|
||||
await _trialUseRepository.SaveChangesAsync();
|
||||
await _trialUseRoleRepository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
public async Task<IResponseOutput> DeleteMaintenanceUser(Guid id, bool isDelete)
|
||||
{
|
||||
|
||||
var trialUser = await _trialUseRepository.AsQueryable().IgnoreQueryFilters().FirstOrDefaultAsync(t => t.Id == id);
|
||||
var trialUser = await _trialUseRoleRepository.AsQueryable().IgnoreQueryFilters().FirstOrDefaultAsync(t => t.Id == id);
|
||||
|
||||
if (trialUser == null) return Null404NotFound(trialUser);
|
||||
|
||||
@@ -195,9 +195,9 @@ namespace IRaCIS.Core.Application.Service
|
||||
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.CurrentActionUserId == trialUser.UserId && t.TrialId == trialUser.TrialId && t.IsTake, u => new SubjectVisit() { CurrentActionUserId = null, CurrentActionUserExpireTime = null, IsTake = false });
|
||||
}
|
||||
|
||||
await _trialUseRepository.BatchUpdateNoTrackingAsync(t => t.Id == id, u => new TrialUser() { IsDeleted = isDelete, RemoveTime = isDelete ? DateTime.Now : null });
|
||||
await _trialUseRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == id, u => new TrialUserRole() { IsDeleted = isDelete, RemoveTime = isDelete ? DateTime.Now : null });
|
||||
|
||||
await _trialUseRepository.SaveChangesAsync();
|
||||
await _trialUseRoleRepository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
[ApiExplorerSettings(GroupName = "Trial")]
|
||||
|
||||
public class TrialService(IRepository<Trial> _trialRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRepository,
|
||||
IRepository<CRO> _croRepository,
|
||||
IRepository<EnrollDetail> _enrollDetailRepository,
|
||||
IRepository<Dictionary> _dictionaryRepository,
|
||||
@@ -208,7 +208,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
//如果是PM, 则需要将该人员添加到 运维人员表
|
||||
//添加运维人员PM
|
||||
await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trial.Id, UserId = _userInfo.UserRoleId, JoinTime = DateTime.Now });
|
||||
await _trialUserRepository.AddAsync(new TrialUserRole() { TrialId = trial.Id, UserId = _userInfo.UserRoleId, JoinTime = DateTime.Now });
|
||||
|
||||
// 添加扩展信息表记录
|
||||
await _trialPaymentPriceRepository.AddAsync(new TrialPaymentPrice() { TrialId = trial.Id });
|
||||
@@ -550,7 +550,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
await _repository.BatchDeleteNoTrackingAsync<TrialSiteUserSurvey>(t => t.TrialSiteSurvey.TrialId == trialId);
|
||||
await _repository.BatchDeleteNoTrackingAsync<TrialSiteEquipmentSurvey>(t => t.TrialSiteSurvey.TrialId == trialId);
|
||||
|
||||
await _repository.BatchDeleteNoTrackingAsync<TrialUser>(t => t.TrialId == trialId);
|
||||
await _repository.BatchDeleteNoTrackingAsync<TrialUserRole>(t => t.TrialId == trialId);
|
||||
await _repository.BatchDeleteNoTrackingAsync<TrialSiteUser>(t => t.TrialId == trialId);
|
||||
await _repository.BatchDeleteNoTrackingAsync<VisitStage>(t => t.TrialId == trialId);
|
||||
await _repository.BatchDeleteNoTrackingAsync<VisitPlanInfluenceStat>(t => t.TrialId == trialId);
|
||||
|
||||
@@ -37,22 +37,22 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
|
||||
|
||||
CreateMap<UserTrialCommand, TrialUser>();
|
||||
CreateMap<UserTrialCommand, TrialUserRole>();
|
||||
|
||||
CreateMap<TrialSiteCommand, TrialSite>()
|
||||
.ForMember(x => x.Id, x => x.Ignore());
|
||||
|
||||
CreateMap<EditTrialSiteCommand, TrialSite>();
|
||||
|
||||
CreateMap<UpdateTrialUserCommand, TrialUser>();
|
||||
CreateMap<UpdateTrialUserCommand, TrialUserRole>();
|
||||
|
||||
|
||||
|
||||
CreateMap<AssginSiteCRCCommand, TrialUser>();
|
||||
CreateMap<AssginSiteCRCCommand, TrialUserRole>();
|
||||
|
||||
CreateMap<TrialUserAddCommand, TrialUser>();
|
||||
CreateMap<TrialUserAddCommand, TrialUserRole>();
|
||||
|
||||
CreateMap<SiteCRCCommand, TrialUser>();
|
||||
CreateMap<SiteCRCCommand, TrialUserRole>();
|
||||
|
||||
|
||||
//临床项目
|
||||
@@ -86,16 +86,16 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
|
||||
|
||||
CreateMap<TrialUser, TrialMaintenanceDTO>().IncludeMembers(t => t.User)
|
||||
.ForMember(d => d.UserRealName, u => u.MapFrom(s => s.User.FullName))
|
||||
.ForMember(t => t.UserType, u => u.MapFrom(t => t.User.UserTypeRole.UserTypeShortName));
|
||||
CreateMap<TrialUserRole, TrialMaintenanceDTO>().IncludeMembers(t => t.UserRole)
|
||||
.ForMember(d => d.UserRealName, u => u.MapFrom(s => s.UserRole.FullName))
|
||||
.ForMember(t => t.UserType, u => u.MapFrom(t => t.UserRole.UserTypeRole.UserTypeShortName));
|
||||
CreateMap<UserRole, TrialMaintenanceDTO>();
|
||||
|
||||
var trialSiteId = Guid.Empty;
|
||||
CreateMap<TrialUser, AssginSiteCRCListDTO>().IncludeMembers(t => t.User)
|
||||
.ForMember(d => d.UserRealName, u => u.MapFrom(s => s.User.FullName))
|
||||
CreateMap<TrialUserRole, AssginSiteCRCListDTO>().IncludeMembers(t => t.UserRole)
|
||||
.ForMember(d => d.UserRealName, u => u.MapFrom(s => s.UserRole.FullName))
|
||||
.ForMember(d => d.TrialSiteId, u => u.MapFrom(t => trialSiteId))
|
||||
.ForMember(d => d.UserType, u => u.MapFrom(t => t.User.UserTypeRole.UserTypeShortName))
|
||||
.ForMember(d => d.UserType, u => u.MapFrom(t => t.UserRole.UserTypeRole.UserTypeShortName))
|
||||
.ForMember(d => d.IsSelect, u => u.MapFrom(t => t.Trial.TrialSiteUserList.Any(k => k.UserId == t.UserId && k.TrialSiteId== trialSiteId)));
|
||||
CreateMap<UserRole, AssginSiteCRCListDTO>();
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
IRepository<EnrollDetail> _enrollDetailRepository,
|
||||
IRepository<Workload> _workloadRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRepository,
|
||||
IRepository<ReadingQuestionCriterionTrial> _ReadingQuestionCriterionTrialRepository,
|
||||
|
||||
IRepository<TrialExperience> _trialExperienceRepository,
|
||||
@@ -174,7 +174,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
var trial = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId);
|
||||
|
||||
var hasSPMOrCPM = await _trialUserRepository.Where(t => t.TrialId == trialId).AnyAsync(t => t.User.UserTypeEnum == UserTypeEnum.SPM || t.User.UserTypeEnum == UserTypeEnum.CPM);
|
||||
var hasSPMOrCPM = await _trialUserRepository.Where(t => t.TrialId == trialId).AnyAsync(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM);
|
||||
|
||||
var isSPMjoin= trial.IsSPMJoinReviewerSelect && hasSPMOrCPM;
|
||||
|
||||
@@ -354,7 +354,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
//[Authorize(Policy = IRaCISPolicy.PM_APM_SPM_CPM_SMM_CMM)]
|
||||
[UnitOfWork]
|
||||
public async Task<IResponseOutput> ConfirmReviewer(ConfirmReviewerCommand confirmReviewerCommand,
|
||||
[FromServices] IRepository<TrialUser> _trialUserRepository,
|
||||
[FromServices] IRepository<TrialUserRole> _trialUserRepository,
|
||||
[FromServices] IRepository<TaskAllocationRule> _taskAllocationRuleRepository)
|
||||
{
|
||||
//var trial = _trialRepository.FirstOrDefault(t => t.Id == trialId);
|
||||
@@ -412,7 +412,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId, true))
|
||||
{
|
||||
await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now });
|
||||
await _trialUserRepository.AddAsync(new TrialUserRole() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now });
|
||||
}
|
||||
|
||||
await _enrollRepository.BatchUpdateNoTrackingAsync(t => t.Id == intoGroupItem.Id, u => new Enroll() { DoctorUserId = userId });
|
||||
|
||||
Reference in New Issue
Block a user