diff --git a/IRaCIS.Core.API/Controllers/ExtraController.cs b/IRaCIS.Core.API/Controllers/ExtraController.cs index 4f26e5863..e8016d431 100644 --- a/IRaCIS.Core.API/Controllers/ExtraController.cs +++ b/IRaCIS.Core.API/Controllers/ExtraController.cs @@ -130,7 +130,7 @@ namespace IRaCIS.Api.Controllers //验证MFA 编码是否有问题 ,前端要拆开,自己调用验证的逻辑 //await _userService.VerifyMFACodeAsync(userId, loginUser.MFACode); - //var loginUser = await _userRepository.Where(u => u.UserName.Equals(userName) && u.Password == password).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); + //var loginUser = await _userRoleRepository.Where(u => u.UserName.Equals(userName) && u.Password == password).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); var basicInfo = await _userService.GetUserBasicInfo(userId, loginUser.Password); @@ -375,7 +375,7 @@ namespace IRaCIS.Api.Controllers [HttpGet("User/UserRedirect")] [AllowAnonymous] - public async Task UserRedirect([FromServices] IRepository _userRepository, string url, [FromServices] ILogger _logger) + public async Task UserRedirect([FromServices] IRepository _userRoleRepository, string url, [FromServices] ILogger _logger) { var decodeUrl = System.Web.HttpUtility.UrlDecode(url); @@ -391,7 +391,7 @@ namespace IRaCIS.Api.Controllers var errorUrl = domainStrList[0] + "//" + domainStrList[2] + "/error"; - if (!await _userRepository.AnyAsync(t => t.Id == Guid.Parse(userId) && t.EmailToken == token && t.IsFirstAdd)) + if (!await _userRoleRepository.AnyAsync(t => t.Id == Guid.Parse(userId) && t.EmailToken == token && t.IsFirstAdd)) { decodeUrl = errorUrl + $"?lang={lang}&ErrorMessage={System.Web.HttpUtility.UrlEncode(lang == "zh" ? "您的初始化链接已过期" : "Error!The initialization link has expired. Return")} "; } diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs index 11313c7be..5ad8ce116 100644 --- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs @@ -370,7 +370,7 @@ namespace IRaCIS.Core.API.Controllers //await _uploadHub.Clients.All.ReceivProgressAsync(archiveStudyCommand.StudyInstanceUid, receivedCount); - await _uploadHub.Clients.User(_userInfo.Id.ToString()).ReceivProgressAsync(archiveStudyCommand.StudyInstanceUid, receivedCount); + await _uploadHub.Clients.User(_userInfo.UserRoleId.ToString()).ReceivProgressAsync(archiveStudyCommand.StudyInstanceUid, receivedCount); archiveResult.ReceivedFileCount = receivedCount; diff --git a/IRaCIS.Core.Application/BusinessFilter/_Config/_AppSettings.cs b/IRaCIS.Core.Application/BusinessFilter/_Config/_AppSettings.cs index e2c6fcddb..2c43c8a87 100644 --- a/IRaCIS.Core.Application/BusinessFilter/_Config/_AppSettings.cs +++ b/IRaCIS.Core.Application/BusinessFilter/_Config/_AppSettings.cs @@ -140,7 +140,7 @@ public static class AppSettings case nameof(Doctor): return IRaCISBasicConfig.DoctorCodePrefix + codeInt.ToString("D4"); - case nameof(User): + case nameof(UserRole): return IRaCISBasicConfig.UserCodePrefix + codeInt.ToString("D4"); case nameof(QCChallenge): diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index f4e8064e6..756d71220 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -116,7 +116,7 @@ 分配规则 - + 分配规则 @@ -147,7 +147,7 @@ 一致性分析配置表 - + 一致性分析配置表 @@ -1940,7 +1940,7 @@ FrontAuditConfigService - + FrontAuditConfigService @@ -2249,7 +2249,7 @@ - + 根据用户Id获取用户详细信息[New] @@ -12576,7 +12576,7 @@ 生成的阅片模块(在大列表上展示的) 阅片期 - + 生成的阅片模块(在大列表上展示的) 阅片期 @@ -12671,7 +12671,7 @@ 用户WL模板 - + 用户WL模板 @@ -12715,7 +12715,7 @@ Dashboard统计、全局工作量统计、入组两个维度统计(按照项目、按照人) - + Dashboard统计、全局工作量统计、入组两个维度统计(按照项目、按照人) @@ -12834,7 +12834,7 @@ 项目外部人员 录入流程相关 - + 项目外部人员 录入流程相关 @@ -13314,7 +13314,7 @@ 加急的医学反馈任务 通知MIM - + 加急的医学反馈任务 通知MIM @@ -13332,7 +13332,7 @@ MIM 回复医学返回通知IR - + MIM 回复医学返回通知IR @@ -13349,7 +13349,7 @@ 加急阅片 IR 申请重阅 或者PM 申请重阅 - + 加急阅片 IR 申请重阅 或者PM 申请重阅 @@ -13389,7 +13389,7 @@ CRC 提交了 通知QC进行质控 Code005,006 - + CRC 提交了 通知QC进行质控 Code005,006 @@ -13399,7 +13399,7 @@ CRC 回复质控质疑 通知QC Code012,013 - + CRC 回复质控质疑 通知QC Code012,013 @@ -13409,7 +13409,7 @@ QC回复 质控质疑,通知CRC (014,015) - + QC回复 质控质疑,通知CRC (014,015) @@ -13419,19 +13419,19 @@ CRC 回复一致性核查质疑 通知PM (019,020) - + CRC 回复一致性核查质疑 通知PM (019,020) - + 通知PM 进行一致性核查 (018,030) - + 通知PM 进行一致性核查 (018,030) @@ -13441,7 +13441,7 @@ QC 领取了质控任务 (007,008) - + QC 领取了质控任务 (007,008) @@ -13452,15 +13452,15 @@ publish 请求流不会先到消费者,发布后,直接执行后续代码 - + - + meditor send 的时候,请求流会先到消费者,返回后才会执行后续代码 publish 请求流不会先到消费者,发布后,直接执行后续代码 - + @@ -14985,7 +14985,7 @@ UserTypeRoleService - + UserTypeRoleService @@ -15418,7 +15418,7 @@ TrialSiteSurveyService - + TrialSiteSurveyService @@ -15524,7 +15524,7 @@ TrialSiteUserSurveyService - + TrialSiteUserSurveyService @@ -16045,7 +16045,7 @@ SystemDocumentService - + SystemDocumentService diff --git a/IRaCIS.Core.Application/MassTransit/Consumer/ConsistencyCheckConsumer.cs b/IRaCIS.Core.Application/MassTransit/Consumer/ConsistencyCheckConsumer.cs index 0efce758d..afad75e47 100644 --- a/IRaCIS.Core.Application/MassTransit/Consumer/ConsistencyCheckConsumer.cs +++ b/IRaCIS.Core.Application/MassTransit/Consumer/ConsistencyCheckConsumer.cs @@ -191,7 +191,7 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer // dialogMsg.AppendLine(@$"
说明:为高效解决/处理以上全部质疑问题,麻烦您准确核实实际影像检查情况。请注意影像日期与实际检查的日期可能会不一致,部分检查(如PET -CT)可能同时存在多种模态影像。准确核实后,请回复该访视正确的影像检查情况。"); dbSV.CheckState = CheckStateEnum.CVPassed; - dbSV.CheckUserId = _userInfo.Id; + dbSV.CheckUserId = _userInfo.UserRoleId; dbSV.CheckPassedTime = DateTime.Now; dbSV.CheckChallengeState = CheckChanllengeTypeEnum.Closed; diff --git a/IRaCIS.Core.Application/MassTransit/Consumer/ReadingRelationEmailConsumer.cs b/IRaCIS.Core.Application/MassTransit/Consumer/ReadingRelationEmailConsumer.cs index a547968f0..b83006f3a 100644 --- a/IRaCIS.Core.Application/MassTransit/Consumer/ReadingRelationEmailConsumer.cs +++ b/IRaCIS.Core.Application/MassTransit/Consumer/ReadingRelationEmailConsumer.cs @@ -22,7 +22,7 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer; /// 加急的医学反馈任务 通知MIM /// public class UrgentMedicalReviewAddedEventConsumer( - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _taskMedicalReviewRepository, IRepository _trialRepository, IRepository _subjectVisitRepository, @@ -58,7 +58,7 @@ public class UrgentMedicalReviewAddedEventConsumer( return; } var criterion = await _readingQuestionCriterionTrialRepository.FirstOrDefaultAsync(x => x.Id == medicalReview.VisitTask.TrialReadingCriterionId); - var userinfo = await _userRepository.Where(x => x.Id == medicalReview.MedicalManagerUserId).FirstOrDefaultAsync(); + var userinfo = await _userRoleRepository.Where(x => x.Id == medicalReview.MedicalManagerUserId).FirstOrDefaultAsync(); var taskInfo = await _visitTaskRepository.Where(x => x.Id == medicalReview.VisitTaskId).Include(x=>x.SourceSubjectVisit).Include(x => x.ReadModule).Include(x => x.Subject).FirstNotNullAsync(); @@ -128,7 +128,7 @@ public class UrgentMedicalReviewAddedEventConsumer( //IR 回复医学反馈通知MIM public class UrgentIRRepliedMedicalReviewConsumer( - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _taskMedicalReviewRepository, IRepository _trialRepository, IRepository _subjectVisitRepository, @@ -159,7 +159,7 @@ public class UrgentIRRepliedMedicalReviewConsumer( return; } var criterion = await _readingQuestionCriterionTrialRepository.FirstOrDefaultAsync(x => x.Id == medicalReview.VisitTask.TrialReadingCriterionId); - var userinfo = await _userRepository.Where(x => x.Id == medicalReview.MedicalManagerUserId).FirstOrDefaultAsync(); + var userinfo = await _userRoleRepository.Where(x => x.Id == medicalReview.MedicalManagerUserId).FirstOrDefaultAsync(); var taskInfo = await _visitTaskRepository.Where(x => x.Id == medicalReview.VisitTaskId).Include(x => x.SourceSubjectVisit).Include(x => x.ReadModule).Include(x => x.Subject).FirstNotNullAsync(); @@ -231,7 +231,7 @@ public class UrgentIRRepliedMedicalReviewConsumer( /// MIM 回复医学返回通知IR /// public class UrgentMIMRepliedMedicalReviewConsumer( - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _taskMedicalReviewRepository, IRepository _trialRepository, IRepository _subjectVisitRepository, @@ -268,7 +268,7 @@ public class UrgentMIMRepliedMedicalReviewConsumer( var criterion = await _readingQuestionCriterionTrialRepository.FirstOrDefaultAsync(x => x.Id == medicalReview.VisitTask.TrialReadingCriterionId); var taskInfo = await _visitTaskRepository.Where(x => x.Id == medicalReview.VisitTaskId).Include(x => x.SourceSubjectVisit).Include(x => x.ReadModule).Include(x => x.Subject).FirstNotNullAsync(); - var userinfo = await _userRepository.Where(x => x.Id == taskInfo.DoctorUserId).FirstOrDefaultAsync(); + var userinfo = await _userRoleRepository.Where(x => x.Id == taskInfo.DoctorUserId).FirstOrDefaultAsync(); @@ -346,7 +346,7 @@ public class UrgentMIMRepliedMedicalReviewConsumer( /// 加急阅片 IR 申请重阅 或者PM 申请重阅 /// public class UrgentIRApplyedReReadingConsumer( - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _trialUseRepository, IRepository _taskMedicalReviewRepository, IRepository _trialRepository, @@ -370,7 +370,7 @@ public class UrgentIRApplyedReReadingConsumer( var criterion = await _readingQuestionCriterionTrialRepository.FirstOrDefaultAsync(x => x.Id == taskInfo.TrialReadingCriterionId); - var doctorInfo = await _userRepository.Where(x => x.Id == taskInfo.DoctorUserId).FirstOrDefaultAsync(); + var doctorInfo = await _userRoleRepository.Where(x => x.Id == taskInfo.DoctorUserId).FirstOrDefaultAsync(); var trialUser = await _trialUseRepository.Where(x => x.TrialId == taskInfo.TrialId).Include(x => x.User).Select(x=>x.User).ToListAsync(); diff --git a/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs b/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs index d1734d2e1..dec695e0d 100644 --- a/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs +++ b/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs @@ -229,7 +229,7 @@ public class SiteSurverRejectedEventConsumer( //PM 驳回到SPM if (siteSurveyInfo.State == TrialSiteSurveyEnum.CRCSubmitted) { - //var user = await _userRepository.FirstOrDefaultAsync(t => t.Id == siteSurveyInfo.PreliminaryUserId); + //var user = await _userRoleRepository.FirstOrDefaultAsync(t => t.Id == siteSurveyInfo.PreliminaryUserId); //name = user.FullName; diff --git a/IRaCIS.Core.Application/MassTransit/Consumer/SubjectVisitQCAndCheckConsumer.cs b/IRaCIS.Core.Application/MassTransit/Consumer/SubjectVisitQCAndCheckConsumer.cs index 22f58a5da..85f5b6971 100644 --- a/IRaCIS.Core.Application/MassTransit/Consumer/SubjectVisitQCAndCheckConsumer.cs +++ b/IRaCIS.Core.Application/MassTransit/Consumer/SubjectVisitQCAndCheckConsumer.cs @@ -23,7 +23,7 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer; /// CRC 提交了 通知QC进行质控 Code005,006 /// public class CRCSubmitedAndQCToAuditEventConsumer( - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _trialUseRepository, IRepository _subjectVisitRepository, IRepository _trialRepository, @@ -127,7 +127,7 @@ public class CRCSubmitedAndQCToAuditEventConsumer( /// CRC 回复质控质疑 通知QC Code012,013 /// public class CRCRepliedQCChallengeEventConsumer( - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _trialUseRepository, IRepository _subjectVisitRepository, IRepository _trialRepository, @@ -224,7 +224,7 @@ public class CRCRepliedQCChallengeEventConsumer( /// QC回复 质控质疑,通知CRC (014,015) /// public class QCRepliedQCChallengeEventConsumer( - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _trialUseRepository, IRepository _subjectVisitRepository, IRepository _trialRepository, @@ -333,7 +333,7 @@ public class QCRepliedQCChallengeEventConsumer( /// CRC 回复一致性核查质疑 通知PM (019,020) /// public class CRCRepliedCheckChallengeEventConsumer( - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _trialUseRepository, IRepository _subjectVisitRepository, IRepository _trialRepository, @@ -425,7 +425,7 @@ public class CRCRepliedCheckChallengeEventConsumer( /// public class PMRepliedCheckChallengeEventConsumer( - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _trialUseRepository, IRepository _subjectVisitRepository, IRepository _trialRepository, @@ -524,7 +524,7 @@ public class PMRepliedCheckChallengeEventConsumer( /// 通知PM 进行一致性核查 (018,030) /// public class CheckStateChangedToAuditEventConsumer( - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _trialUseRepository, IRepository _subjectVisitRepository, IRepository _trialRepository, @@ -612,7 +612,7 @@ public class CheckStateChangedToAuditEventConsumer( /// QC 领取了质控任务 (007,008) /// public class QCClaimTaskEventConsumer( - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _trialUseRepository, IRepository _subjectVisitRepository, IRepository _trialRepository, diff --git a/IRaCIS.Core.Application/MassTransit/Consumer/TestConsumer.cs b/IRaCIS.Core.Application/MassTransit/Consumer/TestConsumer.cs index d87654fbd..8dcc1c22a 100644 --- a/IRaCIS.Core.Application/MassTransit/Consumer/TestConsumer.cs +++ b/IRaCIS.Core.Application/MassTransit/Consumer/TestConsumer.cs @@ -30,13 +30,13 @@ public class MasstransiTestCommand /// publish 请求流不会先到消费者,发布后,直接执行后续代码 /// /// -/// -public class MasstransitTestConsumer(IRepository _userRepository) : IConsumer +/// +public class MasstransitTestConsumer(IRepository _userRoleRepository) : IConsumer { public async Task Consume(ConsumeContext context) { - Console.WriteLine(_userRepository._dbContext.GetHashCode()); + Console.WriteLine(_userRoleRepository._dbContext.GetHashCode()); Console.WriteLine("Now is " + DateTime.Now.ToString()); Console.WriteLine($"MassTransit.Consumer :{context.Message.value}"); diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs index 4bc3a1580..30c514c33 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs @@ -18,7 +18,7 @@ namespace IRaCIS.Core.Application.Service /// [ApiExplorerSettings(GroupName = "Trial")] public class TaskAllocationRuleService(IRepository _taskAllocationRuleRepository, - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _enrollRepository, IRepository _readingQuestionCriterionTrialRepository, IRepository _subjectCanceDoctorRepository, @@ -124,7 +124,7 @@ namespace IRaCIS.Core.Application.Service public async Task> GetDoctorUserSelectList(Guid trialId, [FromServices] IRepository _enrollRepository) { var query = from enroll in _enrollRepository.Where(t => t.TrialId == trialId && t.EnrollStatus >= EnrollStatus.ConfirmIntoGroup) - join user in _userRepository.AsQueryable() on enroll.DoctorId equals user.DoctorId + join user in _userRoleRepository.AsQueryable() on enroll.DoctorId equals user.DoctorId select new TrialDoctorUserSelectView() { TrialId = enroll.TrialId, @@ -151,7 +151,7 @@ namespace IRaCIS.Core.Application.Service .WhereIf(selectQuery.TrialReadingCriterionId != null && selectQuery.ReadingCategory == null, t => t.Enroll.EnrollReadingCategoryList.Any(t => t.TrialReadingCriterionId == selectQuery.TrialReadingCriterionId)) .WhereIf(selectQuery.TrialReadingCriterionId != null && selectQuery.ReadingCategory != null, t => t.Enroll.EnrollReadingCategoryList.Any(t => t.TrialReadingCriterionId == selectQuery.TrialReadingCriterionId && t.ReadingCategory == selectQuery.ReadingCategory)) - join user in _userRepository.AsQueryable() on allocationRule.DoctorUserId equals user.Id + join user in _userRoleRepository.AsQueryable() on allocationRule.DoctorUserId equals user.Id select new TrialDoctorUserSelectView() { TrialId = allocationRule.TrialId, diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs index c45ec466e..441bce672 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs @@ -30,7 +30,7 @@ namespace IRaCIS.Core.Application.Service IRepository _trialRepository, IRepository _trialSiteRepository, IRepository _enrollRepository, - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _trialVirtualSiteCodeUpdateRepository, IVisitTaskHelpeService _visitTaskCommonService, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITaskConsistentRuleService { @@ -369,7 +369,7 @@ namespace IRaCIS.Core.Application.Service var doctorUserIdQuery = from enroll in _enrollRepository.Where(t => t.TrialId == trialId).Where(t => t.EnrollReadingCategoryList.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId).Any(c => c.ReadingCategory == ReadingCategory.Global || c.ReadingCategory == ReadingCategory.Visit)) .Where(t => t.EnrollReadingCriteriaList.Any(t => t.TrialReadingCriterionId == trialReadingCriterionId && t.IsJoinAnalysis == true)) - join user in _userRepository.Where() on enroll.DoctorId equals user.DoctorId + join user in _userRoleRepository.Where() on enroll.DoctorId equals user.DoctorId select user.Id; var configDoctorUserIdList = await doctorUserIdQuery.ToListAsync(); @@ -784,7 +784,7 @@ namespace IRaCIS.Core.Application.Service var taskConsistentRuleQueryable = from enroll in _enrollRepository.Where(t => t.TrialId == trialId && t.EnrollStatus == EnrollStatus.ConfirmIntoGroup && t.EnrollReadingCriteriaList.Any(c => c.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && c.IsJoinAnalysis)) - join user in _userRepository.Where() on enroll.DoctorUserId equals user.Id + join user in _userRoleRepository.Where() on enroll.DoctorUserId equals user.Id join taskConsistentRule in _taskConsistentRuleRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.IsSelfAnalysis) on enroll.TrialId equals taskConsistentRule.TrialId select new TaskConsistentRuleView() { diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs index 52f75d25a..2761cd7e1 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs @@ -196,7 +196,7 @@ namespace IRaCIS.Core.Application.Service public async Task>> GetMIMMedicalReviewTaskList(TaskMedicalReviewQuery inQuery) { - var taskMedicalReviewQueryable = _taskMedicalReviewRepository.Where(t => t.VisitTask.TrialId == inQuery.TrialId && t.MedicalManagerUserId == _userInfo.Id && t.VisitTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) + var taskMedicalReviewQueryable = _taskMedicalReviewRepository.Where(t => t.VisitTask.TrialId == inQuery.TrialId && t.MedicalManagerUserId == _userInfo.UserRoleId && t.VisitTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) .WhereIf(inQuery.IsGetNextMedicalReviewTask, x => ( diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index ad3ff96bf..18569202f 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -843,7 +843,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, var visitTaskQueryable = _visitTaskReReadingRepository .Where(t => t.RequestReReadingType == RequestReReadingType.DocotorApply) - .Where(t => t.OriginalReReadingTask.DoctorUserId == _userInfo.Id) + .Where(t => t.OriginalReReadingTask.DoctorUserId == _userInfo.UserRoleId) .Where(t => t.OriginalReReadingTask.TrialId == inQuery.TrialId) .WhereIf(inQuery.RequestReReadingResultEnum != null, t => t.RequestReReadingResultEnum == inQuery.RequestReReadingResultEnum) .WhereIf(inQuery.RootReReadingTaskId != null, t => t.RootReReadingTaskId == inQuery.RootReReadingTaskId || t.OriginalReReadingTaskId == inQuery.RootReReadingTaskId) @@ -961,7 +961,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, //随机阅片 else { - var taskQuery = _visitTaskRepository.Where(x => x.TrialId == inQuery.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect && x.TrialReadingCriterionId == trialReadingCriterionId) + var taskQuery = _visitTaskRepository.Where(x => x.TrialId == inQuery.TrialId && x.DoctorUserId == _userInfo.UserRoleId && x.TaskState == TaskState.Effect && x.TrialReadingCriterionId == trialReadingCriterionId) .Where(x => !x.Subject.IsDeleted).Where(x => (x.IsNeedClinicalDataSign && x.IsClinicalDataSign) || !x.IsNeedClinicalDataSign); iRUnReadOut = new IRUnReadOutDto() @@ -1005,7 +1005,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, if (critrion.IsReadingTaskViewInOrder == ReadingOrder.InOrder) { - var visitQuery = _visitTaskRepository.Where(x => x.TrialId == inQuery.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect) + var visitQuery = _visitTaskRepository.Where(x => x.TrialId == inQuery.TrialId && x.DoctorUserId == _userInfo.UserRoleId && x.TaskState == TaskState.Effect) .WhereIf(inQuery.SubjectId != null, x => x.SubjectId == inQuery.SubjectId) //前序 不存在 未生成任务的访视 @@ -1126,19 +1126,19 @@ public class VisitTaskService(IRepository _visitTaskRepository, if (subjectId != null) { //找到 非一致性分析,未签名,状态正常的 并且任务名称是TimePoint的 任务 - var needDealTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id + var needDealTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskBlindName == "Timepoint" && t.ReadingCategory == ReadingCategory.Visit && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze), true).ToListAsync(); if (needDealTaskList.Count > 0) { //已完成的访视任务数量(包含重阅的) - var haveFinishedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id + var haveFinishedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit); //已经处理过的任务名称的数量 - var haveDealedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id + var haveDealedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit && t.TaskBlindName != "Timepoint"); @@ -1158,7 +1158,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, } } - var visitQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect) + var visitQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.UserRoleId && x.TaskState == TaskState.Effect) .WhereIf(inQuery.SubjectId != null, x => x.SubjectId == inQuery.SubjectId) .WhereIf(!string.IsNullOrEmpty(subjectCode), t => (t.Subject.Code.Contains(subjectCode!) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(subjectCode!) && t.IsAnalysisCreate)); @@ -1221,7 +1221,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId) - .Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState == ReadingTaskState.HaveSigned)//该医生 已经签名的数据 + .Where(t => t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState == ReadingTaskState.HaveSigned)//该医生 已经签名的数据 .WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId) @@ -1253,10 +1253,10 @@ public class VisitTaskService(IRepository _visitTaskRepository, [UnitOfWork] public async Task AIRReReading(AIRReReadingCommand command) { - var baseLineTaskList = await _visitTaskRepository.Where(t => t.TrialId == command.TrialId && t.TrialReadingCriterionId == command.TrialReadingCriterionId && t.DoctorUserId == _userInfo.Id + var baseLineTaskList = await _visitTaskRepository.Where(t => t.TrialId == command.TrialId && t.TrialReadingCriterionId == command.TrialReadingCriterionId && t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.SourceSubjectVisit.IsBaseLine == true).ToListAsync(); - var judegeList = await _visitTaskRepository.Where(t => t.TrialId == command.TrialId && t.TrialReadingCriterionId == command.TrialReadingCriterionId && t.DoctorUserId == _userInfo.Id + var judegeList = await _visitTaskRepository.Where(t => t.TrialId == command.TrialId && t.TrialReadingCriterionId == command.TrialReadingCriterionId && t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Judge && t.ReadingTaskState == ReadingTaskState.HaveSigned).ToListAsync(); foreach (var item in judegeList) @@ -1284,7 +1284,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, - var requestRecordList = await _visitTaskReReadingRepository.Where(t => baseLineTaskIdList.Contains(t.OriginalReReadingTaskId) && t.RequestReReadingUserId == _userInfo.Id && t.RequestReReadingReason == "AIR自动重阅基线").ToListAsync(); + var requestRecordList = await _visitTaskReReadingRepository.Where(t => baseLineTaskIdList.Contains(t.OriginalReReadingTaskId) && t.RequestReReadingUserId == _userInfo.UserRoleId && t.RequestReReadingReason == "AIR自动重阅基线").ToListAsync(); if (requestRecordList.Count != baseLineTaskIdList.Count) { @@ -1496,7 +1496,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, RootReReadingTaskId = rootReReadingTaskId == Guid.Empty ? task.Id : rootReReadingTaskId, OriginalReReadingTaskId = task.Id, RequestReReadingTime = DateTime.Now, - RequestReReadingUserId = _userInfo.Id, + RequestReReadingUserId = _userInfo.UserRoleId, IsCopyOrigenalForms = applyReReadingCommand.IsCopyOrigenalForms, IsCopyFollowForms = applyReReadingCommand.IsCopyFollowForms, RequestReReadingReason = applyReReadingCommand.RequestReReadingReason, @@ -1518,7 +1518,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, if (!isSPMjoin && IsPMOrAPm()) { - var requestRecordList = await _visitTaskReReadingRepository.Where(t => applyReReadingCommand.TaskIdList.Contains(t.OriginalReReadingTaskId) && t.RequestReReadingUserId == _userInfo.Id).ToListAsync(); + var requestRecordList = await _visitTaskReReadingRepository.Where(t => applyReReadingCommand.TaskIdList.Contains(t.OriginalReReadingTaskId) && t.RequestReReadingUserId == _userInfo.UserRoleId).ToListAsync(); await ConfirmReReading(new ConfirmReReadingCommand() { @@ -1623,7 +1623,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, if ((origenalTask.TaskState != TaskState.Effect && origenalTask.TaskState != TaskState.Freeze)) { - await _visitTaskReReadingRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new VisitTaskReReading() { RequestReReadingConfirmUserId = _userInfo.Id, RequestReReadingResultEnum = RequestReReadingResult.Invalid }); + await _visitTaskReReadingRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new VisitTaskReReading() { RequestReReadingConfirmUserId = _userInfo.UserRoleId, RequestReReadingResultEnum = RequestReReadingResult.Invalid }); //---当前申请重阅任务的状态,已被其他任务重阅已影响,不允许对该状态下的任务进行重阅同意与否操作 return ResponseOutput.Ok(string.Empty, msg: _localizer["VisitTask_ReapplyStatusConflict"]); @@ -1634,7 +1634,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, //更新申请信息 var visitTaskReReadingAppply = await _visitTaskReReadingRepository.FirstOrDefaultAsync(t => t.Id == item.Id); - visitTaskReReadingAppply.RequestReReadingConfirmUserId = _userInfo.Id; + visitTaskReReadingAppply.RequestReReadingConfirmUserId = _userInfo.UserRoleId; visitTaskReReadingAppply.RequestReReadingResultEnum = agreeReReadingCommand.RequestReReadingResultEnum; visitTaskReReadingAppply.RequestReReadingRejectReason = agreeReReadingCommand.RequestReReadingRejectReason; @@ -2616,7 +2616,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, { // IR 申请 PM 同意 - if (((IsPMOrAPm() && applyId != null && await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && t.CreateUser.UserTypeEnum == UserTypeEnum.IndependentReviewer)) + if (((IsPMOrAPm() && applyId != null && await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && t.CreateUserRole.UserTypeEnum == UserTypeEnum.IndependentReviewer)) || (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer && applyId == null))) { @@ -2659,7 +2659,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, //IR 申请 PM 同意 仅仅影响自己 - if ((IsPMOrAPm() && applyId != null && await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && t.CreateUser.UserTypeEnum == UserTypeEnum.IndependentReviewer)) + if ((IsPMOrAPm() && applyId != null && await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && t.CreateUserRole.UserTypeEnum == UserTypeEnum.IndependentReviewer)) || (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer && applyId == null)) { @@ -2778,7 +2778,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, //PM 影响所有阅片人 仅仅针对访视 SPM CPM 调用 else if (((IsSpmOrCPM()) && applyId != null && - await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && (t.CreateUser.UserTypeEnum == UserTypeEnum.ProjectManager || t.CreateUser.UserTypeEnum == UserTypeEnum.APM)) && filterObj.IsAnalysisCreate == false && filterObj.ReadingCategory == ReadingCategory.Visit) + await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && (t.CreateUserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.CreateUserRole.UserTypeEnum == UserTypeEnum.APM)) && filterObj.IsAnalysisCreate == false && filterObj.ReadingCategory == ReadingCategory.Visit) || (IsPMOrAPm() && applyId == null)) { @@ -2876,7 +2876,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, var list = await _visitTaskRepository.Where(filterExpression) //IR 申请的时候,仅仅看到影响自己的 - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer, t => t.DoctorUserId == _userInfo.Id) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer, t => t.DoctorUserId == _userInfo.UserRoleId) .OrderBy(t => t.VisitTaskNum).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); #region 影响后的操作 diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs index 4beb54f0d..5cd03a8ba 100644 --- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs @@ -205,7 +205,7 @@ namespace IRaCIS.Core.Application.Service CreateMap(); - CreateMap() + CreateMap() .ForMember(o => o.DoctorUserId, t => t.MapFrom(u => u.Id)) .ForMember(o => o.FullName, t => t.MapFrom(u => u.FullName)); @@ -250,7 +250,7 @@ namespace IRaCIS.Core.Application.Service - CreateMap() + CreateMap() .ForMember(o => o.UserId, t => t.MapFrom(u => u.Id)) .ForMember(o => o.UserCode, t => t.MapFrom(u => u.UserCode)) diff --git a/IRaCIS.Core.Application/Service/Common/CommonDocumentService.cs b/IRaCIS.Core.Application/Service/Common/CommonDocumentService.cs index 084f205ad..5ea3f87dc 100644 --- a/IRaCIS.Core.Application/Service/Common/CommonDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Common/CommonDocumentService.cs @@ -31,7 +31,7 @@ namespace IRaCIS.Core.Application.Service .WhereIf(queryCommonDocument.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == queryCommonDocument.BusinessScenarioEnum) .WhereIf(!string.IsNullOrEmpty(queryCommonDocument.Code), t => t.Code.Contains(queryCommonDocument.Code)) .WhereIf(!string.IsNullOrEmpty(queryCommonDocument.Name), t => t.Name.Contains(queryCommonDocument.Name) || t.NameCN.Contains(queryCommonDocument.Name)) - .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id }); + .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.UserRoleId }); return await commonDocumentQueryable.ToPagedListAsync(queryCommonDocument); } diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index f8ebae89c..f78448112 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -122,7 +122,7 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteCode), t => t.TrialSite.TrialSiteCode.Contains(param.TrialSiteCode)) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, - t => t.UserId == _userInfo.Id) + t => t.UserId == _userInfo.UserRoleId) .WhereIf(!string.IsNullOrWhiteSpace(param.UserKeyInfo), t => (t.User.FullName).Contains(param.UserKeyInfo) || t.User.UserName.Contains(param.UserKeyInfo) || t.User.EMail.Contains(param.UserKeyInfo)) @@ -223,7 +223,7 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(!string.IsNullOrEmpty(inQuery.Code), o => o.TrialCode.Contains(inQuery.Code)) .WhereIf(!string.IsNullOrEmpty(inQuery.ResearchProgramNo), o => o.ResearchProgramNo.Contains(inQuery.ResearchProgramNo)) .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.Id && t.IsDeleted == false) && t.IsDeleted == false) + .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))) .Select(t => new TrialToBeDoneDto() @@ -250,49 +250,49 @@ namespace IRaCIS.Core.Application.Service.Common SPM_ReviewerSelectApprovalCount = isSPMOrCPM ? t.EnrollList.Where(u => u.EnrollStatus == EnrollStatus.HasCommittedToCRO).Count() : 0, - MIM_UrgentCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + MIM_UrgentCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .Where(u => u.VisitTask.IsUrgent && u.AuditState != MedicalReviewAuditState.HaveSigned).Count() : 0, - MIM_PendingResponseCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + MIM_PendingResponseCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IndependentReviewer && u.AuditState == MedicalReviewAuditState.Auditing).Count() : 0, - MIM_PendingReviewCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + MIM_PendingReviewCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .Where(u => u.AuditState != MedicalReviewAuditState.HaveSigned && u.LatestReplyUser.UserTypeEnum != UserTypeEnum.IndependentReviewer).Count() : 0, - CRC_UrgentCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id) && t.IsUrgent).Count() : 0, + CRC_UrgentCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId) && t.IsUrgent).Count() : 0, - CRC_CheckQuestionCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + CRC_CheckQuestionCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply).Count() : 0, - CRC_QCQuestionCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)).SelectMany(c => c.QCChallengeList) + CRC_QCQuestionCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)).SelectMany(c => c.QCChallengeList) .Where(u => u.IsClosed == false && (u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC || u.LatestReplyUserId == null)).Count() : 0, //待审核 审核中 加急的数量 - IQC_UrgentCount = isIQC ? t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id && t.QCProcessEnum != TrialQCProcess.NotAudit && t.IsUrgent).Count() : 0, + IQC_UrgentCount = isIQC ? t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.UserRoleId && t.QCProcessEnum != TrialQCProcess.NotAudit && t.IsUrgent).Count() : 0, //审核未完成 - IQC_AuditToBeDealedCount = isIQC ? t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id && t.QCProcessEnum != TrialQCProcess.NotAudit).Count() : 0, + IQC_AuditToBeDealedCount = isIQC ? t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.UserRoleId && t.QCProcessEnum != TrialQCProcess.NotAudit).Count() : 0, //质疑待处理 IQC_QuestionToBeDealedCount = isIQC ? t.SubjectVisitList.SelectMany(c => c.QCChallengeList) - .Where(u => u.CreateUserId == _userInfo.Id && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count() : 0, + .Where(u => u.CreateUserId == _userInfo.UserRoleId && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count() : 0, //待领取 IQC_ToBeClaimedCount = isIQC ? t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted && t.AuditState != AuditStateEnum.QCPassed) - .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count() : 0, + .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.UserRoleId && u.ReviewAuditUserId == null))).Count() : 0, 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_TotalReadCount = isIR ? t.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count() : 0, + IR_TotalReadCount = isIR ? t.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count() : 0, IR_UnReadCount = isIR ? t.VisitTaskList - .Where(c => c.DoctorUserId == _userInfo.Id && c.ReadingTaskState != ReadingTaskState.HaveSigned && c.TaskState == TaskState.Effect && c.TrialReadingCriterion.IsSigned) + .Where(c => c.DoctorUserId == _userInfo.UserRoleId && c.ReadingTaskState != ReadingTaskState.HaveSigned && c.TaskState == TaskState.Effect && c.TrialReadingCriterion.IsSigned) // 前序 不存在 未一致性核查未通过的 .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) //前序 不存在 未生成任务的访视 @@ -479,7 +479,7 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(inQuery.SubmitState != null, t => t.SubmitState == inQuery.SubmitState) .WhereIf(inQuery.ChallengeState != null, t => t.ChallengeState == inQuery.ChallengeState) .WhereIf(inQuery.IsUrgent != null, t => t.IsUrgent == inQuery.IsUrgent) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .ProjectTo(_mapper.ConfigurationProvider); var list = query.OrderBy(t => t.TrialSiteCode).ThenBy(t => t.SubjectCode).ThenBy(t => t.BlindName).ToList(); @@ -587,7 +587,7 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(inQuery.IsOverTime != null && inQuery.IsOverTime == true, t => t.IsClosed ? t.ClosedTime > t.DeadlineTime : DateTime.Now > t.DeadlineTime) .WhereIf(inQuery.IsOverTime != null && inQuery.IsOverTime == false, t => t.IsClosed ? t.ClosedTime < t.DeadlineTime : DateTime.Now < t.DeadlineTime) .WhereIf(inQuery.IsUrgent != null, t => t.SubjectVisit.IsUrgent == inQuery.IsUrgent) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.SubjectVisit.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.SubjectVisit.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .ProjectTo(_mapper.ConfigurationProvider); @@ -628,7 +628,7 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId) // CRC 只负责他管理site的受试者 - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .ProjectTo(_mapper.ConfigurationProvider) .WhereIf(inQuery.IsMissingImages == true, t => t.MissingSubmmitCount > 0) .WhereIf(inQuery.IsMissingImages == false, t => t.MissingSubmmitCount == 0) @@ -810,7 +810,7 @@ namespace IRaCIS.Core.Application.Service.Common var svExpression = QCCommon.GetStudyMonitorSubjectVisitFilter(inQuery.VisitPlanArray); var StudyMonitorQuery = _studyMonitorRepository.Where(t => t.TrialId == inQuery.TrialId, ignoreQueryFilters: true) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) //.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo)) .WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo)) @@ -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.CreateUser.UserName.Contains(inQuery.Uploader)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Uploader), t => t.CreateUserRole.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.CreateUser.UserName, + Uploader = t.CreateUserRole.UserName, IP = t.IP, @@ -925,7 +925,7 @@ namespace IRaCIS.Core.Application.Service.Common var svExpression = QCCommon.GetDicomStudySubjectVisitFilter(studyQuery.VisitPlanArray); var dicomStudyQuery = _dicomStudyRepository.Where(t => t.TrialId == studyQuery.TrialId) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .WhereIf(studyQuery.VisitPlanArray != null && studyQuery.VisitPlanArray?.Length > 0, svExpression) .WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo)) .Where(x => x.SubjectVisit.AuditState == AuditStateEnum.QCPassed) @@ -953,7 +953,7 @@ namespace IRaCIS.Core.Application.Service.Common var nodeDicomStudyQuery = _noneDicomStudyRepository.Where(t => t.TrialId == studyQuery.TrialId) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .WhereIf(studyQuery.VisitPlanArray != null && studyQuery.VisitPlanArray?.Length > 0, svExpression2) .WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo)) .Where(x => x.SubjectVisit.AuditState == AuditStateEnum.QCPassed) @@ -1022,7 +1022,7 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo)) .WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression) //.WhereIf(!string.IsNullOrEmpty(checkQuery.VisitPlanInfo), checkQuery.VisitPlanInfo.Contains('.') ? t => t.InPlan == false : t => t.VisitNum == decimal.Parse(checkQuery.VisitPlanInfo)) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))//CRC 过滤负责的site + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId))//CRC 过滤负责的site .ProjectTo(_mapper.ConfigurationProvider); var list = query.OrderBy(t => t.TrialSiteCode).ThenBy(t => t.SubjectCode).ThenBy(t => t.VisitNum).ToList(); @@ -1233,9 +1233,9 @@ 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.CreateUser.UserName.Contains(inQuery.Name) || t.CreateUser.FullName.Contains(inQuery.Name)) + .WhereIf(inQuery.Name.IsNotNullOrEmpty(), t => t.CreateUserRole.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.CreateUser.UserTypeEnum == inQuery.UserType) + .WhereIf(inQuery.UserType != null, t => t.CreateUserRole.UserTypeEnum == inQuery.UserType) .WhereIf(inQuery.IsSuccess != null, t => t.IsSuccess == inQuery.IsSuccess) .WhereIf(inQuery.DownloadStartTime != null, t => t.DownloadStartTime >= inQuery.DownloadStartTime) .WhereIf(inQuery.DownloadEndTime != null, t => t.DownloadEndTime <= inQuery.DownloadEndTime) diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs index 43f599562..7041e3768 100644 --- a/IRaCIS.Core.Application/Service/Common/MailService.cs +++ b/IRaCIS.Core.Application/Service/Common/MailService.cs @@ -42,7 +42,8 @@ namespace IRaCIS.Core.Application.Service IRepository _systemBasicDatarepository, IRepository _visitTaskRepository, IRepository _trialSiteRepository, - IRepository _userRepository, + IRepository _userRoleRepository, + IRepository _identityUserRepository, IRepository _userFeedBackRepository, ITokenService _tokenService, IRepository _subjectVisitRepository, @@ -169,83 +170,11 @@ namespace IRaCIS.Core.Application.Service await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle); } - //用户重置邮箱 - public async Task SendMailEditEmail(Guid userId, string userName, string emailAddress, int verificationCode) - { - - var messageToSend = new MimeMessage(); - //发件地址 - messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail)); - //收件地址 - messageToSend.To.Add(new MailboxAddress(userName, emailAddress)); - //主题 - //---[来自展影IRC] 关于重置邮箱的提醒 - - var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN; - - Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input => - { - var topicStr = string.Format(input.topicStr, companyName); - - var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr), - - userName, - //---您正在进行邮箱重置操作 - verificationCode - ); - - return (topicStr, htmlBodyStr); - }; - - - await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.UserResetEmail, messageToSend, emailConfigFunc); - - - var sucessHandle = GetEmailSuccessHandle(userId, verificationCode, emailAddress); - - await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle); - - - } - //不登录 通过邮箱重置密码 - public async Task AnolymousSendEmailForResetAccount(string emailAddress, int verificationCode) - { - var messageToSend = new MimeMessage(); - //发件地址 - messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail)); - //收件地址 - messageToSend.To.Add(new MailboxAddress(String.Empty, emailAddress)); - var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN; - - Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input => - { - var topicStr = string.Format(input.topicStr, companyName); - - var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr), - - "Sir/Madam", - //---您正在进行邮箱重置密码操作 - verificationCode - ); - - return (topicStr, htmlBodyStr); - }; - - - await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.UnloginUseEmailResetPassword, messageToSend, emailConfigFunc); - - ////此时不知道用户 - var sucessHandle = GetEmailSuccessHandle(Guid.Empty, verificationCode, emailAddress); - - - await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle); - } - /// /// Reviewer简历录入 发送验证码 /// @@ -333,12 +262,13 @@ namespace IRaCIS.Core.Application.Service } + #region 邮件已修改 //添加用户发送邮件 public async Task AddUserSendEmailAsync(Guid userId, string baseUrl, string routeUrl) { - var sysUserInfo = (await _userRepository.Where(t => t.Id == userId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException(); + var sysUserInfo = (await _identityUserRepository.Where(t => t.Id == userId).Include(t => t.UserRoleList).ThenInclude(c => c.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException(); var messageToSend = new MimeMessage(); @@ -352,9 +282,9 @@ namespace IRaCIS.Core.Application.Service var token = _tokenService.GetToken(new UserTokenInfo() { UserRoleId = sysUserInfo.Id }); - await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new User() { EmailToken = token }); + await _identityUserRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new IdentityUser() { EmailToken = token }); - routeUrl = routeUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&UserType=" + sysUserInfo.UserTypeRole.UserTypeShortName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token; + routeUrl = routeUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token; var domain = baseUrl.Substring(0, baseUrl.IndexOf("/login")); @@ -371,7 +301,7 @@ namespace IRaCIS.Core.Application.Service sysUserInfo.FullName, sysUserInfo.UserName, - sysUserInfo.UserTypeRole.UserTypeShortName, + string.Join(',', sysUserInfo.UserRoleList.Select(t => t.UserTypeRole.UserTypeShortName)), redirectUrl ); @@ -388,7 +318,7 @@ namespace IRaCIS.Core.Application.Service //管理员重置密码发送邮件 public async Task AdminResetPwdSendEmailAsync(Guid userId, string pwdNotMd5 = "123456") { - var sysUserInfo = (await _userRepository.Where(t => t.Id == userId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException(); + var sysUserInfo = (await _identityUserRepository.Where(t => t.Id == userId).Include(t => t.UserRoleList).ThenInclude(c => c.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException(); var messageToSend = new MimeMessage(); //发件地址 @@ -408,7 +338,7 @@ namespace IRaCIS.Core.Application.Service sysUserInfo.FullName, sysUserInfo.UserName, - sysUserInfo.UserTypeRole.UserTypeShortName, + string.Join(',', sysUserInfo.UserRoleList.Select(t => t.UserTypeRole.UserTypeShortName)), pwdNotMd5 ); @@ -421,11 +351,92 @@ namespace IRaCIS.Core.Application.Service await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig); } + //用户重置邮箱 + public async Task SendMailEditEmail(Guid userId, string userName, string emailAddress, int verificationCode) + { + + var messageToSend = new MimeMessage(); + //发件地址 + messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail)); + //收件地址 + messageToSend.To.Add(new MailboxAddress(userName, emailAddress)); + //主题 + //---[来自展影IRC] 关于重置邮箱的提醒 + + var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN; + + Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input => + { + var topicStr = string.Format(input.topicStr, companyName); + + var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr), + + userName, + //---您正在进行邮箱重置操作 + verificationCode + ); + + return (topicStr, htmlBodyStr); + }; + + + await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.UserResetEmail, messageToSend, emailConfigFunc); + + + var sucessHandle = GetEmailSuccessHandle(userId, verificationCode, emailAddress); + + await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle); + + + } + + + //不登录 通过邮箱重置密码 + public async Task AnolymousSendEmailForResetAccount(string emailAddress, int verificationCode) + { + var messageToSend = new MimeMessage(); + //发件地址 + messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail)); + //收件地址 + messageToSend.To.Add(new MailboxAddress(String.Empty, emailAddress)); + + + var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN; + + Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input => + { + var topicStr = string.Format(input.topicStr, companyName); + + var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr), + + "Sir/Madam", + //---您正在进行邮箱重置密码操作 + verificationCode + ); + + return (topicStr, htmlBodyStr); + }; + + + await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.UnloginUseEmailResetPassword, messageToSend, emailConfigFunc); + + ////此时不知道用户 + var sucessHandle = GetEmailSuccessHandle(Guid.Empty, verificationCode, emailAddress); + + + await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle); + } + + #endregion + + + + //Site调研 用户加入项目 public async Task SiteSurveyUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl) { - var sysUserInfo = (await _userRepository.Where(t => t.Id == userId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException(); + var sysUserInfo = (await _userRoleRepository.Where(t => t.Id == userId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException(); var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId); @@ -442,7 +453,7 @@ namespace IRaCIS.Core.Application.Service if (sysUserInfo.IsFirstAdd) { - await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new User() { EmailToken = token }); + await _userRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new UserRole() { EmailToken = token }); } var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&UserType=" + sysUserInfo.UserTypeRole.UserTypeShortName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token; @@ -486,7 +497,7 @@ namespace IRaCIS.Core.Application.Service { var trialInfo = (await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId)).IfNullThrowException(); - var sysUserInfo = (await _userRepository.Where(t => t.Id == userId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException(); + var sysUserInfo = (await _userRoleRepository.Where(t => t.Id == userId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException(); var messageToSend = new MimeMessage(); @@ -502,7 +513,7 @@ namespace IRaCIS.Core.Application.Service var token = _tokenService.GetToken(new UserTokenInfo() { UserRoleId = sysUserInfo.Id }); if (sysUserInfo.IsFirstAdd) { - await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new User() { EmailToken = token }); + await _userRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new UserRole() { EmailToken = token }); } var domain = baseUrl.Substring(0, baseUrl.IndexOf("/login")); @@ -545,7 +556,7 @@ namespace IRaCIS.Core.Application.Service public async Task DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl) { var doctor = await _doctorTypeRepository.FindAsync(doctorId); - User sysUserInfo = new User(); + UserRole sysUserInfo = new UserRole(); var userType = await _userTypeRepository.FirstAsync(t => t.UserTypeEnum == UserTypeEnum.IndependentReviewer); @@ -553,13 +564,13 @@ namespace IRaCIS.Core.Application.Service using (await @lock.AcquireAsync()) { - var isDoctorHaveAccount = await _userRepository.AnyAsync(t => t.DoctorId == doctorId); + var isDoctorHaveAccount = await _userRoleRepository.AnyAsync(t => t.DoctorId == doctorId); if (!isDoctorHaveAccount) { - var saveItem = new User() { FirstName = doctor.FirstName, LastName = doctor.LastName, EMail = doctor.EMail }; + var saveItem = new UserRole() { FirstName = doctor.FirstName, LastName = doctor.LastName, EMail = doctor.EMail }; var trialType = await _trialRepository.Where(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefaultAsync(); @@ -569,9 +580,9 @@ namespace IRaCIS.Core.Application.Service } - saveItem.Code = _userRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; + saveItem.Code = _userRoleRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; - saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(User)); + saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(UserRole)); saveItem.UserName = saveItem.UserCode; @@ -580,19 +591,19 @@ namespace IRaCIS.Core.Application.Service saveItem.DoctorId = doctorId; saveItem.UserTypeId = userType.Id; - var savedUser = await _userRepository.AddAsync(saveItem); + var savedUser = await _userRoleRepository.AddAsync(saveItem); //下面获取Token 需要这部分信息 sysUserInfo = savedUser.Clone(); sysUserInfo.UserTypeRole = userType; - await _userRepository.SaveChangesAsync(); + await _userRoleRepository.SaveChangesAsync(); } else { - sysUserInfo = (await _userRepository.Where(t => t.DoctorId == doctorId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException(); + sysUserInfo = (await _userRoleRepository.Where(t => t.DoctorId == doctorId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException(); } } @@ -611,7 +622,7 @@ namespace IRaCIS.Core.Application.Service if (sysUserInfo.IsFirstAdd) { - await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new User() { EmailToken = token }); + await _userRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new UserRole() { EmailToken = token }); } var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&UserType=" + userType.UserTypeShortName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token; @@ -658,7 +669,7 @@ namespace IRaCIS.Core.Application.Service public async Task UserFeedBackMail(Guid feedBackId) { - var feedBack = await _userFeedBackRepository.Where(t => t.Id == feedBackId).Include(t => t.CreateUser).ThenInclude(t => t.UserTypeRole).FirstNotNullAsync(); + var feedBack = await _userFeedBackRepository.Where(t => t.Id == feedBackId).Include(t => t.CreateUserRole).ThenInclude(t => t.UserTypeRole).FirstNotNullAsync(); var messageToSend = new MimeMessage(); //发件地址 @@ -674,7 +685,7 @@ namespace IRaCIS.Core.Application.Service var userTypeEnumList = emailConfigInfo.EmailNoticeUserTypeList.Where(t => t.EmailUserType == EmailUserType.To).Select(t => t.UserType).ToList(); - var emailList = await _userRepository.Where(t => userTypeEnumList.Contains(t.UserTypeEnum) && + var emailList = await _userRoleRepository.Where(t => userTypeEnumList.Contains(t.UserTypeEnum) && (isHaveTrialId ? t.UserTrials.Any(t => t.TrialId == feedBack.TrialId) : true)).Select(t => new { t.EMail, t.UserTypeEnum, t.FullName }).ToListAsync(); @@ -703,8 +714,8 @@ namespace IRaCIS.Core.Application.Service info.TrialCode, info.SubejctCode, info.VisitName, - feedBack.CreateUser.UserTypeRole.UserTypeShortName, - feedBack.CreateUser.FullName, + feedBack.CreateUserRole.UserTypeRole.UserTypeShortName, + feedBack.CreateUserRole.FullName, emailType, feedBack.QuestionDescription, _systemEmailConfig.SiteUrl @@ -733,8 +744,8 @@ namespace IRaCIS.Core.Application.Service info.TrialCode, info.SubejctCode, info.VisitName, - feedBack.CreateUser.UserTypeRole.UserTypeShortName, - feedBack.CreateUser.FullName, + feedBack.CreateUserRole.UserTypeRole.UserTypeShortName, + feedBack.CreateUserRole.FullName, emailType, feedBack.QuestionDescription, _systemEmailConfig.SiteUrl @@ -762,8 +773,8 @@ namespace IRaCIS.Core.Application.Service var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr), userNames, info.TrialCode, - feedBack.CreateUser.UserTypeRole.UserTypeShortName, - feedBack.CreateUser.FullName, + feedBack.CreateUserRole.UserTypeRole.UserTypeShortName, + feedBack.CreateUserRole.FullName, emailType, feedBack.QuestionDescription, _systemEmailConfig.SiteUrl @@ -787,8 +798,8 @@ namespace IRaCIS.Core.Application.Service var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr), userNames, - feedBack.CreateUser.UserTypeRole.UserTypeShortName, - feedBack.CreateUser.FullName, + feedBack.CreateUserRole.UserTypeRole.UserTypeShortName, + feedBack.CreateUserRole.FullName, feedBack.QuestionDescription, _systemEmailConfig.SiteUrl ); diff --git a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs index fca2fa4da..df1c0177c 100644 --- a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs @@ -98,9 +98,9 @@ namespace IRaCIS.Core.Application.Service CreateMap() - .ForMember(d => d.UserFullName, u => u.MapFrom(s => s.CreateUser.FullName)) - .ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.CreateUser.UserTypeEnum)) - .ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUser.UserName)) + .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.TrialSiteCode, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteCode)); diff --git a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs index d677259ea..dfdbd58fd 100644 --- a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs @@ -721,7 +721,7 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task UpdateAuditResume(ResumeConfirmCommand auditResumeParam) { - var userId = _userInfo.Id; + var userId = _userInfo.UserRoleId; //判断 合作协议、正式简历 是否有。如果没有,显示提示信息,并且不能保存 var attachmentList = await _attachmentRepository.Where(u => u.DoctorId == auditResumeParam.Id) .Select(u => u.Type).ToListAsync(); diff --git a/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs b/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs index 4dda27de3..cc7e997f9 100644 --- a/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs @@ -99,7 +99,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() ; - CreateMap(); + CreateMap(); CreateMap() .ForMember(x=>x.VisitReadingCount, u => u.MapFrom(t => (t.ExperienceDataType==ExperienceDataType.TrialAuto||t.ExperienceDataType==ExperienceDataType.SystemAuto)? @@ -178,7 +178,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(d => d.IntoGroupState, u => u.MapFrom(s => s.EnrollStatus)) .ForMember(d => d.OptTime, u => u.MapFrom(s => s.CreateTime)) - .ForMember(d => d.OptUserName, u => u.MapFrom(s => s.CreateUser.UserName)); + .ForMember(d => d.OptUserName, u => u.MapFrom(s => s.CreateUserRole.UserName)); CreateMap().IncludeMembers(t => t.Doctor, t => t.Doctor.Hospital) .ForMember(o => o.DictionaryList, t => t.MapFrom(u => u.Doctor.DoctorDicRelationList.Where(t => t.KeyName == StaticData.ReadingType || t.KeyName == StaticData.Subspeciality).Select(t => t.Dictionary).OrderBy(t => t.ShowOrder))) diff --git a/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs b/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs index 970ce6daa..1034f965e 100644 --- a/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs @@ -6,7 +6,7 @@ using IRaCIS.Core.Application.Contracts; using Microsoft.AspNetCore.Mvc; -using User = IRaCIS.Core.Domain.Models.User; +using UserRole = IRaCIS.Core.Domain.Models.UserRole; namespace IRaCIS.Core.Application.Services { @@ -15,7 +15,7 @@ namespace IRaCIS.Core.Application.Services /// [ApiExplorerSettings(GroupName = "Trial")] public class SystemDocumentService(IRepository _systemDocumentRepository, - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _systemDocConfirmedUserRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ISystemDocumentService { @@ -35,7 +35,7 @@ namespace IRaCIS.Core.Application.Services .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name)) .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId) .WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted) - .ProjectTo(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us, userId = _userInfo.Id }); + .ProjectTo(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us, userId = _userInfo.UserRoleId }); return await systemDocumentQueryable.ToPagedListAsync(inQuery); } @@ -151,10 +151,10 @@ namespace IRaCIS.Core.Application.Services //外部人员 只签署 文档类型枚举值有值的 .WhereIf(isInternal == false, t => t.DocUserSignType == DocUserSignType.InnerAndOuter) .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId) - join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = _userInfo.Id, SystemDocumentId = sysDoc.Id } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc + join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = _userInfo.UserRoleId, SystemDocumentId = sysDoc.Id } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc from confirm in cc.DefaultIfEmpty() - join user in _userRepository.Where() on _userInfo.Id equals user.Id + join user in _userRoleRepository.Where() on _userInfo.UserRoleId equals user.Id select new UnionDocumentWithConfirmInfoView() { diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs index a95ee52e8..be2a21e30 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs @@ -57,7 +57,7 @@ namespace IRaCIS.Core.Application.Services .WhereIf(inQuery.TrialId != null, t => t.TrialId == inQuery.TrialId) .Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - join trialUser in _trialUserRepository.Where(t => t.UserId == _userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId + join trialUser in _trialUserRepository.Where(t => t.UserId == _userInfo.UserRoleId) on trialDoc.TrialId equals trialUser.TrialId join confirm in _trialDocConfirmedUserRepository.Where() on new { trialUser.UserId, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc @@ -221,9 +221,9 @@ namespace IRaCIS.Core.Application.Services //系统文档查询 var systemDocumentQueryable = from needConfirmedUserType in _systemDocNeedConfirmedUserTypeRepository.Where(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId, ignoreQueryFilters: true) .WhereIf(trialInfo.TrialFinishedTime != null, u => u.SystemDocument.CreateTime < trialInfo.TrialFinishedTime) - .WhereIf(!_userInfo.IsAdmin, t => t.SystemDocument.IsDeleted == false || (t.SystemDocument.IsDeleted == true && t.SystemDocument.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id))) + .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.Id) + join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId && t.UserId == _userInfo.UserRoleId) on needConfirmedUserType.NeedConfirmUserTypeId equals trialUser.User.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() @@ -255,9 +255,9 @@ namespace IRaCIS.Core.Application.Services //项目文档查询 var trialDocQueryable = from trialDoc in _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == inQuery.TrialId) .WhereIf(!_userInfo.IsAdmin, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - .WhereIf(!_userInfo.IsAdmin, t => t.IsDeleted == false || (t.IsDeleted == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id))) + .WhereIf(!_userInfo.IsAdmin, t => t.IsDeleted == false || (t.IsDeleted == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId))) - join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId && t.UserId == _userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId + join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId && t.UserId == _userInfo.UserRoleId) on trialDoc.TrialId equals trialUser.TrialId join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on new { trialUser.UserId, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc from confirm in cc.DefaultIfEmpty() @@ -321,13 +321,13 @@ namespace IRaCIS.Core.Application.Services var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == inQuery.TrialId && t.Trial.TrialStatusStr != StaticData.TrialState.TrialStopped) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId)) .CountAsync(); var needSignSystemDocCount = await _systemDocumentRepository - .Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId)) + .Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId)) .CountAsync(); var trialTaskConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefault(); @@ -470,13 +470,13 @@ namespace IRaCIS.Core.Application.Services var result = await unionQuery.ToPagedListAsync(inQuery); var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId)) .CountAsync(); var needSignSystemDocCount = await _systemDocumentRepository - .Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId)) + .Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId)) .CountAsync(); @@ -614,9 +614,9 @@ namespace IRaCIS.Core.Application.Services var success = false; if (isSystemDoc) { - if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.Id)) + if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.UserRoleId)) { - await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now }); + await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.UserRoleId, SignFirstViewTime = DateTime.Now }); } @@ -624,10 +624,10 @@ namespace IRaCIS.Core.Application.Services else { - if (!await _trialDocUserTypeConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.Id)) + if (!await _trialDocUserTypeConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.UserRoleId)) { - await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now }); + await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.UserRoleId, SignFirstViewTime = DateTime.Now }); } @@ -642,9 +642,9 @@ namespace IRaCIS.Core.Application.Services [HttpPut("{documentId:guid}")] public async Task SetSystemDocFirstViewTime(Guid documentId) { - if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.Id)) + if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.UserRoleId)) { - await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now }); + await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.UserRoleId, SignFirstViewTime = DateTime.Now }); } @@ -656,10 +656,10 @@ namespace IRaCIS.Core.Application.Services [HttpPut("{trialId:guid}/{documentId:guid}")] public async Task SetTrialDocFirstViewTime(Guid documentId) { - if (!await _trialDocUserTypeConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.Id)) + if (!await _trialDocUserTypeConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.UserRoleId)) { - await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now }); + await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.UserRoleId, SignFirstViewTime = DateTime.Now }); } var success = await _trialDocConfirmedUserRepository.SaveChangesAsync(); @@ -678,7 +678,7 @@ namespace IRaCIS.Core.Application.Services if (userConfirmCommand.isSystemDoc) { - var sysDocConfirm = await _systemDocConfirmedUserRepository.FirstOrDefaultAsync(t => t.SystemDocumentId == userConfirmCommand.DocumentId && t.ConfirmUserId == _userInfo.Id, true); + var sysDocConfirm = await _systemDocConfirmedUserRepository.FirstOrDefaultAsync(t => t.SystemDocumentId == userConfirmCommand.DocumentId && t.ConfirmUserId == _userInfo.UserRoleId, true); if (sysDocConfirm.ConfirmTime != null) { @@ -705,7 +705,7 @@ namespace IRaCIS.Core.Application.Services else { - var trialDocConfirm = await _trialDocUserTypeConfirmedUserRepository.FirstOrDefaultAsync(t => t.TrialDocumentId == userConfirmCommand.DocumentId && t.ConfirmUserId == _userInfo.Id, true); + var trialDocConfirm = await _trialDocUserTypeConfirmedUserRepository.FirstOrDefaultAsync(t => t.TrialDocumentId == userConfirmCommand.DocumentId && t.ConfirmUserId == _userInfo.UserRoleId, true); if (trialDocConfirm.ConfirmTime != null) { diff --git a/IRaCIS.Core.Application/Service/Financial/TrialPaymentPriceService.cs b/IRaCIS.Core.Application/Service/Financial/TrialPaymentPriceService.cs index ea24386e5..4b10985ac 100644 --- a/IRaCIS.Core.Application/Service/Financial/TrialPaymentPriceService.cs +++ b/IRaCIS.Core.Application/Service/Financial/TrialPaymentPriceService.cs @@ -66,7 +66,7 @@ namespace IRaCIS.Core.Application.Service SowPath = "", SowName = "", UpdateTime = DateTime.Now, - UpdateUserId = _userInfo.Id + UpdateUserId = _userInfo.UserRoleId }); return ResponseOutput.Result(success); diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index eca846b30..5a6bc7e5a 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -65,19 +65,19 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc (t.TrialReadingCriterion.IsReadingTaskViewInOrder == ReadingOrder.Random && t.TrialReadingCriterion.ImageUploadEnum != ReadingImageUpload.None)))) { //找到 非一致性分析,未签名,状态正常的 并且任务名称是TimePoint的 任务 - var needDealTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id + var needDealTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskBlindName == "Timepoint" && t.ReadingCategory == ReadingCategory.Visit && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze), true).ToListAsync(); if (needDealTaskList.Count > 0) { //已完成的访视任务数量(包含重阅的) - var haveFinishedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id + var haveFinishedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit); //已经处理过的任务名称的数量 - var haveDealedTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id + var haveDealedTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit && t.TaskBlindName != "Timepoint").Select(t => new { t.TaskBlindName, t.SourceSubjectVisitId, t.SouceReadModuleId }).ToListAsync(); @@ -153,7 +153,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var query = _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.SourceSubjectVisitId != null - && t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect) + && t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect) //满足 有序,或者随机只看到当前任务的dicom 非dicom检查 .WhereIf(criterionInfo.IsReadingTaskViewInOrder != ReadingOrder.SubjectRandom && inQuery.VisitTaskId != null, t => t.Id == inQuery.VisitTaskId) .Select(u => new SubjectImageUploadDTO() @@ -402,7 +402,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc else { //在事务未完成前 防止前端重复提交 - await _fusionCache.SetAsync(CacheKeys.TrialTaskStudyUidDBLock(incommand.TrialId, incommand.VisitTaskId, incommand.Study.StudyInstanceUid), _userInfo.Id, TimeSpan.FromMinutes(1)); + await _fusionCache.SetAsync(CacheKeys.TrialTaskStudyUidDBLock(incommand.TrialId, incommand.VisitTaskId, incommand.Study.StudyInstanceUid), _userInfo.UserRoleId, TimeSpan.FromMinutes(1)); } } @@ -653,7 +653,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc { var subjectCode = inQuery.SubjectCode; var subjectId = inQuery.SubjectId; - var doctorUserId = _userInfo.Id; + var doctorUserId = _userInfo.UserRoleId; if (inQuery.VisitTaskId != null) { @@ -839,7 +839,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc public async Task> GetSubjectImageDownloadSelectList(IRReadingDownloadQuery inQuery) { - var doctorUserId = _userInfo.Id; + var doctorUserId = _userInfo.UserRoleId; var isAnalysisCreate = false; //要根据标准阅片顺序,确定是否查询单个任务的,还是查询所有的 @@ -1129,9 +1129,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc 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.CreateUser.UserName.Contains(inQuery.Name) || t.CreateUser.FullName.Contains(inQuery.Name)) + .WhereIf(inQuery.Name.IsNotNullOrEmpty(), t => t.CreateUserRole.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.CreateUser.UserTypeEnum == inQuery.UserType) + .WhereIf(inQuery.UserType != null, t => t.CreateUserRole.UserTypeEnum == inQuery.UserType) .WhereIf(inQuery.IsSuccess != null, t => t.IsSuccess == inQuery.IsSuccess) .WhereIf(inQuery.DownloadStartTime != null, t => t.DownloadStartTime >= inQuery.DownloadStartTime) .WhereIf(inQuery.DownloadEndTime != null, t => t.DownloadEndTime <= inQuery.DownloadEndTime) @@ -1538,7 +1538,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc public async Task> GetIRUploadTaskList_Old(CRCUploadTaskQuery inQuery) { var query = _visitTaskRepository.Where(t => t.SubjectId == inQuery.SubjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId - && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect) + && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect) .ProjectTo(_mapper.ConfigurationProvider); diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs index 48005b743..56c6a645f 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs @@ -99,20 +99,20 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc if (visitTaskId != null) { var cacheValue = _fusionCache.GetOrDefault(CacheKeys.TrialTaskStudyUidUploading(trialId, visitTaskId.Value, studyInstanceUid)); - if (cacheValue != Guid.Empty && cacheValue != _userInfo.Id) + if (cacheValue != Guid.Empty && cacheValue != _userInfo.UserRoleId) { //---当前已有人正在上传和归档该检查! return ResponseOutput.NotOk(I18n.T("UploadDownLoad_ArchiveInProgress")); } else { - await _fusionCache.SetAsync(CacheKeys.TrialTaskStudyUidUploading(trialId, visitTaskId.Value, studyInstanceUid), _userInfo.Id, TimeSpan.FromSeconds(15)); + await _fusionCache.SetAsync(CacheKeys.TrialTaskStudyUidUploading(trialId, visitTaskId.Value, studyInstanceUid), _userInfo.UserRoleId, TimeSpan.FromSeconds(15)); } } else { - await _fusionCache.SetAsync(CacheKeys.TrialStudyUidUploading(trialId, studyInstanceUid), _userInfo.Id, TimeSpan.FromSeconds(15)); + await _fusionCache.SetAsync(CacheKeys.TrialStudyUidUploading(trialId, studyInstanceUid), _userInfo.UserRoleId, TimeSpan.FromSeconds(15)); } @@ -139,7 +139,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc else { //在事务未完成前 防止前端重复提交 - await _fusionCache.SetAsync(CacheKeys.TrialStudyUidDBLock(incommand.TrialId, incommand.Study.StudyInstanceUid), _userInfo.Id, TimeSpan.FromMinutes(3)); + await _fusionCache.SetAsync(CacheKeys.TrialStudyUidDBLock(incommand.TrialId, incommand.Study.StudyInstanceUid), _userInfo.UserRoleId, TimeSpan.FromMinutes(3)); } } @@ -357,7 +357,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var svExpression = QCCommon.GetDicomStudySubjectVisitFilter(inQuery.VisitPlanArray); var dicomStudyQuery = _dicomStudyRepository.Where(t => t.TrialId == inQuery.TrialId) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) //.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo)) .WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo)) @@ -394,7 +394,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc TrialSiteCode = t.Subject.TrialSite.TrialSiteCode, - Uploader = t.CreateUser.UserName, + Uploader = t.CreateUserRole.UserName, UploadTime = t.CreateTime @@ -406,7 +406,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var nodeDicomStudyQuery = _noneDicomStudyRepository.Where(t => t.TrialId == inQuery.TrialId) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) //.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo)) .WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression2) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo)) @@ -444,7 +444,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc TrialSiteCode = t.Subject.TrialSite.TrialSiteCode, - Uploader = t.CreateUser.UserName, + Uploader = t.CreateUserRole.UserName, UploadTime = t.CreateTime @@ -468,7 +468,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc { var svExpression = QCCommon.GetStudyMonitorSubjectVisitFilter(inQuery.VisitPlanArray); var StudyMonitorQuery = _studyMonitorRepository.Where(t => t.TrialId == inQuery.TrialId, ignoreQueryFilters: true) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) //.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo)) .WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo)) @@ -476,7 +476,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc .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.CreateUser.UserName.Contains(inQuery.Uploader)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Uploader), t => t.CreateUserRole.UserName.Contains(inQuery.Uploader)) .WhereIf(inQuery.IsSuccess != null, t => t.IsSuccess == inQuery.IsSuccess) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.StudyCode), t => t.StudyCode.Contains(inQuery.StudyCode)) .WhereIf(inQuery.UploadStartTime != null, t => t.UploadStartTime >= inQuery.UploadStartTime) @@ -499,7 +499,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc TrialSiteCode = t.Subject.TrialSite.TrialSiteCode, - Uploader = t.CreateUser.UserName, + Uploader = t.CreateUserRole.UserName, UploadTime = t.CreateTime, @@ -615,7 +615,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc public async Task>> VerifyTaskStudyAllowUploadAsync(VerifyTaskUploadOrReupload verifyInfo) { - var queryStudy = _visitTaskRepository.Where(t => t.SubjectId == verifyInfo.SubjectId && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.Id).Select(u => new + var queryStudy = _visitTaskRepository.Where(t => t.SubjectId == verifyInfo.SubjectId && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.UserRoleId).Select(u => new { VisitTaskId = u.Id, SourceSubjectVisitId = u.SourceSubjectVisitId, @@ -654,7 +654,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var result = new VerifyStudyUploadResult(); - if (_fusionCache.GetOrDefault($"StudyUid_{trialId}_{studyInstanceUid}") != _userInfo.Id) + if (_fusionCache.GetOrDefault($"StudyUid_{trialId}_{studyInstanceUid}") != _userInfo.UserRoleId) { result.AllowUpload = false; @@ -704,7 +704,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc { if (result.AllowReUpload || result.AllowUpload) { - await _fusionCache.SetAsync($"StudyUid_{trialId}_{studyInstanceUid}", _userInfo.Id, TimeSpan.FromSeconds(30)); + await _fusionCache.SetAsync($"StudyUid_{trialId}_{studyInstanceUid}", _userInfo.UserRoleId, TimeSpan.FromSeconds(30)); } else @@ -800,7 +800,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var result = new VerifyStudyUploadResult(); - if (cacheUserId.GetValueOrDefault() != _userInfo.Id && cacheUserId.HasValue) + if (cacheUserId.GetValueOrDefault() != _userInfo.UserRoleId && cacheUserId.HasValue) { result.AllowUpload = false; @@ -869,7 +869,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc { if (result.AllowReUpload || result.AllowUpload) { - _fusionCache.Set(CacheKeys.TrialStudyUidUploading(trialId, studyInstanceUid), _userInfo.Id, TimeSpan.FromSeconds(30)); + _fusionCache.Set(CacheKeys.TrialStudyUidUploading(trialId, studyInstanceUid), _userInfo.UserRoleId, TimeSpan.FromSeconds(30)); } else { diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs index 7f2159893..8b18ea4f3 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs @@ -40,8 +40,8 @@ namespace IRaCIS.Core.Application.Service CreateMap().IncludeMembers(t => t.Subject, u => u.SubjectVisit) .ForMember(d => d.SiteName, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteName)) - .ForMember(d => d.UploaderFirstName, u => u.MapFrom(s => s.CreateUser.FirstName)) - .ForMember(d => d.UploaderLastName, u => u.MapFrom(s => s.CreateUser.LastName)) + .ForMember(d => d.UploaderFirstName, u => u.MapFrom(s => s.CreateUserRole.FirstName)) + .ForMember(d => d.UploaderLastName, u => u.MapFrom(s => s.CreateUserRole.LastName)) .ForMember(d => d.UploadedTime, u => u.MapFrom(s => s.CreateTime)); CreateMap(); @@ -66,7 +66,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(o => o.IsCompleteClinicalData, t => t.MapFrom(u => !u.ReadingClinicalDataList.Any(x => x.ReadingClinicalDataPDFList.Count() == 0))) .ForMember(o => o.UploadedTime, t => t.MapFrom(u => u.CreateTime)) - .ForMember(o => o.Uploader, t => t.MapFrom(u => u.CreateUser.LastName + " / " + u.CreateUser.FirstName)) + .ForMember(o => o.Uploader, t => t.MapFrom(u => u.CreateUserRole.LastName + " / " + u.CreateUserRole.FirstName)) .ForMember(o => o.StudyId, t => t.MapFrom(u => u.Id)) .ForMember(o => o.IsHaveUploadFailed, t => t.MapFrom(u => u.DicomStudyMonitorList.Any(t => t.FailedFileCount > 0))) .ForMember(o => o.Modalities, t => t.MapFrom(u => string.Join('、', u.SeriesList.Select(t => t.Modality).Distinct()))); @@ -141,9 +141,9 @@ namespace IRaCIS.Core.Application.Service ; CreateMap() - .ForMember(d => d.UserFullName, u => u.MapFrom(s => s.CreateUser.FullName)) - .ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.CreateUser.UserTypeEnum)) - .ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUser.UserName)) + .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.TrialSiteCode, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteCode)) ; diff --git a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs index 6bf2306e7..c36602cb3 100644 --- a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs @@ -29,7 +29,7 @@ namespace IRaCIS.Core.Application.Service IRepository _qCChallengeRepository, IRepository _dictionaryRepository, IRepository _trialRepository, - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _checkChallengeDialogRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IFrontAuditConfigService { @@ -60,19 +60,19 @@ namespace IRaCIS.Core.Application.Service { case AccessToDialogueEnum.Question: - AccessToDialogueOutDto title = (await _qCChallengeRepository.Where(x => x.Id == inDto.Id).Include(x => x.CreateUser).Select(x => new AccessToDialogueOutDto() + AccessToDialogueOutDto title = (await _qCChallengeRepository.Where(x => x.Id == inDto.Id).Include(x => x.CreateUserRole).Select(x => new AccessToDialogueOutDto() { CreateTime = x.CreateTime, - CreateUserName = x.CreateUser.UserName, + CreateUserName = x.CreateUserRole.UserName, TalkContent = x.Content, IsTitle = true, }).FirstOrDefaultAsync()) ?? new AccessToDialogueOutDto(); - data = await _qCChallengeDialogRepository.Where(x => x.QCChallengeId == inDto.Id && x.CreateTime <= inDto.Createtime).Include(x => x.CreateUser).Select( + data = await _qCChallengeDialogRepository.Where(x => x.QCChallengeId == inDto.Id && x.CreateTime <= inDto.Createtime).Include(x => x.CreateUserRole).Select( x => new AccessToDialogueOutDto() { CreateTime = x.CreateTime, - CreateUserName = x.CreateUser.UserName, + CreateUserName = x.CreateUserRole.UserName, TalkContent = x.TalkContent } ).OrderBy(x => x.CreateTime).ToListAsync(); @@ -81,11 +81,11 @@ namespace IRaCIS.Core.Application.Service break; case AccessToDialogueEnum.Consistency: - data = await _checkChallengeDialogRepository.Where(x => x.SubjectVisitId == inDto.Id && x.CreateTime <= inDto.Createtime).Include(x => x.CreateUser).Select( + data = await _checkChallengeDialogRepository.Where(x => x.SubjectVisitId == inDto.Id && x.CreateTime <= inDto.Createtime).Include(x => x.CreateUserRole).Select( x => new AccessToDialogueOutDto() { CreateTime = x.CreateTime, - CreateUserName = x.CreateUser.UserName, + CreateUserName = x.CreateUserRole.UserName, TalkContent = x.TalkContent } ).OrderBy(x => x.CreateTime).ToListAsync(); @@ -401,7 +401,7 @@ namespace IRaCIS.Core.Application.Service //用户的数据稽查没有 临时处理 - var userObj = await _userRepository.Where(t => t.Id == objectRelationParentId).Select(t => new { UserRealName = t.FullName, t.Phone, t.UserName, UserType = t.UserTypeRole.UserTypeShortName, t.EMail, t.OrganizationName }).FirstOrDefaultAsync(); + var userObj = await _userRoleRepository.Where(t => t.Id == objectRelationParentId).Select(t => new { UserRealName = t.FullName, t.Phone, t.UserName, UserType = t.UserTypeRole.UserTypeShortName, t.EMail, t.OrganizationName }).FirstOrDefaultAsync(); if (userObj != null) { @@ -1074,14 +1074,14 @@ namespace IRaCIS.Core.Application.Service //IsConfig = lst.Select(x => x.IsConfig).FirstOrDefault(), IsShowParent = lst.Select(x => x.IsShowParent).FirstOrDefault(), ParentId = item.AddItemGuid, - CreateUserId = _userInfo.Id, + CreateUserId = _userInfo.UserRoleId, IsEnable = lst.Select(x => x.IsEnable).FirstOrDefault(), DictionaryKey = lst.Select(x => x.DictionaryKey).FirstOrDefault(), EnumType = lst.Select(x => x.EnumType).FirstOrDefault(), UpdateTime = DateTime.Now, ValueCN = lst.Select(x => x.ValueCN).FirstOrDefault(), Value = lst.Max(x => x.Value), - UpdateUserId = _userInfo.Id, + UpdateUserId = _userInfo.UserRoleId, ChildrenTypeId = additem?.ChildrenTypeId, ModuleTypeId = additem?.ModuleTypeId, ObjectTypeId = additem?.ObjectTypeId, diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs index 1633381e2..336fe4ff1 100644 --- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs @@ -12,7 +12,7 @@ namespace IRaCIS.Core.Application.Service.Inspection public class InspectionService(IRepository _dataInspectionRepository, IRepository _dictionaryRepository, IRepository _trialSignRepository, - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _trialSiteRepository, IRepository _trialRepository, IRepository _subjectRepository, @@ -53,7 +53,7 @@ namespace IRaCIS.Core.Application.Service.Inspection from leftsubjectVisit in subjectVisittemp.DefaultIfEmpty() join parent in _dataInspectionRepository.Where() on data.ParentId equals parent.Id into parenttemp from leftparent in parenttemp.DefaultIfEmpty() - join user in _userRepository.Where().IgnoreQueryFilters() on data.CreateUserId equals user.Id into usertemp + join user in _userRoleRepository.Where().IgnoreQueryFilters() on data.CreateUserId equals user.Id into usertemp from leftuser in usertemp.DefaultIfEmpty() join usertype in _userTypeRepository.Where().IgnoreQueryFilters() on leftuser.UserTypeId equals usertype.Id into usertypetemp from leftusertype in usertypetemp.DefaultIfEmpty() @@ -257,7 +257,7 @@ namespace IRaCIS.Core.Application.Service.Inspection /// 验证用户签名信息 /// public async Task VerifySignatureAsync(SignDTO signDTO) { - var user = await _userRepository.FirstOrDefaultAsync(u => u.UserName == signDTO.UserName && u.Password == signDTO.PassWord); + var user = await _userRoleRepository.FirstOrDefaultAsync(u => u.UserName == signDTO.UserName && u.Password == signDTO.PassWord); if (user == null) { throw new BusinessValidationFailedException(_localizer["User_CheckNameOrPw"]); diff --git a/IRaCIS.Core.Application/Service/Institution/CROService.cs b/IRaCIS.Core.Application/Service/Institution/CROService.cs index dbe34930a..236cba181 100644 --- a/IRaCIS.Core.Application/Service/Institution/CROService.cs +++ b/IRaCIS.Core.Application/Service/Institution/CROService.cs @@ -65,7 +65,7 @@ namespace IRaCIS.Core.Application.Service //---该CRO已经参与项目,不能被删除。 return ResponseOutput.NotOk(_localizer["CRO_InProject"]); } - //if (_userRepository.Find().Any(t => t.OrganizationId == cROCompanyId)) + //if (_userRoleRepository.Find().Any(t => t.OrganizationId == cROCompanyId)) //{ // return ResponseOutput.NotOk("该CRO下存在用户,暂时无法删除。"); //} diff --git a/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs b/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs index cfde80063..0c37fec09 100644 --- a/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs +++ b/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs @@ -48,7 +48,7 @@ namespace IRaCIS.Core.Application.Service if (entity.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.HavePublished) { - entity.PublishedUserId = _userInfo.Id; + entity.PublishedUserId = _userInfo.UserRoleId; entity.PublishedTime = DateTime.Now; } await _systemNoticeRepository.SaveChangesAsync(); @@ -61,7 +61,7 @@ namespace IRaCIS.Core.Application.Service if (addOrEditSystemNotice.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.HavePublished && systemNotice.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.NotPublish) { - systemNotice.PublishedUserId = _userInfo.Id; + systemNotice.PublishedUserId = _userInfo.UserRoleId; systemNotice.PublishedTime = DateTime.Now; } else if (addOrEditSystemNotice.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.NotPublish && systemNotice.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.HavePublished) @@ -125,7 +125,7 @@ namespace IRaCIS.Core.Application.Service .WhereIf(inQuery.NoticeTypeEnum != null, t => t.NoticeTypeEnum == inQuery.NoticeTypeEnum) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.FileName), t => t.FileName.Contains(inQuery.FileName)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.NoticeContent), t => t.NoticeContent.Contains(inQuery.NoticeContent)) - .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id }); + .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.UserRoleId }); return await systemNoticeQueryable.ToPagedListAsync(inQuery); } @@ -137,9 +137,9 @@ namespace IRaCIS.Core.Application.Service var appDateTimeNow = DateTime.Now; var query = _systemNoticeRepository - .Where(t => t.NoticeUserTypeList.Any(t => t.UserTypeId == _userInfo.UserTypeId) && t.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.HavePublished && !t.NoticeUserReadList.Any(t => t.CreateUserId == _userInfo.Id)) + .Where(t => t.NoticeUserTypeList.Any(t => t.UserTypeId == _userInfo.UserTypeId) && t.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.HavePublished && !t.NoticeUserReadList.Any(t => t.CreateUserId == _userInfo.UserRoleId)) .Where(t => t.EndDate == null || t.EndDate != null && t.EndDate > appDateTimeNow) - .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id }); + .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.UserRoleId }); return await query.ToListAsync(); } diff --git a/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs b/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs index 8ed020093..3083adfc1 100644 --- a/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs @@ -32,15 +32,15 @@ namespace IRaCIS.Core.Application.Service var isCRCOrIR = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer; var userFeedBackQueryable = _userFeedBackRepository - .WhereIf(isCRCOrIR, t => t.CreateUserId == _userInfo.Id) + .WhereIf(isCRCOrIR, t => t.CreateUserId == _userInfo.UserRoleId) .WhereIf(inQuery.State != null, t => t.State == inQuery.State) .WhereIf(inQuery.TrialId != null, t => t.TrialId == inQuery.TrialId) .WhereIf(inQuery.QuestionType != null, t => t.QuestionType == inQuery.QuestionType) .WhereIf(inQuery.BeginCreatime != null, t => t.CreateTime >= inQuery.BeginCreatime) .WhereIf(inQuery.EndCreatime != null, t => t.CreateTime == inQuery.EndCreatime) - .WhereIf(inQuery.UserTypeEnum != null, t => t.CreateUser.UserTypeEnum == inQuery.UserTypeEnum) - .WhereIf(!string.IsNullOrEmpty(inQuery.FeedBackUserKeyInfo), t => t.CreateUser.FullName.Contains(inQuery.FeedBackUserKeyInfo) || t.CreateUser.UserName.Contains(inQuery.FeedBackUserKeyInfo)) + .WhereIf(inQuery.UserTypeEnum != null, t => t.CreateUserRole.UserTypeEnum == inQuery.UserTypeEnum) + .WhereIf(!string.IsNullOrEmpty(inQuery.FeedBackUserKeyInfo), t => t.CreateUserRole.FullName.Contains(inQuery.FeedBackUserKeyInfo) || t.CreateUserRole.UserName.Contains(inQuery.FeedBackUserKeyInfo)) .WhereIf(!string.IsNullOrEmpty(inQuery.QuestionDescription), t => t.QuestionDescription.Contains(inQuery.QuestionDescription)) .WhereIf(!string.IsNullOrEmpty(inQuery.TrialKeyInfo), t => t.Trial.ExperimentName.Contains(inQuery.TrialKeyInfo) || t.Trial.TrialCode.Contains(inQuery.TrialKeyInfo)) .WhereIf(!string.IsNullOrEmpty(inQuery.SubejctAndVisitKeyInfo), t => t.Subject.Code.Contains(inQuery.SubejctAndVisitKeyInfo) || t.SubjectVisit.VisitName.Contains(inQuery.SubejctAndVisitKeyInfo)) diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index aee79516e..099aab6f0 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -23,7 +23,7 @@ using LoginReturnDTO = IRaCIS.Application.Contracts.LoginReturnDTO; namespace IRaCIS.Core.Application.Service { [ApiExplorerSettings(GroupName = "Management")] - public class UserService(IRepository _userRepository, + public class UserService(IRepository _userRoleRepository, IMailVerificationService _mailVerificationService, IRepository _verificationCodeRepository, IRepository _userTrialRepository, @@ -70,7 +70,7 @@ namespace IRaCIS.Core.Application.Service private async Task VerifyUserPwdAsync(Guid identityUserId, string newPwd, string? oldPwd = null) { - //var dbUser = (await _userRepository.FirstOrDefaultAsync(t => t.Id == userId)).IfNullThrowException(); + //var dbUser = (await _userRoleRepository.FirstOrDefaultAsync(t => t.Id == userId)).IfNullThrowException(); if (_verifyConfig.CurrentValue.OpenUserComplexPassword) { @@ -149,7 +149,7 @@ namespace IRaCIS.Core.Application.Service //验证码 6位 int verificationCode = new Random().Next(100000, 1000000); - await _mailVerificationService.SendMailEditEmail(_userInfo.Id, _userInfo.FullName, email, verificationCode); + await _mailVerificationService.SendMailEditEmail(_userInfo.IdentityUserId, _userInfo.FullName, email, verificationCode); return ResponseOutput.Ok(); @@ -163,7 +163,7 @@ namespace IRaCIS.Core.Application.Service var verificationRecord = await _verificationCodeRepository - .FirstOrDefaultAsync(t => t.UserId == _userInfo.Id && t.Code == verificationCode && t.CodeType == 0); + .FirstOrDefaultAsync(t => t.UserId == _userInfo.UserRoleId && t.Code == verificationCode && t.CodeType == 0); //检查数据库是否存在该验证码 if (verificationRecord == null) @@ -200,9 +200,9 @@ namespace IRaCIS.Core.Application.Service }); //删除验证码历史记录 - await _verificationCodeRepository.BatchDeleteNoTrackingAsync(t => t.UserId == _userInfo.Id && t.CodeType == 0); + await _verificationCodeRepository.BatchDeleteNoTrackingAsync(t => t.UserId == _userInfo.UserRoleId && t.CodeType == 0); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = _userInfo.Id, OptType = UserOptType.UpdateUser }, true); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.UserRoleId, OptUserId = _userInfo.UserRoleId, OptType = UserOptType.UpdateUser }, true); return ResponseOutput.Ok(); @@ -222,7 +222,7 @@ namespace IRaCIS.Core.Application.Service Phone = newPhone }); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = _userInfo.Id, OptType = UserOptType.UpdateUser }, true); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.UserRoleId, OptUserId = _userInfo.UserRoleId, OptType = UserOptType.UpdateUser }, true); return ResponseOutput.Ok(); } @@ -239,7 +239,7 @@ namespace IRaCIS.Core.Application.Service UserName = newUserName }); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = _userInfo.Id, OptType = UserOptType.UpdateUser }, true); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.UserRoleId, OptUserId = _userInfo.UserRoleId, OptType = UserOptType.UpdateUser }, true); return ResponseOutput.Ok(); } @@ -267,7 +267,7 @@ namespace IRaCIS.Core.Application.Service }, true); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = _userInfo.Id, OptType = UserOptType.UpdateUser }, true); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.UserRoleId, OptUserId = _userInfo.UserRoleId, OptType = UserOptType.UpdateUser }, true); return ResponseOutput.Ok(); } @@ -429,7 +429,7 @@ namespace IRaCIS.Core.Application.Service if (!string.IsNullOrEmpty(editPwModel.NewUserName)) { - await VerifyUserNameAsync(_userInfo.Id, editPwModel.NewUserName); + await VerifyUserNameAsync(_userInfo.UserRoleId, editPwModel.NewUserName); await _identityUserRepository.BatchUpdateNoTrackingAsync(t => t.Id == _userInfo.IdentityUserId, u => new IdentityUser() { @@ -444,7 +444,7 @@ namespace IRaCIS.Core.Application.Service IsFirstAdd = false }); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = _userInfo.Id, OptType = UserOptType.LoginModifyPassword }, true); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.UserRoleId, OptUserId = _userInfo.UserRoleId, OptType = UserOptType.LoginModifyPassword }, true); return ResponseOutput.Result(success); @@ -536,7 +536,7 @@ namespace IRaCIS.Core.Application.Service var user = await _identityUserRepository.Where(t => t.Id == _userInfo.IdentityUserId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); - user.AccountList = await _userRepository.Where(t => t.IdentityUserId == _userInfo.IdentityUserId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + user.AccountList = await _userRoleRepository.Where(t => t.IdentityUserId == _userInfo.IdentityUserId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); return user; } @@ -557,7 +557,7 @@ namespace IRaCIS.Core.Application.Service // await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = userId, OptType = UserOptType.DeleteUser }, true); - // var success = await _userRepository.BatchDeleteNoTrackingAsync(t => t.Id == userId); + // var success = await _userRoleRepository.BatchDeleteNoTrackingAsync(t => t.Id == userId); // return ResponseOutput.Result(success); //} @@ -602,11 +602,11 @@ namespace IRaCIS.Core.Application.Service saveItem.Password = MD5Helper.Md5(IRCEmailPasswordHelper.GenerateRandomPassword(10)); - var addRoleList = new List(); + var addRoleList = new List(); foreach (var role in userAddModel.UserRoleList) { - var addRole = _mapper.Map(userAddModel); + var addRole = _mapper.Map(userAddModel); addRole.UserTypeEnum = role.UserTypeEnum; addRole.UserTypeId = role.UserTypeId; @@ -664,7 +664,7 @@ namespace IRaCIS.Core.Application.Service user.OrganizationName = _userInfo.IsEn_Us ? _systemEmailConfig.OrganizationName : _systemEmailConfig.OrganizationNameCN; } - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = model.Id, OptType = UserOptType.UpdateUser }); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.UserRoleId, OptUserId = model.Id, OptType = UserOptType.UpdateUser }); //处理角色的添加、禁用 @@ -678,7 +678,7 @@ namespace IRaCIS.Core.Application.Service } else { - var addRole = _mapper.Map(model); + var addRole = _mapper.Map(model); addRole.UserTypeEnum = role.UserTypeEnum; addRole.UserTypeId = role.UserTypeId; @@ -689,7 +689,7 @@ namespace IRaCIS.Core.Application.Service user.UserRoleList = existDBRoleList; - var success = await _userRepository.SaveChangesAsync(); + var success = await _userRoleRepository.SaveChangesAsync(); return ResponseOutput.Ok(success); @@ -828,7 +828,7 @@ namespace IRaCIS.Core.Application.Service var userLoginReturnModel = new LoginReturnDTO(); - var loginUser = await _userRepository.Where(u => u.UserName.Equals(userName) && u.Password == password).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); + var loginUser = await _userRoleRepository.Where(u => u.UserName.Equals(userName) && u.Password == password).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); if (loginUser == null) { @@ -931,8 +931,6 @@ namespace IRaCIS.Core.Application.Service { await _fusionCache.RemoveAsync(CacheKeys.UserToken(identityUserId)); - //await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = userId, OptUserId = _userInfo.Id, OptType = UserOptType.LoginOut }, true); - return ResponseOutput.Ok(); } @@ -1098,7 +1096,7 @@ namespace IRaCIS.Core.Application.Service await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(identityUserId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(_verifyConfig.CurrentValue.AutoLoginOutMinutes)); } - userLoginReturnModel.BasicInfo.AccountList = await _userRepository.Where(t => t.IdentityUserId == identityUserId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + userLoginReturnModel.BasicInfo.AccountList = await _userRoleRepository.Where(t => t.IdentityUserId == identityUserId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); userLoginReturnModel.CompanyInfo = companyInfo; return ResponseOutput.Ok(userLoginReturnModel); @@ -1117,7 +1115,7 @@ namespace IRaCIS.Core.Application.Service { var identityUserId = _userInfo.IdentityUserId; - var userTokenInfo = await _userRepository.Where(t => t.IdentityUserId == identityUserId && t.Id == userRoleId).Select(t => new UserTokenInfo() + var userTokenInfo = await _userRoleRepository.Where(t => t.IdentityUserId == identityUserId && t.Id == userRoleId).Select(t => new UserTokenInfo() { UserRoleId = t.Id, IdentityUserId = t.IdentityUserId, @@ -1136,48 +1134,9 @@ namespace IRaCIS.Core.Application.Service { var jwt = _tokenService.GetToken(userTokenInfo); - var selectUserInfo = _userRepository.Where(t => t.IdentityUserId == identityUserId && t.Id == userRoleId).FirstOrDefault(); - - //if (!_identityUserRepository.Any(t => t.Id == identityUserId)) - //{ - // var identityUser = _mapper.Map(selectUserInfo); - - // await _identityUserRepository.AddAsync(identityUser, true); - //} - - ////多账号没维护 - //if (await _userRepository.Where(t => t.IdentityUserId == identityUserId).AnyAsync(t => t.IsMutiAccountInfoConfirm == false)) - //{ - // //将信息维护为一致 - // await _userRepository.BatchUpdateNoTrackingAsync(t => t.IdentityUserId == identityUserId, u => new User() - // { - // Code = selectUserInfo.Code, - // UserName = selectUserInfo.UserName, - // FirstName = selectUserInfo.FirstName, - // LastName = selectUserInfo.LastName, - // Phone = selectUserInfo.Phone, - // EMail = selectUserInfo.EMail, - // DepartmentName = selectUserInfo.DepartmentName, - // OrganizationName = selectUserInfo.OrganizationName, - // IsFirstAdd = selectUserInfo.IsFirstAdd, - // Sex = selectUserInfo.Sex, - // Status = selectUserInfo.Status, - // UserCode = selectUserInfo.UserCode, - // Password = selectUserInfo.Password, - // PasswordChanged = selectUserInfo.PasswordChanged, - // LastChangePassWordTime = selectUserInfo.LastChangePassWordTime, - // PositionName = selectUserInfo.PositionName, - // IsTestUser = selectUserInfo.IsTestUser, - // IsZhiZhun = selectUserInfo.IsZhiZhun, - // AutoCutNextTask = selectUserInfo.AutoCutNextTask, - // //DoctorId=selectUserInfo.DoctorId, - // LastLoginIP = selectUserInfo.LastLoginIP, - // LastLoginTime = selectUserInfo.LastLoginTime, - // }); - //} + return jwt; - //return new LoginSelectRoleReturn() { AccountList = accountList, JwtStr = jwt }; } else { diff --git a/IRaCIS.Core.Application/Service/Management/UserTypeService.cs b/IRaCIS.Core.Application/Service/Management/UserTypeService.cs index 924343023..e1a7fffae 100644 --- a/IRaCIS.Core.Application/Service/Management/UserTypeService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserTypeService.cs @@ -12,7 +12,7 @@ namespace IRaCIS.Core.Application.Contracts /// UserTypeRoleService /// [ApiExplorerSettings(GroupName = "Management")] - public class UserTypeRoleService(IRepository _userTypeRepository, IRepository _userRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IUserTypeService + public class UserTypeRoleService(IRepository _userTypeRepository, IRepository _userRoleRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IUserTypeService { [HttpPost] @@ -79,7 +79,7 @@ namespace IRaCIS.Core.Application.Contracts [HttpDelete("{userTypeId:guid}")] public async Task DeleteUserTypeRole(Guid userTypeId) { - if (await _userRepository.AnyAsync(t => t.UserTypeId == userTypeId)) + if (await _userRoleRepository.AnyAsync(t => t.UserTypeId == userTypeId)) { //---该用户类型中已存在用户,不能删除 return ResponseOutput.NotOk(_localizer["UserType_InUse"]); diff --git a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs index 9ec293b9a..cfc90dc82 100644 --- a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs @@ -17,7 +17,7 @@ namespace IRaCIS.Core.Application.Service - CreateMap().ForMember(d => d.UserCode, x => x.Ignore()); + CreateMap().ForMember(d => d.UserCode, x => x.Ignore()); CreateMap().ReverseMap() .ForMember(t => t.UserTypeMenuList, u => u.MapFrom(c => c.MenuIds)) .ForMember(t => t.UserTypeGroupList, u => u.MapFrom(c => c.UserTypeGroupIdList)); @@ -93,7 +93,7 @@ namespace IRaCIS.Core.Application.Service var userId = Guid.Empty; CreateMap() .ForMember(t => t.PublishUserName, d => d.MapFrom(t => t.PublishedUser.UserName)) - .ForMember(t => t.CreateUserName, d => d.MapFrom(t => t.CreateUser.UserName)) + .ForMember(t => t.CreateUserName, d => d.MapFrom(t => t.CreateUserRole.UserName)) .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path + "?access_token=" + token)); @@ -101,7 +101,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(t => t.PublishUserName, d => d.MapFrom(t => t.PublishedUser.UserName)) - .ForMember(t => t.CreateUserName, d => d.MapFrom(t => t.CreateUser.UserName)) + .ForMember(t => t.CreateUserName, d => d.MapFrom(t => t.CreateUserRole.UserName)) .ForMember(t => t.IsRead, d => d.MapFrom(t => t.NoticeUserReadList.Any(t => t.CreateUserId == userId))) .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path + "?access_token=" + token)); @@ -132,9 +132,9 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.SubjectCode, c => c.MapFrom(t => t.Subject.Code)) .ForMember(d => d.TrialSiteCode, c => c.MapFrom(t => t.VisitTask.IsAnalysisCreate ? t.VisitTask.BlindTrialSiteCode : t.TrialSite.TrialSiteCode)) .ForMember(d => d.SubjectVisitName, c => c.MapFrom(t => t.SubjectVisit.VisitName)) - .ForMember(d => d.FeedBackUserName, c => c.MapFrom(t => t.CreateUser.UserName)) - .ForMember(d => d.FeedBackFullName, c => c.MapFrom(t => t.CreateUser.FullName)) - .ForMember(d => d.UserTypeEnum, c => c.MapFrom(t => t.CreateUser.UserTypeEnum)) + .ForMember(d => d.FeedBackUserName, c => c.MapFrom(t => t.CreateUserRole.UserName)) + .ForMember(d => d.FeedBackFullName, c => c.MapFrom(t => t.CreateUserRole.FullName)) + .ForMember(d => d.UserTypeEnum, c => c.MapFrom(t => t.CreateUserRole.UserTypeEnum)) .ForMember(d => d.ScreenshotList, c => c.MapFrom(t => t.FeedBackScreenshotList)) ; @@ -142,21 +142,21 @@ namespace IRaCIS.Core.Application.Service CreateMap(); - CreateMap() + CreateMap() .ForMember(d => d.UserTypeShortName, c => c.MapFrom(t => t.UserTypeRole.UserTypeShortName)); - CreateMap(); + CreateMap(); CreateMap() .ForMember(d => d.IdentityUserId, c => c.MapFrom(t => t.Id)); CreateMap(); - CreateMap(); + CreateMap(); - CreateMap() + CreateMap() .ForMember(d => d.UserTypeShortName, c => c.MapFrom(t => t.UserTypeRole.UserTypeShortName)); diff --git a/IRaCIS.Core.Application/Service/QC/QCCommon.cs b/IRaCIS.Core.Application/Service/QC/QCCommon.cs index da3590c1e..012befc5e 100644 --- a/IRaCIS.Core.Application/Service/QC/QCCommon.cs +++ b/IRaCIS.Core.Application/Service/QC/QCCommon.cs @@ -49,7 +49,7 @@ namespace IRaCIS.Core.Application.Service { subjectVisit = (await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == subjectVisitId)).IfNullThrowException(); } - if (subjectVisit!.CurrentActionUserId != _userInfo.Id) + if (subjectVisit!.CurrentActionUserId != _userInfo.UserRoleId) { //---您不是该质控任务当前领取人,没有操作权限! throw new BusinessValidationFailedException(_localizer["QCCommon_NoPermission"]); diff --git a/IRaCIS.Core.Application/Service/QC/QCListService.cs b/IRaCIS.Core.Application/Service/QC/QCListService.cs index ee3dabcf0..f125a8aab 100644 --- a/IRaCIS.Core.Application/Service/QC/QCListService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCListService.cs @@ -52,7 +52,7 @@ namespace IRaCIS.Core.Application.Image.QA .WhereIf(inQuery.SubmitState != null, t => t.SubmitState == inQuery.SubmitState) .WhereIf(inQuery.ChallengeState != null, t => t.ChallengeState == inQuery.ChallengeState) .WhereIf(inQuery.IsUrgent != null, t => t.IsUrgent == inQuery.IsUrgent) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .ProjectTo(_mapper.ConfigurationProvider); @@ -148,7 +148,7 @@ namespace IRaCIS.Core.Application.Image.QA .WhereIf(inQuery.IsOverTime != null && inQuery.IsOverTime == true, t => t.IsClosed ? t.ClosedTime > t.DeadlineTime : DateTime.Now > t.DeadlineTime) .WhereIf(inQuery.IsOverTime != null && inQuery.IsOverTime == false, t => t.IsClosed ? t.ClosedTime < t.DeadlineTime : DateTime.Now < t.DeadlineTime) .WhereIf(inQuery.IsUrgent != null, t => t.SubjectVisit.IsUrgent == inQuery.IsUrgent) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.SubjectVisit.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.SubjectVisit.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .ProjectTo(_mapper.ConfigurationProvider); var pageList = await query.ToPagedListAsync(inQuery, new string[] { nameof(QCCRCChallengeViewModel.IsUrgent) + " desc", nameof(QCCRCChallengeViewModel.CreateTime) }); @@ -209,7 +209,7 @@ namespace IRaCIS.Core.Application.Image.QA var result = await GetQCVisitList(new QCVisitSearchDTO() { TrialId = inDto.TrialId, - CurrentActionUserId = _userInfo.Id, + CurrentActionUserId = _userInfo.UserRoleId, VisitId = inDto.VisitId, PageIndex = 1, PageSize = 1, @@ -291,7 +291,7 @@ namespace IRaCIS.Core.Application.Image.QA .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo)) .WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression) //.WhereIf(!string.IsNullOrEmpty(checkQuery.VisitPlanInfo), checkQuery.VisitPlanInfo.Contains('.') ? t => t.InPlan == false : t => t.VisitNum == decimal.Parse(checkQuery.VisitPlanInfo)) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))//CRC 过滤负责的site + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId))//CRC 过滤负责的site .ProjectTo(_mapper.ConfigurationProvider); var pageList = await query.ToPagedListAsync(inQuery); @@ -313,7 +313,7 @@ namespace IRaCIS.Core.Application.Image.QA var sv = (await _subjectVisitRepository.Where(t => t.Id == subjectVisitId) .ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); - sv.DialogList.ForEach(t => t.IsCurrentUser = _userInfo.Id == t.CreateUserId); + sv.DialogList.ForEach(t => t.IsCurrentUser = _userInfo.UserRoleId == t.CreateUserId); return sv; } @@ -544,7 +544,7 @@ namespace IRaCIS.Core.Application.Image.QA { var list = await _qcChallengeRepository.Where(t => t.Id == qaChallengeId) - .ProjectTo(_mapper.ConfigurationProvider, new { currentUserId = _userInfo.Id }).ToListAsync(); + .ProjectTo(_mapper.ConfigurationProvider, new { currentUserId = _userInfo.UserRoleId }).ToListAsync(); //利用automapper 运行时映射 //list.ForEach(t => t.IsCurrentUser = _userInfo.Id == t.CreateUserId); @@ -566,7 +566,7 @@ namespace IRaCIS.Core.Application.Image.QA { var qaChallengeQuery = _qcChallengeRepository.Where(t => t.SubjectVisitId == subjectVisitId && t.QCProcessEnum == trialQCProcess) - .ProjectTo(_mapper.ConfigurationProvider, new { currentUserId = _userInfo.Id }); + .ProjectTo(_mapper.ConfigurationProvider, new { currentUserId = _userInfo.UserRoleId }); var list = await qaChallengeQuery.ToListAsync(); diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index 6a0fe950d..380ccaf56 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -224,7 +224,7 @@ namespace IRaCIS.Core.Application.Image.QA dbQCChallenge.LatestMsgTime = DateTime.Now; - dbQCChallenge.LatestReplyUserId = _userInfo.Id; + dbQCChallenge.LatestReplyUserId = _userInfo.UserRoleId; var success = await _qCChallengeDialogrepository.SaveChangesAsync(); @@ -345,7 +345,7 @@ namespace IRaCIS.Core.Application.Image.QA ResponseOutput.NotOk(_localizer["QCOperation_PassAfterClose"]); } - sv.CheckUserId = _userInfo.Id; + sv.CheckUserId = _userInfo.UserRoleId; sv.CheckState = CheckStateEnum.CVPassed; sv.ReadingStatus = ReadingStatusEnum.TaskAllocate; @@ -835,7 +835,7 @@ namespace IRaCIS.Core.Application.Image.QA subjectVisit = (await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == sujectVisitId)).IfNullThrowException(); } - if (subjectVisit!.CurrentActionUserId != _userInfo.Id) + if (subjectVisit!.CurrentActionUserId != _userInfo.UserRoleId) { //---您不是该质控任务当前领取人,没有操作权限! throw new BusinessValidationFailedException(_localizer["QCOperation_NoRecipient"]); @@ -863,7 +863,7 @@ namespace IRaCIS.Core.Application.Image.QA dbSubjectVisit.IsTake = true; - dbSubjectVisit.CurrentActionUserId = _userInfo.Id; + dbSubjectVisit.CurrentActionUserId = _userInfo.UserRoleId; dbSubjectVisit.CurrentActionUserExpireTime = DateTime.Now.AddHours(1); @@ -919,8 +919,8 @@ namespace IRaCIS.Core.Application.Image.QA break; case TrialQCProcess.SingleAudit: visitList = await _subjectVisitRepository.Where(x => x.SubmitState == SubmitStateEnum.Submitted - && x.TrialId == inDto.TrialId && x.PreliminaryAuditUserId != _userInfo.Id && (x.CurrentActionUserId == _userInfo.Id || (x.AuditState != AuditStateEnum.PrimaryQCPassed && !x.IsTake))) - .Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.Id) + && x.TrialId == inDto.TrialId && x.PreliminaryAuditUserId != _userInfo.UserRoleId && (x.CurrentActionUserId == _userInfo.UserRoleId || (x.AuditState != AuditStateEnum.PrimaryQCPassed && !x.IsTake))) + .Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.UserRoleId) .Include(x => x.Subject).ToListAsync(); subjectVisit = visitList.Where(x => x.SubjectId == inDto.SubjectId) @@ -953,9 +953,9 @@ namespace IRaCIS.Core.Application.Image.QA case TrialQCProcess.DoubleAudit: visitList = await _subjectVisitRepository.Where(x => x.SubmitState == SubmitStateEnum.Submitted && x.TrialId == inDto.TrialId && - ((x.CurrentActionUserId == _userInfo.Id) || (!x.IsTake && x.AuditState != AuditStateEnum.QCPassed && (x.PreliminaryAuditUserId != _userInfo.Id))) + ((x.CurrentActionUserId == _userInfo.UserRoleId) || (!x.IsTake && x.AuditState != AuditStateEnum.QCPassed && (x.PreliminaryAuditUserId != _userInfo.UserRoleId))) ) - .Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.Id) + .Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.UserRoleId) .Include(x => x.Subject).ToListAsync(); if (subjectVisit != null) { @@ -1046,7 +1046,7 @@ namespace IRaCIS.Core.Application.Image.QA } else if (trialConfig.QCProcessEnum == TrialQCProcess.SingleAudit) { - if (dbSubjectVisit.PreliminaryAuditUserId == _userInfo.Id) + if (dbSubjectVisit.PreliminaryAuditUserId == _userInfo.UserRoleId) { //---初审已通过,不能继续领取 return ResponseOutput.NotOk(_localizer["QCOperation_InitialAuditPassed"]); @@ -1068,7 +1068,7 @@ namespace IRaCIS.Core.Application.Image.QA } else if (trialConfig.QCProcessEnum == TrialQCProcess.DoubleAudit) { - if (dbSubjectVisit.PreliminaryAuditUserId == _userInfo.Id) + if (dbSubjectVisit.PreliminaryAuditUserId == _userInfo.UserRoleId) { //---复审不能和初审是同一个人 return ResponseOutput.NotOk(_localizer["QCOperation_NoSameReviewer"]); @@ -1099,7 +1099,7 @@ namespace IRaCIS.Core.Application.Image.QA dbSubjectVisit.IsTake = true; - dbSubjectVisit.CurrentActionUserId = _userInfo.Id; + dbSubjectVisit.CurrentActionUserId = _userInfo.UserRoleId; dbSubjectVisit.CurrentActionUserExpireTime = DateTime.Now.AddHours(1); @@ -1109,7 +1109,7 @@ namespace IRaCIS.Core.Application.Image.QA } else { - if (dbSubjectVisit!.CurrentActionUserId != _userInfo.Id) + if (dbSubjectVisit!.CurrentActionUserId != _userInfo.UserRoleId) { //---您不是该质控任务当前领取人,没有操作权限! return ResponseOutput.NotOk(_localizer["QCOperation_NoRecipient"], ApiResponseCodeEnum.NeedTips); @@ -1414,7 +1414,7 @@ namespace IRaCIS.Core.Application.Image.QA { dbSubjectVisit.SubmitState = SubmitStateEnum.Submitted; dbSubjectVisit.SubmitTime = DateTime.Now; - dbSubjectVisit.SubmitUserId = _userInfo.Id; + dbSubjectVisit.SubmitUserId = _userInfo.UserRoleId; //维护统一状态 dbSubjectVisit.ReadingStatus = ReadingStatusEnum.ImageQuality; @@ -1513,7 +1513,7 @@ namespace IRaCIS.Core.Application.Image.QA public async Task QCPassedOrFailed(Guid trialId, Guid subjectVisitId, [FromRoute] AuditStateEnum auditState) { - if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == _userInfo.Id)) + if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == _userInfo.UserRoleId)) { //---您已经被移出项目,没有操作权限。 return ResponseOutput.NotOk(_localizer["QCOperation_RemoveItem"]); @@ -1574,7 +1574,7 @@ namespace IRaCIS.Core.Application.Image.QA dbSubjectVisit.AuditState = AuditStateEnum.QCPassed; dbSubjectVisit.CheckState = trialConfig.IsImageConsistencyVerification ? CheckStateEnum.ToCheck : CheckStateEnum.CVPassed; dbSubjectVisit.ForwardState = trialConfig.IsImageConsistencyVerification ? ForwardStateEnum.None : ForwardStateEnum.ToForward; - dbSubjectVisit.PreliminaryAuditUserId = _userInfo.Id; + dbSubjectVisit.PreliminaryAuditUserId = _userInfo.UserRoleId; dbSubjectVisit.PreliminaryAuditTime = DateTime.Now; @@ -1618,7 +1618,7 @@ namespace IRaCIS.Core.Application.Image.QA } dbSubjectVisit.AuditState = AuditStateEnum.PrimaryQCPassed; - dbSubjectVisit.PreliminaryAuditUserId = _userInfo.Id; + dbSubjectVisit.PreliminaryAuditUserId = _userInfo.UserRoleId; dbSubjectVisit.PreliminaryAuditTime = DateTime.Now; @@ -1638,7 +1638,7 @@ namespace IRaCIS.Core.Application.Image.QA dbSubjectVisit.ForwardState = trialConfig.IsImageConsistencyVerification ? ForwardStateEnum.None : ForwardStateEnum.ToForward; - dbSubjectVisit.ReviewAuditUserId = _userInfo.Id; + dbSubjectVisit.ReviewAuditUserId = _userInfo.UserRoleId; dbSubjectVisit.ReviewAuditTime = DateTime.Now; @@ -1682,7 +1682,7 @@ namespace IRaCIS.Core.Application.Image.QA if (dbSubjectVisit.AuditState == AuditStateEnum.InPrimaryQC) { dbSubjectVisit.AuditState = AuditStateEnum.QCFailed; - dbSubjectVisit.PreliminaryAuditUserId = _userInfo.Id; + dbSubjectVisit.PreliminaryAuditUserId = _userInfo.UserRoleId; } else @@ -1697,12 +1697,12 @@ namespace IRaCIS.Core.Application.Image.QA if (dbSubjectVisit.AuditState == AuditStateEnum.InPrimaryQC) { dbSubjectVisit.AuditState = AuditStateEnum.QCFailed; - dbSubjectVisit.PreliminaryAuditUserId = _userInfo.Id; + dbSubjectVisit.PreliminaryAuditUserId = _userInfo.UserRoleId; } else if (dbSubjectVisit.AuditState == AuditStateEnum.InSecondaryQC) { dbSubjectVisit.AuditState = AuditStateEnum.QCFailed; - dbSubjectVisit.ReviewAuditUserId = _userInfo.Id; + dbSubjectVisit.ReviewAuditUserId = _userInfo.UserRoleId; } else { @@ -1717,7 +1717,7 @@ namespace IRaCIS.Core.Application.Image.QA } - dbSubjectVisit.Auditor = _userInfo.Id; + dbSubjectVisit.Auditor = _userInfo.UserRoleId; dbSubjectVisit.IsTake = false; dbSubjectVisit.CurrentActionUserId = null; dbSubjectVisit.CurrentActionUserExpireTime = null; @@ -1818,7 +1818,7 @@ namespace IRaCIS.Core.Application.Image.QA qcChallenge.ReuploadEnum = QCChanllengeReuploadEnum.QCAgreeUpload; qcChallenge.LatestMsgTime = DateTime.Now; - qcChallenge.LatestReplyUserId = _userInfo.Id; + qcChallenge.LatestReplyUserId = _userInfo.UserRoleId; await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == qcChallenge.SubjectVisitId, c => new SubjectVisit() { IsQCConfirmedReupload = true }); @@ -1845,7 +1845,7 @@ namespace IRaCIS.Core.Application.Image.QA sv.AuditState = AuditStateEnum.InPrimaryQC; sv.CurrentActionUserExpireTime = DateTime.Now.AddHours(1); - sv.CurrentActionUserId = _userInfo.Id; + sv.CurrentActionUserId = _userInfo.UserRoleId; //BackgroundJob.Schedule(t => t.CancelQCObtaion(qcChallenge.SubjectVisitId, DateTime.Now), TimeSpan.FromHours(1)); sv.IsTake = true; @@ -1936,13 +1936,13 @@ namespace IRaCIS.Core.Application.Image.QA qcChallenge.ReUploadedTime = DateTime.Now; - qcChallenge.ReUploadUserId = _userInfo.Id; + qcChallenge.ReUploadUserId = _userInfo.UserRoleId; qcChallenge.ReUploader = _userInfo.FullName; qcChallenge.LatestMsgTime = DateTime.Now; - qcChallenge.LatestReplyUserId = _userInfo.Id; + qcChallenge.LatestReplyUserId = _userInfo.UserRoleId; var dbSubjectVisit = await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == qcChallenge.SubjectVisitId).IfNullThrowException(); @@ -2013,7 +2013,7 @@ namespace IRaCIS.Core.Application.Image.QA } qcChallenge.LatestMsgTime = DateTime.Now; - qcChallenge.LatestReplyUserId = _userInfo.Id; + qcChallenge.LatestReplyUserId = _userInfo.UserRoleId; qcChallenge.ReuploadEnum = QCChanllengeReuploadEnum.CRCRequestReupload; qcChallenge.DialogList.Add(new QCChallengeDialog() diff --git a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs index 146f770f2..6405e50c6 100644 --- a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs @@ -49,7 +49,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(d => d.CreateTime, u => u.MapFrom(s => s.CreateTime)) - .ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUser.FullName)) + .ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUserRole.FullName)) .ForMember(d => d.Content, u => u.MapFrom(s => s.TalkContent)); CreateMap() @@ -58,7 +58,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.SubjectVisit.TrialSite.TrialSiteCode)) .ForMember(d => d.VisitName, u => u.MapFrom(s => s.SubjectVisit.VisitName)) - .ForMember(d => d.CreateUserName, u => u.MapFrom(s => s.CreateUser.UserName)) + .ForMember(d => d.CreateUserName, u => u.MapFrom(s => s.CreateUserRole.UserName)) .ForMember(d => d.LatestReplyUserName, u => u.MapFrom(t => t.LatestReplyUser.UserName)) .ForMember(d => d.LatestReplyUserFullName, u => u.MapFrom(t => t.LatestReplyUser.FullName)) .ForMember(d => d.DialogList, u => u.MapFrom(t => t.DialogList)) @@ -89,8 +89,8 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.RadiologyClinicalDataCount, u => u.MapFrom(s => s.ClinicalDataList.Count(t => t.ClinicalDataTrialSet.ClinicalDataLevel == ClinicalLevel.ImageRead))) .ForMember(d => d.OncologyClinicalDataCount, u => u.MapFrom(s => s.ClinicalDataList.Count(t => t.ClinicalDataTrialSet.ClinicalDataLevel == ClinicalLevel.OncologyRead))) - .ForMember(d => d.ChallengeWaitReplyCount, u => u.MapFrom(s => s.SubjectVisitList.SelectMany(c => c.QCChallengeList).Count(t => t.IsClosed == false && !t.DialogList.Any(t => t.CreateUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator)))) - .ForMember(d => d.CheckWaitReplyCount, u => u.MapFrom(s => s.SubjectVisitList.Count(t => t.CheckState == CheckStateEnum.CVIng && t.CheckChallengeState != CheckChanllengeTypeEnum.Closed && !t.CheckChallengeDialogList.Any(t => t.CreateUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator)))) + .ForMember(d => d.ChallengeWaitReplyCount, u => u.MapFrom(s => s.SubjectVisitList.SelectMany(c => c.QCChallengeList).Count(t => t.IsClosed == false && !t.DialogList.Any(t => t.CreateUserRole.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator)))) + .ForMember(d => d.CheckWaitReplyCount, u => u.MapFrom(s => s.SubjectVisitList.Count(t => t.CheckState == CheckStateEnum.CVIng && t.CheckChallengeState != CheckChanllengeTypeEnum.Closed && !t.CheckChallengeDialogList.Any(t => t.CreateUserRole.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator)))) ; CreateMap() @@ -124,7 +124,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(d => d.CreateTime, u => u.MapFrom(s => s.CreateTime)) - .ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUser.FullName)) + .ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUserRole.FullName)) .ForMember(d => d.Content, u => u.MapFrom(s => s.TalkContent)); CreateMap() @@ -554,8 +554,8 @@ namespace IRaCIS.Core.Application.Service //一致性核查 质疑对话 CreateMap() - .ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUser.UserName)) - .ForMember(d => d.CreateUserFullName, u => u.MapFrom(t => t.CreateUser.FullName)); + .ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUserRole.UserName)) + .ForMember(d => d.CreateUserFullName, u => u.MapFrom(t => t.CreateUserRole.FullName)); CreateMap() .ForMember(d => d.SubjectVisitCheck, u => u.MapFrom(t => t)) @@ -586,13 +586,13 @@ namespace IRaCIS.Core.Application.Service // 临床数据上传 路径拼接返回 CreateMap() - .ForMember(d => d.CreateUser, u => u.MapFrom(s => s.CreateUser.FullName)) + .ForMember(d => d.CreateUser, u => u.MapFrom(s => s.CreateUserRole.FullName)) .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path)); CreateMap() - .ForMember(d => d.CreateUser, u => u.MapFrom(s => s.CreateUser.FullName)) + .ForMember(d => d.CreateUser, u => u.MapFrom(s => s.CreateUserRole.FullName)) .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path)); CreateMap() - .ForMember(d => d.CreateUser, u => u.MapFrom(s => s.CreateUser.FullName)) + .ForMember(d => d.CreateUser, u => u.MapFrom(s => s.CreateUserRole.FullName)) .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path)); @@ -602,14 +602,14 @@ namespace IRaCIS.Core.Application.Service //QC 质疑对话 var currentUserId = Guid.Empty; CreateMap() - .ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUser.UserName)) - .ForMember(d => d.CreateUserFullName, u => u.MapFrom(t => t.CreateUser.FullName)) + .ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUserRole.UserName)) + .ForMember(d => d.CreateUserFullName, u => u.MapFrom(t => t.CreateUserRole.FullName)) .ForMember(d => d.IsCurrentUser, u => u.MapFrom(s => s.CreateUserId == currentUserId)); //质疑编号 CreateMap() .ForMember(d => d.LatestReplyUserName, u => u.MapFrom(t => t.LatestReplyUser.FullName)) - .ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUser.FullName)) + .ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUserRole.FullName)) .ForMember(d => d.CurrentActionUserId, u => u.MapFrom(t => t.SubjectVisit.CurrentActionUserId)) .ForMember(d => d.CurrentActionUserName, u => u.MapFrom(t => t.SubjectVisit.CurrentActionUser.FullName)) @@ -624,7 +624,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(d => d.LatestReplyUserName, u => u.MapFrom(t => t.LatestReplyUser.FullName)) - .ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUser.FullName)) + .ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUserRole.FullName)) .ForMember(d => d.CurrentActionUserId, u => u.MapFrom(t => t.SubjectVisit.CurrentActionUserId)) .ForMember(d => d.CurrentActionUserName, u => u.MapFrom(t => t.SubjectVisit.CurrentActionUser.FullName)) @@ -641,7 +641,7 @@ namespace IRaCIS.Core.Application.Service // 一致性核查文件 CreateMap() - .ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUser.FullName)); + .ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUserRole.FullName)); //CRC 质疑列表 @@ -666,7 +666,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.BlindName, u => u.MapFrom(s => s.SubjectVisit.BlindName)) //.ForMember(d => d.ClosedUserUserName, u => u.MapFrom(s => s.ClosedUser.UserName)) .ForMember(d => d.IsQCConfirmedReupload, u => u.MapFrom(s => s.SubjectVisit.IsQCConfirmedReupload)) - .ForMember(d => d.CreateUserName, u => u.MapFrom(s => s.CreateUser.UserName)) + .ForMember(d => d.CreateUserName, u => u.MapFrom(s => s.CreateUserRole.UserName)) .ForMember(d => d.LatestReplyUserName, u => u.MapFrom(t => t.LatestReplyUser.UserName)) .ForMember(d => d.LatestReplyUserFullName, u => u.MapFrom(t => t.LatestReplyUser.FullName)) diff --git a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs index b57a309bb..f25387e44 100644 --- a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs +++ b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs @@ -428,7 +428,7 @@ namespace IRaCIS.Core.Application.Service await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview() { - LatestReplyUserId = (inDto.IsSendDialog && !medicalReview.IsSendMessage && inDto.IsHaveQuestion) ? _userInfo.Id : null, + LatestReplyUserId = (inDto.IsSendDialog && !medicalReview.IsSendMessage && inDto.IsHaveQuestion) ? _userInfo.UserRoleId : null, IsHaveQuestion = inDto.IsHaveQuestion, Questioning = inDto.Questioning, IsSendMessage = inDto.IsSendDialog && inDto.IsHaveQuestion, @@ -471,7 +471,7 @@ namespace IRaCIS.Core.Application.Service { await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview() { - LatestReplyUserId = _userInfo.Id, + LatestReplyUserId = _userInfo.UserRoleId, IsClosedDialog = inDto.IsClosedDialog, MedicalDialogCloseEnum = inDto.MedicalDialogCloseEnum, DialogCloseReason = inDto.DialogCloseReason, @@ -510,7 +510,7 @@ namespace IRaCIS.Core.Application.Service await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview() { - LatestReplyUserId = _userInfo.Id, + LatestReplyUserId = _userInfo.UserRoleId, }); var visitTaskId = await _taskMedicalReviewRepository.Where(x => x.Id == inDto.TaskMedicalReviewId).Select(x => x.VisitTaskId).FirstOrDefaultAsync(); @@ -566,7 +566,7 @@ namespace IRaCIS.Core.Application.Service await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(x => !x.IsClosedDialog && x.Id == inDto.TaskMedicalReviewId, x => new TaskMedicalReview() { - LatestReplyUserId = _userInfo.Id, + LatestReplyUserId = _userInfo.UserRoleId, IsClosedDialog = true, MedicalDialogCloseEnum = MedicalDialogClose.IRApplyReReading, @@ -580,7 +580,7 @@ namespace IRaCIS.Core.Application.Service await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview() { - LatestReplyUserId = _userInfo.Id, + LatestReplyUserId = _userInfo.UserRoleId, DoctorUserIdeaEnum = inDto.DoctorUserIdeaEnum, }); ReadingMedicalReviewDialog dialog = new ReadingMedicalReviewDialog() @@ -617,7 +617,7 @@ namespace IRaCIS.Core.Application.Service .OrderBy(x => x.CreateTime).ToListAsync(); result.ForEach(x => { - x.IsCurrentUser = x.CreateUserId == _userInfo.Id; + x.IsCurrentUser = x.CreateUserId == _userInfo.UserRoleId; }); return (result, new { @@ -710,7 +710,7 @@ namespace IRaCIS.Core.Application.Service await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview() { - LatestReplyUserId = _userInfo.Id, + LatestReplyUserId = _userInfo.UserRoleId, DoctorUserIdeaEnum = inDto.DoctorUserIdeaEnum, DisagreeReason = inDto.DisagreeReason, IsApplyHeavyReading = inDto.IsApplyHeavyReading, @@ -784,7 +784,7 @@ namespace IRaCIS.Core.Application.Service public async Task> GetIRMedicalFeedbackList(GetIRMedicalFeedbackListInDto inDto) { var taskMedicalReviewquery = _taskMedicalReviewRepository.Where(x => x.TrialId == inDto.TrialId).Include(x => x.VisitTask) - .Where(x => x.VisitTask.DoctorUserId == _userInfo.Id) + .Where(x => x.VisitTask.DoctorUserId == _userInfo.UserRoleId) .Where(x => x.IsHaveQuestion) .WhereIf(!inDto.TaskBlindName.IsNullOrEmpty(), x => x.VisitTask.TaskBlindName == inDto.TaskBlindName) .WhereIf(inDto.SubjectId != null, x => x.VisitTask.SubjectId == inDto.SubjectId!) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index ffda142c6..fd836bbd6 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -181,7 +181,7 @@ namespace IRaCIS.Core.Application.Service }; return await _trialDocumentRepository.Where(x => x.TrialId == inDto.TrialId - && x.TrialDocConfirmedUserList.Any(y => y.ConfirmUserId == _userInfo.Id && y.ConfirmTime != null) + && x.TrialDocConfirmedUserList.Any(y => y.ConfirmUserId == _userInfo.UserRoleId && y.ConfirmTime != null) && x.NeedConfirmedUserTypeList.Any(y => y.NeedConfirmUserTypeId == _userInfo.UserTypeId)) .WhereIf(userType == UserTypeEnum.IndependentReviewer, t => t.FileType.Code == "2" || t.FileType.Code == "6") .WhereIf(userType == UserTypeEnum.IQC, t => t.FileType.Code == "4" || t.FileType.Code == "5") @@ -2676,7 +2676,7 @@ namespace IRaCIS.Core.Application.Service public async Task ClearSkipReadingCache() { - await _fusionCache.RemoveAsync(CacheKeys.SkipReadingCacheKey(_userInfo.Id)); + await _fusionCache.RemoveAsync(CacheKeys.SkipReadingCacheKey(_userInfo.UserRoleId)); return true; } @@ -2689,18 +2689,18 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task SetSkipReadingCache(SetSkipReadingCacheInDto inDto) { - var clearSkipReadingCache = await _fusionCache.GetOrDefaultAsync(CacheKeys.SkipReadingCacheKey(_userInfo.Id)); + var clearSkipReadingCache = await _fusionCache.GetOrDefaultAsync(CacheKeys.SkipReadingCacheKey(_userInfo.UserRoleId)); if (clearSkipReadingCache == null || clearSkipReadingCache == string.Empty) { List cacheIds = new List(); cacheIds.Add(inDto.VisitTaskId); - await _fusionCache.SetAsync(CacheKeys.SkipReadingCacheKey(_userInfo.Id), JsonConvert.SerializeObject(cacheIds), TimeSpan.FromHours(24)); + await _fusionCache.SetAsync(CacheKeys.SkipReadingCacheKey(_userInfo.UserRoleId), JsonConvert.SerializeObject(cacheIds), TimeSpan.FromHours(24)); } else { List? cacheIds = JsonConvert.DeserializeObject>(clearSkipReadingCache); cacheIds.Add(inDto.VisitTaskId); - await _fusionCache.SetAsync(CacheKeys.SkipReadingCacheKey(_userInfo.Id), JsonConvert.SerializeObject(cacheIds), TimeSpan.FromHours(24)); + await _fusionCache.SetAsync(CacheKeys.SkipReadingCacheKey(_userInfo.UserRoleId), JsonConvert.SerializeObject(cacheIds), TimeSpan.FromHours(24)); } return true; } @@ -2731,7 +2731,7 @@ namespace IRaCIS.Core.Application.Service #region 跳过阅片 - var clearSkipReadingCache = await _fusionCache.GetOrDefaultAsync(CacheKeys.SkipReadingCacheKey(_userInfo.Id)); + var clearSkipReadingCache = await _fusionCache.GetOrDefaultAsync(CacheKeys.SkipReadingCacheKey(_userInfo.UserRoleId)); List cacheSkipIds = new List(); @@ -2896,7 +2896,7 @@ namespace IRaCIS.Core.Application.Service } else { - var query = _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.TrialReadingCriterionId == trialReadingCriterionId && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.DoctorUserId == _userInfo.Id + var query = _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.TrialReadingCriterionId == trialReadingCriterionId && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.DoctorUserId == _userInfo.UserRoleId && x.TrialReadingCriterionId == trialReadingCriterionId && x.TaskState == TaskState.Effect) .Where(x=> !cacheSkipIds.Contains(x.Id)); @@ -3071,17 +3071,17 @@ namespace IRaCIS.Core.Application.Service { return true; } - var startReadingTimeKey = _userInfo.Id.ToString() + "StartReadingTime"; - var startRestTimeKey = _userInfo.Id.ToString() + "StartRestTime"; + var startReadingTimeKey = _userInfo.UserRoleId.ToString() + "StartReadingTime"; + var startRestTimeKey = _userInfo.UserRoleId.ToString() + "StartRestTime"; int readingMinute = _verifyConfig.CurrentValue.ContinuousReadingTimeMin; // 为60整数 int restMinute = _verifyConfig.CurrentValue.ReadingRestTimeMin; // - var startReadingTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.StartReadingTimeKey(_userInfo.Id)); - var startRestTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.StartRestTime(_userInfo.Id)); + var startReadingTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.StartReadingTimeKey(_userInfo.UserRoleId)); + var startRestTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.StartRestTime(_userInfo.UserRoleId)); if (startReadingTime == null && startRestTime == null) { - await _fusionCache.SetAsync(CacheKeys.StartReadingTimeKey(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); + await _fusionCache.SetAsync(CacheKeys.StartReadingTimeKey(_userInfo.UserRoleId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); } else if (startRestTime != null) { @@ -3094,8 +3094,8 @@ namespace IRaCIS.Core.Application.Service else { // 休息时间>10分钟 删除休息时间的缓存 记录开始阅片时间 - await _fusionCache.RemoveAsync(CacheKeys.StartRestTime(_userInfo.Id)); - await _fusionCache.SetAsync(CacheKeys.StartReadingTimeKey(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); + await _fusionCache.RemoveAsync(CacheKeys.StartRestTime(_userInfo.UserRoleId)); + await _fusionCache.SetAsync(CacheKeys.StartReadingTimeKey(_userInfo.UserRoleId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); } } @@ -3107,8 +3107,8 @@ namespace IRaCIS.Core.Application.Service int timespanMin = (DateTime.Now - cacheDate).Minutes; if (timespanMin > readingMinute) { - await _fusionCache.RemoveAsync(CacheKeys.StartReadingTimeKey(_userInfo.Id)); - await _fusionCache.SetAsync(CacheKeys.StartRestTime(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); + await _fusionCache.RemoveAsync(CacheKeys.StartReadingTimeKey(_userInfo.UserRoleId)); + await _fusionCache.SetAsync(CacheKeys.StartRestTime(_userInfo.UserRoleId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); throw new BusinessValidationFailedException(_localizer["ReadingImage_NeedRest", readingMinute / 60m, restMinute]); } @@ -3128,26 +3128,26 @@ namespace IRaCIS.Core.Application.Service { if (userID == null) { - userID = _userInfo.Id; + userID = _userInfo.UserRoleId; } //int readingMinute = 120; // 为60整数 int restMinute = 10; // - var startReadingTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.StartReadingTimeKey(_userInfo.Id)); - var startRestTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.StartRestTime(_userInfo.Id)); + var startReadingTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.StartReadingTimeKey(_userInfo.UserRoleId)); + var startRestTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.StartRestTime(_userInfo.UserRoleId)); if (startRestTime != null) { var cacheStartRestTime = DateTime.Parse(startRestTime!.ToString()); int timespanMin = (DateTime.Now - cacheStartRestTime).Minutes; if (timespanMin > restMinute) { - await _fusionCache.RemoveAsync(CacheKeys.StartRestTime(_userInfo.Id)); + await _fusionCache.RemoveAsync(CacheKeys.StartRestTime(_userInfo.UserRoleId)); } } else if (startReadingTime != null) { - await _fusionCache.SetAsync(CacheKeys.StartReadingTimeKey(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); + await _fusionCache.SetAsync(CacheKeys.StartReadingTimeKey(_userInfo.UserRoleId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); } return true; } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadModuleService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadModuleService.cs index 16198fa3e..151a0e22f 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadModuleService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadModuleService.cs @@ -15,7 +15,7 @@ namespace IRaCIS.Core.Application.Service [ApiExplorerSettings(GroupName = "Reading")] public class ReadModuleService(IRepository _subjectVisitRepository, IRepository _subjectRepository, - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _trialRepository, IVisitTaskHelpeService _visitTaskHelpeService, IRepository _visitTaskRepository, @@ -860,7 +860,7 @@ namespace IRaCIS.Core.Application.Service }; readModule.StakeholderIds = stakeholderIds.Distinct().ToList(); - readModule.StakeholderNames = await _userRepository.Where(x => readModule.StakeholderIds.Contains(x.Id)).Select(x => x.FirstName + "/" + x.LastName).ToListAsync(); + readModule.StakeholderNames = await _userRoleRepository.Where(x => readModule.StakeholderIds.Contains(x.Id)).Select(x => x.FirstName + "/" + x.LastName).ToListAsync(); return readModule; } diff --git a/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs b/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs index 4bd2e0754..502f937ed 100644 --- a/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs @@ -27,7 +27,7 @@ namespace IRaCIS.Core.Application.Service public async Task> GetDoctorShortcutKey(DefaultShortcutKeyQuery inQuery) { var shortcutKeyList = await _shortcutKeyRepository.Where(x => x.ImageToolType == inQuery.ImageToolType) - .Where(x => x.UserId == _userInfo.Id) + .Where(x => x.UserId == _userInfo.UserRoleId) .ToListAsync(); var defaultshortcutKeyList = this.GetDefaultShortcutKey(); @@ -302,17 +302,17 @@ namespace IRaCIS.Core.Application.Service var shortcutKeys = GetDefaultShortcutKey(); shortcutKeys.ForEach(x => { - x.UserId = _userInfo.Id; + x.UserId = _userInfo.UserRoleId; }); - await _shortcutKeyRepository.BatchDeleteNoTrackingAsync(x => x.ImageToolType == inDto.ImageToolType && x.UserId == _userInfo.Id); + await _shortcutKeyRepository.BatchDeleteNoTrackingAsync(x => x.ImageToolType == inDto.ImageToolType && x.UserId == _userInfo.UserRoleId); await _shortcutKeyRepository.AddRangeAsync(shortcutKeys.Select(x => new ShortcutKey() { ImageToolType = inDto.ImageToolType, Keyboardkey = x.Keyboardkey, ShortcutKeyEnum = x.ShortcutKeyEnum, - UserId = _userInfo.Id, + UserId = _userInfo.UserRoleId, AltKey = x.AltKey, CtrlKey = x.CtrlKey, MetaKey = x.MetaKey, @@ -332,14 +332,14 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task SetShortcutKey(SetDefaultShortcutKey inDto) { - await _shortcutKeyRepository.BatchDeleteNoTrackingAsync(x => x.ImageToolType == inDto.ImageToolType && x.UserId == _userInfo.Id); + await _shortcutKeyRepository.BatchDeleteNoTrackingAsync(x => x.ImageToolType == inDto.ImageToolType && x.UserId == _userInfo.UserRoleId); await _shortcutKeyRepository.AddRangeAsync(inDto.ShortcutKeyList.Select(x => new ShortcutKey() { ImageToolType = inDto.ImageToolType, Keyboardkey = x.Keyboardkey, ShortcutKeyEnum = x.ShortcutKeyEnum, - UserId = _userInfo.Id, + UserId = _userInfo.UserRoleId, AltKey = x.AltKey, CtrlKey = x.CtrlKey, MetaKey = x.MetaKey, diff --git a/IRaCIS.Core.Application/Service/Reading/ShortcutKey/UserWLTemplateService.cs b/IRaCIS.Core.Application/Service/Reading/ShortcutKey/UserWLTemplateService.cs index 1887c5ade..6a43b2333 100644 --- a/IRaCIS.Core.Application/Service/Reading/ShortcutKey/UserWLTemplateService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ShortcutKey/UserWLTemplateService.cs @@ -15,7 +15,7 @@ namespace IRaCIS.Core.Application.Service /// [ApiExplorerSettings(GroupName = "Reading")] public class UserWLTemplateService(IRepository _userWLTemplateRepository, - IRepository _userRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService + IRepository _userRoleRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService { @@ -28,7 +28,7 @@ namespace IRaCIS.Core.Application.Service public async Task> GetUserWLTemplateList(UserWLTemplateQuery inQuery) { var userWLTemplateQueryable = _userWLTemplateRepository - .Where(x => x.UserId == _userInfo.Id) + .Where(x => x.UserId == _userInfo.UserRoleId) .ProjectTo(_mapper.ConfigurationProvider); return await userWLTemplateQueryable.ToListAsync(); } @@ -40,10 +40,10 @@ namespace IRaCIS.Core.Application.Service /// public async Task AddOrUpdateUserWLTemplate(UserWLTemplateAddOrEdit addOrEditUserWLTemplate) { - addOrEditUserWLTemplate.UserId = _userInfo.Id; + addOrEditUserWLTemplate.UserId = _userInfo.UserRoleId; if (addOrEditUserWLTemplate.Id == null) { - var count = await _userWLTemplateRepository.Where(x => x.UserId == _userInfo.Id).CountAsync(); + var count = await _userWLTemplateRepository.Where(x => x.UserId == _userInfo.UserRoleId).CountAsync(); if (count >= 10) { throw new BusinessValidationFailedException(_localizer["UserWLTS_MaxTemplate"]); @@ -51,12 +51,12 @@ namespace IRaCIS.Core.Application.Service } - if (await _userWLTemplateRepository.AnyAsync(x => x.UserId == _userInfo.Id && x.TemplateName == addOrEditUserWLTemplate.TemplateName && x.Id != addOrEditUserWLTemplate.Id)) + if (await _userWLTemplateRepository.AnyAsync(x => x.UserId == _userInfo.UserRoleId && x.TemplateName == addOrEditUserWLTemplate.TemplateName && x.Id != addOrEditUserWLTemplate.Id)) { throw new BusinessValidationFailedException(_localizer["UserWLTS_NameRepeated"]); } - if (await _userWLTemplateRepository.AnyAsync(x => x.UserId == _userInfo.Id && x.WW == addOrEditUserWLTemplate.WW && x.WL == addOrEditUserWLTemplate.WL && x.Id != addOrEditUserWLTemplate.Id)) + if (await _userWLTemplateRepository.AnyAsync(x => x.UserId == _userInfo.UserRoleId && x.WW == addOrEditUserWLTemplate.WW && x.WL == addOrEditUserWLTemplate.WL && x.Id != addOrEditUserWLTemplate.Id)) { throw new BusinessValidationFailedException(_localizer["UserWLTS_ContentRepeated"]); } @@ -85,7 +85,7 @@ namespace IRaCIS.Core.Application.Service public async Task GetAutoCutNextTask() { - return await _userRepository.Where(x => x.Id == _userInfo.Id).Select(x => new + return await _userRoleRepository.Where(x => x.Id == _userInfo.UserRoleId).Select(x => new { AutoCutNextTask = x.AutoCutNextTask }).FirstNotNullAsync(); @@ -100,13 +100,13 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task SetAutoCutNextTask(SetAutoCutNextTaskInDto inDto) { - await _userRepository.UpdatePartialFromQueryAsync(_userInfo.Id, x => new User() + await _userRoleRepository.UpdatePartialFromQueryAsync(_userInfo.UserRoleId, x => new UserRole() { AutoCutNextTask = inDto.AutoCutNextTask }); - await _userRepository.SaveChangesAsync(); + await _userRoleRepository.SaveChangesAsync(); return ResponseOutput.Ok(); } diff --git a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs index 15258cf36..ad7e72069 100644 --- a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs @@ -38,21 +38,21 @@ namespace IRaCIS.Core.Application.Service CreateMap(); CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) .ForMember(d => d.SystemClinicalQuestionId, opt => opt.MapFrom(src => src.Id)); CreateMap() - .ForMember(d => d.CreateUser, opt => opt.Ignore()) + .ForMember(d => d.CreateUserRole, opt => opt.Ignore()) .ForMember(d => d.SystemClinicalQuestionId, opt => opt.MapFrom(src => src.Id)); CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) .ForMember(d => d.SystemTableQuestionId, u => u.MapFrom(s => s.Id)); CreateMap() .ForMember(d => d.SystemTableQuestionId, opt => opt.MapFrom(src => src.Id)) - .ForMember(d => d.CreateUser, opt => opt.Ignore()); + .ForMember(d => d.CreateUserRole, opt => opt.Ignore()); // 预览 @@ -67,22 +67,22 @@ namespace IRaCIS.Core.Application.Service CreateMap(); CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) .ForAllMembers(opts => opts.Condition((src, dest, srcMember) => srcMember != null)); CreateMap(); - CreateMap().ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + CreateMap().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap(); - CreateMap().ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + CreateMap().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap(); - CreateMap().ReverseMap().ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + CreateMap().ReverseMap().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); - CreateMap().ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + CreateMap().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap().ReverseMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap() @@ -149,16 +149,16 @@ namespace IRaCIS.Core.Application.Service //.ForMember(t=>t.SystemCriterionNameList,u=>u.MapFrom(c=>c.SystemClinicalDataCriterionList.Select(t=>t.SystemReadingCriterion.CriterionName))) //.ForMember(t => t.SystemCriterionIdList, u => u.MapFrom(c => c.SystemClinicalDataCriterionList.Select(t => t.SystemReadingCriterion.Id))); - CreateMap().ReverseMap().ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + CreateMap().ReverseMap().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap(); - CreateMap().ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + CreateMap().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap(); - CreateMap().ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + CreateMap().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap() .ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id)); @@ -174,7 +174,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.QuestionName, u => u.MapFrom(s => isEn_Us ? s.QuestionEnName : s.QuestionName)) .ForMember(d => d.GroupName, u => u.MapFrom(s => isEn_Us ? s.GroupEnName : s.GroupName)) .ForMember(dest => dest.ReadingCriterionPage, opt => opt.Ignore()) - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) .ForMember(dest => dest.ParentReadingQuestionTrial, opt => opt.Ignore()) .ForMember(dest => dest.RelevanceReadingQuestionTrial, opt => opt.Ignore()) .ForMember(dest => dest.ReadingQuestionCriterionTrial, opt => opt.Ignore()); @@ -192,20 +192,20 @@ namespace IRaCIS.Core.Application.Service CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) .ForMember(d => d.QuestionName, u => u.MapFrom(s => isEn_Us ? s.QuestionEnName : s.QuestionName)); CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) .ForMember(d => d.ShowOrder, u => u.MapFrom(s => s.ReadingQuestionTrial.ShowOrder)) .ForMember(d => d.QuestionMark, u => u.MapFrom(s => s.ReadingTableQuestionTrial.QuestionMark)); CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) .ForMember(d => d.QuestionName, u => u.MapFrom(s => isEn_Us ? s.QuestionEnName : s.QuestionName)) .ForMember(d => d.GroupName, u => u.MapFrom(s => isEn_Us ? s.GroupEnName : s.GroupName)) .ForMember(d => d.PageShowOrder, u => u.MapFrom(s => s.ReadingCriterionPage.ShowOrder)) .ForMember(d => d.PageName, u => u.MapFrom(s => s.ReadingCriterionPage.PageName)) - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) .ForMember(d => d.IsPublicPage, u => u.MapFrom(s => s.ReadingCriterionPage.IsPublicPage)); CreateMap() @@ -218,13 +218,13 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.QuestionName, u => u.MapFrom(s => isEn_Us ? s.QuestionEnName : s.QuestionName)); CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) .ForMember(d => d.DependShowOrder, u => u.MapFrom(s => s.DependParentQuestion.ShowOrder)); CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) .ForMember(d => d.DependShowOrder, u => u.MapFrom(s => s.DependParentQuestion.ShowOrder)); CreateMap(); @@ -243,66 +243,66 @@ namespace IRaCIS.Core.Application.Service CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) .ForMember(d => d.DependShowOrder, u => u.MapFrom(s => s.DependParentQuestion.ShowOrder)) - .ForMember(d => d.CreateUser, u => u.Ignore()); - CreateMap().ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + .ForMember(d => d.CreateUserRole, u => u.Ignore()); + CreateMap().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); - CreateMap().ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + CreateMap().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); - CreateMap().ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + CreateMap().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap() - .ForMember(d => d.CreateUser, u => u.Ignore()); + .ForMember(d => d.CreateUserRole, u => u.Ignore()); CreateMap() ; CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) .ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id)); CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) .ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id)); CreateMap() - .ForMember(d => d.CreateUser, u => u.Ignore()) + .ForMember(d => d.CreateUserRole, u => u.Ignore()) .ForMember(d => d.ReadingTableQuestionTrialList, u => u.Ignore()) .ForMember(d => d.ReadingQuestionSystemId, u => u.MapFrom(s => s.Id)); CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) .ForMember(d => d.MergeName, u => u.MapFrom(s => s.MergeRow == null ? string.Empty : s.MergeRow.ReadingQuestionTrial.OrderMark + s.MergeRow.RowIndex.GetLesionMark())) .ForMember(d => d.SplitName, u => u.MapFrom(s => s.SplitRow == null ? string.Empty : s.SplitRow.ReadingQuestionTrial.OrderMark + s.SplitRow.RowIndex.GetLesionMark())) .ForMember(d => d.LesionType, u => u.MapFrom(s => s.ReadingQuestionTrial == null ? null : s.ReadingQuestionTrial.LesionType)); CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) .ForMember(dest => dest.DependParentQuestion, opt => opt.Ignore()) .ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id)) .ForMember(d => d.SystemTableQuestionId, u => u.MapFrom(s => s.Id)); CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) .ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id)); CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) ; CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) .ForMember(dest => dest.ReadingQuestionTrialList, opt => opt.Ignore()) - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()) .ForMember(d => d.ReadingQuestionCriterionSystemId, u => u.MapFrom(s => s.Id)); CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap() .ForMember(d => d.QuestionCount, u => u.MapFrom(s => s.ReadingQuestionSystemList.Count())); @@ -312,7 +312,7 @@ namespace IRaCIS.Core.Application.Service CreateMap(); CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap() .ForMember(d => d.GroupName, u => u.MapFrom(s => s.GroupInfo == null ? s.GroupName : s.GroupInfo.GroupName)) @@ -326,14 +326,14 @@ namespace IRaCIS.Core.Application.Service CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap() .ForMember(d => d.QuestionCount, u => u.MapFrom(s => s.ReadingQuestionTrialList.Count())); CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap() .ForMember(d => d.GroupName, u => u.MapFrom(s => s.GroupInfo == null ? s.GroupName : s.GroupInfo.GroupName)) @@ -363,17 +363,17 @@ namespace IRaCIS.Core.Application.Service #region 医学审核 CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap() .ForMember(x => x.ParentShowOrder, y => y.MapFrom(n => n.ParentQuestion.ShowOrder)); CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap() .ForMember(x => x.ParentShowOrder, y => y.MapFrom(n => n.ParentQuestion.ShowOrder)); @@ -386,7 +386,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() //.ForMember(x => x.FileList, y => y.MapFrom(n => n.FileList)) - .ForMember(x => x.CreateUserName, y => y.MapFrom(n => n.CreateUser.UserName)); + .ForMember(x => x.CreateUserName, y => y.MapFrom(n => n.CreateUserRole.UserName)); #endregion @@ -395,10 +395,10 @@ namespace IRaCIS.Core.Application.Service CreateMap(); CreateMap(); CreateMap().ReverseMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap(); #endregion @@ -411,15 +411,15 @@ namespace IRaCIS.Core.Application.Service CreateMap().ReverseMap(); CreateMap().ReverseMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap().ReverseMap() - .ForMember(dest => dest.CreateUser, opt => opt.Ignore()); + .ForMember(dest => dest.CreateUserRole, opt => opt.Ignore()); CreateMap().ReverseMap(); CreateMap() .ForMember(o => o.UploadedTime, t => t.MapFrom(u => u.CreateTime)) - .ForMember(o => o.Uploader, t => t.MapFrom(u => u.CreateUser.LastName + " / " + u.CreateUser.FirstName)) + .ForMember(o => o.Uploader, t => t.MapFrom(u => u.CreateUserRole.LastName + " / " + u.CreateUserRole.FirstName)) .ForMember(o => o.StudyId, t => t.MapFrom(u => u.Id)); CreateMap() diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 38579bf71..d931707ce 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -31,7 +31,7 @@ namespace IRaCIS.Core.Application.Contracts [ApiExplorerSettings(GroupName = "Trial")] public class TrialSiteSurveyService(IRepository _trialSiteSurveyRepository, IRepository _trialSiteUserSurveyRepository, - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _trialRepository, IRepository _trialSiteRepository, IRepository _doctorRepository, @@ -81,7 +81,7 @@ namespace IRaCIS.Core.Application.Contracts public async Task UseUserIDGetDoctorID(UseUserIDGetDoctorIDInDto inDto) { - var userinfo = await _userRepository.Where(x => x.Id == inDto.UserID).FirstOrDefaultAsync(); + var userinfo = await _userRoleRepository.Where(x => x.Id == inDto.UserID).FirstOrDefaultAsync(); if (userinfo != null && userinfo.DoctorId != null) { @@ -100,7 +100,7 @@ namespace IRaCIS.Core.Application.Contracts var info = await _doctorRepository.AddAsync(doctor, true); - await _userRepository.BatchUpdateNoTrackingAsync(x => x.Id == inDto.UserID, x => new User() + await _userRoleRepository.BatchUpdateNoTrackingAsync(x => x.Id == inDto.UserID, x => new UserRole() { DoctorId = info.Id @@ -226,7 +226,7 @@ namespace IRaCIS.Core.Application.Contracts var info = await _doctorRepository.AddAsync(doctor, true); - //await _userRepository.BatchUpdateNoTrackingAsync(x => x.EMail == inDto.EmailOrPhone, x => new User() + //await _userRoleRepository.BatchUpdateNoTrackingAsync(x => x.EMail == inDto.EmailOrPhone, x => new User() //{ // DoctorId = info.DoctorId, @@ -695,7 +695,7 @@ namespace IRaCIS.Core.Application.Contracts { ////PM 给SPM发 (初审人) - //user = await _userRepository.FirstOrDefaultAsync(t => t.Id == survey.PreliminaryUserId); + //user = await _userRoleRepository.FirstOrDefaultAsync(t => t.Id == survey.PreliminaryUserId); //messageToSend.To.Add(new MailboxAddress(String.Empty, survey.PreliminaryUserId == null ? survey.Email : user.EMail)); @@ -832,7 +832,7 @@ namespace IRaCIS.Core.Application.Contracts else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM) { - await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.CRCSubmitted, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved, PreliminaryUserId = _userInfo.Id, PreliminaryTime = DateTime.Now }); + await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.CRCSubmitted, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved, PreliminaryUserId = _userInfo.UserRoleId, PreliminaryTime = DateTime.Now }); } else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM) @@ -873,7 +873,7 @@ namespace IRaCIS.Core.Application.Contracts { //找下系统中是否存在该用户类型的 并且邮箱 或者手机的账户 - var sysUserInfo = await _userRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync(); + var sysUserInfo = await _userRoleRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync(); if (sysUserInfo == null) @@ -883,7 +883,7 @@ namespace IRaCIS.Core.Application.Contracts using (await @lock.AcquireAsync()) { - var saveItem = _mapper.Map(item); + var saveItem = _mapper.Map(item); if (trialType == TrialType.NoneOfficial) @@ -893,9 +893,9 @@ namespace IRaCIS.Core.Application.Contracts // 中心调研生成账号 都是外部的 saveItem.IsZhiZhun = false; - saveItem.Code = _userRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; + saveItem.Code = _userRoleRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; - saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(User)); + saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(UserRole)); saveItem.UserName = saveItem.UserCode; @@ -904,10 +904,10 @@ namespace IRaCIS.Core.Application.Contracts saveItem.UserTypeEnum = _userTypeRepository.Where(t => t.Id == saveItem.UserTypeId).Select(t => t.UserTypeEnum).First(); - var newUser = _userRepository.AddAsync(saveItem).Result; + var newUser = _userRoleRepository.AddAsync(saveItem).Result; - _ = _userRepository.SaveChangesAsync().Result; + _ = _userRoleRepository.SaveChangesAsync().Result; sysUserInfo = newUser; @@ -983,15 +983,15 @@ namespace IRaCIS.Core.Application.Contracts findTrialSiteUser.DeletedTime = null; } - await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable }); + await _userRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new UserRole() { Status = UserStateEnum.Enable }); await _trialSiteUserSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == userInfo.Id, u => new TrialSiteUserSurvey() { IsJoin = true }); } - await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurvey.Id && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock, ReviewerUserId = _userInfo.Id, ReviewerTime = DateTime.Now }); + await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurvey.Id && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock, ReviewerUserId = _userInfo.UserRoleId, ReviewerTime = DateTime.Now }); - await _userRepository.SaveChangesAsync(); + await _userRoleRepository.SaveChangesAsync(); return ResponseOutput.Ok(); @@ -1027,7 +1027,7 @@ namespace IRaCIS.Core.Application.Contracts foreach (var item in list) { //找下系统中是否存在该用户类型的 并且邮箱 或者手机的账户 - var sysUserInfo = await _userRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync(); + var sysUserInfo = await _userRoleRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync(); if (sysUserInfo == null) { @@ -1036,7 +1036,7 @@ namespace IRaCIS.Core.Application.Contracts using (await @lock.AcquireAsync()) { - var saveItem = _mapper.Map(item); + var saveItem = _mapper.Map(item); if (trialType == TrialType.NoneOfficial) @@ -1046,17 +1046,17 @@ namespace IRaCIS.Core.Application.Contracts // 中心调研生成账号 都是外部的 saveItem.IsZhiZhun = false; - saveItem.Code = _userRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; + saveItem.Code = _userRoleRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; - saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(User)); + saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(UserRole)); saveItem.UserName = saveItem.UserCode; //saveItem.UserTypeEnum = _userTypeRepository.Where(t => t.Id == saveItem.UserTypeId).Select(t => t.UserTypeEnum).First(); - var newUser = _userRepository.AddAsync(saveItem).Result; + var newUser = _userRoleRepository.AddAsync(saveItem).Result; - _ = _userRepository.SaveChangesAsync().Result; + _ = _userRoleRepository.SaveChangesAsync().Result; sysUserInfo = newUser; @@ -1104,7 +1104,7 @@ namespace IRaCIS.Core.Application.Contracts findTrialSiteUser.DeletedTime = null; } - await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable }); + await _userRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new UserRole() { Status = UserStateEnum.Enable }); await _trialSiteUserRepository.SaveChangesAsync(); diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs index 8b1e2f849..2f4008ac8 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs @@ -16,7 +16,7 @@ namespace IRaCIS.Core.Application.Contracts [ApiExplorerSettings(GroupName = "Trial")] public class TrialSiteUserSurveyService(IRepository _trialSiteUserSurveyRepository, IRepository _trialRepository, - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _trialSiteSurveyRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITrialSiteUserSurveyService { @@ -56,7 +56,7 @@ namespace IRaCIS.Core.Application.Contracts var item = addOrEditTrialSiteUserSurvey; //找下系统中是否存在该用户类型的 并且邮箱 或者手机的账户 - var sysUserInfo = await _userRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync(); + var sysUserInfo = await _userRoleRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync(); if (sysUserInfo != null) { @@ -97,7 +97,7 @@ namespace IRaCIS.Core.Application.Contracts if (addOrEditTrialSiteUserSurvey.UserTypeId != null) { - var existSysUser = await _userRepository.Where(t => t.EMail == addOrEditTrialSiteUserSurvey.Email && t.UserTypeId == addOrEditTrialSiteUserSurvey.UserTypeId).Include(d => d.UserTypeRole).FirstOrDefaultAsync(); + var existSysUser = await _userRoleRepository.Where(t => t.EMail == addOrEditTrialSiteUserSurvey.Email && t.UserTypeId == addOrEditTrialSiteUserSurvey.UserTypeId).Include(d => d.UserTypeRole).FirstOrDefaultAsync(); if (existSysUser != null) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs index fdf43fac5..38de835b5 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs @@ -35,7 +35,7 @@ namespace IRaCIS.Core.Application.AutoMapper .ForMember(d => d.IsGenerateSuccess, u => u.MapFrom(c => true)) .ForMember(d => d.SystemUserId, u => u.MapFrom(c => c.UserId)) .ForMember(d => d.IsJoin, u => u.MapFrom(c => !c.IsDeleted)) - .ForMember(d => d.CreateUser, u => u.Ignore()); + .ForMember(d => d.CreateUserRole, u => u.Ignore()); //列表 @@ -74,16 +74,16 @@ namespace IRaCIS.Core.Application.AutoMapper - CreateMap(); + CreateMap(); - CreateMap() + CreateMap() .ForMember(d => d.EMail, u => u.MapFrom(s => s.Email)); - CreateMap(); + CreateMap(); - CreateMap().ForMember(d => d.RealName, u => u.MapFrom(s => s.LastName + " / " + s.FirstName)); + CreateMap().ForMember(d => d.RealName, u => u.MapFrom(s => s.LastName + " / " + s.FirstName)); diff --git a/IRaCIS.Core.Application/Service/Stat/StatisticsService.cs b/IRaCIS.Core.Application/Service/Stat/StatisticsService.cs index f662d038d..55839c7dd 100644 --- a/IRaCIS.Core.Application/Service/Stat/StatisticsService.cs +++ b/IRaCIS.Core.Application/Service/Stat/StatisticsService.cs @@ -18,7 +18,7 @@ namespace IRaCIS.Core.Application.Service IRepository _dictionaryRepository, IRepository _hospitalRepository, IRepository _enrollDetailRepository, - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _userTrialRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IStatisticsService { @@ -48,7 +48,7 @@ namespace IRaCIS.Core.Application.Service else //不管是精鼎的pm还是我们的pm 还是运维人员 只能看到自己参与项目的统计 { - List trialIdList = _userTrialRepository.Where(u => u.UserId == _userInfo.Id).Select(u => u.TrialId).ToList(); + List trialIdList = _userTrialRepository.Where(u => u.UserId == _userInfo.UserRoleId).Select(u => u.TrialId).ToList(); trialLambda = trialLambda.And(u => trialIdList.Contains(u.Id)); } if (!string.IsNullOrWhiteSpace(inQuery.TrialCode)) @@ -370,7 +370,7 @@ namespace IRaCIS.Core.Application.Service public PageOutput GetParticipateTrialStat(ParticipateQueryDto param) { - Expression> userLambda = x => true; + Expression> userLambda = x => true; Expression> userTrialLambda = x => true; if (!string.IsNullOrEmpty(param.UserInfo)) { @@ -385,7 +385,7 @@ namespace IRaCIS.Core.Application.Service } var userTypeEnumStr = _userInfo.UserTypeEnumStr; - var userId = _userInfo.Id; + var userId = _userInfo.UserRoleId; //PM 进来只能看到他负责的项目下的参与人员列表 @@ -406,7 +406,7 @@ namespace IRaCIS.Core.Application.Service }); var userQuery = from trialStat in trialStatQuery - join user in _userRepository.Where(userLambda) on trialStat.UserId equals user.Id + join user in _userRoleRepository.Where(userLambda) on trialStat.UserId equals user.Id select new UserParticipateTrialStat { Email = user.EMail, @@ -441,7 +441,7 @@ namespace IRaCIS.Core.Application.Service Expression> userTrialLambda = x => x.UserId == userId; var userTypeEnum = _userInfo.UserTypeEnumStr; - var loginUserId = _userInfo.Id; + var loginUserId = _userInfo.UserRoleId; //PM 进来只能看到他负责的项目下的参与人员列表 diff --git a/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs b/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs index 7e6c03113..38845d607 100644 --- a/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs +++ b/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs @@ -41,7 +41,7 @@ namespace IRaCIS.Core.Application.Service.Third_partyProject .WhereIf(!string.IsNullOrEmpty(inQuery.Code), o => o.TrialCode.Contains(inQuery.Code)) .WhereIf(!string.IsNullOrEmpty(inQuery.ResearchProgramNo), o => o.ResearchProgramNo.Contains(inQuery.ResearchProgramNo)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.ExperimentName), o => o.ExperimentName.Contains(inQuery.ExperimentName)) - .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin, t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id && t.IsDeleted == false) && t.IsDeleted == false) + .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin, t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId && t.IsDeleted == false) && t.IsDeleted == false) .Select(t => new TrialListDTO_UltrasonicDicom() { TrialId = t.Id, @@ -123,7 +123,7 @@ namespace IRaCIS.Core.Application.Service.Third_partyProject TrialSiteCode = dicomStudy.Subject.TrialSite.TrialSiteCode, - Uploader = dicomStudy.CreateUser.UserName, + Uploader = dicomStudy.CreateUserRole.UserName, UploadTime = dicomStudy.CreateTime }; diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs index d41bdbca1..87f59f8ab 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs @@ -39,10 +39,10 @@ namespace IRaCIS.Core.Application { return await _trialRepository .Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM, c => c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.SPMApproved).Count() > 0) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM, c => c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.CRCSubmitted).Count() > 0) - .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id }) + .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.UserRoleId }) .OrderByDescending(t => t.ApprovalRequiredCount).ToPagedListAsync(inQuery); } @@ -70,10 +70,10 @@ namespace IRaCIS.Core.Application else { var trialDocStat = await _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .WhereIf(!_userInfo.IsAdmin, c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .WhereIf(!_userInfo.IsAdmin, c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId && t.ConfirmTime != null)) .Count() > 0) - .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id, userTypeId = _userInfo.UserTypeId }) + .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.UserRoleId, userTypeId = _userInfo.UserTypeId }) .OrderByDescending(t => t.WaitSignCount) .ToPagedListAsync(inQuery); @@ -101,7 +101,7 @@ namespace IRaCIS.Core.Application var query = _trialRepository .Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new CheckToBeDoneDto() { TrialId = t.Id, @@ -122,11 +122,11 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery, defalutSortArray); var totalToBeCheckedCount = await _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(u => u.CheckState == CheckStateEnum.ToCheck).CountAsync(); var totalToBeRepliedCount = await _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeDialogList.OrderByDescending(t => t.CreateTime).First().UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).CountAsync(); @@ -148,7 +148,7 @@ namespace IRaCIS.Core.Application { var query = _visitTaskReReadingRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed) .GroupBy(t => new { t.OriginalReReadingTask.Trial.ExperimentName, t.OriginalReReadingTask.Trial.ResearchProgramNo, t.OriginalReReadingTask.Trial.TrialCode, t.OriginalReReadingTask.TrialId }) .Select(g => new ReReadingApplyToBeDoneDto() @@ -169,7 +169,7 @@ namespace IRaCIS.Core.Application var toBeApprovalCount = _visitTaskReReadingRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed).Count(); return ResponseOutput.Ok(result, new { TotalToBeApprovalCount = toBeApprovalCount }); @@ -190,7 +190,7 @@ namespace IRaCIS.Core.Application [FromServices] IRepository _trialRepository) { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new ReviewerSelectToBeDoneDto() { TrialId = t.Id, @@ -208,7 +208,7 @@ namespace IRaCIS.Core.Application var toBeApprovalCount = await _enrollRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(u => u.EnrollStatus == EnrollStatus.HasCommittedToCRO).CountAsync(); return ResponseOutput.Ok(result, new { ToBeApprovalCount = toBeApprovalCount }); ; @@ -226,7 +226,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new GetPMClinicalDataToBeDoneListOutDto() { TrialId = t.Id, @@ -246,7 +246,7 @@ namespace IRaCIS.Core.Application var all = await _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new GetPMClinicalDataToBeDoneListOutDto() { @@ -275,7 +275,7 @@ namespace IRaCIS.Core.Application [FromServices] IRepository _trialRepository) { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new ReviewerSelectToBeDoneDto() { TrialId = t.Id, @@ -294,7 +294,7 @@ namespace IRaCIS.Core.Application var toBeApprovalCount = await _enrollRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(u => u.EnrollStatus == EnrollStatus.HasCommittedToCRO).CountAsync(); return ResponseOutput.Ok(result, new { TotalToBeApprovalCount = toBeApprovalCount }); ; @@ -315,7 +315,7 @@ namespace IRaCIS.Core.Application { var query = _visitTaskReReadingRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed) .GroupBy(t => new { t.OriginalReReadingTask.Trial.ExperimentName, t.OriginalReReadingTask.Trial.ResearchProgramNo, t.OriginalReReadingTask.Trial.TrialCode, t.OriginalReReadingTask.TrialId }) .Select(g => new ReReadingApprovalToBeDoneDto() @@ -336,7 +336,7 @@ namespace IRaCIS.Core.Application var toBeApprovalCount = _visitTaskReReadingRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed).Count(); return ResponseOutput.Ok(result, new { TotalToBeApprovalCount = toBeApprovalCount }); @@ -363,7 +363,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) //.Where(t => t.clinicalDataTrialSets.Any(t => t.ClinicalDataLevel == ClinicalLevel.Subject && t.IsConfirm)) .Select(t => new ImageClinicalDataToBeDoneDto() { @@ -405,7 +405,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) //.Where(t => t.clinicalDataTrialSets.Any(t => t.ClinicalDataLevel == ClinicalLevel.Subject && t.IsConfirm)) .Select(t => new ImageClinicalDataToBeDoneDto() { @@ -466,7 +466,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new ImageQuestionToBeDoneDto() { TrialId = t.Id, @@ -474,11 +474,11 @@ namespace IRaCIS.Core.Application ExperimentName = t.ExperimentName, TrialCode = t.TrialCode, - UrgentCount = t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + UrgentCount = t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .SelectMany(c => c.QCChallengeList) .Where(u => u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC && u.SubjectVisit.IsUrgent).Count(), - ToBeDealedCount = t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + ToBeDealedCount = t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .SelectMany(c => c.QCChallengeList) .Where(u => u.IsClosed == false && (u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC || u.LatestReplyUserId == null)).Count(), @@ -491,8 +491,8 @@ namespace IRaCIS.Core.Application var toBeDealedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .SelectMany(c => c.QCChallengeList) .Where(u => u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC).Count(); @@ -514,7 +514,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new ImageCheckQuestionToBeDoneDto() { TrialId = t.Id, @@ -522,10 +522,10 @@ namespace IRaCIS.Core.Application ExperimentName = t.ExperimentName, TrialCode = t.TrialCode, - UrgentCount = t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + UrgentCount = t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply && u.IsUrgent).Count(), - ToBeReplyedCount = t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + ToBeReplyedCount = t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply).Count() }).Where(x => x.ToBeReplyedCount > 0); @@ -537,8 +537,8 @@ namespace IRaCIS.Core.Application var toBeDealedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply).Count(); return ResponseOutput.Ok(result, new { TotalToBeReplyedCount = toBeDealedCount }); @@ -560,7 +560,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new ImageReUploadToBeDoneDto() { TrialId = t.Id, @@ -568,11 +568,11 @@ namespace IRaCIS.Core.Application ExperimentName = t.ExperimentName, TrialCode = t.TrialCode, UrgentCount = t.SubjectVisitList - .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.IsUrgent && ((u.SubmitState == SubmitStateEnum.ToSubmit && u.IsPMBackOrReReading) || u.IsQCConfirmedReupload)).Count(), ToBeReUploadCount = t.SubjectVisitList - .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => (u.SubmitState == SubmitStateEnum.ToSubmit && u.IsPMBackOrReReading) || (u.IsQCConfirmedReupload)).Count(), }).Where(x => x.ToBeReUploadCount > 0); @@ -583,7 +583,7 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery, defalutSortArray); var toBeDealedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(u => (u.SubmitState == SubmitStateEnum.ToSubmit && u.IsPMBackOrReReading) || (u.IsQCConfirmedReupload)).Count(); return ResponseOutput.Ok(result, new { TotalToBeReUploadCount = toBeDealedCount }); @@ -607,7 +607,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id) && (t.IsUrgent || t.IsSubjectExpeditedView || t.IsEnrollementQualificationConfirm || t.IsPDProgressView)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId) && (t.IsUrgent || t.IsSubjectExpeditedView || t.IsEnrollementQualificationConfirm || t.IsPDProgressView)) .Select(t => new ImageSubmittedToBeDoneDto() { TrialId = t.Id, @@ -615,12 +615,12 @@ namespace IRaCIS.Core.Application ExperimentName = t.ExperimentName, TrialCode = t.TrialCode, UrgentCount = t.SubjectVisitList - .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.SubmitState == SubmitStateEnum.ToSubmit && (u.IsEnrollmentConfirm || u.PDState == PDStateEnum.PDProgress || u.Trial.IsUrgent || u.Subject.IsUrgent)/*u.IsUrgent*/).Count(), ToBeDealedCount = t.SubjectVisitList - .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.SubmitState == SubmitStateEnum.ToSubmit).Count(), }).Where(x => x.ToBeDealedCount > 0); @@ -633,8 +633,8 @@ namespace IRaCIS.Core.Application var toBeDealedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.SubmitState == SubmitStateEnum.ToSubmit).Count(); return ResponseOutput.Ok(result, new { TotalToBeDealedCount = toBeDealedCount }); @@ -663,7 +663,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.QCProcessEnum != TrialQCProcess.NotAudit) .Select(t => new ImageQualityToBeDoneDto() { @@ -673,15 +673,15 @@ namespace IRaCIS.Core.Application TrialCode = t.TrialCode, // 待审核 加急的(待领取 已领取)-- 领取了 还没做完 就是待审核 - UrgentCount = t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id && u.IsUrgent).Count(), + UrgentCount = t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.UserRoleId && u.IsUrgent).Count(), //待领取量 ToBeClaimedCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted && t.AuditState != AuditStateEnum.QCPassed && t.AuditState != AuditStateEnum.QCFailed) - .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count(), + .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.UserRoleId && u.ReviewAuditUserId == null))).Count(), //待审核通过,统计从已领取到QC提交之间的 已领取 待审核 审核中 (审核完成 领取人就会清理 所以只用查询当前领取人是自己的就好了) - ToBeReviewedCount = t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id).Count() + ToBeReviewedCount = t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.UserRoleId).Count() }).Where(x => x.ToBeClaimedCount + x.ToBeReviewedCount > 0); @@ -693,13 +693,13 @@ namespace IRaCIS.Core.Application var toBeClaimedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id) && t.SubmitState == SubmitStateEnum.Submitted && t.AuditState != AuditStateEnum.QCPassed && t.AuditState != AuditStateEnum.QCFailed) - .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count(); + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId) && t.SubmitState == SubmitStateEnum.Submitted && t.AuditState != AuditStateEnum.QCPassed && t.AuditState != AuditStateEnum.QCFailed) + .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.UserRoleId && u.ReviewAuditUserId == null))).Count(); var toBeReviwedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(u => u.CurrentActionUserId == _userInfo.Id).Count(); + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(u => u.CurrentActionUserId == _userInfo.UserRoleId).Count(); return ResponseOutput.Ok(result, new { TotalToBeClaimedCount = toBeClaimedCount, TotalToBeReviewedCount = toBeReviwedCount }); @@ -721,7 +721,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new ImageQuestionToBeDoneDto() { TrialId = t.Id, @@ -729,10 +729,10 @@ namespace IRaCIS.Core.Application ExperimentName = t.ExperimentName, TrialCode = t.TrialCode, UrgentCount = t.SubjectVisitList.SelectMany(c => c.QCChallengeList) - .Where(u => u.CreateUserId == _userInfo.Id && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator && u.SubjectVisit.IsUrgent).Count(), + .Where(u => u.CreateUserId == _userInfo.UserRoleId && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator && u.SubjectVisit.IsUrgent).Count(), ToBeDealedCount = t.SubjectVisitList.SelectMany(c => c.QCChallengeList) - .Where(u => u.CreateUserId == _userInfo.Id && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count(), + .Where(u => u.CreateUserId == _userInfo.UserRoleId && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count(), }).Where(x => x.ToBeDealedCount > 0); ; @@ -742,9 +742,9 @@ namespace IRaCIS.Core.Application var toBeDealedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .SelectMany(c => c.QCChallengeList) - .Where(u => u.CreateUserId == _userInfo.Id && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count(); + .Where(u => u.CreateUserId == _userInfo.UserRoleId && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count(); return ResponseOutput.Ok(result, new { TotalToBeDealedCount = toBeDealedCount }); @@ -775,7 +775,7 @@ namespace IRaCIS.Core.Application { - var newQuery = _trialReadingCriterionRepository.Where(t => t.IsSigned && t.IsConfirm && t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + var newQuery = _trialReadingCriterionRepository.Where(t => t.IsSigned && t.IsConfirm && t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(c => new IRImageReadingToBeDoneDto() { TrialId = c.TrialId, @@ -785,7 +785,7 @@ namespace IRaCIS.Core.Application CriterionName = c.CriterionName, TrialReadingCriterionId = c.Id, - UrgentCount = c.VisitTaskList.AsQueryable().Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) + UrgentCount = c.VisitTaskList.AsQueryable().Where(t => t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) // 前序 不存在 未一致性核查未通过的 .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) //前序 不存在 未生成任务的访视 @@ -795,7 +795,7 @@ namespace IRaCIS.Core.Application .Count(t => t.IsUrgent), - UnReadCount = c.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) + UnReadCount = c.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) // 前序 不存在 未一致性核查未通过的 .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) //前序 不存在 未生成任务的访视 @@ -807,7 +807,7 @@ namespace IRaCIS.Core.Application - HaveSignedCount = c.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.Id && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze) + HaveSignedCount = c.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.UserRoleId && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze) && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count(), }).Where(x => x.UnReadCount > 0); @@ -885,9 +885,9 @@ namespace IRaCIS.Core.Application var result = await newQuery.ToPagedListAsync(inQuery, defalutSortArray); var toBeDealedCount = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .SelectMany(t => t.VisitTaskList) - .Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect && t.TrialReadingCriterion.IsSigned == true && t.TrialReadingCriterion.IsConfirm == true) + .Where(t => t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect && t.TrialReadingCriterion.IsSigned == true && t.TrialReadingCriterion.IsConfirm == true) // 前序 不存在 未一致性核查未通过的 .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) //前序 不存在 未生成任务的访视 @@ -913,8 +913,8 @@ namespace IRaCIS.Core.Application { var query = _taskMedicalReviewRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.VisitTask.DoctorUserId == _userInfo.Id) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.VisitTask.DoctorUserId == _userInfo.UserRoleId) .GroupBy(t => new { t.TrialId, @@ -957,8 +957,8 @@ namespace IRaCIS.Core.Application var toBeDealedCount = _taskMedicalReviewRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.IsClosedDialog == false && t.VisitTask.DoctorUserId == _userInfo.Id) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(t => t.IsClosedDialog == false && t.VisitTask.DoctorUserId == _userInfo.UserRoleId) .Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.MIM) //.Where(u => u.ReadingMedicalReviewDialogList.OrderByDescending(l => l.CreateTime).First().UserTypeEnumInt == (int)UserTypeEnum.MIM) .Count(); @@ -990,8 +990,8 @@ namespace IRaCIS.Core.Application #region 废弃不能对包含聚合或子查询的表达式执行聚合函数 var query = _taskMedicalReviewRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .GroupBy(t => new { t.TrialId, @@ -1028,16 +1028,16 @@ namespace IRaCIS.Core.Application var toBeReplyedQuery = _taskMedicalReviewRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IndependentReviewer && u.AuditState == MedicalReviewAuditState.Auditing); var toBeReplyedCount = toBeReplyedQuery.Count(); var tobeReviewedCount = _taskMedicalReviewRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .Where(u => u.AuditState != MedicalReviewAuditState.HaveSigned && u.LatestReplyUser.UserTypeEnum != UserTypeEnum.IndependentReviewer).Count(); @@ -1089,9 +1089,9 @@ namespace IRaCIS.Core.Application if (!_userInfo.IsAdmin) { var list = await _trialRepository.Where(t => t.TrialStatusStr != StaticData.TrialState.TrialStopped) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .WhereIf(!_userInfo.IsAdmin, c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) && - !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)).Count() > 0) + !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId && t.ConfirmTime != null)).Count() > 0) .Select(t => t.Id).ToListAsync(); return list; @@ -1115,30 +1115,30 @@ namespace IRaCIS.Core.Application var isInternal = _userInfo.IsZhiZhun; var needSignTrialCount = await _trialRepository.Where(t => t.TrialStatusStr != StaticData.TrialState.TrialStopped) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) - && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)).Count() > 0).CountAsync(); + && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId && t.ConfirmTime != null)).Count() > 0).CountAsync(); var needSignSysDocCont = await _systemDocumentRepository - .Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)) + .Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId && t.ConfirmTime != null)) //外部人员 只签署 文档类型枚举值有值的 .WhereIf(isInternal == false, t => t.DocUserSignType == DocUserSignType.InnerAndOuter) .SelectMany(t => t.NeedConfirmedUserTypeList) .CountAsync(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId); var signedTrialCount = await _trialDocumentRepository.AsQueryable(true) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - .Where(t => t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)).CountAsync(); + .Where(t => t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId && t.ConfirmTime != null)).CountAsync(); var signedSysDocCont = await _systemDocumentRepository - .Where(t => t.IsDeleted == false && t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)) + .Where(t => t.IsDeleted == false && t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.UserRoleId && t.ConfirmTime != null)) .SelectMany(t => t.NeedConfirmedUserTypeList) .CountAsync(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId); var siteSurveyCount = await _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM, c => c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.SPMApproved).Count() > 0) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM, c => c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.CRCSubmitted).Count() > 0) .CountAsync(); @@ -1178,7 +1178,7 @@ namespace IRaCIS.Core.Application SysSignedDocCount = signedSysDocCont, SysNoticeUnReadCount = await _systemNoticeRepository.Where(t => t.NoticeUserTypeList.Any(t => t.UserTypeId == _userInfo.UserTypeId) && t.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.HavePublished - && !t.NoticeUserReadList.Any(t => t.CreateUserId == _userInfo.Id)) + && !t.NoticeUserReadList.Any(t => t.CreateUserId == _userInfo.UserRoleId)) .Where(t => t.EndDate == null || t.EndDate != null && t.EndDate > appDateTimeNow) .CountAsync(), @@ -1187,16 +1187,16 @@ namespace IRaCIS.Core.Application PM_SiteSurveryCount = isPM ? siteSurveyCount : 0, PM_CheckCount = isPM ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(u => u.SubjectVisitList.Any(t => t.CheckState == CheckStateEnum.ToCheck || (t.CheckState == CheckStateEnum.CVIng && t.CheckChallengeDialogList.OrderByDescending(t => t.CreateTime).First().UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator))).CountAsync() : 0, PM_ReviewerSelectCount = isPM ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.EnrollList.Where(u => u.EnrollStatus == EnrollStatus.InviteIntoGroup).Count() > 0).CountAsync() : 0, PM_ReReadingApprovalCount = isPM ? await _visitTaskReReadingRepository - .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed) .GroupBy(t => t.OriginalReReadingTask.TrialId) .Select(g => new ReReadingApplyToBeDoneDto() @@ -1207,7 +1207,7 @@ namespace IRaCIS.Core.Application }).Where(x => x.ToBeApprovalCount > 0).CountAsync() : 0, PM_ClinicalDataCount = isPM ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.ReadModuleList.Where(u => u.IsCRCConfirm && !u.IsPMConfirm).Count() > 0).CountAsync() : 0, #endregion @@ -1215,34 +1215,34 @@ namespace IRaCIS.Core.Application #region CRC CRC_ImageSubmitCount = isCRC ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id) && (t.IsUrgent || t.IsSubjectExpeditedView || t.IsEnrollementQualificationConfirm || t.IsPDProgressView)) - .Where(t => t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)).Where(u => u.SubmitState == SubmitStateEnum.ToSubmit).Count() > 0).CountAsync() : 0, + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId) && (t.IsUrgent || t.IsSubjectExpeditedView || t.IsEnrollementQualificationConfirm || t.IsPDProgressView)) + .Where(t => t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)).Where(u => u.SubmitState == SubmitStateEnum.ToSubmit).Count() > 0).CountAsync() : 0, CRC_ImageQuestionCount = isCRC ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)).SelectMany(c => c.QCChallengeList) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(t => t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)).SelectMany(c => c.QCChallengeList) .Where(u => u.IsClosed == false && (u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC || u.LatestReplyUserId == null)).Count() > 0).CountAsync() : 0, CRC_CheckQuestionCount = isCRC ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(t => t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply).Count() > 0).CountAsync() : 0, CRC_ImageReUploadCount = isCRC ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.SubjectVisitList - .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => (u.SubmitState == SubmitStateEnum.ToSubmit && u.IsPMBackOrReReading) || (u.IsQCConfirmedReupload)).Count() > 0).CountAsync() : 0, CRC_ClinicalDataTobeDoneCount = isCRC ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.ReadingClinicalDataList.Where(x => !x.IsSign && x.ClinicalDataTrialSet.UploadRole == UploadRole.CRC).Count() > 0).CountAsync() : 0, CRC_ClinialDataTobeConfirmCount = isCRC ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.ReadModuleList.Where(x => !x.IsCRCConfirm).Count() > 0).CountAsync() : 0, @@ -1256,11 +1256,11 @@ namespace IRaCIS.Core.Application SPM_SiteSurveryCount = isSPMOrCPM ? siteSurveyCount : 0, SPM_ReviewerApprovalCount = isSPMOrCPM ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.EnrollList.Where(u => u.EnrollStatus == EnrollStatus.HasCommittedToCRO).Count() > 0).CountAsync() : 0, SPM_ReReadingApprovalCount = isSPMOrCPM ? await _visitTaskReReadingRepository - .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed) .GroupBy(t => t.OriginalReReadingTask.TrialId) .Select(g => new ReReadingApplyToBeDoneDto() @@ -1277,23 +1277,23 @@ namespace IRaCIS.Core.Application IQC_IamgeQCCount = isIQC ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.QCProcessEnum != TrialQCProcess.NotAudit) .Select(t => new { //待领取量 ToBeClaimedCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted && t.AuditState != AuditStateEnum.QCPassed) - .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count(), + .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.UserRoleId && u.ReviewAuditUserId == null))).Count(), //待审核通过,统计从已领取到QC提交之间的 已领取 待审核 审核中 (审核完成 领取人就会清理 所以只用查询当前领取人是自己的就好了) - ToBeReviewedCount = t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id).Count() + ToBeReviewedCount = t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.UserRoleId).Count() }).Where(x => x.ToBeClaimedCount + x.ToBeReviewedCount > 0).CountAsync() : 0, IQC_QCQuestionCount = isIQC ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.SubjectVisitList.SelectMany(c => c.QCChallengeList) - .Where(u => u.CreateUserId == _userInfo.Id && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count() > 0).CountAsync() : 0, + .Where(u => u.CreateUserId == _userInfo.UserRoleId && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count() > 0).CountAsync() : 0, @@ -1315,8 +1315,8 @@ namespace IRaCIS.Core.Application // .Where(y => y.IsFrontTaskNeedSignButNotSign == false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true)).Count()>0).CountAsync() : 0, - await _trialReadingCriterionRepository.Where(t => t.IsSigned == true && t.IsConfirm == true && t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(c => c.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) + await _trialReadingCriterionRepository.Where(t => t.IsSigned == true && t.IsConfirm == true && t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(c => c.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) // 前序 不存在 未一致性核查未通过的 .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) //前序 不存在 未生成任务的访视 @@ -1328,8 +1328,8 @@ namespace IRaCIS.Core.Application : 0, - IR_MedicalReviewCount = isIR ? await _taskMedicalReviewRepository.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.VisitTask.DoctorUserId == _userInfo.Id) + IR_MedicalReviewCount = isIR ? await _taskMedicalReviewRepository.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.VisitTask.DoctorUserId == _userInfo.UserRoleId) .GroupBy(t => new { t.TrialId, t.VisitTask.TrialReadingCriterionId }) .Where(g => g.Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.MIM && u.AuditState == MedicalReviewAuditState.Auditing).Count() > 0).CountAsync() : 0, @@ -1339,8 +1339,8 @@ namespace IRaCIS.Core.Application #region MIM MIM_MedicalReviewCount = isMIM ? await _taskMedicalReviewRepository - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .GroupBy(t => new { t.TrialId, t.VisitTask.TrialReadingCriterionId }) .Select(g => new { @@ -1379,7 +1379,7 @@ namespace IRaCIS.Core.Application .WhereIf(!string.IsNullOrEmpty(inQuery.Code), o => o.TrialCode.Contains(inQuery.Code)) .WhereIf(!string.IsNullOrEmpty(inQuery.ResearchProgramNo), o => o.ResearchProgramNo.Contains(inQuery.ResearchProgramNo)) .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.Id && t.IsDeleted == false) && t.IsDeleted == false) + .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))) .Select(t => new TrialToBeDoneDto() @@ -1406,49 +1406,49 @@ namespace IRaCIS.Core.Application SPM_ReviewerSelectApprovalCount = isSPMOrCPM ? t.EnrollList.Where(u => u.EnrollStatus == EnrollStatus.HasCommittedToCRO).Count() : 0, - MIM_UrgentCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + MIM_UrgentCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .Where(u => u.VisitTask.IsUrgent && u.AuditState != MedicalReviewAuditState.HaveSigned).Count() : 0, - MIM_PendingResponseCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + MIM_PendingResponseCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IndependentReviewer && u.AuditState == MedicalReviewAuditState.Auditing).Count() : 0, - MIM_PendingReviewCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + MIM_PendingReviewCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .Where(u => u.AuditState != MedicalReviewAuditState.HaveSigned && u.LatestReplyUser.UserTypeEnum != UserTypeEnum.IndependentReviewer).Count() : 0, - CRC_UrgentCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id) && t.IsUrgent).Count() : 0, + CRC_UrgentCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId) && t.IsUrgent).Count() : 0, - CRC_CheckQuestionCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + CRC_CheckQuestionCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply).Count() : 0, - CRC_QCQuestionCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)).SelectMany(c => c.QCChallengeList) + CRC_QCQuestionCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)).SelectMany(c => c.QCChallengeList) .Where(u => u.IsClosed == false && (u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC || u.LatestReplyUserId == null)).Count() : 0, //待审核 审核中 加急的数量 - IQC_UrgentCount = isIQC ? t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id && t.QCProcessEnum != TrialQCProcess.NotAudit && t.IsUrgent).Count() : 0, + IQC_UrgentCount = isIQC ? t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.UserRoleId && t.QCProcessEnum != TrialQCProcess.NotAudit && t.IsUrgent).Count() : 0, //审核未完成 - IQC_AuditToBeDealedCount = isIQC ? t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id && t.QCProcessEnum != TrialQCProcess.NotAudit).Count() : 0, + IQC_AuditToBeDealedCount = isIQC ? t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.UserRoleId && t.QCProcessEnum != TrialQCProcess.NotAudit).Count() : 0, //质疑待处理 IQC_QuestionToBeDealedCount = isIQC ? t.SubjectVisitList.SelectMany(c => c.QCChallengeList) - .Where(u => u.CreateUserId == _userInfo.Id && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count() : 0, + .Where(u => u.CreateUserId == _userInfo.UserRoleId && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count() : 0, //待领取 IQC_ToBeClaimedCount = isIQC ? t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted && t.AuditState != AuditStateEnum.QCPassed) - .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count() : 0, + .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.UserRoleId && u.ReviewAuditUserId == null))).Count() : 0, 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_TotalReadCount = isIR ? t.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count() : 0, + IR_TotalReadCount = isIR ? t.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count() : 0, IR_UnReadCount = isIR ? t.VisitTaskList - .Where(c => c.DoctorUserId == _userInfo.Id && c.ReadingTaskState != ReadingTaskState.HaveSigned && c.TaskState == TaskState.Effect && c.TrialReadingCriterion.IsSigned) + .Where(c => c.DoctorUserId == _userInfo.UserRoleId && c.ReadingTaskState != ReadingTaskState.HaveSigned && c.TaskState == TaskState.Effect && c.TrialReadingCriterion.IsSigned) // 前序 不存在 未一致性核查未通过的 .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) //前序 不存在 未生成任务的访视 @@ -1511,7 +1511,7 @@ namespace IRaCIS.Core.Application // QC IQC 待领取 QC_IQC_ToBeClaimedCount = (t.User.UserTypeEnum == UserTypeEnum.IQC) ? - t.Trial.SubjectVisitList.Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count() : 0, + t.Trial.SubjectVisitList.Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.UserRoleId && u.ReviewAuditUserId == null))).Count() : 0, // CRC 质疑待回复 --区分人 diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs index 211ea0c88..2ab7a341a 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs @@ -802,7 +802,7 @@ namespace IRaCIS.Core.Application throw new BusinessValidationFailedException(_localizer["TrialConfig_InvalidParentQuestionId"]); } - if (await _trialRepository.AnyAsync(t => t.Id == signConfirmDTO.TrialId && t.QCQuestionConfirmedUserId != null && t.QCQuestionConfirmedUserId != _userInfo.Id)) + if (await _trialRepository.AnyAsync(t => t.Id == signConfirmDTO.TrialId && t.QCQuestionConfirmedUserId != null && t.QCQuestionConfirmedUserId != _userInfo.UserRoleId)) { //---影像质控审核问题已被其他人员确认,不允许再次确认。 throw new BusinessValidationFailedException(_localizer["TrialConfig_AuditQuestionConfirmed"]); @@ -872,7 +872,7 @@ namespace IRaCIS.Core.Application throw new BusinessValidationFailedException(_localizer["TrialConfig_InvalidParentQuestionId"]); } - if (await _trialRepository.AnyAsync(t => t.Id == signConfirmDTO.TrialId && t.QCQuestionConfirmedUserId != null && t.QCQuestionConfirmedUserId != _userInfo.Id)) + if (await _trialRepository.AnyAsync(t => t.Id == signConfirmDTO.TrialId && t.QCQuestionConfirmedUserId != null && t.QCQuestionConfirmedUserId != _userInfo.UserRoleId)) { //---影像质控审核问题已被其他人员确认,不允许再次确认。 throw new BusinessValidationFailedException(_localizer["TrialConfig_AuditQuestionConfirmed"]); @@ -882,7 +882,7 @@ namespace IRaCIS.Core.Application { IsConfirm = true }); - await _trialRepository.UpdatePartialFromQueryAsync(t => t.Id == signConfirmDTO.TrialId, u => new Trial() { QCQuestionConfirmedTime = DateTime.Now, QCQuestionConfirmedUserId = _userInfo.Id, IsQCQuestionConfirmed = true }); + await _trialRepository.UpdatePartialFromQueryAsync(t => t.Id == signConfirmDTO.TrialId, u => new Trial() { QCQuestionConfirmedTime = DateTime.Now, QCQuestionConfirmedUserId = _userInfo.UserRoleId, IsQCQuestionConfirmed = true }); await _trialRepository.SaveChangesAsync(); } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs index d1e8305e6..98b70603e 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs @@ -21,7 +21,7 @@ namespace IRaCIS.Core.Application.Service /// [ApiExplorerSettings(GroupName = "Trial")] public class TrialExternalUserService(IRepository _trialExternalUseRepository, - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _trialUserRepository, IRepository _trialRepository, IRepository _userTypeRepository, @@ -64,7 +64,7 @@ namespace IRaCIS.Core.Application.Service using (await @lock.AcquireAsync()) { - var existSysUser = await _userRepository.FirstOrDefaultAsync(t => t.EMail == addOrEditTrialExternalUser.Email && t.UserTypeId == addOrEditTrialExternalUser.UserTypeId); + var existSysUser = await _userRoleRepository.FirstOrDefaultAsync(t => t.EMail == addOrEditTrialExternalUser.Email && t.UserTypeId == addOrEditTrialExternalUser.UserTypeId); if (existSysUser != null) { @@ -93,7 +93,7 @@ namespace IRaCIS.Core.Application.Service await _trialExternalUseRepository.AddAsync(addEntity); - var existUser = await _userRepository.FirstOrDefaultAsync(t => t.EMail == addOrEditTrialExternalUser.Email && t.UserTypeId == addOrEditTrialExternalUser.UserTypeId); + 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) @@ -107,7 +107,7 @@ namespace IRaCIS.Core.Application.Service //生成账户 并插入 - var generateUser = _mapper.Map(addOrEditTrialExternalUser); + var generateUser = _mapper.Map(addOrEditTrialExternalUser); if (trialType == TrialType.NoneOfficial) { @@ -117,10 +117,10 @@ namespace IRaCIS.Core.Application.Service // 外部人员生成账号 都是外部的 generateUser.IsZhiZhun = false; - generateUser.Code = _userRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; + generateUser.Code = _userRoleRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; - generateUser.UserCode = AppSettings.GetCodeStr(generateUser.Code, nameof(User)); + generateUser.UserCode = AppSettings.GetCodeStr(generateUser.Code, nameof(UserRole)); generateUser.UserName = generateUser.UserCode; @@ -130,7 +130,7 @@ namespace IRaCIS.Core.Application.Service generateUser.Status = UserStateEnum.Disable; - var newAddUser = await _userRepository.AddAsync(generateUser); + var newAddUser = await _userRoleRepository.AddAsync(generateUser); addEntity.IsSystemUser = false; @@ -224,7 +224,7 @@ namespace IRaCIS.Core.Application.Service if (isSystemUser == false) { - await _userRepository.BatchDeleteNoTrackingAsync(t => t.Id == systemUserId); + await _userRoleRepository.BatchDeleteNoTrackingAsync(t => t.Id == systemUserId); } return ResponseOutput.Result(success); @@ -253,12 +253,12 @@ namespace IRaCIS.Core.Application.Service await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now }); - await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable }); + await _userRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new UserRole() { Status = UserStateEnum.Enable }); await _trialExternalUseRepository.BatchUpdateNoTrackingAsync(t => t.Id == userInfo.Id, u => new TrialExternalUser() { IsJoin = true }); - await _userRepository.SaveChangesAsync(); + await _userRoleRepository.SaveChangesAsync(); } await _mailVerificationService.ExternalUserJoinEmail(trialId, userId, sendEmail.BaseUrl, sendEmail.RouteUrl); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs index 4d75837ad..4c9f86c31 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs @@ -9,7 +9,7 @@ namespace IRaCIS.Core.Application.Service { [ApiExplorerSettings(GroupName = "Trial")] public class TrialMaintenanceService(IRepository _trialUseRepository, - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _trialSiteUserRepository, IRepository _subjectVisitRepository, IRepository _trialRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITrialMaintenanceService @@ -82,7 +82,7 @@ namespace IRaCIS.Core.Application.Service //之前已经选择的用户 不放在列表中,现在又要改回去 废弃 - var query = _userRepository.Where(t => t.UserTypeEnum != UserTypeEnum.SuperAdmin) + var query = _userRoleRepository.Where(t => t.UserTypeEnum != UserTypeEnum.SuperAdmin) //正式或者培训的项目 不能允许测试用户(必须正式用户) 同时必须是内部的用户 .WhereIf(trialType == TrialType.OfficialTrial || trialType == TrialType.Training, t => t.IsTestUser == false && t.IsZhiZhun) diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs index 6d34f7bbf..ec18e5080 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs @@ -90,8 +90,8 @@ namespace IRaCIS.Core.Application.Service .WhereIf(multiModalityIdSelectCount > 0, t => t.TrialDicList.Count(t => t.KeyName == StaticData.Modality) == multiModalityIdSelectCount) .WhereIf(multiCriteriaSelectCount > 0, t => t.TrialDicList.Count(t => t.KeyName == StaticData.Criterion) == multiCriteriaSelectCount) .WhereIf(multiReviewTypeSelectCount > 0, t => t.TrialDicList.Count(t => t.KeyName == StaticData.ReviewType) == multiReviewTypeSelectCount) - .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin, t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id && t.IsDeleted == false) && t.IsDeleted == false) - .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id, isEn_Us = _userInfo.IsEn_Us }); + .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin, t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId && t.IsDeleted == false) && t.IsDeleted == false) + .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.UserRoleId, isEn_Us = _userInfo.IsEn_Us }); return await query.ToPagedListAsync(inQuery); @@ -102,7 +102,7 @@ namespace IRaCIS.Core.Application.Service public async Task> GetTrialSelect() { return await _trialRepository.AsQueryable() - .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OP, t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id) && t.IsDeleted == false) + .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) .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); } @@ -208,7 +208,7 @@ namespace IRaCIS.Core.Application.Service //如果是PM, 则需要将该人员添加到 运维人员表 //添加运维人员PM - await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trial.Id, UserId = _userInfo.Id, JoinTime = DateTime.Now }); + await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trial.Id, UserId = _userInfo.UserRoleId, JoinTime = DateTime.Now }); // 添加扩展信息表记录 await _trialPaymentPriceRepository.AddAsync(new TrialPaymentPrice() { TrialId = trial.Id }); @@ -588,7 +588,7 @@ namespace IRaCIS.Core.Application.Service .WhereIf(inQuery.Status == 8, t => t.EnrollList.Any(u => u.EnrollStatus == EnrollStatus.InviteIntoGroup)) .WhereIf(inQuery.Status == 10, t => t.EnrollList.Any(u => u.EnrollStatus == EnrollStatus.DoctorReading)) .WhereIf(inQuery.Status == 14, t => t.EnrollList.Any(u => u.EnrollStatus == EnrollStatus.Finished)) - .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id, isEn_Us = _userInfo.IsEn_Us }); + .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.UserRoleId, isEn_Us = _userInfo.IsEn_Us }); return await query.ToPagedListAsync(inQuery, nameof(TrialDetailDTO.CreateTime)); @@ -617,13 +617,13 @@ namespace IRaCIS.Core.Application.Service { var query = _trialRepository .WhereIf(inQuery.EnrollStatus != null, o => (int)inQuery.EnrollStatus! == 10 ? - o.EnrollList.Any(o => o.EnrollStatus >= EnrollStatus.ConfirmIntoGroup && o.EnrollStatus <= EnrollStatus.DoctorReading && o.DoctorId == _userInfo.Id) : - o.EnrollList.Any(o => o.EnrollStatus == inQuery.EnrollStatus && o.DoctorId == _userInfo.Id)) + o.EnrollList.Any(o => o.EnrollStatus >= EnrollStatus.ConfirmIntoGroup && o.EnrollStatus <= EnrollStatus.DoctorReading && o.DoctorId == _userInfo.UserRoleId) : + o.EnrollList.Any(o => o.EnrollStatus == inQuery.EnrollStatus && o.DoctorId == _userInfo.UserRoleId)) .WhereIf(inQuery.Expedited != null, o => o.Expedited == inQuery.Expedited) .WhereIf(!string.IsNullOrEmpty(inQuery.Code), o => o.TrialCode.Contains(inQuery.Code)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Indication), o => o.Indication.Contains(inQuery.Indication)) - .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin, t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id, isEn_Us = _userInfo.IsEn_Us }); + .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin, t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.UserRoleId, isEn_Us = _userInfo.IsEn_Us }); return await query.ToPagedListAsync(inQuery, nameof(TrialDetailDTO.CreateTime)); @@ -646,12 +646,12 @@ namespace IRaCIS.Core.Application.Service { await _enrollDetailRepository.AddAsync(new EnrollDetail() { - DoctorId = _userInfo.Id, + DoctorId = _userInfo.UserRoleId, TrialId = trialId, EnrollStatus = status, OptUserType = (int)SystemUserType.DoctorUser, }); - return ResponseOutput.Result(await _enrollRepository.BatchUpdateNoTrackingAsync(u => u.TrialId == trialId && u.DoctorId == _userInfo.Id, e => new Enroll + return ResponseOutput.Result(await _enrollRepository.BatchUpdateNoTrackingAsync(u => u.TrialId == trialId && u.DoctorId == _userInfo.UserRoleId, e => new Enroll { EnrollStatus = status })); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs index e3feb10d1..2b5c7a822 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs @@ -30,7 +30,7 @@ namespace IRaCIS.Core.Application.Services .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SiteName), t => t.TrialSiteName.Contains(inQuery.SiteName)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteAliasName), t => t.TrialSiteAliasName.Contains(inQuery.TrialSiteAliasName)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteCode), t => t.TrialSiteCode.Contains(inQuery.TrialSiteCode)) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.CRCUserList.Any(k => k.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.CRCUserList.Any(k => k.UserId == _userInfo.UserRoleId)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserKeyInfo), t => t.CRCUserList.Any(k => (k.User.FullName).Contains(inQuery.UserKeyInfo) || k.User.UserName.Contains(inQuery.UserKeyInfo) || k.User.EMail.Contains(inQuery.UserKeyInfo))) @@ -52,7 +52,7 @@ namespace IRaCIS.Core.Application.Services .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SiteName), t => t.TrialSiteName.Contains(inQuery.SiteName) || t.TrialSiteAliasName.Contains(inQuery.TrialSiteAliasName)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteAliasName), t => t.TrialSiteAliasName.Contains(inQuery.TrialSiteAliasName)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteCode), t => t.TrialSiteCode.Contains(inQuery.TrialSiteCode)) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.CRCUserList.Any(k => k.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.CRCUserList.Any(k => k.UserId == _userInfo.UserRoleId)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserKeyInfo), t => t.CRCUserList.Any(k => (k.User.FullName).Contains(inQuery.UserKeyInfo) || k.User.UserName.Contains(inQuery.UserKeyInfo) || k.User.EMail.Contains(inQuery.UserKeyInfo))) @@ -255,7 +255,7 @@ namespace IRaCIS.Core.Application.Services //CRC只看到他负责的 var list = await _trialSiteRepository.Where(t => t.TrialId == trialId) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .ProjectTo(_mapper.ConfigurationProvider).OrderBy(t => t.TrialSiteCode).ToListAsync(); @@ -269,7 +269,7 @@ namespace IRaCIS.Core.Application.Services //CRC只看到他负责的 var list = await _trialSiteRepository.Where(t => t.TrialId == trialId) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => t.TrialSiteCode).ToListAsync(); var virtualList = await _visitTaskRepository.Where(t => t.IsSelfAnalysis == true && t.TrialId == trialId).Select(t => t.BlindTrialSiteCode).Distinct().ToListAsync(); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs index f94b5ae18..00def5d27 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs @@ -89,7 +89,7 @@ namespace IRaCIS.Core.Application.Service CreateMap().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(); + CreateMap(); var trialSiteId = Guid.Empty; CreateMap().IncludeMembers(t => t.User) @@ -97,10 +97,10 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.TrialSiteId, u => u.MapFrom(t => trialSiteId)) .ForMember(d => d.UserType, u => u.MapFrom(t => t.User.UserTypeRole.UserTypeShortName)) .ForMember(d => d.IsSelect, u => u.MapFrom(t => t.Trial.TrialSiteUserList.Any(k => k.UserId == t.UserId && k.TrialSiteId== trialSiteId))); - CreateMap(); + CreateMap(); var trialId = Guid.Empty; - CreateMap() + CreateMap() .ForMember(d => d.UserRealName, u => u.MapFrom(s => s.FullName)) .ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName)) .ForMember(d => d.UserId, u => u.MapFrom(s => s.Id)) @@ -151,7 +151,7 @@ namespace IRaCIS.Core.Application.Service CreateMap().IncludeMembers(t => t.User) .ForMember(d => d.UserType, u => u.MapFrom(s => s.User.UserTypeRole.UserTypeShortName)) .ForMember(d => d.UserRealName, u => u.MapFrom(s => s.User.FullName)); - CreateMap(); + CreateMap(); #endregion @@ -189,22 +189,22 @@ namespace IRaCIS.Core.Application.Service CreateMap(); CreateMap() - .ForMember(t => t.UserRealName, u => u.MapFrom(c => c.CreateUser.FullName)) - .ForMember(t => t.UserName, u => u.MapFrom(c => c.CreateUser.UserName)); + .ForMember(t => t.UserRealName, u => u.MapFrom(c => c.CreateUserRole.FullName)) + .ForMember(t => t.UserName, u => u.MapFrom(c => c.CreateUserRole.UserName)); CreateMap().ReverseMap(); - CreateMap(); + CreateMap(); CreateMap().ReverseMap(); - CreateMap(); + CreateMap(); CreateMap(); - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); @@ -270,7 +270,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(t => t.TrialSiteAliasName, u => u.MapFrom(c => c.TrialSite.TrialSiteAliasName)) .ForMember(t => t.UserRealName, u => u.MapFrom(c => c.User.FullName)) .ForMember(t => t.UserType, u => u.MapFrom(c => c.User.UserTypeRole.UserTypeShortName)); - CreateMap(); + CreateMap(); diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectService.cs index fd775a7a9..11cc30eaa 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectService.cs @@ -113,7 +113,7 @@ namespace IRaCIS.Core.Application.Service .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId) // CRC 只负责他管理site的受试者 - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .ProjectTo(_mapper.ConfigurationProvider) .WhereIf(inQuery.IsMissingImages != null, t => t.IsMissingImages == inQuery.IsMissingImages); diff --git a/IRaCIS.Core.Application/Service/Visit/_MapConfig.cs b/IRaCIS.Core.Application/Service/Visit/_MapConfig.cs index cf927ee17..848708e9e 100644 --- a/IRaCIS.Core.Application/Service/Visit/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Visit/_MapConfig.cs @@ -26,7 +26,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() - .ForMember(d => d.CreateUser, u => u.MapFrom(g => g.CreateUser.LastName + " / " + g.CreateUser.FirstName)); + .ForMember(d => d.CreateUser, u => u.MapFrom(g => g.CreateUserRole.LastName + " / " + g.CreateUserRole.FirstName)); diff --git a/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs b/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs index b78e797a4..b6b505bb6 100644 --- a/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs +++ b/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs @@ -16,7 +16,7 @@ namespace IRaCIS.Core.Application.Service IRepository _doctorRepository, IRepository _enrollDetailRepository, IRepository _workloadRepository, - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _trialUserRepository, IRepository _ReadingQuestionCriterionTrialRepository, @@ -146,7 +146,7 @@ namespace IRaCIS.Core.Application.Service TrialId = trialId, EnrollStatus = EnrollStatus.HasApplyDownloadResume, - DoctorUserId = _userRepository.Where(t => t.DoctorId == doctorId).Select(t => t.Id).FirstOrDefault() + DoctorUserId = _userRoleRepository.Where(t => t.DoctorId == doctorId).Select(t => t.Id).FirstOrDefault() }); ; await _enrollDetailRepository.AddAsync(new EnrollDetail() diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index 95bd3fbe8..c37fe593a 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -48,7 +48,7 @@ namespace IRaCIS.Core.Application.Service IRepository _readingQuestionCriterionTrialRepository, IRepository _visitTaskRepository, IRepository _dicomSeriesRepository, - IRepository _userRepository, + IRepository _userRoleRepository, IRepository _trialBodyPartRepository, IDistributedLockProvider _distributedLockProvider, ILogger _logger, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService @@ -160,7 +160,7 @@ namespace IRaCIS.Core.Application.Service public async Task UserMutiAccount([FromServices] IRepository _identityUserRepository) { - var userList = _userRepository.Where().ToList(); + var userList = _userRoleRepository.Where().ToList(); foreach (var item in userList.GroupBy(t => t.EMail.Trim())) { @@ -174,7 +174,7 @@ namespace IRaCIS.Core.Application.Service await _identityUserRepository.AddAsync(identityUser); - await _userRepository.BatchUpdateNoTrackingAsync(t => emailUserIdList.Contains(t.Id), u => new User() { IdentityUserId = identityUserId }); + await _userRoleRepository.BatchUpdateNoTrackingAsync(t => emailUserIdList.Contains(t.Id), u => new UserRole() { IdentityUserId = identityUserId }); } await _identityUserRepository.SaveChangesAsync(); @@ -241,7 +241,7 @@ namespace IRaCIS.Core.Application.Service { var timeSpan = HolidayHelper.GetChinaWorkTimeSpan(startdate, endDate); - _userRepository.Where(t => t.Id == _userInfo.Id).Select(t => t.FullName).FirstOrDefault(); + _userRoleRepository.Where(t => t.Id == _userInfo.UserRoleId).Select(t => t.FullName).FirstOrDefault(); return $"{timeSpan.Days}天,{timeSpan.Hours}小时{timeSpan.Minutes}分钟{timeSpan.Seconds}秒"; } @@ -306,7 +306,7 @@ namespace IRaCIS.Core.Application.Service public async Task TestDistributedLock() { - await _userRepository.Where().Select(t => t.FullName).FirstNotNullAsync(); + await _userRoleRepository.Where().Select(t => t.FullName).FirstNotNullAsync(); Console.WriteLine($"我进来了当前值是:" + IntValue); _logger.LogWarning($"我进来了当前值是:" + IntValue); @@ -633,7 +633,7 @@ namespace IRaCIS.Core.Application.Service - //var d = _userRepository.Where(t => t.FullName.Contains("cc")).Select(t => t.FullName).FirstOrDefault(); + //var d = _userRoleRepository.Where(t => t.FullName.Contains("cc")).Select(t => t.FullName).FirstOrDefault(); //var c = _dicRepository.Where(t => t.ParentId != null).Select(t => t.MappedValue).First(); //CultureInfo culture = CultureInfo.CurrentUICulture; diff --git a/IRaCIS.Core.Application/Triggers/BeforeSaveTrigger/AddlTrialUserTrigger.cs b/IRaCIS.Core.Application/Triggers/BeforeSaveTrigger/AddlTrialUserTrigger.cs index a59d46f6c..ebcacc106 100644 --- a/IRaCIS.Core.Application/Triggers/BeforeSaveTrigger/AddlTrialUserTrigger.cs +++ b/IRaCIS.Core.Application/Triggers/BeforeSaveTrigger/AddlTrialUserTrigger.cs @@ -10,7 +10,7 @@ namespace IRaCIS.Core.Application.Triggers public class AddlTrialUserTrigger( IStringLocalizer _localizer, IRepository _trialRepository, - IRepository _userRepository) : IBeforeSaveTrigger + IRepository _userRoleRepository) : IBeforeSaveTrigger { @@ -24,7 +24,7 @@ namespace IRaCIS.Core.Application.Triggers var trialInfo = await _trialRepository.FindAsync(trialUser.TrialId); // 必须包在同一个事务,有的时候是数据库还没用户,不能直接查询数据库 - var user = await _userRepository.FindAsync(trialUser.UserId); + var user = await _userRoleRepository.FindAsync(trialUser.UserId); if (trialInfo.TrialType == Domain.Share.TrialType.OfficialTrial || trialInfo.TrialType == Domain.Share.TrialType.Training) { diff --git a/IRaCIS.Core.Application/Triggers/BeforeSaveTrigger/UserLogTrigger.cs b/IRaCIS.Core.Application/Triggers/BeforeSaveTrigger/UserLogTrigger.cs index 3adc7fcfd..de92f607d 100644 --- a/IRaCIS.Core.Application/Triggers/BeforeSaveTrigger/UserLogTrigger.cs +++ b/IRaCIS.Core.Application/Triggers/BeforeSaveTrigger/UserLogTrigger.cs @@ -28,15 +28,15 @@ namespace IRaCIS.Core.Application.Triggers } - public class UserAddTrigger(IUserInfo _userInfo, IRepository _userLogReposiotry) : IBeforeSaveTrigger + public class UserAddTrigger(IUserInfo _userInfo, IRepository _userLogReposiotry) : IBeforeSaveTrigger { - public async Task BeforeSave(ITriggerContext context, CancellationToken cancellationToken) + public async Task BeforeSave(ITriggerContext context, CancellationToken cancellationToken) { var user = context.Entity; if (context.ChangeType == ChangeType.Added) { - await _userLogReposiotry.AddAsync(new UserLog() { OptType = UserOptType.AddUser, OptUserId = user.Id, LoginUserId = _userInfo.Id, IP = _userInfo.IP }); + await _userLogReposiotry.AddAsync(new UserLog() { OptType = UserOptType.AddUser, OptUserId = user.Id, LoginUserId = _userInfo.UserRoleId, IP = _userInfo.IP }); } diff --git a/IRaCIS.Core.Domain/Allocation/SubjectUser.cs b/IRaCIS.Core.Domain/Allocation/SubjectUser.cs index 475c19ec0..549c901ec 100644 --- a/IRaCIS.Core.Domain/Allocation/SubjectUser.cs +++ b/IRaCIS.Core.Domain/Allocation/SubjectUser.cs @@ -19,7 +19,7 @@ public class SubjectUser : BaseFullAuditEntity [JsonIgnore] public List EarlierSubjectUserList { get; set; } [JsonIgnore] - public User DoctorUser { get; set; } + public UserRole DoctorUser { get; set; } [JsonIgnore] public Subject Subject { get; set; } diff --git a/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs b/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs index 6dda502b9..f1b34a1df 100644 --- a/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs +++ b/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs @@ -8,7 +8,7 @@ public class TaskAllocationRule : BaseFullAuditEntity [ForeignKey("DoctorUserId")] [JsonIgnore] - public User DoctorUser { get; set; } + public UserRole DoctorUser { get; set; } [JsonIgnore] public Enroll Enroll { get; set; } diff --git a/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs b/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs index b2c80102e..e1aa6fc8c 100644 --- a/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs +++ b/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs @@ -16,10 +16,10 @@ public class TaskMedicalReview : BaseFullAuditEntity #region 导航属性 [JsonIgnore] - public User LatestReplyUser { get; set; } + public UserRole LatestReplyUser { get; set; } [JsonIgnore] - public User MedicalManagerUser { get; set; } + public UserRole MedicalManagerUser { get; set; } [JsonIgnore] [ForeignKey("VisitTaskId")] diff --git a/IRaCIS.Core.Domain/Allocation/TaskMedicalReviewRule.cs b/IRaCIS.Core.Domain/Allocation/TaskMedicalReviewRule.cs index e5aa996ba..7f76b0cf1 100644 --- a/IRaCIS.Core.Domain/Allocation/TaskMedicalReviewRule.cs +++ b/IRaCIS.Core.Domain/Allocation/TaskMedicalReviewRule.cs @@ -7,7 +7,7 @@ public class TaskMedicalReviewRule : BaseFullAuditEntity #region 导航属性 [JsonIgnore] - public User DoctorUser { get; set; } + public UserRole DoctorUser { get; set; } #endregion public Guid DoctorUserId { get; set; } diff --git a/IRaCIS.Core.Domain/Allocation/VisitTask.cs b/IRaCIS.Core.Domain/Allocation/VisitTask.cs index 4efb9a1dd..eb955eee8 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTask.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs @@ -18,7 +18,7 @@ public class VisitTask : BaseFullAuditEntity [ForeignKey("TrialReadingCriterionId")] public ReadingQuestionCriterionTrial TrialReadingCriterion { get; set; } [ForeignKey("DoctorUserId")] - public User DoctorUser { get; set; } + public UserRole DoctorUser { get; set; } [ForeignKey("SouceReadModuleId")] public ReadModule ReadModule { get; set; } diff --git a/IRaCIS.Core.Domain/Allocation/VisitTaskReReading.cs b/IRaCIS.Core.Domain/Allocation/VisitTaskReReading.cs index 8a5c392d4..e7666e20a 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTaskReReading.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTaskReReading.cs @@ -9,7 +9,7 @@ public class VisitTaskReReading : BaseFullAuditEntity #region 导航属性 [JsonIgnore] - public User RequestReReadingUser { get; set; } + public UserRole RequestReReadingUser { get; set; } [JsonIgnore] public VisitTask NewReReadingTask { get; set; } @@ -18,7 +18,7 @@ public class VisitTaskReReading : BaseFullAuditEntity [JsonIgnore] public VisitTask OriginalReReadingTask { get; set; } [JsonIgnore] - public User RequestReReadingConfirmUser { get; set; } + public UserRole RequestReReadingConfirmUser { get; set; } [JsonIgnore] public Trial Trial { get; set; } diff --git a/IRaCIS.Core.Domain/BaseModel/Entity.cs b/IRaCIS.Core.Domain/BaseModel/Entity.cs index 671393d49..55847a041 100644 --- a/IRaCIS.Core.Domain/BaseModel/Entity.cs +++ b/IRaCIS.Core.Domain/BaseModel/Entity.cs @@ -81,7 +81,7 @@ public abstract class BaseAddAuditEntity : Entity, IAuditAdd [ForeignKey("CreateUserId")] [JsonIgnore] - public virtual User CreateUser { get; set; } + public virtual UserRole CreateUserRole { get; set; } } public abstract class BaseAddDeleteAuditEntity : Entity, IAuditAdd, ISoftDelete @@ -95,7 +95,7 @@ public abstract class BaseAddDeleteAuditEntity : Entity, IAuditAdd, ISoftDelete [ForeignKey("CreateUserId")] [JsonIgnore] - public User CreateUser { get; set; } + public UserRole CreateUserRole { get; set; } } public abstract class BaseFullAuditEntity : Entity, IAuditUpdate, IAuditAdd @@ -107,7 +107,7 @@ public abstract class BaseFullAuditEntity : Entity, IAuditUpdate, IAuditAdd [ForeignKey("CreateUserId")] [JsonIgnore] - public User CreateUser { get; set; } + public UserRole CreateUserRole { get; set; } } public abstract class BaseFullDeleteAuditEntity : Entity, IAuditUpdate, IAuditAdd, ISoftDelete { @@ -121,7 +121,7 @@ public abstract class BaseFullDeleteAuditEntity : Entity, IAuditUpdate, IAuditAd [ForeignKey("CreateUserId")] [JsonIgnore] - public User CreateUser { get; set; } + public UserRole CreateUserRole { get; set; } } public abstract class BaseAuditUpdateEntity : Entity, IAuditUpdate diff --git a/IRaCIS.Core.Domain/Dcotor/Doctor.cs b/IRaCIS.Core.Domain/Dcotor/Doctor.cs index 6560f43f4..e5a00ef6f 100644 --- a/IRaCIS.Core.Domain/Dcotor/Doctor.cs +++ b/IRaCIS.Core.Domain/Dcotor/Doctor.cs @@ -39,7 +39,7 @@ public class Doctor : BaseFullAuditEntity public List CriterionFileList { get; set; } [JsonIgnore] - public User User { get; set; } + public UserRole User { get; set; } #endregion public bool AcceptingNewTrial { get; set; } diff --git a/IRaCIS.Core.Domain/Document/SystemDocConfirmedUser.cs b/IRaCIS.Core.Domain/Document/SystemDocConfirmedUser.cs index 633ad4b14..86c52d717 100644 --- a/IRaCIS.Core.Domain/Document/SystemDocConfirmedUser.cs +++ b/IRaCIS.Core.Domain/Document/SystemDocConfirmedUser.cs @@ -11,7 +11,7 @@ public class SystemDocConfirmedUser : BaseAddDeleteAuditEntity [JsonIgnore] [ForeignKey("ConfirmUserId")] - public User ConfirmUser { get; set; } + public UserRole ConfirmUser { get; set; } #endregion public Guid SystemDocumentId { get; set; } diff --git a/IRaCIS.Core.Domain/Document/TrialDocConfirmedUser.cs b/IRaCIS.Core.Domain/Document/TrialDocConfirmedUser.cs index 023ecb832..1aee269d6 100644 --- a/IRaCIS.Core.Domain/Document/TrialDocConfirmedUser.cs +++ b/IRaCIS.Core.Domain/Document/TrialDocConfirmedUser.cs @@ -8,7 +8,7 @@ public class TrialDocConfirmedUser : BaseAddDeleteAuditEntity [JsonIgnore] [ForeignKey("ConfirmUserId")] - public User User { get; set; } + public UserRole User { get; set; } [JsonIgnore] public TrialDocument TrialDocument { get; set; } #endregion diff --git a/IRaCIS.Core.Domain/Document/TrialEmailNoticeConfig.cs b/IRaCIS.Core.Domain/Document/TrialEmailNoticeConfig.cs index 01a80a558..479049efe 100644 --- a/IRaCIS.Core.Domain/Document/TrialEmailNoticeConfig.cs +++ b/IRaCIS.Core.Domain/Document/TrialEmailNoticeConfig.cs @@ -96,7 +96,7 @@ public class TrialEmailBlackUser : Entity public TrialEmailNoticeConfig TrialEmailNoticeConfig { get; set; } [JsonIgnore] - public User User { get; set; } + public UserRole User { get; set; } public Guid TrialEmailNoticeConfigId { get; set; } public Guid UserId { get; set; } } diff --git a/IRaCIS.Core.Domain/Management/Notice/SystemNotice.cs b/IRaCIS.Core.Domain/Management/Notice/SystemNotice.cs index 91e89956f..fc05cb432 100644 --- a/IRaCIS.Core.Domain/Management/Notice/SystemNotice.cs +++ b/IRaCIS.Core.Domain/Management/Notice/SystemNotice.cs @@ -37,7 +37,7 @@ public class SystemNotice : BaseFullAuditEntity public Guid? PublishedUserId { get; set; } - public User PublishedUser { get; set; } + public UserRole PublishedUser { get; set; } public DateTime? PublishedTime { get; set; } diff --git a/IRaCIS.Core.Domain/Management/User.cs b/IRaCIS.Core.Domain/Management/User.cs index 65782b7e6..9c3512ffa 100644 --- a/IRaCIS.Core.Domain/Management/User.cs +++ b/IRaCIS.Core.Domain/Management/User.cs @@ -5,7 +5,7 @@ namespace IRaCIS.Core.Domain.Models; [Comment("̨ - ϵͳ˻ɫϵ")] [Table("User")] -public class User : BaseFullAuditEntity +public class UserRole : BaseFullAuditEntity { #region @@ -111,7 +111,7 @@ public class User : BaseFullAuditEntity [Table("IdentityUser")] public class IdentityUser: BaseFullAuditEntity { - public List UserRoleList { get; set; } = new List(); + public List UserRoleList { get; set; } = new List(); [Projectable] public string FullName => LastName + " / " + FirstName; diff --git a/IRaCIS.Core.Domain/Management/UserLog.cs b/IRaCIS.Core.Domain/Management/UserLog.cs index 3c11a410a..5d481011a 100644 --- a/IRaCIS.Core.Domain/Management/UserLog.cs +++ b/IRaCIS.Core.Domain/Management/UserLog.cs @@ -8,10 +8,10 @@ public class UserLog : BaseAddAuditEntity { #region 导航属性 [JsonIgnore] - public User LoginUser { get; set; } + public UserRole LoginUser { get; set; } [JsonIgnore] - public User OptUser { get; set; } + public UserRole OptUser { get; set; } #endregion public string IP { get; set; } = string.Empty; diff --git a/IRaCIS.Core.Domain/Management/UserType.cs b/IRaCIS.Core.Domain/Management/UserType.cs index bc07c5cc7..b4012b58e 100644 --- a/IRaCIS.Core.Domain/Management/UserType.cs +++ b/IRaCIS.Core.Domain/Management/UserType.cs @@ -15,7 +15,7 @@ public class UserType : Entity public List SystemDocNeedConfirmedUserTypeList { get; set; } [JsonIgnore] - public List UserList { get; set; } + public List UserList { get; set; } #endregion public UserTypeEnum UserTypeEnum { get; set; } diff --git a/IRaCIS.Core.Domain/QC/QCChallenge.cs b/IRaCIS.Core.Domain/QC/QCChallenge.cs index ef7aee7e7..67dfb3c6f 100644 --- a/IRaCIS.Core.Domain/QC/QCChallenge.cs +++ b/IRaCIS.Core.Domain/QC/QCChallenge.cs @@ -10,7 +10,7 @@ public class QCChallenge : BaseAddAuditEntity #region 导航属性 [JsonIgnore] [ForeignKey("LatestReplyUserId")] - public User LatestReplyUser { get; set; } + public UserRole LatestReplyUser { get; set; } [JsonIgnore] [Comment("导航属性")] [ForeignKey("SubjectVisitId")] diff --git a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteSurvey.cs b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteSurvey.cs index 48ac5e5a3..43cfce7f6 100644 --- a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteSurvey.cs +++ b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteSurvey.cs @@ -17,9 +17,9 @@ public class TrialSiteSurvey : BaseFullDeleteAuditEntity [JsonIgnore] public Trial Trial { get; set; } [JsonIgnore] - public User ReviewerUser { get; set; } + public UserRole ReviewerUser { get; set; } [JsonIgnore] - public User PreliminaryUser { get; set; } + public UserRole PreliminaryUser { get; set; } #endregion public Guid TrialSiteId { get; set; } diff --git a/IRaCIS.Core.Domain/Trial/Enroll.cs b/IRaCIS.Core.Domain/Trial/Enroll.cs index 1f176375b..309f72585 100644 --- a/IRaCIS.Core.Domain/Trial/Enroll.cs +++ b/IRaCIS.Core.Domain/Trial/Enroll.cs @@ -13,7 +13,7 @@ public partial class Enroll : BaseFullAuditEntity [JsonIgnore] public virtual Doctor Doctor { get; set; } [JsonIgnore] - public User DoctorUser { get; set; } + public UserRole DoctorUser { get; set; } [JsonIgnore] public List EnrollReadingCategoryList { get; set; } diff --git a/IRaCIS.Core.Domain/Trial/Trial.cs b/IRaCIS.Core.Domain/Trial/Trial.cs index b5f9d3686..26cc22fa5 100644 --- a/IRaCIS.Core.Domain/Trial/Trial.cs +++ b/IRaCIS.Core.Domain/Trial/Trial.cs @@ -213,7 +213,7 @@ public partial class Trial : BaseFullDeleteAuditEntity public bool IsTrialStart { get; set; } = false; [Comment("QC 问题流程")] - public User QCQuestionConfirmedUser { get; set; } + public UserRole QCQuestionConfirmedUser { get; set; } public Guid? QCQuestionConfirmedUserId { get; set; } public DateTime? QCQuestionConfirmedTime { get; set; } diff --git a/IRaCIS.Core.Domain/TrialSiteUser/TrialSiteUser.cs b/IRaCIS.Core.Domain/TrialSiteUser/TrialSiteUser.cs index 110096fd6..9a6033296 100644 --- a/IRaCIS.Core.Domain/TrialSiteUser/TrialSiteUser.cs +++ b/IRaCIS.Core.Domain/TrialSiteUser/TrialSiteUser.cs @@ -8,7 +8,7 @@ public class TrialSiteUser : BaseFullDeleteAuditEntity #region 导航属性 [JsonIgnore] [ForeignKey("UserId")] - public User User { get; set; } + public UserRole User { get; set; } [JsonIgnore] [ForeignKey("TrialId")] public Trial Trial { get; set; } diff --git a/IRaCIS.Core.Domain/TrialSiteUser/TrialUser.cs b/IRaCIS.Core.Domain/TrialSiteUser/TrialUser.cs index c2bdad498..664801a1d 100644 --- a/IRaCIS.Core.Domain/TrialSiteUser/TrialUser.cs +++ b/IRaCIS.Core.Domain/TrialSiteUser/TrialUser.cs @@ -11,7 +11,7 @@ public class TrialUser : BaseFullDeleteAuditEntity [JsonIgnore] [ForeignKey("UserId")] - public User User { get; set; } + public UserRole User { get; set; } #endregion public Guid UserId { get; set; } diff --git a/IRaCIS.Core.Domain/Visit/SubjectVisit.cs b/IRaCIS.Core.Domain/Visit/SubjectVisit.cs index 751ea0be7..df62719e8 100644 --- a/IRaCIS.Core.Domain/Visit/SubjectVisit.cs +++ b/IRaCIS.Core.Domain/Visit/SubjectVisit.cs @@ -14,28 +14,28 @@ public class SubjectVisit : BaseFullDeleteAuditEntity [ForeignKey("OutPlanPreviousVisitId")] public SubjectVisit OutPlanPreviousVisit { get; set; } [ForeignKey("ForwardUserId")] - public User ForwardUser { get; set; } + public UserRole ForwardUser { get; set; } /// /// 初审 /// [JsonIgnore] [ForeignKey("PreliminaryAuditUserId")] - public User PreliminaryAuditUser { get; set; } + public UserRole PreliminaryAuditUser { get; set; } /// /// 复审 /// [JsonIgnore] [ForeignKey("ReviewAuditUserId")] - public User ReviewAuditUser { get; set; } + public UserRole ReviewAuditUser { get; set; } [JsonIgnore] [ForeignKey("CurrentActionUserId")] - public User CurrentActionUser { get; set; } + public UserRole CurrentActionUser { get; set; } [JsonIgnore] [ForeignKey("SubmitUserId")] - public User SubmitUser { get; set; } + public UserRole SubmitUser { get; set; } [JsonIgnore] [ForeignKey("TrialId")] public Trial Trial { get; set; } diff --git a/IRaCIS.Core.Infra.EFCore/AuthUser/IUserInfo.cs b/IRaCIS.Core.Infra.EFCore/AuthUser/IUserInfo.cs index 6a9adbf20..e9434387f 100644 --- a/IRaCIS.Core.Infra.EFCore/AuthUser/IUserInfo.cs +++ b/IRaCIS.Core.Infra.EFCore/AuthUser/IUserInfo.cs @@ -6,7 +6,7 @@ public interface IUserInfo { - Guid Id { get; } + Guid UserRoleId { get; } Guid IdentityUserId { get; } diff --git a/IRaCIS.Core.Infra.EFCore/AuthUser/UserInfo.cs b/IRaCIS.Core.Infra.EFCore/AuthUser/UserInfo.cs index 633c08c41..099baccea 100644 --- a/IRaCIS.Core.Infra.EFCore/AuthUser/UserInfo.cs +++ b/IRaCIS.Core.Infra.EFCore/AuthUser/UserInfo.cs @@ -15,9 +15,9 @@ namespace IRaCIS.Core.Domain.Share } /// - /// 用户角色Id + /// 用户角色Id /// - public Guid Id + public Guid UserRoleId { get { @@ -30,6 +30,9 @@ namespace IRaCIS.Core.Domain.Share } } + /// + /// 真实用户Id + /// public Guid IdentityUserId { get diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 4a1245519..c58d386df 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -2631,11 +2631,11 @@ namespace IRaCIS.Core.Infra.EFCore.Common #region 阅片 //用户添加 - foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(User))) + foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(UserRole))) { var type = GetEntityAuditOpt(item); - var entity = item.Entity as User; + var entity = item.Entity as UserRole; var extraIdentification = string.Empty; @@ -2645,7 +2645,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common extraIdentification = "/Personalization"; } - await InsertInspection(entity, type, x => new InspectionConvertDTO() + await InsertInspection(entity, type, x => new InspectionConvertDTO() { IsDistinctionInterface = false, ExtraIndentification = extraIdentification @@ -3533,7 +3533,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common inspection.CreateUserName = _userInfo.UserName; inspection.CreateUserRealName = _userInfo.FullName; inspection.RoleName = _userInfo.UserTypeShortName; - inspection.CreateUserId = _userInfo.Id; + inspection.CreateUserId = _userInfo.UserRoleId; inspection.IP = _userInfo.IP; inspection.CreateTime = inspection.CreateTime == default(DateTime) ? DateTime.Now : inspection.CreateTime; diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index a2c2a5c85..a76b123d7 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -424,7 +424,7 @@ public class IRaCISDBContext : DbContext public virtual DbSet VerificationCodes { get; set; } public virtual DbSet MenuFunctions { get; set; } public virtual DbSet UserTypeMenuFunction { get; set; } - public virtual DbSet Users { get; set; } + public virtual DbSet Users { get; set; } public virtual DbSet UserType { get; set; } @@ -456,7 +456,7 @@ public class IRaCISDBContext : DbContext public virtual DbSet Site { get; set; } - public virtual DbSet User { get; set; } + public virtual DbSet User { get; set; } public virtual DbSet UserPassWordLog { get; set; } diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs index 87639013c..8036390cf 100644 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs +++ b/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs @@ -44,9 +44,9 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration } } - public class UserConfigration : IEntityTypeConfiguration + public class UserConfigration : IEntityTypeConfiguration { - public void Configure(EntityTypeBuilder builder) + public void Configure(EntityTypeBuilder builder) { //User 和VisitTask 存在一对多的关系 这里不显式配置就报错,why? builder.HasMany(t => t.VisitTaskList).WithOne(t => t.DoctorUser).HasForeignKey(t => t.DoctorUserId); diff --git a/IRaCIS.Core.Infra.EFCore/Interceptor/AuditEntityInterceptor.cs b/IRaCIS.Core.Infra.EFCore/Interceptor/AuditEntityInterceptor.cs index a3224346c..ad1ba2867 100644 --- a/IRaCIS.Core.Infra.EFCore/Interceptor/AuditEntityInterceptor.cs +++ b/IRaCIS.Core.Infra.EFCore/Interceptor/AuditEntityInterceptor.cs @@ -104,14 +104,14 @@ public class AuditEntityInterceptor(IUserInfo _userInfo, if (entry.Entity is IAuditUpdate updateEntity1) { updateEntity1.UpdateTime = DateTime.Now; - updateEntity1.UpdateUserId = _userInfo.Id; + updateEntity1.UpdateUserId = _userInfo.UserRoleId; } if (entry.Entity is ISoftDelete softDelete) { if (softDelete.IsDeleted) { - softDelete.DeleteUserId = _userInfo.Id; + softDelete.DeleteUserId = _userInfo.UserRoleId; softDelete.DeletedTime = DateTime.Now; } else @@ -133,7 +133,7 @@ public class AuditEntityInterceptor(IUserInfo _userInfo, } if (addEntity.CreateUserId == default(Guid)) { - addEntity.CreateUserId = _userInfo.Id; + addEntity.CreateUserId = _userInfo.UserRoleId; } } @@ -141,7 +141,7 @@ public class AuditEntityInterceptor(IUserInfo _userInfo, if (entry.Entity is IAuditUpdate updateEntity) { updateEntity.UpdateTime = DateTime.Now; - updateEntity.UpdateUserId = _userInfo.Id; + updateEntity.UpdateUserId = _userInfo.UserRoleId; } break; } diff --git a/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs b/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs index ddecbf4d5..0b2e88343 100644 --- a/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs +++ b/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs @@ -395,7 +395,7 @@ namespace IRaCIS.Core.Infra.EFCore public async Task BatchUpdateNoTrackingAsync(Expression> whereFilter, Expression> updateFactory) where T : Entity { - return await _dbContext.BatchUpdateNoTrackingAsync(whereFilter, updateFactory, _userInfo.Id); + return await _dbContext.BatchUpdateNoTrackingAsync(whereFilter, updateFactory, _userInfo.UserRoleId); //return await _dbContext.Set().IgnoreQueryFilters().Where(whereFilter).BatchUpdateAsync(updateFactory).ConfigureAwait(false) > 0; diff --git a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs index 300fe9ef1..741686c83 100644 --- a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs +++ b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs @@ -268,7 +268,7 @@ namespace IRaCIS.Core.Infra.EFCore Expression> updateFactory) { - return await _dbContext.BatchUpdateNoTrackingAsync(where, updateFactory, _userInfo.Id); + return await _dbContext.BatchUpdateNoTrackingAsync(where, updateFactory, _userInfo.UserRoleId); }