一致性分析
parent
f7963eebd8
commit
9b2d431fa8
|
@ -152,6 +152,8 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
//public ReReadingApplyGenerateTaskCommand ReReadingApplyGenerateTaskCommand { get; set; } = new ReReadingApplyGenerateTaskCommand();
|
||||
|
||||
public List<VisitTaskSimpleView> GenerataConsistentTaskList { get; set; }
|
||||
|
||||
}
|
||||
|
||||
//public class ReReadingApplyGenerateTaskCommand
|
||||
|
|
|
@ -9,7 +9,7 @@ using System.Collections.Generic;
|
|||
namespace IRaCIS.Core.Application.ViewModel
|
||||
{
|
||||
/// <summary> TaskConsistentRuleView 列表视图模型 </summary>
|
||||
public class TaskConsistentRuleView: TaskConsistentRuleAddOrEdit
|
||||
public class TaskConsistentRuleView : TaskConsistentRuleAddOrEdit
|
||||
{
|
||||
public Guid CreateUserId { get; set; }
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
@ -20,6 +20,96 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
public UserSimpleInfo CompareDoctorUser { get; set; }
|
||||
|
||||
|
||||
public int? GeneratedSubjectCount { get; set; }
|
||||
|
||||
public int? GeneratedVisitCount { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class ConsistentQuery : PageInput
|
||||
{
|
||||
|
||||
public Guid TaskConsistentRuleId { get; set; }
|
||||
|
||||
//public int PlanSubjectCount { get; set; }
|
||||
//public int PlanVisitCount { get; set; }
|
||||
//public int IntervalWeeks { get; set; }
|
||||
//public Guid? CompareDoctorUserId { get; set; }
|
||||
//public bool IsHaveReadingPeriod { get; set; }
|
||||
//public bool IsGenerateGlobalTask { get; set; }
|
||||
//public Guid? AnalysisDoctorUserId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class ConsistentConfirmGenerateCommand
|
||||
{
|
||||
public Guid TaskConsistentRuleId { get; set; }
|
||||
|
||||
public List<Guid> SubejctIdList { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class DoctorConsistentRuleSubjectView
|
||||
{
|
||||
public Guid TrialId => VisitTaskList.Select(t => t.TrialId).First();
|
||||
public Guid SiteId => VisitTaskList.Select(t => t.SiteId).First();
|
||||
|
||||
public String TrialSiteCode => VisitTaskList.Select(t => t.TrialSiteCode).First();
|
||||
public string SubjectCode => VisitTaskList.Select(t => t.TrialSiteCode).First();
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
public bool IsHaveCreatedTask { get; set; }
|
||||
public int? ValidTaskCount { get; set; }
|
||||
|
||||
public int? ValidVisitCount => VisitTaskList.Select(t => t.TaskName).Distinct().Count();
|
||||
|
||||
public List<VisitTaskSimpleView> VisitTaskList { get; set; }
|
||||
}
|
||||
|
||||
public class VisitTaskSimpleView
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
public Arm ArmEnum { get; set; }
|
||||
public string TaskCode { get; set; }
|
||||
|
||||
public string TaskName { get; set; }
|
||||
public string TaskBlindName { get; set; }
|
||||
|
||||
public decimal VisitTaskNum { get; set; }
|
||||
|
||||
public ReadingCategory ReadingCategory { get; set; }
|
||||
|
||||
public TaskState TaskState { get; set; }
|
||||
|
||||
public String TrialSiteCode { get; set; } = String.Empty;
|
||||
public string SubjectCode { get; set; } = String.Empty;
|
||||
}
|
||||
|
||||
|
||||
public class SelfConsistentView
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
|
||||
public String TrialSiteCode => VisitTaskList.Select(t => t.TrialSiteCode).First();
|
||||
public string SubjectCode => VisitTaskList.Select(t => t.TrialSiteCode).First();
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
|
||||
public int? VisitValidTaskCount { get; set; }
|
||||
|
||||
public int? VisitValidCount => VisitTaskList.Select(t => t.TaskName).Distinct().Count();
|
||||
|
||||
public List<VisitTaskSimpleView> VisitTaskList { get; set; }
|
||||
}
|
||||
|
||||
///<summary>TaskConsistentRuleQuery 列表查询参数模型</summary>
|
||||
|
@ -35,7 +125,6 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
public class TaskConsistentRuleAddOrEdit
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
public Guid AnalysisDoctorUserId { get; set; }
|
||||
public bool IsEnable { get; set; }
|
||||
public string Note { get; set; }
|
||||
public Guid TrialId { get; set; }
|
||||
|
@ -45,6 +134,8 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
public Guid? CompareDoctorUserId { get; set; }
|
||||
public bool IsHaveReadingPeriod { get; set; }
|
||||
public bool IsGenerateGlobalTask { get; set; }
|
||||
public Guid AnalysisDoctorUserId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -221,66 +221,11 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
}
|
||||
|
||||
|
||||
public class SelfConsistentQuery
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public Guid AnalysisDoctorUserId { get; set; }
|
||||
|
||||
public Guid? CompareDoctorUserId { get; set; }
|
||||
|
||||
public int IntervalWeeks { get; set; }
|
||||
|
||||
public bool IsHaveReadingPeriod { get; set; }
|
||||
|
||||
public Guid? SiteId { get; set; }
|
||||
|
||||
public int? VisitCount { get; set; }
|
||||
|
||||
public Guid? SubjectId { get; set; }
|
||||
|
||||
|
||||
|
||||
//public int? SubjectCount { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class SelfConsistentView
|
||||
{
|
||||
//public Guid TrialId { get; set; }
|
||||
//public Guid SiteId { get; set; }
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
public String TrialSiteCode => VisitTaskList.Select(t=>t.TrialSiteCode).First();
|
||||
public string SubjectCode => VisitTaskList.Select(t => t.TrialSiteCode).First();
|
||||
|
||||
public int? VisitValidTaskCount { get; set; }
|
||||
|
||||
public int? VisitValidCount => VisitTaskList.Select(t=>t.TaskName).Distinct().Count();
|
||||
|
||||
public List<VisitTaskSimpleView> VisitTaskList { get; set; }
|
||||
}
|
||||
|
||||
public class VisitTaskSimpleView
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
public Guid? TrialId { get; set; }
|
||||
|
||||
public Guid? SubjectId { get; set; }
|
||||
|
||||
public Arm? ArmEnum { get; set; }
|
||||
public string? TaskCode { get; set; }
|
||||
|
||||
public string? TaskName { get; set; }
|
||||
public string? TaskBlindName { get; set; }
|
||||
|
||||
public ReadingCategory? ReadingCategory { get; set; }
|
||||
|
||||
public TaskState? TaskState { get; set; }
|
||||
|
||||
public String? TrialSiteCode { get; set; } = String.Empty;
|
||||
public string? SubjectCode { get; set; } = String.Empty;
|
||||
}
|
||||
|
||||
|
||||
public class IRUnReadSubjectQuery : PageInput
|
||||
|
|
|
@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
@ -28,6 +29,186 @@ namespace IRaCIS.Core.Application.Service
|
|||
_visitTaskRepository = visitTaskRepository;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 一致性分析列表 (自身 组内 最后勾选 产生的任务)
|
||||
/// </summary>
|
||||
/// <param name="queryVisitTask"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<ReadingTaskView>> GetAnalysisTaskList(VisitTaskQuery queryVisitTask)
|
||||
{
|
||||
var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == queryVisitTask.TrialId)
|
||||
.Where(t => t.IsAnalysisCreate)
|
||||
|
||||
.WhereIf(queryVisitTask.SiteId != null, t => t.Subject.SiteId == queryVisitTask.SiteId)
|
||||
.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId)
|
||||
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
|
||||
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId)
|
||||
.WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory)
|
||||
.WhereIf(queryVisitTask.ReadingTaskState != null, t => t.ReadingTaskState == queryVisitTask.ReadingTaskState)
|
||||
.WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState)
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName))
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.Subject.Code.Contains(queryVisitTask.SubjectCode))
|
||||
.WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate)
|
||||
.WhereIf(queryVisitTask.EndAllocateDate != null, t => t.AllocateTime < queryVisitTask.EndAllocateDate.Value.AddDays(1))
|
||||
.ProjectTo<ReadingTaskView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var defalutSortArray = new string[] { nameof(VisitTask.IsUrgent) + " desc", nameof(VisitTask.SubjectId) };
|
||||
|
||||
var pageList = await visitTaskQueryable.ToPagedListAsync(queryVisitTask.PageIndex, queryVisitTask.PageSize, queryVisitTask.SortField, queryVisitTask.Asc, string.IsNullOrWhiteSpace(queryVisitTask.SortField), defalutSortArray);
|
||||
|
||||
return (pageList);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 为一致性分析医生,选择Subejct 列表
|
||||
/// </summary>
|
||||
/// <param name="inQuery"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<DoctorConsistentRuleSubjectView>> GetDoctorConsistentRuleSubjectList(ConsistentQuery inQuery)
|
||||
{
|
||||
var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == inQuery.TaskConsistentRuleId);
|
||||
|
||||
var doctorUserId = filterObj.CompareDoctorUserId == null ? filterObj.AnalysisDoctorUserId : filterObj.CompareDoctorUserId;
|
||||
|
||||
var group = _visitTaskRepository.Where(t => t.TrialId == filterObj.TrialId)
|
||||
.WhereIf(filterObj.CompareDoctorUserId == null, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId)
|
||||
.WhereIf(filterObj.CompareDoctorUserId != null, t => t.DoctorUserId == filterObj.CompareDoctorUserId)
|
||||
.Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect)
|
||||
.Where(t => t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7 + 1) > DateTime.Now)
|
||||
//重阅产生的访视任务 要把之前的访视任务去除
|
||||
.Where(t => t.ReReadingApplyState != ReReadingApplyState.Agree)
|
||||
|
||||
.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);
|
||||
|
||||
var query = group.Select(g => new DoctorConsistentRuleSubjectView()
|
||||
{
|
||||
SubjectId = g.Key,
|
||||
|
||||
IsHaveCreatedTask = g.Any(t => t.IsAnalysisCreate && t.SubjectId == g.Key && t.DoctorUserId == doctorUserId),
|
||||
|
||||
VisitTaskList = g.Where(t => t.IsAnalysisCreate == false).OrderBy(t => t.VisitTaskNum).Select(c => new VisitTaskSimpleView()
|
||||
{
|
||||
Id = c.Id,
|
||||
ReadingCategory = c.ReadingCategory,
|
||||
TaskBlindName = c.TaskBlindName,
|
||||
TaskCode = c.TaskCode,
|
||||
TaskName = c.TaskName,
|
||||
TaskState = c.TaskState,
|
||||
ArmEnum = c.ArmEnum,
|
||||
SubjectId = c.SubjectId,
|
||||
TrialId = c.TrialId,
|
||||
SubjectCode = c.Subject.Code,
|
||||
TrialSiteCode = c.Subject.TrialSite.TrialSiteCode,
|
||||
}).ToList(),
|
||||
|
||||
ValidTaskCount = g.Count()
|
||||
|
||||
});
|
||||
|
||||
var count = group.Count();
|
||||
|
||||
query = query.OrderByDescending(t => t.IsHaveCreatedTask).Skip((inQuery.PageIndex - 1) * inQuery.PageSize);
|
||||
var items = await query.Take(inQuery.PageSize).ToArrayAsync().ConfigureAwait(false);
|
||||
|
||||
var pagedList = new PageOutput<DoctorConsistentRuleSubjectView>()
|
||||
{
|
||||
PageIndex = inQuery.PageIndex,
|
||||
PageSize = inQuery.PageSize,
|
||||
TotalCount = count,
|
||||
CurrentPageData = items
|
||||
};
|
||||
|
||||
|
||||
return pagedList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 确认生成一致性分析任务
|
||||
/// </summary>
|
||||
/// <param name="inCommand"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> ConfirmGenerateConsistentTask(ConsistentConfirmGenerateCommand inCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService)
|
||||
{
|
||||
var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == inCommand.TaskConsistentRuleId);
|
||||
|
||||
var doctorUserId = filterObj.CompareDoctorUserId == null ? filterObj.AnalysisDoctorUserId : filterObj.CompareDoctorUserId;
|
||||
|
||||
|
||||
|
||||
var group = _visitTaskRepository.Where(t => t.TrialId == filterObj.TrialId && inCommand.SubejctIdList.Contains(t.SubjectId))
|
||||
.WhereIf(filterObj.CompareDoctorUserId == null, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId)
|
||||
.WhereIf(filterObj.CompareDoctorUserId != null, t => t.DoctorUserId == filterObj.CompareDoctorUserId)
|
||||
.Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect)
|
||||
.Where(t => t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7 + 1) > DateTime.Now)
|
||||
//重阅产生的访视任务 要把之前的访视任务去除
|
||||
.Where(t => t.ReReadingApplyState != ReReadingApplyState.Agree)
|
||||
|
||||
.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);
|
||||
|
||||
|
||||
var query = group.Select(g => new DoctorConsistentRuleSubjectView()
|
||||
{
|
||||
SubjectId = g.Key,
|
||||
|
||||
IsHaveCreatedTask = g.Any(t => t.IsAnalysisCreate && t.SubjectId == g.Key && t.DoctorUserId == doctorUserId),
|
||||
|
||||
VisitTaskList = g.Where(t => t.IsAnalysisCreate == false).OrderBy(t => t.VisitTaskNum).Select(c => new VisitTaskSimpleView()
|
||||
{
|
||||
Id = c.Id,
|
||||
ReadingCategory = c.ReadingCategory,
|
||||
TaskBlindName = c.TaskBlindName,
|
||||
TaskCode = c.TaskCode,
|
||||
TaskName = c.TaskName,
|
||||
TaskState = c.TaskState,
|
||||
ArmEnum = c.ArmEnum,
|
||||
SubjectId = c.SubjectId,
|
||||
TrialId = c.TrialId,
|
||||
SubjectCode = c.Subject.Code,
|
||||
TrialSiteCode = c.Subject.TrialSite.TrialSiteCode,
|
||||
}).Take(filterObj.PlanVisitCount).ToList(),
|
||||
|
||||
ValidTaskCount = g.Count()
|
||||
|
||||
});
|
||||
|
||||
var list = query.ToList();
|
||||
|
||||
foreach (var subject in list)
|
||||
{
|
||||
|
||||
await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand()
|
||||
{
|
||||
ReadingCategory = ReadingCategory.Consistent,
|
||||
GenerataConsistentTaskList = subject.VisitTaskList
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 一致性分配 配置+ 统计已经生成数量统计表
|
||||
/// </summary>
|
||||
/// <param name="inQuery"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<List<TaskConsistentRuleView>> GetTaskConsistentRuleList(TaskConsistentRuleQuery inQuery)
|
||||
{
|
||||
|
@ -41,6 +222,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public async Task<IResponseOutput> AddOrUpdateTaskConsistentRule(TaskConsistentRuleAddOrEdit addOrEditTaskConsistentRule)
|
||||
{
|
||||
|
||||
|
@ -85,5 +269,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,12 @@ namespace IRaCIS.Core.Application.Service
|
|||
[HttpDelete("{taskMedicalReviewRuleId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteTaskMedicalReviewRule(Guid taskMedicalReviewRuleId)
|
||||
{
|
||||
|
||||
if(await _taskMedicalReviewRuleRepository.Where(t=>t.Id== taskMedicalReviewRuleId).AnyAsync(t => t.TaskMedicalReviewList.Any()))
|
||||
{
|
||||
return ResponseOutput.NotOk("已产生医学审核任务");
|
||||
}
|
||||
|
||||
var success = await _taskMedicalReviewRuleRepository.DeleteFromQueryAsync(t => t.Id == taskMedicalReviewRuleId,true);
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
|
|
|
@ -328,6 +328,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
VisitTaskNum = reReadingVisitTask.VisitTaskNum,
|
||||
ReadingCategory = reReadingVisitTask.ReadingCategory,
|
||||
SourceSubjectVisitId = reReadingVisitTask.SourceSubjectVisitId,
|
||||
SouceReadModuleId = reReadingVisitTask.SouceReadModuleId,
|
||||
|
||||
IsReReadingCreate = true,
|
||||
TaskState = TaskState.Effect,
|
||||
|
@ -354,6 +355,36 @@ namespace IRaCIS.Core.Application.Service
|
|||
//}
|
||||
|
||||
break;
|
||||
case ReadingCategory.Consistent:
|
||||
|
||||
foreach (var task in generateTaskCommand.GenerataConsistentTaskList)
|
||||
{
|
||||
var consistentTask = new VisitTask()
|
||||
{
|
||||
TrialId = task.TrialId,
|
||||
SubjectId = task.SubjectId,
|
||||
ArmEnum = task.ArmEnum,
|
||||
TaskName = task.TaskName,
|
||||
TaskBlindName = task.TaskBlindName,
|
||||
|
||||
VisitTaskNum = task.VisitTaskNum,
|
||||
ReadingCategory = task.ReadingCategory,
|
||||
|
||||
IsReReadingCreate = true,
|
||||
TaskState = TaskState.Effect,
|
||||
Code = currentMaxCodeInt + 1,
|
||||
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
|
||||
};
|
||||
|
||||
await _visitTaskRepository.AddAsync(consistentTask);
|
||||
|
||||
currentMaxCodeInt = currentMaxCodeInt + 1;
|
||||
|
||||
_provider.Set<int>($"{trialId}_{StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt, TimeSpan.FromMinutes(30));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ReadingCategory.Judge:
|
||||
var firstTask = await _visitTaskRepository.Where(x => generateTaskCommand.JudgeVisitTaskIdList.Contains(x.Id)).FirstOrDefaultAsync();
|
||||
|
||||
|
|
|
@ -199,99 +199,10 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 一致性分析列表 (自身 组内 最后勾选 产生的任务)
|
||||
/// </summary>
|
||||
/// <param name="queryVisitTask"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<ReadingTaskView>> GetAnalysisTaskList(VisitTaskQuery queryVisitTask)
|
||||
{
|
||||
var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == queryVisitTask.TrialId)
|
||||
.Where(t => t.IsAnalysisCreate)
|
||||
|
||||
.WhereIf(queryVisitTask.SiteId != null, t => t.Subject.SiteId == queryVisitTask.SiteId)
|
||||
.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId)
|
||||
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
|
||||
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId)
|
||||
.WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory)
|
||||
.WhereIf(queryVisitTask.ReadingTaskState != null, t => t.ReadingTaskState == queryVisitTask.ReadingTaskState)
|
||||
.WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState)
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName))
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.Subject.Code.Contains(queryVisitTask.SubjectCode))
|
||||
.WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate)
|
||||
.WhereIf(queryVisitTask.EndAllocateDate != null, t => t.AllocateTime < queryVisitTask.EndAllocateDate.Value.AddDays(1))
|
||||
.ProjectTo<ReadingTaskView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var defalutSortArray = new string[] { nameof(VisitTask.IsUrgent) + " desc", nameof(VisitTask.SubjectId) };
|
||||
|
||||
var pageList = await visitTaskQueryable.ToPagedListAsync(queryVisitTask.PageIndex, queryVisitTask.PageSize, queryVisitTask.SortField, queryVisitTask.Asc, string.IsNullOrWhiteSpace(queryVisitTask.SortField), defalutSortArray);
|
||||
|
||||
return (pageList);
|
||||
}
|
||||
|
||||
|
||||
//[HttpPost]
|
||||
//public async Task<PageOutput<SelfConsistentView>> GetSelfConsistentList(SelfConsistentQuery inQuery)
|
||||
//{
|
||||
// var group = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.DoctorUserId == inQuery.AnalysisDoctorUserId)
|
||||
// .Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect)
|
||||
// .Where(t => t.SignTime!.Value.AddDays(inQuery.IntervalWeeks * 7 + 1) > DateTime.Now)
|
||||
// //重阅产生的访视任务 要把之前的访视任务去除
|
||||
// .Where(t => t.ReReadingApplyState != ReReadingApplyState.Agree)
|
||||
// .WhereIf(inQuery.IsHaveReadingPeriod == false, t => t.ReadingCategory == ReadingCategory.Visit)
|
||||
// .WhereIf(inQuery.IsHaveReadingPeriod == true, t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global)
|
||||
// .GroupBy(t => t.SubjectId)
|
||||
// ;
|
||||
|
||||
// var query= group.Select(g => new SelfConsistentView()
|
||||
// {
|
||||
// SubjectId = g.Key,
|
||||
|
||||
// VisitTaskList = g.OrderBy(t => t.SubjectVisit.VisitNum).Select(c => new VisitTaskSimpleView()
|
||||
// {
|
||||
// Id = c.Id,
|
||||
// ReadingCategory = c.ReadingCategory,
|
||||
// TaskBlindName = c.TaskBlindName,
|
||||
// TaskCode = c.TaskCode,
|
||||
// TaskName = c.TaskName,
|
||||
// TaskState = c.TaskState,
|
||||
// ArmEnum = c.ArmEnum,
|
||||
// SubjectId = c.SubjectId,
|
||||
// TrialId = c.TrialId,
|
||||
// SubjectCode = c.Subject.Code,
|
||||
// TrialSiteCode = c.Subject.TrialSite.TrialSiteCode,
|
||||
// }).Take(2).ToList(),
|
||||
|
||||
// VisitValidTaskCount = g.Count()
|
||||
|
||||
// })
|
||||
|
||||
|
||||
|
||||
// //source = source.Skip((pageNumber - 1) * pageSize);
|
||||
// //var items = await source
|
||||
// // .Take(pageSize)
|
||||
// // .ToArrayAsync(cancellationToken)
|
||||
// // .ConfigureAwait(false);
|
||||
|
||||
// //var pagedList = new PageOutput<T>()
|
||||
// //{
|
||||
// // PageIndex = pageNumber,
|
||||
// // PageSize = pageSize,
|
||||
// // TotalCount = count,
|
||||
// // CurrentPageData = items
|
||||
// //};
|
||||
|
||||
|
||||
// //var count = group.Count();
|
||||
|
||||
// //var list= query.Skip((pageNumber - 1) * pageSize).Take(pageSize).ToList();
|
||||
|
||||
|
||||
|
||||
// return query.ToList();
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.FullName));
|
||||
//.ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.UserTypeRole.UserTypeShortName));
|
||||
//.ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.UserTypeRole.UserTypeShortName));
|
||||
|
||||
|
||||
|
||||
|
@ -207,14 +207,16 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
.ForMember(o => o.GeneratedGlobalTaskList, t => t.MapFrom(u => u.TaskMedicalReviewList.Where(t => t.VisitTask.ReadingCategory == ReadingCategory.Global && t.VisitTask.TaskState == TaskState.Effect && t.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.VisitTask.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.VisitTaskId, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })))
|
||||
.ForMember(o => o.GeneratedJudgeTaskList, t => t.MapFrom(u => u.TaskMedicalReviewList.Where(t => t.VisitTask.ReadingCategory == ReadingCategory.Judge && t.VisitTask.TaskState == TaskState.Effect && t.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.VisitTask.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.VisitTaskId, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })))
|
||||
.ForMember(o => o.GeneratedTumorTaskList, t => t.MapFrom(u => u.TaskMedicalReviewList.Where(t => t.VisitTask.ReadingCategory == ReadingCategory.Oncology && t.VisitTask.TaskState == TaskState.Effect && t.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.VisitTask.SignTime).Select(t => new TaskBasicIdView() {TaskId = t.VisitTaskId,TrialId=t.TrialId,DoctorUserId=t.DoctorUserId })))
|
||||
.ForMember(o => o.GeneratedTumorTaskList, t => t.MapFrom(u => u.TaskMedicalReviewList.Where(t => t.VisitTask.ReadingCategory == ReadingCategory.Oncology && t.VisitTask.TaskState == TaskState.Effect && t.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.VisitTask.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.VisitTaskId, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })))
|
||||
.ForMember(o => o.GeneratedVisitTaskList, t => t.MapFrom(u => u.TaskMedicalReviewList.Where(t => t.VisitTask.ReadingCategory == ReadingCategory.Visit && t.VisitTask.TaskState == TaskState.Effect && t.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.VisitTask.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.VisitTaskId, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })));
|
||||
|
||||
CreateMap<TaskMedicalReviewRuleAddOrEdit, TaskMedicalReviewRule>();
|
||||
|
||||
|
||||
|
||||
CreateMap<TaskConsistentRule, TaskConsistentRuleView>();
|
||||
CreateMap<TaskConsistentRule, TaskConsistentRuleView>()
|
||||
.ForMember(o => o.GeneratedSubjectCount, t => t.MapFrom(u => u.DoctorConsistentTaskList.Select(t => t.SubjectId).Distinct().Count()))
|
||||
.ForMember(o => o.GeneratedVisitCount, t => t.MapFrom(u => u.DoctorConsistentTaskList.Count()));
|
||||
|
||||
CreateMap<TaskConsistentRuleAddOrEdit, TaskConsistentRule>();
|
||||
|
||||
|
|
|
@ -23,7 +23,11 @@ namespace IRaCIS.Core.Domain.Share
|
|||
|
||||
|
||||
|
||||
//生成任务 额外增加的 前端那边不加
|
||||
|
||||
ReReading = 6,
|
||||
|
||||
Consistent = 7,
|
||||
}
|
||||
|
||||
public enum TaskAllocationState
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
// 生成时间 2022-07-01 15:32:56
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
using System;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Collections.Generic;
|
||||
using EntityFrameworkCore.Projectables;
|
||||
using System.Linq;
|
||||
|
||||
namespace IRaCIS.Core.Domain.Models
|
||||
{
|
||||
///<summary>
|
||||
|
@ -57,6 +59,12 @@ namespace IRaCIS.Core.Domain.Models
|
|||
public User CompareDoctorUser { get; set; }
|
||||
|
||||
public User AnalysisDoctorUser { get; set; }
|
||||
|
||||
public List<VisitTask> DoctorVisitTaskList { get; set; }
|
||||
|
||||
|
||||
[Projectable]
|
||||
public List<VisitTask> DoctorConsistentTaskList => DoctorVisitTaskList.Where(t => t.IsAnalysisCreate && t.TaskConsistentRuleId == Id).ToList();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue