Merge branch 'master' of http://192.168.1.2:8033/IRaCIS_Core_Api
commit
49ce934300
|
@ -896,6 +896,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<(PageOutput<IRUnReadSubjectView>, object)> GetIRUnReadSubjectTaskList(IRUnReadSubjectQuery iRUnReadSubjectQuery)
|
public async Task<(PageOutput<IRUnReadSubjectView>, object)> GetIRUnReadSubjectTaskList(IRUnReadSubjectQuery iRUnReadSubjectQuery)
|
||||||
{
|
{
|
||||||
|
|
||||||
var trialId = iRUnReadSubjectQuery.TrialId;
|
var trialId = iRUnReadSubjectQuery.TrialId;
|
||||||
|
|
||||||
var trialReadingCriterionId = iRUnReadSubjectQuery.TrialReadingCriterionId;
|
var trialReadingCriterionId = iRUnReadSubjectQuery.TrialReadingCriterionId;
|
||||||
|
@ -905,6 +906,11 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||||
var readingTool = criterionConfig.ReadingTool;
|
var readingTool = criterionConfig.ReadingTool;
|
||||||
var isReadingTaskViewInOrder = criterionConfig.IsReadingTaskViewInOrder;
|
var isReadingTaskViewInOrder = criterionConfig.IsReadingTaskViewInOrder;
|
||||||
|
|
||||||
|
#region 按照Subject 维度
|
||||||
|
if (isReadingTaskViewInOrder)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
var visitTaskListInfo = await GetOrderReadingIQueryable(new GetOrderReadingIQueryableInDto()
|
var visitTaskListInfo = await GetOrderReadingIQueryable(new GetOrderReadingIQueryableInDto()
|
||||||
{
|
{
|
||||||
TrialId = trialId,
|
TrialId = trialId,
|
||||||
|
@ -935,12 +941,6 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||||
CurrentPageData = currentPageData,
|
CurrentPageData = currentPageData,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#region 按照Subject 维度
|
|
||||||
if (isReadingTaskViewInOrder)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
// 封装的方法有问题
|
// 封装的方法有问题
|
||||||
//var result = await visitQuery.ToPagedListAsync(iRUnReadSubjectQuery.PageIndex, iRUnReadSubjectQuery.PageSize, String.IsNullOrEmpty(iRUnReadSubjectQuery.SortField) ? nameof(IRUnReadSubjectView.SubjectId) : iRUnReadSubjectQuery.SortField, iRUnReadSubjectQuery.Asc);
|
//var result = await visitQuery.ToPagedListAsync(iRUnReadSubjectQuery.PageIndex, iRUnReadSubjectQuery.PageSize, String.IsNullOrEmpty(iRUnReadSubjectQuery.SortField) ? nameof(IRUnReadSubjectView.SubjectId) : iRUnReadSubjectQuery.SortField, iRUnReadSubjectQuery.Asc);
|
||||||
return (result, new
|
return (result, new
|
||||||
|
@ -957,10 +957,9 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
var taskQuery = _visitTaskRepository.Where(x => x.TrialId == iRUnReadSubjectQuery.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect && x.TrialReadingCriterionId == trialReadingCriterionId)
|
var taskQuery = _visitTaskRepository.Where(x => x.TrialId == iRUnReadSubjectQuery.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect && x.TrialReadingCriterionId == trialReadingCriterionId)
|
||||||
// .Where(x=>x.Subject.ClinicalDataList.Any(c => c.IsSign && (c.ReadingId == x.SouceReadModuleId || c.ReadingId == x.SourceSubjectVisitId)))
|
// .Where(x=>x.Subject.ClinicalDataList.Any(c => c.IsSign && (c.ReadingId == x.SouceReadModuleId || c.ReadingId == x.SourceSubjectVisitId)))
|
||||||
.Where(x => !x.Subject.IsDeleted);
|
.Where(x => !x.Subject.IsDeleted).Where(x=>(x.IsNeedClinicalDataSign&&x.IsClinicalDataSign)||!x.IsNeedClinicalDataSign);
|
||||||
|
|
||||||
IRUnReadOutDto iRUnReadOut = new IRUnReadOutDto()
|
IRUnReadOutDto iRUnReadOut = new IRUnReadOutDto()
|
||||||
{
|
{
|
||||||
|
@ -973,8 +972,65 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var visitGroupQuery = taskQuery.GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var visitTaskQuery = visitGroupQuery.Select(x => new IRUnReadSubjectView()
|
||||||
|
{
|
||||||
|
SubjectId = x.Key.SubjectId,
|
||||||
|
SubjectCode = x.Key.BlindSubjectCode == string.Empty ? x.Key.Code : x.Key.BlindSubjectCode,
|
||||||
|
|
||||||
|
SuggesteFinishedTime = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned).Min(x => x.SuggesteFinishedTime),
|
||||||
|
|
||||||
|
//未读任务量
|
||||||
|
UnReadTaskCount = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned).Count(),
|
||||||
|
|
||||||
|
//未读 里可读任务量
|
||||||
|
UnReadCanReadTaskCount = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned && y.IsFrontTaskNeedSignButNotSign == false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true)
|
||||||
|
//不能对包含聚合或子查询的表达式执行聚合函数
|
||||||
|
//&& !x.Any(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.IsNeedClinicalDataSign == true && t.IsClinicalDataSign == false && t.VisitTaskNum<y.VisitTaskNum )
|
||||||
|
).Count(),
|
||||||
|
|
||||||
|
|
||||||
|
//已读任务量
|
||||||
|
HaveReadTaskCount = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState == ReadingTaskState.HaveSigned).Count(),
|
||||||
|
|
||||||
|
ExistReadingApply = x.Any(y => y.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed || y.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed),
|
||||||
|
|
||||||
|
//查出所有未读的 未读的可读的 在这个列表基础上 过滤下 y.IsFrontTaskNeedSignButNotSign==false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true) 这样容易排错 确认这三个字段是否维护有误
|
||||||
|
UnReadTaskList = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned).OrderBy(x => x.VisitTaskNum)
|
||||||
|
.Select(u => new IRUnreadTaskView()
|
||||||
|
{
|
||||||
|
Id = u.Id,
|
||||||
|
IsUrgent = u.IsUrgent,
|
||||||
|
VisitNum = u.VisitTaskNum,
|
||||||
|
TaskBlindName = u.TaskBlindName,
|
||||||
|
VisistId = u.SourceSubjectVisitId,
|
||||||
|
SuggesteFinishedTime = u.SuggesteFinishedTime,
|
||||||
|
ReadingCategory = u.ReadingCategory,
|
||||||
|
IsAnalysisCreate = u.IsAnalysisCreate,
|
||||||
|
ArmEnum = u.ArmEnum,
|
||||||
|
TrialReadingCriterionId = u.TrialReadingCriterionId,
|
||||||
|
IsNeedClinicalDataSign = u.IsNeedClinicalDataSign,
|
||||||
|
IsClinicalDataSign = u.IsClinicalDataSign,
|
||||||
|
IsFrontTaskNeedSignButNotSign = u.IsFrontTaskNeedSignButNotSign
|
||||||
|
})
|
||||||
|
.ToList(),
|
||||||
|
}).Where(x => x.UnReadCanReadTaskCount > 0);
|
||||||
|
|
||||||
|
|
||||||
|
var totalCount = await visitGroupQuery.CountAsync();
|
||||||
|
var currentPageData =await visitTaskQuery.ToListAsync();
|
||||||
|
|
||||||
|
var result = new PageOutput<IRUnReadSubjectView>()
|
||||||
|
{
|
||||||
|
PageSize = iRUnReadSubjectQuery.PageSize,
|
||||||
|
PageIndex = iRUnReadSubjectQuery.PageIndex,
|
||||||
|
TotalCount = totalCount,
|
||||||
|
CurrentPageData = currentPageData,
|
||||||
|
};
|
||||||
|
|
||||||
return (result, new
|
return (result, new
|
||||||
{
|
{
|
||||||
IsReadingTaskViewInOrder = isReadingTaskViewInOrder,
|
IsReadingTaskViewInOrder = isReadingTaskViewInOrder,
|
||||||
|
|
Loading…
Reference in New Issue