修改建议完成时间

Uat_Study
hang 2022-07-27 14:27:41 +08:00
parent 47390c4273
commit 1734d4d39d
7 changed files with 107 additions and 36 deletions

View File

@ -86,7 +86,7 @@
<PackageReference Include="MailKit" Version="3.2.0" />
<PackageReference Include="MediatR" Version="10.0.1" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="6.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.4">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.7">
<TreatAsUsed>true</TreatAsUsed>
</PackageReference>
<PackageReference Include="MimeKit" Version="3.2.0" />

View File

@ -323,7 +323,7 @@
</member>
<member name="M:IRaCIS.Core.Application.Service.Allocation.VisitTaskService.ReReadingTaskTrackingDeal(IRaCIS.Core.Domain.Models.VisitTask,IRaCIS.Core.Application.ViewModel.ConfirmReReadingCommand)">
<summary>
重阅原任务跟踪处理
重阅原任务跟踪处理 只会在同意的时候调用这个
</summary>
<param name="origenalTask"></param>
</member>

View File

@ -199,6 +199,9 @@ namespace IRaCIS.Core.Application.Service
task1.AllocateTime = DateTime.Now;
task2.AllocateTime = DateTime.Now;
task1.SuggesteFinishedTime = DateTime.Now.AddDays(7);
task2.SuggesteFinishedTime = DateTime.Now.AddDays(7);
#endregion
@ -224,6 +227,7 @@ namespace IRaCIS.Core.Application.Service
arm1.TaskAllocationState = TaskAllocationState.Allocated;
arm1.AllocateTime = DateTime.Now;
arm1.DoctorUserId = task1.DoctorUserId;
arm1.SuggesteFinishedTime = DateTime.Now.AddDays(7);
}
else
{
@ -264,6 +268,7 @@ namespace IRaCIS.Core.Application.Service
arm2.TaskAllocationState = TaskAllocationState.Allocated;
arm2.AllocateTime = DateTime.Now;
arm2.DoctorUserId = task2.DoctorUserId;
arm2.SuggesteFinishedTime = DateTime.Now.AddDays(7);
}
else
{
@ -325,6 +330,9 @@ namespace IRaCIS.Core.Application.Service
task1.AllocateTime = DateTime.Now;
task2.AllocateTime = DateTime.Now;
task1.SuggesteFinishedTime = DateTime.Now.AddDays(7);
task2.SuggesteFinishedTime = DateTime.Now.AddDays(7);
}
@ -429,6 +437,8 @@ namespace IRaCIS.Core.Application.Service
singleTask.AllocateTime = DateTime.Now;
singleTask.SuggesteFinishedTime = DateTime.Now.AddDays(7);
#endregion
@ -454,6 +464,7 @@ namespace IRaCIS.Core.Application.Service
arm.TaskAllocationState = TaskAllocationState.Allocated;
arm.AllocateTime = DateTime.Now;
arm.DoctorUserId = singleTask.DoctorUserId;
arm.SuggesteFinishedTime = DateTime.Now.AddDays(7);
}
else
{
@ -511,6 +522,8 @@ namespace IRaCIS.Core.Application.Service
singleTask.AllocateTime = DateTime.Now;
singleTask.SuggesteFinishedTime = DateTime.Now.AddDays(7);
}
#endregion
@ -627,6 +640,7 @@ namespace IRaCIS.Core.Application.Service
DoctorUserId = task.DoctorUserId,
TaskAllocationState = TaskAllocationState.Allocated,
AllocateTime = DateTime.Now,
SuggesteFinishedTime = DateTime.Now.AddDays(7),
SouceReadModuleId = task.SouceReadModuleId,
SourceSubjectVisitId = task.SourceSubjectVisitId,
@ -668,10 +682,11 @@ namespace IRaCIS.Core.Application.Service
SouceReadModuleId = task.SouceReadModuleId,
SourceSubjectVisitId = task.SourceSubjectVisitId,
DoctorUserId = task.DoctorUserId,
TaskAllocationState = TaskAllocationState.Allocated,
AllocateTime = DateTime.Now,
SuggesteFinishedTime= DateTime.Now.AddDays(7),
IsAnalysisCreate = true,
IsSelfAnalysis = false,

View File

