代码提交一版
This commit is contained in:
@@ -7,107 +7,122 @@ using System;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using System.Collections.Generic;
|
||||
namespace IRaCIS.Core.Application.ViewModel
|
||||
{
|
||||
/// <summary> FrontAuditConfigView 列表视图模型 </summary>
|
||||
public class FrontAuditConfigView
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Value { get; set; } = string.Empty;
|
||||
public string ValueCN { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public DateTime CreateTime { get; set; }
|
||||
public Guid CreateUserId { get; set; }
|
||||
public DateTime UpdateTime { get; set; }
|
||||
public Guid UpdateUserId { get; set; }
|
||||
public string Code { get; set; } = string.Empty;
|
||||
public Guid? ParentId { get; set; }
|
||||
public bool? IsEnable { get; set; }
|
||||
public bool? IsConfig { get; set; }
|
||||
public string ModuleTypeId { get; set; } = string.Empty;
|
||||
public string OptTypeId { get; set; } = string.Empty;
|
||||
public string ChildrenTypeId { get; set; } = string.Empty;
|
||||
{
|
||||
/// <summary> FrontAuditConfigView 列表视图模型 </summary>
|
||||
public class FrontAuditConfigView
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Value { get; set; } = string.Empty;
|
||||
public string ValueCN { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public DateTime CreateTime { get; set; }
|
||||
public Guid CreateUserId { get; set; }
|
||||
public DateTime UpdateTime { get; set; }
|
||||
public Guid UpdateUserId { get; set; }
|
||||
public string Code { get; set; } = string.Empty;
|
||||
public Guid? ParentId { get; set; }
|
||||
public bool? IsEnable { get; set; }
|
||||
public bool? IsConfig { get; set; }
|
||||
public string ModuleTypeId { get; set; } = string.Empty;
|
||||
public string OptTypeId { get; set; } = string.Empty;
|
||||
public string ChildrenTypeId { get; set; } = string.Empty;
|
||||
|
||||
public string ConfigType { get; set; } = string.Empty;
|
||||
public string ConfigType { get; set; } = string.Empty;
|
||||
|
||||
public bool? IsShowParent { get; set; }
|
||||
|
||||
public string ChildrenTypeValue { get; set; } = string.Empty;
|
||||
public string ChildrenTypeValueCN { get; set; } = string.Empty;
|
||||
public bool? IsShowParent { get; set; }
|
||||
|
||||
public string ModuleTypeValue { get; set; } = string.Empty;
|
||||
public string ModuleTypeValueCN { get; set; } = string.Empty;
|
||||
public string ChildrenTypeValue { get; set; } = string.Empty;
|
||||
public string ChildrenTypeValueCN { get; set; } = string.Empty;
|
||||
|
||||
public string OptTypeValue { get; set; } = string.Empty;
|
||||
public string OptTypeValueCN { get; set; } = string.Empty;
|
||||
public string ModuleTypeValue { get; set; } = string.Empty;
|
||||
public string ModuleTypeValueCN { get; set; } = string.Empty;
|
||||
|
||||
public int? Sort { get; set; }
|
||||
public string OptTypeValue { get; set; } = string.Empty;
|
||||
public string OptTypeValueCN { get; set; } = string.Empty;
|
||||
|
||||
public string? EnumList { get; set; }
|
||||
public int? Sort { get; set; }
|
||||
|
||||
public string? DictionaryKey { get; set; }
|
||||
public string? EnumList { get; set; }
|
||||
|
||||
public string? EnumType { get; set; }
|
||||
public string? DictionaryKey { get; set; }
|
||||
|
||||
public string? EnumType { get; set; }
|
||||
|
||||
public string ObjectTypeId { get; set; } = string.Empty;
|
||||
|
||||
public bool? IsShowByTrialConfig { get; set; }
|
||||
|
||||
public string ByTrialConfig { get; set; } = string.Empty;
|
||||
|
||||
|
||||
}
|
||||
|
||||
///<summary>FrontAuditConfigQuery 列表查询参数模型</summary>
|
||||
public class FrontAuditConfigQuery
|
||||
{
|
||||
///<summary> Value</summary>
|
||||
public string Value { get; set; }=string.Empty;
|
||||
}
|
||||
|
||||
///<summary> ValueCN</summary>
|
||||
public string ValueCN { get; set; } = string.Empty;
|
||||
///<summary>FrontAuditConfigQuery 列表查询参数模型</summary>
|
||||
public class FrontAuditConfigQuery
|
||||
{
|
||||
///<summary> Value</summary>
|
||||
public string Value { get; set; } = string.Empty;
|
||||
|
||||
///<summary> Description</summary>
|
||||
public string Description { get; set; } = string.Empty;
|
||||
///<summary> ValueCN</summary>
|
||||
public string ValueCN { get; set; } = string.Empty;
|
||||
|
||||
///<summary> Code</summary>
|
||||
public string Code { get; set; } = string.Empty;
|
||||
///<summary> Description</summary>
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
///<summary> OptTypeId </summary>
|
||||
public string OptTypeId { get; set; } = string.Empty;
|
||||
///<summary> Code</summary>
|
||||
public string Code { get; set; } = string.Empty;
|
||||
|
||||
///<summary> ChildrenTypeId</summary>
|
||||
public string ChildrenTypeId { get; set; } = string.Empty;
|
||||
///<summary> OptTypeId </summary>
|
||||
public string OptTypeId { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
///<summary> ChildrenTypeId</summary>
|
||||
public string ChildrenTypeId { get; set; } = string.Empty;
|
||||
|
||||
///<summary> FrontAuditConfigAddOrEdit 列表查询参数模型</summary>
|
||||
public class FrontAuditConfigAddOrEdit
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
public string Value { get; set; } = string.Empty;
|
||||
public string ValueCN { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public DateTime CreateTime { get; set; }
|
||||
public Guid CreateUserId { get; set; }
|
||||
public DateTime UpdateTime { get; set; }
|
||||
public Guid UpdateUserId { get; set; }
|
||||
public string Code { get; set; } = string.Empty;
|
||||
public Guid? ParentId { get; set; }
|
||||
public bool IsEnable { get; set; }
|
||||
public bool IsConfig { get; set; }
|
||||
public string ModuleTypeId { get; set; } = string.Empty;
|
||||
public string OptTypeId { get; set; } = string.Empty;
|
||||
public string ChildrenTypeId { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public string ConfigType { get; set; } = string.Empty;
|
||||
///<summary> FrontAuditConfigAddOrEdit 列表查询参数模型</summary>
|
||||
public class FrontAuditConfigAddOrEdit
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
public string Value { get; set; } = string.Empty;
|
||||
public string ValueCN { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public DateTime CreateTime { get; set; }
|
||||
public Guid CreateUserId { get; set; }
|
||||
public DateTime UpdateTime { get; set; }
|
||||
public Guid UpdateUserId { get; set; }
|
||||
public string Code { get; set; } = string.Empty;
|
||||
public Guid? ParentId { get; set; }
|
||||
public bool IsEnable { get; set; }
|
||||
public bool IsConfig { get; set; }
|
||||
public string ModuleTypeId { get; set; } = string.Empty;
|
||||
public string OptTypeId { get; set; } = string.Empty;
|
||||
public string ChildrenTypeId { get; set; } = string.Empty;
|
||||
|
||||
public bool? IsShowParent { get; set; }
|
||||
public string ConfigType { get; set; } = string.Empty;
|
||||
|
||||
public int? Sort { get; set; }
|
||||
public bool? IsShowParent { get; set; }
|
||||
|
||||
public string EnumList { get; set; } = string.Empty;
|
||||
public int? Sort { get; set; }
|
||||
|
||||
public string DictionaryKey { get; set; } = string.Empty;
|
||||
public string EnumList { get; set; } = string.Empty;
|
||||
|
||||
public string EnumType { get; set; } = string.Empty;
|
||||
public string DictionaryKey { get; set; } = string.Empty;
|
||||
|
||||
public string EnumType { get; set; } = string.Empty;
|
||||
|
||||
public string ObjectTypeId { get; set; } = string.Empty;
|
||||
|
||||
public bool? IsShowByTrialConfig { get; set; }
|
||||
|
||||
public string ByTrialConfig { get; set; } = string.Empty;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -73,6 +73,9 @@ namespace IRaCIS.Core.Application.Service
|
||||
EnumList=data.EnumList,
|
||||
DictionaryKey=data.DictionaryKey,
|
||||
EnumType=data.EnumType,
|
||||
ObjectTypeId=data.ObjectTypeId,
|
||||
IsShowByTrialConfig=data.IsShowByTrialConfig,
|
||||
ByTrialConfig=data.ByTrialConfig,
|
||||
};
|
||||
|
||||
query = query
|
||||
|
||||
@@ -76,6 +76,14 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
|
||||
/// </summary>
|
||||
public string ResearchProgramNo { get; set; } = string.Empty;
|
||||
|
||||
public List<EnumList> EnumList { get; set; }=new List<EnumList> { };
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 对象名称
|
||||
/// </summary>
|
||||
public string ObjectType { get; set; } = string.Empty;
|
||||
|
||||
|
||||
////需要单独处理
|
||||
//public string IP { get; set; }
|
||||
@@ -85,6 +93,15 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
|
||||
}
|
||||
|
||||
|
||||
public class EnumList
|
||||
{
|
||||
public string Key { get; set; } = string.Empty;
|
||||
|
||||
public string Code { get; set; } = string.Empty;
|
||||
|
||||
public string Type { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public interface IInspectionDTO
|
||||
{
|
||||
public DataInspectionAddDTO AuditInfo { get; set; }
|
||||
@@ -245,6 +262,12 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
|
||||
/// 是否有签名
|
||||
/// </summary>
|
||||
public bool? IsSign { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 对象名称
|
||||
/// </summary>
|
||||
|
||||
public string ObjectType { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class InspectionBase
|
||||
|
||||
@@ -3,7 +3,9 @@ using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Service.Inspection.DTO;
|
||||
using IRaCIS.Core.Application.Service.Inspection.Interface;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Panda.DynamicWebApi.Attributes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -39,6 +41,14 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
join user in _repository.GetQueryable<User>() on data.CreateUserId equals user.Id into usertemp
|
||||
from leftuser in usertemp.DefaultIfEmpty()
|
||||
|
||||
|
||||
join moduleTyped in _repository.GetQueryable<Dictionary>().Where(x => x.Code == "ModuleType") on 1 equals 1
|
||||
join moduleTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = moduleTyped.Id, ModuleType=data.ModuleType } equals new { ParentId=moduleTypec.ParentId.Value, ModuleType= moduleTypec.Value } into moduleTypectemp
|
||||
from leftmoduleTypec in moduleTypectemp.DefaultIfEmpty()
|
||||
|
||||
|
||||
|
||||
|
||||
select new GetDataInspectionOutDto()
|
||||
{
|
||||
CreateTime = data.CreateTime,
|
||||
@@ -75,10 +85,12 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
TrialName=data.TrialName,
|
||||
SiteCode=data.SiteCode,
|
||||
ResearchProgramNo=data.ResearchProgramNo,
|
||||
ObjectType=data.ObjectType,
|
||||
};
|
||||
|
||||
query = query.WhereIf(!dto.BlindName.IsNullOrEmpty(), x => x.BlindName == dto.BlindName)
|
||||
.WhereIf(dto.IsSign != null, x => x.IsSign == dto.IsSign)
|
||||
.WhereIf(!dto.ObjectType.IsNullOrEmpty(), x => x.ObjectType == dto.ObjectType)
|
||||
.WhereIf(!dto.ChildrenType.IsNullOrEmpty(), x => x.ChildrenType == dto.ChildrenType)
|
||||
.WhereIf(!dto.ModuleType.IsNullOrEmpty(), x => x.ModuleType == dto.ModuleType)
|
||||
.WhereIf(!dto.OptType.IsNullOrEmpty(), x => x.OptType == dto.OptType)
|
||||
@@ -244,9 +256,10 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
/// <returns></returns>
|
||||
public async Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId, object? Statusdata = null)
|
||||
{
|
||||
await SetEnum(addDto);
|
||||
var add = _mapper.Map<DataInspection>(addDto);
|
||||
Guid? parentId = null;
|
||||
parentId = (await _repository.GetQueryable<DataInspection>().Where(x => x.TrialId == add.TrialId && x.SubjectVisitId == add.SubjectVisitId && x.SubjectId == add.SubjectId && x.SiteId == add.SiteId&&x.ModuleType==add.ModuleType&&x.ChildrenType==add.ChildrenType).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id;
|
||||
parentId = (await _repository.GetQueryable<DataInspection>().Where(x => x.TrialId == add.TrialId && x.SubjectVisitId == add.SubjectVisitId && x.SubjectId == add.SubjectId && x.SiteId == add.SiteId&&x.ModuleType==add.ModuleType&&x.ChildrenType==add.ChildrenType && x.ObjectType==add.ObjectType).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id;
|
||||
add.ParentId = parentId;
|
||||
add.CreateTime = DateTime.Now;
|
||||
add.CreateUserId = _userInfo.Id;
|
||||
@@ -272,6 +285,83 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理枚举
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
public async Task SetEnum(DataInspectionAddDTO Data)
|
||||
{
|
||||
#region 枚举
|
||||
try
|
||||
{
|
||||
var JsonData = JsonConvert.DeserializeObject<IDictionary<string, object>>(Data.JsonDetail);
|
||||
foreach (var item in Data.EnumList)
|
||||
{
|
||||
var value = JsonData[item.Key];
|
||||
if (value.GetType() == typeof(JArray))
|
||||
{
|
||||
JArray arrays = (JArray)value;
|
||||
if (item.Type.ToLower() == "id".ToLower())
|
||||
{
|
||||
List<Guid> guids = new List<Guid>();
|
||||
arrays.ForEach(x =>
|
||||
{
|
||||
guids.Add(Guid.Parse(x.ToString()));
|
||||
});
|
||||
JsonData[item.Key] = string.Join(',', await _repository.GetQueryable<Dictionary>().Where(x => guids.Contains(x.Id)).Select(x => x.Value).ToListAsync());
|
||||
}
|
||||
else
|
||||
{
|
||||
List<string> guids =new List<string>();
|
||||
arrays.ForEach(x =>
|
||||
{
|
||||
guids.Add(x.ToString());
|
||||
});
|
||||
JsonData[item.Key] = string.Join(',', await
|
||||
_repository.GetQueryable<Dictionary>().Where(x => x.Code == item.Code).GroupJoin(
|
||||
_repository.GetQueryable<Dictionary>().Where(x=>guids.Contains(x.Code)), a => a.Id, b => b.ParentId, (a, b) => new
|
||||
{
|
||||
parent = b
|
||||
}).SelectMany(a => a.parent, (m, n) => new
|
||||
{
|
||||
value = n.Value
|
||||
}).Select(x => x.value).ToListAsync()
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.Type.ToLower() == "id".ToLower())
|
||||
{
|
||||
Guid guid = Guid.Parse(value.ToString());
|
||||
JsonData[item.Key] = await _repository.GetQueryable<Dictionary>().Where(x => guid == x.Id).Select(x => x.Value).FirstOrDefaultAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
JsonData[item.Key] = await _repository.GetQueryable<Dictionary>().Where(x=>x.Code==item.Code).Join(_repository.GetQueryable<Dictionary>().Where(x=>x.Code== value.ToString()), a => a.Id, b => b.ParentId, (a, b) => new
|
||||
{
|
||||
value=b.Value
|
||||
}).Select(x=>x.value).FirstOrDefaultAsync();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Data.JsonDetail = JsonConvert.SerializeObject(JsonData);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw new BusinessValidationFailedException("Json 对象枚举异常");
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置项目以及名称
|
||||
/// </summary>
|
||||
@@ -349,6 +439,10 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,5 +22,7 @@ namespace IRaCIS.Core.Application.Service.Inspection.Interface
|
||||
Task<dynamic> Enforcement(dynamic OptCommand, DataInspectionAddDTO AuditInfo, SignDTO SignInfo, dynamic fun, IResponseOutput? response = null, object? Statusdata = null);
|
||||
|
||||
Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId, object? Statusdata = null);
|
||||
|
||||
Task SetEnum(DataInspectionAddDTO Data);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user