Browse Source

预约

master
DESKTOP-G961P6V\Zhh 1 year ago
parent
commit
562da6559b
  1. 36
      src/Shentun.WebPeis.Application.Contracts/ThirdInterfaces/CreateThirdInterfaceDto.cs
  2. 11
      src/Shentun.WebPeis.Application.Contracts/ThirdInterfaces/DeleteThirdInterfaceDto.cs
  3. 42
      src/Shentun.WebPeis.Application.Contracts/ThirdInterfaces/ThirdInterfaceDto.cs
  4. 11
      src/Shentun.WebPeis.Application.Contracts/ThirdInterfaces/ThirdInterfaceTypeInputDto.cs
  5. 39
      src/Shentun.WebPeis.Application.Contracts/ThirdInterfaces/UpdateThirdInterfaceDto.cs
  6. 161
      src/Shentun.WebPeis.Application/ThirdInterfaces/ThirdInterfaceAppService.cs
  7. 4
      src/Shentun.WebPeis.Application/WebPeisApplicationAutoMapperProfile.cs
  8. 69
      src/Shentun.WebPeis.Domain/ThirdInterfaces/ThirdInterface.cs
  9. 141
      src/Shentun.WebPeis.Domain/ThirdInterfaces/ThirdInterfaceManager.cs
  10. 41
      src/Shentun.WebPeis.EntityFrameworkCore/Configures/ThirdInterfaceConfigure.cs
  11. 1
      src/Shentun.WebPeis.EntityFrameworkCore/EntityFrameworkCore/WebPeisDbContext.cs

36
src/Shentun.WebPeis.Application.Contracts/ThirdInterfaces/CreateThirdInterfaceDto.cs

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.WebPeis.ThirdInterfaces
{
public class CreateThirdInterfaceDto
{
/// <summary>
/// 名称
/// </summary>
public string ThirdInterfaceName { 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; }
}
}

11
src/Shentun.WebPeis.Application.Contracts/ThirdInterfaces/DeleteThirdInterfaceDto.cs

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.WebPeis.ThirdInterfaces
{
public class DeleteThirdInterfaceDto
{
public Guid ThirdInterfaceId { get; set; }
}
}

42
src/Shentun.WebPeis.Application.Contracts/ThirdInterfaces/ThirdInterfaceDto.cs

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Shentun.WebPeis.ThirdInterfaces
{
public class ThirdInterfaceDto : AuditedEntityDtoName
{
public Guid ThirdInterfaceId { get; set; }
/// <summary>
/// 名称
/// </summary>
public string ThirdInterfaceName { 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; }
}
}

11
src/Shentun.WebPeis.Application.Contracts/ThirdInterfaces/ThirdInterfaceTypeInputDto.cs

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.WebPeis.ThirdInterfaces
{
public class ThirdInterfaceTypeInputDto
{
public string ThirdInterfaceType { get; set; }
}
}

39
src/Shentun.WebPeis.Application.Contracts/ThirdInterfaces/UpdateThirdInterfaceDto.cs

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.WebPeis.ThirdInterfaces
{
public class UpdateThirdInterfaceDto
{
/// <summary>
/// 主键ID
/// </summary>
public Guid ThirdInterfaceId { get; set; }
/// <summary>
/// 名称
/// </summary>
public string ThirdInterfaceName { 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; }
}
}

161
src/Shentun.WebPeis.Application/ThirdInterfaces/ThirdInterfaceAppService.cs

