修改任务

This commit is contained in:
2022-07-04 16:29:29 +08:00
parent b27549c216
commit 9b0872bab2
8 changed files with 57 additions and 19 deletions
@@ -6,6 +6,8 @@
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace IRaCIS.Core.Application.ViewModel
{
/// <summary> TaskConsistentRuleView 列表视图模型 </summary>
@@ -91,6 +93,9 @@ namespace IRaCIS.Core.Application.ViewModel
public String TrialSiteCode { get; set; } = String.Empty;
public string SubjectCode { get; set; } = String.Empty;
[JsonIgnore]
public Guid? DoctorUserId { get; set; }
}
@@ -22,6 +22,8 @@ namespace IRaCIS.Core.Application.ViewModel
public string TaskName { get; set; }
public string TaskBlindName { get; set; }
public decimal VisitTaskNum { get; set; }
public ReadingCategory ReadingCategory { get; set; }
public TaskAllocationState TaskAllocationState { get; set; }
@@ -175,9 +175,9 @@ namespace IRaCIS.Core.Application.Service
var group = _visitTaskRepository.Where(t => t.TrialId == filterObj.TrialId && inCommand.SubejctIdList.Contains(t.SubjectId))
// 自身一致性分析
.WhereIf(isSelfAnalysis, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId)
.WhereIf(isSelfAnalysis, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId)
// 组内一致性分析
.WhereIf(isSelfAnalysis == false, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId && subjectfilter.Contains(t.SubjectId))
.WhereIf(isSelfAnalysis == false, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId && subjectfilter.Contains(t.SubjectId))
.Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect)
.Where(t => t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7 + 1) > DateTime.Now)
//重阅产生的访视任务 要把之前的访视任务去除
@@ -185,8 +185,8 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(filterObj.IsHaveReadingPeriod == false, t => t.ReadingCategory == ReadingCategory.Visit)
.WhereIf(filterObj.IsHaveReadingPeriod == true, t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global)
.GroupBy(t => t.SubjectId)
.Where(g => g.Count() > filterObj.PlanVisitCount);
.GroupBy(t => t.SubjectId)
.Where(g => g.Count() > filterObj.PlanVisitCount);
var query = group.Select(g => new DoctorConsistentRuleSubjectView()
@@ -218,7 +218,7 @@ namespace IRaCIS.Core.Application.Service
foreach (var subject in list)
{
subject.VisitTaskList.ForEach(t => t.DoctorUserId = doctorUserId);
await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand()
@@ -237,7 +237,6 @@ namespace IRaCIS.Core.Application.Service
/// <summary>
/// 一致性分配 配置+ 统计已经生成数量统计表
/// </summary>
@@ -374,6 +374,12 @@ namespace IRaCIS.Core.Application.Service
TaskState = TaskState.Effect,
Code = currentMaxCodeInt + 1,
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
DoctorUserId = task.DoctorUserId,
TaskAllocationState = TaskAllocationState.Allocated,
AllocateTime = DateTime.Now,
};
await _visitTaskRepository.AddAsync(consistentTask);
@@ -407,7 +413,7 @@ namespace IRaCIS.Core.Application.Service
TaskState = TaskState.Effect,
DoctorUserId = subjectUser==null ? null : subjectUser.Id,
TaskAllocationState = subjectUser == null? TaskAllocationState.NotAllocate: TaskAllocationState.Allocated,
AllocateTime = DateTime.Now,
AllocateTime = subjectUser == null ?null: DateTime.Now,
};
await _visitTaskRepository.AddAsync(visitTask);
currentMaxCodeInt = currentMaxCodeInt + 1;
@@ -199,7 +199,7 @@ namespace IRaCIS.Core.Application.Service
}
@@ -950,7 +950,7 @@ namespace IRaCIS.Core.Application.Service
OriginalReReadingTaskId = task.Id,
RequestReReadingTime = DateTime.Now,
RequestReReadingUserId = _userInfo.Id,
IsCopyOrigenalForms= applyReReadingCommand.IsCopyOrigenalForms,
IsCopyOrigenalForms = applyReReadingCommand.IsCopyOrigenalForms,
RequestReReadingReason = applyReReadingCommand.RequestReReadingReason,
RequestReReadingType = applyReReadingCommand.RequestReReadingType,
@@ -979,14 +979,6 @@ namespace IRaCIS.Core.Application.Service
foreach (var item in agreeReReadingCommand.ConfirmReReadingList)
{
//await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.Id == item.OriginalReReadingTaskId, u => new VisitTask()
//{
// ReReadingApplyState = (agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? ReReadingApplyState.Agree : ReReadingApplyState.Reject),
// TaskState = (agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? TaskState.HaveReturned : TaskState.Effect)
//});
var origenalTask = (await _visitTaskRepository.Where(t => item.OriginalReReadingTaskId == t.Id, true).FirstOrDefaultAsync()).IfNullThrowException();
//更新原始任务
@@ -1064,6 +1056,22 @@ namespace IRaCIS.Core.Application.Service
/// <summary>
/// 重阅影响提示列表
/// </summary>
/// <param name="taskId"></param>
/// <returns></returns>
[HttpGet("{taskId:guid}")]
public async Task<List<VisitTaskSimpleView>> GetReReadingInfluenceTaskList(Guid taskId)
{
var filterObj = await _visitTaskRepository.FirstOrDefaultNoTrackingAsync(t => t.Id == taskId);
var list = await _visitTaskRepository.Where(t => t.TrialId == filterObj.TrialId && t.SubjectId == filterObj.SubjectId && t.VisitTaskNum >= filterObj.VisitTaskNum)
.Where(t => t.TaskState == TaskState.Effect && ! t.IsAnalysisCreate)
.ProjectTo<VisitTaskSimpleView>(_mapper.ConfigurationProvider).ToListAsync();
return list;
}
}
@@ -220,6 +220,13 @@ namespace IRaCIS.Core.Application.Service
CreateMap<TaskConsistentRuleAddOrEdit, TaskConsistentRule>();
CreateMap<VisitTask, VisitTaskSimpleView>()
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.Subject.TrialSite.TrialSiteCode))
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code));
}
}