Browse Source

pacs+人寿推送

master
wxd 1 year ago
parent
commit
9c575b2ffa
  1. 64
      src/Shentun.Peis.Application/PacsBusiness/PacsBusinessAppService.cs
  2. 21
      src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs
  3. 39
      src/Shentun.Peis.Application/ThirdBookingPushs/ThirdBookingPushAppService.cs
  4. 11
      src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs

64
src/Shentun.Peis.Application/PacsBusiness/PacsBusinessAppService.cs

@ -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);
}
}
}
}

21
src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs

@ -988,7 +988,14 @@ namespace Shentun.Peis.PatientRegisters
if (!string.IsNullOrWhiteSpace(input.ThirdBookingId))
{
await _thirdBookingPushAppService.PushRegisterAsync(new PatientRegisterIdInputDto { PatientRegisterId = entity.Id });
try
{
await _thirdBookingPushAppService.PushRegisterAsync(new PatientRegisterIdInputDto { PatientRegisterId = entity.Id });
}
catch (Exception ex)
{
_logger.LogError($"推送人寿完成登记=》{ex.Message}");
}
}
#endregion
@ -2208,8 +2215,18 @@ namespace Shentun.Peis.PatientRegisters
if (!string.IsNullOrWhiteSpace(entity.ThirdBookingId)
&& input.IsAudit == 'Y')
{
await _thirdBookingPushAppService.PushCompletePhysicalAsync(new PatientRegisterIdInputDto { PatientRegisterId = entity.Id });
try
{
await _thirdBookingPushAppService.PushCompletePhysicalAsync(new PatientRegisterIdInputDto { PatientRegisterId = entity.Id });
}
catch (Exception ex)
{
_logger.LogError($"推送人寿完成体检=》{ex.Message}");
}
}
#endregion
return ObjectMapper.Map<PatientRegister, PatientRegisterDto>(newentity);
}

39
src/Shentun.Peis.Application/ThirdBookingPushs/ThirdBookingPushAppService.cs

@ -18,9 +18,11 @@ using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Mime;
using System.Security.Policy;
using System.ServiceModel.Channels;
using System.Text;
using System.Threading.Channels;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
@ -128,11 +130,20 @@ namespace Shentun.Peis.ThirdBookingPushs
thirdBookingEnt.MedicalStatus = '1';
await _thirdBookingRepository.UpdateAsync(thirdBookingEnt);
}
else
{
throw new UserFriendlyException($"推送失败:Id为{input.PatientRegisterId},状态为:{decryptDataPara.STATUS},{decryptDataPara.MESSAGE}");
}
}
else
{
throw new UserFriendlyException($"推送失败:Id为{input.PatientRegisterId},{resultPara.MESSAGE}");
}
}
}
}
}
}
}
@ -223,6 +234,14 @@ namespace Shentun.Peis.ThirdBookingPushs
thirdBookingEnt.MedicalStatus = '2';
await _thirdBookingRepository.UpdateAsync(thirdBookingEnt);
}
else
{
throw new UserFriendlyException($"推送失败:Id为{input.PatientRegisterId},状态为:{decryptDataPara.STATUS},{decryptDataPara.MESSAGE}");
}
}
else
{
throw new UserFriendlyException($"推送失败:Id为{input.PatientRegisterId},{resultPara.MESSAGE}");
}
}
}
@ -335,6 +354,14 @@ namespace Shentun.Peis.ThirdBookingPushs
thirdBookingEnt.MedicalStatus = '3';
await _thirdBookingRepository.UpdateAsync(thirdBookingEnt);
}
else
{
throw new UserFriendlyException($"推送失败:Id为{input.PatientRegisterId},{decryptDataPara.MESSAGE}");
}
}
else
{
throw new UserFriendlyException($"推送失败:Id为{input.PatientRegisterId},{fileResultEncry.MESSAGE}");
}
#endregion
@ -343,14 +370,14 @@ namespace Shentun.Peis.ThirdBookingPushs
}
else
{
throw new UserFriendlyException($"推送失败:Id为{input.PatientRegisterId},{fileResultEncry.MESSAGE}");
}
#endregion
}
}
}
@ -407,7 +434,7 @@ namespace Shentun.Peis.ThirdBookingPushs
if (!response.IsSuccessStatusCode)
{
result = response.Content.ReadAsStringAsync().Result;
//throw new Exception("http通信错误:" + response.StatusCode + ",结果:" + result);
throw new Exception("http通信错误:" + response.StatusCode + ",结果:" + result);
}
result = await response.Content.ReadAsStringAsync();
@ -463,7 +490,7 @@ namespace Shentun.Peis.ThirdBookingPushs
if (!response.IsSuccessStatusCode)
{
result = response.Content.ReadAsStringAsync().Result;
//throw new Exception("http通信错误:" + response.StatusCode + ",结果:" + result);
throw new Exception("http通信错误:" + response.StatusCode + ",结果:" + result);
}
result = await response.Content.ReadAsStringAsync();

11
src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs

@ -571,7 +571,7 @@ public class PeisHttpApiHostModule : AbpModule
RequestPath = "/UserSign"
});
//虚拟目录
app.UseStaticFiles(new StaticFileOptions
{
@ -632,8 +632,13 @@ public class PeisHttpApiHostModule : AbpModule
app.UseAbpSerilogEnrichers();
app.UseConfiguredEndpoints();
//任务计划
await StartScheduler(context);
var IsEnabledHangfire = configuration["Hangfire:IsEnabled"];
if (!string.IsNullOrWhiteSpace(IsEnabledHangfire) && Convert.ToBoolean(IsEnabledHangfire) == true)
{
//任务计划
await StartScheduler(context);
}
}

Loading…
Cancel
Save