diff --git a/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs b/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs index af9f61ea7..66b33faf6 100644 --- a/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs +++ b/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs @@ -12,6 +12,7 @@ using Magicodes.ExporterAndImporter.Excel.AspNetCore; using IRaCIS.Core.Application.Service.Inspection.Interface; using Newtonsoft.Json; using IRaCIS.Core.Infrastructure; +using MassTransit; namespace IRaCIS.Application.Services { @@ -523,8 +524,8 @@ namespace IRaCIS.Application.Services { subjectsids.ForEach(y => { - var dataindtid = Guid.NewGuid(); - var guid = Guid.NewGuid(); + Guid dataindtid = NewId.NextGuid(); + Guid guid = NewId.NextGuid(); // datas.Add(new DataInspection() { @@ -562,12 +563,12 @@ namespace IRaCIS.Application.Services SiteId = y.SiteId, SubjectId = y.Id, SubjectVisitId = guid, - SubjectCode = y.Code, BlindName = x.BlindName, ParentId = dataindtid, SubjectVisitName = x.VisitName, IsSign = false, + TrialId=x.TrialId, CreateTime = createtime.AddMilliseconds(500), Identification = "Init|Visit|Status|Visit-Image Upload", JsonDetail = JsonConvert.SerializeObject(new @@ -579,6 +580,14 @@ namespace IRaCIS.Application.Services IsBaseLine = x.IsBaseLine, IsEnrollment = y.IsEnrollment, IsUrgent = y.IsUrgent, + VisitNum = x.VisitNum, + VisitDay = x.VisitDay, + VisitExecuted = false, + VisitWindowLeft = x.VisitWindowLeft, + VisitWindowRight = x.VisitWindowRight, + IsFinalVisit = false, + IsLostVisit = false, + PDState = trial.IsPDProgressView, }), }); diff --git a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs index df075e6bb..31ddcf3af 100644 --- a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs +++ b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs @@ -159,7 +159,11 @@ namespace IRaCIS.Core.Infra.EFCore foreach (var add in datas) { await SetInspectionNameValue(add); - add.ParentId = (await _dbContext.DataInspection.AsQueryable().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 && x.VisitStageId == add.VisitStageId && x.GeneralId == add.GeneralId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id; + if (add.ParentId == null) + { + add.ParentId = (await _dbContext.DataInspection.AsQueryable().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 && x.VisitStageId == add.VisitStageId && x.GeneralId == add.GeneralId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id; + + } add.CreateUserId = _userInfo.Id; add.IP = _userInfo.IP; var JsonData = JsonConvert.DeserializeObject>(add.JsonDetail);