Test.EIImageViewer
parent
4b7435660f
commit
0f9607674d
|
@ -569,8 +569,9 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk(fun.ErrorMessage);
|
return ResponseOutput.NotOk(fun.ErrorMessage);
|
||||||
}
|
}
|
||||||
opt.AuditInfo.VisitStageId = Guid.Parse(fun.Data);
|
opt.AuditInfo.VisitStageId = fun.Data.Id;
|
||||||
opt.OptCommand.Id = Guid.Parse(fun.Data);
|
opt.OptCommand.Id = fun.Data.Id;
|
||||||
|
|
||||||
return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo, null, fun);
|
return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo, null, fun);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,6 +600,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
public async Task<IResponseOutput> ConfirmTrialVisitPlan(DataInspectionDto<IDDto> opt)
|
public async Task<IResponseOutput> ConfirmTrialVisitPlan(DataInspectionDto<IDDto> opt)
|
||||||
{
|
{
|
||||||
var fun = _visitPlanService.ConfirmTrialVisitPlan;
|
var fun = _visitPlanService.ConfirmTrialVisitPlan;
|
||||||
|
opt.AuditInfo.NeedSava = false;
|
||||||
return await _inspectionService.Enforcement(opt.OptCommand.Id, opt.AuditInfo, opt.SignInfo, fun);
|
return await _inspectionService.Enforcement(opt.OptCommand.Id, opt.AuditInfo, opt.SignInfo, fun);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace IRaCIS.Application.Interfaces
|
||||||
{
|
{
|
||||||
public interface IVisitPlanService
|
public interface IVisitPlanService
|
||||||
{
|
{
|
||||||
Task<IResponseOutput<string>> AddOrUpdateVisitStage(VisitPlanCommand visitPlan);
|
Task<IResponseOutput<VisitStage>> AddOrUpdateVisitStage(VisitPlanCommand visitPlan);
|
||||||
Task<IResponseOutput> ConfirmTrialVisitPlan(Guid trialId);
|
Task<IResponseOutput> ConfirmTrialVisitPlan(Guid trialId);
|
||||||
Task<IResponseOutput> DeleteVisitStage(Guid id);
|
Task<IResponseOutput> DeleteVisitStage(Guid id);
|
||||||
Task<IActionResult> DownloadInflunceStudyList(Guid visitPlanInfluenceStatId);
|
Task<IActionResult> DownloadInflunceStudyList(Guid visitPlanInfluenceStatId);
|
||||||
|
|
|
@ -11,6 +11,7 @@ using Magicodes.ExporterAndImporter.Excel;
|
||||||
using Magicodes.ExporterAndImporter.Excel.AspNetCore;
|
using Magicodes.ExporterAndImporter.Excel.AspNetCore;
|
||||||
using IRaCIS.Core.Application.Service.Inspection.Interface;
|
using IRaCIS.Core.Application.Service.Inspection.Interface;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using IRaCIS.Core.Infrastructure;
|
||||||
|
|
||||||
namespace IRaCIS.Application.Services
|
namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
|
@ -89,13 +90,14 @@ namespace IRaCIS.Application.Services
|
||||||
/// <summary> 添加或更新访视计划某项[New]</summary>
|
/// <summary> 添加或更新访视计划某项[New]</summary>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[UnitOfWork]
|
[UnitOfWork]
|
||||||
public async Task<IResponseOutput<string>> AddOrUpdateVisitStage(VisitPlanCommand visitPlan)
|
public async Task<IResponseOutput<VisitStage>> AddOrUpdateVisitStage(VisitPlanCommand visitPlan)
|
||||||
{
|
{
|
||||||
DateTime createtime = DateTime.Now;
|
DateTime createtime = DateTime.Now;
|
||||||
List<DataInspection> datas = new List<DataInspection>();
|
|
||||||
if (!await _trialRepository.Where(t => t.Id == visitPlan.TrialId).IgnoreQueryFilters().AnyAsync(t => t.TrialStatusStr == StaticData.TrialOngoing || t.TrialStatusStr == StaticData.TrialInitializing))
|
if (!await _trialRepository.Where(t => t.Id == visitPlan.TrialId).IgnoreQueryFilters().AnyAsync(t => t.TrialStatusStr == StaticData.TrialOngoing || t.TrialStatusStr == StaticData.TrialInitializing))
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk(" only in Initializing or Ongoing State can operate ");
|
throw new BusinessValidationFailedException(" only in Initializing or Ongoing State can operate ");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var visitPlanList = await _visitStageRepository.Where(t => t.TrialId == visitPlan.TrialId,ignoreQueryFilters:true)
|
var visitPlanList = await _visitStageRepository.Where(t => t.TrialId == visitPlan.TrialId,ignoreQueryFilters:true)
|
||||||
|
@ -112,7 +114,8 @@ namespace IRaCIS.Application.Services
|
||||||
//比当前 visitNum小的 visitDay的最大值 还小 不允许添加
|
//比当前 visitNum小的 visitDay的最大值 还小 不允许添加
|
||||||
if (visitPlan.VisitDay <= visitPlanList.Where(t => t.VisitNum < visitPlan.VisitNum).Select(t => t.VisitDay).Max())
|
if (visitPlan.VisitDay <= visitPlanList.Where(t => t.VisitNum < visitPlan.VisitNum).Select(t => t.VisitDay).Max())
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk("For the visit plan, the VisitDay with a larger VisitNum should be larger than the VisitDay with a smaller VisitNum.");
|
throw new BusinessValidationFailedException(" For the visit plan, the VisitDay with a larger VisitNum should be larger than the VisitDay with a smaller VisitNum.");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +123,7 @@ namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
if (visitPlan.VisitDay >= visitPlanList.Where(t => t.VisitNum > visitPlan.VisitNum).Select(t => t.VisitDay).Min())
|
if (visitPlan.VisitDay >= visitPlanList.Where(t => t.VisitNum > visitPlan.VisitNum).Select(t => t.VisitDay).Min())
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk("For the visit plan, the VisitDay with a larger VisitNum should be larger than the VisitDay with a smaller VisitNum.");
|
throw new BusinessValidationFailedException("For the visit plan, the VisitDay with a larger VisitNum should be larger than the VisitDay with a smaller VisitNum.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,12 +132,12 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
if (await _visitStageRepository.AnyAsync(t => t.TrialId == visitPlan.TrialId && (t.VisitName == visitPlan.VisitName || t.VisitNum == visitPlan.VisitNum), true))
|
if (await _visitStageRepository.AnyAsync(t => t.TrialId == visitPlan.TrialId && (t.VisitName == visitPlan.VisitName || t.VisitNum == visitPlan.VisitNum), true))
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk("A visit with the same VisitName/VisitNum already existed in the current visit plan.");
|
throw new BusinessValidationFailedException("A visit with the same VisitName/VisitNum already existed in the current visit plan.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (await _visitStageRepository.AnyAsync(t => t.TrialId == visitPlan.TrialId && t.IsBaseLine, true) && visitPlan.IsBaseLine)
|
if (await _visitStageRepository.AnyAsync(t => t.TrialId == visitPlan.TrialId && t.IsBaseLine, true) && visitPlan.IsBaseLine)
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk("A visit already is baseline in the current visit plan.");
|
throw new BusinessValidationFailedException("A visit already is baseline in the current visit plan.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//已添加受试者 都不存在该新增的计划名称 那么该项目所有受试者都增加一个访视记录
|
//已添加受试者 都不存在该新增的计划名称 那么该项目所有受试者都增加一个访视记录
|
||||||
|
@ -158,19 +161,7 @@ namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
svItem.VisitExecuted = VisitExecutedEnum.Unavailable;
|
svItem.VisitExecuted = VisitExecutedEnum.Unavailable;
|
||||||
}
|
}
|
||||||
//datas.Add(new DataInspection()
|
|
||||||
//{
|
|
||||||
// SubjectVisitId = svItem.Id,
|
|
||||||
// SubjectVisitName = svItem.VisitName,
|
|
||||||
// BlindName = visitPlan.BlindName,
|
|
||||||
// Identification = "Add|Visit|Info|Visit-Image Upload",
|
|
||||||
// SiteId = svItem.SiteId,
|
|
||||||
// TrialId = svItem.TrialId,
|
|
||||||
// SubjectId = svItem.SubjectId,
|
|
||||||
// IsSign = false,
|
|
||||||
// CreateTime = createtime,
|
|
||||||
// JsonDetail = JsonConvert.SerializeObject(svItem)
|
|
||||||
//});
|
|
||||||
|
|
||||||
|
|
||||||
await _repository.AddAsync(svItem);
|
await _repository.AddAsync(svItem);
|
||||||
|
@ -184,16 +175,7 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
var result = await _repository.AddAsync(visitPlanItem);
|
var result = await _repository.AddAsync(visitPlanItem);
|
||||||
visitPlan.Id = result.Id;
|
visitPlan.Id = result.Id;
|
||||||
//datas.Add(new DataInspection()
|
|
||||||
//{
|
|
||||||
// BlindName = visitPlan.BlindName,
|
|
||||||
// Identification = "Add|Visit|Info|Visit-Image Upload",
|
|
||||||
// TrialId = visitPlan.TrialId,
|
|
||||||
// IsSign = false,
|
|
||||||
// CreateTime = createtime.AddSeconds(1),
|
|
||||||
// VisitStageId = result.Id,
|
|
||||||
// JsonDetail = JsonConvert.SerializeObject(visitPlan)
|
|
||||||
//});
|
|
||||||
|
|
||||||
//更新项目访视计划状态为未确认
|
//更新项目访视计划状态为未确认
|
||||||
await _trialRepository.BatchUpdateAsync(u => u.Id == visitPlan.TrialId, t => new Trial() { VisitPlanConfirmed = false });
|
await _trialRepository.BatchUpdateAsync(u => u.Id == visitPlan.TrialId, t => new Trial() { VisitPlanConfirmed = false });
|
||||||
|
@ -202,7 +184,7 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
//return ResponseOutput.Ok(result.Id.ToString());
|
//return ResponseOutput.Ok(result.Id.ToString());
|
||||||
|
|
||||||
|
return ResponseOutput.Ok(visitPlanItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
else//update
|
else//update
|
||||||
|
@ -211,25 +193,25 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
if (await _visitStageRepository.AnyAsync(t => t.TrialId == visitPlan.TrialId && (t.VisitName == visitPlan.VisitName || t.VisitNum == visitPlan.VisitNum) && t.Id != visitPlan.Id,true))
|
if (await _visitStageRepository.AnyAsync(t => t.TrialId == visitPlan.TrialId && (t.VisitName == visitPlan.VisitName || t.VisitNum == visitPlan.VisitNum) && t.Id != visitPlan.Id,true))
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk("A visit with the same VisitName/VisitNum already existed in the current visit plan.");
|
throw new BusinessValidationFailedException("A visit with the same VisitName/VisitNum already existed in the current visit plan.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (await _visitStageRepository.AnyAsync(t => t.TrialId == visitPlan.TrialId && t.IsBaseLine && t.Id != visitPlan.Id,true) && visitPlan.IsBaseLine)
|
if (await _visitStageRepository.AnyAsync(t => t.TrialId == visitPlan.TrialId && t.IsBaseLine && t.Id != visitPlan.Id,true) && visitPlan.IsBaseLine)
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk("A visit already is baseline in the current visit plan.");
|
throw new BusinessValidationFailedException("A visit already is baseline in the current visit plan.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var stage = await _visitStageRepository.FirstOrDefaultAsync(t => t.Id == visitPlan.Id,true);
|
var stage = await _visitStageRepository.FirstOrDefaultAsync(t => t.Id == visitPlan.Id,true);
|
||||||
if (stage == null) return ResponseOutput.NotOk("None");
|
if (stage == null) throw new BusinessValidationFailedException("None");
|
||||||
|
|
||||||
//修改是否是基线
|
//修改是否是基线
|
||||||
if (stage.IsBaseLine && stage.IsBaseLine != visitPlan.IsBaseLine)
|
if (stage.IsBaseLine && stage.IsBaseLine != visitPlan.IsBaseLine)
|
||||||
{
|
{
|
||||||
if (await _repository.Where<SubjectVisit>(t => t.TrialId == visitPlan.TrialId).AnyAsync(v => v.IsBaseLine && v.SubmitState >= SubmitStateEnum.ToSubmit))
|
if (await _repository.Where<SubjectVisit>(t => t.TrialId == visitPlan.TrialId).AnyAsync(v => v.IsBaseLine && v.SubmitState >= SubmitStateEnum.ToSubmit))
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk("有CRC已经为基线上传了影像数据,不允许修改基线");
|
throw new BusinessValidationFailedException("有CRC已经为基线上传了影像数据,不允许修改基线");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,13 +223,13 @@ namespace IRaCIS.Application.Services
|
||||||
//await _trialRepository.UpdateFromQueryAsync(u => u.Id == visitPlan.TrialId, t => new Trial() { VisitPlanConfirmed = false });
|
//await _trialRepository.UpdateFromQueryAsync(u => u.Id == visitPlan.TrialId, t => new Trial() { VisitPlanConfirmed = false });
|
||||||
|
|
||||||
await _repository.SaveChangesAsync();
|
await _repository.SaveChangesAsync();
|
||||||
|
return ResponseOutput.Ok(stage);
|
||||||
//return ResponseOutput.Ok();
|
//return ResponseOutput.Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
await _inspectionService.AddListInspectionRecordAsync(datas);
|
|
||||||
return ResponseOutput.Ok(visitPlan.Id.Value.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> 删除项目计划某一项[New]</summary>
|
/// <summary> 删除项目计划某一项[New]</summary>
|
||||||
|
|
Loading…
Reference in New Issue