稽查
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user