添加接口

Uat_Study
he 2022-04-07 16:25:47 +08:00
parent 34dd484582
commit 348d2cb7d4
10 changed files with 185 additions and 13 deletions

View File

@ -91,6 +91,45 @@ namespace IRaCIS.Core.API.Controllers
return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo, null, fun); return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo, null, fun);
} }
[HttpPost, Route("Inspection/subjectVisit/SetSubjectVisitUrgent")]
public async Task<IResponseOutput> SetSubjectVisitUrgent(DataInspectionDto<SetSubjectVisitUrgentCommand> opt)
{
var fun = await _subjectVisitService.SetSubjectVisitUrgent(opt.OptCommand.subjectVisitId,opt.OptCommand.isUrgent);
if (!fun.IsSuccess)
{
return ResponseOutput.NotOk(fun.ErrorMessage);
}
return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo, null, fun);
}
[HttpPost, Route("Inspection/subjectVisit/DeleteSV")]
public async Task<IResponseOutput> DeleteSV(DataInspectionDto<DeleteSVCommand> opt)
{
var fun = await _subjectVisitService.DeleteSV(opt.OptCommand.Id);
if (!fun.IsSuccess)
{
return ResponseOutput.NotOk(fun.ErrorMessage);
}
return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo, null, fun);
}
[HttpPost, Route("Inspection/subjectVisit/SetSVExecuted")]
public async Task<IResponseOutput> SetSVExecuted(DataInspectionDto<DeleteSVCommand> opt)
{
var fun = await _subjectVisitService.SetSVExecuted(opt.OptCommand.Id);
if (!fun.IsSuccess)
{
return ResponseOutput.NotOk(fun.ErrorMessage);
}
return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo, null, fun);
}
#endregion #endregion
#region 配置项目信息 #region 配置项目信息

View File

@ -386,6 +386,16 @@
<member name="T:IRaCIS.Core.Application.ViewModel.FrontAuditConfigView"> <member name="T:IRaCIS.Core.Application.ViewModel.FrontAuditConfigView">
<summary> FrontAuditConfigView 列表视图模型 </summary> <summary> FrontAuditConfigView 列表视图模型 </summary>
</member> </member>
<member name="P:IRaCIS.Core.Application.ViewModel.FrontAuditConfigView.IsHaveSign">
<summary>
是否有签名
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.FrontAuditConfigView.IsHaveReason">
<summary>
是否有原因
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.FrontAuditConfigView.IsForwardPosition"> <member name="P:IRaCIS.Core.Application.ViewModel.FrontAuditConfigView.IsForwardPosition">
<summary> <summary>
是否向前站位 是否向前站位
@ -430,6 +440,16 @@
标识 标识
</summary> </summary>
</member> </member>
<member name="P:IRaCIS.Core.Application.ViewModel.FrontAuditConfigAddOrEdit.IsHaveSign">
<summary>
是否有签名
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.FrontAuditConfigAddOrEdit.IsHaveReason">
<summary>
是否有原因
</summary>
</member>
<member name="T:IRaCIS.Core.Application.ViewModel.SystemAnonymizationView"> <member name="T:IRaCIS.Core.Application.ViewModel.SystemAnonymizationView">
<summary> SystemAnonymizationView 列表视图模型 </summary> <summary> SystemAnonymizationView 列表视图模型 </summary>
</member> </member>

View File

@ -58,6 +58,16 @@ namespace IRaCIS.Core.Application.ViewModel
public string ByTrialConfig { get; set; } = string.Empty; public string ByTrialConfig { get; set; } = string.Empty;
/// <summary>
/// 是否有签名
/// </summary>
public bool? IsHaveSign { get; set; }
/// <summary>
/// 是否有原因
/// </summary>
public bool? IsHaveReason { get; set; }
/// <summary> /// <summary>
/// 是否向前站位 /// 是否向前站位
@ -179,6 +189,18 @@ namespace IRaCIS.Core.Application.ViewModel
/// <summary>
/// 是否有签名
/// </summary>
public bool? IsHaveSign { get; set; }
/// <summary>
/// 是否有原因
/// </summary>
public bool? IsHaveReason { get; set; }
} }

View File

@ -148,6 +148,8 @@ namespace IRaCIS.Core.Application.Service
ByTrialConfig=data.ByTrialConfig, ByTrialConfig=data.ByTrialConfig,
IsForwardPosition=data.IsForwardPosition, IsForwardPosition=data.IsForwardPosition,
Identification=data.Identification, Identification=data.Identification,
IsHaveReason=data.IsHaveReason,
IsHaveSign=data.IsHaveSign,
}; };
query = query query = query

View File