@ -0,0 +1,161 @@
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;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Users;
namespace Shentun.WebPeis.ThirdInterfaces
{
/// <summary>
/// 第三方接口
/// </summary>
[ApiExplorerSettings(GroupName = "Work")]
[Authorize]
public class ThirdInterfaceAppService : ApplicationService
{
private readonly IRepository<ThirdInterface> _thirdInterfaceRepository;
private readonly CacheService _cacheService;
private readonly ThirdInterfaceManager _thirdInterfaceManager;
public ThirdInterfaceAppService(
IRepository<ThirdInterface> 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,
ThirdInterfaceName = s.ThirdInterfaceName,
DisplayOrder = s.DisplayOrder,
ThirdInterfaceId = s.ThirdInterfaceId,
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>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/ThirdInterface/GetListByThirdInterfaceTypeAsync")]
public async Task<List<ThirdInterfaceDto>> GetListByThirdInterfaceTypeAsync(ThirdInterfaceTypeInputDto input)
{
var thirdInterfaceList = (await _thirdInterfaceRepository.GetQueryableAsync()
).Where(o=>o.ThirdInterfaceType == input.ThirdInterfaceType);
return thirdInterfaceList.Select(s => new ThirdInterfaceDto
{
CreationTime = s.CreationTime,
CreatorId = s.CreatorId,
ThirdInterfaceName = s.ThirdInterfaceName,
DisplayOrder = s.DisplayOrder,
ThirdInterfaceId = s.ThirdInterfaceId,
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(o=>o.ThirdInterfaceId == input.ThirdInterfaceId);
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/Delete")]
public async Task DeleteAsync(DeleteThirdInterfaceDto input)
{
await _thirdInterfaceManager.CheckAndDeleteAsync(input.ThirdInterfaceId);
}
/// <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);
}
}
}

4
src/Shentun.WebPeis.Application/WebPeisApplicationAutoMapperProfile.cs

@ -13,6 +13,7 @@ using Shentun.WebPeis.Nations;
using Shentun.WebPeis.OrganizationUnits;
using Shentun.WebPeis.Persons;
using Shentun.WebPeis.Sexs;
using Shentun.WebPeis.ThirdInterfaces;
using Volo.Abp.Identity;
namespace Shentun.WebPeis;
@ -78,5 +79,8 @@ public class WebPeisApplicationAutoMapperProfile : Profile
.ForMember(d => d.PmStartTime, opt => opt.MapFrom(src => DataHelper.ConvertStringToTimeOnly(src.PmStartTime)))
.ForMember(d => d.PmStopTime, opt => opt.MapFrom(src => DataHelper.ConvertStringToTimeOnly(src.PmStopTime)));
CreateMap<ThirdInterface, ThirdInterfaceDto>();
CreateMap<CreateThirdInterfaceDto, ThirdInterface>();
CreateMap<UpdateThirdInterfaceDto, ThirdInterface>();
}
}

69
src/Shentun.WebPeis.Domain/ThirdInterfaces/ThirdInterface.cs

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.Domain.Entities;
using System.ComponentModel.DataAnnotations;
namespace Shentun.WebPeis.Models
{
/// <summary>
/// 第三方接口表
/// </summary>
[Table("third_interface")]
public class ThirdInterface : AuditedEntity, IHasConcurrencyStamp, IDisplayOrder
{
public ThirdInterface() { }
public ThirdInterface(Guid id)
{
ThirdInterfaceId = id;
}
public Guid ThirdInterfaceId { get; set; }
/// <summary>
/// 名称
/// </summary>
[Column("third_interface_name")]
[StringLength(30)]
public string ThirdInterfaceName { get; set; }
/// <summary>
/// 接口类型
/// </summary>
[Column("third_interface_type")]
[StringLength(2)]
public string ThirdInterfaceType { get; set; }
/// <summary>
/// 配置参数
/// </summary>
[Column("parm_value")]
[StringLength(2000)]
public string ParmValue { get; set; }
/// <summary>
/// 体检中心ID
/// </summary>
[Column("medical_center_id")]
public Guid MedicalCenterId { get; set; }
/// <summary>
/// 是否启用
/// </summary>
[Column("is_active")]
[StringLength(1)]
public char IsActive { get; set; }
[Column("display_order")]
public int DisplayOrder { get; set; }
[Column("concurrency_stamp")]
public string ConcurrencyStamp { get; set; }
public override object?[] GetKeys()
{
return [ThirdInterfaceId];
}
}
}

141
src/Shentun.WebPeis.Domain/ThirdInterfaces/ThirdInterfaceManager.cs

@ -0,0 +1,141 @@

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 System.Reflection;
using Shentun.WebPeis.Models;
using Shentun.WebPeis.Enums;
namespace Shentun.WebPeis.ThirdInterfaces
{
public class ThirdInterfaceManager : DomainService
{
private readonly IRepository<ThirdInterface> _thirdInterfaceRepository;
public ThirdInterfaceManager(
IRepository<ThirdInterface> thirdInterfaceRepository
)
{
_thirdInterfaceRepository = thirdInterfaceRepository;
}
/// <summary>
/// 创建
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public async Task<ThirdInterface> CreateAsync(
ThirdInterface entity
)
{
Verify(entity);
return new ThirdInterface
{
ThirdInterfaceName = entity.ThirdInterfaceName,
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.ThirdInterfaceName != targetEntity.ThirdInterfaceName)
{
targetEntity.ThirdInterfaceName = sourceEntity.ThirdInterfaceName;
}
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(o=>o.ThirdInterfaceId == 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.ThirdInterfaceName, "名称");
DataHelper.CheckStringIsNull(entity.ParmValue, "配置参数");
DataHelper.CheckCharIsYOrN(entity.IsActive, "是否启用");
Type type = typeof(ThirdInterfaceTypeFlag);
//从规定的约束内搜索字段
//约束有是静态成员,是公共成员,和返回父级的公共静态成员,
//FieldInfo[] fields = type.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy);
//if (fields.Where(o=>o.GetValue(null) == entity.ThirdInterfaceType).Count() == 0)
//{
// throw new ArgumentException($"接口类型参数为:{entity.ThirdInterfaceType},是无效值");
//}
//if (entity.ThirdInterfaceType != ThirdInterfaceTypeFlag.LisRequest
// && entity.ThirdInterfaceType != ThirdInterfaceTypeFlag.ChargeRequest
// && entity.ThirdInterfaceType != ThirdInterfaceTypeFlag.ImportLisResult
// && entity.ThirdInterfaceType != ThirdInterfaceTypeFlag.ImportPacsResult
// && entity.ThirdInterfaceType != ThirdInterfaceTypeFlag.ImportPatientRegister
// && entity.ThirdInterfaceType != ThirdInterfaceTypeFlag.TranToWebPeis
// && entity.ThirdInterfaceType != ThirdInterfaceTypeFlag.WebAppoint)
//{
// throw new ArgumentException($"接口类型参数为:{entity.ThirdInterfaceType},是无效值");
//}
}
}
}

41
src/Shentun.WebPeis.EntityFrameworkCore/Configures/ThirdInterfaceConfigure.cs

@ -0,0 +1,41 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Shentun.Peis.EntityFrameworkCore;
using Shentun.WebPeis.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.TenantManagement;
namespace Shentun.WebPeis.Configures
{
public class ThirdInterfaceConfigure : IEntityTypeConfiguration<ThirdInterface>
{
public void Configure(EntityTypeBuilder<ThirdInterface> entity)
{
entity.ToTable("third_interface", tb => tb.HasComment("第三方接口表"));
entity.Property(t => t.ThirdInterfaceName).HasComment("名称").IsRequired().HasMaxLength(30);
entity.Property(t => t.DisplayOrder).HasComment("显示顺序").IsRequired();
entity.Property(t => t.ThirdInterfaceType).HasComment("接口类型").IsRequired();
entity.Property(t => t.IsActive).HasComment("是否启用").IsRequired();
entity.Property(e => e.ConcurrencyStamp)
.HasMaxLength(40)
.HasColumnName("concurrency_stamp");
entity.Property(e => e.CreationTime)
.HasColumnType("timestamp(6) without time zone")
.HasColumnName("creation_time");
entity.Property(e => e.CreatorId).HasColumnName("creator_id");
entity.Property(e => e.LastModificationTime)
.HasColumnType("timestamp(6) without time zone")
.HasColumnName("last_modification_time");
entity.Property(e => e.LastModifierId).HasColumnName("last_modifier_id");
entity.Property(e => e.ThirdInterfaceId)
.IsFixedLength().ValueGeneratedNever()
.HasComment("编号").HasColumnName("third_interface_id");
}
}
}

1
src/Shentun.WebPeis.EntityFrameworkCore/EntityFrameworkCore/WebPeisDbContext.cs

@ -232,6 +232,7 @@ public partial class WebPeisDbContext : AbpDbContext<WebPeisDbContext>,
public virtual DbSet<DiseaseScreeningType> DiseaseScreeningTypes { get; set; }
public virtual DbSet<PrimarykeyBuilder> PrimarykeyBuilders { get; set; }
public virtual DbSet<ThirdInterface> ThirdInterfaces { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);

Loading…
Cancel
Save