修改一版
This commit is contained in:
@@ -60,6 +60,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public string Modality { get; set; } = string.Empty;
|
||||
public DateTime ImageDate { get; set; }
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
public int? Code { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -64,13 +64,16 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
{
|
||||
using (await _mutex.LockAsync())
|
||||
{
|
||||
if (addOrEditNoneDicomStudy.Id == Guid.Empty|| addOrEditNoneDicomStudy.Id==null)
|
||||
{
|
||||
addOrEditNoneDicomStudy.Code =(await _noneDicomStudyRepository.Where(t => t.TrialId == addOrEditNoneDicomStudy.TrialId).MaxAsync(x=>x.Code)) + 1;
|
||||
}
|
||||
|
||||
addOrEditNoneDicomStudy.Code = addOrEditNoneDicomStudy.Code ?? 0;
|
||||
|
||||
var entity = await _noneDicomStudyRepository.InsertOrUpdateAsync(addOrEditNoneDicomStudy, false);
|
||||
|
||||
if (_repository.Entry(entity).State == Microsoft.EntityFrameworkCore.EntityState.Added)
|
||||
{
|
||||
entity.Code = _noneDicomStudyRepository.Where(t => t.TrialId == addOrEditNoneDicomStudy.TrialId).Select(t => t.Code).DefaultIfEmpty().Max() + 1;
|
||||
}
|
||||
|
||||
|
||||
entity.StudyCode = "NST" + entity.Code.ToString("D5");
|
||||
await _repository.SaveChangesAsync();
|
||||
|
||||
Reference in New Issue
Block a user