@ -89,16 +89,25 @@ namespace IRaCIS.Core.Application.Service.Allocation
{
foreach (var doctorArm in command.DoctorArmList)
{
if(!await _subjectUserRepository.AnyAsync(t=>t.SubjectId == subjectId && t.DoctorUserId == doctorArm.DoctorUserId && t.ArmEnum == doctorArm.ArmEnum && t.IsConfirmed && t.OrignalSubjectUserId == null))
if (!await _subjectUserRepository.AnyAsync(t => t.SubjectId == subjectId && t.DoctorUserId == doctorArm.DoctorUserId && t.ArmEnum == doctorArm.ArmEnum && t.IsConfirmed && t.OrignalSubjectUserId == null))
{
await _subjectUserRepository.AddAsync(new SubjectUser() {TrialId=command.TrialId, ArmEnum = doctorArm.ArmEnum, DoctorUserId = doctorArm.DoctorUserId, SubjectId = subjectId, AssignTime = DateTime.Now });
await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = command.TrialId, ArmEnum = doctorArm.ArmEnum, DoctorUserId = doctorArm.DoctorUserId, SubjectId = subjectId, AssignTime = DateTime.Now });
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == subjectId && t.ArmEnum == doctorArm.ArmEnum && t.TrialId == command.TrialId && t.TaskAllocationState == TaskAllocationState.NotAllocate && t.TaskState == TaskState.Effect,
u => new VisitTask()
{
AllocateTime = DateTime.Now,
DoctorUserId = doctorArm.DoctorUserId,
TaskAllocationState = TaskAllocationState.Allocated,
SuggesteFinishedTime = /*t.IsUrgent ? DateTime.Now.AddDays(2) :*/ DateTime.Now.AddDays(7),
});
//task.SuggesteFinishedTime = task.IsUrgent ? DateTime.Now.AddDays(2) : DateTime.Now.AddDays(7);
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == subjectId && t.ArmEnum == doctorArm.ArmEnum && t.TrialId==command.TrialId && t.TaskAllocationState==TaskAllocationState.NotAllocate && t.TaskState==TaskState.Effect, u => new VisitTask()
{
AllocateTime = DateTime.Now,
DoctorUserId = doctorArm.DoctorUserId,
TaskAllocationState = TaskAllocationState.Allocated
});
}
}
@ -107,6 +116,9 @@ namespace IRaCIS.Core.Application.Service.Allocation
await _subjectUserRepository.SaveChangesAsync();
return ResponseOutput.Ok();
}
@ -150,18 +162,19 @@ namespace IRaCIS.Core.Application.Service.Allocation
{
foreach (var command in commandList.Where(t => t.IsCancelAssign))
{
if(await _visitTaskRepository.AnyAsync(t=>t.SubjectId==command.SubjectId && t.DoctorUserId==command.DoctorUserId && t.ArmEnum==command.ArmEnum && t.ReadingTaskState != ReadingTaskState.WaitReading))
if (await _visitTaskRepository.AnyAsync(t => t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum && t.ReadingTaskState != ReadingTaskState.WaitReading))
{
throw new BusinessValidationFailedException("当前医生已开始做该Subject的任务不允许取消分配");
}
await _subjectUserRepository.DeleteFromQueryAsync(t => t.Id == command.Id);
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum && t.ReadingTaskState==ReadingTaskState.WaitReading && t.TaskState==TaskState.Effect, u => new VisitTask()
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum && t.ReadingTaskState == ReadingTaskState.WaitReading && t.TaskState == TaskState.Effect, u => new VisitTask()
{
AllocateTime=null,
DoctorUserId=null,
TaskAllocationState=TaskAllocationState.NotAllocate
AllocateTime = null,
DoctorUserId = null,
TaskAllocationState = TaskAllocationState.NotAllocate,
SuggesteFinishedTime = null
});
}
@ -219,9 +232,13 @@ namespace IRaCIS.Core.Application.Service.Allocation
visitTask.DoctorUserId = assignSubjectTaskToDoctorCommand.DoctorUserId;
visitTask.TaskAllocationState = TaskAllocationState.Allocated;
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == visitTask.SourceSubjectVisitId, u => new SubjectVisit() { ReadingStatus = ReadingStatusEnum.ImageReading });
visitTask.SuggesteFinishedTime = DateTime.Now.AddDays(7);
await _readModuleRepository.BatchUpdateNoTrackingAsync(t => t.Id == visitTask.SouceReadModuleId, u => new ReadModule() { ReadingStatus = ReadingStatusEnum.ImageReading });
//await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == visitTask.SourceSubjectVisitId, u => new SubjectVisit() { ReadingStatus = ReadingStatusEnum.ImageReading });
//await _readModuleRepository.BatchUpdateNoTrackingAsync(t => t.Id == visitTask.SouceReadModuleId, u => new ReadModule() { ReadingStatus = ReadingStatusEnum.ImageReading });
}
else if (assignSubjectTaskToDoctorCommand.TaskOptType == TaskOptType.ReAssign)
@ -247,9 +264,9 @@ namespace IRaCIS.Core.Application.Service.Allocation
visitTask.DoctorUserId = null;
visitTask.TaskAllocationState = TaskAllocationState.NotAllocate;
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == visitTask.SourceSubjectVisitId, u => new SubjectVisit() { ReadingStatus = ReadingStatusEnum.TaskAllocate });
//await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == visitTask.SourceSubjectVisitId, u => new SubjectVisit() { ReadingStatus = ReadingStatusEnum.TaskAllocate });
await _readModuleRepository.BatchUpdateNoTrackingAsync(t => t.Id == visitTask.SouceReadModuleId, u => new ReadModule() { ReadingStatus = ReadingStatusEnum.TaskAllocate });
//await _readModuleRepository.BatchUpdateNoTrackingAsync(t => t.Id == visitTask.SouceReadModuleId, u => new ReadModule() { ReadingStatus = ReadingStatusEnum.TaskAllocate });
}
await _visitTaskRepository.SaveChangesAsync();
return ResponseOutput.Ok();
@ -1262,7 +1279,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
/// <summary>
/// 重阅原任务跟踪处理
/// 重阅原任务跟踪处理 只会在同意的时候调用这个
/// </summary>
/// <param name="origenalTask"></param>
private void ReReadingTaskTrackingDeal(VisitTask origenalTask, ConfirmReReadingCommand agreeReReadingCommand)
@ -1655,20 +1672,36 @@ namespace IRaCIS.Core.Application.Service.Allocation
newTask.DoctorUserId = origenalTask.DoctorUserId;
newTask.TaskAllocationState = TaskAllocationState.Allocated;
newTask.AllocateTime = DateTime.Now;
newTask.SuggesteFinishedTime = DateTime.Now.AddDays(7);
//拷贝表单
if (visitTaskReReadingAppply.IsCopyFollowForms)
if (visitTaskReReadingAppply.IsCopyOrigenalForms)
{
var list = _readingTaskQuestionAnswerRepository.Where(t => t.VisitTaskId == influenceTask.Id).ToList();
foreach (var item in list)
if (origenalTask.ReadingCategory == ReadingCategory.Visit)
{
item.Id = Guid.Empty;
item.VisitTaskId = newTask.Id;
var list = _readingTaskQuestionAnswerRepository.Where(t => t.VisitTaskId == origenalTask.Id).ToList();
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;
}
_ = _readingTaskQuestionAnswerRepository.AddRangeAsync(list).Result;
}
@ -1781,6 +1814,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
newTask.DoctorUserId = origenalTask.DoctorUserId;
newTask.TaskAllocationState = TaskAllocationState.Allocated;
newTask.AllocateTime = DateTime.Now;
newTask.SuggesteFinishedTime = DateTime.Now.AddDays(7);
//拷贝表单
if (visitTaskReReadingAppply.IsCopyOrigenalForms)
@ -1799,7 +1833,15 @@ namespace IRaCIS.Core.Application.Service.Allocation
}
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;
}
@ -1818,11 +1860,19 @@ namespace IRaCIS.Core.Application.Service.Allocation
}
}
else if (agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Reject)
{
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.Id == origenalTask.Id, u => new VisitTask()
{
ReReadingApplyState = ReReadingApplyState.Reject
});
}
}
await _visitTaskRepository.SaveChangesAsync();
return ResponseOutput.Ok();

