IRC_NewDev
parent
aba7dfdec9
commit
3e375ea6d1
|
@ -4,6 +4,7 @@
|
|||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using System.Data;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
{
|
||||
|
@ -283,7 +284,12 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public decimal Data { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class FileToDataTableDto
|
||||
{
|
||||
public DataTable DataTable { get; set; }
|
||||
|
||||
public List<string> SheetNames { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 阅片计算Dto
|
||||
|
|
|
@ -35,12 +35,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
/// 从上传文件中获取Datatable
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<DataTable> GetDataTableFromUpload(IFormFile file,string pathCode,Guid trialId)
|
||||
public async Task<FileToDataTableDto> GetDataTableFromUpload(IFormFile file,string pathCode,Guid trialId)
|
||||
{
|
||||
|
||||
|
||||
FileToDataTableDto result=new FileToDataTableDto ();
|
||||
|
||||
DataTable result = new DataTable();
|
||||
result.DataTable = new DataTable();
|
||||
var fileFolder = "Upload\\";
|
||||
if (!Directory.Exists(fileFolder))
|
||||
{
|
||||
|
@ -59,8 +59,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
file.CopyTo(stream);
|
||||
await stream.CopyToAsync(fileStream);
|
||||
|
||||
result.SheetNames= stream.GetSheetNames();
|
||||
stream.Position = 0;
|
||||
result = stream.QueryAsDataTable(useHeaderRow: false);
|
||||
result.DataTable = stream.QueryAsDataTable(useHeaderRow: false);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
|
@ -89,7 +90,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
var rowsToRemove = new System.Collections.Generic.List<DataRow>();
|
||||
|
||||
// 遍历DataTable的每一行
|
||||
foreach (DataRow row in result.Rows)
|
||||
foreach (DataRow row in result.DataTable.Rows)
|
||||
{
|
||||
bool allEmpty = true;
|
||||
|
||||
|
@ -113,7 +114,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
// 移除标记为待删除的行
|
||||
foreach (var row in rowsToRemove)
|
||||
{
|
||||
result.Rows.Remove(row);
|
||||
result.DataTable.Rows.Remove(row);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -604,9 +604,18 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
var file = request.Form.Files[0];
|
||||
Guid visitTaskId = Guid.Parse(request.Form["VisitTaskId"]);
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x => x.Subject).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
|
||||
var dataTable =await _generalCalculateService.GetDataTableFromUpload(file, "IVUSTemplate", taskinfo.TrialId);
|
||||
var uploadInfo =await _generalCalculateService.GetDataTableFromUpload(file, "IVUSTemplate", taskinfo.TrialId);
|
||||
|
||||
|
||||
List<string> sheetNames = new List<string>()
|
||||
{
|
||||
"各匹配片段测量值","MeasuredValue"
|
||||
};
|
||||
|
||||
if (sheetNames.Intersect(uploadInfo.SheetNames).Count() == 0)
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["IVUS_UplpadDataError"]);
|
||||
}
|
||||
var dataTable = uploadInfo.DataTable;
|
||||
|
||||
var values = new TemplateData()
|
||||
{
|
||||
|
|
|
@ -44,6 +44,6 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
Task<DataTable> GetDataTableFromUpload(IFormFile file, string pathCode, Guid trialId);
|
||||
Task<FileToDataTableDto> GetDataTableFromUpload(IFormFile file, string pathCode, Guid trialId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -471,9 +471,18 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
var file = request.Form.Files[0];
|
||||
Guid visitTaskId = Guid.Parse(request.Form["VisitTaskId"]);
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x => x.Subject).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
|
||||
var dataTable = await _generalCalculateService.GetDataTableFromUpload(file, "OCTFCT", taskinfo.TrialId);
|
||||
var uploadInfo = await _generalCalculateService.GetDataTableFromUpload(file, "OCTFCT", taskinfo.TrialId);
|
||||
|
||||
|
||||
List<string> sheetNames = new List<string>()
|
||||
{
|
||||
"FCT导入","FCT"
|
||||
};
|
||||
|
||||
if (sheetNames.Intersect(uploadInfo.SheetNames).Count() == 0)
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["IVUS_UplpadDataError"]);
|
||||
}
|
||||
var dataTable = uploadInfo.DataTable;
|
||||
|
||||
var values = new TemplateData()
|
||||
{
|
||||
|
@ -648,9 +657,17 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
var file = request.Form.Files[0];
|
||||
Guid visitTaskId = Guid.Parse(request.Form["VisitTaskId"]);
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x => x.Subject).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
|
||||
var dataTable = await _generalCalculateService.GetDataTableFromUpload(file, "OCTLipidAngle", taskinfo.TrialId);
|
||||
var uploadInfo = await _generalCalculateService.GetDataTableFromUpload(file, "OCTLipidAngle", taskinfo.TrialId);
|
||||
List<string> sheetNames = new List<string>()
|
||||
{
|
||||
"脂质角度","LipidAngle"
|
||||
};
|
||||
|
||||
|
||||
if (sheetNames.Intersect(uploadInfo.SheetNames).Count() == 0)
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["IVUS_UplpadDataError"]);
|
||||
}
|
||||
var dataTable = uploadInfo.DataTable;
|
||||
|
||||
var values = new TemplateData()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue