diff --git a/IRaCIS.Core.API/appsettings.Development.json b/IRaCIS.Core.API/appsettings.Development.json index c4b06e481..96aa3b8e8 100644 --- a/IRaCIS.Core.API/appsettings.Development.json +++ b/IRaCIS.Core.API/appsettings.Development.json @@ -21,9 +21,9 @@ "Endpoint": "https://oss-cn-shanghai.aliyuncs.com", "AccessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ", "AccessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio", - "BucketName": "zyypacs", + "BucketName": "zy-irc-test-store", "RoleArn": "acs:ram::1899121822495495:role/oss-upload", - "ViewEndpoint": "https://zyypacs.oss-cn-shanghai.aliyuncs.com", + "ViewEndpoint": "https://zy-irc-test-store.oss-cn-shanghai.aliyuncs.com", "Region": "oss-cn-shanghai" }, @@ -42,11 +42,12 @@ "Endpoint": "https://oss-cn-shanghai.aliyuncs.com", "AccessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ", "AccessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio", - "BucketName": "zyypacs", + "BucketName": "zy-irc-test-store", "RoleArn": "acs:ram::1899121822495495:role/oss-upload", - "ViewEndpoint": "https://zyypacs.oss-cn-shanghai.aliyuncs.com", + "ViewEndpoint": "https://zy-irc-test-store.oss-cn-shanghai.aliyuncs.com", "Region": "oss-cn-shanghai" }, + "BasicSystemConfig": { "OpenUserComplexPassword": false, diff --git a/IRaCIS.Core.API/appsettings.Production.json b/IRaCIS.Core.API/appsettings.Production.json index 442c3a8d1..5aa029aa1 100644 --- a/IRaCIS.Core.API/appsettings.Production.json +++ b/IRaCIS.Core.API/appsettings.Production.json @@ -11,6 +11,16 @@ "RemoteNew": "Server=101.132.193.237,1433;Database=IRaCIS.Production;User ID=sa;Password=zhanying2021;TrustServerCertificate=true", "Hangfire": "Server=101.132.193.237,1433;Database=Hangfire.IRaCIS.Production;User ID=sa;Password=zhanying2021;TrustServerCertificate=true" }, + + "AliyunOSS": { + "regionId": "cn-shanghai", + "region": "oss-cn-shanghai", + "endpoint": "https://oss-cn-shanghai.aliyuncs.com", + "accessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ", + "accessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio", + "bucketName": "zy-irc-store", + "viewEndpoint": "https://zy-irc-cache.oss-cn-shanghai.aliyuncs.com" + }, "BasicSystemConfig": { "OpenUserComplexPassword": true, @@ -22,13 +32,6 @@ "LoginFailLockMinutes": 30 }, - //"SystemEmailSendConfig": { - // "Port": 465, - // "Host": "smtp.163.com", - // "FromEmail": "zhou941003@qq.com", - // "FromName": "hangZhou", - // "AuthorizationCode": "sqfhlpfdvnexbcab" - //} "SystemEmailSendConfig": { "Port": 465, diff --git a/IRaCIS.Core.API/appsettings.Staging.json b/IRaCIS.Core.API/appsettings.Staging.json index 708834b73..0564ea927 100644 --- a/IRaCIS.Core.API/appsettings.Staging.json +++ b/IRaCIS.Core.API/appsettings.Staging.json @@ -7,9 +7,21 @@ } }, "ConnectionStrings": { - "RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=IRaCIS_Verify;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true", - "Hangfire": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Hangfire_IRaCIS;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true" + "RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Uat_IRC;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true", + "Hangfire": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Uat.Study.Hangfire;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true" }, + + "AliyunOSS": { + "RegionId": "cn-shanghai", + "Endpoint": "https://oss-cn-shanghai.aliyuncs.com", + "AccessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ", + "AccessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio", + "BucketName": "zy-irc-uat-store", + "RoleArn": "acs:ram::1899121822495495:role/oss-upload", + "ViewEndpoint": "https://zy-irc-uat-store.oss-cn-shanghai.aliyuncs.com", + "Region": "oss-cn-shanghai" + }, + "BasicSystemConfig": { "OpenUserComplexPassword": true, diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index cce22df5d..5db76d015 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -181,12 +181,6 @@ 医学审核生成规则 废弃 - - - 产生医学审核 - - - 任务医学审核 diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewRuleService.cs index 8b27e8f75..1c25af2f0 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewRuleService.cs @@ -78,120 +78,7 @@ namespace IRaCIS.Core.Application.Service return ResponseOutput.Ok(); } - /// - /// 产生医学审核 - /// - /// - [Obsolete] - public async Task GenerateMedicalReviewTask(GenerateMedicalReviewTaskCommand generateCommand) - { - var trialId = generateCommand.TrialId; - //var mimUserList = await _trialUserRepository.Where(t => t.User.UserTypeEnum == Domain.Share.UserTypeEnum.MIM && t.TrialId == trialId).Select(t => t.User).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); - - - - Guid? defalutMIMUserId = null /*mimUserList.FirstOrDefault()?.UserId*/; - - //获取当前医生数据 已经生成的,和配置的数量 - var taskTaskMedicalReviewRuleList = await _taskMedicalReviewRuleRepository.Where(t => t.TrialId == trialId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); - - foreach (var item in taskTaskMedicalReviewRuleList) - { - - if (item.IsEnable) - { - - if (item.PlanGlobalCount > item.GeneratedGlobalCount) - { - var needGenerateCount = item.PlanGlobalCount - item.GeneratedGlobalCount; - - var canGenerateCount = item.ActualGlobalCount - item.GeneratedGlobalCount; - - var toGenerateCount = canGenerateCount > needGenerateCount ? needGenerateCount : canGenerateCount; - - //分配给MIM - - if (toGenerateCount > 0) - { - var toGenerateTaskList = item.ActualGlobalTaskList.ExceptBy(item.GeneratedGlobalTaskList.Select(t => t.TaskId), t => t.TaskId).Take(toGenerateCount).ToList(); - - foreach (var toGenerateTask in toGenerateTaskList) - { - await _taskMedicalReviewRepository.AddAsync(new TaskMedicalReview() { DoctorUserId = toGenerateTask.DoctorUserId!.Value, TrialId = toGenerateTask.TrialId, VisitTaskId = toGenerateTask.TaskId, MedicalManagerUserId = defalutMIMUserId }); - } - } - - - } - if (item.PlanJudgeCount > item.GeneratedJudgeCount) - { - var needGenerateCount = item.PlanJudgeCount - item.GeneratedJudgeCount; - - var canGenerateCount = item.ActualJudgeCount - item.GeneratedGlobalCount; - - var toGenerateCount = canGenerateCount > needGenerateCount ? needGenerateCount : canGenerateCount; - - if (toGenerateCount > 0) - { - var toGenerateTaskList = item.ActualJudgeTaskList.ExceptBy(item.GeneratedJudgeTaskList.Select(t => t.TaskId), t => t.TaskId).Take(toGenerateCount).ToList(); - - foreach (var toGenerateTask in toGenerateTaskList) - { - await _taskMedicalReviewRepository.AddAsync(new TaskMedicalReview() { DoctorUserId = toGenerateTask.DoctorUserId!.Value, TrialId = toGenerateTask.TrialId, VisitTaskId = toGenerateTask.TaskId, MedicalManagerUserId = defalutMIMUserId }); - } - } - - } - if (item.PlanTumorCount > item.GeneratedTumorCount) - { - var needGenerateCount = item.PlanTumorCount - item.GeneratedTumorCount; - - var canGenerateCount = item.ActualTumorCount - item.GeneratedGlobalCount; - - var toGenerateCount = canGenerateCount > needGenerateCount ? needGenerateCount : canGenerateCount; - - if (toGenerateCount > 0) - { - var toGenerateTaskList = item.ActualTumorTaskList.ExceptBy(item.GeneratedTumorTaskList.Select(t => t.TaskId), t => t.TaskId).Take(toGenerateCount).ToList(); - - foreach (var toGenerateTask in toGenerateTaskList) - { - await _taskMedicalReviewRepository.AddAsync(new TaskMedicalReview() { DoctorUserId = toGenerateTask.DoctorUserId!.Value, TrialId = toGenerateTask.TrialId, VisitTaskId = toGenerateTask.TaskId, MedicalManagerUserId = defalutMIMUserId }); - } - } - - } - if (item.PlanVisitCount > item.GeneratedVisitCount) - { - var needGenerateCount = item.PlanVisitCount - item.GeneratedVisitCount; - - var canGenerateCount = item.ActualVisitCount - item.GeneratedGlobalCount; - - var toGenerateCount = canGenerateCount > needGenerateCount ? needGenerateCount : canGenerateCount; - - if (toGenerateCount > 0) - { - - var toGenerateTaskList = item.ActualVisitTaskList.ExceptBy(item.GeneratedVisitTaskList.Select(t => t.TaskId), t => t.TaskId).Take(toGenerateCount).ToList(); - - foreach (var toGenerateTask in toGenerateTaskList) - { - await _taskMedicalReviewRepository.AddAsync(new TaskMedicalReview() { DoctorUserId = toGenerateTask.DoctorUserId!.Value, TrialId = toGenerateTask.TrialId, VisitTaskId = toGenerateTask.TaskId, MedicalManagerUserId = defalutMIMUserId }); - } - } - - } - - } - - } - - - await _taskMedicalReviewRepository.SaveChangesAsync(); - return ResponseOutput.Ok(); - - } } diff --git a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs index 6c41c6688..9917ab527 100644 --- a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs +++ b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs @@ -458,8 +458,12 @@ namespace IRaCIS.Core.Application.Service { throw new BusinessValidationFailedException(_localizer["MedicalReview_SaveQuestion"]); } + var medicalReview = await _taskMedicalReviewRepository.Where(x => x.Id == inDto.TaskMedicalReviewId).FirstNotNullAsync(); + await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview() { + + LatestReplyUserId = (inDto.IsSendDialog && !medicalReview.IsSendMessage && inDto.IsHaveQuestion) ? _userInfo.Id : null, IsHaveQuestion = inDto.IsHaveQuestion, Questioning = inDto.Questioning, IsSendMessage = inDto.IsSendDialog && inDto.IsHaveQuestion, @@ -468,9 +472,8 @@ namespace IRaCIS.Core.Application.Service AuditAdviceEnum = inDto.AuditAdviceEnum, SaveConclusionTime = DateTime.Now, - }); + }); ; - var medicalReview = await _taskMedicalReviewRepository.Where(x => x.Id == inDto.TaskMedicalReviewId).FirstNotNullAsync(); if (inDto.IsSendDialog&& !medicalReview.IsSendMessage && inDto.IsHaveQuestion) { @@ -503,6 +506,7 @@ namespace IRaCIS.Core.Application.Service { await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview() { + LatestReplyUserId=_userInfo.Id, IsClosedDialog = inDto.IsClosedDialog, MedicalDialogCloseEnum=inDto.MedicalDialogCloseEnum, DialogCloseReason=inDto.DialogCloseReason, @@ -539,6 +543,11 @@ namespace IRaCIS.Core.Application.Service throw new BusinessValidationFailedException(_localizer["MedicalReview_invalid"]); } + await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview() + { + LatestReplyUserId = _userInfo.Id, + }); + var visitTaskId = await _taskMedicalReviewRepository.Where(x => x.Id == inDto.TaskMedicalReviewId).Select(x => x.VisitTaskId).FirstOrDefaultAsync(); ReadingMedicalReviewDialog dialog = new ReadingMedicalReviewDialog() { @@ -592,6 +601,7 @@ namespace IRaCIS.Core.Application.Service await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(x => !x.IsClosedDialog && x.Id == inDto.TaskMedicalReviewId, x => new TaskMedicalReview() { + LatestReplyUserId=_userInfo.Id, IsClosedDialog = true, MedicalDialogCloseEnum = MedicalDialogClose.IRApplyReReading, @@ -605,6 +615,7 @@ namespace IRaCIS.Core.Application.Service await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview() { + LatestReplyUserId=_userInfo.Id, DoctorUserIdeaEnum = inDto.DoctorUserIdeaEnum, }); ReadingMedicalReviewDialog dialog = new ReadingMedicalReviewDialog() @@ -732,10 +743,11 @@ namespace IRaCIS.Core.Application.Service await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview() { + LatestReplyUserId = _userInfo.Id, DoctorUserIdeaEnum = inDto.DoctorUserIdeaEnum, DisagreeReason = inDto.DisagreeReason, - IsApplyHeavyReading=inDto.IsApplyHeavyReading, - }); + IsApplyHeavyReading = inDto.IsApplyHeavyReading, + }); ; var visitTaskId = await _taskMedicalReviewRepository.Where(x => x.Id == inDto.TaskMedicalReviewId).Select(x => x.VisitTaskId).FirstOrDefaultAsync(); await _readingMedicalReviewDialogRepository.AddAsync(new ReadingMedicalReviewDialog() diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs index f8c9eb00c..3b7dc4c5b 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs @@ -612,11 +612,11 @@ namespace IRaCIS.Core.Application TrialCode = t.TrialCode, UrgentCount = t.SubjectVisitList .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) - .Where(u => u.SubmitState == SubmitStateEnum.ToSubmit && u.IsUrgent && u.IsPMBackOrReReading).Count(), + .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(u => u.SubmitState == SubmitStateEnum.ToSubmit && u.IsPMBackOrReReading).Count(), + .Where(u => (u.SubmitState == SubmitStateEnum.ToSubmit && u.IsPMBackOrReReading) ||(u.IsQCConfirmedReupload)).Count(), }).Where(x => x.ToBeReUploadCount > 0); @@ -624,7 +624,7 @@ namespace IRaCIS.Core.Application var toBeDealedCount = _subjectVisitRepository .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(u => u.SubmitState == SubmitStateEnum.ToSubmit && u.IsPMBackOrReReading).Count(); + .Where(u => (u.SubmitState == SubmitStateEnum.ToSubmit && u.IsPMBackOrReReading) || (u.IsQCConfirmedReupload)).Count(); return ResponseOutput.Ok(result, new { TotalToBeReUploadCount = toBeDealedCount }); @@ -956,6 +956,11 @@ namespace IRaCIS.Core.Application TrialReadingCriterionId = g.Key.TrialReadingCriterionId, #region 不能对包含聚合或子查询的表达式执行聚合函数 + + + UrgentCount = g.Where(u => u.VisitTask.IsUrgent && u.LatestReplyUser.UserTypeEnum== UserTypeEnum.MIM).Count(), + + ToBeReplyedCount = g.Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.MIM).Count(), #endregion //UrgentCount = g.Where(u => u.VisitTask.IsUrgent @@ -971,7 +976,9 @@ namespace IRaCIS.Core.Application var toBeDealedCount = _taskMedicalReviewRepository .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(t => t.IsClosedDialog == false && t.VisitTask.DoctorUserId == _userInfo.Id) - .Where(u => u.ReadingMedicalReviewDialogList.OrderByDescending(l => l.CreateTime).First().UserTypeEnumInt == (int)UserTypeEnum.MIM).Count(); + .Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.MIM) + //.Where(u => u.ReadingMedicalReviewDialogList.OrderByDescending(l => l.CreateTime).First().UserTypeEnumInt == (int)UserTypeEnum.MIM) + .Count(); return ResponseOutput.Ok(result, new { TotalToBeReplyedCount = toBeDealedCount }); @@ -1019,6 +1026,10 @@ namespace IRaCIS.Core.Application TrialCode = g.Key.TrialCode, CriterionName = g.Key.CriterionName, + UrgentCount = g.Where(u => u.VisitTask.IsUrgent).Select(u => u.VisitTask.IsUrgent && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IndependentReviewer).Count(), + + ToBeReplyedCount = g.Select(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IndependentReviewer).Count(), + //UrgentCount = g.Where(u => u.VisitTask.IsUrgent).Select(u => u.ReadingMedicalReviewDialogList.OrderByDescending(l => l.CreateTime).First()).Count(t => t.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer), //ToBeReplyedCount = g.Select(t => t.ReadingMedicalReviewDialogList.OrderByDescending(l => l.CreateTime).First()).Count(t => t.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer), @@ -1036,7 +1047,9 @@ namespace IRaCIS.Core.Application var toBeReplyedQuery = _taskMedicalReviewRepository .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(t => t.IsClosedDialog == false) - .Where(u => u.ReadingMedicalReviewDialogList.OrderByDescending(l => l.CreateTime).First().UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer); + .Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IndependentReviewer); + + //.Where(u => u.ReadingMedicalReviewDialogList.OrderByDescending(l => l.CreateTime).First().UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer); var toBeReplyedCount = toBeReplyedQuery.Count(); diff --git a/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs b/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs index 901e4c984..83a31484f 100644 --- a/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs +++ b/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs @@ -19,7 +19,10 @@ namespace IRaCIS.Core.Domain.Models [Table("TaskMedicalReview")] public class TaskMedicalReview : Entity, IAuditUpdate, IAuditAdd { + [JsonIgnore] + public User LatestReplyUser { get; set; } + public Guid? LatestReplyUserId { get; set; } /// /// CreateUserId