Uat_Study
he 2022-04-07 14:11:01 +08:00
parent 7a1cc3e29f
commit c72a73d339
6 changed files with 94 additions and 50 deletions

View File

@ -87,15 +87,15 @@ namespace IRaCIS.Core.API.Controllers
return ResponseOutput.NotOk(fun.ErrorMessage); 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
{ //{
Status = 1, // Status = 1,
//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,
}; //};
return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo, null, fun, statusdata); return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo, null, fun);
} }
#endregion #endregion
@ -160,15 +160,15 @@ namespace IRaCIS.Core.API.Controllers
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 = "OnVisit", // 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,
}; //};
return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo, null, fun, statusdata); return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo, null, fun);
} }
/// <summary> /// <summary>

View File

@ -234,7 +234,7 @@
对象名称 对象名称
</summary> </summary>
</member> </member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.Enforcement(System.Object,IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionAddDTO,IRaCIS.Core.Application.Contracts.SignDTO,System.Object,IRaCIS.Core.Infrastructure.Extention.IResponseOutput,System.Object)"> <member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.Enforcement(System.Object,IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionAddDTO,IRaCIS.Core.Application.Contracts.SignDTO,System.Object,IRaCIS.Core.Infrastructure.Extention.IResponseOutput)">
<summary> <summary>
通用逻辑封装 通用逻辑封装
</summary> </summary>
@ -243,7 +243,6 @@
<param name="SignInfo">用户签名</param> <param name="SignInfo">用户签名</param>
<param name="fun">委托</param> <param name="fun">委托</param>
<param name="response">方法返回的结果</param> <param name="response">方法返回的结果</param>
<param name="Statusdata">添加状态的对象</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.MapData(System.Object,System.Object)"> <member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.MapData(System.Object,System.Object)">
@ -259,7 +258,7 @@
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.AddSignRecordAsync(IRaCIS.Core.Application.Contracts.SignDTO)"> <member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.AddSignRecordAsync(IRaCIS.Core.Application.Contracts.SignDTO)">
<summary> 添加签名记录 </summary> /// <summary> 添加签名记录 </summary> ///
</member> </member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.AddInspectionRecordAsync(IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionAddDTO,System.Nullable{System.Guid},System.Object)"> <member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.AddInspectionRecordAsync(IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionAddDTO,System.Nullable{System.Guid})">
<summary> <summary>
添加稽查记录 添加稽查记录
</summary> </summary>
@ -268,6 +267,13 @@
<param name="Statusdata">初始化状态对象</param> <param name="Statusdata">初始化状态对象</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.AddListInspectionRecordAsync(System.Collections.Generic.List{IRaCIS.Core.Domain.Models.DataInspection})">
<summary>
批量添加稽查记录
</summary>
<param name="datas"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.SetEnum(IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionAddDTO)"> <member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.SetEnum(IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionAddDTO)">
<summary> <summary>
处理枚举 处理枚举
@ -281,6 +287,13 @@
<param name="Data"></param> <param name="Data"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.Interface.IInspectionService.AddListInspectionRecordAsync(System.Collections.Generic.List{IRaCIS.Core.Domain.Models.DataInspection})">
<summary>
批量添加稽查记录
</summary>
<param name="datas"></param>
<returns></returns>
</member>
<member name="T:IRaCIS.Core.Application.Service.TrialExternalUserService"> <member name="T:IRaCIS.Core.Application.Service.TrialExternalUserService">
<summary> <summary>
项目外部人员 录入流程相关 项目外部人员 录入流程相关

View File

