计划比率

Uat_Study
hang 2022-06-17 15:31:12 +08:00
parent b1f629f56e
commit 50e71792b2
6 changed files with 35 additions and 9 deletions

View File

@ -34,12 +34,16 @@ namespace IRaCIS.Core.Application.ViewModel
//该医生未应用的任务数
public int? WaitApplySelfTaskCount { get; set; }
public int? WaitApplySelfSubjectCount { get; set; }
//该医生已应用的任务数
public int? SelfTaskCount { get; set; }
//已经分配该医生Subject数量
public int? SelfSubjectCount { get; set; }
public int? SelfApplyedSubjectCount { get; set; }
//已应用 的Subject 数
public int? ApplyedTotalSubjectCount { get; set; }

View File

@ -80,6 +80,7 @@ namespace IRaCIS.Core.Application.Service
CheckPassedTime = subjectVisit.CheckPassedTime,
ArmEnum = 1,//特殊
Code = currentMaxCodeInt + 1,
SourceSubjectVisitId=subjectVisit.Id,
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
ReadingCategory = ReadingCategory.Visit
});
@ -94,6 +95,7 @@ namespace IRaCIS.Core.Application.Service
CheckPassedTime = subjectVisit.CheckPassedTime,
ArmEnum = 2,//特殊
Code = currentMaxCodeInt + 2,
SourceSubjectVisitId = subjectVisit.Id,
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 2, nameof(VisitTask)),
ReadingCategory = ReadingCategory.Visit
});
@ -203,6 +205,7 @@ namespace IRaCIS.Core.Application.Service
CheckPassedTime = subjectVisit.CheckPassedTime,
ArmEnum = 0, //特殊
Code = currentMaxCodeInt + 1,
SourceSubjectVisitId = subjectVisit.Id,
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
ReadingCategory = ReadingCategory.Visit
});

View File

@ -122,7 +122,6 @@ namespace IRaCIS.Core.Application.Service
/// <summary>
/// 获取影像阅片列表 (排除重阅的) 相比而言多了几个字段 和配置信息
/// </summary>

View File

@ -22,17 +22,24 @@ namespace IRaCIS.Core.Application.Service
//.ForMember(o => o.ArmList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(c => c.TrialId == u.TrialId).Select(t => t.ArmEnum).Distinct()))
.ForMember(o => o.TotalTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count()))
.ForMember(o => o.ApplyedTotalTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t => t.DoctorUserId != null)))
.ForMember(o => o.WaitApplySelfTaskCount, t => t.MapFrom(u => subjectIdList.Count==0? u.Trial.SubjectDoctorUserList.Where(d => d.DoctorUserId == u.DoctorUserId)
.SelectMany(t => t.SubjectArmVisitTaskList.Where(t => t.DoctorUserId == null)).Count():
u.Trial.SubjectDoctorUserList.Where(d => d.DoctorUserId == u.DoctorUserId && subjectIdList.Contains(d.SubjectId))
.SelectMany(t => t.SubjectArmVisitTaskList.Where(t => t.DoctorUserId == null)).Count()
.ForMember(o => o.WaitApplySelfTaskCount, t => t.MapFrom(u =>
subjectIdList.Count==0? u.Trial.SubjectDoctorUserList.Where(d => d.DoctorUserId == u.DoctorUserId).SelectMany(t => t.SubjectArmVisitTaskList.Where(t => t.DoctorUserId == null)).Count()
: u.Trial.SubjectDoctorUserList.Where(d => d.DoctorUserId == u.DoctorUserId && subjectIdList.Contains(d.SubjectId)).SelectMany(t => t.SubjectArmVisitTaskList.Where(t => t.DoctorUserId == null)).Count()
))
.ForMember(o => o.SelfUndoTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t => t.DoctorUserId == u.DoctorUserId && t.ReadingTaskState != ReadingTaskState.HaveSigned)))
.ForMember(o => o.SelfTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t => t.DoctorUserId == u.DoctorUserId)))
.ForMember(o => o.TotalSubjectCount, t => t.MapFrom(u => u.Trial.SubjectList.Count()))
.ForMember(o => o.ApplyedTotalSubjectCount, t => t.MapFrom(u => u.Trial.SubjectList.Count(c => c.SubjectVisitTaskList.Any(d => d.DoctorUserId !=null))))
.ForMember(o => o.SelfSubjectCount, t => t.MapFrom(u => u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId).Count()));
.ForMember(o => o.SelfSubjectCount, t => t.MapFrom(u => u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId).Count()))
.ForMember(o => o.SelfApplyedSubjectCount, t => t.MapFrom(u => u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId && t.SubjectArmVisitTaskList.Any()).Count()))
.ForMember(o => o.WaitApplySelfSubjectCount, t => t.MapFrom(u =>
subjectIdList.Count == 0 ? u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId && t.SubjectArmVisitTaskList.Any(c=>c.DoctorUserId ==null)).Count()
: u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId && subjectIdList.Contains(t.SubjectId) && t.SubjectArmVisitTaskList.Any(c => c.DoctorUserId == null)).Count()
))
;

View File

@ -144,6 +144,10 @@ namespace IRaCIS.Core.Application.Contracts
public TaskAllocateDefaultState FollowGlobalVisitAutoAssignDefaultState { get; set; }
public ReadingTaskViewMethod ReadingTaskViewEnum { get; set; }
public bool IsReadingTaskViewInOrder { get; set; } = true;
}
public class TrialReadingTaskViewConfig

View File

@ -20,14 +20,18 @@ namespace IRaCIS.Core.Application
private readonly IRepository<ClinicalDataTrialSet> _clinicalDataTrialSetRepository;
private readonly IEasyCachingProvider _provider;
private readonly IRepository<TaskAllocationRule> _taskAllocationRuleRepository;
public TrialConfigService(IRepository<Trial> trialRepository,
IRepository<TrialQCQuestion> trialQCQuestionRepository,
IRepository<ReadingQuestionCriterionTrial> readingQuestionCriterionTrialRepository,
IRepository<ClinicalDataTrialSet> clinicalDataTrialSetRepository,
IRepository<TaskAllocationRule> taskAllocationRuleRepository,
IEasyCachingProvider provider
)
{
_trialRepository = trialRepository;
_taskAllocationRuleRepository = taskAllocationRuleRepository;
this._trialQCQuestionRepository = trialQCQuestionRepository;
this._readingQuestionCriterionTrialRepository = readingQuestionCriterionTrialRepository;
this._clinicalDataTrialSetRepository = clinicalDataTrialSetRepository;
@ -170,7 +174,7 @@ namespace IRaCIS.Core.Application
{
await _clinicalDataTrialSetRepository.UpdatePartialFromQueryAsync(item, x => new ClinicalDataTrialSet()
{
IsConfirm = true
});
}
@ -179,7 +183,7 @@ namespace IRaCIS.Core.Application
{
await _clinicalDataTrialSetRepository.UpdatePartialFromQueryAsync(item, x => new ClinicalDataTrialSet()
{
IsConfirm = false
});
}
@ -223,7 +227,7 @@ namespace IRaCIS.Core.Application
}
}
if((trialStatusStr == StaticData.TrialState.TrialStopped|| trialStatusStr == StaticData.TrialState.TrialCompleted)&& trial.TrialStatusStr!= StaticData.TrialState.TrialOngoing)
if ((trialStatusStr == StaticData.TrialState.TrialStopped || trialStatusStr == StaticData.TrialState.TrialCompleted) && trial.TrialStatusStr != StaticData.TrialState.TrialOngoing)
{
return ResponseOutput.NotOk("项目没有进入启动状态,不能设置为停止或完成状态");
}
@ -402,6 +406,11 @@ namespace IRaCIS.Core.Application
_mapper.Map(trialConfig, trialInfo);
if (_taskAllocationRuleRepository.Where(t => t.TrialId == trialConfig.TrialId && t.IsEnable).Sum(t => t.PlanReadingRatio) != 100)
{
return ResponseOutput.NotOk("已启用医生的记录比率不为百分之100");
}
return ResponseOutput.Ok(await _trialRepository.SaveChangesAsync());
}