From 9158f28998272d0d6946e5f1c07f4f5e08110ef9 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 25 Nov 2025 09:56:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BB=E5=AD=A6=E5=AE=A1=E6=A0=B8=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D=E5=AF=BC=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 13 ++ .../Service/Common/ExcelExportService.cs | 160 ++++++++++++++++++ .../Service/QC/DTO/QCListViewModel.cs | 8 + .../Service/QC/_MapConfig.cs | 5 +- .../Reading/Dto/ReadingMedicalReviewDto.cs | 2 + 5 files changed, 186 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 2fbc18fdc..12edfd5d1 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -900,6 +900,14 @@ + + + 获取医学审核对话拼接内容 + + + + + 影像下载记录表 @@ -9187,6 +9195,11 @@ 任务Id + + + 单位 + + 保存表格问题标记 diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index 82f8a9eb3..6d302a3f4 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -22,6 +22,8 @@ using System.ComponentModel.Design; using System.Globalization; using System.IO; using System.Linq; +using System.Reflection; +using System.Text; using static IRaCIS.Core.Application.Service.ExcelExportHelper; using IDictionaryService = IRaCIS.Application.Interfaces.IDictionaryService; using TrialIdentityUser = IRaCIS.Core.Domain.Models.TrialIdentityUser; @@ -32,6 +34,8 @@ namespace IRaCIS.Core.Application.Service.Common [ApiExplorerSettings(GroupName = "Common")] public class ExcelExportService(IRepository _trialUserRoleRepository, IRepository _visitTaskRepository, + IRepository _dictionaryRepository, + IRepository _internationalizationRepository, IRepository _readingQuestionCriterionTrialRepository, IRepository _systemDocNeedConfirmedUserTypeRepository, IRepository _dicomStudyRepository, @@ -1758,6 +1762,80 @@ namespace IRaCIS.Core.Application.Service.Common var list = taskMedicalReviewQueryable.OrderBy(t => t.TrialSiteCode).ThenBy(t => t.SubjectCode).ThenBy(t => t.VisitTaskNum).ToList(); + #region 处理翻译对话 by he wen tao + + Dictionary i18NKeys = new Dictionary() + { + { "Msg1","trials:medicalFeedback:message:msg1"}, + { "Msg2","trials:medicalFeedback:message:msg2"}, + { "Msg3","trials:medicalFeedback:message:msg3"}, + { "Msg4", "trials:medicalFeedback:message:msg4"}, + { "Msg5", "trials:medicalFeedback:message:msg5"}, + { "CloseReasonEnum", "trials:medicalFeedback:title:closeReasonEnum"}, + { "IsEndorse", "trials:medicalFeedback:title:isEndorse"}, + { "Reason", "trials:medicalFeedback:title:reason"}, + { "IsRequestReread", "trials:medicalFeedback:title:isRequestReread"}, + }; + + var i18Values = i18NKeys.Select(x => x.Value).ToList(); + var i18nList = await _internationalizationRepository.Where(x => i18Values.Contains(x.Code)) + .Select(x => new + { + Code = x.Code, + Value = _userInfo.IsEn_Us ? x.Value : x.ValueCN + }).ToListAsync(); + + List dictionaryCodeList = new List() + { + "AuditAdvice", + "MedicalDialogCloseEnum", + "MedicalReviewDoctorUserIdea", + "YesOrNo", + }; + + var dictionadParents = await _dictionaryRepository.Where(x => dictionaryCodeList.Contains(x.Parent.Code)) + .Select(x => new + { + ParentCode = x.Parent.Code, + Code = x.Code, + Value = _userInfo.IsEn_Us ? x.Value : x.ValueCN + }).ToListAsync(); + + JointMedicalReviewI18n i18N = new JointMedicalReviewI18n() { }; + foreach (var kv in i18NKeys) + { + PropertyInfo? pi = i18N.GetType().GetProperty(kv.Key); + if (pi != null && pi.CanWrite) + { + var value = i18nList.Where(x => x.Code == kv.Value).Select(x => x.Value).FirstOrDefault() ?? string.Empty; + object safeValue = Convert.ChangeType(value, pi.PropertyType); + pi.SetValue(i18N, safeValue); + } + } + foreach (var item in dictionaryCodeList) + { + PropertyInfo? pi = i18N.GetType().GetProperty(item); + if (pi != null && pi.CanWrite) + { + var value = dictionadParents.Where(x => x.ParentCode == item).ToDictionary(x => x.Code, x => x.Value); + object safeValue = Convert.ChangeType(value, pi.PropertyType); + pi.SetValue(i18N, safeValue); + } + } + + + foreach (var item in list) + { + foreach (var dialog in item.DialogList) + { + dialog.ResultContent = JointMedicalReviewDialog(dialog, i18N); + } + } + + + #endregion + + var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId); @@ -1767,6 +1845,88 @@ namespace IRaCIS.Core.Application.Service.Common return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialMedicalReviewList_Export, exportInfo, $"{exportInfo.ResearchProgramNo}", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(TaskMedicalReviewExportDto)); } + /// + /// 获取医学审核对话拼接内容 + /// + /// + /// + /// + private string JointMedicalReviewDialog(GetMedicalReviewDialogOutDto record, JointMedicalReviewI18n i18NAndDic) + { + StringBuilder str = new StringBuilder() { }; + var userTypes = new List() { 14, 30 }; + + // 这里userTypes.Contains(record.UserTypeEnumInt) 可以提出来 但是还是按照前端写吧 免得不好对照 + + // v-if="[14, 30].includes(record.UserTypeEnumInt) && record.Questioning + if (userTypes.Contains(record.UserTypeEnumInt) && record.Questioning.IsNotNullOrEmpty()) + { + // + str.AppendLine(i18NAndDic.Msg1); + + str.AppendLine(record.Questioning); + + if (record.FileList.Count() > 0) + { + str.AppendLine(i18NAndDic.Msg2); + record.FileList.ForEach(x => + { + str.AppendLine(x.FileName); + }); + } + + str.AppendLine(i18NAndDic.Msg3); + + str.AppendLine(i18NAndDic.AuditAdvice[record.AuditAdviceEnum.GetEnumInt()]); + + str.AppendLine(i18NAndDic.Msg4); + } + + //v-if="[14, 30].includes(record.UserTypeEnumInt) && record.MedicalDialogCloseEnum!== null" + if (userTypes.Contains(record.UserTypeEnumInt) && record.MedicalDialogCloseEnum != null) + { + str.AppendLine(i18NAndDic.CloseReasonEnum + i18NAndDic.MedicalDialogCloseEnum[record.MedicalDialogCloseEnum.Value.GetEnumInt()]); + } + + // v-if="[14, 30].includes(record.UserTypeEnumInt) && record.Content + if (userTypes.Contains(record.UserTypeEnumInt) && record.Content.IsNotNullOrEmpty()) + { + str.AppendLine(record.Content); + } + + // v-if="[13].includes(record.UserTypeEnumInt)" + + if (13 == record.UserTypeEnumInt) + { + str.AppendLine(i18NAndDic.IsEndorse + i18NAndDic.MedicalReviewDoctorUserIdea[record.DoctorUserIdeaEnum.GetEnumInt()]); + + // v-if="record.DoctorUserIdeaEnum===2" + if ((int)record.DoctorUserIdeaEnum == 2) + { + str.AppendLine(i18NAndDic.Reason + record.DisagreeReason); + } + + // record.MedicalDialogCloseEnum!== null + + if (record.MedicalDialogCloseEnum != null) + { + str.AppendLine(i18NAndDic.IsRequestReread + i18NAndDic.YesOrNo[record.IsApplyHeavyReading.ToString()]); + } + + // v-if="record.FileList && record.FileList.length > 0" + + if (record.FileList.Count() > 0) + { + record.FileList.ForEach(x => + { + str.AppendLine(x.FileName); + }); + } + } + + return str.ToString(); + + } /// /// 影像下载记录表 diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs index 526f366ab..1c2629107 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs @@ -1,6 +1,7 @@ using IRaCIS.Core.API._ServiceExtensions.NewtonsoftJson; using IRaCIS.Core.Application.Contracts.DTO; using IRaCIS.Core.Application.Helper; +using IRaCIS.Core.Application.Service.Reading.Dto; using IRaCIS.Core.Domain.Share; using MiniExcelLibs.Attributes; using Newtonsoft.Json; @@ -989,6 +990,13 @@ namespace IRaCIS.Core.Application.Contracts /// [DictionaryTranslateAttribute("YesOrNo")] public bool IsInvalid { get; set; } + + + + public List DialogList { get; set; } + + public string DialogStr => string.Join("\n\n", DialogList.OrderBy(t => t.CreateTime).Select(c => c.CreateUserName + " (" + ExportExcelConverterDate.DateTimeInternationalToString(c.CreateTime) + ") :" + c.ResultContent)); + } public class TrialImageDownloadExportDto diff --git a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs index 3af58e72a..f94b1bb1f 100644 --- a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs @@ -179,13 +179,14 @@ namespace IRaCIS.Core.Application.Service .ForMember(o => o.MedicalNo, t => t.MapFrom(u => u.VisitTask.Subject.MedicalNo)) .ForMember(o => o.DoctorUserName, t => t.MapFrom(u => u.VisitTask.DoctorUser.UserName)) .ForMember(o => o.MedicalManagerUserName, t => t.MapFrom(u => u.MedicalManagerUser.UserName)) - .ForMember(o => o.QuestionContent, t => t.MapFrom(u => string.Join("\n\n", u.ReadingMedicalReviewDialogList.Where(t => t.IsHaveQuestion).Select(t => t.Questioning)))); + .ForMember(o => o.QuestionContent, t => t.MapFrom(u => string.Join("\n\n", u.ReadingMedicalReviewDialogList.Where(t => t.IsHaveQuestion).Select(t => t.Questioning)))) + .ForMember(o => o.DialogList, t => t.MapFrom(u => u.ReadingMedicalReviewDialogList)); CreateMap() .ForMember(o => o.TrialReadingCriterionName, t => t.MapFrom(u => u.TrialReadingCriterion.CriterionName)) .ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.IsSelfAnalysis == true ? u.BlindTrialSiteCode : u.Subject.TrialSite.TrialSiteCode)) .ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.IsSelfAnalysis == true ? u.BlindSubjectCode : u.Subject.Code)) - + ; diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingMedicalReviewDto.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingMedicalReviewDto.cs index 4f7939d5a..b50c85548 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingMedicalReviewDto.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingMedicalReviewDto.cs @@ -343,6 +343,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public List FileList { get; set; } = new List(); + //存储最后翻译的内容 + public string ResultContent { get; set; } }