diff --git a/src/Shentun.Peis.Application/TransToWebPeis/TransToWebPeisAppService.cs b/src/Shentun.Peis.Application/TransToWebPeis/TransToWebPeisAppService.cs index 9c3711d..5d2eee5 100644 --- a/src/Shentun.Peis.Application/TransToWebPeis/TransToWebPeisAppService.cs +++ b/src/Shentun.Peis.Application/TransToWebPeis/TransToWebPeisAppService.cs @@ -67,6 +67,14 @@ namespace Shentun.Peis.TransToWebPeis IsAutoCloseConnection = true }); + + private readonly SqlSugarClient WebDb0520 = new SqlSugarClient(new ConnectionConfig() + { + ConnectionString = "Host=10.1.12.138;Port=5432;Database=WebPeis0520;User ID=postgres;Password=st123;", + DbType = SqlSugar.DbType.PostgreSQL, + IsAutoCloseConnection = true + }); + public TransToWebPeisAppService( IRepository itemTypeRepository, ILogger logger, @@ -147,6 +155,7 @@ namespace Shentun.Peis.TransToWebPeis patientRegisterEnt.IsUpload = 'Y'; await _patientRegisterRepository.UpdateAsync(patientRegisterEnt); + } /// @@ -219,10 +228,10 @@ namespace Shentun.Peis.TransToWebPeis { var thirdInterface = await _thirdInterfaceRepository.FirstOrDefaultAsync(f => f.ThirdInterfaceType == ThirdInterfaceTypeFlag.TranToWebPeis); - if (thirdInterface.IsActive != 'Y') - { - throw new UserFriendlyException("该接口已禁用"); - } + //if (thirdInterface.IsActive != 'Y') + //{ + // throw new UserFriendlyException("该接口已禁用"); + //} var parmValue = thirdInterface.ParmValue; var configurationBuilder = new ConfigurationBuilder() @@ -1455,5 +1464,42 @@ namespace Shentun.Peis.TransToWebPeis } #endregion + #region 临时导报告 + + /// + /// 临时导入2024年报告 + /// + /// + public async Task TempExportReportAsync() + { + + var patientRegisterIds = (await _patientRegisterRepository.GetQueryableAsync()) + .Where(m => m.CompleteFlag == PatientRegisterCompleteFlag.SumCheck + && m.SummaryDate > Convert.ToDateTime("2024-01-01 00:00:00")) + .OrderBy(o => o.SummaryDate) + .Select(s => s.Id).ToList(); + + foreach (var item in patientRegisterIds) + { + using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true)) + { + var isUploadReport = WebDb0520.Ado.GetDataTable($"select patient_register_id from patient_register where patient_register_id='{item}' and report_file is null ").Rows.Count; + if (isUploadReport == 1) + { + await SyncPatientRegisterReportByPatientRegisterIdAsync(new PatientRegisterIdInputDto + { + PatientRegisterId = item + }); + } + + await uow.CompleteAsync(); + } + } + + + } + + #endregion + } }