代码修改
parent
d0d249655b
commit
0611c1d9fe
Binary file not shown.
|
@ -2601,7 +2601,7 @@
|
|||
<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.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)">
|
||||
<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>
|
||||
获取任务表格问题答案
|
||||
</summary>
|
||||
|
@ -5489,7 +5489,7 @@
|
|||
<param name="questionType">任务类型</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.IGeneralCalculateService.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)">
|
||||
<member name="M:IRaCIS.Core.Application.Service.IGeneralCalculateService.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>
|
||||
获取任务表格问题答案
|
||||
</summary>
|
||||
|
|
|
@ -30,6 +30,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
public string ResearchProgramNo { get; set; } = string.Empty;
|
||||
|
||||
public ExportData Lesion { get; set; }=new ExportData();
|
||||
|
||||
/// <summary>
|
||||
/// 访视一
|
||||
/// </summary>
|
||||
|
@ -123,11 +125,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
{
|
||||
Title = item.Title,
|
||||
VisitOneImgNum = item.VisitImgNum,
|
||||
VisitOneLength = item.VisitLength.ToString(),
|
||||
VisitOneLength = item.VisitLength!=null? item.VisitLength.Value.ToString():string.Empty,
|
||||
VisitTwoImgNum = VisitList.Count >= 2 ? VisitTwo.VisitNoTargetInfoList[index].VisitImgNum : string.Empty,
|
||||
VisitTwoLength = VisitList.Count >= 2 ? VisitTwo.VisitNoTargetInfoList[index].VisitLength.ToString() : string.Empty,
|
||||
VisitTwoLength = VisitList.Count >= 2&& VisitTwo.VisitNoTargetInfoList[index].VisitLength!=null ? VisitTwo.VisitNoTargetInfoList[index].VisitLength.Value.ToString() : string.Empty,
|
||||
VisitThreeImgNum = VisitList.Count >= 3 ? VisitThree.VisitNoTargetInfoList[index].VisitImgNum : string.Empty,
|
||||
VisitThreeLength = VisitList.Count >= 3 ? VisitThree.VisitNoTargetInfoList[index].VisitLength.ToString() : string.Empty
|
||||
VisitThreeLength = VisitList.Count >= 3&& VisitThree.VisitNoTargetInfoList[index].VisitLength!=null ? VisitThree.VisitNoTargetInfoList[index].VisitLength.Value.ToString() : string.Empty
|
||||
};
|
||||
targets.Add(targetInfo);
|
||||
index++;
|
||||
|
@ -157,6 +159,64 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public string VisitThreeLength { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class ExportData
|
||||
{
|
||||
public string OneVisitName { get; set; } = string.Empty;
|
||||
|
||||
public string OneCheckDate { get; set; } = string.Empty;
|
||||
|
||||
public string OneCheckInfoStr { get; set; } = string.Empty;
|
||||
|
||||
public string OneTargetSum { get; set; } = string.Empty;
|
||||
|
||||
public string OneHaveNewLesion { get; set; } = string.Empty;
|
||||
|
||||
public string OneTargetResult { get; set; } = string.Empty;
|
||||
|
||||
public string OneNoTargetResult { get; set; } = string.Empty;
|
||||
|
||||
public string OneOverallResult { get; set; } = string.Empty;
|
||||
|
||||
public string OneDoctorSignTime { get; set; } = string.Empty;
|
||||
|
||||
public string TwoVisitName { get; set; } = string.Empty;
|
||||
|
||||
public string TwoCheckDate { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public string TwoCheckInfoStr { get; set; } = string.Empty;
|
||||
|
||||
public string TwoTargetSum { get; set; } = string.Empty;
|
||||
|
||||
public string TwoHaveNewLesion { get; set; } = string.Empty;
|
||||
|
||||
public string TwoTargetResult { get; set; } = string.Empty;
|
||||
|
||||
public string TwoNoTargetResult { get; set; } = string.Empty;
|
||||
|
||||
public string TwoOverallResult { get; set; } = string.Empty;
|
||||
|
||||
public string TwoDoctorSignTime { get; set; } = string.Empty;
|
||||
|
||||
public string ThreeVisitName { get; set; } = string.Empty;
|
||||
|
||||
public string ThreeCheckDate { get; set; } = string.Empty;
|
||||
|
||||
public string ThreeCheckInfoStr { get; set; } = string.Empty;
|
||||
|
||||
public string ThreeTargetSum { get; set; } = string.Empty;
|
||||
|
||||
public string ThreeHaveNewLesion { get; set; } = string.Empty;
|
||||
|
||||
public string ThreeTargetResult { get; set; } = string.Empty;
|
||||
|
||||
public string ThreeNoTargetResult { get; set; } = string.Empty;
|
||||
|
||||
public string ThreeOverallResult { get; set; } = string.Empty;
|
||||
|
||||
public string ThreeDoctorSignTime { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class ExportVisitData
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -221,7 +281,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
{
|
||||
get
|
||||
{
|
||||
return $"{DoctorName}/{SignTime}";
|
||||
return DoctorName==string.Empty?string.Empty: $"{DoctorName}/{SignTime}";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -233,7 +293,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
/// <summary>
|
||||
/// 靶病灶总长度
|
||||
/// </summary>
|
||||
public decimal TargetSum
|
||||
public decimal? TargetSum
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -322,7 +382,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
/// <summary>
|
||||
/// 长度
|
||||
/// </summary>
|
||||
public decimal VisitLength { get; set; }
|
||||
public decimal? VisitLength { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ using SixLabors.ImageSharp;
|
|||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
@ -669,13 +670,42 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
return answer;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取报告No
|
||||
/// </summary>
|
||||
/// <param name="visitTaskInfo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> GetReportExportNo(VisitTask visitTaskInfo)
|
||||
|
||||
public void SetPropertyDynamically(object targetObj, string targetPropName, object sourceObj, string prefix)
|
||||
{
|
||||
// 1. 解析目标属性名(如"CheckInfoStr")
|
||||
string basePropName = targetPropName.Replace(prefix, "");
|
||||
|
||||
// 2. 获取源对象路径(如"VisitOne.CheckInfoStr")
|
||||
string sourcePath = $"Visit{prefix}.{basePropName}";
|
||||
object sourceValue = GetNestedPropertyValue(sourceObj, sourcePath);
|
||||
|
||||
// 3. 赋值给目标属性
|
||||
PropertyInfo targetProp = targetObj.GetType().GetProperty(prefix+targetPropName);
|
||||
if (targetProp != null && sourceValue != null)
|
||||
{
|
||||
targetProp.SetValue(targetObj, sourceValue);
|
||||
}
|
||||
}
|
||||
|
||||
public object GetNestedPropertyValue(object obj, string path)
|
||||
{
|
||||
foreach (string part in path.Split('.'))
|
||||
{
|
||||
if (obj == null) return null;
|
||||
PropertyInfo prop = obj.GetType().GetProperty(part);
|
||||
if (prop == null) return null;
|
||||
obj = prop.GetValue(obj);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取报告No
|
||||
/// </summary>
|
||||
/// <param name="visitTaskInfo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> GetReportExportNo(VisitTask visitTaskInfo)
|
||||
{
|
||||
if (visitTaskInfo.ReportExportDate != null && visitTaskInfo.ReportExportNum != null)
|
||||
{
|
||||
|
@ -779,7 +809,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
/// <param name="questionMark">问题标识</param>
|
||||
/// <param name="rowIndex">索引</param>
|
||||
/// <returns></returns>
|
||||
public string GetTaskTableAnswer(List<ReadingTableQuestionAnswer>? tableAnswerList, List<Dictionary>? dictionList, List<Dictionary>? unitDictionary, Guid taskId, LesionType lesionType, QuestionMark questionMark, decimal rowIndex)
|
||||
public string GetTaskTableAnswer(List<ReadingTableQuestionAnswer>? tableAnswerList, List<Dictionary>? dictionList, List<Dictionary>? unitDictionary, Guid taskId, LesionType lesionType, QuestionMark questionMark, decimal rowIndex,bool AutoUnit=true)
|
||||
{
|
||||
var answerData = tableAnswerList.FirstOrDefault(x => x.VisitTaskId == taskId && x.ReadingQuestionTrial.LesionType == lesionType && x.ReadingTableQuestionTrial.QuestionMark == questionMark && x.RowIndex == rowIndex);
|
||||
|
||||
|
@ -798,16 +828,20 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
answer = answerData.Answer;
|
||||
|
||||
}
|
||||
if (answer != "NA" && answerData.ReadingTableQuestionTrial.Unit != null && answerData.ReadingTableQuestionTrial.Unit != ValueUnit.none)
|
||||
if (AutoUnit)
|
||||
{
|
||||
answer += " " + unitDictionary.SelectMany(x => x.ChildList).Where(x => x.Code == ((int)answerData.ReadingTableQuestionTrial.Unit).ToString()).Select(x => x.ValueCN).FirstIsNullReturnEmpty();
|
||||
}
|
||||
if (answer != "NA" && answerData.ReadingTableQuestionTrial.Unit != null && answerData.ReadingTableQuestionTrial.Unit != ValueUnit.none)
|
||||
{
|
||||
answer += " " + unitDictionary.SelectMany(x => x.ChildList).Where(x => x.Code == ((int)answerData.ReadingTableQuestionTrial.Unit).ToString()).Select(x => x.ValueCN).FirstIsNullReturnEmpty();
|
||||
}
|
||||
|
||||
if (answer != "NA" && answerData.ReadingTableQuestionTrial.ValueType == ValueOfType.Percentage)
|
||||
{
|
||||
answer += " %";
|
||||
if (answer != "NA" && answerData.ReadingTableQuestionTrial.ValueType == ValueOfType.Percentage)
|
||||
{
|
||||
answer += " %";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return answer;
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// <param name="questionMark">问题标识</param>
|
||||
/// <param name="rowIndex">索引</param>
|
||||
/// <returns></returns>
|
||||
string GetTaskTableAnswer(List<ReadingTableQuestionAnswer>? tableAnswerList, List<Dictionary>? dictionList, List<Dictionary>? unitDictionary, Guid taskId, LesionType lesionType, QuestionMark questionMark, decimal rowIndex);
|
||||
string GetTaskTableAnswer(List<ReadingTableQuestionAnswer>? tableAnswerList, List<Dictionary>? dictionList, List<Dictionary>? unitDictionary, Guid taskId, LesionType lesionType, QuestionMark questionMark, decimal rowIndex, bool AutoUnit = true);
|
||||
|
||||
/// <summary>
|
||||
/// 获取阅片报告
|
||||
|
@ -136,5 +136,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// <param name="visitTaskInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<string> GetReportExportNo(VisitTask visitTaskInfo);
|
||||
|
||||
void SetPropertyDynamically(object targetObj, string targetPropName, object sourceObj, string prefix);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ using Microsoft.Extensions.Options;
|
|||
using MiniSoftware;
|
||||
using Newtonsoft.Json;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
@ -113,15 +114,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
OverallResult = _generalCalculateService.GetTaskanswer(answerList, dictionList, unitDictionary, x.Id, QuestionType.Tumor),
|
||||
DoctorName = x.DoctorUser.LastName + x.DoctorUser.FirstName,
|
||||
SignTime = x.SignTime?.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
VisitTargetInfoList = getLesionInfo(LesionType.TargetLesion),
|
||||
VisitNoTargetInfoList = getLesionInfo(LesionType.NonTargetLesions),
|
||||
VisitTargetInfoList = getLesionInfo(LesionType.TargetLesion,x.Id),
|
||||
VisitNoTargetInfoList = getLesionInfo(LesionType.NonTargetLesions, x.Id),
|
||||
}).OrderBy(x=>x.VisitNum).ToList();
|
||||
|
||||
|
||||
#region 两个函数
|
||||
List<VisitLesionInfo> getLesionInfo(LesionType lesionType)
|
||||
List<VisitLesionInfo> getLesionInfo(LesionType lesionType,Guid Visittaskid)
|
||||
{
|
||||
var targetFocus = rowinfoList.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.ReadingQuestionTrial.LesionType == lesionType).OrderBy(x => x.RowIndex).ToList();
|
||||
var targetFocus = rowinfoList.Where(x => x.VisitTaskId == Visittaskid && x.ReadingQuestionTrial.LesionType == lesionType).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
|
||||
var targetInfo = new List<VisitLesionInfo>();
|
||||
|
@ -129,11 +130,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
int num = 1;
|
||||
foreach (var item in targetFocus)
|
||||
{
|
||||
|
||||
VisitLesionInfo target = new VisitLesionInfo
|
||||
{
|
||||
RowMark = rowinfoList.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == item.RowIndex && x.ReadingQuestionTrial.LesionType == lesionType).Select(x => x.RowMark).FirstIsNullReturnEmpty(),
|
||||
Organ = _generalCalculateService.GetTaskTableAnswer(tableAnswerList, dictionList, unitDictionary, inDto.VisitTaskId, lesionType, QuestionMark.Organ, item.RowIndex),
|
||||
Part = _generalCalculateService.GetTaskTableAnswer(tableAnswerList, dictionList, unitDictionary, inDto.VisitTaskId, lesionType, QuestionMark.Part, item.RowIndex),
|
||||
RowMark = rowinfoList.Where(x => x.VisitTaskId == Visittaskid && x.RowIndex == item.RowIndex && x.ReadingQuestionTrial.LesionType == lesionType).Select(x => x.RowMark).FirstIsNullReturnEmpty(),
|
||||
Organ = _generalCalculateService.GetTaskTableAnswer(tableAnswerList, dictionList, unitDictionary, Visittaskid, lesionType, QuestionMark.Organ, item.RowIndex),
|
||||
Part = _generalCalculateService.GetTaskTableAnswer(tableAnswerList, dictionList, unitDictionary, Visittaskid, lesionType, QuestionMark.Part, item.RowIndex),
|
||||
Number = num,
|
||||
StudyCode = instanceList.Where(x => x.Id == item.InstanceId).Select(x => x.DicomSerie.DicomStudy.Code).FirstOrDefault(),
|
||||
RowId = item.Id,
|
||||
|
@ -143,6 +145,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
};
|
||||
targetInfo.Add(target);
|
||||
num++;
|
||||
|
||||
}
|
||||
if (lesionType == LesionType.TargetLesion)
|
||||
{
|
||||
|
@ -153,7 +156,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
Number = i,
|
||||
};
|
||||
targetInfo.Add(target);
|
||||
i++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -165,10 +168,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
{
|
||||
// 非淋巴结取长径 淋巴结取长短径
|
||||
var state = _generalCalculateService.GetTaskTableAnswer(tableAnswerList, dictionList, unitDictionary, visitTaskid, lesionType, QuestionMark.State, item);
|
||||
var majorAxis = _generalCalculateService.GetTaskTableAnswer(tableAnswerList, dictionList, unitDictionary, visitTaskid, lesionType, QuestionMark.MajorAxis, item);
|
||||
var majorAxis = _generalCalculateService.GetTaskTableAnswer(tableAnswerList, dictionList, unitDictionary, visitTaskid, lesionType, QuestionMark.MajorAxis, item,false);
|
||||
|
||||
var isLymph = _generalCalculateService.GetTaskTableAnswer(tableAnswerList, dictionList, unitDictionary, visitTaskid, lesionType, QuestionMark.IsLymph, item);
|
||||
var shortAxis = _generalCalculateService.GetTaskTableAnswer(tableAnswerList, dictionList, unitDictionary, visitTaskid, lesionType, QuestionMark.ShortAxis, item);
|
||||
var shortAxis = _generalCalculateService.GetTaskTableAnswer(tableAnswerList, dictionList, unitDictionary, visitTaskid, lesionType, QuestionMark.ShortAxis, item, false);
|
||||
|
||||
var result = string.Empty;
|
||||
|
||||
|
@ -196,6 +199,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
List<ExportTumorEvaluationInfo> resultdata = new List<ExportTumorEvaluationInfo>();
|
||||
|
||||
List<string> times= new List<string>() { "One", "Two", "Three" };
|
||||
List<string> columns=new List<string>() { "VisitName", "CheckDate","CheckInfoStr", "HaveNewLesion", "TargetResult", "NoTargetResult", "OverallResult", "DoctorSignTime" };
|
||||
for (int i = 0; i < (int)Math.Ceiling((double)exportVisitDatas.Count() / 3); i++)
|
||||
{
|
||||
ExportTumorEvaluationInfo export = new ExportTumorEvaluationInfo
|
||||
|
@ -205,15 +210,34 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
SubjectCode = subjectCode,
|
||||
VisitList= exportVisitDatas.Skip(i*3).Take(3).ToList(),
|
||||
};
|
||||
|
||||
export.Lesion = new ExportData()
|
||||
{
|
||||
OneTargetSum = export.VisitOne.TargetSum.ToString(),
|
||||
TwoTargetSum = export.VisitTwo.VisitTargetInfoList.Count()> 0? export.VisitTwo.TargetSum.ToString():string.Empty,
|
||||
ThreeTargetSum = export.VisitThree.VisitTargetInfoList.Count() > 0 ? export.VisitThree.TargetSum.ToString() : string.Empty,
|
||||
|
||||
|
||||
};
|
||||
foreach (var time in times)
|
||||
{
|
||||
foreach (var column in columns)
|
||||
{
|
||||
_generalCalculateService.SetPropertyDynamically(export.Lesion, column, export, time);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
resultdata.Add(export);
|
||||
}
|
||||
|
||||
|
||||
|
||||
var value = new
|
||||
{
|
||||
VisitTaskList = resultdata,
|
||||
};
|
||||
|
||||
|
||||
|
||||
var templatePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"wwwroot/ReadReoprtTemplate/TumorEvaluation_RECIST1.1_CN_V1.docx");
|
||||
var outputFilePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"wwwroot/ReadReoprtTemplate/downLoad/{inDto.DownLoadGuid}.docx");
|
||||
|
|
Loading…
Reference in New Issue