From 6cde1b440512568b71cbae2b2181d78bb90a994c Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 29 Oct 2024 15:23:36 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E8=87=B4?= =?UTF-8?q?=E6=80=A7=E6=A0=B8=E6=9F=A5=E5=AF=BC=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ExtraController.cs | 6 +- IRaCIS.Core.API/IRaCIS.Core.API.xml | 6 +- .../Helper/OtherTool/RestClientAPI.cs | 90 +++++++++++++++++++ .../Consumer/ConsistencyCheckConsumer.cs | 2 +- .../Service/QC/DTO/QCListViewModel.cs | 3 +- 5 files changed, 99 insertions(+), 8 deletions(-) create mode 100644 IRaCIS.Core.Application/Helper/OtherTool/RestClientAPI.cs diff --git a/IRaCIS.Core.API/Controllers/ExtraController.cs b/IRaCIS.Core.API/Controllers/ExtraController.cs index 7ee7324aa..8a9bc6b12 100644 --- a/IRaCIS.Core.API/Controllers/ExtraController.cs +++ b/IRaCIS.Core.API/Controllers/ExtraController.cs @@ -395,10 +395,10 @@ namespace IRaCIS.Api.Controllers /// 后端通过这个code ,带上客户端信息,和授权类型 可以向单点登录提供商,获取厂商token /// /// 但是单点登录提供商提供的token 和我们系统的token 是有区别的,我们的token里面有我们业务系统的UserId,涉及到很多业务操作,所以在此出现了两种方案 - /// 1、前段使用厂商的Token。 后端通过code 获取厂商的Token 返回前端的同时返回我们系统的UserId,前段在http 请求头加上一个自定义参数,带上UserId 后端取用户Id的地方变动下, + /// 1、前端使用厂商的Token。 后端通过code 获取厂商的Token 返回前端的同时返回我们系统的UserId,前段在http 请求头加上一个自定义参数,带上UserId 后端取用户Id的地方变动下, /// 但是除了UserId外,后端还有其他信息也是从Token取的,所以在请求头也需要带上,此外后端认证Token的方式也需要变化,改造成本稍大(如果是微服务,做这种处理还是可以的)。 - /// 2、前段还是使用我们后台自己的Token。后端通过code 获取厂商Token的同时,后端做一个隐藏登录,返回厂商的Token的同时,也返回我们系统的Token。 - /// (像我们单体,这种方式最简单,我们用单点登录,无非就是不想记多个系统的密码,自动登录而已,其他不支持的项目改造陈本也是最低的) + /// 2、前端还是使用我们后台自己的Token。后端通过code 获取厂商Token的同时,后端做一个隐藏登录,返回厂商的Token的同时,也返回我们系统的Token。 + /// (像我们单体,这种方式最简单,我们用单点登录,无非就是不想记多个系统的密码,自动登录而已,其他不支持的项目改造成本也是最低的) /// /// 回调的厂商类型 比如github, google, 我们用的logto ,不同的厂商回调到前端的地址可以不同的,但是请求后端的接口可以是同一个 /// 在第三方平台登录成功后,回调前端的时候会返回一个code diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml index f1145cb26..99b7643fa 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.xml +++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml @@ -39,10 +39,10 @@ 后端通过这个code ,带上客户端信息,和授权类型 可以向单点登录提供商,获取厂商token 但是单点登录提供商提供的token 和我们系统的token 是有区别的,我们的token里面有我们业务系统的UserId,涉及到很多业务操作,所以在此出现了两种方案 - 1、前段使用厂商的Token。 后端通过code 获取厂商的Token 返回前端的同时返回我们系统的UserId,前段在http 请求头加上一个自定义参数,带上UserId 后端取用户Id的地方变动下, + 1、前端使用厂商的Token。 后端通过code 获取厂商的Token 返回前端的同时返回我们系统的UserId,前段在http 请求头加上一个自定义参数,带上UserId 后端取用户Id的地方变动下, 但是除了UserId外,后端还有其他信息也是从Token取的,所以在请求头也需要带上,此外后端认证Token的方式也需要变化,改造成本稍大(如果是微服务,做这种处理还是可以的)。 - 2、前段还是使用我们后台自己的Token。后端通过code 获取厂商Token的同时,后端做一个隐藏登录,返回厂商的Token的同时,也返回我们系统的Token。 - (像我们单体,这种方式最简单,我们用单点登录,无非就是不想记多个系统的密码,自动登录而已,其他不支持的项目改造陈本也是最低的) + 2、前端还是使用我们后台自己的Token。后端通过code 获取厂商Token的同时,后端做一个隐藏登录,返回厂商的Token的同时,也返回我们系统的Token。 + (像我们单体,这种方式最简单,我们用单点登录,无非就是不想记多个系统的密码,自动登录而已,其他不支持的项目改造成本也是最低的) 回调的厂商类型 比如github, google, 我们用的logto ,不同的厂商回调到前端的地址可以不同的,但是请求后端的接口可以是同一个 在第三方平台登录成功后,回调前端的时候会返回一个code diff --git a/IRaCIS.Core.Application/Helper/OtherTool/RestClientAPI.cs b/IRaCIS.Core.Application/Helper/OtherTool/RestClientAPI.cs new file mode 100644 index 000000000..f51a01db5 --- /dev/null +++ b/IRaCIS.Core.Application/Helper/OtherTool/RestClientAPI.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Security; +using System.Net; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; +using RestSharp; +using Newtonsoft.Json; +using IRaCIS.Core.Infrastructure.Extention; +using NPOI.SS.Formula.Functions; + +namespace IRaCIS.Core.Application.Helper.OtherTool +{ + public static class RestClientAPI + { + public static async Task GetAsync(string api, Dictionary query = null, Dictionary headers = null) + { + using var _client = new RestClient(); + + var request = new RestRequest(api, Method.Get); + + if (query != null) + { + foreach (var kv in query) + { + request.AddParameter(kv.Key, kv.Value); + } + } + + if (headers != null) + { + foreach (var header in headers) + { + request.AddHeader(header.Key, header.Value); + } + } + + + var response = await _client.ExecuteAsync(request); + + if (response.IsSuccessful) + { + return JsonConvert.DeserializeObject(response.Content ?? string.Empty); + + } + else + { + Console.WriteLine($"请求失败,错误代码: {response.StatusCode}, 错误消息: {response.ErrorMessage}"); + return JsonConvert.DeserializeObject(string.Empty); + } + + } + + public static async Task PostAsync(string api, object jsonObj = null, Dictionary headers = null) + { + using var _client = new RestClient(); + + var request = new RestRequest(api, Method.Post); + + if (jsonObj != null) + { + request.AddJsonBody(jsonObj); + } + + if (headers != null) + { + foreach (var header in headers) + { + request.AddHeader(header.Key, header.Value); + } + } + + + var response = await _client.ExecuteAsync(request); + + if (response.IsSuccessful) + { + return JsonConvert.DeserializeObject(response.Content ?? string.Empty); + + } + else + { + Console.WriteLine($"请求失败,错误代码: {response.StatusCode}, 错误消息: {response.ErrorMessage}"); + return JsonConvert.DeserializeObject(string.Empty); + } + } + } +} diff --git a/IRaCIS.Core.Application/MassTransit/Consumer/ConsistencyCheckConsumer.cs b/IRaCIS.Core.Application/MassTransit/Consumer/ConsistencyCheckConsumer.cs index 30e8faaab..0efce758d 100644 --- a/IRaCIS.Core.Application/MassTransit/Consumer/ConsistencyCheckConsumer.cs +++ b/IRaCIS.Core.Application/MassTransit/Consumer/ConsistencyCheckConsumer.cs @@ -236,7 +236,7 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer } dialogMsg.AppendLine($"
"); - dialogMsg.AppendLine(@$"
{_localizer["ConsistencyVerification_Desc"]}
"); + dialogMsg.AppendLine(@$"
{_localizer["ConsistencyVerification_Desc"]}
"); dbSV.CheckResult = _localizer["ConsistencyVerification_Conf"] + String.Join(" | ", dbExceptExcel.Select(t => $"{_localizer["ConsistencyVerification_EdcL", t.StudyDate, t.Modality]}")) + " | " diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs index 729cbdbe4..baca35733 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs @@ -352,7 +352,8 @@ namespace IRaCIS.Core.Application.Contracts public string Content { get; set; } - public string ContentReplaced => Content.Replace("
", "").Replace("
", "").Replace("
", "").Replace("
", "").Replace("
", ""); + public string ContentReplaced => Content.Replace("
", "").Replace("
", "").Replace("
", "") + .Replace("
", "").Replace("
", "").Replace("
", ""); } From 052bff92471c0e56c1ebc89f3aadcea09b80a81b Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 29 Oct 2024 15:45:22 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E5=AF=BC?= =?UTF-8?q?=E8=A1=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTO/InternationalizationViewModel.cs | 36 +++++++++++++++++++ .../Service/Common/ExcelExportService.cs | 16 +++++---- .../Common/InternationalizationService.cs | 4 +++ .../Service/Common/_MapConfig.cs | 4 +++ .../_IRaCIS/_Config/_StaticData.cs | 2 ++ 5 files changed, 56 insertions(+), 6 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Common/DTO/InternationalizationViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/InternationalizationViewModel.cs index 77d83493e..86c3a9e6b 100644 --- a/IRaCIS.Core.Application/Service/Common/DTO/InternationalizationViewModel.cs +++ b/IRaCIS.Core.Application/Service/Common/DTO/InternationalizationViewModel.cs @@ -3,6 +3,8 @@ // 生成时间 2023-06-01 13:38:20 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 //-------------------------------------------------------------------- +using IRaCIS.Core.Application.Helper; + namespace IRaCIS.Core.Application.ViewModel { /// InternationalizationView 列表视图模型 @@ -19,6 +21,32 @@ namespace IRaCIS.Core.Application.ViewModel } + public class InternationExportDTO + { + public Guid? Id { get; set; } + + [DictionaryTranslateAttribute("InternationalizationKeyState")] + public int State { get; set; } + public string Description { get; set; } = string.Empty; + public string Code { get; set; } = string.Empty; + public string Value { get; set; } = string.Empty; + public string ValueCN { get; set; } = string.Empty; + + public string FrontType { get; set; } = string.Empty; + + [DictionaryTranslateAttribute("InternationalizationType")] + public int InternationalizationType { get; set; } + public string Module { get; set; } = string.Empty; + //关联版本历史记录表Id + public Guid? PublishLogId { get; set; } + + public string Version { get; set; } + + public DateTime CreateTime { get; set; } + + public DateTime UpdateTime { get; set; } + } + ///InternationalizationQuery 列表查询参数模型 public class InternationalizationQuery : PageInput { @@ -34,6 +62,14 @@ namespace IRaCIS.Core.Application.ViewModel //关联版本历史记录表Id public Guid? PublishLogId { get; set; } + public DateTime? BeginCreateTime { get; set; } + + public DateTime? EndCreatTime { get; set; } + + public DateTime? BeginUpdateTime { get; set; } + + public DateTime? EndUpdateTime { get; set; } + } /// InternationalizationAddOrEdit 列表查询参数模型 diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index f16898812..59d048b5e 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -1304,7 +1304,11 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(inQuery.InternationalizationType != null, t => t.InternationalizationType == inQuery.InternationalizationType) .WhereIf(inQuery.Value != null, t => t.Value.Contains(inQuery.Value)) .WhereIf(inQuery.ValueCN != null, t => t.ValueCN.Contains(inQuery.ValueCN)) - .ProjectTo(_mapper.ConfigurationProvider); + .WhereIf(inQuery.BeginCreateTime != null, t => t.CreateTime >= inQuery.BeginCreateTime) + .WhereIf(inQuery.EndCreatTime != null, t => t.CreateTime <= inQuery.EndCreatTime) + .WhereIf(inQuery.BeginUpdateTime != null, t => t.UpdateTime >= inQuery.BeginUpdateTime) + .WhereIf(inQuery.EndUpdateTime != null, t => t.UpdateTime <= inQuery.EndUpdateTime) + .ProjectTo(_mapper.ConfigurationProvider); var list = internationalizationQueryable.SortToListAsync(inQuery); @@ -1312,7 +1316,7 @@ namespace IRaCIS.Core.Application.Service.Common exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId); exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId); - return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialSCPImageUploadList_Export, exportInfo, $"{exportInfo.ResearchProgramNo}", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(InternationalizationView)); + return await ExcelExportHelper.DataExportAsync(StaticData.Export.Internationalization_Export, exportInfo, $"{exportInfo.ResearchProgramNo}", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(InternationExportDTO)); } @@ -1663,7 +1667,7 @@ namespace IRaCIS.Core.Application.Service.Common if (judegeList.Count > 0) { - var maxFinishedJudge = judegeList.Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned).OrderByDescending(t=>t.VisitTaskNum).FirstOrDefault(); + var maxFinishedJudge = judegeList.Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned).OrderByDescending(t => t.VisitTaskNum).FirstOrDefault(); var maxNotFinishedJudge = judegeList.Where(t => t.ReadingTaskState != ReadingTaskState.HaveSigned).FirstOrDefault(); @@ -2260,7 +2264,7 @@ namespace IRaCIS.Core.Application.Service.Common .GroupBy(t => new { t.SubjectId, t.SourceSubjectVisitId }) .Where(g => g.Count() == 2).Select(g => g.Key.SourceSubjectVisitId).Distinct().Count(); - exportInfo.JudgeVisitCount = _visitTaskRepository.Where(comonTaskFilter).Where(t => t.ReadingCategory == ReadingCategory.Judge ).Count(); + exportInfo.JudgeVisitCount = _visitTaskRepository.Where(comonTaskFilter).Where(t => t.ReadingCategory == ReadingCategory.Judge).Count(); //3、裁判认同数M:触发裁判的受试者访视中,阅片人被裁判认同的访视数量; //4、总裁判数N:阅片人所阅的受试者访视中,触发裁判的访视数量; @@ -2329,11 +2333,11 @@ namespace IRaCIS.Core.Application.Service.Common //2、总样本量Q:R1,R2均完成阅片的阅片期数量; exportInfo.ReadingPeriodCount = _visitTaskRepository.Where(comonTaskFilter).Where(t => t.ReadingCategory == ReadingCategory.Global && t.ReadingTaskState == ReadingTaskState.HaveSigned) - .GroupBy(t => new { t.SubjectId, t.SouceReadModuleId }) + .GroupBy(t => new { t.SubjectId, t.SouceReadModuleId }) .Where(g => g.Count() == 2).Select(g => g.Key.SouceReadModuleId).Distinct().Count(); exportInfo.judgeReadingPeriodCount = _visitTaskRepository.Where(comonTaskFilter).Where(t => t.ReadingCategory == ReadingCategory.Global && t.ReadingTaskState == ReadingTaskState.HaveSigned) - .GroupBy(t => new { t.SubjectId, t.SouceReadModuleId }) + .GroupBy(t => new { t.SubjectId, t.SouceReadModuleId }) .Where(g => g.Count() == 2 && g.Any(c => c.JudgeVisitTaskId != null)).Select(g => g.Key.SouceReadModuleId).Distinct().Count(); //3、裁判认同数J:触发裁判的阅片期中,阅片人被裁判认同的阅片期数量; diff --git a/IRaCIS.Core.Application/Service/Common/InternationalizationService.cs b/IRaCIS.Core.Application/Service/Common/InternationalizationService.cs index 5adee87e1..f7d6a38b0 100644 --- a/IRaCIS.Core.Application/Service/Common/InternationalizationService.cs +++ b/IRaCIS.Core.Application/Service/Common/InternationalizationService.cs @@ -101,6 +101,10 @@ namespace IRaCIS.Core.Application.Service .WhereIf(inQuery.InternationalizationType != null, t => t.InternationalizationType == inQuery.InternationalizationType) .WhereIf(inQuery.Value != null, t => t.Value.Contains(inQuery.Value)) .WhereIf(inQuery.ValueCN != null, t => t.ValueCN.Contains(inQuery.ValueCN)) + .WhereIf(inQuery.BeginCreateTime != null, t => t.CreateTime >= inQuery.BeginCreateTime) + .WhereIf(inQuery.EndCreatTime != null, t => t.CreateTime <= inQuery.EndCreatTime) + .WhereIf(inQuery.BeginUpdateTime != null, t => t.UpdateTime >= inQuery.BeginUpdateTime) + .WhereIf(inQuery.EndUpdateTime != null, t => t.UpdateTime <= inQuery.EndUpdateTime) .ProjectTo(_mapper.ConfigurationProvider); var pageList = await internationalizationQueryable diff --git a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs index 607f64bfc..8ff1c86e0 100644 --- a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs @@ -67,6 +67,10 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(o => o.Version, t => t.MapFrom(u => u.PublishLog.Version)); + + CreateMap() + .ForMember(o => o.Version, t => t.MapFrom(u => u.PublishLog.Version)); + CreateMap().ReverseMap(); CreateMap().ReverseMap(); diff --git a/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs b/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs index 6b6add65e..f936d4bfa 100644 --- a/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs +++ b/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs @@ -240,6 +240,8 @@ public static class StaticData public static string TrialSCPImageUploadPatientList_Export = "TrialSCPImageUploadPatientList_Export"; + public static string Internationalization_Export = "Internationalization_Export"; + //public const string TrialRECIST1Point1SelfAnalysisList_Export = "TrialRECIST1Point1SelfAnalysisList_Export"; //public const string TrialRECIST1Point1GroupAnalysisList_Export = "TrialRECIST1Point1GroupAnalysisList_Export"; From fc392e869c1af7ca99b184fad7f8d94992835c8a Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 29 Oct 2024 15:55:59 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A3=81=E5=88=A4?= =?UTF-8?q?=E4=B8=80=E8=87=B4=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Common/ExcelExportService.cs | 2 +- IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index 59d048b5e..04c73888f 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -2346,7 +2346,7 @@ namespace IRaCIS.Core.Application.Service.Common var doctor2List = _visitTaskRepository.Where(comonTaskFilter).Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) .GroupBy(t => new { t.DoctorUserId, t.DoctorUser.UserName, t.DoctorUser.FullName }) //有全局裁判 - .Where(g => g.Any(t => t.ReadingCategory == ReadingCategory.Global && t.JudgeVisitTaskId != null)) + //.Where(g => g.Any(t => t.ReadingCategory == ReadingCategory.Global && t.JudgeVisitTaskId != null)) .Select(g => new DoctorJudgeRatio() { DoctorUserId = g.Key.DoctorUserId, diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs index baca35733..1a24b3ad0 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs @@ -1184,7 +1184,7 @@ namespace IRaCIS.Core.Application.Contracts public string JudgeRatioStr => TotalJudgeCount == 0 ? $"NA" : $"{Math.Round((decimal)JudgeAgreeCount * 100 / TotalJudgeCount, 2)}%"; - public string ExceptionMark => TotalJudgeCount == 0 ? $"Y" : (JudgeAgreeCount * 3 / TotalJudgeCount < 1) ? "Y" : "N"; + public string ExceptionMark => TotalJudgeCount == 0 ? $"NA" : (JudgeAgreeCount * 3 / TotalJudgeCount < 1) ? "Y" : "N"; }