受试者取消医生

This commit is contained in:
2022-07-29 11:03:40 +08:00
parent 0b5cd87212
commit 283bbd29e5
8 changed files with 97 additions and 8 deletions
@@ -327,6 +327,13 @@
</summary>
<param name="origenalTask"></param>
</member>
<member name="M:IRaCIS.Core.Application.Service.Allocation.VisitTaskService.SetReReadingOrBackInfluenceAnalysisAsync(System.Guid)">
<summary>
PM 申请重阅 被同意 或者 PM 直接退回的时候影响
</summary>
<param name="subjectId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Allocation.VisitTaskService.ConfirmReReading(IRaCIS.Core.Application.ViewModel.ConfirmReReadingCommand,IRaCIS.Core.Application.Service.IVisitTaskHelpeService)">
<summary>
确认重阅与否 1同意 2 拒绝
@@ -141,6 +141,25 @@ namespace IRaCIS.Core.Application.ViewModel
public string Note { get; set; } = string.Empty;
}
public class CancelDoctorCommand
{
public Guid TrialId { get; set; }
public Guid SubjectId { get; set; }
public string Note { get; set; }
}
public class SubjectCancelDoctorView
{
public Guid SubjectId { get; set; }
public string Note { get; set; }
public DateTime CreateTime { get; set; }
}
public class TrialDoctorUserSelectView
{
public Guid TrialId { get; set; }
@@ -25,13 +25,16 @@ namespace IRaCIS.Core.Application.Service
private readonly IRepository<Trial> _trialRepository;
private readonly IRepository<SubjectCanceDoctor> _subjectCanceDoctorRepository;
public TaskAllocationRuleService(IRepository<TaskAllocationRule> taskAllocationRuleRepository, IRepository<User> userRepository, IRepository<Trial> trialRepository)
public TaskAllocationRuleService(IRepository<TaskAllocationRule> taskAllocationRuleRepository, IRepository<User> userRepository, IRepository<Trial> trialRepository, IRepository<SubjectCanceDoctor> subjectCanceDoctorRepository)
{
_taskAllocationRuleRepository = taskAllocationRuleRepository;
_userRepository = userRepository;
_trialRepository = trialRepository;
_subjectCanceDoctorRepository = subjectCanceDoctorRepository;
}
@@ -42,7 +45,7 @@ namespace IRaCIS.Core.Application.Service
/// </summary>
/// <param name="trialId"></param>
/// <returns></returns>
public async Task<(List<TaskAllocationRuleDTO>,object?)> GetDoctorPlanAllocationRuleList(Guid trialId)
public async Task<(List<TaskAllocationRuleDTO>, object?)> GetDoctorPlanAllocationRuleList(Guid trialId)
{
var list = await _taskAllocationRuleRepository.Where(t => t.TrialId == trialId).ProjectTo<TaskAllocationRuleDTO>(_mapper.ConfigurationProvider).ToListAsync();
@@ -58,7 +61,7 @@ namespace IRaCIS.Core.Application.Service
public async Task<IResponseOutput> AddOrUpdateTaskAllocationRule(TaskAllocationRuleAddOrEdit addOrEditTaskAllocationRule)
{
//冗余 存
@@ -87,7 +90,7 @@ namespace IRaCIS.Core.Application.Service
[HttpDelete("{taskAllocationRuleId:guid}")]
public async Task<IResponseOutput> DeleteTaskAllocationRule(Guid taskAllocationRuleId)
{
if (await _taskAllocationRuleRepository.Where(t => t.Id == taskAllocationRuleId).AnyAsync(t => t.DoctorUser.VisitTaskList.Where(u=>u.TrialId==t.TrialId).Any()))
if (await _taskAllocationRuleRepository.Where(t => t.Id == taskAllocationRuleId).AnyAsync(t => t.DoctorUser.VisitTaskList.Where(u => u.TrialId == t.TrialId).Any()))
{
return ResponseOutput.NotOk("已分配任务给该医生,不允许删除");
}
@@ -99,11 +102,29 @@ namespace IRaCIS.Core.Application.Service
}
public async Task<IResponseOutput> AddSubjectCancelDoctorNote(CancelDoctorCommand command)
{
await _subjectCanceDoctorRepository.InsertOrUpdateAsync(command, true);
return ResponseOutput.Ok();
}
public async Task<List<SubjectCancelDoctorView>> GetSubjectCancelDoctorHistoryList(Guid subjectId)
{
var list = await _subjectCanceDoctorRepository.Where(t => t.SubjectId == subjectId).ProjectTo<SubjectCancelDoctorView>(_mapper.ConfigurationProvider).ToListAsync();
return list;
}
/// <summary>
/// 获取访视任务 应用Subject后 医生比率情况
/// </summary>
/// <returns></returns>
[HttpPost]
[Obsolete]
public async Task<List<DoctorVisitTaskStatView>> GetSubjectApplyDoctorTaskStatList(ApplySubjectCommand assignConfirmCommand)
{
var taskAllocationRuleQueryable = _taskAllocationRuleRepository.Where(t => t.TrialId == assignConfirmCommand.TrialId && t.IsJudgeDoctor == assignConfirmCommand.IsJudgeDoctor)
@@ -115,6 +136,7 @@ namespace IRaCIS.Core.Application.Service
[HttpPost]
[Obsolete]
public async Task<(List<DoctorVisitTaskStatView>, object)> GetTaskAllocationRuleList(TaskAllocationRuleQuery queryTaskAllocationRule)
{
var taskAllocationRuleQueryable = _taskAllocationRuleRepository.Where(t => t.TrialId == queryTaskAllocationRule.TrialId /*&& t.IsJudgeDoctor == queryTaskAllocationRule.IsJudgeDoctor*/)
@@ -147,7 +169,7 @@ namespace IRaCIS.Core.Application.Service
UserCode = user.UserCode,
UserName = user.UserName,
UserTypeEnum = user.UserTypeRole.UserTypeEnum,
ReadingCategoryList=enroll.EnrollReadingCategoryList.Select(t=>t.ReadingCategory).ToList()
ReadingCategoryList = enroll.EnrollReadingCategoryList.Select(t => t.ReadingCategory).ToList()
};
@@ -159,7 +181,7 @@ namespace IRaCIS.Core.Application.Service
public async Task<List<TrialDoctorUserSelectView>> GetDoctorSelectList(DoctorSelectQuery selectQuery, [FromServices] IRepository<Enroll> _enrollRepository)
{
var query = from allocationRule in _taskAllocationRuleRepository.Where(t => t.TrialId == selectQuery.TrialId && t.IsEnable)
.WhereIf(selectQuery.ReadingCategory!=null,t=>t.Enroll.EnrollReadingCategoryList.Any(t=>t.ReadingCategory==selectQuery.ReadingCategory))
.WhereIf(selectQuery.ReadingCategory != null, t => t.Enroll.EnrollReadingCategoryList.Any(t => t.ReadingCategory == selectQuery.ReadingCategory))
join user in _userRepository.AsQueryable() on allocationRule.DoctorUserId equals user.Id
select new TrialDoctorUserSelectView()
{
@@ -121,9 +121,14 @@ namespace IRaCIS.Core.Application.Service
CreateMap<VisitTask, AnalysisTaskView>().IncludeBase<VisitTask, VisitTaskView>()
.ForMember(o => o.IsReReadingOrBackInfluenceAnalysis, t => t.MapFrom(u => u.Subject.IsReReadingOrBackInfluenceAnalysis));
CreateMap<CancelDoctorCommand, SubjectCanceDoctor>();
CreateMap<SubjectCanceDoctor, SubjectCancelDoctorView>();
CreateMap<VisitTaskReReading, ReReadingTaskView>()
.ForMember(o => o.ReReadingNewTaskCode, t => t.MapFrom(u => u.NewReReadingTask.TaskCode))