diff --git a/src/Shentun.Peis.Application.Contracts/PacsBusiness/ImportPacsDicomServiceDataInputDto.cs b/src/Shentun.Peis.Application.Contracts/PacsBusiness/ImportPacsDicomServiceDataInputDto.cs new file mode 100644 index 0000000..9c77a2c --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/PacsBusiness/ImportPacsDicomServiceDataInputDto.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace Shentun.Peis.PacsBusiness +{ + public class ImportPacsDicomServiceDataInputDto + { + /// + /// 条码号 + /// + public string CheckRequestNo { get; set; } + + /// + /// 实例ID + /// + public Guid InstanceId { get; set; } + + /// + /// 患者ID + /// + public Guid ParentPatientId { get; set; } + + /// + /// 系列ID + /// + public Guid ParentSeriesId { get; set; } + + /// + /// 研究ID + /// + public Guid ParentStudyId { get; set; } + + /// + /// 路径 + /// + public string Path { get; set; } + + /// + /// 文件名称 + /// + public string FileName { get; set; } + + /// + /// 状态 + /// + public string Status { get; set; } + } +} diff --git a/src/Shentun.Peis.Application/PacsBusiness/PacsBusinessAppService.cs b/src/Shentun.Peis.Application/PacsBusiness/PacsBusinessAppService.cs index 524e6ba..508d924 100644 --- a/src/Shentun.Peis.Application/PacsBusiness/PacsBusinessAppService.cs +++ b/src/Shentun.Peis.Application/PacsBusiness/PacsBusinessAppService.cs @@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using NPOI.POIFS.Storage; using NPOI.Util; +using NUglify.Helpers; using Shentun.Peis.Enums; using Shentun.Peis.Models; using Shentun.Peis.PatientRegisters; @@ -49,7 +50,7 @@ namespace Shentun.Peis.PacsBusiness private readonly IRepository _asbitemRepository; private readonly ICurrentUser _currentUser; private readonly IRepository _userItemTypeRepository; - + private readonly IRepository _dicomFileDetailRepository; public PacsBusinessAppService( IConfiguration configuration, IRepository registerCheckRepository, @@ -66,7 +67,8 @@ namespace Shentun.Peis.PacsBusiness IRepository registerCheckAsbitemRepository, IRepository asbitemRepository, ICurrentUser currentUser, - IRepository userItemTypeRepository) + IRepository userItemTypeRepository, + IRepository dicomFileDetailRepository) { _configuration = configuration; _registerCheckRepository = registerCheckRepository; @@ -84,6 +86,7 @@ namespace Shentun.Peis.PacsBusiness _asbitemRepository = asbitemRepository; _currentUser = currentUser; _userItemTypeRepository = userItemTypeRepository; + _dicomFileDetailRepository = dicomFileDetailRepository; } @@ -414,5 +417,59 @@ namespace Shentun.Peis.PacsBusiness return new PagedResultDto(totalCount, entListDto); } + + /// + /// 导入pacs dicom服务返回的数据 用作前端导出文件 + /// + /// + [HttpPost("api/app/PacsBusiness/ImportPacsDicomServiceData")] + public async Task ImportPacsDicomServiceDataAsync(ImportPacsDicomServiceDataInputDto input) + { + + if (string.IsNullOrWhiteSpace(input.CheckRequestNo)) + throw new UserFriendlyException("条码号不能为空"); + var registerCheckEnt = await _registerCheckRepository.FirstOrDefaultAsync(f => f.CheckRequestNo == input.CheckRequestNo); + if (registerCheckEnt == null) + throw new UserFriendlyException("条码号不正确"); + + if (input.InstanceId == Guid.Empty) + throw new UserFriendlyException("InstanceId不正确"); + + if (input.ParentStudyId == Guid.Empty) + throw new UserFriendlyException("ParentStudyId不正确"); + + if (input.ParentPatientId == Guid.Empty) + throw new UserFriendlyException("ParentPatientId不正确"); + + if (input.ParentSeriesId == Guid.Empty) + throw new UserFriendlyException("ParentSeriesId不正确"); + + if (string.IsNullOrWhiteSpace(input.Status)) + throw new UserFriendlyException("状态不能为空"); + + if (string.IsNullOrWhiteSpace(input.Path)) + throw new UserFriendlyException("路径不能为空"); + + if (string.IsNullOrWhiteSpace(input.FileName)) + throw new UserFriendlyException("文件名称不能为空"); + + var dicomFileDetailEnt = new DicomFileDetail + { + DisplayOrder = 1, + RegisterCheckId = registerCheckEnt.Id, + FileName = input.FileName, + InstanceId = input.InstanceId, + ParentPatientId = input.ParentPatientId, + ParentSeriesId = input.ParentSeriesId, + ParentStudyId = input.ParentStudyId, + Path = input.Path, + Status = input.Status + }; + + + await _dicomFileDetailRepository.InsertAsync(dicomFileDetailEnt); + } + + } } diff --git a/src/Shentun.Peis.Domain/DicomFileDetails/DicomFileDetail.cs b/src/Shentun.Peis.Domain/DicomFileDetails/DicomFileDetail.cs new file mode 100644 index 0000000..506136b --- /dev/null +++ b/src/Shentun.Peis.Domain/DicomFileDetails/DicomFileDetail.cs @@ -0,0 +1,78 @@ +using Shentun.Peis.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.Domain.Entities; + +namespace Shentun.Peis.Models +{ + + /// + /// dicom文件数据 从dicom服务导文件需要 + /// + [Table("dicom_file_detail")] + public class DicomFileDetail : AuditedEntity, IHasConcurrencyStamp,IDisplayOrder + { + /// + /// registerCheck表ID + /// + public Guid RegisterCheckId { get; set; } + + /// + /// 实例ID + /// + [Column("instance_id")] + public Guid InstanceId { get; set; } + + /// + /// 患者ID + /// + [Column("parent_patient_id")] + public Guid ParentPatientId { get; set; } + + /// + /// 系列ID + /// + [Column("parent_series_id")] + public Guid ParentSeriesId { get; set; } + + /// + /// 研究ID + /// + [Column("parent_study_id")] + public Guid ParentStudyId { get; set; } + + /// + /// 路径 + /// + [Column("path")] + [StringLength(200)] + public string Path { get; set; } + + /// + /// 文件名称 + /// + [Column("file_name")] + [StringLength(100)] + public string FileName { get; set; } + + /// + /// 状态 + /// + [Column("status")] + [StringLength(200)] + public string Status { get; set; } + + [Column("display_order")] + public int DisplayOrder { get; set; } + + [Column("concurrency_stamp")] + public string ConcurrencyStamp { get; set; } + + } +} diff --git a/src/Shentun.Peis.EntityFrameworkCore/DbMapping/DicomFileDetails/DicomFileDetailDbMapping.cs b/src/Shentun.Peis.EntityFrameworkCore/DbMapping/DicomFileDetails/DicomFileDetailDbMapping.cs new file mode 100644 index 0000000..f957a6f --- /dev/null +++ b/src/Shentun.Peis.EntityFrameworkCore/DbMapping/DicomFileDetails/DicomFileDetailDbMapping.cs @@ -0,0 +1,30 @@ +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.EntityFrameworkCore; + +namespace Shentun.Peis.DbMapping.DicomFileDetails +{ + + internal class DicomFileDetailDbMapping : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder entity) + { + entity.HasComment("dicom文件数据"); + entity.Property(t => t.RegisterCheckId).HasComment("RegisterCheck表ID").IsRequired(); + entity.Property(t => t.ParentPatientId).HasComment("患者ID").IsRequired(); + entity.Property(t => t.InstanceId).HasComment("实例ID").IsRequired(); + entity.Property(t => t.ParentSeriesId).HasComment("系列ID").IsRequired(); + entity.Property(t => t.ParentStudyId).HasComment("研究ID").IsRequired(); + entity.Property(t => t.Path).HasComment("路径"); + entity.Property(t => t.Status).HasComment("状态"); + entity.Property(t => t.FileName).HasComment("文件名称"); + entity.ConfigureByConvention(); + } + } +} diff --git a/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs b/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs index e4d5b77..f4f1497 100644 --- a/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs +++ b/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs @@ -9,6 +9,7 @@ using Shentun.Peis.Books; using Shentun.Peis.DbMapping; using Shentun.Peis.DbMapping.ChargeRequestAsbitems; using Shentun.Peis.DbMapping.ChargeRequests; +using Shentun.Peis.DbMapping.DicomFileDetails; using Shentun.Peis.DbMapping.PatientRegisterExters; using Shentun.Peis.DbMapping.ThirdInterfaces; using Shentun.Peis.Devices; @@ -376,6 +377,8 @@ public class PeisDbContext : public DbSet ThirdMedicalCenterBookingDates { get; set; } = null!; + public DbSet DicomFileDetails { get; set; } = null!; + public PeisDbContext(DbContextOptions options) : base(options) { @@ -625,7 +628,8 @@ public class PeisDbContext : .ApplyConfiguration(new DeviceDbMapping()) .ApplyConfiguration(new ThirdBookingDbMapping()) .ApplyConfiguration(new ThirdMedicalCenterBookingDateDbMapping()) - .ApplyConfiguration(new ThirdMedicalCenterDbMapping()); + .ApplyConfiguration(new ThirdMedicalCenterDbMapping()) + .ApplyConfiguration(new DicomFileDetailDbMapping()); #endregion