Uat_Study
he 2022-03-30 09:46:17 +08:00
parent 4c7fad02b2
commit 99e185baf5
8 changed files with 80 additions and 17 deletions

View File

@ -137,9 +137,22 @@ namespace IRaCIS.Core.API.Controllers
public async Task<IResponseOutput> AddOrUpdateSubject(InsSubjectCommand opt)
{
opt.AuditInfo.SubjectId = opt.OptCommand.Id;
var fun = _subjectService.AddOrUpdateSubject;
return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo, fun);
var fun = await _subjectService.AddOrUpdateSubject(opt.OptCommand);
opt.AuditInfo.SubjectId = Guid.Parse(fun.Data);
var statusdata = new {
status = 1,
outEnrollmentTime = DateTime.Now.ToString("yyyy-MM-dd"),
visitOverTime = DateTime.Now.ToString("yyyy-MM-dd"),
reason = string.Empty,
};
return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo, null, fun, statusdata);
}
/// <summary>

View File

@ -658,7 +658,7 @@
是否有签名
</summary>
</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)">
<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)">
<summary>
通用逻辑封装
</summary>
@ -666,6 +666,8 @@
<param name="AuditInfo">添加稽查</param>
<param name="SignInfo">用户签名</param>
<param name="fun">委托</param>
<param name="response">方法返回的结果</param>
<param name="Statusdata">添加状态的对象</param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.MapData(System.Object,System.Object)">
@ -681,8 +683,14 @@
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.AddSignRecordAsync(IRaCIS.Core.Application.Contracts.SignDTO)">
<summary> 添加签名记录 </summary> ///
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.AddInspectionRecordAsync(IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionAddDTO,System.Nullable{System.Guid})">
<summary> 添加稽查记录( 有的会签名,有的不会签名) </summary> ///
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.AddInspectionRecordAsync(IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionAddDTO,System.Nullable{System.Guid},System.Object)">
<summary>
添加稽查记录
</summary>
<param name="addDto">添加对象</param>
<param name="signId">签名Id</param>
<param name="Statusdata">初始化状态对象</param>
<returns></returns>
</member>
<member name="T:IRaCIS.Core.Application.Service.TrialExternalUserService">
<summary>

View File

@ -31,7 +31,7 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
/// <summary>
/// 子类
/// </summary>
public string ChildrenType { get; set; }
public string ChildrenType { get; set; } = string.Empty;
public bool IsSign { get; set; }
public string JsonDetail { get; set; } = string.Empty;
@ -141,6 +141,8 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
public string UserFirstName { get; set; } = string.Empty;
public string UserLastName { get; set; } = string.Empty;
public string SubjectCode { get; set; } = string.Empty;
}

View File

@ -3,6 +3,7 @@ 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 Newtonsoft.Json;
using Panda.DynamicWebApi.Attributes;
using System;
using System.Collections.Generic;
@ -66,6 +67,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
CreateUser = leftuser.UserName,
UserFirstName = leftuser.FirstName,
UserLastName = leftuser.LastName,
SubjectCode=leftsubject.Code,
};
query = query.WhereIf(!dto.BlindName.IsNullOrEmpty(), x => x.BlindName == dto.BlindName)
@ -126,8 +128,10 @@ namespace IRaCIS.Core.Application.Service.Inspection
/// <param name="AuditInfo">添加稽查</param>
/// <param name="SignInfo">用户签名</param>
/// <param name="fun">委托</param>
/// <param name="response">方法返回的结果</param>
/// <param name="Statusdata">添加状态的对象</param>
/// <returns></returns>
public async Task<dynamic> Enforcement(dynamic OptCommand, DataInspectionAddDTO AuditInfo, SignDTO SignInfo, dynamic fun, IResponseOutput response=null)
public async Task<dynamic> Enforcement(dynamic OptCommand, DataInspectionAddDTO AuditInfo, SignDTO SignInfo, dynamic fun, IResponseOutput? response=null, object? Statusdata=null)
{
Guid? signId = null;
MapData(OptCommand, AuditInfo);
@ -164,7 +168,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
// 判断是否需要前面
await AddInspectionRecordAsync(AuditInfo, signId);
await AddInspectionRecordAsync(AuditInfo, signId, Statusdata);
if (bResult.IsSuccess == false)
{
@ -224,18 +228,49 @@ namespace IRaCIS.Core.Application.Service.Inspection
}
/// <summary> 添加稽查记录( 有的会签名,有的不会签名) </summary> ///
public async Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId)
/// <summary>
/// 添加稽查记录
/// </summary>
/// <param name="addDto">添加对象</param>
/// <param name="signId">签名Id</param>
/// <param name="Statusdata">初始化状态对象</param>
/// <returns></returns>
public async Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId, object? Statusdata = null)
{
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 == x.SiteId).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).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id;
add.ParentId = parentId;
add.CreateTime = DateTime.Now;
add.CreateUserId = _userInfo.Id;
add.SignId = signId;
add.IP = _userInfo.IP;
await _repository.AddAsync(add);
if (addDto.OptType.ToLower() == "Add".ToLower()|| Statusdata!=null)
{
DataInspection ststus = new DataInspection()
{
SignId = signId,
SiteId = add.SiteId,
SubjectId = add.SubjectId,
SubjectVisitId = add.SubjectVisitId,
IsSign = add.IsSign,
BlindName = add.BlindName,
ChildrenType = "Status",
OptType = "Init",
CreateTime = add.CreateTime,
CreateUserId = add.CreateUserId,
IP = add.IP,
ModuleType = add.ModuleType,
TrialId = add.TrialId,
JsonDetail = JsonConvert.SerializeObject(Statusdata)
};
await _repository.AddAsync(ststus);
}
var success = await _repository.SaveChangesAsync();
return ResponseOutput.Ok(success);

View File

@ -19,8 +19,8 @@ namespace IRaCIS.Core.Application.Service.Inspection.Interface
Task<Guid> AddSignRecordAsync(SignDTO signDTO);
Task<dynamic> Enforcement(dynamic OptCommand, DataInspectionAddDTO AuditInfo, SignDTO SignInfo, dynamic fun, IResponseOutput response = 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);
Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId, object? Statusdata = null);
}
}

View File

@ -43,9 +43,14 @@ namespace IRaCIS.Application.Contracts
public class SubjectStatusChangeCommand
{
[NotDefault]
public Guid SubjectId { get; set; }
public Guid? TrialId { get; set; }
public Guid? SiteId { get; set; }
public SubjectStatus Status { get; set; }
public DateTime? OutEnrollmentTime { get; set; }
public DateTime? VisitOverTime { get; set; }

View File

@ -5,7 +5,7 @@ namespace IRaCIS.Application.Interfaces
{
public interface ISubjectService
{
Task<IResponseOutput> AddOrUpdateSubject([FromBody] SubjectCommand subjectCommand);
Task<IResponseOutput<string>> AddOrUpdateSubject([FromBody] SubjectCommand subjectCommand);
Task<IResponseOutput> DeleteSubject(Guid id);
Task<IResponseOutput> UpdateSubjectStatus(SubjectStatusChangeCommand subjectStatusChangeCommand);

View File

@ -25,7 +25,7 @@ namespace IRaCIS.Application.Services
[TrialAudit(AuditType.SubjectAudit, AuditOptType.AddOrUpdateSubject)]
[TypeFilter(typeof(TrialResourceFilter))]
public async Task<IResponseOutput> AddOrUpdateSubject([FromBody] SubjectCommand subjectCommand)
public async Task<IResponseOutput<string>> AddOrUpdateSubject([FromBody] SubjectCommand subjectCommand)
{
if (await _repository.AnyAsync<Trial>(t => t.Id == subjectCommand.TrialId && !t.VisitPlanConfirmed))