|
|
|
@ -19,9 +19,13 @@ namespace Shentun.Peis.DiagnosisTemplates |
|
|
|
public class DiagnosisTemplateManager : DomainService |
|
|
|
{ |
|
|
|
private readonly IRepository<DiagnosisTemplate, Guid> _repository; |
|
|
|
public DiagnosisTemplateManager(IRepository<DiagnosisTemplate, Guid> repository) |
|
|
|
private readonly IRepository<DiagnosisTemplateDetail> _diagnosisTemplateDetailRepository; |
|
|
|
public DiagnosisTemplateManager( |
|
|
|
IRepository<DiagnosisTemplate, Guid> repository, |
|
|
|
IRepository<DiagnosisTemplateDetail> diagnosisTemplateDetailRepository) |
|
|
|
{ |
|
|
|
_repository = repository; |
|
|
|
_diagnosisTemplateDetailRepository = diagnosisTemplateDetailRepository; |
|
|
|
} |
|
|
|
/// <summary>
|
|
|
|
/// 创建
|
|
|
|
@ -34,11 +38,11 @@ namespace Shentun.Peis.DiagnosisTemplates |
|
|
|
{ |
|
|
|
DataHelper.CheckStringIsNull(entity.DisplayName, "名称"); |
|
|
|
await EntityHelper.CheckSameName<DiagnosisTemplate, Guid>(_repository, entity.DisplayName); |
|
|
|
if (entity.DisplayName.Length > 1) |
|
|
|
{ |
|
|
|
//if (entity.DisplayName.Length > 1)
|
|
|
|
//{
|
|
|
|
|
|
|
|
throw new UserFriendlyException($"DisplayName:'{entity.DisplayName}'字符超出长度"); |
|
|
|
} |
|
|
|
// throw new UserFriendlyException($"DisplayName:'{entity.DisplayName}'字符超出长度");
|
|
|
|
//}
|
|
|
|
return new DiagnosisTemplate |
|
|
|
{ |
|
|
|
DisplayName = entity.DisplayName, |
|
|
|
@ -59,10 +63,10 @@ namespace Shentun.Peis.DiagnosisTemplates |
|
|
|
{ |
|
|
|
DataHelper.CheckStringIsNull(sourceEntity.DisplayName, "名称"); |
|
|
|
|
|
|
|
if (sourceEntity.DisplayName.Length > 1) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"DisplayName:'{sourceEntity.DisplayName}'字符超出长度"); |
|
|
|
} |
|
|
|
//if (sourceEntity.DisplayName.Length > 1)
|
|
|
|
//{
|
|
|
|
// throw new UserFriendlyException($"DisplayName:'{sourceEntity.DisplayName}'字符超出长度");
|
|
|
|
//}
|
|
|
|
|
|
|
|
if (sourceEntity.DisplayName != targetEntity.DisplayName) |
|
|
|
{ |
|
|
|
@ -78,17 +82,6 @@ namespace Shentun.Peis.DiagnosisTemplates |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 修改排序 相邻之间
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id">需要修改的ID</param>
|
|
|
|
/// <param name="targetid">目标ID</param>
|
|
|
|
public async Task UpdateSortAsync(Guid id, Guid targetid) |
|
|
|
{ |
|
|
|
await EntityHelper.UpdateSort(_repository, id, targetid); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 修改排序 置顶,置底
|
|
|
|
/// </summary>
|
|
|
|
@ -112,6 +105,21 @@ namespace Shentun.Peis.DiagnosisTemplates |
|
|
|
public async Task UpdateSortManyAsync(UpdateSortManyDto input) |
|
|
|
{ |
|
|
|
await EntityHelper.UpdateSortManyAsync(_repository, input); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///删除
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
|
|
public async Task CheckAndDeleteAsync(Guid id) |
|
|
|
{ |
|
|
|
//删除诊断模板明细
|
|
|
|
await _diagnosisTemplateDetailRepository.DeleteAsync(d => d.DiagnosisTemplateId == id); |
|
|
|
//删除诊断模板数据
|
|
|
|
await _repository.DeleteAsync(id); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|