@ -211,10 +211,15 @@ namespace IRaCIS.Core.Application.Service.Inspection
foreach (var item in column) foreach (var item in column)
{ {
try try
{
var i = mapData.GetType().GetProperty(item).GetValue(mapData);
if (i == null)
{ {
var value = data.GetType().GetProperty(item).GetValue(data); var value = data.GetType().GetProperty(item).GetValue(data);
mapData.GetType().GetProperty(item).SetValue(mapData, value); mapData.GetType().GetProperty(item).SetValue(mapData, value);
} }
}
catch (Exception) catch (Exception)
{ {
continue; continue;

View File

@ -43,6 +43,19 @@ namespace IRaCIS.Core.Application.Contracts
} }
public class DeleteSVCommand
{
public Guid Id { get; set; }
}
public class SetSubjectVisitUrgentCommand
{
public Guid subjectVisitId { get; set; }
public bool isUrgent { get; set; }
}
public class SubjectVisitDTO : SubjectVisitCommand public class SubjectVisitDTO : SubjectVisitCommand
{ {
public SubjectStatus SubjectStatus { get; set; } public SubjectStatus SubjectStatus { get; set; }

View File

@ -8,5 +8,7 @@ namespace IRaCIS.Core.Application.Interfaces
Task<IResponseOutput> DeleteSV(Guid id); Task<IResponseOutput> DeleteSV(Guid id);
Task<List<VisitStudyDTO>> GetVisitStudyList(Guid trialId, Guid sujectVisitId, int isReading); Task<List<VisitStudyDTO>> GetVisitStudyList(Guid trialId, Guid sujectVisitId, int isReading);
Task<IResponseOutput> SetSVExecuted(Guid subjectVisitId); Task<IResponseOutput> SetSVExecuted(Guid subjectVisitId);
Task<IResponseOutput> SetSubjectVisitUrgent(Guid subjectVisitId, bool isUrgent);
} }
} }

View File

@ -31,7 +31,7 @@ namespace IRaCIS.Application.Services
[TypeFilter(typeof(TrialResourceFilter))] [TypeFilter(typeof(TrialResourceFilter))]
public async Task<IResponseOutput<string>> AddOrUpdateSubject([FromBody] SubjectCommand subjectCommand) public async Task<IResponseOutput<string>> AddOrUpdateSubject([FromBody] SubjectCommand subjectCommand)
{ {
bool isadd = false;
if (await _repository.AnyAsync<Trial>(t => t.Id == subjectCommand.TrialId && !t.VisitPlanConfirmed)) 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."); 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.");
@ -43,16 +43,13 @@ namespace IRaCIS.Application.Services
VerifyMsg = "A subjects with the same subject ID already existed in this trial." VerifyMsg = "A subjects with the same subject ID already existed in this trial."
}; };
var mapedSubject = await _subjectRepository.InsertOrUpdateAsync(subjectCommand, false, verifyExp1/*, verifyExp2*/); var mapedSubject = await _subjectRepository.InsertOrUpdateAsync(subjectCommand, false, verifyExp1/*, verifyExp2*/);
if (subjectCommand.Id == null) //insert if (subjectCommand.Id == null) //insert
{ {
isadd = true;
var IsEnrollementQualificationConfirm = await _repository.Where<Trial>(t => t.Id == mapedSubject.TrialId).Select(u => u.IsEnrollementQualificationConfirm).FirstOrDefaultAsync(); var IsEnrollementQualificationConfirm = await _repository.Where<Trial>(t => t.Id == mapedSubject.TrialId).Select(u => u.IsEnrollementQualificationConfirm).FirstOrDefaultAsync();
//添加受试者的时候,获取访视计划列表,添加到受试者访视表。 //添加受试者的时候,获取访视计划列表,添加到受试者访视表。
var visitPlan = await _repository.Where<VisitStage>(t => t.TrialId == subjectCommand.TrialId).ToListAsync(); var visitPlan = await _repository.Where<VisitStage>(t => t.TrialId == subjectCommand.TrialId).ToListAsync();
@ -101,7 +98,7 @@ namespace IRaCIS.Application.Services
var createtime = DateTime.Now.AddSeconds(1); var createtime = DateTime.Now.AddSeconds(1);
// 添加稽查记录 // 添加稽查记录
if (subjectCommand.Id == null) if (isadd)
{ {
List<DataInspection> datas = new List<DataInspection>(); List<DataInspection> datas = new List<DataInspection>();
datas.Add(new DataInspection() datas.Add(new DataInspection()
@ -130,13 +127,38 @@ namespace IRaCIS.Application.Services
SubjectVisitId= item.Id, SubjectVisitId= item.Id,
SubjectVisitName=item.VisitName, SubjectVisitName=item.VisitName,
IsSign = false, IsSign = false,
CreateTime = createtime, CreateTime = visittime,
Identification = "Subject|Init|Subject|Status", Identification = "Add|Visit|Info|Visit-Image Upload",
JsonDetail = JsonConvert.SerializeObject(new JsonDetail = JsonConvert.SerializeObject(new
{ {
VisitName = item.VisitName, VisitName = item.VisitName,
VisitNum = item.VisitNum, VisitNum = item.VisitNum,
IsBaseLine=item.IsBaseLine, IsBaseLine=item.IsBaseLine,
VisitExecuted= false,
IsFinalVisit=item.IsFinalVisit,
PDState="None",
IsLostVisit=item.IsLostVisit,
})
});
datas.Add(new DataInspection()
{
TrialId = subjectCommand.TrialId,
SiteId = subjectCommand.SiteId,
SubjectId = subjectCommand.Id,
SubjectCode = subjectCommand.Code,
SubjectVisitId = item.Id,
SubjectVisitName = item.VisitName,
IsSign = false,
CreateTime = visittime.AddSeconds(1),
Identification = "Init|Visit|Status|Visit-Image Upload",
JsonDetail = JsonConvert.SerializeObject(new
{
VisitName = item.VisitName,
SubmitState = "",
AuditState = "",
}) })
}); });
} }

