This commit is contained in:
he
2022-04-07 14:11:01 +08:00
parent 7a1cc3e29f
commit c72a73d339
6 changed files with 94 additions and 50 deletions
@@ -4,6 +4,8 @@ using IRaCIS.Core.Infra.EFCore;
using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Domain.Share;
using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Service.Inspection.Interface;
using Newtonsoft.Json;
namespace IRaCIS.Application.Services
{
@@ -11,10 +13,12 @@ namespace IRaCIS.Application.Services
public class SubjectService : BaseService, ISubjectService
{
private readonly IRepository<Subject> _subjectRepository;
private readonly IInspectionService _inspectionService;
public SubjectService(IRepository<Subject> subjectRepository)
public SubjectService(IRepository<Subject> subjectRepository, IInspectionService inspectionService)
{
_subjectRepository = subjectRepository;
this._inspectionService = inspectionService;
}
/// <summary>
@@ -95,6 +99,26 @@ namespace IRaCIS.Application.Services
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());
}