代码提交一版

Uat_Study
he 2022-03-31 18:12:07 +08:00
parent 0c6be16987
commit fb2586e5c1
11 changed files with 296 additions and 78 deletions

View File

@ -80,6 +80,10 @@ namespace IRaCIS.Core.API.Controllers
{
//opt.AuditInfo.SubjectCode = opt.OptCommand.Code;
var fun = await _subjectVisitService.AddOrUpdateSV(opt.OptCommand);
if (!fun.IsSuccess)
{
return ResponseOutput.NotOk(fun.ErrorMessage);
}
opt.AuditInfo.SubjectId = Guid.Parse(fun.Data);
var statusdata = new
{
@ -150,11 +154,13 @@ namespace IRaCIS.Core.API.Controllers
public async Task<IResponseOutput> AddOrUpdateSubject(InsSubjectCommand opt)
{
opt.AuditInfo.SubjectCode = opt.OptCommand.Code;
var fun = await _subjectService.AddOrUpdateSubject(opt.OptCommand);
opt.AuditInfo.SubjectId = Guid.Parse(fun.Data);
var statusdata = new {
Status = 1,
var statusdata = new
{
Status = "OnVisit",
//OutEnrollmentTime = DateTime.Now.ToString("yyyy-MM-dd"),
//VisitOverTime = DateTime.Now.ToString("yyyy-MM-dd"),
Reason = string.Empty,

View File

@ -239,6 +239,12 @@
<param name="Statusdata">初始化状态对象</param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.SetEnum(IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionAddDTO)">
<summary>
处理枚举
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.SetInspectionNameValue(IRaCIS.Core.Domain.Models.DataInspection)">
<summary>
设置项目以及名称
@ -246,6 +252,59 @@
<param name="Data"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.ExtractObj(System.String)">
<summary>
提取json字符串对象
例如输入:{"1":1,"a":"aa","aa":"{\"2\":2,\"bb\":\"{\\\"3\\\":3,\\\"cc\\\":\\\"ccc\\\"}\"}"}
例如输出:{"1":1,"a":"aa","aa":{"2":2,"bb":{"3":3,"cc":"ccc"}}}
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.ExtractObj(Newtonsoft.Json.Linq.JObject)">
<summary>
提取json对象
例如输入:{"1":1,"a":"aa","aa":"{\"2\":2,\"bb\":\"{\\\"3\\\":3,\\\"cc\\\":\\\"ccc\\\"}\"}"}
例如输出:{"1":1,"a":"aa","aa":{"2":2,"bb":{"3":3,"cc":"ccc"}}}
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.ExtractArr(System.String)">
<summary>
提取json字符串数组
例如输入:["5","6","[\"3\",\"4\",\"[\\\"1\\\",\\\"2\\\"]\"]"]
例如输出:["5","6",["3","4",["1","2"]]]
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.ExtractArr(Newtonsoft.Json.Linq.JArray)">
<summary>
提取json数组
例如输入:["5","6","[\"3\",\"4\",\"[\\\"1\\\",\\\"2\\\"]\"]"]
例如输出:["5","6",["3","4",["1","2"]]]
</summary>
<param name="jArr"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.ExtractAll(System.String)">
<summary>
提取json字符串支持json字符串的对象、数组、字符串
例如输入:["5","6","[\"3\",\"4\",\"[\\\"1\\\",\\\"2\\\"]\"]","{\"1\":2,\"a\":\"ab\"}"]
例如输出:["5","6",["3","4",["1","2"]],{"1":2,"a":"ab"}]
</summary>
<param name="json"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.ExtractAll(Newtonsoft.Json.Linq.JToken)">
<summary>
提取json支持json对象、数组、字符串
例如输入:["5","6","[\"3\",\"4\",\"[\\\"1\\\",\\\"2\\\"]\"]","{\"1\":2,\"a\":\"ab\"}"]
例如输出:["5","6",["3","4",["1","2"]],{"1":2,"a":"ab"}]
</summary>
<param name="json"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.IsJson(System.String)">
<summary>
是否为json开头是'{','['的)
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.TrialExternalUserService">
<summary>
项目外部人员 录入流程相关

View File

@ -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;
}
}
}

View File

@ -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

View File

@ -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

View File

@ -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
}
}
}

View File

@ -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);
}
}

View File

@ -12,6 +12,7 @@
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
</Project>

View File

@ -109,6 +109,14 @@ namespace IRaCIS.Core.Domain.Models
public string EnumType { get; set; }
public string ObjectTypeId { get; set; }
public bool? IsShowByTrialConfig { get; set; }
public string ByTrialConfig { get; set; }
}

View File

@ -85,6 +85,8 @@ namespace IRaCIS.Core.Domain.Models
public BasicDataTypeEnum BasicDataTypeEnum { get; set; }

View File

@ -139,6 +139,11 @@ namespace IRaCIS.Core.Domain.Models
/// </summary>
public string ResearchProgramNo { get; set; }
/// <summary>
/// 对象名称
/// </summary>
public string ObjectType { get; set; }
}