|
|
|
@ -31,6 +31,8 @@ using Volo.Abp.Application.Services; |
|
|
|
using Volo.Abp.Domain.Repositories; |
|
|
|
using Volo.Abp.Identity; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
using Shentun.Peis.PrintReports; |
|
|
|
using System.Threading; |
|
|
|
|
|
|
|
namespace Shentun.Peis.TransToWebPeis |
|
|
|
{ |
|
|
|
@ -55,6 +57,7 @@ namespace Shentun.Peis.TransToWebPeis |
|
|
|
private readonly IRepository<RegisterCheck, Guid> _registerCheckRepository; |
|
|
|
private readonly IRepository<PatientRegisterExter> _patientRegisterExterRepository; |
|
|
|
private readonly UnitOfWorkManager _unitOfWorkManager; |
|
|
|
private readonly PrintReportAppService _printReportAppService; |
|
|
|
|
|
|
|
|
|
|
|
private readonly SqlSugarClient Db = new SqlSugarClient(new ConnectionConfig() |
|
|
|
@ -80,7 +83,8 @@ namespace Shentun.Peis.TransToWebPeis |
|
|
|
IRepository<PatientRegister, Guid> patientRegisterRepository, |
|
|
|
IRepository<RegisterCheck, Guid> registerCheckRepository, |
|
|
|
IRepository<PatientRegisterExter> patientRegisterExterRepository, |
|
|
|
UnitOfWorkManager unitOfWorkManager) |
|
|
|
UnitOfWorkManager unitOfWorkManager, |
|
|
|
PrintReportAppService printReportAppService) |
|
|
|
{ |
|
|
|
_itemTypeRepository = itemTypeRepository; |
|
|
|
_logger = logger; |
|
|
|
@ -98,8 +102,9 @@ namespace Shentun.Peis.TransToWebPeis |
|
|
|
_registerCheckRepository = registerCheckRepository; |
|
|
|
_patientRegisterExterRepository = patientRegisterExterRepository; |
|
|
|
_unitOfWorkManager = unitOfWorkManager; |
|
|
|
_printReportAppService = printReportAppService; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -115,11 +120,14 @@ namespace Shentun.Peis.TransToWebPeis |
|
|
|
throw new UserFriendlyException("人员不存在"); |
|
|
|
if (isPatientRegister.CompleteFlag != PatientRegisterCompleteFlag.SumCheck) |
|
|
|
throw new UserFriendlyException("人员未总检,无法上传"); |
|
|
|
|
|
|
|
//同步数据
|
|
|
|
await TransPatientRegisterByPatientRegisterIdAsync(new PatientRegisterIdInputDto { PatientRegisterId = input.PatientRegisterId }); |
|
|
|
|
|
|
|
//上传报告
|
|
|
|
var thirdInterfaces = await _thirdInterfaceRepository.GetListAsync(o => o.ThirdInterfaceType == |
|
|
|
ThirdInterfaceTypeFlag.TranToWebPeis); |
|
|
|
|
|
|
|
foreach (var thirdInterface in thirdInterfaces) |
|
|
|
{ |
|
|
|
var parmValue = thirdInterface.ParmValue; |
|
|
|
@ -138,6 +146,7 @@ namespace Shentun.Peis.TransToWebPeis |
|
|
|
var patientRegisterEnt = await _patientRegisterRepository.GetAsync(input.PatientRegisterId); |
|
|
|
patientRegisterEnt.IsUpload = 'Y'; |
|
|
|
await _patientRegisterRepository.UpdateAsync(patientRegisterEnt); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -199,6 +208,93 @@ namespace Shentun.Peis.TransToWebPeis |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 导入数据 任务计划用
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <exception cref="Exception"></exception>
|
|
|
|
[HttpPost("api/app/TransToWebPeis/SyncPatientRegisterReportByPatientRegisterId")] |
|
|
|
public async Task SyncPatientRegisterReportByPatientRegisterIdAsync(PatientRegisterIdInputDto input) |
|
|
|
{ |
|
|
|
|
|
|
|
var thirdInterface = await _thirdInterfaceRepository.FirstOrDefaultAsync(f => f.ThirdInterfaceType == ThirdInterfaceTypeFlag.TranToWebPeis); |
|
|
|
if (thirdInterface.IsActive != 'Y') |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("该接口已禁用"); |
|
|
|
} |
|
|
|
|
|
|
|
var parmValue = thirdInterface.ParmValue; |
|
|
|
var configurationBuilder = new ConfigurationBuilder() |
|
|
|
.AddJsonStream(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(parmValue))); |
|
|
|
var config = configurationBuilder.Build(); |
|
|
|
var reportApiBaseAddress = config.GetSection("Interface").GetSection("ReportApiBaseAddress").Value; |
|
|
|
var reportApiUrl = config.GetSection("Interface").GetSection("ReportApiUrl").Value; |
|
|
|
|
|
|
|
string reportBase64 = ""; |
|
|
|
#region 获取报告地址
|
|
|
|
|
|
|
|
var printReportData = await _printReportAppService.GetMedicalReportAsync(new PatientRegisterIdInputDto |
|
|
|
{ |
|
|
|
PatientRegisterId = input.PatientRegisterId |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
using (var httpClientHandler = new HttpClientHandler()) |
|
|
|
{ |
|
|
|
using (var httpClient = new HttpClient(httpClientHandler)) |
|
|
|
{ |
|
|
|
httpClient.BaseAddress = new Uri(reportApiBaseAddress); |
|
|
|
|
|
|
|
httpClient.DefaultRequestHeaders.Accept.Add( |
|
|
|
new MediaTypeWithQualityHeaderValue("application/json"));//设置accept标头,告诉JSON是可接受的响应类型
|
|
|
|
|
|
|
|
|
|
|
|
var sendData = JsonConvert.SerializeObject(printReportData); |
|
|
|
using (HttpContent httpContent = new StringContent(sendData)) |
|
|
|
{ |
|
|
|
httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); |
|
|
|
HttpResponseMessage response = null; |
|
|
|
|
|
|
|
response = await httpClient.PostAsync(reportApiUrl, httpContent); |
|
|
|
|
|
|
|
|
|
|
|
string result; |
|
|
|
if (!response.IsSuccessStatusCode) |
|
|
|
{ |
|
|
|
result = response.Content.ReadAsStringAsync().Result; |
|
|
|
throw new Exception("http通信错误:" + response.StatusCode + ",结果:" + result); |
|
|
|
} |
|
|
|
result = await response.Content.ReadAsStringAsync(); |
|
|
|
|
|
|
|
var resultDto = JsonConvert.DeserializeObject<WebApiClientOutDto>(result); |
|
|
|
if (resultDto != null) |
|
|
|
{ |
|
|
|
if (resultDto.code != 1) |
|
|
|
{ |
|
|
|
throw new Exception($"调用WebApi失败,返回-1,消息:" + result); |
|
|
|
} |
|
|
|
|
|
|
|
reportBase64 = resultDto.data; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Thread.Sleep(1000); |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(reportBase64)) |
|
|
|
{ |
|
|
|
await UploadPeisReportAsync(new UploadPeisReportIuputDto |
|
|
|
{ |
|
|
|
PatientRegisterId = input.PatientRegisterId, |
|
|
|
ReportBase64 = reportBase64 |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#region MyRegion
|
|
|
|
|
|
|
|
@ -209,7 +305,7 @@ namespace Shentun.Peis.TransToWebPeis |
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpPost("api/app/TransToWebPeis/TransBaseData")] |
|
|
|
private async Task TransBaseDataAsync() |
|
|
|
public async Task TransBaseDataAsync() |
|
|
|
{ |
|
|
|
var thirdInterfaces = await _thirdInterfaceRepository.GetListAsync(o => o.ThirdInterfaceType == |
|
|
|
ThirdInterfaceTypeFlag.TranToWebPeis); |
|
|
|
@ -336,7 +432,7 @@ namespace Shentun.Peis.TransToWebPeis |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 基础数据
|
|
|
|
@ -886,7 +982,7 @@ namespace Shentun.Peis.TransToWebPeis |
|
|
|
new SugarParameter("customer_org_register_id",patientRegisterEnt.CustomerOrgRegisterId), |
|
|
|
new SugarParameter("concurrency_stamp",patientRegisterEnt.ConcurrencyStamp), |
|
|
|
// new SugarParameter("creation_time",patientRegisterEnt.CreationTime),
|
|
|
|
new SugarParameter("creation_time",DateTime.Now), |
|
|
|
new SugarParameter("creation_time",patientRegisterEnt.CreationTime), |
|
|
|
new SugarParameter("creator_id",patientRegisterEnt.CreatorId), |
|
|
|
new SugarParameter("last_modification_time",patientRegisterEnt.LastModificationTime), |
|
|
|
new SugarParameter("last_modifier_id",patientRegisterEnt.LastModifierId), |
|
|
|
@ -1356,7 +1452,7 @@ namespace Shentun.Peis.TransToWebPeis |
|
|
|
|
|
|
|
if (patientRegisterIds.Any()) |
|
|
|
await ExportPatientRegisterWithDetailReverseData(); |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
} |
|
|
|
|