|
|
|
@ -1,6 +1,8 @@ |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using log4net.Repository.Hierarchy; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using NPOI.POIFS.Storage; |
|
|
|
using NPOI.Util; |
|
|
|
using NUglify.Helpers; |
|
|
|
@ -14,10 +16,12 @@ using Shentun.Peis.RegisterChecks; |
|
|
|
using Shentun.Peis.RegisterCheckSuggestions; |
|
|
|
using Shentun.Peis.RegisterCheckSummarys; |
|
|
|
using Shentun.Peis.SumSummaryReports; |
|
|
|
using Shentun.Peis.ThirdBookingPushs; |
|
|
|
using Shentun.Peis.ThirdPartyPublicInterfaces; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Net.Http; |
|
|
|
using System.Text; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Volo.Abp; |
|
|
|
@ -25,6 +29,7 @@ using Volo.Abp.Application.Dtos; |
|
|
|
using Volo.Abp.Application.Services; |
|
|
|
using Volo.Abp.Domain.Repositories; |
|
|
|
using Volo.Abp.Users; |
|
|
|
using static Volo.Abp.Identity.Settings.IdentitySettingNames; |
|
|
|
|
|
|
|
namespace Shentun.Peis.PacsBusiness |
|
|
|
{ |
|
|
|
@ -52,6 +57,7 @@ namespace Shentun.Peis.PacsBusiness |
|
|
|
private readonly ICurrentUser _currentUser; |
|
|
|
private readonly IRepository<UserItemType> _userItemTypeRepository; |
|
|
|
private readonly IRepository<DicomFileDetail, Guid> _dicomFileDetailRepository; |
|
|
|
private readonly ILogger<PacsBusinessAppService> _logger; |
|
|
|
public PacsBusinessAppService( |
|
|
|
IConfiguration configuration, |
|
|
|
IRepository<RegisterCheck, Guid> registerCheckRepository, |
|
|
|
@ -69,7 +75,8 @@ namespace Shentun.Peis.PacsBusiness |
|
|
|
IRepository<Asbitem, Guid> asbitemRepository, |
|
|
|
ICurrentUser currentUser, |
|
|
|
IRepository<UserItemType> userItemTypeRepository, |
|
|
|
IRepository<DicomFileDetail, Guid> dicomFileDetailRepository) |
|
|
|
IRepository<DicomFileDetail, Guid> dicomFileDetailRepository, |
|
|
|
ILogger<PacsBusinessAppService> logger) |
|
|
|
{ |
|
|
|
_configuration = configuration; |
|
|
|
_registerCheckRepository = registerCheckRepository; |
|
|
|
@ -88,6 +95,7 @@ namespace Shentun.Peis.PacsBusiness |
|
|
|
_currentUser = currentUser; |
|
|
|
_userItemTypeRepository = userItemTypeRepository; |
|
|
|
_dicomFileDetailRepository = dicomFileDetailRepository; |
|
|
|
_logger = logger; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -434,16 +442,16 @@ namespace Shentun.Peis.PacsBusiness |
|
|
|
if (registerCheckEnt == null) |
|
|
|
throw new UserFriendlyException("条码号不正确"); |
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(input.InstanceId)) |
|
|
|
if (string.IsNullOrWhiteSpace(input.InstanceId)) |
|
|
|
throw new UserFriendlyException("InstanceId不正确"); |
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(input.ParentStudyId)) |
|
|
|
if (string.IsNullOrWhiteSpace(input.ParentStudyId)) |
|
|
|
throw new UserFriendlyException("ParentStudyId不正确"); |
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(input.ParentPatientId)) |
|
|
|
if (string.IsNullOrWhiteSpace(input.ParentPatientId)) |
|
|
|
throw new UserFriendlyException("ParentPatientId不正确"); |
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(input.ParentSeriesId)) |
|
|
|
if (string.IsNullOrWhiteSpace(input.ParentSeriesId)) |
|
|
|
throw new UserFriendlyException("ParentSeriesId不正确"); |
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(input.Status)) |
|
|
|
@ -526,6 +534,50 @@ namespace Shentun.Peis.PacsBusiness |
|
|
|
return entListDto; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 删除体检dicom服务数据,并清理dicom服务记录
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("api/app/PacsBusiness/DeletePacsCheckDicomDataByRegisterCheckId")] |
|
|
|
public async Task DeletePacsCheckDicomDataByRegisterCheckIdAsync(RegisterCheckIdInputDto input) |
|
|
|
{ |
|
|
|
var dicomFileDetailList = await _dicomFileDetailRepository.GetListAsync(m => m.RegisterCheckId == input.RegisterCheckId); |
|
|
|
if (dicomFileDetailList.Any()) |
|
|
|
{ |
|
|
|
string authString = _configuration.GetValue<string>("Pacs:AuthString"); |
|
|
|
string baseApiUrl = _configuration.GetValue<string>("Pacs:BaseApiUrl"); |
|
|
|
if (string.IsNullOrWhiteSpace(authString) || string.IsNullOrWhiteSpace(baseApiUrl)) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("请配置pacs相关信息"); |
|
|
|
} |
|
|
|
string parentPatientId = dicomFileDetailList.First().ParentPatientId; |
|
|
|
|
|
|
|
await CallPacsDicomServiceAsync($"{baseApiUrl}/patients/{parentPatientId}", authString, "delete"); |
|
|
|
|
|
|
|
await _dicomFileDetailRepository.DeleteManyAsync(dicomFileDetailList); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 调用dicom服务api
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="apiUrl"></param>
|
|
|
|
/// <param name="authString"></param>
|
|
|
|
/// <param name="mothod"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task CallPacsDicomServiceAsync(string apiUrl, string authString, string mothod) |
|
|
|
{ |
|
|
|
var enCodeAuthString = Convert.ToBase64String(Encoding.ASCII.GetBytes(authString)); |
|
|
|
using var httpClient = new HttpClient(); |
|
|
|
httpClient.DefaultRequestHeaders.Add("Authorization", $"Basic {enCodeAuthString}"); |
|
|
|
if (mothod == "delete") |
|
|
|
{ |
|
|
|
var response = await httpClient.DeleteAsync(apiUrl); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |