阅片配置表

Uat_Study
hang 2022-06-08 09:46:55 +08:00
parent 07b66f7afd
commit 892b6ebffa
9 changed files with 102 additions and 31 deletions

View File

@ -39,6 +39,14 @@
分配规则
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.TaskAllocationRuleService.GetDoctorUserSelectList(System.Guid,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Enroll})">
<summary>
获取项目下 医生账户信息下拉
</summary>
<param name="trialId"></param>
<param name="_enrollRepository"></param>
<returns></returns>
</member>
<member name="T:IRaCIS.Core.Application.Service.VisitTaskService">
<summary>
访视读片任务

View File

@ -6,6 +6,8 @@
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace IRaCIS.Core.Application.ViewModel
{
/// <summary> TaskAllocationRuleView 列表视图模型 </summary>
@ -17,24 +19,42 @@ namespace IRaCIS.Core.Application.ViewModel
public DateTime UpdateTime { get; set; }
public Guid UpdateUserId { get; set; }
public int? TotalTaskCount { get; set; }
public int? SelfTaskCount { get; set; }
}
///<summary>TaskAllocationRuleQuery 列表查询参数模型</summary>
public class TaskAllocationRuleQuery
{
[NotDefault]
public Guid TrialId { get; set; }
}
///<summary> TaskAllocationRuleAddOrEdit 列表查询参数模型</summary>
public class TaskAllocationRuleAddOrEdit
{
public Guid Id { get; set; }
public Guid? Id { get; set; }
public Guid TrialId { get; set; }
public int PlanReadingRatio { get; set; }
public Guid DoctorId { get; set; }
public Guid DoctorUserId { get; set; }
public bool IsEnable { get; set; }
public int GroupEnum { get; set; }
public int AllocationObjectEnum { get; set; }
public string Note { get; set; } = string.Empty;
}
public class TrialDoctorUserSelectView
{
public Guid DoctorUserId { get; set; }
public string UserCode { get; set; }
public string UserName { get; set; }
public string FullName { get; set; }
public UserTypeEnum UserTypeEnum { get; set; }
}

View File

@ -31,7 +31,7 @@ namespace IRaCIS.Core.Application.ViewModel
public string TaskCode { get; set; }
public bool IsUrgent { get; set; }
public int ArmEnum { get; set; }
public Guid? DoctorId { get; set; }
public Guid? DoctorUserId { get; set; }
@ -63,13 +63,15 @@ namespace IRaCIS.Core.Application.ViewModel
public string TaskName { get; set; } = String.Empty;
public Guid? DoctorId { get; set; }
public Guid? DoctorUserId { get; set; }
public ReadingCategory? ReadingCategory { get; set; }
public TaskState? TaskState { get; set; }
public DateTime? BeginAllocateDate { get; set; }
public DateTime? EndAllocateDate { get; set; }
}

View File

@ -18,19 +18,19 @@ namespace IRaCIS.Core.Application.Service
{
private readonly IRepository<TaskAllocationRule> _taskAllocationRuleRepository;
private readonly IRepository<User> _userRepository;
public TaskAllocationRuleService(IRepository<TaskAllocationRule> taskAllocationRuleRepository)
public TaskAllocationRuleService(IRepository<TaskAllocationRule> taskAllocationRuleRepository, IRepository<User> userRepository)
{
_taskAllocationRuleRepository = taskAllocationRuleRepository;
_userRepository = userRepository;
}
[HttpPost]
public async Task<List<TaskAllocationRuleView>> GetTaskAllocationRuleList(TaskAllocationRuleQuery queryTaskAllocationRule)
{
var taskAllocationRuleQueryable = _repository.GetQueryable<TaskAllocationRule>()
.ProjectTo<TaskAllocationRuleView>(_mapper.ConfigurationProvider);
var taskAllocationRuleQueryable = _taskAllocationRuleRepository.Where(t=>t.TrialId== queryTaskAllocationRule.TrialId)
.ProjectTo<TaskAllocationRuleView>(_mapper.ConfigurationProvider);
return await taskAllocationRuleQueryable.ToListAsync();
}
@ -38,8 +38,13 @@ namespace IRaCIS.Core.Application.Service
public async Task<IResponseOutput> AddOrUpdateTaskAllocationRule(TaskAllocationRuleAddOrEdit addOrEditTaskAllocationRule)
{
var verifyExp1 = new EntityVerifyExp<TaskAllocationRule>()
{
VerifyExp = t => t.DoctorUserId == addOrEditTaskAllocationRule.DoctorUserId,
VerifyMsg = "已有该医生配置,不允许继续增加"
};
var entity = await _taskAllocationRuleRepository.InsertOrUpdateAsync(addOrEditTaskAllocationRule, true);
var entity = await _taskAllocationRuleRepository.InsertOrUpdateAsync(addOrEditTaskAllocationRule, true, verifyExp1);
return ResponseOutput.Ok(entity.Id.ToString());
@ -55,6 +60,22 @@ namespace IRaCIS.Core.Application.Service
return ResponseOutput.Ok();
}
/// <summary>
/// 获取项目下 医生账户信息下拉
/// </summary>
/// <param name="trialId"></param>
/// <param name="_enrollRepository"></param>
/// <returns></returns>
[HttpGet("{trialId:guid}")]
public async Task<List<TrialDoctorUserSelectView>> GetDoctorUserSelectList(Guid trialId,[FromServices] IRepository<Enroll> _enrollRepository)
{
var query = from enroll in _enrollRepository.Where(t => t.TrialId == trialId)
join user in _userRepository.AsQueryable() on enroll.DoctorId equals user.DoctorId
select user;
return query.ProjectTo<TrialDoctorUserSelectView>(_mapper.ConfigurationProvider).ToList();
}
}
}

