From c0959bd04ea3a4018affba12a392e047f7880d83 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Mon, 13 Jun 2022 11:59:39 +0800
Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=88=86=E9=85=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../IRaCIS.Core.Application.xml | 14 +
.../Allocation/DTO/VisitTaskViewModel.cs | 24 ++
.../Allocation/VisitTaskHelpeService.cs | 108 ++++---
.../Service/Allocation/VisitTaskService.cs | 265 +++++++++++++++++-
.../Service/Allocation/_MapConfig.cs | 4 +
.../TrialSiteUser/DTO/TrialConfigDTO.cs | 9 +-
IRaCIS.Core.Domain/Trial/Trial.cs | 8 +
IRaCIS.Core.Domain/Visit/Subject.cs | 4 +-
8 files changed, 389 insertions(+), 47 deletions(-)
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index ce0c5eb9c..26d1de34f 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -76,6 +76,20 @@
+
+
+ 手动分配确认 绑定该Subject的已存在的任务给医生
+
+
+
+
+
+
+ 自动一次性分配所有未分配的 Subject 给医生
+
+
+
+
系统模板文档配置表
diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs
index 84f33fb15..e5f8ff98f 100644
--- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs
+++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs
@@ -109,8 +109,11 @@ namespace IRaCIS.Core.Application.ViewModel
public String TrialSiteCode { get; set; } = String.Empty;
public string SubjectCode { get; set; } = String.Empty;
+
public bool IsAssignDoctorUser { get; set; }
+
+
public List DoctorUserList { get; set; } = new List();
}
@@ -125,6 +128,8 @@ namespace IRaCIS.Core.Application.ViewModel
public string UserTypeShortName { get; set; }
public DateTime? AssignTime { get; set; }
+
+ public bool IsAssignDoctorApplyedTask { get; set; }
}
@@ -147,6 +152,25 @@ namespace IRaCIS.Core.Application.ViewModel
public List SubjectIdList { get; set; }
}
+
+ public class AssignConfirmCommand
+ {
+ public Guid TrialId { get; set; }
+
+ public List SubjectDoctorUserList { get; set; } = new List();
+ }
+
+ public class SubjectDoctorCommand
+ {
+ public Guid SubjectId { get; set; }
+
+ public List DoctorUserIdList { get; set; }
+ }
+
+ public class AutoSubjectAssignCommand
+ {
+ public Guid TrialId { get; set; }
+ }
}
diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs
index ab842e217..619b9a182 100644
--- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs
+++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs
@@ -48,7 +48,7 @@ namespace IRaCIS.Core.Application.Service
//以前访视未产生任务的,在查询这里要产生 后期维护到一块
- var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.ReadingType, t.TaskAllocateDefaultState, t.TaskAllocateObjEnum }).FirstOrDefaultAsync()).IfNullThrowException();
+ var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.ReadingType, t.IsFollowVisitAutoAssign, t.IsFollowGlobalVisitAutoAssign,t.FollowGlobalVisitAutoAssignDefaultState,t.FollowVisitAutoAssignDefaultState, t.TaskAllocateObjEnum }).FirstOrDefaultAsync()).IfNullThrowException();
var dbMaxCode = _visitTaskRepository.Where(t => t.TrialId == trialId).Select(t => t.Code).DefaultIfEmpty().Max();
@@ -106,41 +106,56 @@ namespace IRaCIS.Core.Application.Service
throw new BusinessValidationFailedException("能参与读片的医生数量必须大于2,自动分配任务中止");
}
- if (trialConfig.TaskAllocateDefaultState == TaskAllocateDefaultState.Allocated)
- {
- task1.TaskState = TaskState.Allocated;
- task2.TaskState = TaskState.Allocated;
- }
- else if (trialConfig.TaskAllocateDefaultState == TaskAllocateDefaultState.InitAllocated)
- {
- task1.TaskState = TaskState.InitAllocated;
- task2.TaskState = TaskState.InitAllocated;
- }
-
- if (trialConfig.TaskAllocateObjEnum == TaskAllocateObj.Subject)
+
+ if (trialConfig.TaskAllocateObjEnum == TaskAllocateObj.Subject )
{
- var allocateSubjectArmList = _visitTaskRepository.Where(t => t.SubjectId == subjectVisit.SubjectId && t.TrialId == subjectVisit.TrialId && t.DoctorUserId != null).Select(t => new { t.DoctorUserId, t.ArmEnum }).Distinct().ToList();
-
- //不是初次分配 直接分配给Subject 之前的医生
- if (allocateSubjectArmList.Count != 0)
+ if (trialConfig.IsFollowVisitAutoAssign )
{
+ var defaultState = trialConfig.FollowVisitAutoAssignDefaultState==TaskAllocateDefaultState.InitAllocated?TaskState.InitAllocated:TaskState.Allocated;
- if (allocateSubjectArmList.GroupBy(t => t.DoctorUserId).Any(g => g.Count() == 2))
+
+ task1.TaskState = defaultState;
+ task2.TaskState = defaultState;
+
+
+
+ var allocateSubjectArmList = _visitTaskRepository.Where(t => t.SubjectId == subjectVisit.SubjectId && t.TrialId == subjectVisit.TrialId && t.DoctorUserId != null).Select(t => new { t.DoctorUserId, t.ArmEnum }).Distinct().ToList();
+
+ //不是初次分配 直接分配给Subject 之前的医生
+ if (allocateSubjectArmList.Count != 0)
{
- throw new BusinessValidationFailedException("请确认是否改了配置,导致同一受试者 分配给同一个医生 在不同的Arm,无法完成自动分配");
+
+ if (allocateSubjectArmList.GroupBy(t => t.DoctorUserId).Any(g => g.Count() == 2))
+ {
+ throw new BusinessValidationFailedException("请确认是否改了配置,导致同一受试者 分配给同一个医生 在不同的Arm,无法完成自动分配");
+ }
+
+ //手动分配的时候 如果只分配了Arm1 没有分配Arm2 就会有问题
+ if (!(allocateSubjectArmList.Any(t => t.ArmEnum == 1) && allocateSubjectArmList.Any(t => t.ArmEnum == 2)))
+ {
+ throw new BusinessValidationFailedException("请确认是否改了配置,或者手动分配时,只分配了一个Arm ");
+ }
+
+
+ //分配给对应Arm的人
+ task1.DoctorUserId = allocateSubjectArmList.FirstOrDefault(t => t.ArmEnum == 1).DoctorUserId;
+ task2.DoctorUserId = allocateSubjectArmList.FirstOrDefault(t => t.ArmEnum == 2).DoctorUserId;
}
+ else
+ {
+ //后续Subect 不自动分配 不处理
+ return;
+ }
+ //else if (trialConfig.IsFollowGlobalVisitAutoAssign)
+ //{
+ // var defaultState = trialConfig.FollowVisitAutoAssignDefaultState == TaskAllocateDefaultState.InitAllocated ? TaskState.InitAllocated : TaskState.Allocated;
- //手动分配的时候 如果只分配了Arm1 没有分配Arm2 就会有问题
- if (!(allocateSubjectArmList.Any(t => t.ArmEnum == 1) && allocateSubjectArmList.Any(t => t.ArmEnum == 2)))
- {
- throw new BusinessValidationFailedException("请确认是否改了配置,或者手动分配时,只分配了一个Arm ");
- }
+ // task1.TaskState = defaultState;
+ // task2.TaskState = defaultState;
+ //}
- //分配给对应Arm的人
- task1.DoctorUserId = allocateSubjectArmList.FirstOrDefault(t => t.ArmEnum == 1).DoctorUserId;
- task2.DoctorUserId = allocateSubjectArmList.FirstOrDefault(t => t.ArmEnum == 2).DoctorUserId;
}
@@ -177,6 +192,8 @@ namespace IRaCIS.Core.Application.Service
ReadingCategory = ReadingCategory.Visit
});
+ singleTask.AllocateTime = DateTime.Now;
+
currentMaxCodeInt = currentMaxCodeInt + 1;
_provider.Set($"{trialId }_{ StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt + 1, TimeSpan.FromMinutes(30));
@@ -184,30 +201,37 @@ namespace IRaCIS.Core.Application.Service
#region 分配
if (isAssignSubjectToDoctor)
{
- if (trialConfig.TaskAllocateDefaultState == TaskAllocateDefaultState.Allocated)
- {
- singleTask.TaskState = TaskState.Allocated;
- }
- else if (trialConfig.TaskAllocateDefaultState == TaskAllocateDefaultState.InitAllocated)
- {
- singleTask.TaskState = TaskState.InitAllocated;
- }
+
if (trialConfig.TaskAllocateObjEnum == TaskAllocateObj.Subject)
{
- //该Subject 之前是否有已分配的 如果改变配置 可能会出现 一个Subject 分配的同一个医生 有的在Arm1 有的在Arm2
- var allocateSubjectArmList = _visitTaskRepository.Where(t => t.SubjectId == subjectVisit.SubjectId && t.TrialId == subjectVisit.TrialId && t.DoctorUserId != null).Select(t => new { t.DoctorUserId, t.ArmEnum }).Distinct().ToList();
- //不是初次分配
- if (allocateSubjectArmList.Count != 0)
+ if (trialConfig.IsFollowVisitAutoAssign)
{
- singleTask.DoctorUserId = allocateSubjectArmList.FirstOrDefault(t => t.ArmEnum == 0).DoctorUserId;
+ var defaultState = trialConfig.FollowVisitAutoAssignDefaultState == TaskAllocateDefaultState.InitAllocated ? TaskState.InitAllocated : TaskState.Allocated;
+
+ singleTask.TaskState = defaultState;
+
+ //该Subject 之前是否有已分配的 如果改变配置 可能会出现 一个Subject 分配的同一个医生 有的在Arm1 有的在Arm2
+ var allocateSubjectArmList = _visitTaskRepository.Where(t => t.SubjectId == subjectVisit.SubjectId && t.TrialId == subjectVisit.TrialId && t.DoctorUserId != null).Select(t => new { t.DoctorUserId, t.ArmEnum }).Distinct().ToList();
+
+ //不是初次分配
+ if (allocateSubjectArmList.Count != 0)
+ {
+ singleTask.DoctorUserId = allocateSubjectArmList.FirstOrDefault(t => t.ArmEnum == 0).DoctorUserId;
+
+ }
+ }
+ else
+ {
+ //后续Subect 不自动分配 不处理
+ return;
}
-
}
- singleTask.AllocateTime = DateTime.Now;
+
+
}
#endregion
diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs
index 00f76298f..fcfce3c94 100644
--- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs
+++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs
@@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Share;
+using IRaCIS.Core.Infrastructure;
namespace IRaCIS.Core.Application.Service
{
@@ -22,15 +23,17 @@ namespace IRaCIS.Core.Application.Service
private readonly IRepository _visitTaskRepository;
private readonly IRepository _trialRepository;
private readonly IRepository _subjectVisitRepository;
+ private readonly IRepository _taskAllocationRuleRepository;
private readonly IRepository _subjectRepository;
private readonly IRepository _subjectUserRepository;
public VisitTaskService(IRepository visitTaskRepository, IRepository trialRepository, IRepository subjectVisitRepository,
- IRepository subjectRepository, IRepository subjectUserRepository
+ IRepository subjectRepository, IRepository subjectUserRepository, IRepository taskAllocationRuleRepository
)
{
+ _taskAllocationRuleRepository = taskAllocationRuleRepository;
_visitTaskRepository = visitTaskRepository;
_trialRepository = trialRepository;
_subjectVisitRepository = subjectVisitRepository;
@@ -108,7 +111,7 @@ namespace IRaCIS.Core.Application.Service
{
await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = assginSubjectDoctorCommand.TrialId, SubjectId = subjectId, DoctorUserId = doctorUserId, AssignTime = DateTime.Now });
}
- await _subjectRepository.BatchUpdateNoTrackingAsync(t => t.Id == subjectId, u => new Subject() { IsAssignDoctorUser = true });
+ //await _subjectRepository.BatchUpdateNoTrackingAsync(t => t.Id == subjectId, u => new Subject() { IsAssignDoctorUser = true });
}
@@ -127,7 +130,7 @@ namespace IRaCIS.Core.Application.Service
foreach (var subjectId in cancelSubjectAssignCommand.SubjectIdList)
{
await _subjectUserRepository.DeleteFromQueryAsync(t => t.SubjectId == subjectId);
- await _subjectRepository.BatchUpdateNoTrackingAsync(t => t.Id == subjectId, u => new Subject() { IsAssignDoctorUser = false });
+ //await _subjectRepository.BatchUpdateNoTrackingAsync(t => t.Id == subjectId, u => new Subject() { IsAssignDoctorUser = false });
}
@@ -136,5 +139,261 @@ namespace IRaCIS.Core.Application.Service
return ResponseOutput.Ok();
}
+
+ ///
+ /// 手动分配确认 绑定该Subject的已存在的任务给医生
+ ///
+ ///
+ ///
+ [HttpPost]
+ [UnitOfWork]
+ public async Task ManualAssignDoctorApplyTask(AssignConfirmCommand assignConfirmCommand)
+ {
+ //需要确认的Subject
+ var subjectIdList = assignConfirmCommand.SubjectDoctorUserList.Select(t => t.SubjectId).ToList();
+
+ var taskList = _visitTaskRepository.Where(t => t.TrialId == assignConfirmCommand.TrialId && t.DoctorUserId == null, true)
+ .WhereIf(subjectIdList.Count() > 0, t => subjectIdList.Contains(t.SubjectId)).ToList();
+
+
+ foreach (var subjectTaskGroup in taskList.GroupBy(t => t.SubjectId))
+ {
+ var subjectId = subjectTaskGroup.Key;
+
+ var subjectDoctorIdList = assignConfirmCommand.SubjectDoctorUserList.Where(t => t.SubjectId == subjectId).First().DoctorUserIdList;
+
+ foreach (var task in subjectTaskGroup.OrderBy(t => t.ArmEnum).ToList())
+ {
+ //单重阅片
+ if (task.ArmEnum == 0)
+ {
+ if (subjectDoctorIdList.Count() == 0)
+ {
+ throw new BusinessValidationFailedException("当前提交的数据,有Subject 未绑定医生");
+ }
+
+ task.DoctorUserId = subjectDoctorIdList.FirstOrDefault();
+ }
+ //双重阅片 任务1
+ else if (task.ArmEnum == 1)
+ {
+ if (subjectDoctorIdList.Count() != 2)
+ {
+ throw new BusinessValidationFailedException("当前提交的数据,有Subject绑定的医生数量不是2个");
+ }
+
+ task.DoctorUserId = subjectDoctorIdList.FirstOrDefault();
+ }
+ else if (task.ArmEnum == 2)
+ {
+ task.DoctorUserId = subjectDoctorIdList.Skip(1).FirstOrDefault();
+ }
+
+ task.AllocateTime = DateTime.Now;
+ }
+ }
+ await _visitTaskRepository.SaveChangesAsync();
+
+ return ResponseOutput.Ok();
+ }
+
+ ///
+ /// 自动一次性分配所有未分配的 Subject 给医生
+ ///
+ ///
+ ///
+ [HttpPost]
+ [UnitOfWork]
+ public async Task AutoSubjectAssignDoctor(AutoSubjectAssignCommand autoSubjectAssignCommand)
+ {
+ //自动分配的话,需要把手动分配的给删掉
+
+
+
+ var trialId = autoSubjectAssignCommand.TrialId;
+
+
+ //获取所有的Subject 目前的分配情况
+ var subjectList = _subjectRepository.Where(t => t.TrialId == trialId).Select(t => new { SubjectId = t.Id, DoctorUserIdList = t.SubjectDoctorList.Select(t => t.DoctorUserId) }).ToList();
+
+ //受试者总数
+ var subjectCount = subjectList.Count();
+
+ //获取待分配的医生列表 指导分配医生的数量
+ var waitAllocationDoctorList = _taskAllocationRuleRepository.Where(t => t.TrialId == trialId && t.IsEnable)
+ .Select(t => new { t.DoctorUserId, t.PlanReadingRatio, Weight = (double)(subjectCount * t.PlanReadingRatio) % 100 })
+ .OrderByDescending(t => t.PlanReadingRatio).ThenByDescending(t => t.Weight);
+
+ //获取项目配置 判断应该分配几个医生
+ var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.ReadingType, t.IsFollowVisitAutoAssign, t.IsFollowGlobalVisitAutoAssign, t.FollowGlobalVisitAutoAssignDefaultState, t.TaskAllocateObjEnum }).FirstOrDefaultAsync()).IfNullThrowException();
+
+ //存放分配后Subject 医生的情况
+ var assignedSubjectDoctorList = subjectList.Clone().SelectMany(t => t.DoctorUserIdList.Select(c => new { t.SubjectId, DoctorUserId = c })).ToList();
+
+ //给医生分配Subject 前验证 已经分配的数据是否符合分配的规范
+ foreach (var doctor in waitAllocationDoctorList)
+ {
+
+ //该医生的目前已分配到的受试者
+ var hasAssignedSubjectIdList = assignedSubjectDoctorList.Where(t => t.DoctorUserId == doctor.DoctorUserId).Select(t => t.SubjectId).ToList();
+
+
+ //验证已经分配的Subject 是否 符合项目配置规范
+
+ foreach (var subjectId in hasAssignedSubjectIdList)
+ {
+ var hasAssignDoctorCount = subjectList.Where(t => t.SubjectId == subjectId).FirstOrDefault().DoctorUserIdList.Count();
+
+ //分配两个医生
+ if (trialConfig.ReadingType == ReadingMethod.Double)
+ {
+
+ if (hasAssignDoctorCount > 2)
+ {
+ throw new BusinessValidationFailedException("当前有Subject绑定医生数量大于2");
+ }
+
+ }
+ else if (trialConfig.ReadingType == ReadingMethod.Single)
+ {
+ if (hasAssignDoctorCount > 1)
+ {
+ throw new BusinessValidationFailedException("当前有Subject绑定医生数量大于1");
+ }
+ }
+ }
+
+ }
+
+ //验证通过 给医生开始分配
+
+ //eg : 10个Sujbect 都是1/4 先分配整数 再分配 10%4=2个
+
+ //不够分的subject数量 适用于 2个Subject 4个医生 这种
+ var specialSubjectCount = subjectCount % waitAllocationDoctorList.Count();
+
+ foreach (var doctor in waitAllocationDoctorList)
+ {
+
+
+ //该医生的目前已分配到的受试者
+ var hasAssignedSubjectIdList = assignedSubjectDoctorList.Where(t => t.DoctorUserId == doctor.DoctorUserId).Select(t => t.SubjectId).ToList();
+
+ //已分配的Subject 数量
+ var hasAssignedSubjectCount = hasAssignedSubjectIdList.Count();
+
+ //该医生计划分配到的Subject 最接近的整数数量
+ var planSubjectCount = (int)Math.Ceiling((double)(subjectCount * doctor.PlanReadingRatio) / 100);
+
+ //权重大的,将特殊的分配
+ if (doctor.Weight >= 50)
+ {
+ if (specialSubjectCount > 0)
+ {
+ specialSubjectCount--;
+
+ planSubjectCount++;
+ }
+
+ }
+
+ //如果计划的数量 大于已经分配的数量 那么该医生 可以分配新的Subject
+ if (planSubjectCount > hasAssignedSubjectCount)
+ {
+
+ //从未分配的Subjct找到可以分配的分配给该医生
+
+ var allAssignedSubjectIdList = assignedSubjectDoctorList.Select(t => t.SubjectId).ToList();
+
+ //取需要分配的数量 并且没有分配给其他医生的包括自己
+ var assignSubjectIdList = subjectList.Where(t => !allAssignedSubjectIdList.Contains(t.SubjectId)).Select(t => t.SubjectId).Take(planSubjectCount - hasAssignedSubjectCount).ToList();
+
+ foreach (var assignSubjectId in assignSubjectIdList)
+ {
+ //将分配结果记录
+ assignedSubjectDoctorList.Add(new { SubjectId = assignSubjectId, DoctorUserId = doctor.DoctorUserId });
+
+ await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = trialId, SubjectId = assignSubjectId, DoctorUserId = doctor.DoctorUserId, AssignTime = DateTime.Now });
+
+
+ }
+ }
+
+ }
+
+ //验证是否所有Subject 是否分配好
+
+ if (assignedSubjectDoctorList.Select(t => t.SubjectId).Count() != subjectCount)
+ {
+ throw new BusinessValidationFailedException("分配算法有问题,有Subject 未分配");
+ }
+
+
+ await _subjectUserRepository.SaveChangesAsync();
+
+ //如果是2个Subject 3个医生 这种 都是百分之33的比率
+ // 10 3
+
+
+
+
+
+ #region 按照Subject 遍历去分
+
+ //foreach (var subject in subjectList)
+ //{
+ // //该Subject 已经分配的医生数量
+ // var hasAssignDoctorCount = subject.DoctorUserIdList.Count();
+
+ // //分配两个医生
+ // if (trialConfig.ReadingType == ReadingMethod.Double)
+ // {
+ // //await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = trialId, SubjectId = subject.SubjectId, DoctorUserId = doctorUserId, AssignTime = DateTime.Now });
+
+
+ // if (hasAssignDoctorCount == 0)
+ // {
+
+
+
+ // }
+ // else if (hasAssignDoctorCount == 1)
+ // {
+
+ // }
+ // else if (hasAssignDoctorCount == 2)
+ // {
+
+ // }
+ // else
+ // {
+ // throw new BusinessValidationFailedException("当前有Subject绑定医生数量大于2");
+ // }
+
+ // }
+ // else if (trialConfig.ReadingType == ReadingMethod.Single)
+ // {
+ // if (hasAssignDoctorCount == 0)
+ // {
+
+ // }
+ // else if (hasAssignDoctorCount == 1)
+ // {
+
+ // }
+ // else
+ // {
+ // throw new BusinessValidationFailedException("当前有Subject绑定医生数量大于1");
+ // }
+ // }
+
+ //}
+
+
+ #endregion
+
+
+ return ResponseOutput.Ok();
+ }
}
}
diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs
index 3b81449c8..8e0d430f6 100644
--- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs
+++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs
@@ -45,6 +45,9 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.SubjectId, t => t.MapFrom(u => u.Id))
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.TrialSite.TrialSiteCode))
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Code))
+ .ForMember(o => o.IsAssignDoctorUser, t => t.MapFrom(u => u.SubjectDoctorList.Any()))
+
+
.ForMember(o => o.DoctorUserList, t => t.MapFrom(u => u.SubjectDoctorList.OrderByDescending(t=>t.UpdateTime)));
CreateMap()
@@ -52,6 +55,7 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode))
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName))
.ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName))
+ .ForMember(o => o.IsAssignDoctorApplyedTask, t => t.MapFrom(u => u.Subject.SubjectVisitTaskList.Any(c => c.DoctorUserId == u.DoctorUserId)))
.ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName));
diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs
index cb94921e7..dd4252dfe 100644
--- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs
+++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs
@@ -132,7 +132,14 @@ namespace IRaCIS.Core.Application.Contracts
public Guid TrialId { get; set; }
public TaskAllocateObj TaskAllocateObjEnum { get; set; }
- public TaskAllocateDefaultState TaskAllocateDefaultState { get; set; }
+ public bool IsFollowVisitAutoAssign { get; set; }
+
+ public bool IsFollowGlobalVisitAutoAssign { get; set; }
+
+ public TaskAllocateDefaultState FollowVisitAutoAssignDefaultState { get; set; }
+
+ public TaskAllocateDefaultState FollowGlobalVisitAutoAssignDefaultState { get; set; }
+
}
public class TrialUrgentConfig
diff --git a/IRaCIS.Core.Domain/Trial/Trial.cs b/IRaCIS.Core.Domain/Trial/Trial.cs
index a4aa1cfd8..a4d227f46 100644
--- a/IRaCIS.Core.Domain/Trial/Trial.cs
+++ b/IRaCIS.Core.Domain/Trial/Trial.cs
@@ -320,6 +320,14 @@ namespace IRaCIS.Core.Domain.Models
public TaskAllocateDefaultState TaskAllocateDefaultState { get; set; }
+ public bool IsFollowVisitAutoAssign { get; set; }
+
+ public bool IsFollowGlobalVisitAutoAssign { get; set; }
+
+ public TaskAllocateDefaultState FollowVisitAutoAssignDefaultState { get; set; }
+
+ public TaskAllocateDefaultState FollowGlobalVisitAutoAssignDefaultState { get; set; }
+
//public Guid? ReviewTypeId { get; set; } = Guid.Empty;
diff --git a/IRaCIS.Core.Domain/Visit/Subject.cs b/IRaCIS.Core.Domain/Visit/Subject.cs
index fd8f781cc..5979670ca 100644
--- a/IRaCIS.Core.Domain/Visit/Subject.cs
+++ b/IRaCIS.Core.Domain/Visit/Subject.cs
@@ -15,6 +15,8 @@ namespace IRaCIS.Core.Domain.Models
public List SubjectDoctorList { get; set; } = new List();
+ public List SubjectVisitTaskList { get; set; } = new List();
+
[ForeignKey("FinalSubjectVisitId")]
public SubjectVisit FinalSubjectVisit { get; set; }
@@ -90,6 +92,6 @@ namespace IRaCIS.Core.Domain.Models
public Guid? DeleteUserId { get; set; }
//是否分配了读片医生
- public bool IsAssignDoctorUser{get;set;}
+ //public bool IsAssignDoctorUser{get;set;}
}
}