From a25cb0827bd71435bfd5014e708747e781fab260 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Tue, 7 Jun 2022 15:47:02 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AE=BF=E8=A7=86=E9=98=85=E7=89=87=E4=BB=BB?=
=?UTF-8?q?=E5=8A=A1=E7=94=9F=E6=88=90=E5=92=8C=E5=88=97=E8=A1=A8=E5=B1=95?=
=?UTF-8?q?=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../IRaCIS.Core.Application.xml | 92 +++++++++-----
.../Allocation/DTO/AllocationListDTO.cs | 37 ++++++
.../DTO/TaskAllocationRuleViewModel.cs | 43 +++++++
.../Allocation/DTO/VisitTaskViewModel.cs | 77 ++++++++++++
.../Interface/ITaskAllocationRuleService.cs | 25 ++++
.../Allocation/TaskAllocationRuleService.cs | 60 +++++++++
.../Service/Allocation/VisitTaskService.cs | 53 ++++++++
.../Service/Allocation/_MapConfig.cs | 26 ++++
.../Service/QC/DTO/QCListViewModel.cs | 3 +-
.../Service/Reading/Dto/GetReadModuleDto.cs | 34 ++++-
.../Service/Reading/ReadModuleService.cs | 5 +-
.../Triggers/SubjectVisitFinalVisitTrigger.cs | 2 -
.../Triggers/SubjectVisitPassedTrigger.cs | 87 +++++++++++++
.../Allocation/AllocationRelation.cs | 24 ++++
.../Allocation/TaskAllocationRule.cs | 71 +++++++++++
IRaCIS.Core.Domain/Allocation/VisitTask.cs | 117 ++++++++++++++++++
IRaCIS.Core.Domain/Trial/DataInspection.cs | 30 +++--
IRaCIS.Core.Domain/_Config/_AppSettings.cs | 4 +
IRaCIS.Core.Domain/_Config/_StaticData.cs | 2 +
.../Context/IRaCISDBContext.cs | 2 +
IRaCIS.Core.Test/DbHelper.ttinclude | 6 +-
21 files changed, 750 insertions(+), 50 deletions(-)
create mode 100644 IRaCIS.Core.Application/Service/Allocation/DTO/AllocationListDTO.cs
create mode 100644 IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs
create mode 100644 IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs
create mode 100644 IRaCIS.Core.Application/Service/Allocation/Interface/ITaskAllocationRuleService.cs
create mode 100644 IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs
create mode 100644 IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs
create mode 100644 IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs
create mode 100644 IRaCIS.Core.Application/Triggers/SubjectVisitPassedTrigger.cs
create mode 100644 IRaCIS.Core.Domain.Share/Allocation/AllocationRelation.cs
create mode 100644 IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs
create mode 100644 IRaCIS.Core.Domain/Allocation/VisitTask.cs
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 8b6af37c1..9b4f5741e 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -34,6 +34,16 @@
主要为了 处理项目结束 锁库,不允许操作
+
+
+ TaskAllocationRuleService
+
+
+
+
+ VisitTaskService
+
+
系统模板文档配置表
@@ -1018,6 +1028,18 @@
文件保存路径
+
+ TaskAllocationRuleView 列表视图模型
+
+
+ TaskAllocationRuleQuery 列表查询参数模型
+
+
+ TaskAllocationRuleAddOrEdit 列表查询参数模型
+
+
+ VisitTaskView 列表视图模型
+
CommonDocumentView 列表视图模型
@@ -1205,6 +1227,41 @@
TrialUserPreparation AddOrEdit 列表查询参数模型
+
+
+ ITaskAllocationRuleService
+
+
+
+
+ ICommonDocumentService
+
+
+
+
+ IFrontAuditConfigService
+
+
+
+
+ ISystemAnonymizationService
+
+
+
+
+ ISystemNoticeService
+
+
+
+
+ ITrialExternalUserService
+
+
+
+
+ ITrialUserPreparation Service
+
+
EmailNoticeConfigView 列表视图模型
@@ -1751,36 +1808,6 @@
是否有 入组评估确认
-
-
- ICommonDocumentService
-
-
-
-
- IFrontAuditConfigService
-
-
-
-
- ISystemAnonymizationService
-
-
-
-
- ISystemNoticeService
-
-
-
-
- ITrialExternalUserService
-
-
-
-
- ITrialUserPreparation Service
-
-
SystemBasicDataService
@@ -2415,6 +2442,11 @@
处理 访视 末次评估 会影响Subject 状态
+
+
+ 处理 访视 末次评估 会影响Subject 状态
+
+
处理 访视 1、提交状态 2、执行状态 3、最早最晚 拍片日期
diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/AllocationListDTO.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/AllocationListDTO.cs
new file mode 100644
index 000000000..7d7be92bf
--- /dev/null
+++ b/IRaCIS.Core.Application/Service/Allocation/DTO/AllocationListDTO.cs
@@ -0,0 +1,37 @@
+using IRaCIS.Core.Domain.Share;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace IRaCIS.Core.Application.Service.Allocation.DTO
+{
+ public class AllocationVisitViewModel
+ {
+
+ public Guid SubjectVisitId { get; set; }
+ public Guid SubjectId { get; set; }
+
+ public string BlindName { get; set; } = string.Empty;
+
+ public decimal VisitNum { get; set; }
+
+
+ public Guid SiteId { get; set; }
+ public String TrialSiteCode { get; set; } = String.Empty;
+ public string SubjectCode { get; set; } = String.Empty;
+
+ public string VisitName { get; set; } = string.Empty;
+
+ public DateTime? CheckPassedTime { get; set; }
+
+ public bool IsUrgent { get; set; }
+
+
+ public ReadingCategory ReadingCategoryEnum { get; set; }
+
+
+
+ }
+}
diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs
new file mode 100644
index 000000000..80178273c
--- /dev/null
+++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs
@@ -0,0 +1,43 @@
+//--------------------------------------------------------------------
+// 此代码由T4模板自动生成 byzhouhang 20210918
+// 生成时间 2022-06-07 13:16:33
+// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
+//--------------------------------------------------------------------
+using System;
+using IRaCIS.Core.Domain.Share;
+using System.Collections.Generic;
+namespace IRaCIS.Core.Application.ViewModel
+{
+ /// TaskAllocationRuleView 列表视图模型
+ public class TaskAllocationRuleView : TaskAllocationRuleAddOrEdit
+ {
+
+ public Guid CreateUserId { get; set; }
+ public DateTime CreateTime { get; set; }
+ public DateTime UpdateTime { get; set; }
+ public Guid UpdateUserId { get; set; }
+
+ }
+
+ ///TaskAllocationRuleQuery 列表查询参数模型
+ public class TaskAllocationRuleQuery
+ {
+
+ }
+
+ /// TaskAllocationRuleAddOrEdit 列表查询参数模型
+ public class TaskAllocationRuleAddOrEdit
+ {
+ public Guid Id { get; set; }
+
+ public int PlanReadingRatio { get; set; }
+ public Guid DoctorId { get; set; }
+ public bool IsEnable { get; set; }
+ public int GroupEnum { get; set; }
+ public int AllocationObjectEnum { get; set; }
+ }
+
+
+}
+
+
diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs
new file mode 100644
index 000000000..be4be5bf5
--- /dev/null
+++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs
@@ -0,0 +1,77 @@
+//--------------------------------------------------------------------
+// 此代码由T4模板自动生成 byzhouhang 20210918
+// 生成时间 2022-06-07 14:10:54
+// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
+//--------------------------------------------------------------------
+using System;
+using IRaCIS.Core.Domain.Share;
+using System.Collections.Generic;
+namespace IRaCIS.Core.Application.ViewModel
+{
+ /// VisitTaskView 列表视图模型
+ public class VisitTaskView
+ {
+ public Guid Id { get; set; }
+ public Guid TrialId { get; set; }
+
+ public string TaskName { get; set; }
+ public string TaskBlindName { get; set; }
+
+ public ReadingCategory ReadingCategory { get; set; }
+
+ public TaskState TaskState { get; set; }
+
+
+ public DateTime? CheckPassedTime { get; set; }
+ public DateTime? AllocateTime { get; set; }
+ public Guid SubjectId { get; set; }
+ public int Code { get; set; }
+
+ public string TaskCode { get; set; }
+ public bool IsUrgent { get; set; }
+ public int ArmEnum { get; set; }
+ public Guid? DoctorId { get; set; }
+
+
+
+ public Guid CreateUserId { get; set; }
+ public DateTime CreateTime { get; set; }
+ public DateTime UpdateTime { get; set; }
+ public Guid UpdateUserId { get; set; }
+
+
+ public Guid SiteId { get; set; }
+ public String TrialSiteCode { get; set; } = String.Empty;
+ public string SubjectCode { get; set; } = String.Empty;
+ }
+
+
+
+ public class VisitTaskQuery : PageInput
+ {
+ public Guid TrialId { get; set; }
+
+ public Guid? SiteId { get; set; }
+
+ public Guid? SubjectId { get; set; }
+
+ public string SubjectCode { get; set; } = String.Empty;
+
+ public bool? IsUrgent { get; set; }
+
+ public string TaskName { get; set; } = String.Empty;
+
+ public Guid? DoctorId { get; set; }
+
+ public ReadingCategory? ReadingCategory { get; set; }
+
+ public TaskState? TaskState { get; set; }
+
+
+ }
+
+
+
+}
+
+
diff --git a/IRaCIS.Core.Application/Service/Allocation/Interface/ITaskAllocationRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/Interface/ITaskAllocationRuleService.cs
new file mode 100644
index 000000000..a7f46ba9a
--- /dev/null
+++ b/IRaCIS.Core.Application/Service/Allocation/Interface/ITaskAllocationRuleService.cs
@@ -0,0 +1,25 @@
+//--------------------------------------------------------------------
+// 此代码由T4模板自动生成 byzhouhang 20210918
+// 生成时间 2022-06-07 13:13:19
+// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
+//--------------------------------------------------------------------
+
+using IRaCIS.Core.Application.ViewModel;
+namespace IRaCIS.Core.Application.Interfaces
+{
+ ///
+ /// ITaskAllocationRuleService
+ ///
+ public interface ITaskAllocationRuleService
+ {
+
+
+ Task> GetTaskAllocationRuleList(TaskAllocationRuleQuery queryTaskAllocationRule);
+
+ Task AddOrUpdateTaskAllocationRule(TaskAllocationRuleAddOrEdit addOrEditTaskAllocationRule);
+
+ Task DeleteTaskAllocationRule(Guid taskAllocationRuleId);
+
+
+ }
+}
diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs
new file mode 100644
index 000000000..fb642100d
--- /dev/null
+++ b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs
@@ -0,0 +1,60 @@
+//--------------------------------------------------------------------
+// 此代码由T4模板自动生成 byzhouhang 20210918
+// 生成时间 2022-06-07 13:14:38
+// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
+//--------------------------------------------------------------------
+
+using IRaCIS.Core.Domain.Models;
+using Microsoft.AspNetCore.Mvc;
+using IRaCIS.Core.Application.Interfaces;
+using IRaCIS.Core.Application.ViewModel;
+namespace IRaCIS.Core.Application.Service
+{
+ ///
+ /// 分配规则
+ ///
+ [ApiExplorerSettings(GroupName = "Trial")]
+ public class TaskAllocationRuleService : BaseService, ITaskAllocationRuleService
+ {
+
+ private readonly IRepository _taskAllocationRuleRepository;
+
+ public TaskAllocationRuleService(IRepository taskAllocationRuleRepository)
+ {
+ _taskAllocationRuleRepository = taskAllocationRuleRepository;
+ }
+
+
+ public async Task> GetTaskAllocationRuleList(TaskAllocationRuleQuery queryTaskAllocationRule)
+ {
+
+
+ var taskAllocationRuleQueryable = _repository.GetQueryable()
+ .ProjectTo(_mapper.ConfigurationProvider);
+
+ return await taskAllocationRuleQueryable.ToListAsync();
+ }
+
+
+ public async Task AddOrUpdateTaskAllocationRule(TaskAllocationRuleAddOrEdit addOrEditTaskAllocationRule)
+ {
+
+ var entity = await _taskAllocationRuleRepository.InsertOrUpdateAsync(addOrEditTaskAllocationRule, true);
+
+ return ResponseOutput.Ok(entity.Id.ToString());
+
+ }
+
+
+ [HttpDelete("{taskAllocationRuleId:guid}")]
+ public async Task DeleteTaskAllocationRule(Guid taskAllocationRuleId)
+ {
+ var success = await _taskAllocationRuleRepository.DeleteFromQueryAsync(t => t.Id == taskAllocationRuleId, true);
+
+
+ return ResponseOutput.Ok();
+ }
+
+
+ }
+}
diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs
new file mode 100644
index 000000000..9a98f4ef1
--- /dev/null
+++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs
@@ -0,0 +1,53 @@
+//--------------------------------------------------------------------
+// 此代码由T4模板自动生成 byzhouhang 20210918
+// 生成时间 2022-06-07 14:10:49
+// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
+//--------------------------------------------------------------------
+
+using IRaCIS.Core.Domain.Models;
+using Microsoft.AspNetCore.Mvc;
+using IRaCIS.Core.Application.Interfaces;
+using IRaCIS.Core.Application.ViewModel;
+namespace IRaCIS.Core.Application.Service
+{
+ ///
+ /// 访视读片任务
+ ///
+ [ApiExplorerSettings(GroupName = "Trial")]
+ public class VisitTaskService : BaseService
+ {
+
+ private readonly IRepository _visitTaskRepository;
+
+ public VisitTaskService(IRepository visitTaskRepository)
+ {
+ _visitTaskRepository = visitTaskRepository;
+ }
+
+ [HttpPost]
+ public async Task> GetVisitTaskList(VisitTaskQuery queryVisitTask)
+ {
+
+ var visitTaskQueryable = _visitTaskRepository
+ .WhereIf(queryVisitTask.TrialId != null, t => t.Subject.SiteId == queryVisitTask.TrialId)
+ .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.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory)
+ .WhereIf(queryVisitTask.TaskState != null, t => t.DoctorId == 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))
+ .ProjectTo(_mapper.ConfigurationProvider);
+
+ var defalutSortArray = new string[] { nameof(VisitTask.IsUrgent) + " desc", nameof(VisitTask.SubjectId) };
+
+ var pageList = await visitTaskQueryable.ToPagedListAsync(queryVisitTask.PageIndex, queryVisitTask.PageSize, queryVisitTask.SortField, queryVisitTask.Asc, string.IsNullOrWhiteSpace(queryVisitTask.SortField), defalutSortArray);
+
+ return pageList;
+ }
+
+
+
+ }
+}
diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs
new file mode 100644
index 000000000..ba1d83d42
--- /dev/null
+++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs
@@ -0,0 +1,26 @@
+using AutoMapper;
+using IRaCIS.Application.Contracts;
+using IRaCIS.Core.Application.Contracts;
+using IRaCIS.Core.Application.ViewModel;
+using IRaCIS.Core.Domain.Models;
+
+namespace IRaCIS.Core.Application.Service
+{
+ public class AllocationConfig : Profile
+ {
+ public AllocationConfig()
+ {
+
+ CreateMap();
+
+ CreateMap()
+ .ForMember(o => o.SiteId, t => t.MapFrom(u => u.Subject.SiteId))
+ .ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.Subject.TrialSite.TrialSiteCode))
+ .ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code));
+
+
+
+ }
+ }
+
+}
diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs
index 36034d511..659eddc69 100644
--- a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs
+++ b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs
@@ -266,7 +266,6 @@ namespace IRaCIS.Core.Application.Contracts
public class CheckQuery : PageInput
{
- public string SubjectInfo { get; set; } = String.Empty;
//public string VisitPlanInfo { get; set; } = String.Empty;
public string[]? VisitPlanArray { get; set; }
@@ -277,6 +276,8 @@ namespace IRaCIS.Core.Application.Contracts
public Guid TrialId { get; set; }
public Guid? SiteId { get; set; }
+ public string SubjectInfo { get; set; } = String.Empty;
+
//public bool? IsClosed { get; set; }
}
diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/GetReadModuleDto.cs b/IRaCIS.Core.Application/Service/Reading/Dto/GetReadModuleDto.cs
index cd715e7ea..973ec1dfc 100644
--- a/IRaCIS.Core.Application/Service/Reading/Dto/GetReadModuleDto.cs
+++ b/IRaCIS.Core.Application/Service/Reading/Dto/GetReadModuleDto.cs
@@ -369,7 +369,39 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
}
public class ReadMoudleView
- {
+ {
+ public Guid Id { get; set; }
+
+ public string Name { get; set; }
+
+ public Guid SubjectId { get; set; }
+
+ public ModuleTypeEnum ModuleType { get; set; }
+
+ public ReadModuleEnum? Status { get; set; }
+
+ public bool? IsUrgent { get; set; }
+
+
+ public Guid SubjectVisitId { get; set; }
+
+ public string SubjectVisitName { get; set; }
+
+
+ public Guid? CutOffVisitId { get; set; }
+
+
+ public string? CutOffVisitName { get; set; }
+
+
+ public Guid? ReadModuleId { get; set; }
+
+
+ public string? ReadModuleName { get; set; }
+
+ public DateTime CreateTime { get; set; }
+
+ public bool IsVisit { get; set; }
}
diff --git a/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs b/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs
index 646df8a16..2f3f85681 100644
--- a/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs
+++ b/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs
@@ -68,7 +68,10 @@ namespace IRaCIS.Application.Services
.WhereIf(dto.SubjectId != null, x => x.Id == dto.SubjectId)
.WhereIf(dto.TrialSiteCode != null, x => x.TrialSite.TrialSiteCode == dto.TrialSiteCode)
.WhereIf(dto.SubjectCode != null, x => x.Code == dto.SubjectCode)
- .Select(x => new ReadPlanView
+
+
+
+ .Select(x => new ReadPlanView
{
TrialSiteCode = x.TrialSite.TrialSiteCode,
SiteCode = x.TrialSite.TrialSiteCode,
diff --git a/IRaCIS.Core.Application/Triggers/SubjectVisitFinalVisitTrigger.cs b/IRaCIS.Core.Application/Triggers/SubjectVisitFinalVisitTrigger.cs
index 0f231217c..a12d3398b 100644
--- a/IRaCIS.Core.Application/Triggers/SubjectVisitFinalVisitTrigger.cs
+++ b/IRaCIS.Core.Application/Triggers/SubjectVisitFinalVisitTrigger.cs
@@ -43,8 +43,6 @@ namespace IRaCIS.Core.Application.Triggers
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == subjectVisit.SubjectId && t.VisitExecuted == VisitExecutedEnum.Unavailable, u => new SubjectVisit() { VisitExecuted = VisitExecutedEnum.UnExecuted });
}
-
-
}
}
diff --git a/IRaCIS.Core.Application/Triggers/SubjectVisitPassedTrigger.cs b/IRaCIS.Core.Application/Triggers/SubjectVisitPassedTrigger.cs
new file mode 100644
index 000000000..b96a3b41d
--- /dev/null
+++ b/IRaCIS.Core.Application/Triggers/SubjectVisitPassedTrigger.cs
@@ -0,0 +1,87 @@
+using EasyCaching.Core;
+using EntityFrameworkCore.Triggered;
+using IRaCIS.Core.Domain.Share;
+using IRaCIS.Core.Infrastructure;
+
+namespace IRaCIS.Core.Application.Triggers
+{
+ ///
+ /// 处理 访视 末次评估 会影响Subject 状态
+ ///
+ public class SubjectVisitPassedTrigger : IAfterSaveTrigger
+ {
+ private readonly IRepository _subjectVisitRepository;
+ private readonly IRepository _visitTaskRepository;
+
+ private readonly IEasyCachingProvider _provider;
+
+ public SubjectVisitPassedTrigger(IRepository subjectVisitRepository, IRepository visitTaskRepository, IEasyCachingProvider provider)
+ {
+ _subjectVisitRepository = subjectVisitRepository;
+ _visitTaskRepository = visitTaskRepository;
+ _provider = provider;
+ }
+
+ public async Task AfterSave(ITriggerContext context, CancellationToken cancellationToken)
+ {
+
+ var subjectVisit = context.Entity;
+
+
+ if (context.ChangeType == ChangeType.Modified)
+ {
+
+ // 一致性核查通过 生成读片任务
+ if (context.UnmodifiedEntity?.CheckState != subjectVisit.CheckState && subjectVisit.CheckState == CheckStateEnum.CVPassed)
+ {
+
+ var dbMaxCode = _visitTaskRepository.Where(t => t.TrialId == subjectVisit.TrialId).Select(t => t.Code).DefaultIfEmpty().Max();
+
+ var cacheMaxCodeInt = _provider.Get($"{subjectVisit.TrialId }_{ StaticData.CacheKey.TaskMaxCode}").Value;
+
+ int currentMaxCodeInt = cacheMaxCodeInt > dbMaxCode ? cacheMaxCodeInt : dbMaxCode;
+
+ _provider.Set($"{subjectVisit.TrialId }_{ StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt + 2, TimeSpan.FromMinutes(30));
+
+
+ await _visitTaskRepository.AddAsync(new VisitTask()
+ {
+ TrialId = subjectVisit.TrialId,
+ SubjectId = subjectVisit.SubjectId,
+ IsUrgent = subjectVisit.IsUrgent,
+ TaskBlindName = subjectVisit.BlindName,
+ TaskName = subjectVisit.VisitName,
+ CheckPassedTime = subjectVisit.CheckPassedTime,
+ ArmEnum = 1,
+ Code = currentMaxCodeInt + 1,
+ TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
+ ReadingCategory = ReadingCategory.Visit
+ });
+
+ await _visitTaskRepository.AddAsync(new VisitTask()
+ {
+ TrialId = subjectVisit.TrialId,
+ SubjectId = subjectVisit.SubjectId,
+ IsUrgent = subjectVisit.IsUrgent,
+ TaskBlindName = subjectVisit.BlindName,
+ TaskName = subjectVisit.VisitName,
+ CheckPassedTime = subjectVisit.CheckPassedTime,
+ ArmEnum = 2,
+ Code = currentMaxCodeInt + 2,
+ TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 2, nameof(VisitTask)),
+ ReadingCategory = ReadingCategory.Visit
+ });
+
+ await _visitTaskRepository.SaveChangesAsync();
+ }
+
+ }
+
+ }
+
+
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/IRaCIS.Core.Domain.Share/Allocation/AllocationRelation.cs b/IRaCIS.Core.Domain.Share/Allocation/AllocationRelation.cs
new file mode 100644
index 000000000..ab982e16c
--- /dev/null
+++ b/IRaCIS.Core.Domain.Share/Allocation/AllocationRelation.cs
@@ -0,0 +1,24 @@
+
+
+namespace IRaCIS.Core.Domain.Share
+{
+ public enum ReadingCategory
+ {
+
+ Visit=1,
+
+ ReadingPeriod=2,
+
+ Global=3
+ }
+
+ public enum TaskState
+ {
+
+ NotAllocate = 0,
+
+ Allocated = 2,
+ }
+
+
+}
diff --git a/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs b/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs
new file mode 100644
index 000000000..46e7ddb41
--- /dev/null
+++ b/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs
@@ -0,0 +1,71 @@
+
+//--------------------------------------------------------------------
+// 此代码由T4模板自动生成 byzhouhang 20210918
+// 生成时间 2022-06-07 13:13:13
+// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
+using System;
+using IRaCIS.Core.Domain.Share;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+namespace IRaCIS.Core.Domain.Models
+{
+ ///
+ ///TaskAllocationRule
+ ///
+ [Table("TaskAllocationRule")]
+ public class TaskAllocationRule : Entity, IAuditUpdate, IAuditAdd
+ {
+ ///
+ /// CreateUserId
+ ///
+ [Required]
+ public Guid CreateUserId { get; set; }
+
+ ///
+ /// CreateTime
+ ///
+ [Required]
+ public DateTime CreateTime { get; set; }
+
+ ///
+ /// UpdateTime
+ ///
+ [Required]
+ public DateTime UpdateTime { get; set; }
+
+ ///
+ /// UpdateUserId
+ ///
+ [Required]
+ public Guid UpdateUserId { get; set; }
+
+
+ ///
+ /// 计划比率
+ ///
+ [Required]
+ public int PlanReadingRatio { get; set; }
+
+ public Guid DoctorId { get; set; }
+
+ ///
+ /// IsEnable
+ ///
+ [Required]
+ public bool IsEnable { get; set; }
+
+ ///
+ /// 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
new file mode 100644
index 000000000..c7982d95c
--- /dev/null
+++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs
@@ -0,0 +1,117 @@
+
+//--------------------------------------------------------------------
+// 此代码由T4模板自动生成 byzhouhang 20210918
+// 生成时间 2022-06-07 14:09:29
+// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
+using System;
+using IRaCIS.Core.Domain.Share;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+namespace IRaCIS.Core.Domain.Models
+{
+ ///
+ ///VisitTask
+ ///
+ [Table("VisitTask")]
+ public class VisitTask : Entity, IAuditUpdate, IAuditAdd
+ {
+
+ public Guid TrialId { get; set; }
+
+ ///
+ /// CreateUserId
+ ///
+ [Required]
+ public Guid CreateUserId { get; set; }
+
+ ///
+ /// CreateTime
+ ///
+ [Required]
+ public DateTime CreateTime { get; set; }
+
+ ///
+ /// UpdateTime
+ ///
+ [Required]
+ public DateTime UpdateTime { get; set; }
+
+ ///
+ /// UpdateUserId
+ ///
+ [Required]
+ public Guid UpdateUserId { get; set; }
+
+ ///
+ /// TaskName
+ ///
+ [Required]
+ public string TaskName { get; set; }=string.Empty;
+
+ ///
+ /// TaskBlindName
+ ///
+ [Required]
+ public string TaskBlindName { get; set; } = string.Empty;
+
+
+
+ ///
+ /// ReadingCategory
+ ///
+ [Required]
+ public ReadingCategory ReadingCategory { get; set; }
+
+ ///
+ /// CheckPassedTime
+ ///
+ public DateTime? CheckPassedTime { get; set; }
+
+ ///
+ /// AllocateTime
+ ///
+ public DateTime? AllocateTime { get; set; }
+
+ ///
+ /// SubjectId
+ ///
+ [Required]
+ public Guid SubjectId { get; set; }
+
+ public Subject Subject { get; set; }
+
+ ///
+ /// Code
+ ///
+ [Required]
+ public int Code { get; set; }
+
+ ///
+ /// TaskCode
+ ///
+ [Required]
+ public string TaskCode { get; set; } = string.Empty;
+
+ ///
+ /// IsUrgent
+ ///
+ [Required]
+ public bool IsUrgent { get; set; }
+
+ ///
+ /// ArmEnum
+ ///
+ [Required]
+ public int ArmEnum { get; set; }
+
+ public TaskState TaskState { get; set; }
+
+
+ ///
+ /// DoctorId
+ ///
+ public Guid? DoctorId { get; set; }
+
+ }
+
+}
diff --git a/IRaCIS.Core.Domain/Trial/DataInspection.cs b/IRaCIS.Core.Domain/Trial/DataInspection.cs
index 2d72037f9..0b20d7ed0 100644
--- a/IRaCIS.Core.Domain/Trial/DataInspection.cs
+++ b/IRaCIS.Core.Domain/Trial/DataInspection.cs
@@ -25,10 +25,7 @@ namespace IRaCIS.Core.Domain.Models
///
public Guid CreateUserId { get; set; }
- ///
- /// 功能模块
- ///
- public Guid? ModuleType { get; set; }
+
///
/// 盲态访视名
@@ -56,10 +53,7 @@ namespace IRaCIS.Core.Domain.Models
///
public Guid? SubjectVisitId { get; set; }
- ///
- /// 操作类型
- ///
- public Guid? OptType { get; set; }
+
///
/// IP地址
@@ -92,6 +86,21 @@ namespace IRaCIS.Core.Domain.Models
/// 子类
///
public Guid? ChildrenType { get; set; }
+ ///
+ /// 对象类型
+ ///
+ public Guid? ObjectType { get; set; }
+
+ ///
+ /// 操作类型
+ ///
+ public Guid? OptType { get; set; }
+
+ ///
+ /// 功能模块
+ ///
+ public Guid? ModuleType { get; set; }
+
///
/// Json 对象
@@ -139,10 +148,7 @@ namespace IRaCIS.Core.Domain.Models
///
public string ResearchProgramNo { get; set; }
- ///
- /// 对象类型
- ///
- public Guid? ObjectType { get; set; }
+
///
/// 标识
diff --git a/IRaCIS.Core.Domain/_Config/_AppSettings.cs b/IRaCIS.Core.Domain/_Config/_AppSettings.cs
index 02397c704..4dfac7a04 100644
--- a/IRaCIS.Core.Domain/_Config/_AppSettings.cs
+++ b/IRaCIS.Core.Domain/_Config/_AppSettings.cs
@@ -85,6 +85,10 @@ namespace IRaCIS.Core.Domain.Share
return DicomStudyCodePrefix + codeInt.ToString("D5");
+ case nameof(VisitTask):
+
+ return "W" + codeInt.ToString("D5");
+
default:
return string.Empty;
}
diff --git a/IRaCIS.Core.Domain/_Config/_StaticData.cs b/IRaCIS.Core.Domain/_Config/_StaticData.cs
index 06b193b64..fac9d5f45 100644
--- a/IRaCIS.Core.Domain/_Config/_StaticData.cs
+++ b/IRaCIS.Core.Domain/_Config/_StaticData.cs
@@ -50,6 +50,8 @@ public static class StaticData
public static class CacheKey
{
public static string StudyMaxCode = "StudyMaxCode";
+
+ public static string TaskMaxCode = "TaskMaxCode";
}
diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs
index fd9cbdab3..f1fec40fc 100644
--- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs
+++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs
@@ -545,7 +545,9 @@ namespace IRaCIS.Core.Infra.EFCore
#endregion
+ public virtual DbSet TaskAllocationRule { get; set; }
+ public virtual DbSet VisitTask { get; set; }
diff --git a/IRaCIS.Core.Test/DbHelper.ttinclude b/IRaCIS.Core.Test/DbHelper.ttinclude
index ca50af026..51fd9a26f 100644
--- a/IRaCIS.Core.Test/DbHelper.ttinclude
+++ b/IRaCIS.Core.Test/DbHelper.ttinclude
@@ -1,10 +1,10 @@
<#+
public class config
{
- public static readonly string ConnectionString = "Server=123.56.181.144,14333\\MSSQLExpress14;Database=IRaCIS_New;User ID=sa;Password=dev123456DEV;";
- public static readonly string DbDatabase = "IRaCIS_New";
+ public static readonly string ConnectionString = "Server=123.56.94.154,1433\\MSSQLSERVER;Database=IRaCIS_New_Tet;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true";
+ public static readonly string DbDatabase = "IRaCIS_New_Tet";
//ַ,ƴ
- public static readonly string TableName = "SystemNotice,SystemNoticeUserRead,SystemNoticeUserType";
+ public static readonly string TableName = "VisitTask";
//ļ service Ƿҳ
}
#>