添加接口

This commit is contained in:
he
2022-04-07 16:25:47 +08:00
parent 34dd484582
commit 348d2cb7d4
10 changed files with 185 additions and 13 deletions
@@ -386,6 +386,16 @@
<member name="T:IRaCIS.Core.Application.ViewModel.FrontAuditConfigView">
<summary> FrontAuditConfigView 列表视图模型 </summary>
</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">
<summary>
是否向前站位
@@ -430,6 +440,16 @@
标识
</summary>
</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">
<summary> SystemAnonymizationView 列表视图模型 </summary>
</member>
@@ -58,6 +58,16 @@ namespace IRaCIS.Core.Application.ViewModel
public string ByTrialConfig { get; set; } = string.Empty;
/// <summary>
/// 是否有签名
/// </summary>
public bool? IsHaveSign { get; set; }
/// <summary>
/// 是否有原因
/// </summary>
public bool? IsHaveReason { get; set; }
/// <summary>
/// 是否向前站位
@@ -179,6 +189,18 @@ namespace IRaCIS.Core.Application.ViewModel
/// <summary>
/// 是否有签名
/// </summary>
public bool? IsHaveSign { get; set; }
/// <summary>
/// 是否有原因
/// </summary>
public bool? IsHaveReason { get; set; }
}
@@ -111,7 +111,7 @@ namespace IRaCIS.Core.Application.Service
from leftOptTypeId in OptTypeIdtemp.DefaultIfEmpty()
join ObjectTypeId in _repository.GetQueryable<Dictionary>() on data.ObjectTypeId equals ObjectTypeId.Id.ToString() into ObjectTypeIdtemp
from leftObjectTypeIdtemp in ObjectTypeIdtemp.DefaultIfEmpty()
select new FrontAuditConfigView()
select new FrontAuditConfigView()
{
IsShowParent = data.IsShowParent,
@@ -148,6 +148,8 @@ namespace IRaCIS.Core.Application.Service
ByTrialConfig=data.ByTrialConfig,
IsForwardPosition=data.IsForwardPosition,
Identification=data.Identification,
IsHaveReason=data.IsHaveReason,
IsHaveSign=data.IsHaveSign,
};
query = query
@@ -212,8 +212,13 @@ namespace IRaCIS.Core.Application.Service.Inspection
{
try
{
var value = data.GetType().GetProperty(item).GetValue(data);
mapData.GetType().GetProperty(item).SetValue(mapData, value);
var i = mapData.GetType().GetProperty(item).GetValue(mapData);
if (i == null)
{
var value = data.GetType().GetProperty(item).GetValue(data);
mapData.GetType().GetProperty(item).SetValue(mapData, value);
}
}
catch (Exception)
{
@@ -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 SubjectStatus SubjectStatus { get; set; }
@@ -8,5 +8,7 @@ namespace IRaCIS.Core.Application.Interfaces
Task<IResponseOutput> DeleteSV(Guid id);
Task<List<VisitStudyDTO>> GetVisitStudyList(Guid trialId, Guid sujectVisitId, int isReading);
Task<IResponseOutput> SetSVExecuted(Guid subjectVisitId);
Task<IResponseOutput> SetSubjectVisitUrgent(Guid subjectVisitId, bool isUrgent);
}
}
@@ -31,7 +31,7 @@ namespace IRaCIS.Application.Services
[TypeFilter(typeof(TrialResourceFilter))]
public async Task<IResponseOutput<string>> AddOrUpdateSubject([FromBody] SubjectCommand subjectCommand)
{
bool isadd = false;
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.");
@@ -43,16 +43,13 @@ namespace IRaCIS.Application.Services
VerifyMsg = "A subjects with the same subject ID already existed in this trial."
};
var mapedSubject = await _subjectRepository.InsertOrUpdateAsync(subjectCommand, false, verifyExp1/*, verifyExp2*/);
if (subjectCommand.Id == null) //insert
{
isadd = true;
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();
@@ -101,7 +98,7 @@ namespace IRaCIS.Application.Services
var createtime = DateTime.Now.AddSeconds(1);
// 添加稽查记录
if (subjectCommand.Id == null)
if (isadd)
{
List<DataInspection> datas = new List<DataInspection>();
datas.Add(new DataInspection()
@@ -130,13 +127,38 @@ namespace IRaCIS.Application.Services
SubjectVisitId= item.Id,
SubjectVisitName=item.VisitName,
IsSign = false,
CreateTime = createtime,
Identification = "Subject|Init|Subject|Status",
CreateTime = visittime,
Identification = "Add|Visit|Info|Visit-Image Upload",
JsonDetail = JsonConvert.SerializeObject(new
{
VisitName = item.VisitName,
VisitNum = item.VisitNum,
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 = "",
})
});
}
@@ -7,6 +7,8 @@ using Microsoft.AspNetCore.Authorization;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.Service.Inspection.Interface;
using Newtonsoft.Json;
namespace IRaCIS.Core.Application.Services
{
@@ -14,10 +16,12 @@ namespace IRaCIS.Core.Application.Services
public class SubjectVisitService : BaseService, ISubjectVisitService
{
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
private readonly IInspectionService _inspectionService;
public SubjectVisitService(IRepository<SubjectVisit> subjectVisitRepository)
public SubjectVisitService(IRepository<SubjectVisit> subjectVisitRepository, IInspectionService inspectionService)
{
_subjectVisitRepository = subjectVisitRepository;
this._inspectionService = inspectionService;
}
[HttpPost]
@@ -25,6 +29,12 @@ namespace IRaCIS.Core.Application.Services
[UnitOfWork]
public async Task<IResponseOutput<string>> AddOrUpdateSV(SubjectVisitCommand svCommand)
{
bool isadd=false;
if (svCommand.Id != null)
{
isadd=true;
}
var verifyExp1 = new EntityVerifyExp<SubjectVisit>()
{
@@ -123,7 +133,33 @@ namespace IRaCIS.Core.Application.Services
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)