添加数据
This commit is contained in:
@@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Application.Service.Inspection.Interface;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using Newtonsoft.Json;
|
||||
using IRaCIS.Core.Domain.Common;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
@@ -34,6 +35,7 @@ namespace IRaCIS.Application.Services
|
||||
[TypeFilter(typeof(TrialResourceFilter))]
|
||||
public async Task<IResponseOutput<string>> AddOrUpdateSubject([FromBody] SubjectCommand subjectCommand)
|
||||
{
|
||||
var svlist = new List<SubjectVisit>();
|
||||
if (await _repository.AnyAsync<Trial>(t => t.Id == subjectCommand.TrialId && !t.VisitPlanConfirmed))
|
||||
{
|
||||
return ResponseOutput.NotOk("The trial visit plan has not been confirmed yet.Please contact the project manager to confirm the visit plan before adding subject.");
|
||||
@@ -60,7 +62,7 @@ namespace IRaCIS.Application.Services
|
||||
//添加受试者的时候,获取访视计划列表,添加到受试者访视表。
|
||||
var visitPlan = await _repository.Where<VisitStage>(t => t.TrialId == subjectCommand.TrialId).ToListAsync();
|
||||
|
||||
var svlist = _mapper.Map<List<SubjectVisit>>(visitPlan);
|
||||
svlist = _mapper.Map<List<SubjectVisit>>(visitPlan);
|
||||
|
||||
var IsEnrollementQualificationConfirm = await _repository.Where<Trial>(t => t.Id == mapedSubject.TrialId).Select(u => u.IsEnrollementQualificationConfirm).FirstOrDefaultAsync();
|
||||
|
||||
@@ -109,8 +111,14 @@ namespace IRaCIS.Application.Services
|
||||
// })
|
||||
//});
|
||||
|
||||
|
||||
JsonSerializerSettings settings = new JsonSerializerSettings();
|
||||
settings.PreserveReferencesHandling = PreserveReferencesHandling.Objects;
|
||||
settings.ReferenceLoopHandling = ReferenceLoopHandling.Serialize;
|
||||
//var jsonData = JsonConvert.SerializeObject(info, settings);
|
||||
|
||||
var visittime = createtime.AddSeconds(1);
|
||||
foreach (var item in mapedSubject.SubjectVisitList)
|
||||
foreach (var item in svlist)
|
||||
{
|
||||
// 添加访视
|
||||
datas.Add(new DataInspection()
|
||||
@@ -125,7 +133,7 @@ namespace IRaCIS.Application.Services
|
||||
IsSign = false,
|
||||
CreateTime = visittime,
|
||||
Identification = "Add|Visit|Info|Visit-Image Upload",
|
||||
JsonDetail = JsonConvert.SerializeObject(item)
|
||||
JsonDetail = item.ToJcJson()
|
||||
});
|
||||
|
||||
// 初始化访视
|
||||
@@ -142,7 +150,7 @@ namespace IRaCIS.Application.Services
|
||||
IsSign = false,
|
||||
CreateTime = visittime.AddSeconds(1),
|
||||
Identification = "Init|Visit|Status|Visit-Image Upload",
|
||||
JsonDetail = JsonConvert.SerializeObject(item)
|
||||
JsonDetail = item.ToJcJson()
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user