@ -177,13 +177,13 @@ namespace IRaCIS.Core.Application.Service
// CreateMap< FrontAuditConfig,FrontAuditConfigAddOrEdit>().ReverseMap(); // CreateMap< FrontAuditConfig,FrontAuditConfigAddOrEdit>().ReverseMap();
if (await _frontAuditConfigRepository.AnyAsync(x => x.Identification == addOrEditFrontAuditConfig.Identification && x.Id != addOrEditFrontAuditConfig.Id&&x.ConfigType=="M")) if (await _frontAuditConfigRepository.AnyAsync(x => x.Identification == addOrEditFrontAuditConfig.Identification && x.Id != addOrEditFrontAuditConfig.Id&&x.ConfigType=="M"&& addOrEditFrontAuditConfig.ConfigType== "M"))
{ {
return ResponseOutput.NotOk("标识重复"); return ResponseOutput.NotOk("标识重复");
} }
if (await _frontAuditConfigRepository.AnyAsync(x => x.Description == addOrEditFrontAuditConfig.Description && x.Id != addOrEditFrontAuditConfig.Id && x.ConfigType == "M")) if (await _frontAuditConfigRepository.AnyAsync(x => x.Description == addOrEditFrontAuditConfig.Description && x.Id != addOrEditFrontAuditConfig.Id && x.ConfigType == "M" && addOrEditFrontAuditConfig.ConfigType == "M"))
{ {
return ResponseOutput.NotOk("名称重复"); return ResponseOutput.NotOk("名称重复");
} }

View File

