diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index b96f6ad8f..1d1690b49 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -3075,7 +3075,7 @@ SystemAnonymizationService - + SystemAnonymizationService @@ -14736,7 +14736,7 @@ - + IR影像阅片 @@ -15192,7 +15192,14 @@ - + + + 发送微信通知 + + + + + 计算返回的结果 为True表示不相等 @@ -17516,17 +17523,17 @@ - 质疑 + ���� - 一致性核查 + һ���Ժ˲� - 复制 + ���� diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index c4f54f1e5..61a44b71d 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -1,6 +1,7 @@ using DocumentFormat.OpenXml; using IRaCIS.Core.Application.Contracts; using IRaCIS.Core.Application.Helper; +using IRaCIS.Core.Application.Helper.OtherTool; using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.Service.ImageAndDoc; using IRaCIS.Core.Application.Service.Reading.Dto; @@ -10,6 +11,7 @@ using IRaCIS.Core.Infra.EFCore.Common; using IRaCIS.Core.Infrastructure; using MassTransit; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Options; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -68,6 +70,7 @@ namespace IRaCIS.Core.Application.Service IGeneralCalculateService _generalCalculateService, IRepository _readingQuestionTrialRepository, IRepository _taskStudyRepository, + IConfiguration _config, IDownloadAndUploadService _downloadAndUploadService, ITrialEmailNoticeConfigService _trialEmailNoticeConfigService, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService, IReadingImageTaskService @@ -3426,6 +3429,18 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task VerifyVisitTaskQuestions(VerifyVisitTaskQuestionsInDto inDto) { + //// 验证一个问题不能有多个答案 + //bool hasDuplicate = await _readingTaskQuestionAnswerRepository + // .Where(x => x.VisitTaskId == inDto.VisitTaskId) + // .GroupBy(x => x.ReadingQuestionTrialId) + // .AnyAsync(g => g.Count() > 1); + + //if (hasDuplicate) + //{ + // return ResponseOutput.NotOk(_localizer["ReadingImage_BackImageNotExist"]); + //} + + //验证后处理影像必须传 if (_visitTaskRepository.Any(t => t.Id == inDto.VisitTaskId && t.TrialReadingCriterion.ImageUploadEnum != ReadingImageUpload.None)) { diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs index f1a7a81ff..f86436cbf 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs @@ -1,5 +1,6 @@ using IRaCIS.Core.Application.Contracts; using IRaCIS.Core.Application.Filter; +using IRaCIS.Core.Application.Helper.OtherTool; using IRaCIS.Core.Application.Service.Reading.Dto; using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Domain.Share; @@ -7,6 +8,7 @@ using IRaCIS.Core.Infra.EFCore.Common; using IRaCIS.Core.Infrastructure; using MassTransit; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; using Newtonsoft.Json; namespace IRaCIS.Core.Application.Service @@ -676,7 +678,7 @@ namespace IRaCIS.Core.Application.Service JudgeDifferenceType = x.Key.JudgeDifferenceType, TaskAnswerList = x.Select(y => y.Answer).ToList(), }).ToList(); - noteEqual = noteEqual || ComputeJudgeResult(groupTasks); + noteEqual = noteEqual || ComputeJudgeResult(groupTasks, visitTask.Id); } } @@ -708,7 +710,7 @@ namespace IRaCIS.Core.Application.Service JudgeDifferenceType = x.Key.JudgeDifferenceType, TaskAnswerList = x.Select(y => y.Answer).ToList(), }).ToList(); - noteEqual = ComputeJudgeResult(groupTasks); + noteEqual = ComputeJudgeResult(groupTasks, visitTask.Id); } break; @@ -757,7 +759,8 @@ namespace IRaCIS.Core.Application.Service JudgeDifferenceValue = x.Key.JudgeDifferenceValue, JudgeDifferenceType = x.Key.JudgeDifferenceType, }).ToList(); - noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks); + + noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks, visitTask.Id); } } @@ -819,7 +822,8 @@ namespace IRaCIS.Core.Application.Service JudgeDifferenceType = x.Key.JudgeDifferenceType, TaskAnswerList = x.Select(y => y.Answer).ToList(), }).ToList(); - noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks); + + noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks, visitTask.Id); } @@ -922,12 +926,60 @@ namespace IRaCIS.Core.Application.Service } + /// + /// 发送微信通知 + /// + /// + /// + public async Task SendWeComNotifier(Guid visiTaskId,string msg) + { + try + { + bool isOpenWeComNotice = _config.GetValue("WeComNoticeConfig:IsOpenWeComNotice"); + + if (isOpenWeComNotice) + { + string webhook = _config["WeComNoticeConfig:WebhookUrl"] ?? string.Empty; + + var uri = new Uri(_config["SystemEmailSendConfig:SiteUrl"]); + var baseUrl = uri.GetLeftPart(UriPartial.Authority); + + var userList = _config.GetSection("WeComNoticeConfig:APINoticeUserList").Get(); + + + + // 🔔 异步告警(不要阻塞请求) + _ = WeComNotifier.SendAlertAsync( + webhook: webhook, + alert: new WeComAlert + { + Env = baseUrl, + UserName = msg, + Api = "", + Message = $"异常信息:{msg}", + Stack = string.Empty, + AtUsers = userList ?? [] + } + ); + + } + + + } + catch (Exception ex) + { + Log.Logger.Error($"MassTransit里发送企业微信出现错误:{ex.Message}"); + } + } + + + /// /// 计算返回的结果 为True表示不相等 /// /// /// - private bool ComputeJudgeResult(List groupTasks) + private bool ComputeJudgeResult(List groupTasks,Guid visiTaskId) { var noteEqual = false; foreach (var item in groupTasks) @@ -935,12 +987,12 @@ namespace IRaCIS.Core.Application.Service // 裁判问题可以不必填 if(item.TaskAnswerList.Count()==0) { - break; + _ = SendWeComNotifier(visiTaskId, "两个阅片任务的答案等于0"); } else if (item.TaskAnswerList.Count() != 2) { - noteEqual = true; - break; + // 发送微信通知 + _ = SendWeComNotifier(visiTaskId, "两个阅片任务的答案不等于2"); } else if (noteEqual) {