diff --git a/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs b/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs
index 4229f1885..8cc8a9b42 100644
--- a/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs
+++ b/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs
@@ -5,8 +5,10 @@ using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Domain.Share;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Hosting;
using MiniExcelLibs;
using MiniExcelLibs.OpenXml;
+using NPOI.SS.Formula.Functions;
using NPOI.XSSF.UserModel;
using System.Collections;
using System.Globalization;
@@ -16,6 +18,18 @@ namespace IRaCIS.Core.Application.Service;
public static class ExcelExportHelper
{
//MiniExcel_Export
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// 文件名前缀
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public static async Task DataExportAsync(string code, ExcelExportInfo data, string exportFileNamePrefix, IRepository _commonDocumentRepository, IWebHostEnvironment _hostEnvironment, IDictionaryService? _dictionaryService = null, Type? translateType = null, CriterionType? criterionType = null)
{
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
@@ -340,6 +354,74 @@ public static class ExcelExportHelper
}
+ ///
+ /// 导出文件模板
+ ///
+ ///
+ ///
+ public static async Task ExportTemplateAsync(ExportTemplateServiceDto inDto)
+ {
+ var (physicalPath, fileName) = await FileStoreHelper.GetCommonDocPhysicalFilePathAsync(inDto.hostEnvironment, inDto.commonDocumentRepository, inDto.TemplateCode);
+ //模板路径
+ var tplPath = physicalPath;
+
+ #region 根据中英文 删除模板sheet
+
+ // 打开模板文件
+ var templateFile = new FileStream(tplPath, FileMode.Open, FileAccess.Read);
+
+ // 获取文件流
+ var templateStream = new MemoryStream();
+ templateFile.CopyTo(templateStream);
+ templateStream.Seek(0, SeekOrigin.Begin);
+
+ var workbook = new XSSFWorkbook(templateStream);
+
+ int sheetCount = workbook.NumberOfSheets;
+
+ if (sheetCount == 2)
+ {
+ if (inDto.IsEnglish)
+ {
+ workbook.RemoveSheetAt(0);
+ }
+ else
+ {
+ workbook.RemoveSheetAt(1);
+ }
+
+ var memoryStream2 = new MemoryStream();
+ workbook.Write(memoryStream2, true);
+
+ memoryStream2.Seek(0, SeekOrigin.Begin);
+
+ templateStream = memoryStream2;
+ }
+
+ // 文件名称 从sheet里面取
+ //fileNmae = workbook.GetSheetName(0);
+ #endregion
+
+
+
+ var memoryStream = new MemoryStream();
+
+ var config = new OpenXmlConfiguration()
+ {
+ IgnoreTemplateParameterMissing = true,
+ };
+
+ await MiniExcel.SaveAsByTemplateAsync(memoryStream, templateStream.ToArray(), inDto.Data, config);
+
+ memoryStream.Seek(0, SeekOrigin.Begin);
+
+
+ return new FileStreamResult(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
+ {
+ FileDownloadName = $"{(string.IsNullOrEmpty(inDto.ExportFileName) ? "" : inDto.ExportFileName + "_")}{Path.GetFileNameWithoutExtension(fileName)}_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx"
+ };
+ }
+
}
\ No newline at end of file
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 828c174d7..ef881fbd6 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -43,6 +43,34 @@
+
+
+
+
+
+
+ 文件名前缀
+
+
+
+
+
+
+
+
+
+ 导出文件模板
+
+
+
+
+
+
+ 导出
+
+
+
+
分配规则
@@ -245,11 +273,18 @@
访视读片任务
-
+
访视读片任务
+
+
+ 导出文件模板
+
+
+
+
添加转变任务
@@ -2721,6 +2756,19 @@
+
+
+ 获取IVUS模板
+
+
+
+
+
+
+ 计算斑块数据统计和PVA数据
+
+
+
验证访视提交
@@ -2728,40 +2776,23 @@
-
+
- 计算NTAV的EEM
+ 获取斑块1-PAV
-
+
- 获取(EEM-Lumen)求和
+ 获取斑块2-PAV
-
+
- 计算NTAV的(EEM-Lumen)求和/回撤中的图像数
-
-
-
-
-
-
- 冠状动脉粥样硬化体积百分比(PAV)
-
-
- (EEM-Lumen)求和/EEM求和✖️100,单位%
-
-
-
-
-
-
- 总动脉粥样硬化体积(NTAV)
+ 获取斑块3-PAV
@@ -16289,6 +16320,26 @@
读片数量分类统计
+
+
+ 导出文件
+
+
+
+
+ 模板Code
+
+
+
+
+ 导出的文件名
+
+
+
+
+ 数据
+
+
后台 工作量审核视图模型
diff --git a/IRaCIS.Core.Application/Service/Allocation/Interface/IVisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/Interface/IVisitTaskHelpeService.cs
index ce7de3877..f5c7bedeb 100644
--- a/IRaCIS.Core.Application/Service/Allocation/Interface/IVisitTaskHelpeService.cs
+++ b/IRaCIS.Core.Application/Service/Allocation/Interface/IVisitTaskHelpeService.cs
@@ -5,7 +5,9 @@
//--------------------------------------------------------------------
+using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.ViewModel;
+using Microsoft.AspNetCore.Mvc;
namespace IRaCIS.Core.Application.Service
{
@@ -18,6 +20,13 @@ namespace IRaCIS.Core.Application.Service
Task AddConvertedTask(Guid taskId);
+ ///
+ /// 导出
+ ///
+ ///
+ ///
+ Task ExportTemplateAsync(ExportTemplateAsyncDto inDto);
+
Task BaseCritrionGenerateVisitTask(Guid trialId, Guid confirmedTrialReadingCriterionId, bool? isManualSelectVisit = null, List? subjectVisitIdList = null);
}
}
\ No newline at end of file
diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs
index 9e817c927..b3df6ed32 100644
--- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs
+++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs
@@ -4,6 +4,7 @@
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
+using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Share;
@@ -28,7 +29,7 @@ namespace IRaCIS.Core.Application.Service
IRepository _readingJudgeInfoRepository,
IRepository _subjectUserRepository,
IRepository _readModuleRepository,
-
+ IRepository _commonDocumentRepository,
IRepository _readingOncologyTaskInfoRepository,
IRepository _trialReadingCriterionRepository,
@@ -39,6 +40,26 @@ namespace IRaCIS.Core.Application.Service
+ ///
+ /// 导出文件模板
+ ///
+ ///
+ ///
+
+ public async Task ExportTemplateAsync(ExportTemplateAsyncDto inDto)
+ {
+ return await ExcelExportHelper.ExportTemplateAsync(new ExportTemplateServiceDto()
+ {
+ Data=inDto.Data,
+ commonDocumentRepository= _commonDocumentRepository,
+ TemplateCode=inDto.TemplateCode,
+ ExportFileName=inDto.ExportFileName,
+ hostEnvironment=_hostEnvironment,
+ IsEnglish=_userInfo.IsEn_Us,
+ });
+ }
+
+
//查询列表的时候,一致性核查通过未产生任务的 自动产生任务 如果是一致性核查,那么还会自动分配
public async Task GenerateVisitTaskAsync(Guid trialId, List subjectVisitIdList, bool isAssignSubjectToDoctor = false)
{
diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs
index cdba58330..a8ef9595c 100644
--- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs
+++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs
@@ -196,6 +196,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public List NotEq { get; set; } = new List();
}
+
+ public class GetExportTemplateInDto
+ {
+ public Guid VisitTaskId { get; set; }
+ }
///
/// 阅片计算Dto
///
diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs
index 39360f78f..2b1c6b3c8 100644
--- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs
+++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs
@@ -784,7 +784,7 @@ namespace IRaCIS.Core.Application.Service
var groupIds = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId&& x.Type == ReadingQestionType.Table || x.Type == ReadingQestionType.BasicTable).Select(x => x.GroupId).Distinct().ToListAsync();
var questionIds = await _readingQuestionTrialRepository
- .WhereIf(!criterionIdInfo.IseCRFShowInDicomReading, x => x.IsShowInDicom)
+ .Where(x => x.IsShowInDicom)
.Where(x => groupIds.Contains(x.GroupId)).Select(x => x.Id).ToListAsync();
@@ -792,8 +792,8 @@ namespace IRaCIS.Core.Application.Service
var questions = await _readingQuestionTrialRepository
.Where(x=> !questionIds.Contains(x.Id))
.WhereIf(questionClassify != null, x => x.QuestionClassify == questionClassify)
- .WhereIf(criterionIdInfo.IseCRFShowInDicomReading, x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table && x.Type != ReadingQestionType.BasicTable)
- .WhereIf(!criterionIdInfo.IseCRFShowInDicomReading, x => x.IsShowInDicom && x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table && x.Type != ReadingQestionType.BasicTable)
+
+ .Where( x => x.IsShowInDicom && x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table && x.Type != ReadingQestionType.BasicTable)
.ProjectTo(_mapper.ConfigurationProvider, new
{
@@ -1083,6 +1083,7 @@ namespace IRaCIS.Core.Application.Service
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).FirstNotNullAsync();
var qusetionList = await _readingQuestionTrialRepository
+ .Where(x=>x.IsShowInDicom)
.WhereIf(inDto.QuestionClassify != null, x => x.QuestionClassify == inDto.QuestionClassify)
.Where(x => x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId).ProjectTo(_mapper.ConfigurationProvider, new
{
@@ -1126,23 +1127,17 @@ namespace IRaCIS.Core.Application.Service
// 是否获取所有问题
if (inDto.IsGetallQuestion)
{
- if (!criterionInfo.IseCRFShowInDicomReading)
- {
- qusetionList = qusetionList.Where(x => x.IsShowInDicom).OrderBy(x => x.ShowOrder).ToList();
- }
+ qusetionList = qusetionList.Where(x => x.IsShowInDicom).OrderBy(x => x.ShowOrder).ToList();
}
else
{
- if (!criterionInfo.IseCRFShowInDicomReading)
- {
- List types = new List()
+ List types = new List()
{
ReadingQestionType.Table,
ReadingQestionType.BasicTable,
ReadingQestionType.Group,
};
- qusetionList = qusetionList.Where(x => x.IsShowInDicom && types.Contains(x.Type)).OrderBy(x => x.ShowOrder).ToList();
- }
+ qusetionList = qusetionList.Where(x => x.IsShowInDicom && types.Contains(x.Type)).OrderBy(x => x.ShowOrder).ToList();
if (inDto.TaskId != null)
@@ -1164,10 +1159,7 @@ namespace IRaCIS.Core.Application.Service
break;
case ReadingTool.NoDicom:
- if (!criterionInfo.IseCRFShowInDicomReading)
- {
- qusetionList = qusetionList.Where(x => x.IsShowInDicom).OrderBy(x => x.ShowOrder).ToList();
- }
+ qusetionList = qusetionList.Where(x => x.IsShowInDicom).OrderBy(x => x.ShowOrder).ToList();
break;
}
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs
index 84a8ecb80..4d1444853 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs
@@ -2,8 +2,10 @@
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore.Common;
+using MassTransit;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
+using Microsoft.IdentityModel.Tokens;
namespace IRaCIS.Core.Application.Service.ReadingCalculate
{
@@ -22,6 +24,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
IRepository _tumorAssessmentRepository,
IGeneralCalculateService _generalCalculateService,
IRepository _readingTaskQuestionAnswerRepository,
+ IVisitTaskHelpeService _visitTaskHelpeService,
ILogger _logger) : BaseService, ICriterionCalculateService
{
@@ -82,7 +85,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
//public async Task GetMeasuredValueTemplate(GetMeasuredValueTemplateInDto inDto)
//{
-
+
//}
#region 获取阅片报告
@@ -449,23 +452,20 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
#region 计算 这里顺序非常重要 后面计算的值要依赖前面计算的结果
var needAddList = new List();
+ // 计算斑块数据统计和PVA数据
+ await this.CalculatePatchDataStatisticsAndPVA(inDto);
List calculateList = new List()
{
- // EEM求和
- new ReadingCalculateData (){QuestionType=QuestionType.EEMSum,GetDecimalNullFun=GetEEM},
+ // 斑块1-PAV
+ new ReadingCalculateData (){QuestionType=QuestionType.Plaque1PVA,GetDecimalNullFun=GetPlaque1PVA},
- // (EEM-Lumen)求和
- new ReadingCalculateData (){QuestionType=QuestionType.EEMLumenSum,GetDecimalNullFun=GetEEMLumenSum},
+ // 斑块2-PAV
+ new ReadingCalculateData (){QuestionType=QuestionType.Plaque2PVA,GetDecimalNullFun=GetPlaque2PVA},
- // 计算NTAV的(EEM-Lumen)求和/回撤中的图像数
- new ReadingCalculateData (){QuestionType=QuestionType.NTAVEEMLumenSumOrRetraceImageCount,GetDecimalNullFun=GetNTAVEEMLumenSumOrRetraceImageCount},
+ // 斑块3-PAV
+ new ReadingCalculateData (){QuestionType=QuestionType.Plaque3PVA,GetDecimalNullFun=GetPlaque3PVA},
- // 冠状动脉粥样硬化体积百分比(PAV)
- new ReadingCalculateData (){QuestionType=QuestionType.PAV,GetDecimalNullFun=GetPAV},
-
- // 总动脉粥样硬化体积(NTAV)
- new ReadingCalculateData (){QuestionType=QuestionType.NTAV,GetDecimalNullFun=GetNTAV},
@@ -561,9 +561,201 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
}
+ ///
+ /// 获取IVUS模板
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task GetIVUSTemplate(GetExportTemplateInDto inDto)
+ {
+
+ var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
+
+ var values = new
+ {
+ SubjectID = taskinfo.BlindSubjectCode,
+ TaskBlindName = taskinfo.TaskBlindName,
+ };
+ return await _visitTaskHelpeService.ExportTemplateAsync(new IRaCIS.Application.Contracts.ExportTemplateAsyncDto()
+ {
+ ExportFileName= "IVUS_Template",
+ TemplateCode= StaticData.Export.IVUSTheMeasuredValueOfEachMatchedFragment,
+ Data= values
+ });
+ }
+
+ ///
+ /// 计算斑块数据统计和PVA数据
+ ///
+ ///
+ public async Task CalculatePatchDataStatisticsAndPVA(ReadingCalculateDto inDto)
+ {
+ // 斑块的表格问题Id
+ var questionInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.PatchDataStatistics).FirstOrDefault();
+
+ // pAV 问题信息
+ var pAVquestionInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.PAV).FirstOrDefault();
+
+
+ // 测量值集合
+ var matchValuesAnswerList = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).ToList();
+
+ // 获取编号
+ var nums = matchValuesAnswerList.SelectMany(x => x.TableQuestionList).Where(x => x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => int.Parse(x.Answer)).Distinct().OrderBy(x => x).ToList();
+
+ List tableAnsweRowInfos = new List();
+ List tableAnswers = new List();
+
+ foreach (var item in nums)
+ {
+ var newRowId = NewId.NextGuid();
+
+ var thisnumTableRows = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.PlaqueNumber && y.Answer == item.ToString())).ToList();
+
+ // 斑块数据统计
+ tableAnsweRowInfos.Add(new ReadingTableAnswerRowInfo()
+ {
+ Id = newRowId,
+ QuestionId = questionInfo!.QuestionId,
+ VisitTaskId = inDto.VisitTaskId,
+ TrialId = inDto.TrialId,
+ RowIndex = item,
+ IsCurrentTaskAdd = true,
+ BlindName = inDto.BlindName,
+ OrderMark = questionInfo.OrderMark,
+ FristAddTaskNum = inDto.VisitTaskNum,
+ FristAddTaskId = inDto.VisitTaskId,
+ RowMark = questionInfo.OrderMark + decimal.Parse(item.ToString()).GetLesionMark()
+ });
+
+ // 斑块
+ tableAnswers.Add(new ReadingTableQuestionAnswer()
+ {
+ Answer = item.ToString(),
+ Id = NewId.NextGuid(),
+ QuestionId = questionInfo!.QuestionId,
+ TrialId = inDto.TrialId,
+ VisitTaskId = inDto.VisitTaskId,
+ RowId = newRowId,
+ RowIndex = item,
+ TableQuestionId = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == questionInfo.QuestionId && x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => x.Id).FirstOrDefaultAsync(),
+ });
+ #region 数据计算
+ var emm = thisnumTableRows.SelectMany(x => x.TableQuestionList)
+ .Where(x => x.QuestionMark == QuestionMark.ElasticArea).Select(x => x.Answer.IsNullOrEmptyReturn0()).Sum().ToString();
+
+ var EEMLumen = thisnumTableRows.SelectMany(x => x.TableQuestionList)
+ .Where(x => x.QuestionMark == QuestionMark.ElasticAreaDiffValue).Select(x => x.Answer.IsNullOrEmptyReturn0()).Sum().ToString();
+
+ var pav = "";
+
+ if (emm != null && EEMLumen != null)
+ {
+ var emmNum = decimal.Round(decimal.Parse(emm ?? "0"));
+ var EEMLumenNum = decimal.Round(decimal.Parse(EEMLumen ?? "0"));
+ if (emmNum != 0)
+ {
+ pav = (EEMLumenNum * 100 / emmNum).ToString();
+ }
+ }
+
+ if (inDto.DigitPlaces != -1)
+ {
+ emm = decimal.Round(decimal.Parse(emm ?? "0"), inDto.DigitPlaces).ToString("F" + inDto.DigitPlaces.ToString());
+ EEMLumen = decimal.Round(decimal.Parse(EEMLumen ?? "0"), inDto.DigitPlaces).ToString("F" + inDto.DigitPlaces.ToString());
+ pav = decimal.Round(decimal.Parse(pav ?? "0"), inDto.DigitPlaces).ToString("F" + inDto.DigitPlaces.ToString());
+
+
+ }
+ #endregion
+
+ #region 冠状动脉粥样硬化体积百分比(PAV)
+
+ var newPAVRowId = NewId.NextGuid();
+ // 斑块数据统计
+ tableAnsweRowInfos.Add(new ReadingTableAnswerRowInfo()
+ {
+ Id = newPAVRowId,
+ QuestionId = pAVquestionInfo!.QuestionId,
+ VisitTaskId = inDto.VisitTaskId,
+ TrialId = inDto.TrialId,
+ RowIndex = item,
+ IsCurrentTaskAdd = true,
+ BlindName = inDto.BlindName,
+ OrderMark = pAVquestionInfo.OrderMark,
+ FristAddTaskNum = inDto.VisitTaskNum,
+ FristAddTaskId = inDto.VisitTaskId,
+ RowMark = pAVquestionInfo.OrderMark + decimal.Parse(item.ToString()).GetLesionMark()
+ });
+
+ // 斑块
+ tableAnswers.Add(new ReadingTableQuestionAnswer()
+ {
+ Answer = item.ToString(),
+ Id = NewId.NextGuid(),
+ QuestionId = pAVquestionInfo!.QuestionId,
+ TrialId = inDto.TrialId,
+ VisitTaskId = inDto.VisitTaskId,
+ RowId = newPAVRowId,
+ RowIndex = item,
+ TableQuestionId = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == pAVquestionInfo.QuestionId && x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => x.Id).FirstOrDefaultAsync(),
+ });
+
+
+
+ // PAV
+ tableAnswers.Add(new ReadingTableQuestionAnswer()
+ {
+ Answer = pav,
+ Id = NewId.NextGuid(),
+ QuestionId = pAVquestionInfo!.QuestionId,
+ TrialId = inDto.TrialId,
+ VisitTaskId = inDto.VisitTaskId,
+ RowId = newPAVRowId,
+ RowIndex = item,
+ TableQuestionId = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == pAVquestionInfo.QuestionId && x.QuestionMark == QuestionMark.PAV).Select(x => x.Id).FirstOrDefaultAsync(),
+ });
+
+ #endregion
+
+
+ // EMM 求和
+ tableAnswers.Add(new ReadingTableQuestionAnswer()
+ {
+ Answer = emm,
+ QuestionId = questionInfo!.QuestionId,
+ TrialId = inDto.TrialId,
+ VisitTaskId = inDto.VisitTaskId,
+ RowId = newRowId,
+ RowIndex = item,
+ TableQuestionId = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == questionInfo.QuestionId && x.QuestionMark == QuestionMark.EEMSum).Select(x => x.Id).FirstOrDefaultAsync(),
+ });
+
+ // (EEM-Lumen)求和
+ tableAnswers.Add(new ReadingTableQuestionAnswer()
+ {
+ Answer = EEMLumen,
+ Id = NewId.NextGuid(),
+ QuestionId = questionInfo!.QuestionId,
+ TrialId = inDto.TrialId,
+ VisitTaskId = inDto.VisitTaskId,
+ RowId = newRowId,
+ RowIndex = item,
+ TableQuestionId = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == questionInfo.QuestionId && x.QuestionMark == QuestionMark.EEMSubtractLumenSum).Select(x => x.Id).FirstOrDefaultAsync(),
+ });
+ }
+
+ await _readingTableAnswerRowInfoRepository.BatchDeleteNoTrackingAsync(x => (x.QuestionId == questionInfo.QuestionId || x.QuestionId == pAVquestionInfo.QuestionId) && x.VisitTaskId == inDto.VisitTaskId);
+ await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => (x.QuestionId == questionInfo.QuestionId || x.QuestionId == pAVquestionInfo.QuestionId) && x.VisitTaskId == inDto.VisitTaskId);
+ await _readingTableAnswerRowInfoRepository.AddRangeAsync(tableAnsweRowInfos);
+ await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
+ await _readingTableQuestionAnswerRepository.SaveChangesAsync();
+
+ }
///
/// 验证访视提交
@@ -576,98 +768,132 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
}
///
- /// 计算NTAV的EEM
+ /// 获取斑块1-PAV
///
///
///
- public async Task GetEEM(ReadingCalculateDto inDto)
+ public async Task GetPlaque1PVA(ReadingCalculateDto inDto)
{
- if (inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).Count() == 0)
- {
- return null;
- }
- return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
- .Where(x => x.QuestionMark == QuestionMark.ElasticArea).Select(x => x.Answer.IsNullOrEmptyReturn0()).Sum();
-
+ return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.PAV).SelectMany(x => x.TableRowInfoList).Where(x=>x.TableQuestionList.Any(y=>y.QuestionMark==QuestionMark.PlaqueNumber&&y.Answer.IsNullOrEmptyReturn0()==1)).SelectMany(x => x.TableQuestionList)
+ .Where(x => x.QuestionMark == QuestionMark.PAV).Select(x=>x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0();
}
///
- /// 获取(EEM-Lumen)求和
+ /// 获取斑块2-PAV
///
///
///
- public async Task GetEEMLumenSum(ReadingCalculateDto inDto)
+ public async Task GetPlaque2PVA(ReadingCalculateDto inDto)
{
- if (inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).Count() == 0)
- {
- return null;
- }
- return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
- .Where(x => x.QuestionMark == QuestionMark.ElasticAreaDiffValue).Select(x => x.Answer.IsNullOrEmptyReturn0()).Sum();
-
+ return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.PAV).SelectMany(x => x.TableRowInfoList).Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.PlaqueNumber && y.Answer.IsNullOrEmptyReturn0() == 2)).SelectMany(x => x.TableQuestionList)
+ .Where(x => x.QuestionMark == QuestionMark.PAV).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0();
}
///
- /// 计算NTAV的(EEM-Lumen)求和/回撤中的图像数
+ /// 获取斑块3-PAV
///
///
///
- public async Task GetNTAVEEMLumenSumOrRetraceImageCount(ReadingCalculateDto inDto)
+ public async Task GetPlaque3PVA(ReadingCalculateDto inDto)
{
- var eEMLumenSum = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.EEMLumenSum).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
- var retracedFramesNumber = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.RetracedFramesNumber).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
-
- if (eEMLumenSum == 0 || retracedFramesNumber == 0)
- {
- return null;
- }
- return eEMLumenSum / retracedFramesNumber;
-
+ return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.PAV).SelectMany(x => x.TableRowInfoList).Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.PlaqueNumber && y.Answer.IsNullOrEmptyReturn0() == 3)).SelectMany(x => x.TableQuestionList)
+ .Where(x => x.QuestionMark == QuestionMark.PAV).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0();
}
- ///
- /// 冠状动脉粥样硬化体积百分比(PAV)
- ///
- ///
- /// (EEM-Lumen)求和/EEM求和✖️100,单位%
- ///
- ///
- ///
- public async Task GetPAV(ReadingCalculateDto inDto)
- {
- var eEMLumenSum = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.EEMLumenSum).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
- var eEMSum = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.EEMSum).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
+ /////
+ ///// 计算NTAV的EEM
+ /////
+ /////
+ /////
+ //public async Task GetEEM(ReadingCalculateDto inDto)
+ //{
+ // if (inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).Count() == 0)
+ // {
+ // return null;
+ // }
+ // return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
+ // .Where(x => x.QuestionMark == QuestionMark.ElasticArea).Select(x => x.Answer.IsNullOrEmptyReturn0()).Sum();
- if (eEMSum == 0)
- {
- return null;
- }
- else
- {
- return eEMLumenSum / eEMSum * 100;
- }
- }
+ //}
- ///
- /// 总动脉粥样硬化体积(NTAV)
- ///
- ///
- ///
- public async Task GetNTAV(ReadingCalculateDto inDto)
- {
- var result = await GetNTAVEEMLumenSumOrRetraceImageCount(inDto);
+ /////
+ ///// 获取(EEM-Lumen)求和
+ /////
+ /////
+ /////
+ //public async Task GetEEMLumenSum(ReadingCalculateDto inDto)
+ //{
+ // if (inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).Count() == 0)
+ // {
+ // return null;
+ // }
+ // return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
+ // .Where(x => x.QuestionMark == QuestionMark.ElasticAreaDiffValue).Select(x => x.Answer.IsNullOrEmptyReturn0()).Sum();
- var medianFrame = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.MedianFrame).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
- if (result == null || medianFrame == 0)
- {
- return null;
- }
- else
- {
- return result.Value * medianFrame;
- }
- }
+ //}
+
+ /////
+ ///// 计算NTAV的(EEM-Lumen)求和/回撤中的图像数
+ /////
+ /////
+ /////
+ //public async Task GetNTAVEEMLumenSumOrRetraceImageCount(ReadingCalculateDto inDto)
+ //{
+ // var eEMLumenSum = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.EEMLumenSum).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
+ // var retracedFramesNumber = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.RetracedFramesNumber).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
+
+ // if (eEMLumenSum == 0 || retracedFramesNumber == 0)
+ // {
+ // return null;
+ // }
+ // return eEMLumenSum / retracedFramesNumber;
+
+ //}
+
+
+ /////
+ ///// 冠状动脉粥样硬化体积百分比(PAV)
+ /////
+ /////
+ ///// (EEM-Lumen)求和/EEM求和✖️100,单位%
+ /////
+ /////
+ /////
+ //public async Task GetPAV(ReadingCalculateDto inDto)
+ //{
+ // var eEMLumenSum = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.EEMLumenSum).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
+ // var eEMSum = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.EEMSum).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
+
+ // if (eEMSum == 0)
+ // {
+ // return null;
+ // }
+ // else
+ // {
+ // return eEMLumenSum / eEMSum * 100;
+ // }
+ //}
+
+ /////
+ ///// 总动脉粥样硬化体积(NTAV)
+ /////
+ /////
+ /////
+ //public async Task GetNTAV(ReadingCalculateDto inDto)
+ //{
+ // var result = await GetNTAVEEMLumenSumOrRetraceImageCount(inDto);
+
+ // var medianFrame = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.MedianFrame).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
+ // if (result == null || medianFrame == 0)
+ // {
+ // return null;
+ // }
+ // else
+ // {
+ // return result.Value * medianFrame;
+ // }
+ //}
#region 将上一次的访视病灶添加到这一次
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs
index b026787e9..62efe7ecd 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs
@@ -449,17 +449,17 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
List calculateList = new List()
{
- // 匹配动脉段最小FCT
- new ReadingCalculateData (){QuestionType=QuestionType.MinFCT,GetDecimalNullFun=GetAllMinFCT},
+ //// 匹配动脉段最小FCT
+ //new ReadingCalculateData (){QuestionType=QuestionType.MinFCT,GetDecimalNullFun=GetAllMinFCT},
- // 平均最小FCT
- new ReadingCalculateData (){QuestionType=QuestionType.AverageMinFCT,GetDecimalNullFun=GetAvgMinFCT},
+ // // 平均最小FCT
+ // new ReadingCalculateData (){QuestionType=QuestionType.AverageMinFCT,GetDecimalNullFun=GetAvgMinFCT},
- // 脂质角度平均值
- new ReadingCalculateData (){QuestionType=QuestionType.AvgLipidAngle,GetDecimalNullFun=GetAvgMinLipidAngle},
+ // // 脂质角度平均值
+ // new ReadingCalculateData (){QuestionType=QuestionType.AvgLipidAngle,GetDecimalNullFun=GetAvgMinLipidAngle},
- // 脂质角度最大值
- new ReadingCalculateData (){QuestionType=QuestionType.MaxLipidAngle,GetDecimalNullFun=GetAllMaxLipidAngle},
+ // // 脂质角度最大值
+ // new ReadingCalculateData (){QuestionType=QuestionType.MaxLipidAngle,GetDecimalNullFun=GetAllMaxLipidAngle},
diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs
index 4fbea926c..7fcd028d9 100644
--- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs
+++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs
@@ -1,6 +1,7 @@
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Domain.Share;
+using Microsoft.AspNetCore.Hosting;
using MiniExcelLibs.Attributes;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
@@ -125,6 +126,40 @@ namespace IRaCIS.Application.Contracts
}
+
+
+ ///
+ /// 导出文件
+ ///
+ public class ExportTemplateAsyncDto
+ {
+ ///
+ /// 模板Code
+ ///
+ public string TemplateCode { get; set; }
+
+ ///
+ /// 导出的文件名
+ ///
+ public string ExportFileName { get; set; }
+
+ ///
+ /// 数据
+ ///
+ public object Data { get; set; }
+ }
+
+ public class ExportTemplateServiceDto : ExportTemplateAsyncDto
+ {
+ public IRepository commonDocumentRepository { get; set; }
+
+ public IWebHostEnvironment hostEnvironment { get; set; }
+
+ public bool IsEnglish { get; set; }
+ }
+
+
+
public class ExcelExportInfo : TrialSelectDTO
{
public string CurrentTime { get; set; }
diff --git a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs
index e108d8a5b..c018af771 100644
--- a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs
+++ b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs
@@ -1777,19 +1777,29 @@ public enum SUVChangeVSBaseline
TriggeringIRECSIT = 8,
///
- /// FCT
+ /// 斑块数据统计
///
- FCT = 101,
+ PatchDataStatistics = 101,
///
/// 各匹配片段测量值
///
MatchValues = 102,
+ ///
+ /// 冠状动脉粥样硬化体积百分比(PAV)
+ ///
+ PAV = 103,
+
///
/// 脂质角度
///
- LipidAngle = 103,
+ LipidAngle =111,
+
+ ///
+ /// FCT
+ ///
+ FCT = 112,
}
@@ -2066,6 +2076,26 @@ public enum SUVChangeVSBaseline
///
ElasticAreaDiffValue = 1003,
+ ///
+ /// 斑块编号
+ ///
+ PlaqueNumber = 1004,
+
+ ///
+ /// EEM求和
+ ///
+ EEMSum = 1005,
+
+ ///
+ /// (EEM-Lumen)求和
+ ///
+ EEMSubtractLumenSum = 1006,
+
+ ///
+ /// 冠状动脉粥样硬化体积百分比(PAV)
+ ///
+ PAV = 1007,
+
///
/// FCT第一次测量值
///
@@ -2096,6 +2126,26 @@ public enum SUVChangeVSBaseline
///
LipidAngle = 1016,
+ ///
+ /// 匹配动脉段最小FCT
+ ///
+ MiniMumFCT = 1017,
+
+ ///
+ /// 平均最小FCT
+ ///
+ AvgMinFCT=1018,
+
+ ///
+ /// 脂质角度平均值
+ ///
+ AvgLipidAngle = 1019,
+
+ ///
+ /// 脂质角度最大值
+ ///
+ MaxAvgLipidAngle = 1020,
+
}
@@ -2458,65 +2508,34 @@ public enum SUVChangeVSBaseline
ImageQualityProblem = 67,
///
- /// 回撤中的图像帧数
+ /// 斑块1-PAV
///
- RetracedFramesNumber = 1003,
+ Plaque1PVA = 1003,
///
- /// 队列分析图像帧数的中位数
+ /// 斑块2-PAV
///
- MedianFrame = 1004,
+ Plaque2PVA = 1004,
///
- /// EEM求和
+ /// 斑块3-PAV
///
- EEMSum = 1005,
+ Plaque3PVA = 1005,
///
- /// (EEM-Lumen)求和
+ /// 斑块1-匹配动脉段最小FCT
///
- EEMLumenSum = 1006,
+ Plaque1MinFCT = 1006,
///
- /// 计算NTAV的(EEM-Lumen)求和/回撤中的图像数
+ /// 斑块2-匹配动脉段最小FCT
///
- NTAVEEMLumenSumOrRetraceImageCount = 1007,
+ Plaque2MinFCT = 1007,
///
- /// 冠状动脉粥样硬化体积百分比(PAV)
+ /// 斑块3-匹配动脉段最小FCT
///
- PAV = 1008,
-
- ///
- /// 总动脉粥样硬化体积(NTAV)
- ///
- NTAV = 1009,
-
- ///
- /// 匹配动脉段最小的FCT
- ///
- MinFCT = 1010,
-
- ///
- /// 平均最小FCT
- ///
- AverageMinFCT = 1011,
-
-
- ///
- /// 脂质角度
- ///
- LipidAngle = 1012,
-
- ///
- /// 脂质角度平均值
- ///
- AvgLipidAngle = 1013,
-
- ///
- /// 脂质角度最大值
- ///
- MaxLipidAngle = 1014,
+ Plaque3MinFCT = 1008,
}
diff --git a/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs b/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs
index 7c49b4275..3472cc21d 100644
--- a/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs
+++ b/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs
@@ -252,6 +252,7 @@ public static class StaticData
public const string TrialMedicalReviewList_Export = "TrialMedicalReviewList_Export";
+
//public const string TrialRECIST1Point1SelfAnalysisList_Export = "TrialRECIST1Point1SelfAnalysisList_Export";
@@ -273,7 +274,7 @@ public static class StaticData
public const string PCWG3Point1DetailedOfEvaluatedLesion_Export = "PCWG3Point1DetailedOfEvaluatedLesion_Export";
-
+ public const string IVUSTheMeasuredValueOfEachMatchedFragment = "IVUS_TheMeasuredValueOfEachMatchedFragment";
}