Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
+36
-35
@@ -1,6 +1,7 @@
|
||||
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
@@ -47,7 +48,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
/// <param name="needChangeType"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ReadingReportDto>> GetReadingReportQuestion(
|
||||
List<ReadingQuestionTrial>? questionList,
|
||||
List<ReadingQuestionTrial>? questionList,
|
||||
List<VisitTaskInfo> taskInfoList,
|
||||
List<Globalanswer>? globalanswerList,
|
||||
List<ReadingTaskQuestionAnswer>? answers,
|
||||
@@ -217,7 +218,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
/// 复制既往新病灶答案
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task CopyHistoryAnswer(VisitTask taskinfo, List<ReadingTableAnswerRowInfo> tableRowList,List<ReadingTableQuestionAnswer> tableAnswerList)
|
||||
public async Task CopyHistoryAnswer(VisitTask taskinfo, List<ReadingTableAnswerRowInfo> tableRowList, List<ReadingTableQuestionAnswer> tableAnswerList)
|
||||
{
|
||||
if (_userInfo.RequestUrl == "ReadingImageTask/resetReadingTask")
|
||||
{
|
||||
@@ -226,16 +227,16 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
if (taskinfo.IsCopyLesionAnswer)
|
||||
{
|
||||
var historyTaskId = await _visitTaskRepository.Where(x =>
|
||||
var historyTaskId = await _visitTaskRepository.Where(x =>
|
||||
x.ReadingCategory == ReadingCategory.Visit &&
|
||||
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
|
||||
x.IsAnalysisCreate == taskinfo.IsAnalysisCreate &&
|
||||
x.DoctorUserId == taskinfo.DoctorUserId &&
|
||||
x.IsSelfAnalysis == taskinfo.IsSelfAnalysis &&
|
||||
x.SubjectId == taskinfo.SubjectId &&
|
||||
x.ReadingTaskState == ReadingTaskState.HaveSigned &&
|
||||
x.VisitTaskNum == taskinfo.VisitTaskNum &&
|
||||
x.TaskState != TaskState.Effect &&
|
||||
x.SubjectId == taskinfo.SubjectId &&
|
||||
x.ReadingTaskState == ReadingTaskState.HaveSigned &&
|
||||
x.VisitTaskNum == taskinfo.VisitTaskNum &&
|
||||
x.TaskState != TaskState.Effect &&
|
||||
x.ArmEnum == taskinfo.ArmEnum)
|
||||
.OrderByDescending(x => x.SignTime)
|
||||
.Select(x => x.Id).FirstOrDefaultAsync();
|
||||
@@ -251,9 +252,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var answerList = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync();
|
||||
|
||||
|
||||
var questionMarkList=await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync();
|
||||
var noneDicomMarkList=await _readingNoneDicomMarkRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync();
|
||||
var noneDicomMarkBindingList=await _readingNoneDicomMarkBindingRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync();
|
||||
var questionMarkList = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync();
|
||||
var noneDicomMarkList = await _readingNoneDicomMarkRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync();
|
||||
var noneDicomMarkBindingList = await _readingNoneDicomMarkBindingRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync();
|
||||
|
||||
foreach (var item in tableRowList)
|
||||
{
|
||||
@@ -261,32 +262,32 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var historyRow = historyTableRowList.Where(x =>
|
||||
x.QuestionId == item.QuestionId &&
|
||||
x.RowIndex == item.RowIndex &&
|
||||
x.IdentityRowId==item.IdentityRowId &&
|
||||
x.IdentityRowId !=null &&
|
||||
x.OrganInfoId==item.OrganInfoId
|
||||
var historyRow = historyTableRowList.Where(x =>
|
||||
x.QuestionId == item.QuestionId &&
|
||||
x.RowIndex == item.RowIndex &&
|
||||
x.IdentityRowId == item.IdentityRowId &&
|
||||
x.IdentityRowId != null &&
|
||||
x.OrganInfoId == item.OrganInfoId
|
||||
).FirstOrDefault();
|
||||
|
||||
if (historyRow != null)
|
||||
{
|
||||
item.StudyId= historyRow.StudyId;
|
||||
item.SeriesId= historyRow.SeriesId;
|
||||
item.InstanceId= historyRow.InstanceId;
|
||||
item.StudyId = historyRow.StudyId;
|
||||
item.SeriesId = historyRow.SeriesId;
|
||||
item.InstanceId = historyRow.InstanceId;
|
||||
|
||||
item.OtherStudyId = historyRow.OtherStudyId;
|
||||
item.OtherSeriesId = historyRow.OtherSeriesId;
|
||||
item.OtherInstanceId= historyRow.OtherInstanceId;
|
||||
item.OtherInstanceId = historyRow.OtherInstanceId;
|
||||
|
||||
item.MeasureData= historyRow.MeasureData.Replace(historyTaskId.ToString(),taskinfo.Id.ToString());
|
||||
item.MeasureData = historyRow.MeasureData.Replace(historyTaskId.ToString(), taskinfo.Id.ToString());
|
||||
item.OtherMeasureData = historyRow.OtherMeasureData.Replace(historyTaskId.ToString(), taskinfo.Id.ToString());
|
||||
|
||||
|
||||
tableAnswerList.Where(x => x.RowId == item.Id).ForEach(x =>
|
||||
{
|
||||
x.Answer = x.Answer.IsNullOrEmpty() ?
|
||||
historyTableAnswerList.Where(y => y.RowId == historyRow.Id && y.TableQuestionId == x.TableQuestionId).Select(x => x.Answer).FirstOrDefault()??string.Empty :
|
||||
historyTableAnswerList.Where(y => y.RowId == historyRow.Id && y.TableQuestionId == x.TableQuestionId).Select(x => x.Answer).FirstOrDefault() ?? string.Empty :
|
||||
x.Answer;
|
||||
});
|
||||
|
||||
@@ -304,7 +305,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
|
||||
// 处理标记
|
||||
Dictionary<Guid,Guid> dicomKeys=new Dictionary<Guid, Guid> ();
|
||||
Dictionary<Guid, Guid> dicomKeys = new Dictionary<Guid, Guid>();
|
||||
|
||||
foreach (var item in questionMarkList)
|
||||
{
|
||||
@@ -336,7 +337,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
Dictionary<Guid, Guid> noneKeys = new Dictionary<Guid, Guid>();
|
||||
foreach (var item in noneDicomMarkList)
|
||||
{
|
||||
var newid= NewId.NextGuid();
|
||||
var newid = NewId.NextGuid();
|
||||
|
||||
item.VisitTaskId = taskinfo.Id;
|
||||
if (item.MarkId != null)
|
||||
@@ -372,7 +373,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -388,17 +389,17 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从上传文件中获取Datatable
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<FileToDataTableDto> GetDataTableFromUpload(IFormFile file,string pathCode,Guid trialId)
|
||||
public async Task<FileToDataTableDto> GetDataTableFromUpload(IFormFile file, string pathCode, Guid trialId)
|
||||
{
|
||||
|
||||
FileToDataTableDto result=new FileToDataTableDto ();
|
||||
FileToDataTableDto result = new FileToDataTableDto();
|
||||
|
||||
result.DataTable = new DataTable();
|
||||
var fileFolder = "Upload\\";
|
||||
@@ -419,7 +420,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
file.CopyTo(stream);
|
||||
await stream.CopyToAsync(fileStream);
|
||||
|
||||
result.SheetNames= stream.GetSheetNames();
|
||||
result.SheetNames = stream.GetSheetNames();
|
||||
stream.Position = 0;
|
||||
result.DataTable = stream.QueryAsDataTable(useHeaderRow: false);
|
||||
}
|
||||
@@ -432,15 +433,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
try
|
||||
{
|
||||
var ossRelativePath = await oSSService.UploadToOSSAsync(fileStream, "InspectionUpload/"+ pathCode, file.FileName);
|
||||
var ossRelativePath = await oSSService.UploadToOSSAsync(fileStream, $"{trialId}/InspectionUpload/" + pathCode, file.FileName, uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = trialId, BatchDataType = BatchDataType.ReadingImportTemplete });
|
||||
await _inspectionFileRepository.AddAsync(new InspectionFile() { FileName = file.FileName, RelativePath = ossRelativePath, TrialId = trialId });
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -457,7 +458,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
// 遍历每一列,检查值
|
||||
foreach (var item in row.ItemArray)
|
||||
{
|
||||
if (item!=null&&!item.ToString().IsNullOrEmpty())
|
||||
if (item != null && !item.ToString().IsNullOrEmpty())
|
||||
{
|
||||
allEmpty = false;
|
||||
break; // 只要有一个不为空,跳出循环
|
||||
@@ -532,7 +533,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
/// <returns></returns>
|
||||
public async Task<ReadingCalculateDto> GetReadingCalculateDto(Guid visitTaskId)
|
||||
{
|
||||
var visitTask = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x=>x.SourceSubjectVisit).FirstNotNullAsync();
|
||||
var visitTask = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x => x.SourceSubjectVisit).FirstNotNullAsync();
|
||||
|
||||
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == visitTask.TrialReadingCriterionId).FirstNotNullAsync();
|
||||
var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == (visitTask.SourceSubjectVisitId ?? default(Guid))).FirstOrDefaultAsync();
|
||||
@@ -540,7 +541,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == visitTask.SubjectId && x.IsBaseLine).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == visitTaskId).Include(x=>x.FristAddTask).ToListAsync();
|
||||
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == visitTaskId).Include(x => x.FristAddTask).ToListAsync();
|
||||
|
||||
var baseLinetaskId = await _visitTaskRepository.Where(x => x.SourceSubjectVisitId == baseLineVisitId && x.TaskState == TaskState.Effect
|
||||
&& x.TrialReadingCriterionId == visitTask.TrialReadingCriterionId
|
||||
|
||||
+25
-23
@@ -83,7 +83,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
await file.CopyToAsync(streamCopy);
|
||||
// 重置流的位置,以便后续读取
|
||||
streamCopy.Position = 0;
|
||||
var ossRelativePath = await oSSService.UploadToOSSAsync(streamCopy, $"{visitTaskInfo.TrialId.ToString()}/InspectionUpload/ReadingImport", file.FileName);
|
||||
var ossRelativePath = await oSSService.UploadToOSSAsync(streamCopy, $"{visitTaskInfo.TrialId.ToString()}/InspectionUpload/ReadingImport", file.FileName, uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = visitTaskInfo.TrialId, BatchDataType = BatchDataType.ReadingImportTemplete });
|
||||
|
||||
|
||||
await _readingImportFileRepository.AddAsync(new ReadingImportFile()
|
||||
@@ -348,13 +348,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
}
|
||||
|
||||
|
||||
private async Task<GetReportsChartDataOutDto> GetReportsChartTypeData(GetReportsChartTypeDataInDto inDto)
|
||||
private async Task<GetReportsChartDataOutDto> GetReportsChartTypeData(GetReportsChartTypeDataInDto inDto)
|
||||
{
|
||||
var visitTaskNameList = inDto.Data.VisitTaskList.Select(x => x.BlindName).ToList();
|
||||
GetReportsChartDataOutDto result = new GetReportsChartDataOutDto() {
|
||||
|
||||
ChartDataList=new List<ReportChartData>() { },
|
||||
VisitTaskNameList= visitTaskNameList,
|
||||
GetReportsChartDataOutDto result = new GetReportsChartDataOutDto()
|
||||
{
|
||||
|
||||
ChartDataList = new List<ReportChartData>() { },
|
||||
VisitTaskNameList = visitTaskNameList,
|
||||
|
||||
};
|
||||
switch (inDto.ReportChartTypeEnum)
|
||||
@@ -455,30 +456,30 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
public async Task<GetReportsChartSummaryOutDto> GetReportsChartSummary(GetReportsChartSummaryInDto inDto)
|
||||
{
|
||||
var criterion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialCriterionId).FirstNotNullAsync();
|
||||
var result= new GetReportsChartSummaryOutDto();
|
||||
var result = new GetReportsChartSummaryOutDto();
|
||||
var r1Data = await GetData(new List<Arm>() { Arm.SingleReadingArm, Arm.DoubleReadingArm1 });
|
||||
var r2Data = await GetData(new List<Arm>() { Arm.DoubleReadingArm2 });
|
||||
|
||||
var alldata = r1Data.VisitTaskList.Count() > r2Data.VisitTaskList.Count() ? r1Data : r2Data;
|
||||
var alldata = r1Data.VisitTaskList.Count() > r2Data.VisitTaskList.Count() ? r1Data : r2Data;
|
||||
var visitTaskName = alldata.VisitTaskList.Select(x => x.BlindName).ToList();
|
||||
var length = alldata.VisitTaskList.Count();
|
||||
|
||||
// -1转为空
|
||||
List<QuestionType?> negativeToString = new List<QuestionType?>()
|
||||
List<QuestionType?> negativeToString = new List<QuestionType?>()
|
||||
{
|
||||
QuestionType.DaysBetween,
|
||||
};
|
||||
|
||||
|
||||
async Task<GetReadingReportEvaluationOutDto> GetData(List<Arm> arms)
|
||||
{
|
||||
var data = new GetReadingReportEvaluationOutDto() { };
|
||||
var task = await _visitTaskRepository.Where(x =>
|
||||
x.SubjectId == inDto.SubjectId
|
||||
&& arms.Contains(x.ArmEnum)
|
||||
&& x.ReadingCategory== ReadingCategory.Visit
|
||||
&& x.ReadingCategory == ReadingCategory.Visit
|
||||
&& x.ReadingTaskState == ReadingTaskState.HaveSigned
|
||||
&& x.TaskState == TaskState.Effect
|
||||
&& x.TrialReadingCriterionId==inDto.TrialCriterionId
|
||||
&& x.TrialReadingCriterionId == inDto.TrialCriterionId
|
||||
).OrderByDescending(x => x.VisitTaskNum).FirstOrDefaultAsync();
|
||||
if (task != null)
|
||||
{
|
||||
@@ -499,13 +500,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
Evaluation = new List<List<EvaluationValue>>() { }
|
||||
};
|
||||
|
||||
var baseLineAnswerType= QuestionType.ExistDisease;
|
||||
var baseLineAnswerType = QuestionType.ExistDisease;
|
||||
|
||||
var visitAnswerType = QuestionType.Tumor;
|
||||
switch (criterion.CriterionType)
|
||||
{
|
||||
case CriterionType.PCWG3:
|
||||
baseLineAnswerType= QuestionType.SiteVisitForTumorEvaluation;
|
||||
baseLineAnswerType = QuestionType.SiteVisitForTumorEvaluation;
|
||||
visitAnswerType = QuestionType.SiteVisitForTumorEvaluation;
|
||||
break;
|
||||
case CriterionType.Lugano2014WithoutPET:
|
||||
@@ -515,14 +516,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
visitAnswerType = QuestionType.ImgOncology;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
result.Evaluation.Add(visitTaskName.Select(x=> new EvaluationValue() {
|
||||
Value=x
|
||||
|
||||
result.Evaluation.Add(visitTaskName.Select(x => new EvaluationValue()
|
||||
{
|
||||
Value = x
|
||||
}).ToList());
|
||||
|
||||
var r1baseLine= r1.TaskQuestions
|
||||
var r1baseLine = r1.TaskQuestions
|
||||
.SelectMany(x => x.Childrens)
|
||||
.Where(x => x.QuestionType == baseLineAnswerType)
|
||||
.SelectMany(x => x.Answer.Select(a => new EvaluationValue
|
||||
@@ -545,7 +547,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
r1data = r1baseLine.Take(1).Concat(r1data.Skip(1)).ToList();
|
||||
|
||||
r1data= r1data.Concat(Enumerable.Repeat(new EvaluationValue() { Value = "" }, length))
|
||||
r1data = r1data.Concat(Enumerable.Repeat(new EvaluationValue() { Value = "" }, length))
|
||||
.Take(length)
|
||||
.ToList();
|
||||
result.Evaluation.Add(r1data);
|
||||
@@ -581,7 +583,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
.ToList();
|
||||
result.Evaluation.Add(r2data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -597,17 +599,17 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var chartList = new List<ReportChartData>();
|
||||
foreach (var item in items)
|
||||
{
|
||||
var itemdata= data.TaskQuestions.SelectMany(x => x.Childrens)
|
||||
var itemdata = data.TaskQuestions.SelectMany(x => x.Childrens)
|
||||
.Where(x => x.QuestionId == item.QuestionId)
|
||||
.FirstOrDefault();
|
||||
var cd = new ReportChartData
|
||||
{
|
||||
Name = item?.QuestionName??string.Empty,
|
||||
Name = item?.QuestionName ?? string.Empty,
|
||||
Value = itemdata?.Answer?.Select(a => a.Answer).ToList() ?? new List<string>()
|
||||
};
|
||||
if (negativeToString.Contains(item.QuestionType))
|
||||
{
|
||||
cd.Value = cd.Value.Select(item => item == "-1"|| item == "-2" ? string.Empty : item).ToList();
|
||||
cd.Value = cd.Value.Select(item => item == "-1" || item == "-2" ? string.Empty : item).ToList();
|
||||
}
|
||||
chartList.Add(cd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user