From 5944393392ab29d84c1d08e275b7e950b9d352bf Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Thu, 7 Jul 2022 14:03:31 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8C=BB=E5=AD=A6=E5=AE=A1=E6=A0=B8=E5=88=97?=
=?UTF-8?q?=E8=A1=A8=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../IRaCIS.Core.Application.xml | 20 ++-
.../DTO/TaskMedicalReviewViewModel.cs | 21 +++
.../TaskMedicalReviewRuleService.cs | 122 +++++++++++++++++-
.../Allocation/TaskMedicalReviewService.cs | 113 ----------------
.../Service/Allocation/_MapConfig.cs | 6 +-
5 files changed, 161 insertions(+), 121 deletions(-)
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 9b1403c4f..dc15f6347 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -88,9 +88,15 @@
- 医学审核生成规则
+ 医学审核生成规则 废弃
+
+
+ 产生医学审核
+
+
+
任务医学审核
@@ -103,10 +109,18 @@
-
+
- 产生医学审核任务
+ 产生医学审核列表
+
+
+
+
+
+ 手动生成并分配医学审核
+
+
diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskMedicalReviewViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskMedicalReviewViewModel.cs
index a512508b4..a97c48de1 100644
--- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskMedicalReviewViewModel.cs
+++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskMedicalReviewViewModel.cs
@@ -36,7 +36,28 @@ namespace IRaCIS.Core.Application.ViewModel
public class GenerateMedicalReviewTaskView : VisitTaskViewBasic
{
+ //开始读片时间
+ public DateTime? FirstReadingTime { get; set; }
+ //读片时间差
+ public TimeSpan? ReadingDurationTimeSpan { get; set; }
+
+ //时间差 换成字符串
+ public string ReadingDuration
+ {
+ get
+ {
+ if (!ReadingDurationTimeSpan.HasValue )
+ return "";
+ else return /*string.Format("{0}天{1}小时{2}分钟", (SignTime - FirstReadingTime)?.Days, (SignTime - FirstReadingTime)?.Hours, (SignTime - FirstReadingTime)?.Minutes)*/
+ string.Format("{0}分钟", (ReadingDurationTimeSpan)?.TotalMinutes);
+ }
+ }
+
+ //是否产生裁判
+ public bool IsGenerateJudge { get; set; }
+
+ //审核次数
public int? GeneratedMedicalReviewCount { get; set; }
public UserSimpleInfo DoctorUser { get; set; }
}
diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewRuleService.cs
index 0d8a83412..55907a34f 100644
--- a/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewRuleService.cs
+++ b/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewRuleService.cs
@@ -11,17 +11,18 @@ using IRaCIS.Core.Application.ViewModel;
namespace IRaCIS.Core.Application.Service
{
///
- /// 医学审核生成规则
+ /// 医学审核生成规则 废弃
///
[ApiExplorerSettings(GroupName = "Trial")]
public class TaskMedicalReviewRuleService : BaseService, ITaskMedicalReviewRuleService
{
private readonly IRepository _taskMedicalReviewRuleRepository;
-
- public TaskMedicalReviewRuleService(IRepository taskMedicalReviewRuleRepository)
+ private readonly IRepository _taskMedicalReviewRepository;
+ public TaskMedicalReviewRuleService(IRepository taskMedicalReviewRuleRepository,IRepository taskMedicalReviewRepository)
{
_taskMedicalReviewRuleRepository = taskMedicalReviewRuleRepository;
+ _taskMedicalReviewRepository = taskMedicalReviewRepository;
}
@@ -68,6 +69,121 @@ namespace IRaCIS.Core.Application.Service
return ResponseOutput.Ok();
}
+ ///
+ /// 产生医学审核
+ ///
+ ///
+ [Obsolete]
+ public async Task GenerateMedicalReviewTask(GenerateMedicalReviewTaskCommand generateCommand)
+ {
+ var trialId = generateCommand.TrialId;
+
+ //var mimUserList = await _trialUserRepository.Where(t => t.User.UserTypeEnum == Domain.Share.UserTypeEnum.MIM && t.TrialId == trialId).Select(t => t.User).ProjectTo(_mapper.ConfigurationProvider).ToListAsync();
+
+
+
+ Guid? defalutMIMUserId = null /*mimUserList.FirstOrDefault()?.UserId*/;
+
+ //获取当前医生数据 已经生成的,和配置的数量
+ var taskTaskMedicalReviewRuleList = await _taskMedicalReviewRuleRepository.Where(t => t.TrialId == trialId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync();
+
+ foreach (var item in taskTaskMedicalReviewRuleList)
+ {
+
+ if (item.IsEnable)
+ {
+
+ if (item.PlanGlobalCount > item.GeneratedGlobalCount)
+ {
+ var needGenerateCount = item.PlanGlobalCount - item.GeneratedGlobalCount;
+
+ var canGenerateCount = item.ActualGlobalCount - item.GeneratedGlobalCount;
+
+ var toGenerateCount = canGenerateCount > needGenerateCount ? needGenerateCount : canGenerateCount;
+
+ //分配给MIM
+
+ if (toGenerateCount > 0)
+ {
+ var toGenerateTaskList = item.ActualGlobalTaskList.ExceptBy(item.GeneratedGlobalTaskList.Select(t => t.TaskId), t => t.TaskId).Take(toGenerateCount).ToList();
+
+ foreach (var toGenerateTask in toGenerateTaskList)
+ {
+ await _taskMedicalReviewRepository.AddAsync(new TaskMedicalReview() { DoctorUserId = (Guid)toGenerateTask.DoctorUserId, TrialId = toGenerateTask.TrialId, VisitTaskId = toGenerateTask.TaskId, MedicalManagerUserId = defalutMIMUserId });
+ }
+ }
+
+
+ }
+ if (item.PlanJudgeCount > item.GeneratedJudgeCount)
+ {
+ var needGenerateCount = item.PlanJudgeCount - item.GeneratedJudgeCount;
+
+ var canGenerateCount = item.ActualJudgeCount - item.GeneratedGlobalCount;
+
+ var toGenerateCount = canGenerateCount > needGenerateCount ? needGenerateCount : canGenerateCount;
+
+ if (toGenerateCount > 0)
+ {
+ var toGenerateTaskList = item.ActualJudgeTaskList.ExceptBy(item.GeneratedJudgeTaskList.Select(t => t.TaskId), t => t.TaskId).Take(toGenerateCount).ToList();
+
+ foreach (var toGenerateTask in toGenerateTaskList)
+ {
+ await _taskMedicalReviewRepository.AddAsync(new TaskMedicalReview() { DoctorUserId = (Guid)toGenerateTask.DoctorUserId, TrialId = toGenerateTask.TrialId, VisitTaskId = toGenerateTask.TaskId, MedicalManagerUserId = defalutMIMUserId });
+ }
+ }
+
+ }
+ if (item.PlanTumorCount > item.GeneratedTumorCount)
+ {
+ var needGenerateCount = item.PlanTumorCount - item.GeneratedTumorCount;
+
+ var canGenerateCount = item.ActualTumorCount - item.GeneratedGlobalCount;
+
+ var toGenerateCount = canGenerateCount > needGenerateCount ? needGenerateCount : canGenerateCount;
+
+ if (toGenerateCount > 0)
+ {
+ var toGenerateTaskList = item.ActualTumorTaskList.ExceptBy(item.GeneratedTumorTaskList.Select(t => t.TaskId), t => t.TaskId).Take(toGenerateCount).ToList();
+
+ foreach (var toGenerateTask in toGenerateTaskList)
+ {
+ await _taskMedicalReviewRepository.AddAsync(new TaskMedicalReview() { DoctorUserId = (Guid)toGenerateTask.DoctorUserId, TrialId = toGenerateTask.TrialId, VisitTaskId = toGenerateTask.TaskId, MedicalManagerUserId = defalutMIMUserId });
+ }
+ }
+
+ }
+ if (item.PlanVisitCount > item.GeneratedVisitCount)
+ {
+ var needGenerateCount = item.PlanVisitCount - item.GeneratedVisitCount;
+
+ var canGenerateCount = item.ActualVisitCount - item.GeneratedGlobalCount;
+
+ var toGenerateCount = canGenerateCount > needGenerateCount ? needGenerateCount : canGenerateCount;
+
+ if (toGenerateCount > 0)
+ {
+
+ var toGenerateTaskList = item.ActualVisitTaskList.ExceptBy(item.GeneratedVisitTaskList.Select(t => t.TaskId), t => t.TaskId).Take(toGenerateCount).ToList();
+
+ foreach (var toGenerateTask in toGenerateTaskList)
+ {
+ await _taskMedicalReviewRepository.AddAsync(new TaskMedicalReview() { DoctorUserId = (Guid)toGenerateTask.DoctorUserId, TrialId = toGenerateTask.TrialId, VisitTaskId = toGenerateTask.TaskId, MedicalManagerUserId = defalutMIMUserId });
+ }
+ }
+
+ }
+
+ }
+
+ }
+
+
+ await _taskMedicalReviewRepository.SaveChangesAsync();
+ return ResponseOutput.Ok();
+
+ }
+
}
}
diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs
index 4c9112562..720945944 100644
--- a/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs
+++ b/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs
@@ -113,120 +113,7 @@ namespace IRaCIS.Core.Application.Service
}
- ///
- /// 产生医学审核
- ///
- ///
- [Obsolete]
- public async Task GenerateMedicalReviewTask(GenerateMedicalReviewTaskCommand generateCommand)
- {
- var trialId = generateCommand.TrialId;
- //var mimUserList = await _trialUserRepository.Where(t => t.User.UserTypeEnum == Domain.Share.UserTypeEnum.MIM && t.TrialId == trialId).Select(t => t.User).ProjectTo(_mapper.ConfigurationProvider).ToListAsync();
-
-
-
- Guid? defalutMIMUserId = null /*mimUserList.FirstOrDefault()?.UserId*/;
-
- //获取当前医生数据 已经生成的,和配置的数量
- var taskTaskMedicalReviewRuleList = await _taskMedicalReviewRuleRepository.Where(t => t.TrialId == trialId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync();
-
- foreach (var item in taskTaskMedicalReviewRuleList)
- {
-
- if (item.IsEnable)
- {
-
- if (item.PlanGlobalCount > item.GeneratedGlobalCount)
- {
- var needGenerateCount = item.PlanGlobalCount - item.GeneratedGlobalCount;
-
- var canGenerateCount = item.ActualGlobalCount - item.GeneratedGlobalCount;
-
- var toGenerateCount = canGenerateCount > needGenerateCount ? needGenerateCount : canGenerateCount;
-
- //分配给MIM
-
- if (toGenerateCount > 0)
- {
- var toGenerateTaskList = item.ActualGlobalTaskList.ExceptBy(item.GeneratedGlobalTaskList.Select(t => t.TaskId), t => t.TaskId).Take(toGenerateCount).ToList();
-
- foreach (var toGenerateTask in toGenerateTaskList)
- {
- await _taskMedicalReviewRepository.AddAsync(new TaskMedicalReview() { DoctorUserId = (Guid)toGenerateTask.DoctorUserId, TrialId = toGenerateTask.TrialId, VisitTaskId = toGenerateTask.TaskId, MedicalManagerUserId = defalutMIMUserId });
- }
- }
-
-
- }
- if (item.PlanJudgeCount > item.GeneratedJudgeCount)
- {
- var needGenerateCount = item.PlanJudgeCount - item.GeneratedJudgeCount;
-
- var canGenerateCount = item.ActualJudgeCount - item.GeneratedGlobalCount;
-
- var toGenerateCount = canGenerateCount > needGenerateCount ? needGenerateCount : canGenerateCount;
-
- if (toGenerateCount > 0)
- {
- var toGenerateTaskList = item.ActualJudgeTaskList.ExceptBy(item.GeneratedJudgeTaskList.Select(t => t.TaskId), t => t.TaskId).Take(toGenerateCount).ToList();
-
- foreach (var toGenerateTask in toGenerateTaskList)
- {
- await _taskMedicalReviewRepository.AddAsync(new TaskMedicalReview() { DoctorUserId = (Guid)toGenerateTask.DoctorUserId, TrialId = toGenerateTask.TrialId, VisitTaskId = toGenerateTask.TaskId, MedicalManagerUserId = defalutMIMUserId });
- }
- }
-
- }
- if (item.PlanTumorCount > item.GeneratedTumorCount)
- {
- var needGenerateCount = item.PlanTumorCount - item.GeneratedTumorCount;
-
- var canGenerateCount = item.ActualTumorCount - item.GeneratedGlobalCount;
-
- var toGenerateCount = canGenerateCount > needGenerateCount ? needGenerateCount : canGenerateCount;
-
- if (toGenerateCount > 0)
- {
- var toGenerateTaskList = item.ActualTumorTaskList.ExceptBy(item.GeneratedTumorTaskList.Select(t => t.TaskId), t => t.TaskId).Take(toGenerateCount).ToList();
-
- foreach (var toGenerateTask in toGenerateTaskList)
- {
- await _taskMedicalReviewRepository.AddAsync(new TaskMedicalReview() { DoctorUserId = (Guid)toGenerateTask.DoctorUserId, TrialId = toGenerateTask.TrialId, VisitTaskId = toGenerateTask.TaskId, MedicalManagerUserId = defalutMIMUserId });
- }
- }
-
- }
- if (item.PlanVisitCount > item.GeneratedVisitCount)
- {
- var needGenerateCount = item.PlanVisitCount - item.GeneratedVisitCount;
-
- var canGenerateCount = item.ActualVisitCount - item.GeneratedGlobalCount;
-
- var toGenerateCount = canGenerateCount > needGenerateCount ? needGenerateCount : canGenerateCount;
-
- if (toGenerateCount > 0)
- {
-
- var toGenerateTaskList = item.ActualVisitTaskList.ExceptBy(item.GeneratedVisitTaskList.Select(t => t.TaskId), t => t.TaskId).Take(toGenerateCount).ToList();
-
- foreach (var toGenerateTask in toGenerateTaskList)
- {
- await _taskMedicalReviewRepository.AddAsync(new TaskMedicalReview() { DoctorUserId = (Guid)toGenerateTask.DoctorUserId, TrialId = toGenerateTask.TrialId, VisitTaskId = toGenerateTask.TaskId, MedicalManagerUserId = defalutMIMUserId });
- }
- }
-
- }
-
- }
-
- }
-
-
- await _taskMedicalReviewRepository.SaveChangesAsync();
- return ResponseOutput.Ok();
-
- }
///
diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs
index f99828cc3..017cae49c 100644
--- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs
+++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs
@@ -156,8 +156,10 @@ namespace IRaCIS.Core.Application.Service
CreateMap()
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.IsAnalysisCreate ? u.BlindTrialSiteCode : u.Subject.TrialSite.TrialSiteCode))
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.IsAnalysisCreate ? u.BlindSubjectCode : u.Subject.Code))
- .ForMember(o => o.GeneratedMedicalReviewCount, t => t.MapFrom(u => u.TaskMedicalReviewList.Count()))
- ;
+ .ForMember(o => o.GeneratedMedicalReviewCount, t => t.MapFrom(u => u.TaskMedicalReviewList.Count()))
+ .ForMember(o => o.IsGenerateJudge, t => t.MapFrom(u => u.JudgeVisitTaskId !=null))
+ .ForMember(o => o.ReadingDurationTimeSpan, t => t.MapFrom(u => u.SignTime - u.FirstReadingTime))
+ ;
CreateMap()