Reapply "先改IRes导出"

This reverts commit f08a5b0d46.
Test_HIR_Net8
he 2025-09-05 09:55:01 +08:00
parent f08a5b0d46
commit 8b61b288fc
5 changed files with 75 additions and 25 deletions

View File

@ -2468,6 +2468,14 @@
<returns></returns>
</member>
<!-- Badly formed XML comment ignored for member "M:IRaCIS.Core.Application.Service.ReadingCalculate.GeneralCalculateService.FileDownSave(System.String,System.String)" -->
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.GeneralCalculateService.GetTrialQuestionName(System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingQuestionTrial},IRaCIS.Core.Domain.Share.QuestionType)">
<summary>
获取项目问题名称
</summary>
<param name="readingQuestionTrials"></param>
<param name="questionType"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.GeneralCalculateService.GetTaskTableAnswer(System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableQuestionAnswer},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.Dictionary},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.Dictionary},System.Guid,IRaCIS.Core.Domain.Share.LesionType,IRaCIS.Core.Domain.Share.QuestionMark,System.Decimal,System.Boolean)">
<summary>
获取任务表格问题答案
@ -5650,6 +5658,14 @@
<param name="downLoadGuid"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.IGeneralCalculateService.GetTrialQuestionName(System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingQuestionTrial},IRaCIS.Core.Domain.Share.QuestionType)">
<summary>
获取项目问题名称
</summary>
<param name="readingQuestionTrials"></param>
<param name="questionType"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.IGeneralCalculateService.GetTaskanswer(System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTaskQuestionAnswer},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.Dictionary},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.Dictionary},System.Guid,IRaCIS.Core.Domain.Share.QuestionType)">
<summary>
获取任务问题答案

View File

@ -295,7 +295,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public class ExportReportQuestion
{
public string QuestionName { get; set; }
public string QuestionName { get; set; }=string.Empty;
public QuestionType QuestionType { get; set; }
}

View File

@ -842,6 +842,20 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
}
/// <summary>
/// 获取项目问题名称
/// </summary>
/// <param name="readingQuestionTrials"></param>
/// <param name="questionType"></param>
/// <returns></returns>
[ApiExplorerSettings(IgnoreApi = true)]
public string GetTrialQuestionName(List<ReadingQuestionTrial>? readingQuestionTrials,QuestionType questionType)
{
var questionName = readingQuestionTrials.Where(x => x.QuestionType == questionType).Select(x =>_userInfo.IsEn_Us?x.QuestionEnName: x.QuestionName).FirstIsNullReturnEmpty();
return questionName.TrimEnd();
}
/// <summary>
/// 获取任务表格问题答案
/// </summary>
@ -865,7 +879,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var answer = string.Empty;
if (answerData.ReadingTableQuestionTrial.TableQuestionType == TableQuestionType.Dictionary)
{
answer = dictionList.Where(x => x.Code == answerData.ReadingTableQuestionTrial.DictionaryCode).SelectMany(x => x.ChildList).Where(x => x.Code == answerData.Answer).Select(x => x.ValueCN).FirstIsNullReturnEmpty();
if (_userInfo.IsEn_Us)
{
answer = dictionList.Where(x => x.Code == answerData.ReadingTableQuestionTrial.DictionaryCode).SelectMany(x => x.ChildList).Where(x => x.Code == answerData.Answer).Select(x => x.Value).FirstIsNullReturnEmpty();
}
else
{
answer = dictionList.Where(x => x.Code == answerData.ReadingTableQuestionTrial.DictionaryCode).SelectMany(x => x.ChildList).Where(x => x.Code == answerData.Answer).Select(x => x.ValueCN).FirstIsNullReturnEmpty();
}
}
else

View File