@ -44,21 +44,23 @@ namespace IRaCIS.Core.Application.Service.Inspection
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()
//join childrenTyped in _repository.GetQueryable<Dictionary>().Where(x => x.Code == "ChildrenType") on 1 equals 1
//join childrenTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = childrenTyped.Id, ModuleType = data.ChildrenType } equals new { ParentId = childrenTypec.ParentId.Value, ModuleType = childrenTypec.Value } into childrenTypectemp
//from leftchildrenTypec in childrenTypectemp.DefaultIfEmpty()
//join ObjectTyped in _repository.GetQueryable<Dictionary>().Where(x => x.Code == "ObjectType") on 1 equals 1
//join ObjectTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = ObjectTyped.Id, ModuleType = data.ObjectType } equals new { ParentId = ObjectTypec.ParentId.Value, ModuleType = ObjectTypec.Value } into objectTypetemp
//from leftObjectType in objectTypetemp.DefaultIfEmpty()
//join OptTyped in _repository.GetQueryable<Dictionary>().Where(x => x.Code == "OptType") on 1 equals 1 //join moduleTyped in _repository.GetQueryable<Dictionary>().Where(x => x.Code == "ModuleType") on 1 equals 1
//join OptTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = OptTyped.Id, ModuleType = data.OptType } equals new { ParentId = OptTypec.ParentId.Value, ModuleType = OptTypec.Value } into optTypetemp //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 leftOptType in optTypetemp.DefaultIfEmpty()
//join childrenTyped in _repository.GetQueryable<Dictionary>().Where(x => x.Code == "ChildrenType") on 1 equals 1
//join childrenTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = childrenTyped.Id, ModuleType = data.ChildrenType } equals new { ParentId = childrenTypec.ParentId.Value, ModuleType = childrenTypec.Value } into childrenTypectemp
//from leftchildrenTypec in childrenTypectemp.DefaultIfEmpty()
//join ObjectTyped in _repository.GetQueryable<Dictionary>().Where(x => x.Code == "ObjectType") on 1 equals 1
//join ObjectTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = ObjectTyped.Id, ModuleType = data.ObjectType } equals new { ParentId = ObjectTypec.ParentId.Value, ModuleType = ObjectTypec.Value } into objectTypetemp
//from leftObjectType in objectTypetemp.DefaultIfEmpty()
//join OptTyped in _repository.GetQueryable<Dictionary>().Where(x => x.Code == "OptType") on 1 equals 1
//join OptTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = OptTyped.Id, ModuleType = data.OptType } equals new { ParentId = OptTypec.ParentId.Value, ModuleType = OptTypec.Value } into optTypetemp
//from leftOptType in optTypetemp.DefaultIfEmpty()
join trialSign in _repository.GetQueryable<TrialSign>() on data.SignId equals trialSign.Id into trialSigntemp join trialSign in _repository.GetQueryable<TrialSign>() on data.SignId equals trialSign.Id into trialSigntemp
@ -74,6 +76,11 @@ namespace IRaCIS.Core.Application.Service.Inspection
} into frontAuditConfigtemp } into frontAuditConfigtemp
from leftfrontAuditConfig in frontAuditConfigtemp.DefaultIfEmpty() from leftfrontAuditConfig in frontAuditConfigtemp.DefaultIfEmpty()
join moduleTypec in _repository.GetQueryable<Dictionary>() on new { ModuleType = leftfrontAuditConfig.ModuleTypeId } equals new { ModuleType = moduleTypec.Id.ToString() } into moduleTypectemp
from leftmoduleTypec in moduleTypectemp.DefaultIfEmpty()
select new GetDataInspectionOutDto() select new GetDataInspectionOutDto()
{ {
CreateTime = data.CreateTime, CreateTime = data.CreateTime,
@ -145,9 +152,8 @@ namespace IRaCIS.Core.Application.Service.Inspection
/// <param name="SignInfo">用户签名</param> /// <param name="SignInfo">用户签名</param>
/// <param name="fun">委托</param> /// <param name="fun">委托</param>
/// <param name="response">方法返回的结果</param> /// <param name="response">方法返回的结果</param>
/// <param name="Statusdata">添加状态的对象</param>
/// <returns></returns> /// <returns></returns>
public async Task<dynamic> Enforcement(dynamic OptCommand, DataInspectionAddDTO AuditInfo, SignDTO SignInfo, dynamic fun, IResponseOutput? response=null, object? Statusdata=null) public async Task<dynamic> Enforcement(dynamic OptCommand, DataInspectionAddDTO AuditInfo, SignDTO SignInfo, dynamic fun, IResponseOutput? response=null)
{ {
Guid? signId = null; Guid? signId = null;
MapData(OptCommand, AuditInfo); MapData(OptCommand, AuditInfo);
@ -184,7 +190,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
// 判断是否需要前面 // 判断是否需要前面
await AddInspectionRecordAsync(AuditInfo, signId, Statusdata); await AddInspectionRecordAsync(AuditInfo, signId);
if (bResult.IsSuccess == false) if (bResult.IsSuccess == false)
{ {
@ -251,7 +257,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
/// <param name="signId">签名Id</param> /// <param name="signId">签名Id</param>
/// <param name="Statusdata">初始化状态对象</param> /// <param name="Statusdata">初始化状态对象</param>
/// <returns></returns> /// <returns></returns>
public async Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId=null, object? Statusdata = null) public async Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId=null)
{ {
await SetEnum(addDto); await SetEnum(addDto);
var add = _mapper.Map<DataInspection>(addDto); var add = _mapper.Map<DataInspection>(addDto);
@ -264,16 +270,16 @@ namespace IRaCIS.Core.Application.Service.Inspection
add.IP = _userInfo.IP; add.IP = _userInfo.IP;
await SetInspectionNameValue(add); await SetInspectionNameValue(add);
await _repository.AddAsync(add); await _repository.AddAsync(add);
if (addDto.OptType.ToLower() == "Add".ToLower()&& Statusdata!=null) //if (addDto.OptType.ToLower() == "Add".ToLower()&& Statusdata!=null)
{ //{
DataInspection ststus=JsonConvert.DeserializeObject<DataInspection>(JsonConvert.SerializeObject(add))??new DataInspection(); // DataInspection ststus=JsonConvert.DeserializeObject<DataInspection>(JsonConvert.SerializeObject(add))??new DataInspection();
ststus.CreateTime = add.CreateTime.AddSeconds(1); // ststus.CreateTime = add.CreateTime.AddSeconds(1);
ststus.JsonDetail = JsonConvert.SerializeObject(Statusdata); // ststus.JsonDetail = JsonConvert.SerializeObject(Statusdata);
ststus.ChildrenType = "Status"; // ststus.ChildrenType = "Status";
ststus.OptType = "Init"; // ststus.OptType = "Init";
ststus.Id = Guid.NewGuid(); // ststus.Id = Guid.NewGuid();
await _repository.AddAsync(ststus); // await _repository.AddAsync(ststus);
} //}
var success = await _repository.SaveChangesAsync(); var success = await _repository.SaveChangesAsync();
return ResponseOutput.Ok(success); return ResponseOutput.Ok(success);
@ -300,6 +306,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
add.ParentId = (await _repository.GetQueryable<DataInspection>().Where(x => x.TrialId == add.TrialId && x.SubjectVisitId == add.SubjectVisitId && x.SubjectId == add.SubjectId && x.SiteId == add.SiteId && x.ChildrenType == add.ChildrenType && x.ObjectType == add.ObjectType).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id; add.ParentId = (await _repository.GetQueryable<DataInspection>().Where(x => x.TrialId == add.TrialId && x.SubjectVisitId == add.SubjectVisitId && x.SubjectId == add.SubjectId && x.SiteId == add.SiteId && x.ChildrenType == add.ChildrenType && x.ObjectType == add.ObjectType).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id;
add.CreateUserId = _userInfo.Id; add.CreateUserId = _userInfo.Id;
add.IP = _userInfo.IP; add.IP = _userInfo.IP;
await SetInspectionNameValue(add);
} }
await _dataInspectionRepository.AddRangeAsync(datas); await _dataInspectionRepository.AddRangeAsync(datas);

View File

@ -19,12 +19,12 @@ namespace IRaCIS.Core.Application.Service.Inspection.Interface
Task<Guid> AddSignRecordAsync(SignDTO signDTO); Task<Guid> AddSignRecordAsync(SignDTO signDTO);
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);
Task SetEnum(DataInspectionAddDTO Data); Task SetEnum(DataInspectionAddDTO Data);
Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId = null, object? Statusdata = null); Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId = null);
/// <summary> /// <summary>
/// 批量添加稽查记录 /// 批量添加稽查记录

View File

@ -4,6 +4,8 @@ using IRaCIS.Core.Infra.EFCore;
using IRaCIS.Core.Application.Filter; using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Service.Inspection.Interface;
using Newtonsoft.Json;
namespace IRaCIS.Application.Services namespace IRaCIS.Application.Services
{ {
@ -11,10 +13,12 @@ namespace IRaCIS.Application.Services
public class SubjectService : BaseService, ISubjectService public class SubjectService : BaseService, ISubjectService
{ {
private readonly IRepository<Subject> _subjectRepository; private readonly IRepository<Subject> _subjectRepository;
private readonly IInspectionService _inspectionService;
public SubjectService(IRepository<Subject> subjectRepository) public SubjectService(IRepository<Subject> subjectRepository, IInspectionService inspectionService)
{ {
_subjectRepository = subjectRepository; _subjectRepository = subjectRepository;
this._inspectionService = inspectionService;
} }
/// <summary> /// <summary>
@ -95,6 +99,26 @@ namespace IRaCIS.Application.Services
await _repository.SaveChangesAsync(); await _repository.SaveChangesAsync();
var createtime = DateTime.Now.AddSeconds(1);
// 添加稽查记录
if (subjectCommand.Id == null)
{
List<DataInspection> datas = new List<DataInspection>();
datas.Add(new DataInspection()
{
TrialId = subjectCommand.TrialId,
SiteId = subjectCommand.SiteId,
SubjectId = subjectCommand.Id,
SubjectCode = subjectCommand.Code,
IsSign=false,
Identification= "Subject|Init|Subject|Status",
JsonDetail= JsonConvert.SerializeObject(new {
Status= "OnVisit",
})
});
await _inspectionService.AddListInspectionRecordAsync(datas);
}
return ResponseOutput.Ok(mapedSubject.Id.ToString()); return ResponseOutput.Ok(mapedSubject.Id.ToString());
} }