From 892b6ebffa540070a652f22726d826f685136ec3 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Wed, 8 Jun 2022 09:46:55 +0800
Subject: [PATCH] =?UTF-8?q?=E9=98=85=E7=89=87=E9=85=8D=E7=BD=AE=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../IRaCIS.Core.Application.xml | 8 +++++
.../DTO/TaskAllocationRuleViewModel.cs | 32 +++++++++++++----
.../Allocation/DTO/VisitTaskViewModel.cs | 6 ++--
.../Allocation/TaskAllocationRuleService.cs | 35 +++++++++++++++----
.../Service/Allocation/VisitTaskService.cs | 4 ++-
.../Service/Allocation/_MapConfig.cs | 11 +++++-
.../Allocation/TaskAllocationRule.cs | 30 ++++++++++------
IRaCIS.Core.Domain/Allocation/VisitTask.cs | 4 +--
IRaCIS.Core.Domain/Trial/Trial.cs | 3 +-
9 files changed, 102 insertions(+), 31 deletions(-)
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 3738c6821..4c0762f30 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -39,6 +39,14 @@
分配规则
+
+
+ 获取项目下 医生账户信息下拉
+
+
+
+
+
访视读片任务
diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs
index 80178273c..5f4851b64 100644
--- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs
+++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs
@@ -6,6 +6,8 @@
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+
namespace IRaCIS.Core.Application.ViewModel
{
/// TaskAllocationRuleView 列表视图模型
@@ -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; }
+
}
///TaskAllocationRuleQuery 列表查询参数模型
public class TaskAllocationRuleQuery
{
-
+ [NotDefault]
+ public Guid TrialId { get; set; }
}
/// TaskAllocationRuleAddOrEdit 列表查询参数模型
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; }
}
diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs
index 5ec8f85db..050b20cab 100644
--- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs
+++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs
@@ -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; }
}
diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs
index fb642100d..66016b216 100644
--- a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs
+++ b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs
@@ -18,19 +18,19 @@ namespace IRaCIS.Core.Application.Service
{
private readonly IRepository _taskAllocationRuleRepository;
+ private readonly IRepository _userRepository;
- public TaskAllocationRuleService(IRepository taskAllocationRuleRepository)
+ public TaskAllocationRuleService(IRepository taskAllocationRuleRepository, IRepository userRepository)
{
_taskAllocationRuleRepository = taskAllocationRuleRepository;
+ _userRepository = userRepository;
}
-
+ [HttpPost]
public async Task> GetTaskAllocationRuleList(TaskAllocationRuleQuery queryTaskAllocationRule)
{
-
-
- var taskAllocationRuleQueryable = _repository.GetQueryable()
- .ProjectTo(_mapper.ConfigurationProvider);
+ var taskAllocationRuleQueryable = _taskAllocationRuleRepository.Where(t=>t.TrialId== queryTaskAllocationRule.TrialId)
+ .ProjectTo(_mapper.ConfigurationProvider);
return await taskAllocationRuleQueryable.ToListAsync();
}
@@ -38,8 +38,13 @@ namespace IRaCIS.Core.Application.Service
public async Task AddOrUpdateTaskAllocationRule(TaskAllocationRuleAddOrEdit addOrEditTaskAllocationRule)
{
+ var verifyExp1 = new EntityVerifyExp()
+ {
+ 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();
}
+ ///
+ /// 获取项目下 医生账户信息下拉
+ ///
+ ///
+ ///
+ ///
+ [HttpGet("{trialId:guid}")]
+ public async Task> GetDoctorUserSelectList(Guid trialId,[FromServices] IRepository _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(_mapper.ConfigurationProvider).ToList();
+ }
+
}
}
diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs
index 54d523b82..a96ec91a9 100644
--- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs
+++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs
@@ -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(_mapper.ConfigurationProvider);
var defalutSortArray = new string[] { nameof(VisitTask.IsUrgent) + " desc", nameof(VisitTask.SubjectId) };
diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs
index ba1d83d42..c9415e71c 100644
--- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs
+++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs
@@ -11,7 +11,9 @@ namespace IRaCIS.Core.Application.Service
public AllocationConfig()
{
- CreateMap();
+ CreateMap()
+ .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()
.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();
+
+ CreateMap()
+ .ForMember(o => o.DoctorUserId, t => t.MapFrom(u => u.Id))
+ .ForMember(o => o.FullName, t => t.MapFrom(u => u.FullName));
+
+
}
}
diff --git a/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs b/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs
index 46e7ddb41..4980b544a 100644
--- a/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs
+++ b/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs
@@ -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; }
+
///
/// CreateUserId
///
@@ -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; }
///
/// IsEnable
@@ -54,17 +59,20 @@ namespace IRaCIS.Core.Domain.Models
[Required]
public bool IsEnable { get; set; }
- ///
- /// Arm 组
- ///
- [Required]
- public int GroupEnum { get; set; }
- ///
- /// 分配类型
- ///
- [Required]
- public int AllocationObjectEnum { get; set; }
+ public string Note { get; set; } = string.Empty;
+
+ /////
+ ///// Arm 组
+ /////
+ //[Required]
+ //public int GroupEnum { get; set; }
+
+ /////
+ ///// 分配类型
+ /////
+ //[Required]
+ //public int AllocationObjectEnum { get; set; }
}
diff --git a/IRaCIS.Core.Domain/Allocation/VisitTask.cs b/IRaCIS.Core.Domain/Allocation/VisitTask.cs
index c7982d95c..ea3b32211 100644
--- a/IRaCIS.Core.Domain/Allocation/VisitTask.cs
+++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs
@@ -108,9 +108,9 @@ namespace IRaCIS.Core.Domain.Models
///
- /// DoctorId
+ /// DoctorUserId
///
- public Guid? DoctorId { get; set; }
+ public Guid? DoctorUserId { get; set; }
}
diff --git a/IRaCIS.Core.Domain/Trial/Trial.cs b/IRaCIS.Core.Domain/Trial/Trial.cs
index 376c51342..a95cec3a8 100644
--- a/IRaCIS.Core.Domain/Trial/Trial.cs
+++ b/IRaCIS.Core.Domain/Trial/Trial.cs
@@ -15,8 +15,9 @@ namespace IRaCIS.Core.Domain.Models
TrialDicList = new List();
}
+ public List VisitTaskList { get; set; }=new List(){ };
- public List TrialSiteSurveyList { get; set; }
+ public List TrialSiteSurveyList { get; set; } = new List();
public List TrialDocumentList { get; set; }
public List EnrollList { get; set; }
public List WorkloadList { get; set; }