11 changed files with 14694 additions and 195 deletions
-
36src/Shentun.Peis.Application.Contracts/ThirdInterfaces/CreateThirdInterfaceDto.cs
-
11src/Shentun.Peis.Application.Contracts/ThirdInterfaces/DeleteThirdInterfaceDto.cs
-
41src/Shentun.Peis.Application.Contracts/ThirdInterfaces/ThirdInterfaceDto.cs
-
39src/Shentun.Peis.Application.Contracts/ThirdInterfaces/UpdateThirdInterfaceDto.cs
-
5src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs
-
136src/Shentun.Peis.Application/ThirdInterfaces/ThirdInterfaceAppService.cs
-
6src/Shentun.Peis.Domain/ThirdInterfaces/ThirdInterface.cs
-
128src/Shentun.Peis.Domain/ThirdInterfaces/ThirdInterfaceManager.cs
-
14084src/Shentun.Peis.EntityFrameworkCore/Migrations/20240429121856_init20240429001.Designer.cs
-
22src/Shentun.Peis.EntityFrameworkCore/Migrations/20240429121856_init20240429001.cs
-
381src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs
@ -0,0 +1,36 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.ThirdInterfaces |
|||
{ |
|||
public class CreateThirdInterfaceDto |
|||
{ |
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
public string DisplayName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 接口类型
|
|||
/// </summary>
|
|||
public string ThirdInterfaceType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 配置参数
|
|||
/// </summary>
|
|||
public string ParmValue { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 体检中心ID
|
|||
/// </summary>
|
|||
public Guid MedicalCenterId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否启用
|
|||
/// </summary>
|
|||
public char IsActive { get; set; } |
|||
|
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.ThirdInterfaces |
|||
{ |
|||
public class DeleteThirdInterfaceDto |
|||
{ |
|||
public Guid Id { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,41 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.ThirdInterfaces |
|||
{ |
|||
public class ThirdInterfaceDto : AuditedEntityDtoName |
|||
{ |
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
public string DisplayName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 接口类型
|
|||
/// </summary>
|
|||
public string ThirdInterfaceType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 配置参数
|
|||
/// </summary>
|
|||
public string ParmValue { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 体检中心ID
|
|||
/// </summary>
|
|||
public Guid MedicalCenterId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否启用
|
|||
/// </summary>
|
|||
public char IsActive { get; set; } |
|||
|
|||
|
|||
public int DisplayOrder { get; set; } |
|||
|
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.ThirdInterfaces |
|||
{ |
|||
public class UpdateThirdInterfaceDto |
|||
{ |
|||
/// <summary>
|
|||
/// 主键ID
|
|||
/// </summary>
|
|||
public Guid Id { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
public string DisplayName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 接口类型
|
|||
/// </summary>
|
|||
public string ThirdInterfaceType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 配置参数
|
|||
/// </summary>
|
|||
public string ParmValue { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 体检中心ID
|
|||
/// </summary>
|
|||
public Guid MedicalCenterId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否启用
|
|||
/// </summary>
|
|||
public char IsActive { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,136 @@ |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Shentun.Peis.HelperDto; |
|||
using Shentun.Peis.Items; |
|||
using Shentun.Peis.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; |
|||
using Volo.Abp.ObjectMapping; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace Shentun.Peis.ThirdInterfaces |
|||
{ |
|||
/// <summary>
|
|||
/// 第三方接口
|
|||
/// </summary>
|
|||
[ApiExplorerSettings(GroupName = "Work")] |
|||
[Authorize] |
|||
public class ThirdInterfaceAppService : ApplicationService |
|||
{ |
|||
private readonly IRepository<ThirdInterface, Guid> _thirdInterfaceRepository; |
|||
private readonly CacheService _cacheService; |
|||
private readonly ThirdInterfaceManager _thirdInterfaceManager; |
|||
|
|||
public ThirdInterfaceAppService( |
|||
IRepository<ThirdInterface, Guid> thirdInterfaceRepository, |
|||
CacheService cacheService, |
|||
ThirdInterfaceManager thirdInterfaceManager) |
|||
{ |
|||
_thirdInterfaceRepository = thirdInterfaceRepository; |
|||
_cacheService = cacheService; |
|||
_thirdInterfaceManager = thirdInterfaceManager; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 查询列表
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/ThirdInterface/GetList")] |
|||
public async Task<List<ThirdInterfaceDto>> GetListAsync() |
|||
{ |
|||
var thirdInterfaceList = await _thirdInterfaceRepository.GetQueryableAsync(); |
|||
return thirdInterfaceList.Select(s => new ThirdInterfaceDto |
|||
{ |
|||
CreationTime = s.CreationTime, |
|||
CreatorId = s.CreatorId, |
|||
DisplayName = s.DisplayName, |
|||
DisplayOrder = s.DisplayOrder, |
|||
Id = s.Id, |
|||
IsActive = s.IsActive, |
|||
LastModificationTime = s.LastModificationTime, |
|||
LastModifierId = s.LastModifierId, |
|||
CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).Result, |
|||
LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).Result, |
|||
MedicalCenterId = s.MedicalCenterId, |
|||
ParmValue = s.ParmValue, |
|||
ThirdInterfaceType = s.ThirdInterfaceType |
|||
}).OrderBy(o => o.DisplayOrder).ToList(); |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 创建
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/ThirdInterface/Create")] |
|||
public async Task<ThirdInterfaceDto> CreateAsync(CreateThirdInterfaceDto input) |
|||
{ |
|||
var createEntity = ObjectMapper.Map<CreateThirdInterfaceDto, ThirdInterface>(input); |
|||
var entity = await _thirdInterfaceManager.CreateAsync(createEntity); |
|||
entity = await _thirdInterfaceRepository.InsertAsync(entity); |
|||
var dto = ObjectMapper.Map<ThirdInterface, ThirdInterfaceDto>(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/ThirdInterface/Update")] |
|||
public async Task<ThirdInterfaceDto> UpdateAsync(UpdateThirdInterfaceDto input) |
|||
{ |
|||
var entity = await _thirdInterfaceRepository.GetAsync(input.Id); |
|||
var sourceEntity = ObjectMapper.Map<UpdateThirdInterfaceDto, ThirdInterface>(input); |
|||
_thirdInterfaceManager.UpdateAsync(sourceEntity, entity); |
|||
entity = await _thirdInterfaceRepository.UpdateAsync(entity); |
|||
var dto = ObjectMapper.Map<ThirdInterface, ThirdInterfaceDto>(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/ThirdInterface/Update")] |
|||
public async Task DeleteAsync(DeleteThirdInterfaceDto input) |
|||
{ |
|||
await _thirdInterfaceManager.CheckAndDeleteAsync(input.Id); |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 修改排序 置顶,置底
|
|||
/// </summary>
|
|||
/// <param name="id">需要修改的ID</param>
|
|||
/// <param name="SortType">修改方式:1 置顶 2 置底</param>
|
|||
/// <returns></returns>
|
|||
[HttpPut("api/app/ThirdInterface/UpdateManySort")] |
|||
public async Task UpdateManySortAsync(Guid id, int SortType) |
|||
{ |
|||
await _thirdInterfaceManager.UpdateManySortAsync(id, SortType); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 修改排序 拖拽
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPut("api/app/ThirdInterface/UpdateSortMany")] |
|||
public async Task UpdateSortManyAsync(UpdateSortManyDto input) |
|||
{ |
|||
await _thirdInterfaceManager.UpdateSortManyAsync(input); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,128 @@ |
|||
using Shentun.Peis.Enums; |
|||
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.Domain.Repositories; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Domain.Services; |
|||
using Shentun.Peis.HelperDto; |
|||
|
|||
namespace Shentun.Peis.ThirdInterfaces |
|||
{ |
|||
public class ThirdInterfaceManager : DomainService |
|||
{ |
|||
private readonly IRepository<ThirdInterface, Guid> _thirdInterfaceRepository; |
|||
|
|||
public ThirdInterfaceManager( |
|||
IRepository<ThirdInterface, Guid> thirdInterfaceRepository |
|||
) |
|||
{ |
|||
_thirdInterfaceRepository = thirdInterfaceRepository; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 创建
|
|||
/// </summary>
|
|||
/// <param name="entity"></param>
|
|||
/// <returns></returns>
|
|||
public async Task<ThirdInterface> CreateAsync( |
|||
ThirdInterface entity |
|||
) |
|||
{ |
|||
Verify(entity); |
|||
|
|||
return new ThirdInterface |
|||
{ |
|||
DisplayName = entity.DisplayName, |
|||
DisplayOrder = await EntityHelper.CreateMaxDisplayOrder<ThirdInterface>(_thirdInterfaceRepository), |
|||
IsActive = entity.IsActive, |
|||
MedicalCenterId = entity.MedicalCenterId, |
|||
ParmValue = entity.ParmValue, |
|||
ThirdInterfaceType = entity.ThirdInterfaceType |
|||
}; |
|||
} |
|||
/// <summary>
|
|||
/// 更新
|
|||
/// </summary>
|
|||
/// <param name="sourceEntity"></param>
|
|||
/// <param name="targetEntity"></param>
|
|||
/// <returns></returns>
|
|||
public void UpdateAsync( |
|||
ThirdInterface sourceEntity, |
|||
ThirdInterface targetEntity |
|||
) |
|||
{ |
|||
DataHelper.CheckEntityIsNull(targetEntity); |
|||
Verify(sourceEntity); |
|||
if (sourceEntity.DisplayName != targetEntity.DisplayName) |
|||
{ |
|||
targetEntity.DisplayName = sourceEntity.DisplayName; |
|||
} |
|||
|
|||
targetEntity.IsActive = sourceEntity.IsActive; |
|||
targetEntity.MedicalCenterId = sourceEntity.MedicalCenterId; |
|||
targetEntity.ParmValue = sourceEntity.ParmValue; |
|||
targetEntity.ThirdInterfaceType = sourceEntity.ThirdInterfaceType; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 删除项目时,同步删除项目结果模板( item_result_template)、参考范围(reference_range)、结果匹配(item_result_match)、组合项目包含的项目(asbitem_detail),项目模板明细(ItemTemplateDetail)。
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
/// <exception cref="UserFriendlyException"></exception>
|
|||
public async Task CheckAndDeleteAsync(Guid id) |
|||
{ |
|||
await _thirdInterfaceRepository.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(_thirdInterfaceRepository, 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(_thirdInterfaceRepository, input); |
|||
|
|||
} |
|||
|
|||
|
|||
private void Verify(ThirdInterface entity) |
|||
{ |
|||
DataHelper.CheckEntityIsNull(entity); |
|||
DataHelper.CheckStringIsNull(entity.DisplayName, "名称"); |
|||
DataHelper.CheckStringIsNull(entity.ParmValue, "配置参数"); |
|||
DataHelper.CheckCharIsYOrN(entity.IsActive, "是否启用"); |
|||
if (entity.ThirdInterfaceType != ThirdInterfaceTypeFlag.LisRequest |
|||
&& entity.ThirdInterfaceType != ThirdInterfaceTypeFlag.ChargeRequest) |
|||
{ |
|||
throw new ArgumentException($"接口类型参数为:{entity.ThirdInterfaceType},是无效值,只能为{ThirdInterfaceTypeFlag.LisRequest}跟{ThirdInterfaceTypeFlag.ChargeRequest}"); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
14084
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240429121856_init20240429001.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,22 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace Shentun.Peis.Migrations |
|||
{ |
|||
public partial class init20240429001 : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue