diff --git a/IRaCIS.Core.API/Resources/en-US.json b/IRaCIS.Core.API/Resources/en-US.json index 2c63c0851..0db3279e4 100644 --- a/IRaCIS.Core.API/Resources/en-US.json +++ b/IRaCIS.Core.API/Resources/en-US.json @@ -1,2 +1,3 @@ { + } diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 47b2b88f4..2fbc18fdc 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -10562,6 +10562,56 @@ IR阅片页面是否可以查看既往任务结果 + + + trials:medicalFeedback:message:msg1 + + + + + trials:medicalFeedback:message:msg2 + + + + + trials:medicalFeedback:message:msg3 + + + + + trials:medicalFeedback:message:msg4 + + + + + trials:medicalFeedback:message:msg5 + + + + + trials:medicalFeedback:title:closeReasonEnum + + + + + trials:medicalFeedback:title:isEndorse + + + + + trials:medicalFeedback:title:reason + + + + + trials:medicalFeedback:title:isRequestReread + + + + + AuditAdvice + + 对话内容 @@ -13081,7 +13131,7 @@ 阅片医学审核 - + 阅片医学审核 @@ -13133,6 +13183,21 @@ + + + 测试获取医学审核对话拼接内容 + + + + + + + 获取医学审核对话拼接内容 + + + + + 完成医学审核 diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingMedicalReviewDto.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingMedicalReviewDto.cs index c5d8899b3..4f7939d5a 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingMedicalReviewDto.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingMedicalReviewDto.cs @@ -203,6 +203,65 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public Guid TaskMedicalReviewId { get; set; } } + public class JointMedicalReviewI18n + { + /// + /// trials:medicalFeedback:message:msg1 + /// + public string Msg1 { get; set; } + + /// + /// trials:medicalFeedback:message:msg2 + /// + public string Msg2 { get; set; } + + /// + /// trials:medicalFeedback:message:msg3 + /// + public string Msg3 { get; set; } + + /// + /// trials:medicalFeedback:message:msg4 + /// + public string Msg4 { get; set; } + + /// + /// trials:medicalFeedback:message:msg5 + /// + public string Msg5 { get; set; } + + /// + /// trials:medicalFeedback:title:closeReasonEnum + /// + public string CloseReasonEnum { get; set; } + + /// + /// trials:medicalFeedback:title:isEndorse + /// + public string IsEndorse { get; set; } + + + /// + /// trials:medicalFeedback:title:reason + /// + public string Reason { get; set; } + + /// + /// trials:medicalFeedback:title:isRequestReread + /// + public string IsRequestReread { get; set; } + + /// + /// AuditAdvice + /// + public Dictionary AuditAdvice { get; set; } + + public Dictionary MedicalDialogCloseEnum { get; set; } + + public Dictionary MedicalReviewDoctorUserIdea { get; set; } + + public Dictionary YesOrNo { get; set; } + } public class GetMedicalReviewDialogOutDto { diff --git a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs index 9a70bd3a3..e89573372 100644 --- a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs +++ b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs @@ -3,12 +3,17 @@ using IRaCIS.Core.Application.Filter; using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.Service.Reading.Dto; using IRaCIS.Core.Application.ViewModel; +using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Infra.EFCore.Common; using IRaCIS.Core.Infrastructure; +using MassTransit; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; +using NPOI.SS.Formula.Functions; using Panda.DynamicWebApi.Attributes; +using System.Reflection; +using System.Text; namespace IRaCIS.Core.Application.Service { @@ -19,6 +24,8 @@ namespace IRaCIS.Core.Application.Service public class ReadingMedicalReviewService(IRepository _readingMedicineTrialQuestionRepository, IRepository _trialRepository, IRepository _visitTaskRepository, + IRepository _dictionaryRepository, + IRepository _internationalizationRepository, IRepository _readingTaskQuestionAnswerRepository, IRepository _readingGlobalTaskInfoRepository, @@ -628,6 +635,167 @@ namespace IRaCIS.Core.Application.Service }); } + /// + /// 测试获取医学审核对话拼接内容 + /// + /// + /// + [HttpPost] + public async Task TestGetJointMedicalReviewDialog(Guid id) + { + var dialog = await _readingMedicalReviewDialogRepository.Where(x => x.Id == id) + .ProjectTo(_mapper.ConfigurationProvider).FirstNotNullAsync(); + + + 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); + } + } + + return await JointMedicalReviewDialog(dialog,i18N); + + + + + } + + /// + /// 获取医学审核对话拼接内容 + /// + /// + /// + /// + public async Task 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(); + + } + /// /// 完成医学审核 ///