一致性核查通过修复bug
parent
1e990815b0
commit
3093d57960
|
@ -109,7 +109,7 @@
|
|||
<param name="inQuery"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.TaskMedicalReviewService.GetGenerateMedicalReviewTaskList(IRaCIS.Core.Application.ViewModel.TaskMedicalReviewQuery)">
|
||||
<member name="M:IRaCIS.Core.Application.Service.TaskMedicalReviewService.GetGenerateMedicalReviewTaskList(IRaCIS.Core.Application.ViewModel.GenerateMedicalReviewTaskQuery)">
|
||||
<summary>
|
||||
产生医学审核列表
|
||||
</summary>
|
||||
|
@ -1543,6 +1543,11 @@
|
|||
是否关闭对话
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetIRMedicalFeedbackListOutDto.IsHaveQuestion">
|
||||
<summary>
|
||||
是否有问题
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetMedicalReviewDialogOutDto.Content">
|
||||
<summary>
|
||||
对话内容
|
||||
|
|
|
@ -152,7 +152,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
//public ReReadingApplyGenerateTaskCommand ReReadingApplyGenerateTaskCommand { get; set; } = new ReReadingApplyGenerateTaskCommand();
|
||||
|
||||
public List<VisitTaskSimpleView> GenerataConsistentTaskList { get; set; }
|
||||
public List<VisitTaskSimpleDTO> GenerataConsistentTaskList { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,56 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
}
|
||||
|
||||
|
||||
public class DoctorSelfConsistentSubjectView
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
|
||||
public String TrialSiteCode { get; set; }
|
||||
public string SubjectCode { get; set; }
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
public bool IsHaveGeneratedTask { get; set; }
|
||||
|
||||
|
||||
public int? ValidVisitCount { get; set; }
|
||||
|
||||
public List<VisitTaskSimpleDTO> VisitTaskList { get; set; }
|
||||
}
|
||||
|
||||
public class VisitTaskSimpleDTO
|
||||
{
|
||||
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 decimal VisitTaskNum { get; set; }
|
||||
|
||||
public ReadingCategory ReadingCategory { get; set; }
|
||||
|
||||
//任务阅片状态
|
||||
public ReadingTaskState ReadingTaskState { get; set; }
|
||||
|
||||
public TaskState TaskState { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public Guid? DoctorUserId { get; set; }
|
||||
[JsonIgnore]
|
||||
public Guid? TaskConsistentRuleId { get; set; }
|
||||
|
||||
public bool IsHaveGeneratedTask { get; set; }
|
||||
|
||||
public List<VisitTaskSimpleDTO> GlobalVisitTaskList { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class DoctorConsistentRuleSubjectView
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@ using IRaCIS.Core.Infrastructure;
|
|||
using IRaCIS.Core.Domain.Share;
|
||||
using System.Linq.Expressions;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using System.Linq;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
@ -74,25 +75,30 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// <param name="inQuery"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<DoctorConsistentRuleSubjectView>> GetDoctorSelfConsistentRuleSubjectList(ConsistentQuery inQuery)
|
||||
public async Task<PageOutput<DoctorSelfConsistentSubjectView>> GetDoctorSelfConsistentRuleSubjectList(ConsistentQuery inQuery)
|
||||
{
|
||||
var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == inQuery.TaskConsistentRuleId);
|
||||
|
||||
var (group, query) = GetIQueryableDoctorSelfConsistentRuleSubjectView(filterObj);
|
||||
var pagedList = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj).ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(DoctorSelfConsistentSubjectView.SubjectCode) : inQuery.SortField, inQuery.Asc);
|
||||
|
||||
var count = group.Count();
|
||||
|
||||
query = query.OrderByDescending(t => t.IsHaveGeneratedTask).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
|
||||
};
|
||||
//var (group, query) = GetIQueryableDoctorSelfConsistentRuleSubjectView(filterObj);
|
||||
|
||||
//var count = group.Count();
|
||||
|
||||
//query = query.OrderByDescending(t => t.IsHaveGeneratedTask).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;
|
||||
|
@ -109,9 +115,11 @@ namespace IRaCIS.Core.Application.Service
|
|||
var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == inCommand.TaskConsistentRuleId);
|
||||
|
||||
|
||||
var (group, query) = GetIQueryableDoctorSelfConsistentRuleSubjectView(filterObj, inCommand.SubejctIdList);
|
||||
var list = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj, inCommand.SubejctIdList).ToListAsync();
|
||||
|
||||
var list = query.OrderByDescending(t => t.IsHaveGeneratedTask).ToList();
|
||||
//var (group, query) = GetIQueryableDoctorSelfConsistentRuleSubjectView(filterObj, inCommand.SubejctIdList);
|
||||
|
||||
//var list = query.OrderByDescending(t => t.IsHaveGeneratedTask).ToList();
|
||||
|
||||
foreach (var subject in list)
|
||||
{
|
||||
|
@ -136,26 +144,96 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
}
|
||||
|
||||
private IQueryable<DoctorSelfConsistentSubjectView> GetIQueryableDoctorSelfConsistentSubjectView(TaskConsistentRule filterObj, List<Guid>? subejctIdList = null)
|
||||
{
|
||||
var doctorUserId = filterObj.AnalysisDoctorUserId;
|
||||
var trialId = filterObj.TrialId;
|
||||
|
||||
#region Subejct 维度
|
||||
|
||||
Expression<Func<VisitTask, bool>> visitTaskFilter = t => t.IsAnalysisCreate == false && t.ReadingCategory == ReadingCategory.Visit && t.DoctorUserId == doctorUserId &&
|
||||
t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect &&
|
||||
t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7) < DateTime.Now &&
|
||||
(t.ReReadingApplyState == ReReadingApplyState.Default || t.ReReadingApplyState == ReReadingApplyState.Reject);
|
||||
|
||||
|
||||
if (subejctIdList != null && subejctIdList?.Count > 0)
|
||||
{
|
||||
visitTaskFilter.And( t => subejctIdList.Contains(t.SubjectId));
|
||||
}
|
||||
|
||||
//所选访视数量 的访视 其中必有一个访视后有全局任务
|
||||
if (filterObj.IsHaveReadingPeriod == true)
|
||||
{
|
||||
visitTaskFilter = visitTaskFilter.And(t => t.Subject.SubjectVisitTaskList.Any(u => u.VisitTaskNum == t.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global]
|
||||
&& t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7) < DateTime.Now));
|
||||
}
|
||||
|
||||
//var globalWithVisitFilter = visitTaskFilter.And(t => t.VisitTaskNum <=)
|
||||
|
||||
var subjectQuery = _subjectRepository.Where(t => t.TrialId == trialId && t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter).Count() >= filterObj.PlanVisitCount);
|
||||
|
||||
|
||||
var query = subjectQuery.Select(t => new DoctorSelfConsistentSubjectView()
|
||||
{
|
||||
TrialId = t.TrialId,
|
||||
SiteId = t.SiteId,
|
||||
SubjectCode = t.Code,
|
||||
TrialSiteCode = t.TrialSite.TrialSiteCode,
|
||||
SubjectId = t.Id,
|
||||
|
||||
IsHaveGeneratedTask = t.SubjectVisitTaskList.Any(c => c.IsAnalysisCreate && c.DoctorUserId == doctorUserId),
|
||||
|
||||
|
||||
ValidVisitCount = t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter).Count(),
|
||||
|
||||
VisitTaskList = t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter).Select(c => new VisitTaskSimpleDTO()
|
||||
{
|
||||
Id = c.Id,
|
||||
ReadingCategory = c.ReadingCategory,
|
||||
ReadingTaskState = c.ReadingTaskState,
|
||||
TaskBlindName = c.TaskBlindName,
|
||||
TaskCode = c.TaskCode,
|
||||
TaskName = c.TaskName,
|
||||
TaskState = c.TaskState,
|
||||
ArmEnum = c.ArmEnum,
|
||||
SubjectId = c.SubjectId,
|
||||
VisitTaskNum = c.VisitTaskNum,
|
||||
TrialId = c.TrialId,
|
||||
|
||||
IsHaveGeneratedTask = c.Subject.SubjectVisitTaskList.Any(t => t.ConsistentAnalysisOriginalTaskId == c.Id),
|
||||
|
||||
GlobalVisitTaskList = c.Subject.SubjectVisitTaskList.Where(t => t.VisitTaskNum == c.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global] && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7) < DateTime.Now).Select(c => new VisitTaskSimpleDTO()
|
||||
{
|
||||
Id = c.Id,
|
||||
ReadingCategory = c.ReadingCategory,
|
||||
ReadingTaskState = c.ReadingTaskState,
|
||||
TaskBlindName = c.TaskBlindName,
|
||||
TaskCode = c.TaskCode,
|
||||
TaskName = c.TaskName,
|
||||
TaskState = c.TaskState,
|
||||
ArmEnum = c.ArmEnum,
|
||||
SubjectId = c.SubjectId,
|
||||
VisitTaskNum = c.VisitTaskNum,
|
||||
TrialId = c.TrialId,
|
||||
|
||||
}).ToList(),
|
||||
|
||||
}).ToList()
|
||||
});
|
||||
|
||||
return query.OrderByDescending(t => t.IsHaveGeneratedTask);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
private (IQueryable<IGrouping<Guid, VisitTask>>, IQueryable<DoctorConsistentRuleSubjectView>) GetIQueryableDoctorSelfConsistentRuleSubjectView(TaskConsistentRule filterObj, List<Guid>? subejctIdList = null)
|
||||
{
|
||||
|
||||
|
||||
//IQueryable<Guid> subjectfilter = default;
|
||||
|
||||
//if (isSelfAnalysis == false)
|
||||
//{
|
||||
// //过滤不满足的Subject
|
||||
|
||||
// subjectfilter = _subjectUserRepository.Where(t => t.TrialId == filterObj.TrialId).GroupBy(t => t.SubjectId)
|
||||
// .Where(g => g.Any(t => t.DoctorUserId == filterObj.AnalysisDoctorUserId) && !g.Any(t => t.DoctorUserId == filterObj.CompareDoctorUserId)).Select(g => g.Key);
|
||||
//}
|
||||
|
||||
var doctorUserId = filterObj.AnalysisDoctorUserId;
|
||||
var trialId = filterObj.TrialId;
|
||||
|
||||
|
||||
#region 任务维度
|
||||
|
||||
var group = _visitTaskRepository.Where(t => t.TrialId == filterObj.TrialId && t.IsAnalysisCreate == false && t.ReadingCategory == ReadingCategory.Visit && t.DoctorUserId == doctorUserId)
|
||||
|
||||
|
@ -170,7 +248,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
//重阅产生的访视任务 要把之前的访视任务去除
|
||||
.Where(t => t.ReReadingApplyState == ReReadingApplyState.Default || t.ReReadingApplyState == ReReadingApplyState.Reject)
|
||||
|
||||
.WhereIf(filterObj.IsHaveReadingPeriod == true, t => t.SameSubjectVisiTaskList.Any(u => u.VisitTaskNum == t.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global]
|
||||
.WhereIf(filterObj.IsHaveReadingPeriod == true, t => t.Subject.SubjectVisitTaskList.Any(u => u.VisitTaskNum == t.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global]
|
||||
&& t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7) < DateTime.Now))
|
||||
.GroupBy(t => t.SubjectId)
|
||||
.Where(g => g.Count() >= filterObj.PlanVisitCount);
|
||||
|
@ -180,7 +258,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
SubjectId = g.Key,
|
||||
|
||||
IsHaveGeneratedTask = g.Any(c => c.SameSubjectVisiTaskList.Any(t => t.IsAnalysisCreate && t.DoctorUserId == doctorUserId && t.TaskConsistentRuleId == filterObj.Id)),
|
||||
IsHaveGeneratedTask = g.Any(c => c.Subject.SubjectVisitTaskList.Any(t => t.IsAnalysisCreate && t.DoctorUserId == doctorUserId && t.TaskConsistentRuleId == filterObj.Id)),
|
||||
|
||||
VisitTaskList = g.OrderBy(t => t.VisitTaskNum)
|
||||
|
||||
|
@ -200,7 +278,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
SubjectCode = c.Subject.Code,
|
||||
TrialSiteCode = c.Subject.TrialSite.TrialSiteCode,
|
||||
|
||||
GlobalVisitTaskList = c.SameSubjectVisiTaskList.Where(t => t.VisitTaskNum == c.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global] && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).Select(t => new VisitTaskSimpleView()
|
||||
GlobalVisitTaskList = c.Subject.SubjectVisitTaskList.Where(t => t.VisitTaskNum == c.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global] && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).Select(t => new VisitTaskSimpleView()
|
||||
{
|
||||
Id = t.Id,
|
||||
ReadingCategory = t.ReadingCategory,
|
||||
|
@ -225,15 +303,25 @@ namespace IRaCIS.Core.Application.Service
|
|||
// UserName = c.DoctorUser.UserName
|
||||
//}).ToList(),
|
||||
|
||||
IsHaveGeneratedTask = c.SameSubjectVisiTaskList.Any(t => t.ConsistentAnalysisOriginalTaskId == c.Id),
|
||||
IsHaveGeneratedTask = c.Subject.SubjectVisitTaskList.Any(t => t.ConsistentAnalysisOriginalTaskId == c.Id),
|
||||
|
||||
}).ToList(),
|
||||
|
||||
ValidTaskCount = g.Count()
|
||||
|
||||
}); ;
|
||||
});
|
||||
|
||||
return (group, query);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -248,7 +336,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
#region 是否有新的医生加入 自动加入配置
|
||||
|
||||
|
||||
if (await _taskConsistentRuleRepository.AnyAsync(t => t.TrialId == inQuery.TrialId))
|
||||
if (await _taskConsistentRuleRepository.AnyAsync(t => t.TrialId == inQuery.TrialId))
|
||||
{
|
||||
var rule = await _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId).ProjectTo<TaskConsistentRuleBatchAddOrEdit>(_mapper.ConfigurationProvider).FirstAsync();
|
||||
|
||||
|
@ -275,7 +363,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
var query = from enroll in _repository.Where<Enroll>(t => t.TrialId == trialId)
|
||||
join user in _repository.Where<User>() on enroll.DoctorId equals user.DoctorId
|
||||
join taskConsistentRule in _repository.Where<TaskConsistentRule>(t=>t.TrialId== trialId) on user.Id equals taskConsistentRule.AnalysisDoctorUserId into c
|
||||
join taskConsistentRule in _repository.Where<TaskConsistentRule>(t => t.TrialId == trialId) on user.Id equals taskConsistentRule.AnalysisDoctorUserId into c
|
||||
from taskConsistentRule in c.DefaultIfEmpty()
|
||||
select new
|
||||
{
|
||||
|
@ -303,7 +391,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
};
|
||||
|
||||
addOrEdit.AnalysisDoctorUserId = doctor.DoctorUserId;
|
||||
addOrEdit.Id = Guid.Empty ;
|
||||
addOrEdit.Id = Guid.Empty;
|
||||
|
||||
var entity = await _taskConsistentRuleRepository.InsertOrUpdateAsync(addOrEdit, true, verifyExp1);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,6 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
//var list3 = _repository.Where<VisitTask>(t => t.Id == Guid.NewGuid()).SelectMany(t => t.SourceSubjectVisit.VisitTaskList).ToList();
|
||||
var list2 = _repository.Where<Subject>(t => t.Id == Guid.NewGuid()).SelectMany(t => t.SubjectVisitTaskList).ToList();
|
||||
var list3 = _repository.Where<VisitTask>(t => t.Id == Guid.NewGuid()).SelectMany(t => t.SameSubjectVisiTaskList).ToList();
|
||||
return _userInfo.LocalIp;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace IRaCIS.Core.Domain.Models
|
|||
//排除一致性分析 因为souceVisitId 没值
|
||||
//public List<VisitTask> SameVisitTaskList { get; set; }
|
||||
|
||||
public List<VisitTask> SameSubjectVisiTaskList { get; set; }
|
||||
//public List<VisitTask> SameSubjectVisiTaskList { get; set; }
|
||||
|
||||
public TaskConsistentRule TaskConsistentRule { get; set; }
|
||||
|
||||
|
|
|
@ -103,7 +103,8 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
|
||||
modelBuilder.Entity<VisitTask>().HasMany(t => t.TaskMedicalReviewList).WithOne(t => t.VisitTask).HasForeignKey(t => t.VisitTaskId);
|
||||
|
||||
modelBuilder.Entity<VisitTask>().HasMany(t => t.SameSubjectVisiTaskList).WithOne().HasForeignKey(t => t.SubjectId).HasPrincipalKey(u=>u.SubjectId);
|
||||
|
||||
|
||||
modelBuilder.Entity<VisitTask>().HasOne(t => t.Subject).WithMany(s=>s.SubjectVisitTaskList).HasForeignKey(t => t.SubjectId);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue