17 changed files with 16428 additions and 1 deletions
-
31src/Shentun.Peis.Application.Contracts/Devices/CreateDeviceDto.cs
-
42src/Shentun.Peis.Application.Contracts/Devices/DeviceDto.cs
-
11src/Shentun.Peis.Application.Contracts/Devices/DeviceIdInputDto.cs
-
19src/Shentun.Peis.Application.Contracts/Devices/DeviceListInputDto.cs
-
34src/Shentun.Peis.Application.Contracts/Devices/UpdateDeviceDto.cs
-
19src/Shentun.Peis.Application.Contracts/Devices/UpdateManySortDeviceInputDto.cs
-
169src/Shentun.Peis.Application/Devices/DeviceAppService.cs
-
7src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs
-
67src/Shentun.Peis.Domain/Devices/Device.cs
-
149src/Shentun.Peis.Domain/Devices/DeviceManager.cs
-
7src/Shentun.Peis.Domain/RegisterCheckPictures/RegisterCheckPicture.cs
-
28src/Shentun.Peis.EntityFrameworkCore/DbMapping/Devices/DeviceDbMapping.cs
-
2src/Shentun.Peis.EntityFrameworkCore/DbMapping/RegisterCheckPictures/RegisterCheckPictureDbMapping.cs
-
6src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs
-
15711src/Shentun.Peis.EntityFrameworkCore/Migrations/20240920090638_insert_device.Designer.cs
-
53src/Shentun.Peis.EntityFrameworkCore/Migrations/20240920090638_insert_device.cs
-
74src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs
@ -0,0 +1,31 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.Devices |
||||
|
{ |
||||
|
public class CreateDeviceDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 名称
|
||||
|
/// </summary>
|
||||
|
public string DisplayName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 仪器类别
|
||||
|
/// </summary>
|
||||
|
public Guid DeviceTypeId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 设备协议 0-视频采集图片和导入图片,1-dicom
|
||||
|
/// </summary>
|
||||
|
public char DeviceProtocolFlag { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// DICOM设备AETitle 该一般字段存储英文字符,仅DICOM设备需要设置
|
||||
|
/// </summary>
|
||||
|
public string AeTitle { get; set; } |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,42 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.Devices |
||||
|
{ |
||||
|
public class DeviceDto : AuditedEntityDtoName |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 名称
|
||||
|
/// </summary>
|
||||
|
public string DisplayName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 仪器类别
|
||||
|
/// </summary>
|
||||
|
public Guid DeviceTypeId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 设备协议 0-视频采集图片和导入图片,1-dicom
|
||||
|
/// </summary>
|
||||
|
public char DeviceProtocolFlag { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// DICOM设备AETitle 该一般字段存储英文字符,仅DICOM设备需要设置
|
||||
|
/// </summary>
|
||||
|
public string AeTitle { 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.Devices |
||||
|
{ |
||||
|
public class DeviceIdInputDto |
||||
|
{ |
||||
|
public Guid DeviceId { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.Devices |
||||
|
{ |
||||
|
public class DeviceListInputDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 仪器类别
|
||||
|
/// </summary>
|
||||
|
public Guid? DeviceTypeId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 检索名字 简码
|
||||
|
/// </summary>
|
||||
|
public string KeyWord { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.Devices |
||||
|
{ |
||||
|
public class UpdateDeviceDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 设备ID
|
||||
|
/// </summary>
|
||||
|
public Guid DeviceId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 名称
|
||||
|
/// </summary>
|
||||
|
public string DisplayName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 仪器类别
|
||||
|
/// </summary>
|
||||
|
public Guid DeviceTypeId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 设备协议 0-视频采集图片和导入图片,1-dicom
|
||||
|
/// </summary>
|
||||
|
public char DeviceProtocolFlag { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// DICOM设备AETitle 该一般字段存储英文字符,仅DICOM设备需要设置
|
||||
|
/// </summary>
|
||||
|
public string AeTitle { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.Devices |
||||
|
{ |
||||
|
public class UpdateManySortDeviceInputDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 需要修改的ID
|
||||
|
/// </summary>
|
||||
|
public Guid DeviceId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改方式:1 置顶 2 置底
|
||||
|
/// </summary>
|
||||
|
public int SortType { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,169 @@ |
|||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Shentun.Peis.Devices; |
||||
|
using Shentun.Peis.HelperDto; |
||||
|
using Shentun.Peis.Models; |
||||
|
using Shentun.Peis.PatientRegisters; |
||||
|
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.Peis.Devices |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 危急值
|
||||
|
/// </summary>
|
||||
|
[ApiExplorerSettings(GroupName = "Work")] |
||||
|
[Authorize] |
||||
|
public class DeviceAppService : ApplicationService |
||||
|
{ |
||||
|
private readonly IRepository<Device, Guid> _deviceRepository; |
||||
|
private readonly CacheService _cacheService; |
||||
|
private readonly DeviceManager _deviceManager; |
||||
|
|
||||
|
public DeviceAppService( |
||||
|
IRepository<Device, Guid> deviceRepository, |
||||
|
CacheService cacheService, |
||||
|
DeviceManager deviceManager |
||||
|
) |
||||
|
{ |
||||
|
_deviceRepository = deviceRepository; |
||||
|
_cacheService = cacheService; |
||||
|
_deviceManager = deviceManager; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取通过主键
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/Device/Get")] |
||||
|
public async Task<DeviceDto> GetAsync(DeviceIdInputDto input) |
||||
|
{ |
||||
|
var deviceEnt = await _deviceRepository.GetAsync(input.DeviceId); |
||||
|
var entityDto = ObjectMapper.Map<Device, DeviceDto>(deviceEnt); |
||||
|
entityDto.CreatorName = await _cacheService.GetSurnameAsync(entityDto.CreatorId); |
||||
|
entityDto.LastModifierName = await _cacheService.GetSurnameAsync(entityDto.LastModifierId); |
||||
|
return entityDto; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取列表 可根据条件检索
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/Device/GetList")] |
||||
|
public async Task<List<DeviceDto>> GetListAsync(DeviceListInputDto input) |
||||
|
{ |
||||
|
|
||||
|
var query = await _deviceRepository.GetQueryableAsync(); |
||||
|
|
||||
|
if (input.DeviceTypeId != null) |
||||
|
query = query.Where(m => m.DeviceTypeId == input.DeviceTypeId); |
||||
|
|
||||
|
|
||||
|
if (!string.IsNullOrWhiteSpace(input.KeyWord)) |
||||
|
query = query.Where(m => m.DisplayName.Contains(input.KeyWord) || m.SimpleCode.Contains(input.KeyWord)); |
||||
|
|
||||
|
|
||||
|
var entdto = query.Select(s => new DeviceDto |
||||
|
{ |
||||
|
CreationTime = s.CreationTime, |
||||
|
CreatorId = s.CreatorId, |
||||
|
DisplayName = s.DisplayName, |
||||
|
DisplayOrder = s.DisplayOrder, |
||||
|
Id = s.Id, |
||||
|
DeviceTypeId = s.DeviceTypeId, |
||||
|
AeTitle = s.AeTitle, |
||||
|
SimpleCode = s.SimpleCode, |
||||
|
DeviceProtocolFlag = s.DeviceProtocolFlag, |
||||
|
LastModificationTime = s.LastModificationTime, |
||||
|
LastModifierId = s.LastModifierId, |
||||
|
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/Device/Create")] |
||||
|
public async Task<DeviceDto> CreateAsync(CreateDeviceDto input) |
||||
|
{ |
||||
|
var createEntity = ObjectMapper.Map<CreateDeviceDto, Device>(input); |
||||
|
var entity = await _deviceManager.CreateAsync(createEntity); |
||||
|
entity = await _deviceRepository.InsertAsync(entity); |
||||
|
var dto = ObjectMapper.Map<Device, DeviceDto>(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/Device/Update")] |
||||
|
public async Task<DeviceDto> UpdateAsync(UpdateDeviceDto input) |
||||
|
{ |
||||
|
var entity = await _deviceRepository.GetAsync(input.DeviceId); |
||||
|
var sourceEntity = ObjectMapper.Map<UpdateDeviceDto, Device>(input); |
||||
|
await _deviceManager.UpdateAsync(sourceEntity, entity); |
||||
|
entity = await _deviceRepository.UpdateAsync(entity); |
||||
|
var dto = ObjectMapper.Map<Device, DeviceDto>(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/Device/Delete")] |
||||
|
public async Task DeleteAsync(DeviceIdInputDto input) |
||||
|
{ |
||||
|
await _deviceManager.CheckAndDeleteAsync(input.DeviceId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改排序 置顶,置底
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/Device/UpdateManySort")] |
||||
|
public async Task UpdateManySortAsync(UpdateManySortDeviceInputDto input) |
||||
|
{ |
||||
|
await _deviceManager.UpdateManySortAsync(input.DeviceId, input.SortType); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改排序 拖拽
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("api/app/Device/UpdateSortMany")] |
||||
|
public async Task UpdateSortManyAsync(UpdateSortManyCommonDto input) |
||||
|
{ |
||||
|
await _deviceManager.UpdateSortManyAsync(input); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,67 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
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.Schema; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Shentun.Peis.Models |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 仪器表
|
||||
|
/// </summary>
|
||||
|
public class Device : AuditedEntity<Guid>, IHasConcurrencyStamp, IDisplayName, IDisplayOrder |
||||
|
{ |
||||
|
public Device(Guid id) : base(id) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 名称
|
||||
|
/// </summary>
|
||||
|
[Column("Display_Name")] |
||||
|
[StringLength(100)] |
||||
|
public string DisplayName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 仪器类别
|
||||
|
/// </summary>
|
||||
|
[Column("device_type_id")] |
||||
|
public Guid DeviceTypeId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 设备协议 0-视频采集图片和导入图片,1-dicom
|
||||
|
/// </summary>
|
||||
|
[Column("device_protocol_flag")] |
||||
|
public char DeviceProtocolFlag { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// DICOM设备AETitle 该一般字段存储英文字符,仅DICOM设备需要设置
|
||||
|
/// </summary>
|
||||
|
[Column("ae_title")] |
||||
|
[StringLength(50)] |
||||
|
public string AeTitle { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 简码
|
||||
|
/// </summary>
|
||||
|
[Column("simple_code")] |
||||
|
[StringLength(100)] |
||||
|
public string SimpleCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 排序
|
||||
|
/// </summary>
|
||||
|
[Column("display_order")] |
||||
|
public int DisplayOrder { get; set; } |
||||
|
|
||||
|
[Column("concurrency_stamp")] |
||||
|
public string ConcurrencyStamp { get; set; } |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,149 @@ |
|||||
|
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.Entities; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
using Volo.Abp.Domain.Services; |
||||
|
|
||||
|
namespace Shentun.Peis.Devices |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
public class DeviceManager : DomainService |
||||
|
{ |
||||
|
private readonly IRepository<Device, Guid> _deviceRepository; |
||||
|
private readonly IRepository<RegisterCheckPicture, Guid> _registerCheckPictureRepository; |
||||
|
|
||||
|
|
||||
|
public DeviceManager( |
||||
|
IRepository<Device, Guid> deviceRepository, |
||||
|
IRepository<RegisterCheckPicture, Guid> registerCheckPictureRepository |
||||
|
) |
||||
|
{ |
||||
|
_deviceRepository = deviceRepository; |
||||
|
_registerCheckPictureRepository = registerCheckPictureRepository; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建
|
||||
|
/// </summary>
|
||||
|
/// <param name="entity"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public async Task<Device> CreateAsync( |
||||
|
Device entity |
||||
|
) |
||||
|
{ |
||||
|
Verify(entity); |
||||
|
await EntityHelper.CheckSameName(_deviceRepository, entity.DisplayName); |
||||
|
return new Device(GuidGenerator.Create()) |
||||
|
{ |
||||
|
DisplayName = entity.DisplayName, |
||||
|
DeviceProtocolFlag = entity.DeviceProtocolFlag, |
||||
|
SimpleCode = LanguageConverter.GetPYSimpleCode(entity.DisplayName), |
||||
|
AeTitle = entity.AeTitle, |
||||
|
DeviceTypeId = entity.DeviceTypeId, |
||||
|
DisplayOrder = await EntityHelper.CreateMaxDisplayOrder(_deviceRepository) |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 更新
|
||||
|
/// </summary>
|
||||
|
/// <param name="sourceEntity"></param>
|
||||
|
/// <param name="targetEntity"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public async Task UpdateAsync( |
||||
|
Device sourceEntity, |
||||
|
Device targetEntity |
||||
|
) |
||||
|
{ |
||||
|
DataHelper.CheckEntityIsNull(sourceEntity); |
||||
|
Verify(targetEntity); |
||||
|
if (sourceEntity.DisplayName != targetEntity.DisplayName) |
||||
|
{ |
||||
|
|
||||
|
await EntityHelper.CheckSameName(_deviceRepository, sourceEntity.DisplayName, targetEntity); |
||||
|
targetEntity.DisplayName = sourceEntity.DisplayName; |
||||
|
targetEntity.SimpleCode = LanguageConverter.GetPYSimpleCode(sourceEntity.DisplayName); |
||||
|
} |
||||
|
|
||||
|
targetEntity.DeviceTypeId = sourceEntity.DeviceTypeId; |
||||
|
targetEntity.DeviceProtocolFlag = sourceEntity.DeviceProtocolFlag; |
||||
|
targetEntity.AeTitle = sourceEntity.AeTitle; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 删除
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
/// <exception cref="UserFriendlyException"></exception>
|
||||
|
public async Task CheckAndDeleteAsync(Guid id) |
||||
|
{ |
||||
|
|
||||
|
var deviceCount = await _registerCheckPictureRepository.CountAsync(f => f.DeviceId == id); |
||||
|
if (deviceCount > 0) |
||||
|
{ |
||||
|
throw new UserFriendlyException("设备已被使用,不能删除"); |
||||
|
} |
||||
|
|
||||
|
await _deviceRepository.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.UpdateManySortCommonAsync(_deviceRepository, id, SortType); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改排序 拖拽
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TEntity"></typeparam>
|
||||
|
/// <param name="repository"></param>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public async Task UpdateSortManyAsync(UpdateSortManyCommonDto input) |
||||
|
{ |
||||
|
await EntityHelper.UpdateSortManyCommonAsync(_deviceRepository, input); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 检查空值
|
||||
|
/// </summary>
|
||||
|
/// <param name="entity"></param>
|
||||
|
private void Verify(Device entity) |
||||
|
{ |
||||
|
|
||||
|
DataHelper.CheckEntityIsNull(entity); |
||||
|
DataHelper.CheckStringIsNull(entity.DisplayName, "名称"); |
||||
|
DataHelper.CheckGuidIsDefaultValue(entity.DeviceTypeId, "仪器类别"); |
||||
|
if (entity.DeviceProtocolFlag != '0' && entity.DeviceProtocolFlag != '1') |
||||
|
{ |
||||
|
throw new ArgumentException($"设备协议只能为0,1"); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Shentun.Peis.Models; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Shentun.Peis.Devices; |
||||
|
using Shentun.Peis.EntityFrameworkCore; |
||||
|
|
||||
|
namespace Shentun.Peis.DbMapping |
||||
|
{ |
||||
|
internal class DeviceDbMapping : IEntityTypeConfiguration<Device> |
||||
|
{ |
||||
|
public void Configure(EntityTypeBuilder<Device> entity) |
||||
|
{ |
||||
|
entity.HasComment("设备表"); |
||||
|
entity.Property(t => t.DisplayName).HasComment("设备名称"); |
||||
|
entity.Property(t => t.DeviceTypeId).HasComment("仪器类别ID"); |
||||
|
entity.Property(t => t.DeviceProtocolFlag).HasComment("设备协议"); |
||||
|
entity.Property(t => t.AeTitle).HasComment("DICOM设备AETitle"); |
||||
|
|
||||
|
|
||||
|
entity.ConfigureByConvention(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
15711
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240920090638_insert_device.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,53 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
#nullable disable |
||||
|
|
||||
|
namespace Shentun.Peis.Migrations |
||||
|
{ |
||||
|
public partial class insert_device : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.AddColumn<Guid>( |
||||
|
name: "device_id", |
||||
|
table: "register_check_picture", |
||||
|
type: "uuid", |
||||
|
nullable: true, |
||||
|
comment: "设备ID"); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "Devices", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
id = table.Column<Guid>(type: "uuid", nullable: false), |
||||
|
Display_Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true, comment: "设备名称"), |
||||
|
device_type_id = table.Column<Guid>(type: "uuid", nullable: false, comment: "仪器类别ID"), |
||||
|
device_protocol_flag = table.Column<char>(type: "character(1)", nullable: false, comment: "设备协议"), |
||||
|
ae_title = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true, comment: "DICOM设备AETitle"), |
||||
|
simple_code = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true), |
||||
|
display_order = table.Column<int>(type: "integer", nullable: false), |
||||
|
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_Devices", x => x.id); |
||||
|
}, |
||||
|
comment: "设备表"); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropTable( |
||||
|
name: "Devices"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "device_id", |
||||
|
table: "register_check_picture"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue