diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 7bd4e7dc1..a26ad13da 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -44,6 +44,25 @@
FrontAuditConfigService
+
+
+ 获取数据库所有表
+
+
+
+
+
+ 获取表列名
+
+
+
+
+
+ 批量添加字段
+
+ 数据集
+
+
翻译稽查数据
diff --git a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs
index 33c49b88d..0c63d8a67 100644
--- a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs
+++ b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs
@@ -6,6 +6,9 @@
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
+using IRaCIS.Core.Infra.EFCore.Dto;
+using System.ComponentModel.DataAnnotations;
+
namespace IRaCIS.Core.Application.ViewModel
{
/// FrontAuditConfigView 列表视图模型
@@ -30,6 +33,14 @@ namespace IRaCIS.Core.Application.ViewModel
}
+ public class BatchAddFrontAudit
+ {
+ [NotDefault]
+ public Guid ParentId { get; set; }
+
+ public List Columns { get; set; }
+ }
+
public class GetChildrenItem
{
diff --git a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs
index cab018157..35f475d4a 100644
--- a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs
@@ -27,6 +27,54 @@ namespace IRaCIS.Core.Application.Service
_frontAuditConfigRepository = frontAuditConfigRepository;
}
+ ///
+ /// 获取数据库所有表
+ ///
+ ///
+ [HttpPost]
+ public async Task> GetDatabaseTables()
+ {
+ return await _frontAuditConfigRepository._dbContext.GetTableList().ToListAsync();
+ }
+
+ ///
+ /// 获取表列名
+ ///
+ ///
+ [HttpPost]
+ public async Task> GetTableColumn(string tableName)
+ {
+ return await _frontAuditConfigRepository._dbContext.GetTableColumn(tableName).ToListAsync();
+ }
+
+
+ ///
+ /// 批量添加字段
+ ///
+ /// 数据集
+ ///
+ public async Task BatchAddFrontAudit(BatchAddFrontAudit data)
+ {
+ var maxsort = await _frontAuditConfigRepository.Where(x => x.ParentId == data.ParentId).MaxAsync(x => x.Sort);
+
+ List fronts=new List();
+ foreach (var item in data.Columns)
+ {
+ maxsort++;
+ fronts.Add(new FrontAuditConfig()
+ {
+
+ Sort = maxsort,
+ Code = item.Name,
+ ValueCN = item.Remake,
+ IsEnable = true,
+ ParentId = data.ParentId
+ });
+ }
+
+ await _frontAuditConfigRepository.AddRangeAsync(fronts);
+ }
+
///
/// 翻译稽查数据
///
diff --git a/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs b/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs
index da3a8ee5a..cedc82509 100644
--- a/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs
+++ b/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs
@@ -336,7 +336,7 @@ namespace IRaCIS.Application.Services
x.Id,
x.IsEnrollment,
x.IsUrgent,
-
+
});
List subjectVisits = new List();
@@ -367,7 +367,6 @@ namespace IRaCIS.Application.Services
BlindName = x.BlindName,
IsBaseLine = x.IsBaseLine,
-
IsUrgent = false,
};
diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs
index 295a15307..c1ccc8cd9 100644
--- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs
+++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs
@@ -16,6 +16,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.ValueGeneration;
using UserTypeGroup = IRaCIS.Core.Domain.Models.UserTypeGroup;
+using IRaCIS.Core.Infra.EFCore.Dto;
namespace IRaCIS.Core.Infra.EFCore
{
@@ -71,6 +72,15 @@ namespace IRaCIS.Core.Infra.EFCore
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
+ modelBuilder.Entity(builder =>
+ {
+ builder.HasBaseType((Type)null);
+ builder.ToView(null);
+ builder.HasNoKey();
+ });
+
+ //modelBuilder.HasDbFunction(typeof(DbContext).GetMethod(nameof(GetTableList)));
+
if (_userInfo.IsEn_Us)
{
@@ -112,6 +122,18 @@ namespace IRaCIS.Core.Infra.EFCore
}
+ #region
+ public IQueryable GetTableList()
+ {
+ return Set().FromSqlRaw("EXEC dbo.procGetTableList");
+ }
+
+ public IQueryable GetTableColumn(string tableName)
+ {
+ return Set().FromSqlRaw($"EXEC dbo.procGetTableColumn {tableName}");
+ }
+ #endregion
+
#region Doctor
public virtual DbSet Dictionary { get; set; }
public virtual DbSet Doctor { get; set; }
@@ -128,7 +150,7 @@ namespace IRaCIS.Core.Infra.EFCore
public virtual DbSet TrialExperienceCriteria { get; set; }
-
+
#endregion
diff --git a/IRaCIS.Core.Infra.EFCore/Dto/SetDictionaryValueDto.cs b/IRaCIS.Core.Infra.EFCore/Dto/SetDictionaryValueDto.cs
index d0bd9e02b..02ca2f968 100644
--- a/IRaCIS.Core.Infra.EFCore/Dto/SetDictionaryValueDto.cs
+++ b/IRaCIS.Core.Infra.EFCore/Dto/SetDictionaryValueDto.cs
@@ -25,6 +25,13 @@ namespace IRaCIS.Core.Infra.EFCore.Dto
}
+ public class TableList
+ {
+ public string Name { get; set; }
+
+ public string Remake { get; set; }
+ }
+
diff --git a/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs b/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs
index e16681209..ccec5066f 100644
--- a/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs
+++ b/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs
@@ -19,6 +19,8 @@ namespace IRaCIS.Core.Infra.EFCore
{
public interface IRepository : ICommandRepository, IQueryRepository where TEntity : Entity
{
+ IRaCISDBContext _dbContext { get; set; }
+
///
/// 获取中心啥的名称
///
diff --git a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs
index c36193a36..a3d771e01 100644
--- a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs
+++ b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs
@@ -201,7 +201,6 @@ namespace IRaCIS.Core.Infra.EFCore
}
-
#endregion
@@ -794,6 +793,9 @@ namespace IRaCIS.Core.Infra.EFCore
Identification = "Init|Trial|Status|Trial Setting-Infomation", // 初始化项目
JsonDetail = entity.ToJcJson()
});
+
+
+
}
// 受试者
@@ -811,6 +813,8 @@ namespace IRaCIS.Core.Infra.EFCore
Identification = "Init|Subject|Status|Subject", // 初始化受试者信息
JsonDetail = entity.ToJcJson()
});
+
+
}
// Dicom序列 // 移动不进来