Merge branch 'Test_IRC_Net10' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net10
continuous-integration/drone/push Build is running
Details
continuous-integration/drone/push Build is running
Details
commit
96650ced2d
|
|
@ -250,6 +250,37 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
public string TaskBlindName { get; set; }
|
public string TaskBlindName { get; set; }
|
||||||
|
|
||||||
public string SubjectID { get; set; }
|
public string SubjectID { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 靶段
|
||||||
|
/// </summary>
|
||||||
|
public string TargetSegment { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 靶段备注
|
||||||
|
/// </summary>
|
||||||
|
public string TargetSegmentRemarks { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ROI段落总长度
|
||||||
|
/// </summary>
|
||||||
|
public string ROIAllLength { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 回撤中的图像帧数
|
||||||
|
/// </summary>
|
||||||
|
public string PullbackFrameCount { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 斑块类型
|
||||||
|
/// </summary>
|
||||||
|
public string PlaqueType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 访视点备注(如有)
|
||||||
|
/// </summary>
|
||||||
|
public string AdjustReason { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OCTFCTUploadData
|
public class OCTFCTUploadData
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
using DocumentFormat.OpenXml.Spreadsheet;
|
||||||
|
using IRaCIS.Core.Application.Interfaces;
|
||||||
|
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||||
using IRaCIS.Core.Application.ViewModel;
|
using IRaCIS.Core.Application.ViewModel;
|
||||||
using IRaCIS.Core.Infra.EFCore.Common;
|
using IRaCIS.Core.Infra.EFCore.Common;
|
||||||
using IRaCIS.Core.Infrastructure;
|
using IRaCIS.Core.Infrastructure;
|
||||||
|
|
@ -6,6 +8,7 @@ using MassTransit;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
{
|
{
|
||||||
|
|
@ -18,6 +21,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
IRepository<ReadingTableAnswerRowInfo> _readingTableAnswerRowInfoRepository,
|
IRepository<ReadingTableAnswerRowInfo> _readingTableAnswerRowInfoRepository,
|
||||||
IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository,
|
IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository,
|
||||||
IRepository<OrganInfo> _organInfoRepository,
|
IRepository<OrganInfo> _organInfoRepository,
|
||||||
|
ISubjectVisitService iSubjectVisitService,
|
||||||
|
IRepository<Dictionary> _dictionaryRepository,
|
||||||
IRepository<ReadingGlobalTaskInfo> _readingGlobalTaskInfoRepository,
|
IRepository<ReadingGlobalTaskInfo> _readingGlobalTaskInfoRepository,
|
||||||
IRepository<SubjectVisit> _subjectVisitRepository,
|
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||||
IRepository<TumorAssessment_IRECIST1Point1> _tumorAssessmentRepository,
|
IRepository<TumorAssessment_IRECIST1Point1> _tumorAssessmentRepository,
|
||||||
|
|
@ -414,10 +419,64 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
|
|
||||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x=>x.Subject).FirstNotNullAsync();
|
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x=>x.Subject).FirstNotNullAsync();
|
||||||
|
|
||||||
|
//靶段
|
||||||
|
var targetSegmentdic = await _dictionaryRepository.Where(x => x.Parent.Code == "TargetSegment").ToListAsync();
|
||||||
|
|
||||||
|
//斑块类型
|
||||||
|
var plaqueTypedic = await _dictionaryRepository.Where(x => x.Parent.Code == "PlaqueType").ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var awswerList=await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).Include(x=>x.ReadingQuestionTrial).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var targetSegmentAnswer = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.TargetSegment).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
|
||||||
|
if (targetSegmentAnswer.IsNotNullOrEmpty())
|
||||||
|
{
|
||||||
|
var data= JsonConvert.DeserializeObject<List<string>>(targetSegmentAnswer);
|
||||||
|
targetSegmentAnswer = string.Join(",", targetSegmentdic
|
||||||
|
.Where(x => data.Contains(x.Code))
|
||||||
|
.Select(x => x.ValueCN));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var targetSegmentData = await iSubjectVisitService.GetReadingVisitStudyList(new Contracts.GetReadingVisitStudyListIndto()
|
||||||
|
{
|
||||||
|
SujectVisitId = taskinfo.SourceSubjectVisitId ?? default(Guid),
|
||||||
|
TrialId = taskinfo.TrialId,
|
||||||
|
VisitTaskId = inDto.VisitTaskId
|
||||||
|
});
|
||||||
|
targetSegmentAnswer = string.Join(",", targetSegmentData
|
||||||
|
.Where(x =>x.BodyPartForEdit.IsNotNullOrEmpty())
|
||||||
|
.Select(x => x.BodyPartForEdit));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var plaqueTypeAnswer = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.PlaqueType).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
|
||||||
|
if (plaqueTypeAnswer.IsNotNullOrEmpty())
|
||||||
|
{
|
||||||
|
var data = JsonConvert.DeserializeObject<List<string>>(plaqueTypeAnswer);
|
||||||
|
plaqueTypeAnswer = string.Join(",", plaqueTypedic
|
||||||
|
.Where(x => data.Contains(x.Code))
|
||||||
|
.Select(x => x.ValueCN));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var values = new TemplateData()
|
var values = new TemplateData()
|
||||||
{
|
{
|
||||||
SubjectID = (taskinfo.BlindSubjectCode.IsNullOrEmpty() ? taskinfo.Subject.Code : taskinfo.BlindSubjectCode),
|
SubjectID = (taskinfo.BlindSubjectCode.IsNullOrEmpty() ? taskinfo.Subject.Code : taskinfo.BlindSubjectCode),
|
||||||
TaskBlindName = taskinfo.TaskBlindName,
|
TaskBlindName = taskinfo.TaskBlindName,
|
||||||
|
TargetSegment= targetSegmentAnswer,
|
||||||
|
TargetSegmentRemarks = awswerList.Where(x=>x.ReadingQuestionTrial.QuestionType == QuestionType.TargetSegmentRemarks).Select(x=>x.Answer).FirstOrDefault()??string.Empty,
|
||||||
|
ROIAllLength = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.ROIAllLength).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
|
||||||
|
PullbackFrameCount = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.PullbackFrameCount).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
|
||||||
|
AdjustReason = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.AdjustReason).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
|
||||||
|
PlaqueType = plaqueTypeAnswer,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
return await _visitTaskHelpeService.ExportTemplateAsync(new IRaCIS.Application.Contracts.ExportTemplateAsyncDto()
|
return await _visitTaskHelpeService.ExportTemplateAsync(new IRaCIS.Application.Contracts.ExportTemplateAsyncDto()
|
||||||
{
|
{
|
||||||
|
|
@ -529,7 +588,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
List<IVUSMeasuredValue> measuredValueList = new List<IVUSMeasuredValue>();
|
List<IVUSMeasuredValue> measuredValueList = new List<IVUSMeasuredValue>();
|
||||||
var errorRow = new List<int> { };
|
var errorRow = new List<int> { };
|
||||||
|
|
||||||
for (int i = 3; i < dataTable.Rows.Count; i++)
|
for (int i = 9; i < dataTable.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
IVUSMeasuredValue iVUSMeasuredValue = new IVUSMeasuredValue() { };
|
IVUSMeasuredValue iVUSMeasuredValue = new IVUSMeasuredValue() { };
|
||||||
try
|
try
|
||||||
|
|
@ -691,7 +750,100 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region 构造外层问题答案
|
||||||
|
List<ReadingTaskQuestionAnswer> questionAnswers = new List<ReadingTaskQuestionAnswer>();
|
||||||
|
|
||||||
|
var readingQuestionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId).ToListAsync();
|
||||||
|
var targetSegmentAnswer = dataTable.Rows[2]["B"].ToString();
|
||||||
|
|
||||||
|
if (targetSegmentAnswer.IsNotNullOrEmpty())
|
||||||
|
{
|
||||||
|
var targetSegmentValues = targetSegmentAnswer.Replace(",", ",").Split(",").ToList();
|
||||||
|
var targetSegmentdic = await _dictionaryRepository.Where(x => x.Parent.Code == "TargetSegment").ToListAsync();
|
||||||
|
targetSegmentAnswer = JsonConvert.SerializeObject(targetSegmentdic.Where(x => targetSegmentValues.Contains(x.ValueCN)).Select(x => x.Code).ToList());
|
||||||
|
}
|
||||||
|
|
||||||
|
questionAnswers.Add(new ReadingTaskQuestionAnswer()
|
||||||
|
{
|
||||||
|
Answer= targetSegmentAnswer??string.Empty,
|
||||||
|
ReadingQuestionCriterionTrialId = taskinfo.TrialReadingCriterionId,
|
||||||
|
ReadingQuestionTrialId = readingQuestionList.Where(x => x.QuestionType == QuestionType.TargetSegment).Select(x => x.Id).FirstOrDefault(),
|
||||||
|
TrialId = taskinfo.TrialId,
|
||||||
|
SubjectId= taskinfo.SubjectId,
|
||||||
|
VisitTaskId = taskinfo.Id,
|
||||||
|
});
|
||||||
|
|
||||||
|
questionAnswers.Add(new ReadingTaskQuestionAnswer()
|
||||||
|
{
|
||||||
|
Answer = dataTable.Rows[3]["B"].ToString()??string.Empty,
|
||||||
|
ReadingQuestionCriterionTrialId = taskinfo.TrialReadingCriterionId,
|
||||||
|
ReadingQuestionTrialId = readingQuestionList.Where(x => x.QuestionType == QuestionType.TargetSegmentRemarks).Select(x => x.Id).FirstOrDefault(),
|
||||||
|
TrialId = taskinfo.TrialId,
|
||||||
|
SubjectId = taskinfo.SubjectId,
|
||||||
|
VisitTaskId = taskinfo.Id,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
questionAnswers.Add(new ReadingTaskQuestionAnswer()
|
||||||
|
{
|
||||||
|
Answer = dataTable.Rows[4]["B"].ToString() ?? string.Empty,
|
||||||
|
ReadingQuestionCriterionTrialId = taskinfo.TrialReadingCriterionId,
|
||||||
|
ReadingQuestionTrialId = readingQuestionList.Where(x => x.QuestionType == QuestionType.ROIAllLength).Select(x => x.Id).FirstOrDefault(),
|
||||||
|
TrialId = taskinfo.TrialId,
|
||||||
|
SubjectId = taskinfo.SubjectId,
|
||||||
|
VisitTaskId = taskinfo.Id,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
questionAnswers.Add(new ReadingTaskQuestionAnswer()
|
||||||
|
{
|
||||||
|
Answer = dataTable.Rows[5]["B"].ToString() ?? string.Empty,
|
||||||
|
ReadingQuestionCriterionTrialId = taskinfo.TrialReadingCriterionId,
|
||||||
|
ReadingQuestionTrialId = readingQuestionList.Where(x => x.QuestionType == QuestionType.PullbackFrameCount).Select(x => x.Id).FirstOrDefault(),
|
||||||
|
TrialId = taskinfo.TrialId,
|
||||||
|
SubjectId = taskinfo.SubjectId,
|
||||||
|
VisitTaskId = taskinfo.Id,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var plaqueTypeAnswer = dataTable.Rows[6]["B"].ToString();
|
||||||
|
|
||||||
|
if (plaqueTypeAnswer.IsNotNullOrEmpty())
|
||||||
|
{
|
||||||
|
var plaqueTypeAnswerValues = plaqueTypeAnswer.Replace(",", ",").Split(",").ToList();
|
||||||
|
var plaqueTypeAnswerdic = await _dictionaryRepository.Where(x => x.Parent.Code == "PlaqueType").ToListAsync();
|
||||||
|
plaqueTypeAnswer = JsonConvert.SerializeObject(plaqueTypeAnswerdic
|
||||||
|
.Where(x => plaqueTypeAnswerValues.Any(val => x.ValueCN.Contains(val)))
|
||||||
|
.Select(x => x.Code)
|
||||||
|
.ToList());
|
||||||
|
}
|
||||||
|
|
||||||
|
questionAnswers.Add(new ReadingTaskQuestionAnswer()
|
||||||
|
{
|
||||||
|
Answer = plaqueTypeAnswer ?? string.Empty,
|
||||||
|
ReadingQuestionCriterionTrialId = taskinfo.TrialReadingCriterionId,
|
||||||
|
ReadingQuestionTrialId = readingQuestionList.Where(x => x.QuestionType == QuestionType.PlaqueType).Select(x => x.Id).FirstOrDefault(),
|
||||||
|
TrialId = taskinfo.TrialId,
|
||||||
|
SubjectId = taskinfo.SubjectId,
|
||||||
|
VisitTaskId = taskinfo.Id,
|
||||||
|
});
|
||||||
|
|
||||||
|
questionAnswers.Add(new ReadingTaskQuestionAnswer()
|
||||||
|
{
|
||||||
|
Answer = dataTable.Rows[7]["B"].ToString() ?? string.Empty,
|
||||||
|
ReadingQuestionCriterionTrialId = taskinfo.TrialReadingCriterionId,
|
||||||
|
ReadingQuestionTrialId = readingQuestionList.Where(x => x.QuestionType == QuestionType.AdjustReason).Select(x => x.Id).FirstOrDefault(),
|
||||||
|
TrialId = taskinfo.TrialId,
|
||||||
|
SubjectId = taskinfo.SubjectId,
|
||||||
|
VisitTaskId = taskinfo.Id,
|
||||||
|
});
|
||||||
|
|
||||||
|
var questionids = questionAnswers.Select(x => x.ReadingQuestionTrialId).ToList();
|
||||||
|
await _readingTaskQuestionAnswerRepository.DeleteFromQueryAsync(x => x.VisitTaskId == taskinfo.Id && questionids.Contains(x.ReadingQuestionTrialId));
|
||||||
|
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||||
|
await _readingTaskQuestionAnswerRepository.AddRangeAsync(questionAnswers);
|
||||||
|
await _readingTaskQuestionAnswerRepository.SaveChangesAsync();
|
||||||
|
#endregion
|
||||||
await _readingTableAnswerRowInfoRepository.DeleteFromQueryAsync(x => x.QuestionId == questionInfo.Id && x.VisitTaskId == taskinfo.Id);
|
await _readingTableAnswerRowInfoRepository.DeleteFromQueryAsync(x => x.QuestionId == questionInfo.Id && x.VisitTaskId == taskinfo.Id);
|
||||||
await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.QuestionId == questionInfo.Id && x.VisitTaskId == taskinfo.Id);
|
await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.QuestionId == questionInfo.Id && x.VisitTaskId == taskinfo.Id);
|
||||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
|
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
|
||||||
using DocumentFormat.OpenXml.Office.SpreadSheetML.Y2023.MsForms;
|
using DocumentFormat.OpenXml.Office.SpreadSheetML.Y2023.MsForms;
|
||||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||||
|
using IRaCIS.Core.Application.Interfaces;
|
||||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||||
using IRaCIS.Core.Application.ViewModel;
|
using IRaCIS.Core.Application.ViewModel;
|
||||||
using IRaCIS.Core.Domain.Models;
|
using IRaCIS.Core.Domain.Models;
|
||||||
|
|
@ -12,6 +13,7 @@ using MassTransit;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
{
|
{
|
||||||
|
|
@ -24,6 +26,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
IRepository<ReadingTableAnswerRowInfo> _readingTableAnswerRowInfoRepository,
|
IRepository<ReadingTableAnswerRowInfo> _readingTableAnswerRowInfoRepository,
|
||||||
IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository,
|
IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository,
|
||||||
IRepository<OrganInfo> _organInfoRepository,
|
IRepository<OrganInfo> _organInfoRepository,
|
||||||
|
ISubjectVisitService iSubjectVisitService,
|
||||||
|
IRepository<Dictionary> _dictionaryRepository,
|
||||||
IHttpContextAccessor httpContext,
|
IHttpContextAccessor httpContext,
|
||||||
IRepository<ReadingGlobalTaskInfo> _readingGlobalTaskInfoRepository,
|
IRepository<ReadingGlobalTaskInfo> _readingGlobalTaskInfoRepository,
|
||||||
IRepository<SubjectVisit> _subjectVisitRepository,
|
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||||
|
|
@ -271,10 +275,66 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
public async Task<FileResult> GetOCTFCTTemplate(GetExportTemplateInDto inDto)
|
public async Task<FileResult> GetOCTFCTTemplate(GetExportTemplateInDto inDto)
|
||||||
{
|
{
|
||||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.Subject).FirstNotNullAsync();
|
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.Subject).FirstNotNullAsync();
|
||||||
|
|
||||||
|
//靶段
|
||||||
|
var targetSegmentdic = await _dictionaryRepository.Where(x => x.Parent.Code == "TargetSegment").ToListAsync();
|
||||||
|
|
||||||
|
//斑块类型
|
||||||
|
var plaqueTypedic = await _dictionaryRepository.Where(x => x.Parent.Code == "PlaqueType").ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var awswerList = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).Include(x => x.ReadingQuestionTrial).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var targetSegmentAnswer = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.TargetSegment).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
|
||||||
|
if (targetSegmentAnswer.IsNotNullOrEmpty())
|
||||||
|
{
|
||||||
|
var data = JsonConvert.DeserializeObject<List<string>>(targetSegmentAnswer);
|
||||||
|
targetSegmentAnswer = string.Join(",", targetSegmentdic
|
||||||
|
.Where(x => data.Contains(x.Code))
|
||||||
|
.Select(x => x.ValueCN));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var targetSegmentData = await iSubjectVisitService.GetReadingVisitStudyList(new Contracts.GetReadingVisitStudyListIndto()
|
||||||
|
{
|
||||||
|
SujectVisitId = taskinfo.SourceSubjectVisitId ?? default(Guid),
|
||||||
|
TrialId = taskinfo.TrialId,
|
||||||
|
VisitTaskId = inDto.VisitTaskId
|
||||||
|
});
|
||||||
|
targetSegmentAnswer = string.Join(",", targetSegmentData
|
||||||
|
.Where(x => x.BodyPartForEdit.IsNotNullOrEmpty())
|
||||||
|
.Select(x => x.BodyPartForEdit));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var plaqueTypeAnswer = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.PlaqueType).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
|
||||||
|
if (plaqueTypeAnswer.IsNotNullOrEmpty())
|
||||||
|
{
|
||||||
|
var data = JsonConvert.DeserializeObject<List<string>>(plaqueTypeAnswer);
|
||||||
|
plaqueTypeAnswer = string.Join(",", plaqueTypedic
|
||||||
|
.Where(x => data.Contains(x.Code))
|
||||||
|
.Select(x => x.ValueCN));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var values = new TemplateData()
|
var values = new TemplateData()
|
||||||
{
|
{
|
||||||
SubjectID = (taskinfo.BlindSubjectCode.IsNullOrEmpty() ? taskinfo.Subject.Code : taskinfo.BlindSubjectCode),
|
SubjectID = (taskinfo.BlindSubjectCode.IsNullOrEmpty() ? taskinfo.Subject.Code : taskinfo.BlindSubjectCode),
|
||||||
TaskBlindName = taskinfo.TaskBlindName,
|
TaskBlindName = taskinfo.TaskBlindName,
|
||||||
|
TargetSegment = targetSegmentAnswer,
|
||||||
|
TargetSegmentRemarks = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.TargetSegmentRemarks).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
|
||||||
|
ROIAllLength = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.ROIAllLength).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
|
||||||
|
//PullbackFrameCount = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.PullbackFrameCount).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
|
||||||
|
PlaqueType = plaqueTypeAnswer,
|
||||||
|
AdjustReason = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.AdjustReason).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
return await _visitTaskHelpeService.ExportTemplateAsync(new IRaCIS.Application.Contracts.ExportTemplateAsyncDto()
|
return await _visitTaskHelpeService.ExportTemplateAsync(new IRaCIS.Application.Contracts.ExportTemplateAsyncDto()
|
||||||
{
|
{
|
||||||
|
|
@ -356,11 +416,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 3; i < dataTable.Rows.Count; i++)
|
for (int i = 8; i < dataTable.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// 手动抛出异常进入catch
|
// 手动抛出异常进入catch
|
||||||
if (!yesOrNo.ContainsKey(dataTable.Rows[i]["K"].ToString())|| !yesOrNo.ContainsKey(dataTable.Rows[i]["L"].ToString()))
|
if (!yesOrNo.ContainsKey(dataTable.Rows[i]["K"].ToString())|| !yesOrNo.ContainsKey(dataTable.Rows[i]["L"].ToString()))
|
||||||
{
|
{
|
||||||
|
|
@ -664,6 +725,91 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region 构造外层问题答案
|
||||||
|
List<ReadingTaskQuestionAnswer> questionAnswers = new List<ReadingTaskQuestionAnswer>();
|
||||||
|
|
||||||
|
var readingQuestionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId).ToListAsync();
|
||||||
|
var targetSegmentAnswer = dataTable.Rows[2]["B"].ToString();
|
||||||
|
|
||||||
|
if (targetSegmentAnswer.IsNotNullOrEmpty())
|
||||||
|
{
|
||||||
|
var targetSegmentValues = targetSegmentAnswer.Replace(",", ",").Split(",").ToList();
|
||||||
|
var targetSegmentdic = await _dictionaryRepository.Where(x => x.Parent.Code == "TargetSegment").ToListAsync();
|
||||||
|
targetSegmentAnswer = JsonConvert.SerializeObject(targetSegmentdic.Where(x => targetSegmentValues.Contains(x.ValueCN)).Select(x => x.Code).ToList());
|
||||||
|
}
|
||||||
|
|
||||||
|
questionAnswers.Add(new ReadingTaskQuestionAnswer()
|
||||||
|
{
|
||||||
|
Answer = targetSegmentAnswer ?? string.Empty,
|
||||||
|
ReadingQuestionCriterionTrialId = taskinfo.TrialReadingCriterionId,
|
||||||
|
ReadingQuestionTrialId = readingQuestionList.Where(x => x.QuestionType == QuestionType.TargetSegment).Select(x => x.Id).FirstOrDefault(),
|
||||||
|
TrialId = taskinfo.TrialId,
|
||||||
|
SubjectId = taskinfo.SubjectId,
|
||||||
|
VisitTaskId = taskinfo.Id,
|
||||||
|
});
|
||||||
|
|
||||||
|
questionAnswers.Add(new ReadingTaskQuestionAnswer()
|
||||||
|
{
|
||||||
|
Answer = dataTable.Rows[3]["B"].ToString() ?? string.Empty,
|
||||||
|
ReadingQuestionCriterionTrialId = taskinfo.TrialReadingCriterionId,
|
||||||
|
ReadingQuestionTrialId = readingQuestionList.Where(x => x.QuestionType == QuestionType.TargetSegmentRemarks).Select(x => x.Id).FirstOrDefault(),
|
||||||
|
TrialId = taskinfo.TrialId,
|
||||||
|
SubjectId = taskinfo.SubjectId,
|
||||||
|
VisitTaskId = taskinfo.Id,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
questionAnswers.Add(new ReadingTaskQuestionAnswer()
|
||||||
|
{
|
||||||
|
Answer = dataTable.Rows[4]["B"].ToString() ?? string.Empty,
|
||||||
|
ReadingQuestionCriterionTrialId = taskinfo.TrialReadingCriterionId,
|
||||||
|
ReadingQuestionTrialId = readingQuestionList.Where(x => x.QuestionType == QuestionType.ROIAllLength).Select(x => x.Id).FirstOrDefault(),
|
||||||
|
TrialId = taskinfo.TrialId,
|
||||||
|
SubjectId = taskinfo.SubjectId,
|
||||||
|
VisitTaskId = taskinfo.Id,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var plaqueTypeAnswer = dataTable.Rows[5]["B"].ToString();
|
||||||
|
|
||||||
|
if (plaqueTypeAnswer.IsNotNullOrEmpty())
|
||||||
|
{
|
||||||
|
var plaqueTypeAnswerValues = plaqueTypeAnswer.Replace(",", ",").Split(",").ToList();
|
||||||
|
var plaqueTypeAnswerdic = await _dictionaryRepository.Where(x => x.Parent.Code == "PlaqueType").ToListAsync();
|
||||||
|
plaqueTypeAnswer = JsonConvert.SerializeObject(plaqueTypeAnswerdic
|
||||||
|
.Where(x => plaqueTypeAnswerValues.Any(val => x.ValueCN.Contains(val)))
|
||||||
|
.Select(x => x.Code)
|
||||||
|
.ToList());
|
||||||
|
}
|
||||||
|
|
||||||
|
questionAnswers.Add(new ReadingTaskQuestionAnswer()
|
||||||
|
{
|
||||||
|
Answer = plaqueTypeAnswer ?? string.Empty,
|
||||||
|
ReadingQuestionCriterionTrialId = taskinfo.TrialReadingCriterionId,
|
||||||
|
ReadingQuestionTrialId = readingQuestionList.Where(x => x.QuestionType == QuestionType.PlaqueType).Select(x => x.Id).FirstOrDefault(),
|
||||||
|
TrialId = taskinfo.TrialId,
|
||||||
|
SubjectId = taskinfo.SubjectId,
|
||||||
|
VisitTaskId = taskinfo.Id,
|
||||||
|
});
|
||||||
|
|
||||||
|
questionAnswers.Add(new ReadingTaskQuestionAnswer()
|
||||||
|
{
|
||||||
|
Answer = dataTable.Rows[6]["B"].ToString() ?? string.Empty,
|
||||||
|
ReadingQuestionCriterionTrialId = taskinfo.TrialReadingCriterionId,
|
||||||
|
ReadingQuestionTrialId = readingQuestionList.Where(x => x.QuestionType == QuestionType.AdjustReason).Select(x => x.Id).FirstOrDefault(),
|
||||||
|
TrialId = taskinfo.TrialId,
|
||||||
|
SubjectId = taskinfo.SubjectId,
|
||||||
|
VisitTaskId = taskinfo.Id,
|
||||||
|
});
|
||||||
|
|
||||||
|
var questionids = questionAnswers.Select(x => x.ReadingQuestionTrialId).ToList();
|
||||||
|
await _readingTaskQuestionAnswerRepository.DeleteFromQueryAsync(x => x.VisitTaskId == taskinfo.Id && questionids.Contains(x.ReadingQuestionTrialId));
|
||||||
|
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||||
|
await _readingTaskQuestionAnswerRepository.AddRangeAsync(questionAnswers);
|
||||||
|
await _readingTaskQuestionAnswerRepository.SaveChangesAsync();
|
||||||
|
#endregion
|
||||||
|
|
||||||
await _readingTableAnswerRowInfoRepository.DeleteFromQueryAsync(x => x.QuestionId == questionInfo.Id && x.VisitTaskId == taskinfo.Id);
|
await _readingTableAnswerRowInfoRepository.DeleteFromQueryAsync(x => x.QuestionId == questionInfo.Id && x.VisitTaskId == taskinfo.Id);
|
||||||
await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.QuestionId == questionInfo.Id && x.VisitTaskId == taskinfo.Id);
|
await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.QuestionId == questionInfo.Id && x.VisitTaskId == taskinfo.Id);
|
||||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||||
|
|
|
||||||
|
|
@ -3060,6 +3060,11 @@ namespace IRaCIS.Core.Domain.Share
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ROIAllLength = 1015,
|
ROIAllLength = 1015,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 斑块类型
|
||||||
|
/// </summary>
|
||||||
|
PlaqueType=1018,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PAV(冠状动脉粥样硬化体积百分比)
|
/// PAV(冠状动脉粥样硬化体积百分比)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue