修改一版
parent
2ad979bee9
commit
74a0553cd8
|
@ -60,6 +60,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
public string Modality { get; set; } = string.Empty;
|
public string Modality { get; set; } = string.Empty;
|
||||||
public DateTime ImageDate { get; set; }
|
public DateTime ImageDate { get; set; }
|
||||||
public string Description { get; set; } = string.Empty;
|
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())
|
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);
|
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");
|
entity.StudyCode = "NST" + entity.Code.ToString("D5");
|
||||||
await _repository.SaveChangesAsync();
|
await _repository.SaveChangesAsync();
|
||||||
|
|
Loading…
Reference in New Issue