19 changed files with 14947 additions and 9 deletions
-
11src/Shentun.Peis.Application.Contracts/Asbitems/AsbitemDto.cs
-
10src/Shentun.Peis.Application.Contracts/Asbitems/CreateAsbitemDto.cs
-
11src/Shentun.Peis.Application.Contracts/Asbitems/UpdateAsbitemDto.cs
-
14src/Shentun.Peis.Application.Contracts/DiseaseScreeningTypes/CreateDiseaseScreeningTypeDto.cs
-
24src/Shentun.Peis.Application.Contracts/DiseaseScreeningTypes/DiseaseScreeningTypeDto.cs
-
11src/Shentun.Peis.Application.Contracts/DiseaseScreeningTypes/DiseaseScreeningTypeIdInputDto.cs
-
19src/Shentun.Peis.Application.Contracts/DiseaseScreeningTypes/UpdateDiseaseScreeningTypeDto.cs
-
19src/Shentun.Peis.Application.Contracts/DiseaseScreeningTypes/UpdateManySortInputDto.cs
-
13src/Shentun.Peis.Application/Asbitems/AsbitemAppService.cs
-
157src/Shentun.Peis.Application/DiseaseScreeningTypes/DiseaseScreeningTypeAppService.cs
-
6src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs
-
8src/Shentun.Peis.Domain/Asbitems/Asbitem.cs
-
6src/Shentun.Peis.Domain/Asbitems/AsbitemManager.cs
-
8src/Shentun.Peis.Domain/DiseaseScreeningTypes/DiseaseScreeningType.cs
-
124src/Shentun.Peis.Domain/DiseaseScreeningTypes/DiseaseScreeningTypeManager.cs
-
5src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs
-
14380src/Shentun.Peis.EntityFrameworkCore/Migrations/20240520125835_init20240520001.Designer.cs
-
60src/Shentun.Peis.EntityFrameworkCore/Migrations/20240520125835_init20240520001.cs
-
70src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs
@ -0,0 +1,14 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.DiseaseScreeningTypes |
||||
|
{ |
||||
|
public class CreateDiseaseScreeningTypeDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 疾病筛查类别名称
|
||||
|
/// </summary>
|
||||
|
public string DisplayName { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.DiseaseScreeningTypes |
||||
|
{ |
||||
|
public class DiseaseScreeningTypeDto:AuditedEntityDtoName |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 疾病筛查类别名称
|
||||
|
/// </summary>
|
||||
|
public string DisplayName { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 自定义简码
|
||||
|
/// </summary>
|
||||
|
public string SimpleCode { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 显示顺序
|
||||
|
/// </summary>
|
||||
|
public int DisplayOrder { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.DiseaseScreeningTypes |
||||
|
{ |
||||
|
public class DiseaseScreeningTypeIdInputDto |
||||
|
{ |
||||
|
public Guid DiseaseScreeningTypeId { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.DiseaseScreeningTypes |
||||
|
{ |
||||
|
public class UpdateDiseaseScreeningTypeDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 主键ID
|
||||
|
/// </summary>
|
||||
|
public Guid DiseaseScreeningTypeId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 疾病筛查类别名称
|
||||
|
/// </summary>
|
||||
|
public string DisplayName { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.DiseaseScreeningTypes |
||||
|
{ |
||||
|
public class UpdateManySortInputDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 需要修改的ID
|
||||
|
/// </summary>
|
||||
|
public Guid DiseaseScreeningTypeId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改方式:1 置顶 2 置底
|
||||
|
/// </summary>
|
||||
|
public int SortType { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,157 @@ |
|||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Shentun.Peis.HelperDto; |
||||
|
using Shentun.Peis.MedicalReportTypes; |
||||
|
using Shentun.Peis.Models; |
||||
|
using Shentun.Peis.ThirdInterfaces; |
||||
|
using SqlSugar; |
||||
|
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.Entities; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
using Volo.Abp.ObjectMapping; |
||||
|
using Volo.Abp.Users; |
||||
|
|
||||
|
namespace Shentun.Peis.DiseaseScreeningTypes |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 疾病筛查类别
|
||||
|
/// </summary>
|
||||
|
[ApiExplorerSettings(GroupName = "Work")] |
||||
|
[Authorize] |
||||
|
public class DiseaseScreeningTypeAppService : ApplicationService |
||||
|
{ |
||||
|
private readonly IRepository<DiseaseScreeningType, Guid> _diseaseScreeningTypeRepository; |
||||
|
private readonly DiseaseScreeningTypeManager _diseaseScreeningTypeManager; |
||||
|
private readonly CacheService _cacheService; |
||||
|
|
||||
|
public DiseaseScreeningTypeAppService( |
||||
|
IRepository<DiseaseScreeningType, Guid> diseaseScreeningTypeRepository, |
||||
|
DiseaseScreeningTypeManager diseaseScreeningTypeManager, |
||||
|
CacheService cacheService) |
||||
|
{ |
||||
|
_diseaseScreeningTypeRepository = diseaseScreeningTypeRepository; |
||||
|
_diseaseScreeningTypeManager = diseaseScreeningTypeManager; |
||||
|
_cacheService = cacheService; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取通过主键
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/DiseaseScreeningType/Get")] |
||||
|
public async Task<DiseaseScreeningTypeDto> GetAsync(DiseaseScreeningTypeIdInputDto input) |
||||
|
{ |
||||
|
var diseaseScreeningTypeEnt = await _diseaseScreeningTypeRepository.GetAsync(input.DiseaseScreeningTypeId); |
||||
|
var entityDto = ObjectMapper.Map<DiseaseScreeningType, DiseaseScreeningTypeDto>(diseaseScreeningTypeEnt); |
||||
|
entityDto.CreatorName = await _cacheService.GetSurnameAsync(entityDto.CreatorId); |
||||
|
entityDto.LastModifierName = await _cacheService.GetSurnameAsync(entityDto.LastModifierId); |
||||
|
return entityDto; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取列表
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/DiseaseScreeningType/GetList")] |
||||
|
public async Task<List<DiseaseScreeningTypeDto>> GetListAsync() |
||||
|
{ |
||||
|
var entlist = await _diseaseScreeningTypeRepository.GetQueryableAsync(); |
||||
|
|
||||
|
var entdto = entlist.Select(s => new DiseaseScreeningTypeDto |
||||
|
{ |
||||
|
CreationTime = s.CreationTime, |
||||
|
CreatorId = s.CreatorId, |
||||
|
DisplayName = s.DisplayName, |
||||
|
DisplayOrder = s.DisplayOrder, |
||||
|
Id = s.Id, |
||||
|
LastModificationTime = s.LastModificationTime, |
||||
|
LastModifierId = s.LastModifierId, |
||||
|
SimpleCode = s.SimpleCode, |
||||
|
CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).Result, |
||||
|
LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).Result |
||||
|
}).OrderBy(o => o.DisplayOrder).ToList(); |
||||
|
|
||||
|
return entdto; |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/DiseaseScreeningType/Create")] |
||||
|
public async Task<DiseaseScreeningTypeDto> CreateAsync(CreateDiseaseScreeningTypeDto input) |
||||
|
{ |
||||
|
var createEntity = ObjectMapper.Map<CreateDiseaseScreeningTypeDto, DiseaseScreeningType>(input); |
||||
|
var entity = await _diseaseScreeningTypeManager.CreateAsync(createEntity); |
||||
|
entity = await _diseaseScreeningTypeRepository.InsertAsync(entity); |
||||
|
var dto = ObjectMapper.Map<DiseaseScreeningType, DiseaseScreeningTypeDto>(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/DiseaseScreeningType/Update")] |
||||
|
public async Task<DiseaseScreeningTypeDto> UpdateAsync(UpdateDiseaseScreeningTypeDto input) |
||||
|
{ |
||||
|
var entity = await _diseaseScreeningTypeRepository.GetAsync(input.DiseaseScreeningTypeId); |
||||
|
var sourceEntity = ObjectMapper.Map<UpdateDiseaseScreeningTypeDto, DiseaseScreeningType>(input); |
||||
|
await _diseaseScreeningTypeManager.UpdateAsync(sourceEntity, entity); |
||||
|
entity = await _diseaseScreeningTypeRepository.UpdateAsync(entity); |
||||
|
var dto = ObjectMapper.Map<DiseaseScreeningType, DiseaseScreeningTypeDto>(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/DiseaseScreeningType/Delete")] |
||||
|
public async Task DeleteAsync(DiseaseScreeningTypeIdInputDto input) |
||||
|
{ |
||||
|
await _diseaseScreeningTypeManager.CheckAndDeleteAsync(input.DiseaseScreeningTypeId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改排序 置顶,置底
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/DiseaseScreeningType/UpdateManySort")] |
||||
|
public async Task UpdateManySortAsync(UpdateManySortInputDto input) |
||||
|
{ |
||||
|
await _diseaseScreeningTypeManager.UpdateManySortAsync(input.DiseaseScreeningTypeId, input.SortType); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改排序 拖拽
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/DiseaseScreeningType/UpdateSortMany")] |
||||
|
public async Task UpdateSortManyAsync(UpdateSortManyDto input) |
||||
|
{ |
||||
|
await _diseaseScreeningTypeManager.UpdateSortManyAsync(input); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,124 @@ |
|||||
|
using Shentun.Peis.HelperDto; |
||||
|
using Shentun.Peis.Models; |
||||
|
using Shentun.Utilities; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
using Volo.Abp.Domain.Services; |
||||
|
|
||||
|
namespace Shentun.Peis.DiseaseScreeningTypes |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 疾病筛查类别
|
||||
|
/// </summary>
|
||||
|
public class DiseaseScreeningTypeManager : DomainService |
||||
|
{ |
||||
|
|
||||
|
private readonly IRepository<DiseaseScreeningType, Guid> _diseaseScreeningTypeRepository; |
||||
|
private readonly IRepository<Asbitem, Guid> _asbitemRepository; |
||||
|
|
||||
|
public DiseaseScreeningTypeManager( |
||||
|
IRepository<DiseaseScreeningType, Guid> diseaseScreeningTypeRepository, |
||||
|
IRepository<Asbitem, Guid> asbitemRepository) |
||||
|
{ |
||||
|
_diseaseScreeningTypeRepository = diseaseScreeningTypeRepository; |
||||
|
_asbitemRepository = asbitemRepository; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建
|
||||
|
/// </summary>
|
||||
|
/// <param name="entity"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public async Task<DiseaseScreeningType> CreateAsync( |
||||
|
DiseaseScreeningType entity |
||||
|
) |
||||
|
{ |
||||
|
DataHelper.CheckEntityIsNull(entity); |
||||
|
DataHelper.CheckStringIsNull(entity.DisplayName, "名称"); |
||||
|
await EntityHelper.CheckSameName<DiseaseScreeningType, Guid>(_diseaseScreeningTypeRepository, entity.DisplayName); |
||||
|
return new DiseaseScreeningType |
||||
|
{ |
||||
|
DisplayName = entity.DisplayName, |
||||
|
SimpleCode = LanguageConverter.GetPYSimpleCode(entity.DisplayName), |
||||
|
DisplayOrder = await EntityHelper.CreateMaxDisplayOrder<DiseaseScreeningType>(_diseaseScreeningTypeRepository) |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 更新
|
||||
|
/// </summary>
|
||||
|
/// <param name="sourceEntity"></param>
|
||||
|
/// <param name="targetEntity"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public async Task UpdateAsync( |
||||
|
DiseaseScreeningType sourceEntity, |
||||
|
DiseaseScreeningType targetEntity |
||||
|
) |
||||
|
{ |
||||
|
DataHelper.CheckEntityIsNull(sourceEntity); |
||||
|
DataHelper.CheckEntityIsNull(targetEntity); |
||||
|
DataHelper.CheckStringIsNull(sourceEntity.DisplayName, "名称"); |
||||
|
if (sourceEntity.DisplayName != targetEntity.DisplayName) |
||||
|
{ |
||||
|
|
||||
|
await EntityHelper.CheckSameName<DiseaseScreeningType, Guid>(_diseaseScreeningTypeRepository, sourceEntity.DisplayName, targetEntity); |
||||
|
targetEntity.DisplayName = sourceEntity.DisplayName; |
||||
|
targetEntity.SimpleCode = LanguageConverter.GetPYSimpleCode(targetEntity.DisplayName); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 验证是否有项目类别使用
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
/// <exception cref="UserFriendlyException"></exception>
|
||||
|
public async Task CheckAndDeleteAsync(Guid id) |
||||
|
{ |
||||
|
|
||||
|
var asbitemEnt = await _asbitemRepository.FirstOrDefaultAsync(m => m.DiseaseScreeningTypeId == id); |
||||
|
if (asbitemEnt != null) |
||||
|
{ |
||||
|
throw new UserFriendlyException($"疾病筛查类别\"{asbitemEnt.DisplayName}\"已在组合项目\"{asbitemEnt.DisplayName}\"中使用,不能删除"); |
||||
|
} |
||||
|
|
||||
|
await _diseaseScreeningTypeRepository.DeleteAsync(id); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改排序 置顶,置底
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">需要修改的ID</param>
|
||||
|
/// <param name="SortType">修改方式:1 置顶 2 置底</param>
|
||||
|
/// <returns></returns>
|
||||
|
public async Task UpdateManySortAsync(Guid id, int SortType) |
||||
|
{ |
||||
|
await EntityHelper.UpdateManySortAsync(_diseaseScreeningTypeRepository, id, SortType); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改排序 拖拽
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TEntity"></typeparam>
|
||||
|
/// <param name="repository"></param>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public async Task UpdateSortManyAsync(UpdateSortManyDto input) |
||||
|
{ |
||||
|
await EntityHelper.UpdateSortManyAsync(_diseaseScreeningTypeRepository, input); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
14380
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240520125835_init20240520001.Designer.cs
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,60 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
#nullable disable |
||||
|
|
||||
|
namespace Shentun.Peis.Migrations |
||||
|
{ |
||||
|
public partial class init20240520001 : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.AddColumn<Guid>( |
||||
|
name: "disease_screening_type_id", |
||||
|
table: "asbitem", |
||||
|
type: "uuid", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "warn", |
||||
|
table: "asbitem", |
||||
|
type: "character varying(100)", |
||||
|
maxLength: 100, |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "disease_screening_type", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
id = table.Column<Guid>(type: "uuid", fixedLength: true, nullable: false, comment: "编号"), |
||||
|
display_name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false, comment: "体检类别名称"), |
||||
|
simple_code = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false, comment: "自定义简码"), |
||||
|
display_order = table.Column<int>(type: "integer", nullable: false, defaultValueSql: "999999", comment: "显示顺序"), |
||||
|
concurrency_stamp = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true), |
||||
|
creation_time = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), |
||||
|
creator_id = table.Column<Guid>(type: "uuid", nullable: false), |
||||
|
last_modification_time = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), |
||||
|
last_modifier_id = table.Column<Guid>(type: "uuid", nullable: false) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_disease_screening_type", x => x.id); |
||||
|
}, |
||||
|
comment: "疾病筛查类别设置"); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropTable( |
||||
|
name: "disease_screening_type"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "disease_screening_type_id", |
||||
|
table: "asbitem"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "warn", |
||||
|
table: "asbitem"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue