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 51ec22c09..a1e1d90e5 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,13 @@
+
+
+ 获取IVUS模板
+
+
+
+
计算斑块数据统计和PVA数据
@@ -16292,6 +16334,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/ReadingCalculate/IVUSCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs
index b21227e87..6f43e62d7 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs
@@ -24,6 +24,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
IRepository _tumorAssessmentRepository,
IGeneralCalculateService _generalCalculateService,
IRepository _readingTaskQuestionAnswerRepository,
+ IVisitTaskHelpeService _visitTaskHelpeService,
ILogger _logger) : BaseService, ICriterionCalculateService
{
@@ -560,6 +561,29 @@ 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.SubjectId,
+ TaskBlindName = taskinfo.TaskBlindName,
+ };
+ return await _visitTaskHelpeService.ExportTemplateAsync(new IRaCIS.Application.Contracts.ExportTemplateAsyncDto()
+ {
+ ExportFileName= "IVUS_Template",
+ TemplateCode= StaticData.Export.IVUSTheMeasuredValueOfEachMatchedFragment,
+ Data= values
+ });
+ }
///
/// 计算斑块数据统计和PVA数据
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.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";
}