View File

@ -47,9 +47,12 @@ namespace IRaCIS.Application.Services
//var needAddVisitList = await _repository.Where<VisitTask>(t => t.TrialId == Guid.Empty).DistinctBy(t => t.VisitTaskNum).ToListAsync();
await _repository.BatchUpdateAsync<TaskInfluence>(t => t.InfluenceTask.TaskState == Core.Domain.Share.TaskState.HaveReturned, u => new TaskInfluence() { OptType = ReReadingOrBackOptType.Return });
await _repository.BatchUpdateAsync<TaskInfluence>(t => t.InfluenceTask.TaskState == Core.Domain.Share.TaskState.Adbandon, u => new TaskInfluence() { OptType = ReReadingOrBackOptType.Abandon });
await _repository.BatchUpdateAsync<VisitTask>(t => t.Id==Guid.Empty, u => new VisitTask() {
SuggesteFinishedTime = u.IsUrgent ? DateTime.Now.AddDays(2) : DateTime.Now.AddDays(7),
Code = u.Code+1
});
return _userInfo.LocalIp;
}

View File

@ -17,9 +17,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="EFCore.BulkExtensions" Version="6.4.4" />
<PackageReference Include="EFCore.BulkExtensions" Version="6.5.5" />
<PackageReference Include="EntityFrameworkCore.Exceptions.SqlServer" Version="6.0.3" />
<PackageReference Include="EntityFrameworkCore.Triggered" Version="3.0.0" />
<PackageReference Include="EntityFrameworkCore.Triggered" Version="3.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />

View File

@ -12,6 +12,7 @@ using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using IRaCIS.Core.Domain.Share;
using EFCore.BulkExtensions;
namespace IRaCIS.Core.Infra.EFCore
{
@ -412,7 +413,9 @@ namespace IRaCIS.Core.Infra.EFCore
{
return await _dbContext.BatchUpdateNoTrackingAsync(whereFilter, updateFactory, _userInfo.Id);
//return await _dbContext.Set<T>().IgnoreQueryFilters().Where(whereFilter).BatchUpdateAsync(updateFactory).ConfigureAwait(false) > 0;
}