修改非dicom
parent
943c44892a
commit
746d0ebc58
|
@ -61,7 +61,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public DateTime ImageDate { get; set; }
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
public int? Code { get; set; }
|
||||
public int Code { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -62,22 +62,28 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
[TypeFilter(typeof(TrialResourceFilter))]
|
||||
public async Task<IResponseOutput<NoneDicomStudyAddReturnDto>> AddOrUpdateNoneDicomStudy(NoneDicomStudyAddOrEdit addOrEditNoneDicomStudy)
|
||||
{
|
||||
|
||||
NoneDicomStudy optEntity = null;
|
||||
using (await _mutex.LockAsync())
|
||||
{
|
||||
if (addOrEditNoneDicomStudy.Id == Guid.Empty || addOrEditNoneDicomStudy.Id == null)
|
||||
{
|
||||
var code = _noneDicomStudyRepository.Where(t => t.TrialId == addOrEditNoneDicomStudy.TrialId).MaxOrDefault(x=>x.Code);
|
||||
//默认会是0
|
||||
var code = await _noneDicomStudyRepository.Where(t => t.TrialId == addOrEditNoneDicomStudy.TrialId).Select(x => x.Code).DefaultIfEmpty().MaxAsync();
|
||||
|
||||
addOrEditNoneDicomStudy.Code = code + 1;
|
||||
|
||||
optEntity = await _noneDicomStudyRepository.InsertFromDTOAsync(addOrEditNoneDicomStudy);
|
||||
|
||||
optEntity.StudyCode = "NST" + optEntity.Code.ToString("D5");
|
||||
}
|
||||
else
|
||||
{
|
||||
optEntity = await _noneDicomStudyRepository.UpdateFromDTOAsync(addOrEditNoneDicomStudy);
|
||||
}
|
||||
|
||||
addOrEditNoneDicomStudy.Code = addOrEditNoneDicomStudy.Code ?? 0;
|
||||
|
||||
var entity = await _noneDicomStudyRepository.InsertOrUpdateAsync(addOrEditNoneDicomStudy, false);
|
||||
|
||||
|
||||
|
||||
entity.StudyCode = "NST" + entity.Code.ToString("D5");
|
||||
await _repository.SaveChangesAsync();
|
||||
await _noneDicomStudyRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
var svTime = _repository.Where<SubjectVisit>(t => t.Id == addOrEditNoneDicomStudy.SubjectVisitId).Select(t => new
|
||||
{
|
||||
|
@ -103,13 +109,10 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
NoneDicomStudyAddReturnDto noneDicom = new NoneDicomStudyAddReturnDto()
|
||||
{
|
||||
StudyCode = entity.StudyCode,
|
||||
Id = entity.Id
|
||||
StudyCode = optEntity.StudyCode,
|
||||
Id = optEntity.Id
|
||||
};
|
||||
return ResponseOutput.Ok(noneDicom);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -318,11 +321,14 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
await _repository.AddAsync(new StudyMonitor()
|
||||
{
|
||||
FileCount = formCollection.Files.Count,
|
||||
FileSize = formCollection.Files.Sum(t => t.Length), IsDicom = false,
|
||||
FileSize = formCollection.Files.Sum(t => t.Length),
|
||||
IsDicom = false,
|
||||
IsDicomReUpload = false,
|
||||
StudyId = noneDicomStudyId,
|
||||
|
||||
UploadStartTime = startTime, UploadFinishedTime = DateTime.Now, IP = _userInfo.IP,
|
||||
UploadStartTime = startTime,
|
||||
UploadFinishedTime = DateTime.Now,
|
||||
IP = _userInfo.IP,
|
||||
//TotalMillisecondsInterval = (DateTime.Now - startTime).TotalMilliseconds,
|
||||
TrialId = sv.TrialId,
|
||||
SiteId = sv.SiteId,
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
using System;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
using Microsoft.EntityFrameworkCore.ValueGeneration;
|
||||
|
||||
namespace IRaCIS.Core.Infra.EFCore.ValueGenerator
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 上传监控 时间间隔存储 需要按照这个字段进行排序
|
||||
/// </summary>
|
||||
public class UploadTotalMillisecondsInterval : ValueGenerator<int>
|
||||
{
|
||||
|
||||
|
@ -13,7 +18,6 @@ namespace IRaCIS.Core.Infra.EFCore.ValueGenerator
|
|||
|
||||
//modelBuilder.Entity<StudyMonitor>().Property(e => e.TestInterval).ValueGeneratedOnAddOrUpdate().HasDefaultValueSql("datediff(MS,UploadStartTime,UploadFinishedTime)");
|
||||
|
||||
|
||||
public override int Next(EntityEntry entry)
|
||||
{
|
||||
if (entry.Entity is StudyMonitor entity)
|
||||
|
|
Loading…
Reference in New Issue