@ -15,6 +15,7 @@ using Microsoft.Extensions.Options;
using MiniSoftware;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Service.ReadingCalculate
{
@ -84,6 +85,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var doctor = await _userRoleRepository.Where(x => x.Id == taskinfo.DoctorUserId).FirstOrDefaultAsync();
var trialQuestion = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId).ToListAsync();
var tableQuestion = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionTrial.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId).ToListAsync();
var dicotionCode = trialQuestion.Where(x => x.DictionaryCode != string.Empty).Select(x => x.DictionaryCode).Distinct().ToList();
dicotionCode.AddRange(tableQuestion.Where(x => x.DictionaryCode != string.Empty).Select(x => x.DictionaryCode).Distinct());
@ -188,14 +190,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
#region 外层问题处理
// 获取外层问题
List<Dictionary<string, object>> getQuestionAnswerList(List<ExportReportQuestion> exports)
async Task<List<Dictionary<string, object>>> getQuestionAnswerList(List<ExportReportQuestion> exports)
{
List<Dictionary<string, object>> questionAnswerList = new List<Dictionary<string, object>>();
foreach (var item in exports)
{
item.QuestionName = _generalCalculateService.GetTrialQuestionName(trialQuestion, item.QuestionType);
Dictionary<string, object> questionAnswer = new Dictionary<string, object>()
{
{"Name",item.QuestionName },
{"Name", item.QuestionName},
{"FirstVisit", _generalCalculateService.GetTaskanswer(answerList,dictionList,unitDictionary,taskIds[0],item.QuestionType)},
{"SecondVisit", relatedCount>=2? _generalCalculateService.GetTaskanswer(answerList,dictionList,unitDictionary,taskIds[1],item.QuestionType):string.Empty },
{"ThirdlyVisit", relatedCount>=3? _generalCalculateService.GetTaskanswer(answerList,dictionList,unitDictionary,taskIds[2],item.QuestionType):string.Empty },
@ -228,13 +231,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var resultList = new List<ExportReportQuestion>()
{ new ExportReportQuestion (){ QuestionName="靶病灶径线之和SOD",QuestionType=QuestionType.SOD},
new ExportReportQuestion (){ QuestionName="非淋巴结靶病灶长径之和",QuestionType=QuestionType.SumOfDiameter},
new ExportReportQuestion (){ QuestionName="与基线相比SOD变化量",QuestionType=QuestionType.SODChange},
new ExportReportQuestion (){ QuestionName="与基线相比SOD变化百分比",QuestionType=QuestionType.SODPercent},
new ExportReportQuestion (){ QuestionName="与最低点相比SOD变化量",QuestionType=QuestionType.LowestIncrease},
new ExportReportQuestion (){ QuestionName="与最低点相比SOD变化百分比",QuestionType=QuestionType.LowPercent},
new ExportReportQuestion (){ QuestionName="最低点访视",QuestionType=QuestionType.LowVisit},
{ new ExportReportQuestion (){QuestionType=QuestionType.SOD},
new ExportReportQuestion (){ QuestionType=QuestionType.SumOfDiameter},
new ExportReportQuestion (){QuestionType=QuestionType.SODChange},
new ExportReportQuestion (){ QuestionType=QuestionType.SODPercent},
new ExportReportQuestion (){ QuestionType=QuestionType.LowestIncrease},
new ExportReportQuestion (){QuestionType=QuestionType.LowPercent},
new ExportReportQuestion (){QuestionType=QuestionType.LowVisit},
};
var isConvertedTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => x.IsConvertedTask).FirstOrDefaultAsync();
@ -242,9 +245,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
if (isConvertedTask)
{
resultList.AddRange(new List<ExportReportQuestion>()
{ new ExportReportQuestion (){ QuestionName="与触发iRECIST访视相比SOD变化量",QuestionType=QuestionType.ComparedTriggeringSODChange},
new ExportReportQuestion (){ QuestionName="新靶病灶直径之和iSOD",QuestionType=QuestionType.ISOD},
new ExportReportQuestion (){ QuestionName="与触发iRECIST访视相比iSOD变化量",QuestionType=QuestionType.ComparedTriggeringiSODChange},
{ new ExportReportQuestion (){ QuestionType=QuestionType.ComparedTriggeringSODChange},
new ExportReportQuestion (){ QuestionType=QuestionType.ISOD},
new ExportReportQuestion (){ QuestionType=QuestionType.ComparedTriggeringiSODChange},
});
@ -254,11 +257,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
if (visitInfo.IsBaseLine)
{
var existDisease = answerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.ExistDisease).Select(x => x.Answer).FirstIsNullReturnEmpty().EqEnum(ExistDisease.No) ? "不" : string.Empty;
assessmentResult = $"{existDisease}存在疾病";
assessmentResult = $"{existDisease}{_localizer["CriterionCalculateExport_ExistDisease"]}";
}
else
{
assessmentResult = $"整体肿瘤评估结果为{_generalCalculateService.GetTaskanswer(answerList, dictionList, unitDictionary, inDto.VisitTaskId, QuestionType.Tumor)}";
assessmentResult = $"{_localizer["CriterionCalculateExport_AssessmentResult"]}{_generalCalculateService.GetTaskanswer(answerList, dictionList, unitDictionary, inDto.VisitTaskId, QuestionType.Tumor)}";
}
var hIRHospital = await _hIRHospitalRepository.Where(t => t.IsDefault == true).FirstNotNullAsync();
@ -268,8 +271,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
{ "HospitalName",hIRHospital.HospitalName } ,// 医院名称
{ "SubjectName",subjectInfo.ShortName }, //患者姓名
{ "SubjectSex", subjectInfo.Sex==string.Empty?string.Empty: subjectInfo.Sex=="M"?"男":"女" }, //患者性别
{ "SubjectAge",subjectInfo.Age==null?string.Empty: subjectInfo.Age +"岁" }, //患者年龄
{ "SubjectSex", subjectInfo.Sex==string.Empty?string.Empty: subjectInfo.Sex=="M"?_localizer["CriterionCalculateExport_Man"]:_localizer["CriterionCalculateExport_Woman"] }, //患者性别
{ "SubjectAge",subjectInfo.Age==null?string.Empty: subjectInfo.Age +_localizer["CriterionCalculateExport_Years"] }, //患者年龄
{ "SubjectCode",string.Join(",",patientIdStrList) }, //患者编号
{ "VisitName",visitInfo.VisitName }, //访视名称
{ "LatestScanDate",visitInfo.StudyList.Min(x=>x.StudyTime)?.ToString("yyyy-MM-dd") }, //随访日期
@ -305,11 +308,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
{ "TNMValue",taskinfo.TNMValue}, // TNM分期
{ "Result",getQuestionAnswerList(resultList)}, // 评估结果
{ "Curative",getQuestionAnswerList(new List<ExportReportQuestion>()
{ new ExportReportQuestion (){ QuestionName="靶病灶评估",QuestionType=QuestionType.TargetLesion},
new ExportReportQuestion (){ QuestionName="非靶病灶评估",QuestionType=QuestionType.NoTargetLesion},
new ExportReportQuestion (){ QuestionName="存在新病灶",QuestionType=QuestionType.NewLesions},
new ExportReportQuestion (){ QuestionName="存在疾病",QuestionType=QuestionType.ExistDisease},
new ExportReportQuestion (){ QuestionName="整体肿瘤评估",QuestionType=QuestionType.Tumor},
{ new ExportReportQuestion (){QuestionType=QuestionType.TargetLesion},
new ExportReportQuestion (){ QuestionType=QuestionType.NoTargetLesion},
new ExportReportQuestion (){ QuestionType=QuestionType.NewLesions},
new ExportReportQuestion (){ QuestionType=QuestionType.ExistDisease},
new ExportReportQuestion (){ QuestionType=QuestionType.Tumor},
})}, // 疗效结果
{ "ReportNo",await _generalCalculateService.GetReportExportNo(taskinfo) } ,
@ -317,10 +320,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
value = _generalCalculateService.StringEmptyTurnedLine(value);
var templatePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"wwwroot/ReadReoprtTemplate/ReportTemplate_RECIST1.1_CN_V1.docx");
var templatePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"wwwroot/ReadReoprtTemplate/ReportTemplate_RECIST1.1_{(_userInfo.IsEn_Us?"EN":"CN")}_V1.docx");
if (isConvertedTask)
{
templatePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"wwwroot/ReadReoprtTemplate/ReportTemplate_IRECIST_CN_V1.docx");
templatePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"wwwroot/ReadReoprtTemplate/ReportTemplate_IRECIST_{(_userInfo.IsEn_Us?"EN":"CN")}_V1.docx");
}
var outputFilePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"wwwroot/ReadReoprtTemplate/downLoad/{inDto.DownLoadGuid}.docx");

View File

@ -108,6 +108,15 @@ namespace IRaCIS.Core.Application.Service
[ApiExplorerSettings(IgnoreApi = true)]
Task<List<Dictionary<string, object>>> GetLesionPic(List<ReadingTableAnswerRowInfo> rowinfoList, LesionType lesionType, Guid downLoadGuid);
/// <summary>
/// 获取项目问题名称
/// </summary>
/// <param name="readingQuestionTrials"></param>
/// <param name="questionType"></param>
/// <returns></returns>
[ApiExplorerSettings(IgnoreApi = true)]
string GetTrialQuestionName(List<ReadingQuestionTrial>? readingQuestionTrials, QuestionType questionType);
/// <summary>
/// 获取任务问题答案
/// </summary>