访视回退拷贝表单
parent
086ca46218
commit
d36e3c0d91
|
@ -21,6 +21,7 @@ using System.Linq;
|
|||
using DocumentFormat.OpenXml.Bibliography;
|
||||
using Org.BouncyCastle.Crypto;
|
||||
using IRaCIS.Core.Domain.Share.Reading;
|
||||
using MassTransit;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.Allocation
|
||||
{
|
||||
|
@ -1976,30 +1977,10 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|||
{
|
||||
if (origenalTask.ReadingCategory == ReadingCategory.Visit)
|
||||
{
|
||||
var list = _readingTaskQuestionAnswerRepository.Where(t => t.VisitTaskId == origenalTask.Id).ToList();
|
||||
CopyForms(newTask, origenalTask);
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
item.Id = Guid.Empty;
|
||||
item.VisitTaskId = newTask.Id;
|
||||
}
|
||||
|
||||
_ = _readingTaskQuestionAnswerRepository.AddRangeAsync(list).Result;
|
||||
}
|
||||
//else if (origenalTask.ReadingCategory == ReadingCategory.Global)
|
||||
//{
|
||||
// var list = _repository.Where<ReadingGlobalTaskInfo>(t => t.GlobalTaskId == origenalTask.Id).ToList();
|
||||
|
||||
// foreach (var item in list)
|
||||
// {
|
||||
// item.Id = Guid.Empty;
|
||||
// item.GlobalTaskId = newTask.Id;
|
||||
// }
|
||||
|
||||
// _ = _repository.AddRangeAsync(list).Result;
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//拷贝后续表单
|
||||
|
@ -2007,28 +1988,10 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|||
{
|
||||
if (origenalTask.ReadingCategory == ReadingCategory.Visit)
|
||||
{
|
||||
var list = _readingTaskQuestionAnswerRepository.Where(t => t.VisitTaskId == origenalTask.Id).ToList();
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
item.Id = Guid.Empty;
|
||||
item.VisitTaskId = newTask.Id;
|
||||
CopyForms(newTask, origenalTask);
|
||||
}
|
||||
|
||||
_ = _readingTaskQuestionAnswerRepository.AddRangeAsync(list).Result;
|
||||
}
|
||||
//else if (origenalTask.ReadingCategory == ReadingCategory.Global)
|
||||
//{
|
||||
// var list = _repository.Where<ReadingGlobalTaskInfo>(t => t.GlobalTaskId == origenalTask.Id).ToList();
|
||||
|
||||
// foreach (var item in list)
|
||||
// {
|
||||
// item.Id = Guid.Empty;
|
||||
// item.GlobalTaskId = newTask.Id;
|
||||
// }
|
||||
|
||||
// _ = _repository.AddRangeAsync(list).Result;
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2124,15 +2087,8 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|||
{
|
||||
if (origenalTask.ReadingCategory == ReadingCategory.Visit)
|
||||
{
|
||||
var list = _readingTaskQuestionAnswerRepository.Where(t => t.VisitTaskId == origenalTask.Id).ToList();
|
||||
CopyForms(newTask, origenalTask);
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
item.Id = Guid.Empty;
|
||||
item.VisitTaskId = newTask.Id;
|
||||
}
|
||||
|
||||
_ = _readingTaskQuestionAnswerRepository.AddRangeAsync(list).Result;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2142,15 +2098,8 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|||
{
|
||||
if (origenalTask.ReadingCategory == ReadingCategory.Visit)
|
||||
{
|
||||
var list = _readingTaskQuestionAnswerRepository.Where(t => t.VisitTaskId == origenalTask.Id).ToList();
|
||||
CopyForms(newTask, origenalTask);
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
item.Id = Guid.Empty;
|
||||
item.VisitTaskId = newTask.Id;
|
||||
}
|
||||
|
||||
_ = _readingTaskQuestionAnswerRepository.AddRangeAsync(list).Result;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2209,6 +2158,74 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
private void CopyForms(VisitTask newTask, VisitTask origenalTask)
|
||||
{
|
||||
|
||||
//自定义
|
||||
var readingCustomTagList = _repository.Where<ReadingCustomTag>(t => t.VisitTaskId == origenalTask.Id).ToList();
|
||||
|
||||
foreach (var item in readingCustomTagList)
|
||||
{
|
||||
item.Id = Guid.Empty;
|
||||
item.VisitTaskId = newTask.Id;
|
||||
}
|
||||
|
||||
_ = _repository.AddRangeAsync(readingCustomTagList).Result;
|
||||
|
||||
|
||||
var readingTaskQuestionMarkList = _repository.Where<ReadingTaskQuestionMark>(t => t.VisitTaskId == origenalTask.Id).ToList();
|
||||
|
||||
foreach (var item in readingTaskQuestionMarkList)
|
||||
{
|
||||
item.Id = Guid.Empty;
|
||||
item.VisitTaskId = newTask.Id;
|
||||
}
|
||||
|
||||
_ = _repository.AddRangeAsync(readingTaskQuestionMarkList).Result;
|
||||
|
||||
var readingTaskQuestionAnswerList = _repository.Where<ReadingTaskQuestionAnswer>(t => t.VisitTaskId == origenalTask.Id).ToList();
|
||||
|
||||
foreach (var item in readingTaskQuestionAnswerList)
|
||||
{
|
||||
item.Id = Guid.Empty;
|
||||
item.VisitTaskId = newTask.Id;
|
||||
}
|
||||
_ = _repository.AddRangeAsync(readingTaskQuestionAnswerList).Result;
|
||||
|
||||
|
||||
|
||||
//ReadingTableAnswerRowInfo ReadingTableQuestionAnswer 一起加
|
||||
var readingTableAnswerRowInfoList = _repository.Where<ReadingTableAnswerRowInfo>(t => t.VisitTaskId == origenalTask.Id).Include(t => t.LesionAnswerList).ToList();
|
||||
|
||||
foreach (var item in readingTableAnswerRowInfoList)
|
||||
{
|
||||
item.Id = NewId.NextSequentialGuid();
|
||||
item.VisitTaskId = newTask.Id;
|
||||
|
||||
foreach (var item2 in item.LesionAnswerList)
|
||||
{
|
||||
item2.Id = Guid.Empty;
|
||||
item2.RowId = item.Id;
|
||||
item2.VisitTaskId = newTask.Id;
|
||||
}
|
||||
}
|
||||
|
||||
_ = _repository.AddRangeAsync(readingTableAnswerRowInfoList).Result;
|
||||
|
||||
|
||||
//var readingTableQuestionAnswerList = _repository.Where<ReadingTableQuestionAnswer>(t => t.VisitTaskId == origenalTask.Id).ToList();
|
||||
|
||||
//foreach (var item in readingTableQuestionAnswerList)
|
||||
//{
|
||||
// item.Id = Guid.Empty;
|
||||
// item.VisitTaskId = newTask.Id;
|
||||
//}
|
||||
|
||||
//_ = _repository.AddRangeAsync(readingTableQuestionAnswerList).Result;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// PM 设置任务 退回
|
||||
|
@ -2590,8 +2607,6 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|||
var filterObj = (await _visitTaskRepository.FirstOrDefaultNoTrackingAsync(t => t.Id == taskId)).IfNullThrowException();
|
||||
var trialId = filterObj.TrialId;
|
||||
|
||||
//var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.IsReadingTaskViewInOrder, t.ReadingType }).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
var criterionConfig = (await _trialReadingCriterionRepository.Where(x => x.Id == filterObj.TrialReadingCriterionId).Select(x => new { x.ReadingTool, x.CriterionType, x.IsAdditionalAssessment, x.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
Expression<Func<VisitTask, bool>> filterExpression = t => t.TrialId == trialId && t.SubjectId == filterObj.SubjectId && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze) && t.TaskAllocationState == TaskAllocationState.Allocated;
|
||||
|
|
Loading…
Reference in New Issue