Merge branch 'Test_IRC_Net8' of http://192.168.3.68:2000/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing Details

IRC_NewDev
hang 2024-09-24 16:42:29 +08:00
commit 4d206ebf9d
3 changed files with 204 additions and 10 deletions

View File

@ -6450,6 +6450,31 @@
不等于
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.Reading.Dto.IVUSMeasuredValue">
<summary>
IVUS测量值导入
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.IVUSMeasuredValue.PlaqueNum">
<summary>
斑块编号
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.IVUSMeasuredValue.Emm">
<summary>
外弹力膜面积Emm
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.IVUSMeasuredValue.Lumen">
<summary>
管腔面积Lumen
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.IVUSMeasuredValue.EmmSubtractionLumen">
<summary>
外弹力膜面积- 管腔面积
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto">
<summary>
阅片计算Dto

View File

@ -201,6 +201,39 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
{
public Guid VisitTaskId { get; set; }
}
/// <summary>
/// IVUS测量值导入
/// </summary>
public class IVUSMeasuredValue
{
/// <summary>
/// 斑块编号
/// </summary>
public int PlaqueNum { get; set; }
/// <summary>
/// 外弹力膜面积Emm
/// </summary>
public decimal Emm { get; set; }
/// <summary>
/// 管腔面积Lumen
/// </summary>
public decimal Lumen { get; set; }
/// <summary>
/// 外弹力膜面积- 管腔面积
/// </summary>
public decimal EmmSubtractionLumen
{
get
{
return this.Emm - this.Lumen;
}
}
}
/// <summary>
/// 阅片计算Dto
/// </summary>

View File

@ -1,8 +1,10 @@
using DocumentFormat.OpenXml.Presentation;
using DocumentFormat.OpenXml.EMMA;
using DocumentFormat.OpenXml.Presentation;
using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore.Common;
using IRaCIS.Core.Infrastructure;
using MassTransit;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@ -599,7 +601,137 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var request = httpContext.HttpContext!.Request;
var file = request.Form.Files[0];
Guid visitTaskId = Guid.Parse(request.Form["VisitTaskId"]);
var dataTable = _generalCalculateService.GetDataTableFromUpload(file);
var dataTable =await _generalCalculateService.GetDataTableFromUpload(file);
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x => x.Subject).Include(x=>x.TrialReadingCriterion).FirstNotNullAsync();
var values = new
{
SubjectID = taskinfo.BlindSubjectCode.IsNullOrEmpty() ? taskinfo.Subject.Code : taskinfo.BlindSubjectCode,
TaskBlindName = taskinfo.TaskBlindName,
};
if (values.SubjectID != dataTable.Rows[0]["B"].ToString() || values.TaskBlindName != dataTable.Rows[1]["B"].ToString())
{
throw new BusinessValidationFailedException(_localizer["IVUS_UploadVisitTaskError"]);
}
List<IVUSMeasuredValue> measuredValueList = new List<IVUSMeasuredValue>();
try
{
for (int i = 3; i < dataTable.Rows.Count; i++)
{
measuredValueList.Add(new IVUSMeasuredValue()
{
PlaqueNum = int.Parse(dataTable.Rows[i]["A"].ToString()),
Emm = decimal.Parse(dataTable.Rows[i]["B"].ToString()),
Lumen = decimal.Parse(dataTable.Rows[i]["C"].ToString()),
});
}
}
catch (Exception)
{
throw new BusinessValidationFailedException(_localizer["IVUS_UplpadDataError"]);
}
var questionInfo = await _readingQuestionTrialRepository.Where(x =>x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId&& x.LesionType == LesionType.MatchValues).FirstNotNullAsync();
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == questionInfo.Id).ToListAsync();
List<ReadingTableAnswerRowInfo> tableAnsweRowInfos = new List<ReadingTableAnswerRowInfo>();
List<ReadingTableQuestionAnswer> tableAnswers = new List<ReadingTableQuestionAnswer>();
var maxnum = _readingTableAnswerRowInfoRepository.Where(x => x.QuestionId == questionInfo.Id && x.VisitTaskId == taskinfo.Id).MaxOrDefault(x => x.RowIndex);
foreach (var item in measuredValueList)
{
maxnum = maxnum + 1;
var newRowId = NewId.NextGuid();
// 斑块数据统计
tableAnsweRowInfos.Add(new ReadingTableAnswerRowInfo()
{
Id = newRowId,
QuestionId = questionInfo.Id,
VisitTaskId = taskinfo.Id,
TrialId = taskinfo.TrialId,
RowIndex = maxnum,
IsCurrentTaskAdd = true,
BlindName = taskinfo.TaskBlindName,
OrderMark = questionInfo.OrderMark,
FristAddTaskNum = taskinfo.VisitTaskNum,
FristAddTaskId = taskinfo.Id,
RowMark = questionInfo.OrderMark + decimal.Parse(maxnum.ToString()).GetLesionMark()
});
// 编号
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = item.PlaqueNum.ToString(),
QuestionId = questionInfo.Id,
TrialId = taskinfo.TrialId,
VisitTaskId = taskinfo.Id,
RowId = newRowId,
RowIndex = maxnum,
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => x.Id).FirstOrDefault(),
});
var emm = item.Emm.ToString();
var lumen=item.Lumen.ToString();
var emmSubtractionLumen = item.EmmSubtractionLumen.ToString();
if (taskinfo.TrialReadingCriterion.DigitPlaces != -1)
{
var digitPlaces= taskinfo.TrialReadingCriterion.DigitPlaces??0;
emm = decimal.Round(decimal.Parse(emm ?? "0"), digitPlaces).ToString("F" + digitPlaces.ToString());
lumen = decimal.Round(decimal.Parse(lumen ?? "0"), digitPlaces).ToString("F" + digitPlaces.ToString());
emmSubtractionLumen = decimal.Round(decimal.Parse(emmSubtractionLumen ?? "0"), digitPlaces).ToString("F" + digitPlaces.ToString());
}
// EMM
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = emm,
QuestionId = questionInfo.Id,
TrialId = taskinfo.TrialId,
VisitTaskId = taskinfo.Id,
RowId = newRowId,
RowIndex = maxnum,
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.ElasticArea).Select(x => x.Id).FirstOrDefault(),
});
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = lumen,
QuestionId = questionInfo.Id,
TrialId = taskinfo.TrialId,
VisitTaskId = taskinfo.Id,
RowId = newRowId,
RowIndex = maxnum,
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.LumenArea).Select(x => x.Id).FirstOrDefault(),
});
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = emmSubtractionLumen,
QuestionId = questionInfo.Id,
TrialId = taskinfo.TrialId,
VisitTaskId = taskinfo.Id,
RowId = newRowId,
RowIndex = maxnum,
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.ElasticAreaDiffValue).Select(x => x.Id).FirstOrDefault(),
});
}
await _readingTableAnswerRowInfoRepository.AddRangeAsync(tableAnsweRowInfos);
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
await this.CalculateTask(new CalculateTaskInDto()
{
VisitTaskId = taskinfo.Id,
});
}
/// <summary>
@ -621,7 +753,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
// 获取编号
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<ReadingTableAnswerRowInfo> tableAnsweRowInfos = new List<ReadingTableAnswerRowInfo>();
// 斑块的表格问题集合
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == questionInfo.QuestionId).ToListAsync();
// pAV表格问题
var pAvTableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == pAVquestionInfo.QuestionId).ToListAsync();
List <ReadingTableAnswerRowInfo> tableAnsweRowInfos = new List<ReadingTableAnswerRowInfo>();
List<ReadingTableQuestionAnswer> tableAnswers = new List<ReadingTableQuestionAnswer>();
foreach (var item in nums)
@ -656,7 +794,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
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(),
TableQuestionId = tableQuestionList.Where(x => x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => x.Id).FirstOrDefault(),
});
@ -685,8 +823,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
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
@ -719,7 +855,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
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(),
TableQuestionId = pAvTableQuestionList.Where(x => x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => x.Id).FirstOrDefault(),
});
@ -734,7 +870,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
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(),
TableQuestionId = pAvTableQuestionList.Where(x => x.QuestionMark == QuestionMark.PAV).Select(x => x.Id).FirstOrDefault(),
});
#endregion
@ -749,7 +885,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
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(),
TableQuestionId = tableQuestionList.Where(x => x.QuestionMark == QuestionMark.EEMSum).Select(x => x.Id).FirstOrDefault(),
});
// (EEM-Lumen)求和
@ -762,7 +898,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
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(),
TableQuestionId = tableQuestionList.Where(x => x.QuestionMark == QuestionMark.EEMSubtractLumenSum).Select(x => x.Id).FirstOrDefault(),
});
}