添加代码
parent
210323eb8a
commit
0e30547736
|
@ -230,19 +230,7 @@ namespace IRaCIS.Api.Controllers
|
|||
await _inspectionService.AddInspectionRecordAsync(data);
|
||||
|
||||
|
||||
List<DataInspection> datas = new List<DataInspection>();
|
||||
datas.Add(new DataInspection()
|
||||
{
|
||||
|
||||
SiteId = savedInfo.SiteId,
|
||||
SubjectId = savedInfo.SubjectId,
|
||||
TrialId = savedInfo.TrialId,
|
||||
SubjectVisitId = savedInfo.SubjectVisitId,
|
||||
Identification = "Edit|Visit|Status|Visit-Image Upload|Add Image",
|
||||
JsonDetail = savedInfo.ToJcJson()
|
||||
});
|
||||
|
||||
await _inspectionService.AddListInspectionRecordAsync(datas);
|
||||
|
||||
|
||||
return ResponseOutput.Ok(archiveResult);
|
||||
|
||||
|
|
|
@ -175,24 +175,6 @@ namespace IRaCIS.Core.Application.Services
|
|||
|
||||
if (isStudyNeedAdd)
|
||||
{
|
||||
//dicomStudy.Id = NewId.NextGuid();
|
||||
|
||||
//datas.Add(new DataInspection()
|
||||
//{
|
||||
|
||||
// SiteId = dicomStudy.SiteId,
|
||||
// SubjectId = dicomStudy.SubjectId,
|
||||
// TrialId = dicomStudy.TrialId,
|
||||
// SubjectVisitId = dicomStudy.SubjectVisitId,
|
||||
// CreateTime = createtime,
|
||||
// GeneralId= dicomStudy.Id,
|
||||
// Identification = "Edit|Visit|Status|Visit-Image Upload|Add Image",
|
||||
// JsonDetail = JsonConvert.SerializeObject(new
|
||||
// {
|
||||
// SubmitState = "待提交",
|
||||
// })
|
||||
//});
|
||||
|
||||
// 添加检查
|
||||
await _studyRepository.AddAsync(dicomStudy);
|
||||
}
|
||||
|
|
|
@ -402,7 +402,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
|||
|
||||
public async Task SetEnum(DataInspectionAddDTO Data)
|
||||
{
|
||||
Data.JsonDetail= await _dataInspectionRepository.SetEnum(Data.Identification, Data.JsonDetail);
|
||||
Data.JsonDetail= await _dataInspectionRepository.SetEnum(Data.TrialId.Value, Data.Identification, Data.JsonDetail);
|
||||
#region 枚举
|
||||
//try
|
||||
//{
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
private readonly IHttpContextAccessor _httpContext;
|
||||
private readonly IDictionaryService _dictionaryService;
|
||||
private readonly IInspectionService _inspectionService;
|
||||
private readonly IRepository<StudyMonitor> _studyMonitorRepository;
|
||||
private readonly IRepository<NoneDicomStudyFile> _noneDicomStudyFileRepository;
|
||||
|
||||
|
||||
|
@ -35,16 +36,18 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
|
||||
public NoneDicomStudyService(IRepository<NoneDicomStudy> noneDicomStudyRepository,
|
||||
IHttpContextAccessor httpContext,
|
||||
IDictionaryService dictionaryService,
|
||||
IInspectionService inspectionService,
|
||||
IHttpContextAccessor httpContext,
|
||||
IDictionaryService dictionaryService,
|
||||
IInspectionService inspectionService,
|
||||
IRepository<StudyMonitor> studyMonitorRepository,
|
||||
IRepository<NoneDicomStudyFile> noneDicomStudyFileRepository)
|
||||
{
|
||||
_noneDicomStudyRepository = noneDicomStudyRepository;
|
||||
|
||||
|
||||
this._httpContext = httpContext;
|
||||
this._dictionaryService = dictionaryService;
|
||||
this._inspectionService = inspectionService;
|
||||
this._studyMonitorRepository = studyMonitorRepository;
|
||||
_noneDicomStudyFileRepository = noneDicomStudyFileRepository;
|
||||
}
|
||||
|
||||
|
@ -130,20 +133,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
var subvisit = await _repository.GetQueryable<SubjectVisit>().FirstOrDefaultAsync(x => x.Id == subjectVisitId);
|
||||
|
||||
// 修改访视状态
|
||||
//List<DataInspection> datas = new List<DataInspection>();
|
||||
//datas.Add(new DataInspection()
|
||||
//{
|
||||
|
||||
// SiteId = subvisit.SiteId,
|
||||
// SubjectId = subvisit.SubjectId,
|
||||
// TrialId = subvisit.TrialId,
|
||||
// SubjectVisitId = subvisit.Id,
|
||||
// Identification = "Edit|Visit|Status|Visit-Image Upload|Add Image",
|
||||
// JsonDetail = subvisit.ToJcJson()
|
||||
//});
|
||||
|
||||
//await _inspectionService.AddListInspectionRecordAsync(datas);
|
||||
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
@ -179,23 +169,6 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
var data = JsonConvert.DeserializeObject<DataInspectionAddDTO>(fileDto.AuditInfo);
|
||||
data.GeneralId = fileDto.noneDicomStudyId;
|
||||
await _inspectionService.AddInspectionRecordAsync(data);
|
||||
|
||||
var subvisit = await _repository.GetQueryable<SubjectVisit>().FirstOrDefaultAsync(x => x.Id == fileDto.subjectVisitId);
|
||||
|
||||
List<DataInspection> datas = new List<DataInspection>();
|
||||
datas.Add(new DataInspection()
|
||||
{
|
||||
|
||||
SiteId = subvisit.SiteId,
|
||||
SubjectId = subvisit.SubjectId,
|
||||
TrialId = subvisit.TrialId,
|
||||
SubjectVisitId = subvisit.Id,
|
||||
Identification = "Edit|Visit|Status|Visit-Image Upload|Add Image",
|
||||
JsonDetail = subvisit.ToJcJson()
|
||||
});
|
||||
|
||||
|
||||
await _inspectionService.AddListInspectionRecordAsync(datas);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -265,7 +238,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
// 上传非Dicom 后 将状态改为待提交 分为普通上传 和QC后重传 普通上传时才改为待提交
|
||||
await _repository.BatchUpdateAsync<SubjectVisit>(t => t.Id == subjectVisitId && t.SubmitState == SubmitStateEnum.None, u => new SubjectVisit() { SubmitState = SubmitStateEnum.ToSubmit });
|
||||
|
||||
await _repository.AddAsync(new StudyMonitor()
|
||||
await _studyMonitorRepository.AddAsync(new StudyMonitor()
|
||||
{
|
||||
FileCount = formCollection.Files.Count,
|
||||
FileSize = formCollection.Files.Sum(t => t.Length),
|
||||
|
@ -316,7 +289,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
}
|
||||
|
||||
|
||||
await _repository.AddAsync(new NoneDicomStudyFile() { FileName = fileName, Path = relativePath, NoneDicomStudyId = noneDicomStudyId });
|
||||
await _noneDicomStudyFileRepository.AddAsync(new NoneDicomStudyFile() { FileName = fileName, Path = relativePath, NoneDicomStudyId = noneDicomStudyId });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1043,17 +1043,6 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
|
||||
var subvisit = await _repository.GetQueryable<SubjectVisit>().FirstOrDefaultAsync(x => x.Id == subjectVisitId);
|
||||
|
||||
|
||||
datas.Add(new DataInspection()
|
||||
{
|
||||
|
||||
SiteId = subvisit.SiteId,
|
||||
SubjectId = subvisit.SubjectId,
|
||||
TrialId = subvisit.TrialId,
|
||||
SubjectVisitId = subvisit.Id,
|
||||
Identification = "Edit|Visit|Status|Visit-Image Upload|Add Image",
|
||||
JsonDetail = subvisit.ToJcJson()
|
||||
});
|
||||
await _inspectionService.AddListInspectionRecordAsync(datas);
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
/// <param name="json">json对象</param>
|
||||
/// <returns></returns>
|
||||
|
||||
Task<string> SetEnum(string Identification, string json);
|
||||
Task<string> SetEnum(Guid trial, string Identification, string json);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -229,6 +229,8 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
public async Task<bool> DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
|
||||
{
|
||||
_dbSet.Remove(entity);
|
||||
|
||||
|
||||
|
||||
if (autoSave)
|
||||
{
|
||||
|
@ -414,9 +416,6 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
#endregion
|
||||
|
||||
#region 不常用
|
||||
|
||||
|
||||
|
||||
/// <summary>EF跟踪方式 生成 部分字段更新 (只更新传递的字段名 new[] {nameof(User.Name), nameof(User.Age))</summary>
|
||||
public async Task<TEntity> UpdatePartialFieldsAsync(TEntity entity, string[] propertyNames,
|
||||
bool autoSave = false, bool ignoreEntityNullProperty = true, params EntityVerifyExp<TEntity>[] verify)
|
||||
|
@ -471,10 +470,10 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
/// <param name="json">Json对象</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="BusinessValidationFailedException"></exception>
|
||||
public async Task<string> SetEnum(string Identification, string json)
|
||||
public async Task<string> SetEnum(Guid trilaid, string Identification, string json)
|
||||
{
|
||||
var list =await (from u in _dbContext.FrontAuditConfig.Where(x=>x.Identification== Identification)
|
||||
join p in _dbContext.FrontAuditConfig.Where(x=>x.DictionaryCode!=null&& x.DictionaryCode != string.Empty&&x.DictionaryType != null&&x.DictionaryType != string.Empty) on u.Id equals p.ParentId
|
||||
join p in _dbContext.FrontAuditConfig.Where(x=>x.Code== "AuditState"||(x.DictionaryCode!=null&& x.DictionaryCode != string.Empty&&x.DictionaryType != null&&x.DictionaryType != string.Empty)) on u.Id equals p.ParentId
|
||||
select new
|
||||
{
|
||||
Key= p.Code,
|
||||
|
@ -482,6 +481,17 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
Type= p.DictionaryType
|
||||
}).ToListAsync();
|
||||
|
||||
// 添加单双审
|
||||
var trialtype = await _dbContext.Trial.AsQueryable().Where(x => x.Id == trilaid).Select(x => x.QCProcessEnum).FirstOrDefaultAsync();
|
||||
|
||||
list.Add(new
|
||||
{
|
||||
|
||||
Key = "AuditState",
|
||||
Code = trialtype == TrialQCProcess.SingleAudit ? "AuditStateRC" : "AuditStatePE",
|
||||
Type = "Code",
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
var JsonData = JsonConvert.DeserializeObject<IDictionary<string, object>>(json);
|
||||
|
@ -602,8 +612,47 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
JsonDetail = entity.ToJcJson()
|
||||
});
|
||||
}
|
||||
|
||||
// dicom影像
|
||||
else if (typeof(TEntity) == typeof(DicomStudy))
|
||||
{
|
||||
DicomStudy data = entity as DicomStudy;
|
||||
await UpdateSubjectVisit(data.SubjectVisitId, SubmitStateEnum.ToSubmit,"上传Dicom影像");
|
||||
}
|
||||
// 非Dicom影像
|
||||
else if (typeof(TEntity) == typeof(NoneDicomStudy))
|
||||
{
|
||||
DicomStudy data = entity as DicomStudy;
|
||||
await UpdateSubjectVisit(data.SubjectVisitId, SubmitStateEnum.ToSubmit, "上传非Dicom影像");
|
||||
}
|
||||
|
||||
// 修改访视状态记录稽查
|
||||
async Task UpdateSubjectVisit(Guid subvisitVisit, SubmitStateEnum submit,string reason)
|
||||
{
|
||||
var subjectvisit = await _dbContext.SubjectVisit.AsNoTracking().AsQueryable().Where(x => x.Id == subvisitVisit).FirstOrDefaultAsync();
|
||||
if (subjectvisit.SubmitState != submit)
|
||||
{
|
||||
subjectvisit.SubmitState = submit;
|
||||
}
|
||||
|
||||
List<DataInspection> inspections = new List<DataInspection>();
|
||||
inspections.Add(new DataInspection()
|
||||
{
|
||||
Identification= "Edit|Visit|Status|Visit-Image Upload|Add Image",
|
||||
TrialId= subjectvisit.TrialId,
|
||||
SiteId=subjectvisit.SiteId,
|
||||
SubjectId=subjectvisit.SubjectId,
|
||||
SubjectVisitId=subjectvisit.Id,
|
||||
Reason= reason,
|
||||
JsonDetail= subjectvisit.ToJcJson(),
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
await AddListInspectionRecordAsync(datas);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加稽查记录
|
||||
/// </summary>
|
||||
|
@ -633,7 +682,7 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
{
|
||||
add.CreateTime = DateTime.Now;
|
||||
}
|
||||
add.JsonDetail = await SetEnum(add.Identification, add.JsonDetail);
|
||||
add.JsonDetail = await SetEnum(add.TrialId,add.Identification, add.JsonDetail);
|
||||
await SetDataInspectionDateType(add);
|
||||
}
|
||||
|
||||
|
@ -641,6 +690,8 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// IsNullOrEmpty
|
||||
/// </summary>
|
||||
|
@ -691,17 +742,13 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
{
|
||||
JsonData[item] = DateTime.Parse(JsonData[item].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Data.JsonDetail = JsonConvert.SerializeObject(JsonData);
|
||||
|
||||
|
|
Loading…
Reference in New Issue