From fee4de85d9c86bc64f75885a39e3a9f2987a823d Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Mon, 10 Jun 2024 16:21:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TransToWebPeisAppService.cs | 183 +++++++++--------- 1 file changed, 92 insertions(+), 91 deletions(-) diff --git a/src/Shentun.Peis.Application/TransToWebPeis/TransToWebPeisAppService.cs b/src/Shentun.Peis.Application/TransToWebPeis/TransToWebPeisAppService.cs index 05d74f6..4301a1e 100644 --- a/src/Shentun.Peis.Application/TransToWebPeis/TransToWebPeisAppService.cs +++ b/src/Shentun.Peis.Application/TransToWebPeis/TransToWebPeisAppService.cs @@ -99,81 +99,11 @@ namespace Shentun.Peis.TransToWebPeis _patientRegisterExterRepository = patientRegisterExterRepository; _unitOfWorkManager = unitOfWorkManager; } - /// - /// 上传基础资料 - /// - /// - - [HttpPost("api/app/TransToWebPeis/TransBaseData")] - public async Task TransBaseDataAsync() - { - var thirdInterfaces = await _thirdInterfaceRepository.GetListAsync(o => o.ThirdInterfaceType == - ThirdInterfaceTypeFlag.TranToWebPeis); - foreach (var thirdInterface in thirdInterfaces) - { - var connectString = GetConnectionStrings(thirdInterface.ParmValue); - - SqlSugarClient WebDb = new SqlSugarClient(new ConnectionConfig() - { - ConnectionString = connectString, - DbType = SqlSugar.DbType.PostgreSQL, - IsAutoCloseConnection = true - }); - - - #region 清理基础数据 - //删除 - - await WebDb.Ado.ExecuteCommandAsync("delete from medical_package_detail;"); - await WebDb.Ado.ExecuteCommandAsync("delete from medical_package;"); - - await WebDb.Ado.ExecuteCommandAsync("delete from customer_org_group_detail;"); - await WebDb.Ado.ExecuteCommandAsync("delete from customer_org_group;"); - await WebDb.Ado.ExecuteCommandAsync("delete from customer_org_register;"); - await WebDb.Ado.ExecuteCommandAsync("delete from customer_org;"); - - await WebDb.Ado.ExecuteCommandAsync("delete from diagnosis;"); - await WebDb.Ado.ExecuteCommandAsync("delete from diagnosis_level;"); - - await WebDb.Ado.ExecuteCommandAsync("delete from asbitem_detail;"); - await WebDb.Ado.ExecuteCommandAsync("delete from asbitem;"); - - await WebDb.Ado.ExecuteCommandAsync("delete from item"); - - await WebDb.Ado.ExecuteCommandAsync("delete from item_type"); - #endregion - - - await TransItemType(WebDb); - await TransItem(WebDb); - await TransAsbitem(WebDb); - await TransMedicalPackage(WebDb); - await TransDiagnosis(WebDb); - - await TransCustomerOrgAsync(WebDb); - await TransCustomerOrgRegisterAsync(WebDb); - await TransCustomerOrgGroupAsync(WebDb); - await TransCustomerOrgGroupDetailAsync(WebDb); - } - - - - - //var connectString = "Host=10.1.12.140;Port=5432;Database=WebPeis;User ID=postgres;Password=st123;"; - - //SqlSugarClient WebDb = new SqlSugarClient(new ConnectionConfig() - //{ - // ConnectionString = connectString, - // DbType = SqlSugar.DbType.PostgreSQL, - // IsAutoCloseConnection = true - //}); - - - } + /// - /// 上传体检报告 + /// 上传体检报告 并同步业务数据 /// /// [HttpPost("api/app/TransToWebPeis/UploadPeisReport")] @@ -210,9 +140,8 @@ namespace Shentun.Peis.TransToWebPeis await _patientRegisterRepository.UpdateAsync(patientRegisterEnt); } - /// - /// 根据人员登记ID上传人员体检信息 1 + /// 根据人员登记ID上传人员体检信息 /// /// /// @@ -270,6 +199,82 @@ namespace Shentun.Peis.TransToWebPeis } } + + #region MyRegion + + + /// + /// 上传基础资料 + /// + /// + + [HttpPost("api/app/TransToWebPeis/TransBaseData")] + private async Task TransBaseDataAsync() + { + var thirdInterfaces = await _thirdInterfaceRepository.GetListAsync(o => o.ThirdInterfaceType == + ThirdInterfaceTypeFlag.TranToWebPeis); + foreach (var thirdInterface in thirdInterfaces) + { + var connectString = GetConnectionStrings(thirdInterface.ParmValue); + + SqlSugarClient WebDb = new SqlSugarClient(new ConnectionConfig() + { + ConnectionString = connectString, + DbType = SqlSugar.DbType.PostgreSQL, + IsAutoCloseConnection = true + }); + + + #region 清理基础数据 + //删除 + + await WebDb.Ado.ExecuteCommandAsync("delete from medical_package_detail;"); + await WebDb.Ado.ExecuteCommandAsync("delete from medical_package;"); + + await WebDb.Ado.ExecuteCommandAsync("delete from customer_org_group_detail;"); + await WebDb.Ado.ExecuteCommandAsync("delete from customer_org_group;"); + await WebDb.Ado.ExecuteCommandAsync("delete from customer_org_register;"); + await WebDb.Ado.ExecuteCommandAsync("delete from customer_org;"); + + await WebDb.Ado.ExecuteCommandAsync("delete from diagnosis;"); + await WebDb.Ado.ExecuteCommandAsync("delete from diagnosis_level;"); + + await WebDb.Ado.ExecuteCommandAsync("delete from asbitem_detail;"); + await WebDb.Ado.ExecuteCommandAsync("delete from asbitem;"); + + await WebDb.Ado.ExecuteCommandAsync("delete from item"); + + await WebDb.Ado.ExecuteCommandAsync("delete from item_type"); + #endregion + + + await TransItemType(WebDb); + await TransItem(WebDb); + await TransAsbitem(WebDb); + await TransMedicalPackage(WebDb); + await TransDiagnosis(WebDb); + + await TransCustomerOrgAsync(WebDb); + await TransCustomerOrgRegisterAsync(WebDb); + await TransCustomerOrgGroupAsync(WebDb); + await TransCustomerOrgGroupDetailAsync(WebDb); + } + + + + + //var connectString = "Host=10.1.12.140;Port=5432;Database=WebPeis;User ID=postgres;Password=st123;"; + + //SqlSugarClient WebDb = new SqlSugarClient(new ConnectionConfig() + //{ + // ConnectionString = connectString, + // DbType = SqlSugar.DbType.PostgreSQL, + // IsAutoCloseConnection = true + //}); + + + } + /// /// 获取数据库连接地址 /// @@ -287,16 +292,7 @@ namespace Shentun.Peis.TransToWebPeis return interfaceConnctionStr; } - private string GetUrl(string parmValue) - { - var configurationBuilder = new ConfigurationBuilder() - .AddJsonStream(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(parmValue))); - var interfaceConfig = configurationBuilder.Build(); - var url = interfaceConfig.GetSection("Interface").GetSection("Url").Value; - - return url; - } - public async Task CallAppServiceAsync(string appBaseAddress, string url, TInput data) + private async Task CallAppServiceAsync(string appBaseAddress, string url, TInput data) { string baseAddress = appBaseAddress; @@ -340,9 +336,8 @@ namespace Shentun.Peis.TransToWebPeis } } - } - - + } + #endregion #region 基础数据 @@ -774,7 +769,7 @@ namespace Shentun.Peis.TransToWebPeis #region 人员导入 /// - /// 人员导入 22 + /// 人员导入 /// /// /// @@ -1255,6 +1250,7 @@ namespace Shentun.Peis.TransToWebPeis #endregion + #region 临时导数据 int sumCount = 0; int handCount = 0; @@ -1262,6 +1258,7 @@ namespace Shentun.Peis.TransToWebPeis /// 导入体检数据到web 全部导入 2024-06-06 /// /// + [RemoteService(false)] public async Task ExportPatientRegisterWithDetailData() { var connectString = @"Host=10.1.12.138;Port=5432;Database=WebPeis0520;User ID=postgres;Password=st123;"; @@ -1303,7 +1300,8 @@ namespace Shentun.Peis.TransToWebPeis _logger.LogInformation($"当前查询数据:{sumCount},新增数据:{handCount}"); - await ExportPatientRegisterWithDetailData(); + if (patientRegisterIds.Any()) + await ExportPatientRegisterWithDetailData(); } @@ -1313,6 +1311,7 @@ namespace Shentun.Peis.TransToWebPeis /// 反向导入 导入体检数据到web 全部导入 2024-06-07 /// /// + [RemoteService(false)] public async Task ExportPatientRegisterWithDetailReverseData() { //var connectString = @"Host=10.1.12.138;Port=5432;Database=WebPeis0520;User ID=postgres;Password=st123;"; @@ -1354,8 +1353,10 @@ namespace Shentun.Peis.TransToWebPeis _logger.LogInformation($"当前降序查询数据:{sumCount},新增数据:{handCount}"); - await ExportPatientRegisterWithDetailReverseData(); - } + if (patientRegisterIds.Any()) + await ExportPatientRegisterWithDetailReverseData(); + } + #endregion } }