View File

@ -7,6 +7,8 @@ using Microsoft.AspNetCore.Authorization;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Application.Contracts; using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.Service.Inspection.Interface;
using Newtonsoft.Json;
namespace IRaCIS.Core.Application.Services namespace IRaCIS.Core.Application.Services
{ {
@ -14,10 +16,12 @@ namespace IRaCIS.Core.Application.Services
public class SubjectVisitService : BaseService, ISubjectVisitService public class SubjectVisitService : BaseService, ISubjectVisitService
{ {
private readonly IRepository<SubjectVisit> _subjectVisitRepository; private readonly IRepository<SubjectVisit> _subjectVisitRepository;
private readonly IInspectionService _inspectionService;
public SubjectVisitService(IRepository<SubjectVisit> subjectVisitRepository) public SubjectVisitService(IRepository<SubjectVisit> subjectVisitRepository, IInspectionService inspectionService)
{ {
_subjectVisitRepository = subjectVisitRepository; _subjectVisitRepository = subjectVisitRepository;
this._inspectionService = inspectionService;
} }
[HttpPost] [HttpPost]
@ -25,6 +29,12 @@ namespace IRaCIS.Core.Application.Services
[UnitOfWork] [UnitOfWork]
public async Task<IResponseOutput<string>> AddOrUpdateSV(SubjectVisitCommand svCommand) public async Task<IResponseOutput<string>> AddOrUpdateSV(SubjectVisitCommand svCommand)
{ {
bool isadd=false;
if (svCommand.Id != null)
{
isadd=true;
}
var verifyExp1 = new EntityVerifyExp<SubjectVisit>() var verifyExp1 = new EntityVerifyExp<SubjectVisit>()
{ {
@ -123,7 +133,33 @@ namespace IRaCIS.Core.Application.Services
await _repository.SaveChangesAsync(); await _repository.SaveChangesAsync();
//if(svCommand.) if (isadd)
{
List<DataInspection> dataInspection=new List<DataInspection>();
dataInspection.Add(new DataInspection()
{
TrialId = svCommand.TrialId,
SiteId = svCommand.SiteId,
SubjectId = svCommand.Id,
SubjectVisitId = svCommand.Id,
SubjectVisitName = svCommand.VisitName,
IsSign = false,
CreateTime = DateTime.Now.AddSeconds(1),
Identification = "Init|Visit|Status|Visit-Image Upload",
JsonDetail = JsonConvert.SerializeObject(new
{
VisitName = svCommand.VisitName,
SubmitState = "",
AuditState = "",
})
});
await _inspectionService.AddListInspectionRecordAsync(dataInspection);
}
// 保存数据后,重新算下是否缺失影像 应对状态撤回 // 保存数据后,重新算下是否缺失影像 应对状态撤回
//if (svCommand.IsLostVisit == false) //if (svCommand.IsLostVisit == false)

View File

@ -127,6 +127,17 @@ namespace IRaCIS.Core.Domain.Models
public string Identification { get; set; } public string Identification { get; set; }
/// <summary>
/// 是否有签名
/// </summary>
public bool? IsHaveSign { get; set; }
/// <summary>
/// 是否有原因
/// </summary>
public bool? IsHaveReason { get; set; }
} }