17 changed files with 743 additions and 0 deletions
-
33src/Shentun.WebPeis.Application.Contracts/DiseaseRiskLevels/CreateDiseaseRiskLevelDto.cs
-
41src/Shentun.WebPeis.Application.Contracts/DiseaseRiskLevels/DiseaseRiskLevelDto.cs
-
11src/Shentun.WebPeis.Application.Contracts/DiseaseRiskLevels/DiseaseRiskLevelIdInputDto.cs
-
39src/Shentun.WebPeis.Application.Contracts/DiseaseRiskLevels/UpdateDiseaseRiskLevelDto.cs
-
16src/Shentun.WebPeis.Application.Contracts/DiseaseRisks/CreateDiseaseRiskDto.cs
-
23src/Shentun.WebPeis.Application.Contracts/DiseaseRisks/DiseaseRiskDto.cs
-
11src/Shentun.WebPeis.Application.Contracts/DiseaseRisks/DiseaseRiskIdInputDto.cs
-
20src/Shentun.WebPeis.Application.Contracts/DiseaseRisks/UpdateDiseaseRiskDto.cs
-
106src/Shentun.WebPeis.Application/DiseaseRiskLevels/DiseaseRiskLevelAppService.cs
-
104src/Shentun.WebPeis.Application/DiseaseRisks/DiseaseRiskAppService.cs
-
6src/Shentun.WebPeis.Application/WebPeisApplicationAutoMapperProfile.cs
-
133src/Shentun.WebPeis.Domain/DiseaseRiskLevels/DiseaseRiskLevelManager.cs
-
21src/Shentun.WebPeis.Domain/DiseaseRiskLevels/UpdateDiseaseRiskLevelSortDragDto.cs
-
18src/Shentun.WebPeis.Domain/DiseaseRiskLevels/UpdateDiseaseRiskLevelSortTopOrBottomInputDto.cs
-
123src/Shentun.WebPeis.Domain/DiseaseRisks/DiseaseRiskManager.cs
-
20src/Shentun.WebPeis.Domain/DiseaseRisks/UpdateDiseaseRiskSortDragDto.cs
-
18src/Shentun.WebPeis.Domain/DiseaseRisks/UpdateDiseaseRiskSortTopOrBottomInputDto.cs
@ -0,0 +1,33 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.WebPeis.DiseaseRiskLevels |
||||
|
{ |
||||
|
public class CreateDiseaseRiskLevelDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 风险级别名称
|
||||
|
/// </summary>
|
||||
|
public string DiseaseRiskLevelName { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 风险级别ID
|
||||
|
/// </summary>
|
||||
|
public Guid DiseaseRiskId { get; set; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 解释
|
||||
|
/// </summary>
|
||||
|
public string? Explain { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 建议
|
||||
|
/// </summary>
|
||||
|
public string? Suggestion { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 函数
|
||||
|
/// </summary>
|
||||
|
public string DiagnosisFunction { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,41 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.WebPeis.DiseaseRiskLevels |
||||
|
{ |
||||
|
public class DiseaseRiskLevelDto:AuditedEntityDtoName |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 风险级别ID
|
||||
|
/// </summary>
|
||||
|
public Guid DiseaseRiskLevelId { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 风险级别名称
|
||||
|
/// </summary>
|
||||
|
public string DiseaseRiskLevelName { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 风险级别ID
|
||||
|
/// </summary>
|
||||
|
public Guid DiseaseRiskId { get; set; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 解释
|
||||
|
/// </summary>
|
||||
|
public string? Explain { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 建议
|
||||
|
/// </summary>
|
||||
|
public string? Suggestion { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 函数
|
||||
|
/// </summary>
|
||||
|
public string DiagnosisFunction { get; set; } |
||||
|
|
||||
|
public string SimpleCode { get; set; } |
||||
|
|
||||
|
public int DisplayOrder { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.WebPeis.DiseaseRiskLevels |
||||
|
{ |
||||
|
public class DiseaseRiskLevelIdInputDto |
||||
|
{ |
||||
|
public Guid DiseaseRiskLevelId { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.WebPeis.DiseaseRiskLevels |
||||
|
{ |
||||
|
public class UpdateDiseaseRiskLevelDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 风险级别ID
|
||||
|
/// </summary>
|
||||
|
public Guid DiseaseRiskLevelId { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 风险级别名称
|
||||
|
/// </summary>
|
||||
|
public string DiseaseRiskLevelName { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 风险级别ID
|
||||
|
/// </summary>
|
||||
|
public Guid DiseaseRiskId { get; set; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 解释
|
||||
|
/// </summary>
|
||||
|
public string? Explain { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 建议
|
||||
|
/// </summary>
|
||||
|
public string? Suggestion { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 函数
|
||||
|
/// </summary>
|
||||
|
public string DiagnosisFunction { get; set; } |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.WebPeis.DiseaseRisks |
||||
|
{ |
||||
|
public class CreateDiseaseRiskDto |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 名称
|
||||
|
/// </summary>
|
||||
|
public string DiseaseRiskName { get; set; } = null!; |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.WebPeis.DiseaseRisks |
||||
|
{ |
||||
|
public class DiseaseRiskDto : AuditedEntityDtoName |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 主键
|
||||
|
/// </summary>
|
||||
|
public Guid DiseaseRiskId { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 名称
|
||||
|
/// </summary>
|
||||
|
|
||||
|
public string DiseaseRiskName { get; set; } = null!; |
||||
|
|
||||
|
public string SimpleCode { get; set; } = null!; |
||||
|
|
||||
|
public int DisplayOrder { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.WebPeis.DiseaseRisks |
||||
|
{ |
||||
|
public class DiseaseRiskIdInputDto |
||||
|
{ |
||||
|
public Guid DiseaseRiskId { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.WebPeis.DiseaseRisks |
||||
|
{ |
||||
|
public class UpdateDiseaseRiskDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 主键
|
||||
|
/// </summary>
|
||||
|
public Guid DiseaseRiskId { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 名称
|
||||
|
/// </summary>
|
||||
|
|
||||
|
public string DiseaseRiskName { get; set; } = null!; |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,106 @@ |
|||||
|
using AutoMapper.Internal.Mappers; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Shentun.WebPeis.Models; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
|
||||
|
namespace Shentun.WebPeis.DiseaseRiskLevels |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 疾病风险级别
|
||||
|
/// </summary>
|
||||
|
[ApiExplorerSettings(GroupName = "Work")] |
||||
|
[Authorize] |
||||
|
public class DiseaseRiskLevelAppService:ApplicationService |
||||
|
{ |
||||
|
|
||||
|
private readonly IRepository<DiseaseRiskLevel> _diseaseRiskLevelRepository; |
||||
|
private readonly DiseaseRiskLevelManager _diseaseRiskLevelManager; |
||||
|
private readonly CacheService _cacheService; |
||||
|
|
||||
|
public DiseaseRiskLevelAppService( |
||||
|
IRepository<DiseaseRiskLevel> diseaseRiskLevelRepository, |
||||
|
DiseaseRiskLevelManager diseaseRiskLevelManager, |
||||
|
CacheService cacheService) |
||||
|
{ |
||||
|
_diseaseRiskLevelRepository = diseaseRiskLevelRepository; |
||||
|
_diseaseRiskLevelManager = diseaseRiskLevelManager; |
||||
|
_cacheService = cacheService; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/DiseaseRiskLevel/Create")] |
||||
|
public async Task<DiseaseRiskLevelDto> CreateAsync(CreateDiseaseRiskLevelDto input) |
||||
|
{ |
||||
|
var createEntity = ObjectMapper.Map<CreateDiseaseRiskLevelDto, DiseaseRiskLevel>(input); |
||||
|
createEntity.DiseaseRiskId = GuidGenerator.Create(); |
||||
|
var entity = await _diseaseRiskLevelManager.CreateAsync(createEntity); |
||||
|
entity = await _diseaseRiskLevelRepository.InsertAsync(entity); |
||||
|
var dto = ObjectMapper.Map<DiseaseRiskLevel, DiseaseRiskLevelDto>(entity); |
||||
|
dto.CreatorName = await _cacheService.GetSurnameAsync(dto.CreatorId); |
||||
|
dto.LastModifierName = await _cacheService.GetSurnameAsync(dto.LastModifierId); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 更新
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/DiseaseRiskLevel/Update")] |
||||
|
public async Task<DiseaseRiskLevelDto> UpdateAsync(UpdateDiseaseRiskLevelDto input) |
||||
|
{ |
||||
|
var entity = await _diseaseRiskLevelRepository.GetAsync(f => f.DiseaseRiskLevelId == input.DiseaseRiskLevelId); |
||||
|
var sourceEntity = ObjectMapper.Map<UpdateDiseaseRiskLevelDto, DiseaseRiskLevel>(input); |
||||
|
_diseaseRiskLevelManager.UpdateAsync(sourceEntity, entity); |
||||
|
entity = await _diseaseRiskLevelRepository.UpdateAsync(entity); |
||||
|
var dto = ObjectMapper.Map<DiseaseRiskLevel, DiseaseRiskLevelDto>(entity); |
||||
|
dto.CreatorName = await _cacheService.GetSurnameAsync(dto.CreatorId); |
||||
|
dto.LastModifierName = await _cacheService.GetSurnameAsync(dto.LastModifierId); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 删除
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/DiseaseRiskLevel/Delete")] |
||||
|
public async Task DeleteAsync(DiseaseRiskLevelIdInputDto input) |
||||
|
{ |
||||
|
await _diseaseRiskLevelManager.CheckAndDeleteAsync(input.DiseaseRiskLevelId); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改排序 置顶,置底
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/DiseaseRiskLevel/UpdateSortTopOrBottom")] |
||||
|
public async Task UpdateSortTopOrBottomAsync(UpdateDiseaseRiskLevelSortTopOrBottomInputDto input) |
||||
|
{ |
||||
|
await _diseaseRiskLevelManager.UpdateSortTopOrBottomAsync(input.DiseaseRiskLevelId, input.SortType); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改排序 拖拽
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/DiseaseRiskLevel/UpdateSortDragAsync")] |
||||
|
public async Task UpdateSortDragAsync(UpdateDiseaseRiskLevelSortDragDto input) |
||||
|
{ |
||||
|
await _diseaseRiskLevelManager.UpdateSortDragAsync(input); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,104 @@ |
|||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Shentun.WebPeis.Models; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
|
||||
|
namespace Shentun.WebPeis.DiseaseRisks |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 疾病风险
|
||||
|
/// </summary>
|
||||
|
[ApiExplorerSettings(GroupName = "Work")] |
||||
|
[Authorize] |
||||
|
public class DiseaseRiskAppService : ApplicationService |
||||
|
{ |
||||
|
private readonly IRepository<DiseaseRisk> _diseaseRiskRepository; |
||||
|
private readonly DiseaseRiskManager _diseaseRiskManager; |
||||
|
private readonly CacheService _cacheService; |
||||
|
|
||||
|
public DiseaseRiskAppService( |
||||
|
IRepository<DiseaseRisk> diseaseRiskRepository, |
||||
|
DiseaseRiskManager diseaseRiskManager, |
||||
|
CacheService cacheService) |
||||
|
{ |
||||
|
_diseaseRiskRepository = diseaseRiskRepository; |
||||
|
_diseaseRiskManager = diseaseRiskManager; |
||||
|
_cacheService = cacheService; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/DiseaseRisk/Create")] |
||||
|
public async Task<DiseaseRiskDto> CreateAsync(CreateDiseaseRiskDto input) |
||||
|
{ |
||||
|
var createEntity = ObjectMapper.Map<CreateDiseaseRiskDto, DiseaseRisk>(input); |
||||
|
createEntity.DiseaseRiskId = GuidGenerator.Create(); |
||||
|
var entity = await _diseaseRiskManager.CreateAsync(createEntity); |
||||
|
entity = await _diseaseRiskRepository.InsertAsync(entity); |
||||
|
var dto = ObjectMapper.Map<DiseaseRisk, DiseaseRiskDto>(entity); |
||||
|
dto.CreatorName = await _cacheService.GetSurnameAsync(dto.CreatorId); |
||||
|
dto.LastModifierName = await _cacheService.GetSurnameAsync(dto.LastModifierId); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 更新
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/DiseaseRisk/Update")] |
||||
|
public async Task<DiseaseRiskDto> UpdateAsync(UpdateDiseaseRiskDto input) |
||||
|
{ |
||||
|
var entity = await _diseaseRiskRepository.GetAsync(f => f.DiseaseRiskId == input.DiseaseRiskId); |
||||
|
var sourceEntity = ObjectMapper.Map<UpdateDiseaseRiskDto, DiseaseRisk>(input); |
||||
|
_diseaseRiskManager.UpdateAsync(sourceEntity, entity); |
||||
|
entity = await _diseaseRiskRepository.UpdateAsync(entity); |
||||
|
var dto = ObjectMapper.Map<DiseaseRisk, DiseaseRiskDto>(entity); |
||||
|
dto.CreatorName = await _cacheService.GetSurnameAsync(dto.CreatorId); |
||||
|
dto.LastModifierName = await _cacheService.GetSurnameAsync(dto.LastModifierId); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 删除
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/DiseaseRisk/Delete")] |
||||
|
public async Task DeleteAsync(DiseaseRiskIdInputDto input) |
||||
|
{ |
||||
|
await _diseaseRiskManager.CheckAndDeleteAsync(input.DiseaseRiskId); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改排序 置顶,置底
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/DiseaseRisk/UpdateSortTopOrBottom")] |
||||
|
public async Task UpdateSortTopOrBottomAsync(UpdateDiseaseRiskSortTopOrBottomInputDto input) |
||||
|
{ |
||||
|
await _diseaseRiskManager.UpdateSortTopOrBottomAsync(input.DiseaseRiskId, input.SortType); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改排序 拖拽
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/DiseaseRisk/UpdateSortDragAsync")] |
||||
|
public async Task UpdateSortDragAsync(UpdateDiseaseRiskSortDragDto input) |
||||
|
{ |
||||
|
await _diseaseRiskManager.UpdateSortDragAsync(input); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,133 @@ |
|||||
|
using Shentun.Utilities; |
||||
|
using Shentun.WebPeis.DiseaseRisks; |
||||
|
using Shentun.WebPeis.Models; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
using Volo.Abp.Domain.Services; |
||||
|
|
||||
|
namespace Shentun.WebPeis.DiseaseRiskLevels |
||||
|
{ |
||||
|
public class DiseaseRiskLevelManager : DomainService |
||||
|
{ |
||||
|
|
||||
|
private readonly IRepository<DiseaseRiskLevel> _diseaseRiskLevelRepository; |
||||
|
|
||||
|
public DiseaseRiskLevelManager( |
||||
|
IRepository<DiseaseRiskLevel> diseaseRiskLevelRepository |
||||
|
) |
||||
|
{ |
||||
|
_diseaseRiskLevelRepository = diseaseRiskLevelRepository; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
public async Task<DiseaseRiskLevel> CreateAsync(DiseaseRiskLevel entity) |
||||
|
{ |
||||
|
DataHelper.CheckEntityIsNull(entity); |
||||
|
//DataHelper.CheckStringIsNull(entity.QuestionTypeName, "名称");
|
||||
|
|
||||
|
return new DiseaseRiskLevel |
||||
|
{ |
||||
|
DiseaseRiskId = entity.DiseaseRiskId, |
||||
|
DiagnosisFunction = entity.DiagnosisFunction, |
||||
|
DiseaseRiskLevelId = entity.DiseaseRiskLevelId, |
||||
|
DiseaseRiskLevelName = entity.DiseaseRiskLevelName, |
||||
|
Explain = entity.Explain, |
||||
|
Suggestion = entity.Suggestion, |
||||
|
SimpleCode = LanguageConverter.GetPYSimpleCode(entity.DiseaseRiskLevelName), |
||||
|
DisplayOrder = await EntityHelper.CreateMaxDisplayOrder<DiseaseRiskLevel>(_diseaseRiskLevelRepository) |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 更新
|
||||
|
/// </summary>
|
||||
|
/// <param name="sourceEntity"></param>
|
||||
|
/// <param name="targetEntity"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public void UpdateAsync( |
||||
|
DiseaseRiskLevel sourceEntity, |
||||
|
DiseaseRiskLevel targetEntity |
||||
|
) |
||||
|
{ |
||||
|
DataHelper.CheckEntityIsNull(sourceEntity); |
||||
|
DataHelper.CheckEntityIsNull(targetEntity); |
||||
|
//DataHelper.CheckStringIsNull(sourceEntity.QuestionTypeName, "名称");
|
||||
|
|
||||
|
targetEntity.DiseaseRiskId = sourceEntity.DiseaseRiskId; |
||||
|
targetEntity.DiagnosisFunction = sourceEntity.DiagnosisFunction; |
||||
|
targetEntity.DiseaseRiskLevelId = sourceEntity.DiseaseRiskLevelId; |
||||
|
targetEntity.DiseaseRiskLevelName = sourceEntity.DiseaseRiskLevelName; |
||||
|
targetEntity.Explain = sourceEntity.Explain; |
||||
|
targetEntity.Suggestion = sourceEntity.Suggestion; |
||||
|
targetEntity.SimpleCode = LanguageConverter.GetPYSimpleCode(sourceEntity.DiseaseRiskLevelName); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 删除
|
||||
|
/// </summary>
|
||||
|
/// <param name="DiseaseRiskLevelId"></param>
|
||||
|
/// <returns></returns>
|
||||
|
/// <exception cref="UserFriendlyException"></exception>
|
||||
|
public async Task CheckAndDeleteAsync(Guid DiseaseRiskLevelId) |
||||
|
{ |
||||
|
|
||||
|
//var questionEnt = await _questionRepository.FirstOrDefaultAsync(m => m.QuestionTypeId == QuestionTypeId);
|
||||
|
//if (questionEnt != null)
|
||||
|
//{
|
||||
|
// throw new UserFriendlyException($"问卷类别已被使用,不能删除");
|
||||
|
//}
|
||||
|
|
||||
|
await _diseaseRiskLevelRepository.DeleteAsync(d => d.DiseaseRiskLevelId == DiseaseRiskLevelId); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改排序 置顶,置底
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">需要修改的ID</param>
|
||||
|
/// <param name="SortType">修改方式:1 置顶 2 置底</param>
|
||||
|
/// <returns></returns>
|
||||
|
public async Task UpdateSortTopOrBottomAsync(Guid DiseaseRiskLevelId, int SortType) |
||||
|
{ |
||||
|
var entity = await _diseaseRiskLevelRepository.GetAsync(f => f.DiseaseRiskLevelId == DiseaseRiskLevelId); |
||||
|
await EntityHelper.UpdateSortTopOrBottomAsync(_diseaseRiskLevelRepository, entity, SortType); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改排序 拖拽
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TEntity"></typeparam>
|
||||
|
/// <param name="repository"></param>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public async Task UpdateSortDragAsync(UpdateDiseaseRiskLevelSortDragDto input) |
||||
|
{ |
||||
|
var entitylist = await _diseaseRiskLevelRepository.GetListAsync(o => input.ItemList.Select(s => s.DiseaseRiskLevelId).Contains(o.DiseaseRiskLevelId)); |
||||
|
|
||||
|
foreach (var entity in entitylist) |
||||
|
{ |
||||
|
foreach (var item in input.ItemList) |
||||
|
{ |
||||
|
if (item.DiseaseRiskLevelId == entity.DiseaseRiskLevelId) |
||||
|
entity.DisplayOrder = item.DisplayOrder; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
await _diseaseRiskLevelRepository.UpdateManyAsync(entitylist); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Shentun.WebPeis.DiseaseRiskLevels |
||||
|
{ |
||||
|
|
||||
|
public class UpdateDiseaseRiskLevelSortDragDto |
||||
|
{ |
||||
|
public List<UpdateDiseaseRiskLevelSortDragDetail> ItemList { get; set; } |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public class UpdateDiseaseRiskLevelSortDragDetail |
||||
|
{ |
||||
|
public Guid DiseaseRiskLevelId { get; set; } |
||||
|
public int DisplayOrder { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Shentun.WebPeis.DiseaseRiskLevels |
||||
|
{ |
||||
|
public class UpdateDiseaseRiskLevelSortTopOrBottomInputDto |
||||
|
{ |
||||
|
public Guid DiseaseRiskLevelId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改方式:1 置顶 2 置底
|
||||
|
/// </summary>
|
||||
|
public int SortType { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,123 @@ |
|||||
|
using Shentun.Utilities; |
||||
|
using Shentun.WebPeis.Models; |
||||
|
using Shentun.WebPeis.Questions; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
|
||||
|
namespace Shentun.WebPeis.DiseaseRisks |
||||
|
{ |
||||
|
public class DiseaseRiskManager |
||||
|
{ |
||||
|
|
||||
|
private readonly IRepository<DiseaseRisk> _diseaseRiskRepository; |
||||
|
|
||||
|
public DiseaseRiskManager( |
||||
|
IRepository<DiseaseRisk> diseaseRiskRepository |
||||
|
) |
||||
|
{ |
||||
|
_diseaseRiskRepository = diseaseRiskRepository; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
public async Task<DiseaseRisk> CreateAsync(DiseaseRisk entity) |
||||
|
{ |
||||
|
DataHelper.CheckEntityIsNull(entity); |
||||
|
//DataHelper.CheckStringIsNull(entity.QuestionTypeName, "名称");
|
||||
|
|
||||
|
return new DiseaseRisk |
||||
|
{ |
||||
|
DiseaseRiskId = entity.DiseaseRiskId, |
||||
|
DiseaseRiskName = entity.DiseaseRiskName, |
||||
|
SimpleCode = LanguageConverter.GetPYSimpleCode(entity.DiseaseRiskName), |
||||
|
DisplayOrder = await EntityHelper.CreateMaxDisplayOrder<DiseaseRisk>(_diseaseRiskRepository) |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 更新
|
||||
|
/// </summary>
|
||||
|
/// <param name="sourceEntity"></param>
|
||||
|
/// <param name="targetEntity"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public void UpdateAsync( |
||||
|
DiseaseRisk sourceEntity, |
||||
|
DiseaseRisk targetEntity |
||||
|
) |
||||
|
{ |
||||
|
DataHelper.CheckEntityIsNull(sourceEntity); |
||||
|
DataHelper.CheckEntityIsNull(targetEntity); |
||||
|
//DataHelper.CheckStringIsNull(sourceEntity.QuestionTypeName, "名称");
|
||||
|
|
||||
|
targetEntity.DiseaseRiskName = sourceEntity.DiseaseRiskName; |
||||
|
targetEntity.SimpleCode = LanguageConverter.GetPYSimpleCode(sourceEntity.DiseaseRiskName); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 删除
|
||||
|
/// </summary>
|
||||
|
/// <param name="DiseaseRiskId"></param>
|
||||
|
/// <returns></returns>
|
||||
|
/// <exception cref="UserFriendlyException"></exception>
|
||||
|
public async Task CheckAndDeleteAsync(Guid DiseaseRiskId) |
||||
|
{ |
||||
|
|
||||
|
//var questionEnt = await _questionRepository.FirstOrDefaultAsync(m => m.QuestionTypeId == QuestionTypeId);
|
||||
|
//if (questionEnt != null)
|
||||
|
//{
|
||||
|
// throw new UserFriendlyException($"问卷类别已被使用,不能删除");
|
||||
|
//}
|
||||
|
|
||||
|
await _diseaseRiskRepository.DeleteAsync(d => d.DiseaseRiskId == DiseaseRiskId); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改排序 置顶,置底
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">需要修改的ID</param>
|
||||
|
/// <param name="SortType">修改方式:1 置顶 2 置底</param>
|
||||
|
/// <returns></returns>
|
||||
|
public async Task UpdateSortTopOrBottomAsync(Guid DiseaseRiskId, int SortType) |
||||
|
{ |
||||
|
var entity = await _diseaseRiskRepository.GetAsync(f => f.DiseaseRiskId == DiseaseRiskId); |
||||
|
await EntityHelper.UpdateSortTopOrBottomAsync(_diseaseRiskRepository, entity, SortType); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改排序 拖拽
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TEntity"></typeparam>
|
||||
|
/// <param name="repository"></param>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public async Task UpdateSortDragAsync(UpdateDiseaseRiskSortDragDto input) |
||||
|
{ |
||||
|
var entitylist = await _diseaseRiskRepository.GetListAsync(o => input.ItemList.Select(s => s.DiseaseRiskId).Contains(o.DiseaseRiskId)); |
||||
|
|
||||
|
foreach (var entity in entitylist) |
||||
|
{ |
||||
|
foreach (var item in input.ItemList) |
||||
|
{ |
||||
|
if (item.DiseaseRiskId == entity.DiseaseRiskId) |
||||
|
entity.DisplayOrder = item.DisplayOrder; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
await _diseaseRiskRepository.UpdateManyAsync(entitylist); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Shentun.WebPeis.DiseaseRisks |
||||
|
{ |
||||
|
public class UpdateDiseaseRiskSortDragDto |
||||
|
{ |
||||
|
public List<UpdateDiseaseRiskSortDragDetail> ItemList { get; set; } |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public class UpdateDiseaseRiskSortDragDetail |
||||
|
{ |
||||
|
public Guid DiseaseRiskId { get; set; } |
||||
|
public int DisplayOrder { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Shentun.WebPeis.DiseaseRisks |
||||
|
{ |
||||
|
public class UpdateDiseaseRiskSortTopOrBottomInputDto |
||||
|
{ |
||||
|
public Guid DiseaseRiskId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改方式:1 置顶 2 置底
|
||||
|
/// </summary>
|
||||
|
public int SortType { get; set; } |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue