代码提交一版

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

View File

@ -239,6 +239,12 @@
<param name="Statusdata">初始化状态对象</param> <param name="Statusdata">初始化状态对象</param>
<returns></returns> <returns></returns>
</member> </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)"> <member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.SetInspectionNameValue(IRaCIS.Core.Domain.Models.DataInspection)">
<summary> <summary>
设置项目以及名称 设置项目以及名称
@ -246,6 +252,59 @@
<param name="Data"></param> <param name="Data"></param>
<returns></returns> <returns></returns>
</member> </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"> <member name="T:IRaCIS.Core.Application.Service.TrialExternalUserService">
<summary> <summary>
项目外部人员 录入流程相关 项目外部人员 录入流程相关

View File

@ -48,6 +48,13 @@ namespace IRaCIS.Core.Application.ViewModel
public string? EnumType { 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;
} }
@ -55,7 +62,7 @@ namespace IRaCIS.Core.Application.ViewModel
public class FrontAuditConfigQuery public class FrontAuditConfigQuery
{ {
///<summary> Value</summary> ///<summary> Value</summary>
public string Value { get; set; }=string.Empty; public string Value { get; set; } = string.Empty;
///<summary> ValueCN</summary> ///<summary> ValueCN</summary>
public string ValueCN { get; set; } = string.Empty; public string ValueCN { get; set; } = string.Empty;
@ -105,6 +112,14 @@ namespace IRaCIS.Core.Application.ViewModel
public string EnumType { 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, EnumList=data.EnumList,
DictionaryKey=data.DictionaryKey, DictionaryKey=data.DictionaryKey,
EnumType=data.EnumType, EnumType=data.EnumType,
ObjectTypeId=data.ObjectTypeId,
IsShowByTrialConfig=data.IsShowByTrialConfig,
ByTrialConfig=data.ByTrialConfig,
}; };
query = query query = query

View File

@ -76,6 +76,14 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
/// </summary> /// </summary>
public string ResearchProgramNo { get; set; } = string.Empty; 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; } //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 interface IInspectionDTO
{ {
public DataInspectionAddDTO AuditInfo { get; set; } public DataInspectionAddDTO AuditInfo { get; set; }
@ -245,6 +262,12 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
/// 是否有签名 /// 是否有签名
/// </summary> /// </summary>
public bool? IsSign { get; set; } public bool? IsSign { get; set; }
/// <summary>
/// 对象名称
/// </summary>
public string ObjectType { get; set; } = string.Empty;
} }
public class InspectionBase 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.DTO;
using IRaCIS.Core.Application.Service.Inspection.Interface; using IRaCIS.Core.Application.Service.Inspection.Interface;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Panda.DynamicWebApi.Attributes; using Panda.DynamicWebApi.Attributes;
using System; using System;
using System.Collections.Generic; 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 join user in _repository.GetQueryable<User>() on data.CreateUserId equals user.Id into usertemp
from leftuser in usertemp.DefaultIfEmpty() 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() select new GetDataInspectionOutDto()
{ {
CreateTime = data.CreateTime, CreateTime = data.CreateTime,
@ -75,10 +85,12 @@ namespace IRaCIS.Core.Application.Service.Inspection
TrialName=data.TrialName, TrialName=data.TrialName,
SiteCode=data.SiteCode, SiteCode=data.SiteCode,
ResearchProgramNo=data.ResearchProgramNo, ResearchProgramNo=data.ResearchProgramNo,
ObjectType=data.ObjectType,
}; };
query = query.WhereIf(!dto.BlindName.IsNullOrEmpty(), x => x.BlindName == dto.BlindName) query = query.WhereIf(!dto.BlindName.IsNullOrEmpty(), x => x.BlindName == dto.BlindName)
.WhereIf(dto.IsSign != null, x => x.IsSign == dto.IsSign) .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.ChildrenType.IsNullOrEmpty(), x => x.ChildrenType == dto.ChildrenType)
.WhereIf(!dto.ModuleType.IsNullOrEmpty(), x => x.ModuleType == dto.ModuleType) .WhereIf(!dto.ModuleType.IsNullOrEmpty(), x => x.ModuleType == dto.ModuleType)
.WhereIf(!dto.OptType.IsNullOrEmpty(), x => x.OptType == dto.OptType) .WhereIf(!dto.OptType.IsNullOrEmpty(), x => x.OptType == dto.OptType)
@ -244,9 +256,10 @@ namespace IRaCIS.Core.Application.Service.Inspection
/// <returns></returns> /// <returns></returns>
public async Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId, object? Statusdata = null) public async Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId, object? Statusdata = null)
{ {
await SetEnum(addDto);
var add = _mapper.Map<DataInspection>(addDto); var add = _mapper.Map<DataInspection>(addDto);
Guid? parentId = null; 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.ParentId = parentId;
add.CreateTime = DateTime.Now; add.CreateTime = DateTime.Now;
add.CreateUserId = _userInfo.Id; 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>
/// 设置项目以及名称 /// 设置项目以及名称
/// </summary> /// </summary>
@ -349,6 +439,10 @@ namespace IRaCIS.Core.Application.Service.Inspection
} }
#endregion #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<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<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.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

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

View File

@ -88,6 +88,8 @@ namespace IRaCIS.Core.Domain.Models
} }
} }

View File

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