View File

@ -32,11 +32,13 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(queryVisitTask.SiteId != null, t => t.Subject.SiteId == queryVisitTask.SiteId)
.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId)
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
.WhereIf(queryVisitTask.DoctorId != null, t => t.DoctorId == queryVisitTask.DoctorId)
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId)
.WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory)
.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState)
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName))
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.Subject.Code.Contains(queryVisitTask.SubjectCode))
.WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime> queryVisitTask.BeginAllocateDate)
.WhereIf(queryVisitTask.EndAllocateDate != null, t => t.AllocateTime < queryVisitTask.EndAllocateDate.Value.AddDays(1))
.ProjectTo<VisitTaskView>(_mapper.ConfigurationProvider);
var defalutSortArray = new string[] { nameof(VisitTask.IsUrgent) + " desc", nameof(VisitTask.SubjectId) };

View File

@ -11,7 +11,9 @@ namespace IRaCIS.Core.Application.Service
public AllocationConfig()
{
CreateMap<TaskAllocationRule, TaskAllocationRuleView>();
CreateMap<TaskAllocationRule, TaskAllocationRuleView>()
.ForMember(o => o.TotalTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count()))
.ForMember(o => o.SelfTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t=>t.DoctorUserId==u.DoctorUserId)));
CreateMap<VisitTask, VisitTaskView>()
.ForMember(o => o.SiteId, t => t.MapFrom(u => u.Subject.SiteId))
@ -19,7 +21,14 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code));
CreateMap<TaskAllocationRuleAddOrEdit, TaskAllocationRule>();
CreateMap<User, TrialDoctorUserSelectView>()
.ForMember(o => o.DoctorUserId, t => t.MapFrom(u => u.Id))
.ForMember(o => o.FullName, t => t.MapFrom(u => u.FullName));
}
}

View File

@ -15,6 +15,11 @@ namespace IRaCIS.Core.Domain.Models
[Table("TaskAllocationRule")]
public class TaskAllocationRule : Entity, IAuditUpdate, IAuditAdd
{
public Trial Trial { get; set; }
public Guid TrialId { get; set; }
/// <summary>
/// CreateUserId
/// </summary>
@ -46,7 +51,7 @@ namespace IRaCIS.Core.Domain.Models
[Required]
public int PlanReadingRatio { get; set; }
public Guid DoctorId { get; set; }
public Guid DoctorUserId { get; set; }
/// <summary>
/// IsEnable
@ -54,17 +59,20 @@ namespace IRaCIS.Core.Domain.Models
[Required]
public bool IsEnable { get; set; }
/// <summary>
/// Arm 组
/// </summary>
[Required]
public int GroupEnum { get; set; }
/// <summary>
/// 分配类型
/// </summary>
[Required]
public int AllocationObjectEnum { get; set; }
public string Note { get; set; } = string.Empty;
///// <summary>
///// Arm 组
///// </summary>
//[Required]
//public int GroupEnum { get; set; }
///// <summary>
///// 分配类型
///// </summary>
//[Required]
//public int AllocationObjectEnum { get; set; }
}

View File

@ -108,9 +108,9 @@ namespace IRaCIS.Core.Domain.Models
/// <summary>
/// DoctorId
/// DoctorUserId
/// </summary>
public Guid? DoctorId { get; set; }
public Guid? DoctorUserId { get; set; }
}

View File

@ -15,8 +15,9 @@ namespace IRaCIS.Core.Domain.Models
TrialDicList = new List<TrialDictionary>();
}
public List<VisitTask> VisitTaskList { get; set; }=new List<VisitTask>(){ };
public List<TrialSiteSurvey> TrialSiteSurveyList { get; set; }
public List<TrialSiteSurvey> TrialSiteSurveyList { get; set; } = new List<TrialSiteSurvey>();
public List<TrialDocument> TrialDocumentList { get; set; }
public List<Enroll> EnrollList { get; set; }
public List<Workload> WorkloadList { get; set; }