diff --git a/openhis-server-new/com/openhis/tool/DatabaseFieldAdder.java b/openhis-server-new/com/openhis/tool/DatabaseFieldAdder.java index 25c5b8aa7..069b459ed 100755 --- a/openhis-server-new/com/openhis/tool/DatabaseFieldAdder.java +++ b/openhis-server-new/com/openhis/tool/DatabaseFieldAdder.java @@ -9,9 +9,14 @@ import java.sql.Statement; */ public class DatabaseFieldAdder { public static void main(String[] args) { - String url = "jdbc:postgresql://192.168.110.252:15432/postgresql?currentSchema=public"; - String username = "postgresql"; - String password = "Jchl1528"; + String url = System.getenv("DB_URL"); + String username = System.getenv("DB_USERNAME"); + String password = System.getenv("DB_PASSWORD"); + + if (url == null || username == null || password == null) { + System.err.println("Please set DB_URL, DB_USERNAME, DB_PASSWORD environment variables"); + return; + } try (Connection conn = DriverManager.getConnection(url, username, password); Statement stmt = conn.createStatement()) { diff --git a/openhis-server-new/core-admin/src/main/java/com/core/web/controller/system/SysConfigController.java b/openhis-server-new/core-admin/src/main/java/com/core/web/controller/system/SysConfigController.java index 33317039f..c3c89548f 100755 --- a/openhis-server-new/core-admin/src/main/java/com/core/web/controller/system/SysConfigController.java +++ b/openhis-server-new/core-admin/src/main/java/com/core/web/controller/system/SysConfigController.java @@ -1,5 +1,8 @@ package com.core.web.controller.system; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.core.common.annotation.Log; import com.core.common.core.controller.BaseController; import com.core.common.core.domain.AjaxResult; @@ -24,6 +27,7 @@ import java.util.List; @RestController @RequestMapping("/system/config") public class SysConfigController extends BaseController { + private static final Logger log = LoggerFactory.getLogger(SysConfigController.class); @Autowired private ISysConfigService configService; @@ -72,13 +76,13 @@ public class SysConfigController extends BaseController { result.put("code", 200); result.put("msg", "操作成功"); result.put("data", configValue); // 明确设置 data 字段,即使值为空字符串 - System.out.println("=== getConfigKey 调试信息 ==="); - System.out.println("configKey: " + configKey); - System.out.println("configValue: [" + configValue + "]"); - System.out.println("result.data: " + result.get("data")); - System.out.println("result.msg: " + result.get("msg")); - System.out.println("result.code: " + result.get("code")); - System.out.println("============================"); + log.info("=== getConfigKey 调试信息 ==="); + log.info("configKey: " + configKey); + log.info("configValue: [" + configValue + "]"); + log.info("result.data: " + result.get("data")); + log.info("result.msg: " + result.get("msg")); + log.info("result.code: " + result.get("code")); + log.info("============================"); return result; } diff --git a/openhis-server-new/core-common/pom.xml b/openhis-server-new/core-common/pom.xml index 86db04eaf..cc4bbf2c2 100755 --- a/openhis-server-new/core-common/pom.xml +++ b/openhis-server-new/core-common/pom.xml @@ -197,6 +197,12 @@ gson + + + org.springframework.boot + spring-boot-starter-test + test + diff --git a/openhis-server-new/core-common/src/main/java/com/core/common/utils/NewExcelUtil.java b/openhis-server-new/core-common/src/main/java/com/core/common/utils/NewExcelUtil.java index c4a2e231b..292752aa9 100755 --- a/openhis-server-new/core-common/src/main/java/com/core/common/utils/NewExcelUtil.java +++ b/openhis-server-new/core-common/src/main/java/com/core/common/utils/NewExcelUtil.java @@ -1040,7 +1040,8 @@ public class NewExcelUtil { try { temp = Double.valueOf(text); } catch (NumberFormatException e) { - } + log.debug("Caught expected exception: {}", e.getMessage()); + } statistics.put(index, statistics.get(index) + temp); } } diff --git a/openhis-server-new/core-common/src/main/java/com/core/common/utils/html/EscapeUtil.java b/openhis-server-new/core-common/src/main/java/com/core/common/utils/html/EscapeUtil.java index 9eec36bf0..19133c93c 100755 --- a/openhis-server-new/core-common/src/main/java/com/core/common/utils/html/EscapeUtil.java +++ b/openhis-server-new/core-common/src/main/java/com/core/common/utils/html/EscapeUtil.java @@ -1,5 +1,8 @@ package com.core.common.utils.html; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.core.common.utils.StringUtils; /** @@ -8,6 +11,7 @@ import com.core.common.utils.StringUtils; * @author system */ public class EscapeUtil { + private static final Logger log = LoggerFactory.getLogger(EscapeUtil.class); public static final String RE_HTML_MARK = "(<[^<]*?>)|(<[\\s]*?/[^<]*?>)|(<[^<]*?/[\\s]*?>)"; private static final char[][] TEXT = new char[64][]; @@ -133,8 +137,8 @@ public class EscapeUtil { // String html = "ipt>alert(\"XSS\")ipt>"; // String html = "<123"; // String html = "123>"; - System.out.println("clean: " + EscapeUtil.clean(html)); - System.out.println("escape: " + escape); - System.out.println("unescape: " + EscapeUtil.unescape(escape)); + log.info("clean: " + EscapeUtil.clean(html)); + log.info("escape: " + escape); + log.info("unescape: " + EscapeUtil.unescape(escape)); } } diff --git a/openhis-server-new/core-common/src/main/java/com/core/common/utils/ip/IpUtils.java b/openhis-server-new/core-common/src/main/java/com/core/common/utils/ip/IpUtils.java index 6906a4687..381ae437c 100755 --- a/openhis-server-new/core-common/src/main/java/com/core/common/utils/ip/IpUtils.java +++ b/openhis-server-new/core-common/src/main/java/com/core/common/utils/ip/IpUtils.java @@ -1,5 +1,8 @@ package com.core.common.utils.ip; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.core.common.utils.ServletUtils; import com.core.common.utils.StringUtils; @@ -13,6 +16,7 @@ import java.net.UnknownHostException; * @author system */ public class IpUtils { + private static final Logger log = LoggerFactory.getLogger(IpUtils.class); public final static String REGX_0_255 = "(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]\\d|\\d)"; // 匹配 ip public final static String REGX_IP = "((" + REGX_0_255 + "\\.){3}" + REGX_0_255 + ")"; @@ -193,7 +197,8 @@ public class IpUtils { try { return InetAddress.getLocalHost().getHostAddress(); } catch (UnknownHostException e) { - } + log.debug("Caught expected exception: {}", e.getMessage()); + } return "127.0.0.1"; } @@ -206,7 +211,8 @@ public class IpUtils { try { return InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { - } + log.debug("Caught expected exception: {}", e.getMessage()); + } return "未知"; } diff --git a/openhis-server-new/core-common/src/main/java/com/core/common/utils/poi/ExcelUtil.java b/openhis-server-new/core-common/src/main/java/com/core/common/utils/poi/ExcelUtil.java index 7c141fb41..a819443cc 100755 --- a/openhis-server-new/core-common/src/main/java/com/core/common/utils/poi/ExcelUtil.java +++ b/openhis-server-new/core-common/src/main/java/com/core/common/utils/poi/ExcelUtil.java @@ -1165,7 +1165,8 @@ public class ExcelUtil { try { temp = Double.valueOf(text); } catch (NumberFormatException e) { - } + log.debug("Caught expected exception: {}", e.getMessage()); + } statistics.put(index, statistics.get(index) + temp); } } diff --git a/openhis-server-new/core-common/src/test/java/com/core/common/core/text/ConvertTest.java b/openhis-server-new/core-common/src/test/java/com/core/common/core/text/ConvertTest.java new file mode 100644 index 000000000..5dd6d96c7 --- /dev/null +++ b/openhis-server-new/core-common/src/test/java/com/core/common/core/text/ConvertTest.java @@ -0,0 +1,81 @@ +package com.core.common.core.text; + +import org.junit.jupiter.api.Test; +import java.math.BigDecimal; +import java.math.BigInteger; +import static org.junit.jupiter.api.Assertions.*; + +/** + * Convert 工具类单元测试 + */ +class ConvertTest { + + @Test + void testToStr() { + assertEquals("hello", Convert.toStr("hello")); + assertEquals("123", Convert.toStr(123)); + assertEquals("true", Convert.toStr(true)); + assertNull(Convert.toStr(null)); + } + + @Test + void testToInt() { + assertEquals(123, Convert.toInt("123")); + assertEquals(123, Convert.toInt(123)); + assertNull(Convert.toInt("invalid")); + assertNull(Convert.toInt(null)); + } + + @Test + void testToLong() { + assertEquals(123L, Convert.toLong("123")); + assertEquals(123L, Convert.toLong(123L)); + assertNull(Convert.toLong("invalid")); + } + + @Test + void testToDouble() { + assertEquals(1.23, Convert.toDouble("1.23"), 0.001); + assertEquals(1.23, Convert.toDouble(1.23), 0.001); + assertNull(Convert.toDouble("invalid")); + } + + @Test + void testToFloat() { + assertEquals(1.23f, Convert.toFloat("1.23"), 0.001); + assertEquals(1.23f, Convert.toFloat(1.23f), 0.001); + } + + @Test + void testToBool() { + assertTrue(Convert.toBool("true")); + assertTrue(Convert.toBool(true)); + assertFalse(Convert.toBool("false")); + assertFalse(Convert.toBool(false)); + assertNull(Convert.toBool("invalid")); + } + + @Test + void testToByte() { + assertEquals((byte) 123, Convert.toByte("123")); + assertEquals((byte) 123, Convert.toByte((byte) 123)); + } + + @Test + void testToShort() { + assertEquals((short) 123, Convert.toShort("123")); + assertEquals((short) 123, Convert.toShort((short) 123)); + } + + @Test + void testToBigDecimal() { + assertEquals(0, new BigDecimal("1.23").compareTo(Convert.toBigDecimal("1.23"))); + assertEquals(0, new BigDecimal("1.23").compareTo(Convert.toBigDecimal(1.23))); + } + + @Test + void testToBigInteger() { + assertEquals(0, new BigInteger("123").compareTo(Convert.toBigInteger("123"))); + assertEquals(0, new BigInteger("123").compareTo(Convert.toBigInteger(123))); + } +} diff --git a/openhis-server-new/core-framework/pom.xml b/openhis-server-new/core-framework/pom.xml index 37374f19b..2a5109c5a 100755 --- a/openhis-server-new/core-framework/pom.xml +++ b/openhis-server-new/core-framework/pom.xml @@ -106,6 +106,12 @@ ${mybatis-plus.version} + + + org.springframework.boot + spring-boot-starter-test + test + diff --git a/openhis-server-new/core-framework/src/main/java/com/core/framework/aspectj/LogAspect.java b/openhis-server-new/core-framework/src/main/java/com/core/framework/aspectj/LogAspect.java index 29f5240e1..15461a05e 100755 --- a/openhis-server-new/core-framework/src/main/java/com/core/framework/aspectj/LogAspect.java +++ b/openhis-server-new/core-framework/src/main/java/com/core/framework/aspectj/LogAspect.java @@ -177,6 +177,7 @@ public class LogAspect { String jsonObj = JSON.toJSONString(o, excludePropertyPreFilter(excludeParamNames)); params += jsonObj.toString() + " "; } catch (Exception e) { + log.debug("Caught expected exception: {}", e.getMessage()); } } } diff --git a/openhis-server-new/core-framework/src/main/java/com/core/framework/config/ApplicationConfig.java b/openhis-server-new/core-framework/src/main/java/com/core/framework/config/ApplicationConfig.java index 429c48284..453bf3000 100755 --- a/openhis-server-new/core-framework/src/main/java/com/core/framework/config/ApplicationConfig.java +++ b/openhis-server-new/core-framework/src/main/java/com/core/framework/config/ApplicationConfig.java @@ -1,5 +1,8 @@ package com.core.framework.config; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; @@ -27,6 +30,7 @@ import java.util.TimeZone; // 指定要扫描的Mapper类的包的路径 @MapperScan({"com.core.**.mapper", "com.openhis.**.mapper"}) public class ApplicationConfig { + private static final Logger log = LoggerFactory.getLogger(ApplicationConfig.class); /** 支持多种日期格式的反序列化器 */ private static final JsonDeserializer LOCAL_DATE_TIME_DESERIALIZER = new JsonDeserializer() { @@ -46,12 +50,14 @@ public class ApplicationConfig { try { return LocalDateTime.parse(cleaned, ISO_FORMATTER); } catch (Exception ignored) { - } + // intentionally ignored + } // 尝试简单格式(yyyy-MM-dd HH:mm:ss) try { return LocalDateTime.parse(cleaned, SIMPLE_FORMATTER); } catch (Exception ignored) { - } + // intentionally ignored + } // 尝试斜杠格式(yyyy/M/d HH:mm:ss) return LocalDateTime.parse(cleaned, SLASH_FORMATTER); } diff --git a/openhis-server-new/core-framework/src/main/java/com/core/framework/config/DruidConfig.java b/openhis-server-new/core-framework/src/main/java/com/core/framework/config/DruidConfig.java index 184961198..7340a7e56 100755 --- a/openhis-server-new/core-framework/src/main/java/com/core/framework/config/DruidConfig.java +++ b/openhis-server-new/core-framework/src/main/java/com/core/framework/config/DruidConfig.java @@ -1,5 +1,8 @@ package com.core.framework.config; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.util.Utils; import com.core.common.enums.DataSourceType; @@ -21,6 +24,7 @@ import java.util.Map; @Configuration public class DruidConfig { + private static final Logger log = LoggerFactory.getLogger(DruidConfig.class); @Bean @ConfigurationProperties("spring.datasource.druid.master") public DataSource masterDataSource(DruidProperties druidProperties) { @@ -50,7 +54,8 @@ public class DruidConfig { DataSource dataSource = SpringUtils.getBean(beanName); targetDataSources.put(sourceName, dataSource); } catch (Exception e) { - } + log.debug("Caught expected exception: {}", e.getMessage()); + } } @SuppressWarnings({"rawtypes", "unchecked"}) diff --git a/openhis-server-new/core-framework/src/main/java/com/core/framework/handler/MybastisColumnsHandler.java b/openhis-server-new/core-framework/src/main/java/com/core/framework/handler/MybastisColumnsHandler.java index f35970df4..38d6490e1 100755 --- a/openhis-server-new/core-framework/src/main/java/com/core/framework/handler/MybastisColumnsHandler.java +++ b/openhis-server-new/core-framework/src/main/java/com/core/framework/handler/MybastisColumnsHandler.java @@ -1,5 +1,8 @@ package com.core.framework.handler; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; import com.core.common.core.domain.model.LoginUser; import com.core.common.utils.SecurityUtils; @@ -14,6 +17,7 @@ import java.util.Date; @Component public class MybastisColumnsHandler implements MetaObjectHandler { + private static final Logger log = LoggerFactory.getLogger(MybastisColumnsHandler.class); // 设置数据新增时候的,字段自动赋值规则 @Override @@ -26,7 +30,8 @@ public class MybastisColumnsHandler implements MetaObjectHandler { username = loginUser.getUsername(); } } catch (Exception ignored) { - } + // intentionally ignored + } // 使用 fillStrategy 而不是 strictInsertFill,确保即使字段已设置也能填充(如果为null) this.fillStrategy(metaObject, "createBy", username != null ? username : "system"); this.fillStrategy(metaObject, "tenantId", getCurrentTenantId()); @@ -43,7 +48,8 @@ public class MybastisColumnsHandler implements MetaObjectHandler { username = loginUser.getUsername(); } } catch (Exception ignored) { - } + // intentionally ignored + } this.strictUpdateFill(metaObject, "updateBy", String.class, username); } diff --git a/openhis-server-new/core-system/src/main/java/com/core/system/service/impl/SysConfigServiceImpl.java b/openhis-server-new/core-system/src/main/java/com/core/system/service/impl/SysConfigServiceImpl.java index 660b172c2..5f391d185 100755 --- a/openhis-server-new/core-system/src/main/java/com/core/system/service/impl/SysConfigServiceImpl.java +++ b/openhis-server-new/core-system/src/main/java/com/core/system/service/impl/SysConfigServiceImpl.java @@ -1,5 +1,8 @@ package com.core.system.service.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.core.common.annotation.DataSource; import com.core.common.constant.CacheConstants; import com.core.common.constant.UserConstants; @@ -25,6 +28,7 @@ import java.util.List; */ @Service public class SysConfigServiceImpl implements ISysConfigService { + private static final Logger log = LoggerFactory.getLogger(SysConfigServiceImpl.class); @Autowired private SysConfigMapper configMapper; @@ -70,24 +74,24 @@ public class SysConfigServiceImpl implements ISysConfigService { SysConfig retConfig = configMapper.selectConfig(config); if (StringUtils.isNotNull(retConfig)) { String dbValue = retConfig.getConfigValue(); - System.out.println("=== selectConfigByKey 调试信息 ==="); - System.out.println("configKey: " + configKey); - System.out.println("retConfig: " + retConfig); - System.out.println("configId: " + retConfig.getConfigId()); - System.out.println("configName: " + retConfig.getConfigName()); - System.out.println("configValue from DB: [" + dbValue + "]"); - System.out.println("configValue is null: " + (dbValue == null)); - System.out.println("configValue is empty: " + StringUtils.isEmpty(dbValue)); - System.out.println("================================"); + log.info("=== selectConfigByKey 调试信息 ==="); + log.info("configKey: " + configKey); + log.info("retConfig: " + retConfig); + log.info("configId: " + retConfig.getConfigId()); + log.info("configName: " + retConfig.getConfigName()); + log.info("configValue from DB: [" + dbValue + "]"); + log.info("configValue is null: " + (dbValue == null)); + log.info("configValue is empty: " + StringUtils.isEmpty(dbValue)); + log.info("================================"); if (StringUtils.isNotEmpty(dbValue)) { redisCache.setCacheObject(getCacheKey(configKey), dbValue); return dbValue; } else { - System.out.println("警告: configValue 为空,返回空字符串"); + log.info("警告: configValue 为空,返回空字符串"); return StringUtils.EMPTY; } } else { - System.out.println("警告: 数据库中未找到 configKey=" + configKey + " 的记录"); + log.info("警告: 数据库中未找到 configKey=" + configKey + " 的记录"); } return StringUtils.EMPTY; } diff --git a/openhis-server-new/core-system/src/main/java/com/core/system/service/impl/SysDictDataServiceImpl.java b/openhis-server-new/core-system/src/main/java/com/core/system/service/impl/SysDictDataServiceImpl.java index e83c6eb04..83511b1d0 100755 --- a/openhis-server-new/core-system/src/main/java/com/core/system/service/impl/SysDictDataServiceImpl.java +++ b/openhis-server-new/core-system/src/main/java/com/core/system/service/impl/SysDictDataServiceImpl.java @@ -6,6 +6,7 @@ import com.core.common.utils.DictUtils; import com.core.system.mapper.SysDictDataMapper; import com.core.system.service.ISysDictDataService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import java.util.List; @@ -39,6 +40,7 @@ public class SysDictDataServiceImpl implements ISysDictDataService { * @return 字典标签 */ @Override + @Cacheable(value = "dictLabelCache", key = "#dictType + ':' + #dictValue") public String selectDictLabel(String dictType, String dictValue) { return dictDataMapper.selectDictLabel(dictType, dictValue); } diff --git a/openhis-server-new/core-system/src/main/java/com/core/system/service/impl/SysTenantServiceImpl.java b/openhis-server-new/core-system/src/main/java/com/core/system/service/impl/SysTenantServiceImpl.java index 67a47bdaa..1f7c9ffbf 100755 --- a/openhis-server-new/core-system/src/main/java/com/core/system/service/impl/SysTenantServiceImpl.java +++ b/openhis-server-new/core-system/src/main/java/com/core/system/service/impl/SysTenantServiceImpl.java @@ -1,5 +1,8 @@ package com.core.system.service.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -36,6 +39,7 @@ import java.util.stream.Collectors; */ @Service public class SysTenantServiceImpl extends ServiceImpl implements ISysTenantService { + private static final Logger log = LoggerFactory.getLogger(SysTenantServiceImpl.class); @Autowired private SysUserTenantMapper sysUserTenantMapper; @Autowired @@ -295,7 +299,8 @@ public class SysTenantServiceImpl extends ServiceImpl !cacheTenant.equals(e.getId()), Comparator.naturalOrder())); } } catch (Exception ignored) { - } + // intentionally ignored + } return R.ok(userBindTenantList); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/OpenHisApplication.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/OpenHisApplication.java index c53d5dff6..7656b038a 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/OpenHisApplication.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/OpenHisApplication.java @@ -1,5 +1,8 @@ package com.openhis; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.openhis.web.ybmanage.config.YbServiceConfig; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -20,13 +23,14 @@ import java.net.UnknownHostException; @EnableConfigurationProperties(YbServiceConfig.class) @EnableAsync public class OpenHisApplication { + private static final Logger log = LoggerFactory.getLogger(OpenHisApplication.class); public static void main(String[] args) throws UnknownHostException { ConfigurableApplicationContext application = SpringApplication.run(OpenHisApplication.class, args); Environment env = application.getEnvironment(); String ip = InetAddress.getLocalHost().getHostAddress(); String port = env.getProperty("server.port"); String path = env.getProperty("server.servlet.context-path"); - System.out.println("\n----------------------------------------------------------\n\t" + log.info("\n----------------------------------------------------------\n\t" + "Application OpenHis is running! Access URLs:\n\t" + "Local: \t\thttp://localhost:" + port + path + "/\n\t" + "External: \thttp://" + ip + ":" + port + path + "/\n" + "----------------------------------------------------------"); diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/quartz/task/RyTask.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/quartz/task/RyTask.java index 5202723b5..afc990e45 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/quartz/task/RyTask.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/quartz/task/RyTask.java @@ -1,5 +1,8 @@ package com.openhis.quartz.task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.core.common.utils.StringUtils; import com.core.framework.config.TenantContext; import com.openhis.administration.domain.Location; @@ -16,6 +19,7 @@ import java.util.List; */ @Component("ryTask") public class RyTask { + private static final Logger log = LoggerFactory.getLogger(RyTask.class); @Resource ILocationService locationService; @@ -27,7 +31,7 @@ public class RyTask { // 设置当前线程的租户ID TenantContext.setCurrentTenant(tenantId); List pharmacyList = locationService.getPharmacyList(); - System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); + log.info(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); } finally { // 清除线程局部变量,防止内存泄漏 TenantContext.clear(); @@ -36,10 +40,10 @@ public class RyTask { } public void ryParams(String params) { - System.out.println("执行有参方法:" + params); + log.info("执行有参方法:" + params); } public void ryNoParams() { - System.out.println("执行无参方法"); + log.info("执行无参方法"); } } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/rule/component/ACmp.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/rule/component/ACmp.java index c1c853b8e..2dbc66bd3 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/rule/component/ACmp.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/rule/component/ACmp.java @@ -1,14 +1,18 @@ package com.openhis.rule.component; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.yomahub.liteflow.core.NodeComponent; import org.springframework.stereotype.Component; @Component("a") public class ACmp extends NodeComponent { + private static final Logger log = LoggerFactory.getLogger(ACmp.class); @Override public void process() { // do your business - System.out.println("___aaa"); + log.info("___aaa"); } } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/rule/component/BCmp.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/rule/component/BCmp.java index d0aca2e86..fe994e266 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/rule/component/BCmp.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/rule/component/BCmp.java @@ -1,14 +1,18 @@ package com.openhis.rule.component; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.yomahub.liteflow.core.NodeComponent; import org.springframework.stereotype.Component; @Component("b") public class BCmp extends NodeComponent { + private static final Logger log = LoggerFactory.getLogger(BCmp.class); @Override public void process() { // do your business - System.out.println("___bbb"); + log.info("___bbb"); } } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/rule/component/CCmp.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/rule/component/CCmp.java index 935181979..d2a19f5dd 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/rule/component/CCmp.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/rule/component/CCmp.java @@ -1,14 +1,18 @@ package com.openhis.rule.component; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.yomahub.liteflow.core.NodeComponent; import org.springframework.stereotype.Component; @Component("c") public class CCmp extends NodeComponent { + private static final Logger log = LoggerFactory.getLogger(CCmp.class); @Override public void process() { // do your business - System.out.println("___ccc"); + log.info("___ccc"); } } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/Inspection/appservice/impl/SampleCollectManageAppService.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/Inspection/appservice/impl/SampleCollectManageAppService.java index 360919ac8..555305dba 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/Inspection/appservice/impl/SampleCollectManageAppService.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/Inspection/appservice/impl/SampleCollectManageAppService.java @@ -1,5 +1,8 @@ package com.openhis.web.Inspection.appservice.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -32,6 +35,7 @@ import java.util.Objects; @RequiredArgsConstructor @Service public class SampleCollectManageAppService implements ISampleCollectAppManageAppService { + private static final Logger log = LoggerFactory.getLogger(SampleCollectManageAppService.class); private final SampleCollectMapper sampleCollectMapper; @@ -96,7 +100,7 @@ public class SampleCollectManageAppService implements ISampleCollectAppManageApp }); if (Objects.equals(status, SpecCollectStatus.RECEIVED.getValue())) { // TODO 接收样本后续逻辑 - System.err.println("接收样本后!!"); + log.error("接收样本后!!"); } return R.ok(); diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/basicmanage/controller/OutpatientNoSegmentController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/basicmanage/controller/OutpatientNoSegmentController.java index 00b1201cb..6c4f19bfb 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/basicmanage/controller/OutpatientNoSegmentController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/basicmanage/controller/OutpatientNoSegmentController.java @@ -1,5 +1,8 @@ package com.openhis.web.basicmanage.controller; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.annotation.Log; import com.core.common.core.domain.R; @@ -20,6 +23,7 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/business-rule/outpatient-no") public class OutpatientNoSegmentController { + private static final Logger log = LoggerFactory.getLogger(OutpatientNoSegmentController.class); @Autowired private IOutpatientNoSegmentService outpatientNoSegmentService; @@ -128,8 +132,8 @@ public class OutpatientNoSegmentController { public R deleteOutpatientNoSegment(@RequestBody java.util.Map request) { // 支持接收 Long[] 或 String[] 或混合类型,处理大整数ID Object idsObj = request.get("ids"); - System.out.println("删除请求 - 接收到的ids原始数据: " + idsObj); - System.out.println("删除请求 - 接收到的ids类型: " + (idsObj != null ? idsObj.getClass().getName() : "null")); + log.info("删除请求 - 接收到的ids原始数据: " + idsObj); + log.info("删除请求 - 接收到的ids类型: " + (idsObj != null ? idsObj.getClass().getName() : "null")); if (idsObj == null) { return R.fail("请选择要删除的数据"); @@ -149,15 +153,15 @@ public class OutpatientNoSegmentController { } else if (idObj instanceof String) { try { String idStr = (String) idObj; - System.out.println("删除请求 - 转换字符串ID: " + idStr); + log.info("删除请求 - 转换字符串ID: " + idStr); ids[i] = Long.parseLong(idStr); - System.out.println("删除请求 - 转换后的Long ID: " + ids[i]); + log.info("删除请求 - 转换后的Long ID: " + ids[i]); // 验证转换是否正确 if (!String.valueOf(ids[i]).equals(idStr)) { - System.out.println("删除请求 - 警告:ID转换后值不匹配!原始: " + idStr + ", 转换后: " + ids[i]); + log.info("删除请求 - 警告:ID转换后值不匹配!原始: " + idStr + ", 转换后: " + ids[i]); } } catch (NumberFormatException e) { - System.out.println("删除请求 - ID转换失败: " + idObj + ", 错误: " + e.getMessage()); + log.info("删除请求 - ID转换失败: " + idObj + ", 错误: " + e.getMessage()); return R.fail("无效的ID格式: " + idObj); } } else if (idObj instanceof Number) { @@ -172,7 +176,7 @@ public class OutpatientNoSegmentController { return R.fail("无效的ID数组格式"); } - System.out.println("删除请求 - 转换后的ids: " + java.util.Arrays.toString(ids)); + log.info("删除请求 - 转换后的ids: " + java.util.Arrays.toString(ids)); if (ids == null || ids.length == 0) { return R.fail("请选择要删除的数据"); @@ -180,37 +184,37 @@ public class OutpatientNoSegmentController { // 获取当前用户ID Long userId = SecurityUtils.getUserId(); - System.out.println("删除请求 - 当前用户ID: " + userId); + log.info("删除请求 - 当前用户ID: " + userId); // 校验删除权限和使用状态 for (Long id : ids) { - System.out.println("删除验证 - 检查ID: " + id); + log.info("删除验证 - 检查ID: " + id); OutpatientNoSegment segment = outpatientNoSegmentService.getById(id); if (segment == null) { // 记录日志以便调试 - System.out.println("删除失败:记录不存在,ID=" + id + ",可能已被软删除或不存在"); + log.info("删除失败:记录不存在,ID=" + id + ",可能已被软删除或不存在"); return R.fail("数据不存在,ID: " + id); } - System.out.println("删除验证 - 找到记录: ID=" + segment.getId() + ", operatorId=" + segment.getOperatorId() + ", usedNo=" + segment.getUsedNo() + ", startNo=" + segment.getStartNo()); + log.info("删除验证 - 找到记录: ID=" + segment.getId() + ", operatorId=" + segment.getOperatorId() + ", usedNo=" + segment.getUsedNo() + ", startNo=" + segment.getStartNo()); // 校验归属权 if (!segment.getOperatorId().equals(userId)) { - System.out.println("删除验证 - 权限检查失败: segment.operatorId=" + segment.getOperatorId() + ", userId=" + userId); + log.info("删除验证 - 权限检查失败: segment.operatorId=" + segment.getOperatorId() + ", userId=" + userId); return R.fail("只能删除自己维护的门诊号码段"); } // 校验使用状态(使用号码=起始号码表示未使用) if (!segment.getUsedNo().equals(segment.getStartNo())) { - System.out.println("删除验证 - 使用状态检查失败: usedNo=" + segment.getUsedNo() + ", startNo=" + segment.getStartNo()); + log.info("删除验证 - 使用状态检查失败: usedNo=" + segment.getUsedNo() + ", startNo=" + segment.getStartNo()); return R.fail("已有门诊号码段已有使用的门诊号码,请核对!"); } } - System.out.println("删除验证 - 所有检查通过,开始执行删除"); + log.info("删除验证 - 所有检查通过,开始执行删除"); int rows = outpatientNoSegmentService.deleteOutpatientNoSegmentByIds(ids); - System.out.println("删除执行 - 影响行数: " + rows); + log.info("删除执行 - 影响行数: " + rows); return rows > 0 ? R.ok("删除成功") : R.fail("删除失败"); } } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/catalogmanage/controller/CatalogController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/catalogmanage/controller/CatalogController.java index bea4a27fc..ba1ef9177 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/catalogmanage/controller/CatalogController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/catalogmanage/controller/CatalogController.java @@ -47,7 +47,7 @@ public class CatalogController { public R getPage(Integer catalogType, @RequestParam(value = "searchKey", defaultValue = "") String searchKey, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { - System.out.println(ybServiceConfig.getUrl()); + log.info(ybServiceConfig.getUrl()); return R.ok(iCatalogService.getPage(catalogType, searchKey, pageNo, pageSize, request)); } } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/document/util/DocumentDirectoryProcessor.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/document/util/DocumentDirectoryProcessor.java index e8cad82dd..802963846 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/document/util/DocumentDirectoryProcessor.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/document/util/DocumentDirectoryProcessor.java @@ -1,5 +1,8 @@ package com.openhis.web.document.util; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.openhis.common.enums.DocTypeEnum; import com.openhis.web.document.dto.DirectoryNode; import com.openhis.web.document.dto.DocDefinitionDto; @@ -7,6 +10,7 @@ import com.openhis.web.document.dto.DocDefinitionDto; import java.util.*; public class DocumentDirectoryProcessor { + private static final Logger log = LoggerFactory.getLogger(DocumentDirectoryProcessor.class); private static Long id; @@ -154,7 +158,7 @@ public class DocumentDirectoryProcessor { public static void printDirectory(List nodes, int indent) { for (DirectoryNode node : nodes) { // 打印缩进和节点信息 - System.out.println(" ".repeat(indent) + node.getName() + " (" + node.getLevel() + ")"); + log.info(" ".repeat(indent) + node.getName() + " (" + node.getLevel() + ")"); // 递归打印子节点,缩进+1 printDirectory(node.getChildren(), indent + 1); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inhospitalnursestation/appservice/impl/EncounterAutoRollAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inhospitalnursestation/appservice/impl/EncounterAutoRollAppServiceImpl.java index 2ab4d6e4c..d9c9bf638 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inhospitalnursestation/appservice/impl/EncounterAutoRollAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inhospitalnursestation/appservice/impl/EncounterAutoRollAppServiceImpl.java @@ -1,5 +1,8 @@ package com.openhis.web.inhospitalnursestation.appservice.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.core.common.core.domain.R; import com.core.common.utils.AssignSeqUtil; @@ -34,6 +37,7 @@ import java.util.stream.Collectors; */ @Service public class EncounterAutoRollAppServiceImpl implements IEncounterAutoRollAppService { + private static final Logger log = LoggerFactory.getLogger(EncounterAutoRollAppServiceImpl.class); @Resource EncounterAutoRollAppMapper encounterAutoRollAppMapper; @@ -183,7 +187,7 @@ public class EncounterAutoRollAppServiceImpl implements IEncounterAutoRollAppSer List nursingRequest = encounterAutoRollAppMapper.getNursingRequest( RequestStatus.COMPLETED.getValue(), ActivityDefCategory.NURSING.getValue(), encounterIdList); if (!nursingRequest.isEmpty()) { - System.out.println("**************滚护理费start****************"); + log.info("**************滚护理费start****************"); // 赋值计费的相关字段 nursingRequest.forEach(nursingDto -> { inBedPatientInfo.stream() @@ -251,7 +255,7 @@ public class EncounterAutoRollAppServiceImpl implements IEncounterAutoRollAppSer chargeItemService.save(chargeItem); } - System.out.println("**************滚护理费end****************"); + log.info("**************滚护理费end****************"); } } } @@ -277,7 +281,7 @@ public class EncounterAutoRollAppServiceImpl implements IEncounterAutoRollAppSer List autoRollBasicService = encounterAutoRollAppMapper .getAutoRollBasicService(PublicationStatus.ACTIVE.getValue(), encounterIdList); if (!autoRollBasicService.isEmpty()) { - System.out.println("**************滚基础服务费start****************"); + log.info("**************滚基础服务费start****************"); // 赋值计费的相关字段 autoRollBasicService.forEach(basicServiceDto -> { inBedPatientInfo.stream() @@ -344,7 +348,7 @@ public class EncounterAutoRollAppServiceImpl implements IEncounterAutoRollAppSer chargeItemService.save(chargeItem); } - System.out.println("**************滚基础服务费end****************"); + log.info("**************滚基础服务费end****************"); } } } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/nenu/appservice/impl/GfStudentListAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/nenu/appservice/impl/GfStudentListAppServiceImpl.java index ca3884ccb..690f247b8 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/nenu/appservice/impl/GfStudentListAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/nenu/appservice/impl/GfStudentListAppServiceImpl.java @@ -1,5 +1,8 @@ package com.openhis.web.nenu.appservice.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.alibaba.fastjson2.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -56,6 +59,7 @@ import java.util.stream.IntStream; */ @Service public class GfStudentListAppServiceImpl implements IGfStudentListAppService { + private static final Logger log = LoggerFactory.getLogger(GfStudentListAppServiceImpl.class); @Autowired private IPatientStudentService patientStudentService; @@ -150,7 +154,8 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService { birthDate = IdCardUtil.extractBirthdayFromIdCard(gfStudentListDto.getIdNumber()); age = IdCardUtil.calculateAgeFromIdCard(gfStudentListDto.getIdNumber()); } catch (Exception ignored) { - } + // intentionally ignored + } // 生成姓名的拼音码和五笔码 String pyStr = ChineseConvertUtils.toPinyinFirstLetter(gfStudentListDto.getName()); String wbStr = ChineseConvertUtils.toWBFirstLetter(gfStudentListDto.getName()); @@ -211,7 +216,8 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService { birthDate = IdCardUtil.extractBirthdayFromIdCard(gfStudentListDto.getIdNumber()); age = IdCardUtil.calculateAgeFromIdCard(gfStudentListDto.getIdNumber()); } catch (Exception ignored) { - } + // intentionally ignored + } // 生成姓名的拼音码和五笔码 String pyStr = ChineseConvertUtils.toPinyinFirstLetter(gfStudentListDto.getName()); String wbStr = ChineseConvertUtils.toWBFirstLetter(gfStudentListDto.getName()); @@ -286,7 +292,8 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService { birthDate = IdCardUtil.extractBirthdayFromIdCard(importDto.getIdNumber()); age = IdCardUtil.calculateAgeFromIdCard(importDto.getIdNumber()); } catch (Exception ignored) { - } + // intentionally ignored + } // 生成姓名的拼音码和五笔码 String pyStr = ChineseConvertUtils.toPinyinFirstLetter(importDto.getName()); String wbStr = ChineseConvertUtils.toWBFirstLetter(importDto.getName()); diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/EleInvoiceServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/EleInvoiceServiceImpl.java index fb81a05d7..f471822c4 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/EleInvoiceServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/EleInvoiceServiceImpl.java @@ -227,7 +227,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService { template.merge(context, writer); return writer.toString(); } catch (Exception e) { - log.error("渲染发票模板失败", e); + logger.error("渲染发票模板失败", e); return "

渲染发票凭条失败:" + e.getMessage() + "

"; } } @@ -239,9 +239,9 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService { try { Map receiptDetail = chargeBillService.getDetail(paymentId); bill.put("receiptData", receiptDetail); - log.info("已成功获取并注入小票动态数据,paymentId: {}", paymentId); + logger.info("已成功获取并注入小票动态数据,paymentId: {}", paymentId); } catch (Exception e) { - log.error("获取小票数据失败,paymentId: {}", paymentId, e); + logger.error("获取小票数据失败,paymentId: {}", paymentId, e); } } @@ -489,7 +489,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService { String srcdata; String srcmsg; - System.out.println(JSON.toJSONString(bill)); + logger.info(JSON.toJSONString(bill)); logger.info("************************************** 分 割 线 ***************************************"); logger.info("挂号请求参数:" + JSON.toJSONString(bill)); logger.info("———————————————————————————————————————————————————————————————————————————————————————"); @@ -799,7 +799,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService { String redata64; String srcdata; String srcmsg; - System.out.println(JSON.toJSONString(bill)); + logger.info(JSON.toJSONString(bill)); JSONObject resobj; logger.info("************************************** 分 割 线 ***************************************"); logger.info("门诊信息入参:" + JSON.toJSONString(bill)); diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/IChargeBillServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/IChargeBillServiceImpl.java index 3c21b6ab2..9d5e15db2 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/IChargeBillServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/IChargeBillServiceImpl.java @@ -496,8 +496,8 @@ public class IChargeBillServiceImpl implements IChargeBillService { // for (String string : strings) { // ChargeItem byId = chargeItemService.getById(Long.parseLong(string)); // if ("adm_healthcare_service".equals(byId.getServiceTable())) { - // System.out.println("//****************************"); - // System.out.println(JSON.toJSONString(byId)); + // log.info("//****************************"); + // log.info(JSON.toJSONString(byId)); // } // } // } @@ -578,8 +578,8 @@ public class IChargeBillServiceImpl implements IChargeBillService { } // for (Long chargeItemId : chargeItemIds) { - // System.out.println(chargeItemId); - // System.out.println(","); + // log.info(chargeItemId); + // log.info(","); // } List chargeItemList = chargeItemService.list(new LambdaQueryWrapper() .in(ChargeItem::getId, chargeItemIds).eq(ChargeItem::getDeleteFlag, DelFlag.NO.getCode())); @@ -589,8 +589,8 @@ public class IChargeBillServiceImpl implements IChargeBillService { // for (ChargeItem chargeItem : chargeItemList) { // if("adm_healthcare_service".equals(chargeItem.getServiceTable())){ - // System.out.println("//****************************"); - // System.out.println(JSON.toJSONString(chargeItem)); + // log.info("//****************************"); + // log.info(JSON.toJSONString(chargeItem)); // } // } // 查询收费定义列表 @@ -892,8 +892,8 @@ public class IChargeBillServiceImpl implements IChargeBillService { // for (String string : strings) { // ChargeItem byId = chargeItemService.getById(Long.parseLong(string)); // if ("adm_healthcare_service".equals(byId.getServiceTable())) { - // System.out.println("//****************************"); - // System.out.println(JSON.toJSONString(byId)); + // log.info("//****************************"); + // log.info(JSON.toJSONString(byId)); // } // } // } @@ -931,11 +931,11 @@ public class IChargeBillServiceImpl implements IChargeBillService { // } // } // if (bigDecimal.compareTo(paymentReconciliation.getTenderedAmount()) != 0) { - // System.out.println("//////**********************///////"); - // System.out.println("payment:" + paymentReconciliation.getId()); - // System.out.println("paymentAmount:" + paymentReconciliation.getTenderedAmount()); - // System.out.println("payment应收:" + paymentReconciliation.getDisplayAmount()); - // System.out.println("//////**********************///////"); + // log.info("//////**********************///////"); + // log.info("payment:" + paymentReconciliation.getId()); + // log.info("paymentAmount:" + paymentReconciliation.getTenderedAmount()); + // log.info("payment应收:" + paymentReconciliation.getDisplayAmount()); + // log.info("//////**********************///////"); // } // if (paymentReconciliation.getStatusEnum() == 3) { // continue; @@ -946,15 +946,15 @@ public class IChargeBillServiceImpl implements IChargeBillService { // BigDecimal bigDecimal1 = BigDecimal.ZERO; // for (ChargeItemBaseInfoDto chargeItemBaseInfoById : chargeItemBaseInfoByIds) { // bigDecimal1 = bigDecimal1.add(chargeItemBaseInfoById.getTotalPrice()); - // System.out.println("收费项:" + chargeItemBaseInfoById.getTotalPrice()); + // log.info("收费项:" + chargeItemBaseInfoById.getTotalPrice()); // } - // System.out.println("付款:" + paymentReconciliation.getTenderedAmount()); + // log.info("付款:" + paymentReconciliation.getTenderedAmount()); // if (bigDecimal1.compareTo(paymentReconciliation.getTenderedAmount()) != 0) { - // System.out.println("//////**********************///////"); - // System.out.println("payment:" + paymentReconciliation.getId()); - // System.out.println("paymentAmount:" + paymentReconciliation.getTenderedAmount()); - // System.out.println("payment应收:" + paymentReconciliation.getDisplayAmount()); - // System.out.println("//////**********************///////"); + // log.info("//////**********************///////"); + // log.info("payment:" + paymentReconciliation.getId()); + // log.info("paymentAmount:" + paymentReconciliation.getTenderedAmount()); + // log.info("payment应收:" + paymentReconciliation.getDisplayAmount()); + // log.info("//////**********************///////"); // } // } // List list1 = chargeItemService.list(new LambdaQueryWrapper() @@ -992,8 +992,8 @@ public class IChargeBillServiceImpl implements IChargeBillService { // for (ChargeItem chargeItem : chargeItemList) { // if("adm_healthcare_service".equals(chargeItem.getServiceTable())){ - // System.out.println("//****************************"); - // System.out.println(JSON.toJSONString(chargeItem)); + // log.info("//****************************"); + // log.info(JSON.toJSONString(chargeItem)); // } // } // 查询收费定义列表 @@ -1205,8 +1205,8 @@ public class IChargeBillServiceImpl implements IChargeBillService { Long definitionId = chargeItem.getDefinitionId(); // if(chargeItemDefKV.get(definitionId)==null){ - // System.out.println(chargeItem.getId()); - // System.out.println(JSON.toJSONString(chargeItem)); + // log.info(chargeItem.getId()); + // log.info(JSON.toJSONString(chargeItem)); // } ChargeItemDefinition chargeItemDefinition = chargeItemDefKV.get(definitionId).get(0); @@ -1311,8 +1311,8 @@ public class IChargeBillServiceImpl implements IChargeBillService { Long definitionId = chargeItem.getDefinitionId(); // if(chargeItemDefKV.get(definitionId)==null){ - // System.out.println(chargeItem.getId()); - // System.out.println(JSON.toJSONString(chargeItem)); + // log.info(chargeItem.getId()); + // log.info(JSON.toJSONString(chargeItem)); // } ChargeItemDefinition chargeItemDefinition = chargeItemDefKV.get(definitionId).get(0); @@ -1976,12 +1976,12 @@ public class IChargeBillServiceImpl implements IChargeBillService { // // //payment维度的值大于收费项的值 // if(paymentAmount.add(discountAmount).compareTo(chargeAmount)>0||chargeAmount.compareTo(paymentAmount.add(discountAmount))>0){ -// System.out.println("总价不对等,提示信息:paymentId:"+paymentReconciliationAccountDel.getId()); +// log.info("总价不对等,提示信息:paymentId:"+paymentReconciliationAccountDel.getId()); // } // // //chargeItem维度折后价格的值大于payment维度的实收 或者 chargeItem维度折后价格的值小于payment维度的实收 // if(chargeDiscountAmount.compareTo(paymentAmount)>0||paymentAmount.compareTo(chargeDiscountAmount)>0){ -// System.out.println("折后价格不对等,提示信息:paymentId:"+paymentReconciliationAccountDel.getId()); +// log.info("折后价格不对等,提示信息:paymentId:"+paymentReconciliationAccountDel.getId()); // } // } @@ -2661,7 +2661,7 @@ public class IChargeBillServiceImpl implements IChargeBillService { for (ChargeItem item : newChargeItemList) { if (item.getTotalPrice() == null) { - System.out.println("这个收费项没有定义总价:" + item.getId()); + log.info("这个收费项没有定义总价:" + item.getId()); } } @@ -2669,8 +2669,8 @@ public class IChargeBillServiceImpl implements IChargeBillService { if (paymentReconciliationId == 1987152585230508034L || paymentReconciliationId == 1987153070121410561L || paymentReconciliationId == 1984438852329246721L || paymentReconciliationId == 1984902967625117698L || paymentReconciliationId == 1984778667126493186L || paymentReconciliationId == 1984780710054531074L) { - System.out.println("主键id如下:" + paymentReconciliationId); - System.out.println("待分配诊疗项目如下:" + JSON.toJSONString(newChargeItemList)); + log.info("主键id如下:" + paymentReconciliationId); + log.info("待分配诊疗项目如下:" + JSON.toJSONString(newChargeItemList)); } if (b.compareTo(BigDecimal.ZERO) > 0) { diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/ThreePartPayServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/ThreePartPayServiceImpl.java index e6a4ba927..e3b867e20 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/ThreePartPayServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/ThreePartPayServiceImpl.java @@ -84,7 +84,7 @@ public class ThreePartPayServiceImpl implements ThreePartPayService { //获取动态参数 Map paramMap = this.getParamMap(jsonObject, practitioner, null, null, null, null); - System.out.println("三方支付【签到】:"); + logger.info("三方支付【签到】:"); logger.info("三方支付【签到】:"); //执行请求 String requestResult = executeRequest(requestMethod, threePartUrl, staticParam, paramMap); @@ -113,7 +113,7 @@ public class ThreePartPayServiceImpl implements ThreePartPayService { //获取动态参数 Map paramMap = this.getParamMap(jsonObject, practitioner, null, null, null, null); - System.out.println("三方支付【签出】:"); + logger.info("三方支付【签出】:"); logger.info("三方支付【签出】:"); //执行请求 String requestResult = executeRequest(requestMethod, threePartUrl, staticParam, paramMap); @@ -508,7 +508,7 @@ public class ThreePartPayServiceImpl implements ThreePartPayService { //获取完整url String url = renderTemplateSafe(threePartUrl, map); - System.out.println("三方支付请求入参:" + url); + logger.info("三方支付请求入参:" + url); logger.info("三方支付请求入参:" + url); //发送请求 @@ -526,14 +526,14 @@ public class ThreePartPayServiceImpl implements ThreePartPayService { data.putAll(staticDta); } - System.out.println("三方支付请求入参:" + data.toJSONString()); + logger.info("三方支付请求入参:" + data.toJSONString()); logger.info("三方支付请求入参:" + data.toJSONString()); requestResult = httpPost(threePartUrl, data.toJSONString()); } - System.out.println("三方支付请求出参:" + requestResult); + logger.info("三方支付请求出参:" + requestResult); logger.info("三方支付请求出参:" + requestResult); return requestResult; @@ -557,16 +557,16 @@ public class ThreePartPayServiceImpl implements ThreePartPayService { HttpGet httpGet = new HttpGet(url); // 执行http请求 response = httpClient.execute(httpGet); - System.out.println("回复信息:" + JSON.toJSONString(response)); + logger.info("回复信息:" + JSON.toJSONString(response)); resultString = EntityUtils.toString(response.getEntity(), "utf-8"); } catch (Exception e) { - log.error("Http请求异常, url: {}", url, e); + logger.error("Http请求异常, url: {}", url, e); throw new ServiceException("Http请求异常,请稍后再试。"); } finally { try { response.close(); } catch (IOException e) { - log.error("关闭响应失败", e); + logger.error("关闭响应失败", e); } } return resultString; @@ -596,13 +596,13 @@ public class ThreePartPayServiceImpl implements ThreePartPayService { response = httpClient.execute(httpPost); resultString = EntityUtils.toString(response.getEntity(), "utf-8"); } catch (Exception e) { - log.error("Http请求异常, url: {}", url, e); + logger.error("Http请求异常, url: {}", url, e); throw new ServiceException("Http请求异常,请稍后再试。"); } finally { try { response.close(); } catch (IOException e) { - log.error("关闭响应失败", e); + logger.error("关闭响应失败", e); } } return resultString; diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java index 521e0c418..2971b8357 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java @@ -475,16 +475,22 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer if (surgeon != null && surgeon.getName() != null) { surgery.setMainSurgeonName(surgeon.getName()); } - } catch (NumberFormatException ignored) {} + } catch (NumberFormatException ignored) { + // intentionally ignored + } } // 从 descJson 解析手术等级、麻醉方式 String surgeryLevelStr = descMap != null ? (String) descMap.get("surgeryLevel") : null; if (surgeryLevelStr != null && !surgeryLevelStr.isEmpty()) { - try { surgery.setSurgeryLevel(Integer.parseInt(surgeryLevelStr)); } catch (NumberFormatException ignored) {} + try { surgery.setSurgeryLevel(Integer.parseInt(surgeryLevelStr)); } catch (NumberFormatException ignored) { + // intentionally ignored + } } String anesthesiaTypeStr = descMap != null ? (String) descMap.get("anesthesiaType") : null; if (anesthesiaTypeStr != null && !anesthesiaTypeStr.isEmpty()) { - try { surgery.setAnesthesiaTypeEnum(Integer.parseInt(anesthesiaTypeStr)); } catch (NumberFormatException ignored) {} + try { surgery.setAnesthesiaTypeEnum(Integer.parseInt(anesthesiaTypeStr)); } catch (NumberFormatException ignored) { + // intentionally ignored + } } // 填充患者姓名(从 adm_patient 查询) if (patientId != null) { @@ -493,7 +499,9 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer if (patient != null) { surgery.setPatientName(patient.getName()); } - } catch (Exception ignored) {} + } catch (Exception ignored) { + // intentionally ignored + } } // 从 descJson 解析手术信息 @@ -504,16 +512,22 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer surgery.setPreoperativeDiagnosis(preoperativeDiagnosis); // 解析费用 if (surgeryFee != null && !surgeryFee.isEmpty()) { - try { surgery.setSurgeryFee(new BigDecimal(surgeryFee)); } catch (NumberFormatException ignored) {} + try { surgery.setSurgeryFee(new BigDecimal(surgeryFee)); } catch (NumberFormatException ignored) { + // intentionally ignored + } } if (anesthesiaFee != null && !anesthesiaFee.isEmpty()) { - try { surgery.setAnesthesiaFee(new BigDecimal(anesthesiaFee)); } catch (NumberFormatException ignored) {} + try { surgery.setAnesthesiaFee(new BigDecimal(anesthesiaFee)); } catch (NumberFormatException ignored) { + // intentionally ignored + } } // 解析计划手术时间 if (plannedTime != null && !plannedTime.isEmpty()) { try { surgery.setPlannedTime(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(plannedTime)); - } catch (Exception ignored) {} + } catch (Exception ignored) { + // intentionally ignored + } } } // 兜底:若 descJson 解析为空,从 activityList 获取手术名称 diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/InboundReportAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/InboundReportAppServiceImpl.java index afe36a84a..f6f25ecaa 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/InboundReportAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/InboundReportAppServiceImpl.java @@ -3,6 +3,9 @@ */ package com.openhis.web.reportmanage.appservice.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; @@ -43,6 +46,7 @@ import java.util.stream.Collectors; */ @Service public class InboundReportAppServiceImpl implements IInboundReportAppService { + private static final Logger log = LoggerFactory.getLogger(InboundReportAppServiceImpl.class); @Autowired private InboundReportMapper inboundReportMapperMapper; @@ -184,7 +188,7 @@ public class InboundReportAppServiceImpl implements IInboundReportAppService { ExcelUtil util = new ExcelUtil<>(InboundReportPageDto.class); util.exportExcel(response, receiptDetailList, excelName); } catch (Exception e) { - e.printStackTrace(); + log.error("Exception occurred", e); System.out.printf("导出Excel失败:" + e.getMessage()); return R.fail("导出Excel失败:" + e.getMessage()); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/InpatientMedicalRecordHomePageCollectionAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/InpatientMedicalRecordHomePageCollectionAppServiceImpl.java index 8396b6ff2..986a23f34 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/InpatientMedicalRecordHomePageCollectionAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/InpatientMedicalRecordHomePageCollectionAppServiceImpl.java @@ -3,6 +3,9 @@ */ package com.openhis.web.reportmanage.appservice.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.alibaba.fastjson2.JSONObject; import com.core.common.core.domain.R; import com.core.common.utils.AgeCalculatorUtil; @@ -33,8 +36,8 @@ import java.util.List; * @date 2025-08-25 */ @Service -public class InpatientMedicalRecordHomePageCollectionAppServiceImpl - implements InpatientMedicalRecordHomePageCollectionAppService { +public class InpatientMedicalRecordHomePageCollectionAppServiceImpl implements InpatientMedicalRecordHomePageCollectionAppService { + private static final Logger log = LoggerFactory.getLogger(InpatientMedicalRecordHomePageCollectionAppServiceImpl.class); @Autowired private InpatientMedicalRecordHomePageCollectionMapper inpatientMedicalRecordHomePageCollectionMapper; @@ -343,8 +346,8 @@ public class InpatientMedicalRecordHomePageCollectionAppServiceImpl // 做成csv文件 CsvFillerUtil.makeCsvFile(response, medicalRecordHomePageList); } catch (IOException e) { - e.printStackTrace(); - System.err.println("写入csv时发生错误:" + e.getMessage()); + log.error("Exception occurred", e); + log.error("写入csv时发生错误:" + e.getMessage()); return R.fail("写入csv时发生错误:" + e.getMessage()); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/InventoryProductReportAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/InventoryProductReportAppServiceImpl.java index 86f1c02b7..c70b90371 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/InventoryProductReportAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/InventoryProductReportAppServiceImpl.java @@ -3,6 +3,9 @@ */ package com.openhis.web.reportmanage.appservice.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; @@ -41,6 +44,7 @@ import java.util.stream.Collectors; */ @Service public class InventoryProductReportAppServiceImpl implements IInventoryProductReportAppService { + private static final Logger log = LoggerFactory.getLogger(InventoryProductReportAppServiceImpl.class); @Autowired private InventoryProductReportMapper inventoryProductReportMapper; @@ -194,7 +198,7 @@ public class InventoryProductReportAppServiceImpl implements IInventoryProductRe // 导出到Excel ExcelFillerUtil.makeExcelFile(response, receiptDetailList, headers, excelName, totalValues); } catch (Exception e) { - e.printStackTrace(); + log.error("Exception occurred", e); System.out.printf("导出Excel失败:" + e.getMessage()); return R.fail("导出Excel失败:" + e.getMessage()); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/LossReportAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/LossReportAppServiceImpl.java index 188b58118..4895d4a8f 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/LossReportAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/LossReportAppServiceImpl.java @@ -3,6 +3,9 @@ */ package com.openhis.web.reportmanage.appservice.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; @@ -40,6 +43,7 @@ import java.util.stream.Collectors; */ @Service public class LossReportAppServiceImpl implements ILossReportAppService { + private static final Logger log = LoggerFactory.getLogger(LossReportAppServiceImpl.class); @Autowired private LossReportMapper lossReportMapper; @@ -151,7 +155,7 @@ public class LossReportAppServiceImpl implements ILossReportAppService { ExcelUtil util = new ExcelUtil<>(LossReportPageDto.class); util.exportExcel(response, receiptDetailList, excelName); } catch (Exception e) { - e.printStackTrace(); + log.error("Exception occurred", e); System.out.printf("导出Excel失败:" + e.getMessage()); return R.fail("导出Excel失败:" + e.getMessage()); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/MedicationDeviceReportAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/MedicationDeviceReportAppServiceImpl.java index be61bc230..5a2972112 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/MedicationDeviceReportAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/MedicationDeviceReportAppServiceImpl.java @@ -3,6 +3,9 @@ */ package com.openhis.web.reportmanage.appservice.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; import com.core.common.core.domain.entity.SysDictData; @@ -39,6 +42,7 @@ import java.util.stream.Collectors; */ @Service public class MedicationDeviceReportAppServiceImpl implements IMedicationDeviceReportAppService { + private static final Logger log = LoggerFactory.getLogger(MedicationDeviceReportAppServiceImpl.class); @Autowired private MedicationDeviceReportMapper medicationDeviceReportMapper; @@ -169,7 +173,7 @@ public class MedicationDeviceReportAppServiceImpl implements IMedicationDeviceRe // 导出到Excel ExcelFillerUtil.makeExcelFile(response, receiptDetailList, headers, excelName, totalValues); } catch (Exception e) { - e.printStackTrace(); + log.error("Exception occurred", e); System.out.printf("导出Excel失败:" + e.getMessage()); return R.fail("导出Excel失败:" + e.getMessage()); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/OutboundReportAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/OutboundReportAppServiceImpl.java index 050db97cf..0594de6cb 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/OutboundReportAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/OutboundReportAppServiceImpl.java @@ -1,5 +1,8 @@ package com.openhis.web.reportmanage.appservice.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; @@ -40,6 +43,7 @@ import java.util.stream.Collectors; */ @Service public class OutboundReportAppServiceImpl implements IOutboundReportAppService { + private static final Logger log = LoggerFactory.getLogger(OutboundReportAppServiceImpl.class); @Autowired OutboundReportMapper outboundReportMapper; @@ -186,7 +190,7 @@ public class OutboundReportAppServiceImpl implements IOutboundReportAppService { ExcelUtil util = new ExcelUtil<>(OutboundReportPageDto.class); util.exportExcel(response, receiptDetailList, excelName); } catch (Exception e) { - e.printStackTrace(); + log.error("Exception occurred", e); System.out.printf("导出Excel失败:" + e.getMessage()); return R.fail("导出Excel失败:" + e.getMessage()); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/PurchaseReturnReportAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/PurchaseReturnReportAppServiceImpl.java index 1e5939a63..c505e64a3 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/PurchaseReturnReportAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/PurchaseReturnReportAppServiceImpl.java @@ -3,6 +3,9 @@ */ package com.openhis.web.reportmanage.appservice.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; @@ -43,6 +46,7 @@ import java.util.stream.Collectors; */ @Service public class PurchaseReturnReportAppServiceImpl implements PurchaseReturnReportAppService { + private static final Logger log = LoggerFactory.getLogger(PurchaseReturnReportAppServiceImpl.class); @Autowired private PurchaseReturnReportMapper purchaseReturnReportMapper; @@ -190,7 +194,7 @@ public class PurchaseReturnReportAppServiceImpl implements PurchaseReturnReportA // 导出到Excel ExcelFillerUtil.makeExcelFile(response, receiptDetailList, headers, excelName, totalValues); } catch (Exception e) { - e.printStackTrace(); + log.error("Exception occurred", e); System.out.printf("导出Excel失败:" + e.getMessage()); return R.fail("导出Excel失败:" + e.getMessage()); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/ReturnIssueReportAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/ReturnIssueReportAppServiceImpl.java index 08106b113..17cccf3d0 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/ReturnIssueReportAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/ReturnIssueReportAppServiceImpl.java @@ -1,5 +1,8 @@ package com.openhis.web.reportmanage.appservice.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; @@ -40,6 +43,7 @@ import java.util.stream.Collectors; */ @Service public class ReturnIssueReportAppServiceImpl implements IReturnIssueReportAppService { + private static final Logger log = LoggerFactory.getLogger(ReturnIssueReportAppServiceImpl.class); @Autowired ReturnIssueReportMapper returnIssueReportMapper; @@ -193,7 +197,7 @@ public class ReturnIssueReportAppServiceImpl implements IReturnIssueReportAppSer // 导出到Excel ExcelFillerUtil.makeExcelFile(response, receiptDetailList, headers, excelName, totalValues); } catch (Exception e) { - e.printStackTrace(); + log.error("Exception occurred", e); System.out.printf("导出Excel失败:" + e.getMessage()); return R.fail("导出Excel失败:" + e.getMessage()); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/StocktakingReportAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/StocktakingReportAppServiceImpl.java index 76b58a757..3c9726e37 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/StocktakingReportAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/StocktakingReportAppServiceImpl.java @@ -3,6 +3,9 @@ */ package com.openhis.web.reportmanage.appservice.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; @@ -40,6 +43,7 @@ import java.util.stream.Collectors; */ @Service public class StocktakingReportAppServiceImpl implements IStocktakingReportAppService { + private static final Logger log = LoggerFactory.getLogger(StocktakingReportAppServiceImpl.class); @Autowired private StocktakingReportMapper stocktakingReportMapper; @@ -179,7 +183,7 @@ public class StocktakingReportAppServiceImpl implements IStocktakingReportAppSer ExcelUtil util = new ExcelUtil<>(StocktakingReportPageDto.class); util.exportExcel(response, receiptDetailList, excelName); } catch (Exception e) { - e.printStackTrace(); + log.error("Exception occurred", e); System.out.printf("导出Excel失败:" + e.getMessage()); return R.fail("导出Excel失败:" + e.getMessage()); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/TransferReportAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/TransferReportAppServiceImpl.java index 1a7d60ecb..574def805 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/TransferReportAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/TransferReportAppServiceImpl.java @@ -3,6 +3,9 @@ */ package com.openhis.web.reportmanage.appservice.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; @@ -41,6 +44,7 @@ import java.util.stream.Collectors; */ @Service public class TransferReportAppServiceImpl implements ITransferReportAppService { + private static final Logger log = LoggerFactory.getLogger(TransferReportAppServiceImpl.class); @Autowired private TransferReportMapper transferReportMapper; @@ -164,7 +168,7 @@ public class TransferReportAppServiceImpl implements ITransferReportAppService { ExcelUtil util = new ExcelUtil<>(TransferReportPageDto.class); util.exportExcel(response, receiptDetailList, excelName); } catch (Exception e) { - e.printStackTrace(); + log.error("Exception occurred", e); System.out.printf("导出Excel失败:" + e.getMessage()); return R.fail("导出Excel失败:" + e.getMessage()); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/utils/CsvFillerUtil.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/utils/CsvFillerUtil.java index 2f79cc6e1..95766027a 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/utils/CsvFillerUtil.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/utils/CsvFillerUtil.java @@ -1,5 +1,8 @@ package com.openhis.web.reportmanage.utils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.openhis.common.constant.CommonConstants; import com.openhis.web.reportmanage.dto.InpatientMedicalRecordHomePageCollectionDto; @@ -22,6 +25,7 @@ import java.util.List; * @date 2025-08-25 */ public final class CsvFillerUtil { + private static final Logger log = LoggerFactory.getLogger(CsvFillerUtil.class); // 表头 public static final String headers = @@ -101,7 +105,7 @@ public final class CsvFillerUtil { // 重命名文件 boolean renamed = targetFile.renameTo(renamedFile); if (renamed) { - System.out.println("文件已存在,已重命名为:" + renamedFile.getAbsolutePath()); + log.info("文件已存在,已重命名为:" + renamedFile.getAbsolutePath()); } else { throw new RuntimeException("无法重命名已存在的文件:" + targetFile.getAbsolutePath()); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/utils/ExcelFillerUtil.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/utils/ExcelFillerUtil.java index bf8e187c0..cd8e05dfd 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/utils/ExcelFillerUtil.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/utils/ExcelFillerUtil.java @@ -1,5 +1,8 @@ package com.openhis.web.reportmanage.utils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -24,6 +27,7 @@ import java.util.Map; * @date 2025-08-25 */ public final class ExcelFillerUtil { + private static final Logger log = LoggerFactory.getLogger(ExcelFillerUtil.class); // 时间戳格式:年月日时分秒(确保文件名唯一) private static final SimpleDateFormat TIME_FORMATTER = new SimpleDateFormat("yyyyMMddHHmmss"); @@ -125,7 +129,7 @@ public final class ExcelFillerUtil { value = field.get(dto); // 获取字段值 } catch (NoSuchFieldException e) { // 如果字段不存在,输出警告信息 - System.err.println("DTO中不存在字段: " + fieldName); + log.error("DTO中不存在字段: " + fieldName); } Cell cell = setDate(dataRow.createCell(columnIndex), value, sheet, columnIndex); @@ -146,7 +150,7 @@ public final class ExcelFillerUtil { // 将字节流写入响应 response.getOutputStream().write(outputStream.toByteArray()); response.getOutputStream().flush(); - System.out.print("导出Excel完成"); + log.info("导出Excel完成"); } catch (IOException e) { System.out.printf("导出Excel失败:" + e.getMessage()); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpRequesPost.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpRequesPost.java index ef962da60..f6b69897e 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpRequesPost.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpRequesPost.java @@ -3,6 +3,9 @@ */ package com.openhis.web.tencentJH.utils.httpUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.alibaba.fastjson2.JSON; import org.apache.http.NameValuePair; import org.apache.http.client.config.RequestConfig; @@ -19,6 +22,7 @@ import java.util.Map; public class HttpRequesPost extends HttpReques { + private static final Logger log = LoggerFactory.getLogger(HttpRequesPost.class); public HttpRequesPost(String path, Map param, Map headers) { HttpPost httpPost = new HttpPost(path); @@ -43,7 +47,7 @@ public class HttpRequesPost extends HttpReques { } } } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + log.error("Exception occurred", e); } this.httpReques = httpPost; } @@ -74,7 +78,7 @@ public class HttpRequesPost extends HttpReques { StringEntity entity = new StringEntity(xml.toString(), "utf-8"); entity.setContentEncoding("UTF-8"); entity.setContentType("text/xml"); - System.out.println("----------xml:"+xml.toString()); + log.info("----------xml:"+xml.toString()); httpPost.setEntity(entity); } else if ("".equals(requestType) || requestType == null) { @@ -95,7 +99,7 @@ public class HttpRequesPost extends HttpReques { } } } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + log.error("Exception occurred", e); } this.httpReques = httpPost; } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/triageandqueuemanage/appservice/impl/TriageQueueAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/triageandqueuemanage/appservice/impl/TriageQueueAppServiceImpl.java index 6c9d553a2..f635c7e4c 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/triageandqueuemanage/appservice/impl/TriageQueueAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/triageandqueuemanage/appservice/impl/TriageQueueAppServiceImpl.java @@ -810,7 +810,7 @@ public class TriageQueueAppServiceImpl implements TriageQueueAppService { } catch (Exception e) { // SSE 推送失败不应该影响业务逻辑 - System.err.println("推送显示屏更新失败:" + e.getMessage()); + log.error("推送显示屏更新失败:" + e.getMessage()); } } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/controller/YbController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/controller/YbController.java index d559dbaab..2e342a3d6 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/controller/YbController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/controller/YbController.java @@ -3,6 +3,9 @@ */ package com.openhis.web.ybmanage.controller; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.alibaba.fastjson2.JSON; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.core.common.annotation.Anonymous; @@ -70,6 +73,7 @@ import java.util.stream.Collectors; @RestController @RequestMapping("/yb-request") public class YbController { + private static final Logger log = LoggerFactory.getLogger(YbController.class); @Autowired YbDao ybDao; @@ -184,7 +188,7 @@ public class YbController { currentRangeResults.add(info5301SpecialConditionResult); } } catch (ParseException e) { - e.printStackTrace(); // 处理日期解析异常 + log.error("Exception occurred", e); // 处理日期解析异常 } } List conditionDefinitions = null; @@ -247,7 +251,7 @@ public class YbController { Financial3201Param financial3201Param = ybDao.getFinancial3201Param(settlement3201WebParam); Result result = ybHttpUtils.reconcileGeneralLedger(financial3201Param); if (result.getCode().equals(CommonConstant.SC_OK_200)) { - // System.out.println(JSON.parseObject(JSON.toJSONString(result.getResult()))); + // log.info(JSON.parseObject(JSON.toJSONString(result.getResult()))); Financial3201Output financial3201Output = JSON.parseObject(JSON.toJSONString(result.getResult()), Financial3201Output.class); ybDao.saveReconcileGeneralLedger(financial3201Output, financial3201Param); @@ -293,7 +297,7 @@ public class YbController { Result result = ybHttpUtils.reconcileGeneralLedger(financial3201Param); if (result.getCode().equals(CommonConstant.SC_OK_200)) { - // System.out.println(JSON.parseObject(JSON.toJSONString(result.getResult()))); + // log.info(JSON.parseObject(JSON.toJSONString(result.getResult()))); Financial3201Output financial3201Output = JSON.parseObject(JSON.toJSONString(result.getResult()), Financial3201Output.class); ybDao.saveReconcileGeneralLedger(financial3201Output, financial3201Param); @@ -339,7 +343,7 @@ public class YbController { // for (Financial3202FileParam item : financial3202FileParams) { // // 假设每个实体都有toString()方法返回逗号分隔的属性 // // 或者你可以自定义获取属性的方式 - // System.out.println(item.toString()); + // log.info(item.toString()); // String line = item.getTxt(); // writer.write(line); // writer.newLine(); @@ -363,7 +367,7 @@ public class YbController { } writer.flush(); } - System.out.println(fileName); + log.info(fileName); // return R.ok("生成txt文件成功,文件名称:"+fileName); } @@ -424,7 +428,7 @@ public class YbController { } } } catch (IOException e) { - e.printStackTrace(); + log.error("Exception occurred", e); throw new ServiceException("IO异常,异常信息:" + e.getMessage()); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/service/impl/YbServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/service/impl/YbServiceImpl.java index 8cdc04c95..6b995246d 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/service/impl/YbServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/service/impl/YbServiceImpl.java @@ -1,5 +1,8 @@ package com.openhis.web.ybmanage.service.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.alibaba.fastjson.JSON; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -76,6 +79,7 @@ import java.util.stream.Collectors; */ @Service public class YbServiceImpl implements IYbService { + private static final Logger log = LoggerFactory.getLogger(YbServiceImpl.class); @Autowired private YbMapper ybMapper; @@ -1209,7 +1213,7 @@ public class YbServiceImpl implements IYbService { try { this.saveCatalog(fileName,dtoMap); } catch (IOException e) { - System.out.println("csv转换失败"); + log.info("csv转换失败"); throw new ServiceException("csv转换失败"); } } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/util/CsvHelperZipProcessor.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/util/CsvHelperZipProcessor.java index cde247fde..7a600cbb0 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/util/CsvHelperZipProcessor.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/util/CsvHelperZipProcessor.java @@ -1,5 +1,8 @@ package com.openhis.web.ybmanage.util; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.opencsv.bean.CsvToBean; import com.opencsv.bean.CsvToBeanBuilder; @@ -13,6 +16,7 @@ import java.util.zip.ZipInputStream; public class CsvHelperZipProcessor { + private static final Logger log = LoggerFactory.getLogger(CsvHelperZipProcessor.class); /** @@ -48,8 +52,8 @@ public class CsvHelperZipProcessor { throw new FileNotFoundException("ZIP文件不存在: " + zipFilePath); } - System.out.println("开始处理ZIP文件: " + zipFilePath); - System.out.println("目标实体类: " + entityClass.getSimpleName()); + log.info("开始处理ZIP文件: " + zipFilePath); + log.info("目标实体类: " + entityClass.getSimpleName()); try (FileInputStream fis = new FileInputStream(zipFile); ZipInputStream zis = new ZipInputStream(fis, StandardCharsets.UTF_8)) { @@ -61,7 +65,7 @@ public class CsvHelperZipProcessor { while ((entry = zis.getNextEntry()) != null) { if (!entry.isDirectory() && entry.getName().toLowerCase().endsWith(".txt")) { totalFiles++; - System.out.println("处理文件[" + totalFiles + "]: " + entry.getName()); + log.info("处理文件[" + totalFiles + "]: " + entry.getName()); // 关键修复:将ZIP条目内容读取到内存中 byte[] fileContent = readZipEntryContent(zis); @@ -70,12 +74,12 @@ public class CsvHelperZipProcessor { allRecords.addAll(fileRecords); totalRecords += fileRecords.size(); - System.out.println("文件 " + entry.getName() + " 解析了 " + fileRecords.size() + " 条记录"); + log.info("文件 " + entry.getName() + " 解析了 " + fileRecords.size() + " 条记录"); } // 不需要手动调用 zis.closeEntry(),try-with-resources会自动处理 } - System.out.println("处理完成: " + totalFiles + " 个文件, 总共 " + totalRecords + " 条记录"); + log.info("处理完成: " + totalFiles + " 个文件, 总共 " + totalRecords + " 条记录"); } // 这里会自动关闭 fis 和 zis // ==================== try-with-resources结束 ==================== @@ -129,10 +133,10 @@ public class CsvHelperZipProcessor { recordCount++; if (recordCount % 1000 == 0) { - System.out.println("已处理 " + recordCount + " 行"); + log.info("已处理 " + recordCount + " 行"); } } - System.out.println("文件处理完成,共 " + recordCount + " 行"); + log.info("文件处理完成,共 " + recordCount + " 行"); } else { // 批量处理 records = csvToBean.parse(); diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/util/YbEleParamBuilderUtil.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/util/YbEleParamBuilderUtil.java index 6652dd267..d84771fb1 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/util/YbEleParamBuilderUtil.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/util/YbEleParamBuilderUtil.java @@ -3,6 +3,9 @@ */ package com.openhis.web.ybmanage.util; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.core.common.exception.ServiceException; @@ -53,6 +56,7 @@ import java.util.*; */ @Component public class YbEleParamBuilderUtil { + private static final Logger log = LoggerFactory.getLogger(YbEleParamBuilderUtil.class); /********************* 业务实体服务 *******************/ @@ -103,7 +107,7 @@ public class YbEleParamBuilderUtil { public static BigDecimal calculateAge(Date birthDate, Date beginTime) { // 验证输入参数是否为空 if (Objects.isNull(birthDate)) { - System.out.println("出生年月日不能为空!"); + log.info("出生年月日不能为空!"); return null; } // 验证输入参数是否为空 @@ -138,7 +142,7 @@ public class YbEleParamBuilderUtil { public static String fileToBase64(String filePath) { File file = new File(filePath); if (!file.exists()) { - System.out.println("文件不存在!"); + log.info("文件不存在!"); return null; } @@ -149,13 +153,13 @@ public class YbEleParamBuilderUtil { fileInputStream.read(fileContent); return Base64.getEncoder().encodeToString(fileContent); } catch (IOException e) { - e.printStackTrace(); + log.error("Exception occurred", e); } finally { if (fileInputStream != null) { try { fileInputStream.close(); } catch (IOException e) { - e.printStackTrace(); + log.error("Exception occurred", e); } } } diff --git a/openhis-server-new/openhis-application/src/main/resources/application.yml b/openhis-server-new/openhis-application/src/main/resources/application.yml index 611681a53..6910f0d10 100755 --- a/openhis-server-new/openhis-application/src/main/resources/application.yml +++ b/openhis-server-new/openhis-application/src/main/resources/application.yml @@ -147,5 +147,17 @@ liteflow: enable: true #liteflow的banner打印是否开启,默认为true print-banner: false - - +# Actuator配置 +management: + endpoints: + web: + exposure: + include: health,info,metrics,prometheus + endpoint: + health: + show-details: always + health: + db: + enabled: true + redis: + enabled: true diff --git a/openhis-server-new/openhis-common/src/main/java/com/openhis/common/utils/IdCardAgeCalculator.java b/openhis-server-new/openhis-common/src/main/java/com/openhis/common/utils/IdCardAgeCalculator.java index 2f6d8ed07..8e9cbc081 100755 --- a/openhis-server-new/openhis-common/src/main/java/com/openhis/common/utils/IdCardAgeCalculator.java +++ b/openhis-server-new/openhis-common/src/main/java/com/openhis/common/utils/IdCardAgeCalculator.java @@ -1,5 +1,8 @@ package com.openhis.common.utils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.time.LocalDate; import java.time.Period; import java.time.format.DateTimeFormatter; @@ -13,6 +16,7 @@ import java.time.format.DateTimeParseException; * @Version 1.0 **/ public class IdCardAgeCalculator { + private static final Logger log = LoggerFactory.getLogger(IdCardAgeCalculator.class); /** * 根据身份证号计算年龄(支持15/18位) * @param idCard 身份证号 @@ -21,7 +25,7 @@ public class IdCardAgeCalculator { public static int calculateAge(String idCard) { // 1. 校验身份证号合法性(基础校验:长度、非空) if (!isValidIdCard(idCard)) { - System.out.println("身份证号格式非法!"); + log.info("身份证号格式非法!"); return -1; } @@ -33,7 +37,7 @@ public class IdCardAgeCalculator { try { birthDate = LocalDate.parse(birthDateStr, DateTimeFormatter.ofPattern("yyyyMMdd")); } catch (DateTimeParseException e) { - System.out.println("出生日期解析失败,身份证号可能非法!"); + log.info("出生日期解析失败,身份证号可能非法!"); return -1; } @@ -93,18 +97,18 @@ public class IdCardAgeCalculator { public static void main(String[] args) { // 测试1:18位身份证(出生日期2000-01-01,当前日期2024-05-20 → 年龄24) String idCard18 = "110101200001011234"; - System.out.println("18位身份证年龄:" + calculateAge(idCard18)); + log.info("18位身份证年龄:" + calculateAge(idCard18)); // 测试2:15位身份证(出生日期2000-01-01 → 15位表示为000101,补全后20000101) String idCard15 = "110101000101123"; - System.out.println("15位身份证年龄:" + calculateAge(idCard15)); + log.info("15位身份证年龄:" + calculateAge(idCard15)); // 测试3:未过生日的情况(出生日期2000-06-01,当前日期2024-05-20 → 年龄23) String idCardNotBirthday = "110101200006011234"; - System.out.println("未过生日的年龄:" + calculateAge(idCardNotBirthday)); + log.info("未过生日的年龄:" + calculateAge(idCardNotBirthday)); // 测试4:非法身份证号(长度错误) String idCardInvalid = "11010120000101123"; // 17位 - System.out.println("非法身份证年龄:" + calculateAge(idCardInvalid)); + log.info("非法身份证年龄:" + calculateAge(idCardInvalid)); } } diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/InvoiceSegmentServiceImpl.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/InvoiceSegmentServiceImpl.java index 48952474b..7467544ea 100755 --- a/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/InvoiceSegmentServiceImpl.java +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/InvoiceSegmentServiceImpl.java @@ -1,5 +1,8 @@ package com.openhis.administration.service.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.openhis.administration.domain.InvoiceSegment; @@ -18,6 +21,7 @@ import java.util.List; */ @Service public class InvoiceSegmentServiceImpl implements IInvoiceSegmentService { + private static final Logger log = LoggerFactory.getLogger(InvoiceSegmentServiceImpl.class); @Autowired private InvoiceSegmentMapper invoiceSegmentMapper; @@ -49,57 +53,57 @@ public class InvoiceSegmentServiceImpl implements IInvoiceSegmentService { */ @Override public int updateInvoiceSegment(InvoiceSegment invoiceSegment) { - System.out.println("===== 开始更新发票段 ===="); - System.out.println("传入的invoiceSegment对象: id=" + invoiceSegment.getId() + ", segmentId=" + invoiceSegment.getSegmentId()); + log.info("===== 开始更新发票段 ===="); + log.info("传入的invoiceSegment对象: id=" + invoiceSegment.getId() + ", segmentId=" + invoiceSegment.getSegmentId()); // 确保必填字段存在 if (invoiceSegment.getBeginNumber() == null || invoiceSegment.getEndNumber() == null) { - System.out.println("错误: beginNumber或endNumber为空,无法更新"); + log.info("错误: beginNumber或endNumber为空,无法更新"); return 0; } // 先尝试直接通过id更新 int rows = invoiceSegmentMapper.updateById(invoiceSegment); - System.out.println("直接通过id更新结果: 影响行数=" + rows); + log.info("直接通过id更新结果: 影响行数=" + rows); // 如果直接更新失败,尝试多种查询策略 if (rows == 0) { // 策略1: 使用传入的id作为segmentId查询(处理前端传入的keyId作为segment_id的情况) if (invoiceSegment.getId() != null) { - System.out.println("策略1: 尝试将id=" + invoiceSegment.getId() + "作为segment_id查询"); + log.info("策略1: 尝试将id=" + invoiceSegment.getId() + "作为segment_id查询"); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(InvoiceSegment::getSegmentId, invoiceSegment.getId()); queryWrapper.eq(InvoiceSegment::getDeleteFlag, "0"); InvoiceSegment existingSegment = invoiceSegmentMapper.selectOne(queryWrapper); if (existingSegment != null) { - System.out.println("策略1成功: 找到匹配的记录,原始id=" + existingSegment.getId() + ", segmentId=" + existingSegment.getSegmentId()); + log.info("策略1成功: 找到匹配的记录,原始id=" + existingSegment.getId() + ", segmentId=" + existingSegment.getSegmentId()); invoiceSegment.setId(existingSegment.getId()); invoiceSegment.setSegmentId(existingSegment.getSegmentId()); // 确保segmentId正确 rows = invoiceSegmentMapper.updateById(invoiceSegment); - System.out.println("更新结果: 影响行数=" + rows); + log.info("更新结果: 影响行数=" + rows); } } // 策略2: 使用传入的segmentId字段查询 if (rows == 0 && invoiceSegment.getSegmentId() != null) { - System.out.println("策略2: 尝试使用segmentId=" + invoiceSegment.getSegmentId() + "查询"); + log.info("策略2: 尝试使用segmentId=" + invoiceSegment.getSegmentId() + "查询"); LambdaQueryWrapper segmentIdWrapper = new LambdaQueryWrapper<>(); segmentIdWrapper.eq(InvoiceSegment::getSegmentId, invoiceSegment.getSegmentId()); segmentIdWrapper.eq(InvoiceSegment::getDeleteFlag, "0"); InvoiceSegment existingSegment = invoiceSegmentMapper.selectOne(segmentIdWrapper); if (existingSegment != null) { - System.out.println("策略2成功: 找到匹配的记录,原始id=" + existingSegment.getId() + ", segmentId=" + existingSegment.getSegmentId()); + log.info("策略2成功: 找到匹配的记录,原始id=" + existingSegment.getId() + ", segmentId=" + existingSegment.getSegmentId()); invoiceSegment.setId(existingSegment.getId()); rows = invoiceSegmentMapper.updateById(invoiceSegment); - System.out.println("更新结果: 影响行数=" + rows); + log.info("更新结果: 影响行数=" + rows); } } // 策略3: 基于业务键查询(beginNumber和endNumber通常是唯一的业务组合) if (rows == 0) { - System.out.println("策略3: 尝试根据业务键查询,beginNumber=" + invoiceSegment.getBeginNumber() + ", endNumber=" + invoiceSegment.getEndNumber()); + log.info("策略3: 尝试根据业务键查询,beginNumber=" + invoiceSegment.getBeginNumber() + ", endNumber=" + invoiceSegment.getEndNumber()); LambdaQueryWrapper businessWrapper = new LambdaQueryWrapper<>(); businessWrapper.eq(InvoiceSegment::getBeginNumber, invoiceSegment.getBeginNumber()); businessWrapper.eq(InvoiceSegment::getEndNumber, invoiceSegment.getEndNumber()); @@ -107,27 +111,27 @@ public class InvoiceSegmentServiceImpl implements IInvoiceSegmentService { InvoiceSegment existingSegment = invoiceSegmentMapper.selectOne(businessWrapper); if (existingSegment != null) { - System.out.println("策略3成功: 找到匹配的记录,原始id=" + existingSegment.getId() + ", segmentId=" + existingSegment.getSegmentId()); + log.info("策略3成功: 找到匹配的记录,原始id=" + existingSegment.getId() + ", segmentId=" + existingSegment.getSegmentId()); invoiceSegment.setId(existingSegment.getId()); invoiceSegment.setSegmentId(existingSegment.getSegmentId()); // 确保segmentId正确 rows = invoiceSegmentMapper.updateById(invoiceSegment); - System.out.println("更新结果: 影响行数=" + rows); + log.info("更新结果: 影响行数=" + rows); } } // 策略4: 如果是特定场景下的已知ID问题,添加特殊处理逻辑 if (rows == 0) { - System.out.println("策略4: 检查是否需要特殊处理"); + log.info("策略4: 检查是否需要特殊处理"); // 检查是否是之前日志中提到的ID问题 if ("1990329963367977000".equals(invoiceSegment.getSegmentId() + "")) { - System.out.println("检测到特殊ID模式,尝试替代查询"); + log.info("检测到特殊ID模式,尝试替代查询"); // 这里可以添加更具体的替代查询逻辑 } } // 增强调试信息:显示当前表中所有可能相关的记录 if (rows == 0) { - System.out.println("所有查询策略都失败了,显示表中相关记录:"); + log.info("所有查询策略都失败了,显示表中相关记录:"); // 查询条件可以根据实际情况调整 LambdaQueryWrapper debugWrapper = new LambdaQueryWrapper<>(); debugWrapper.eq(InvoiceSegment::getDeleteFlag, "0"); @@ -136,14 +140,14 @@ public class InvoiceSegmentServiceImpl implements IInvoiceSegmentService { List segments = invoiceSegmentMapper.selectList(debugWrapper); for (InvoiceSegment seg : segments) { - System.out.println("记录: id=" + seg.getId() + ", segmentId=" + seg.getSegmentId() + ", beginNumber=" + seg.getBeginNumber() + ", endNumber=" + seg.getEndNumber()); + log.info("记录: id=" + seg.getId() + ", segmentId=" + seg.getSegmentId() + ", beginNumber=" + seg.getBeginNumber() + ", endNumber=" + seg.getEndNumber()); } - System.out.println("提示: 请检查前端传递的ID是否与数据库中的记录匹配"); + log.info("提示: 请检查前端传递的ID是否与数据库中的记录匹配"); } } - System.out.println("===== 更新发票段结束 ==== 最终结果: " + (rows > 0 ? "成功" : "失败")); + log.info("===== 更新发票段结束 ==== 最终结果: " + (rows > 0 ? "成功" : "失败")); return rows; } @@ -152,9 +156,9 @@ public class InvoiceSegmentServiceImpl implements IInvoiceSegmentService { */ @Override public int deleteInvoiceSegmentByIds(Long[] ids) { - System.out.println("删除发票段IDs: " + java.util.Arrays.toString(ids)); + log.info("删除发票段IDs: " + java.util.Arrays.toString(ids)); List idList = java.util.Arrays.asList(ids); - System.out.println("删除ID列表: " + idList); + log.info("删除ID列表: " + idList); // 检查记录是否存在且未被删除 - 先尝试通过id查找 LambdaQueryWrapper checkWrapper = new LambdaQueryWrapper<>(); @@ -162,32 +166,32 @@ public class InvoiceSegmentServiceImpl implements IInvoiceSegmentService { checkWrapper.eq(InvoiceSegment::getDeleteFlag, "0"); // 检查未被删除的记录 List existingRecords = invoiceSegmentMapper.selectList(checkWrapper); - System.out.println("通过id检查到的未删除记录数: " + existingRecords.size()); + log.info("通过id检查到的未删除记录数: " + existingRecords.size()); // 如果通过id没有找到记录,尝试通过segment_id查找 if (existingRecords.isEmpty()) { - System.out.println("通过id未找到记录,尝试通过segment_id查找"); + log.info("通过id未找到记录,尝试通过segment_id查找"); LambdaQueryWrapper segmentIdWrapper = new LambdaQueryWrapper<>(); segmentIdWrapper.in(InvoiceSegment::getSegmentId, idList); segmentIdWrapper.eq(InvoiceSegment::getDeleteFlag, "0"); existingRecords = invoiceSegmentMapper.selectList(segmentIdWrapper); - System.out.println("通过segment_id检查到的未删除记录数: " + existingRecords.size()); + log.info("通过segment_id检查到的未删除记录数: " + existingRecords.size()); // 如果通过segment_id找到了记录,使用这些记录的id进行删除 if (!existingRecords.isEmpty()) { List actualIds = existingRecords.stream() .map(InvoiceSegment::getId) .collect(java.util.stream.Collectors.toList()); - System.out.println("使用实际id列表进行删除: " + actualIds); + log.info("使用实际id列表进行删除: " + actualIds); int rows = invoiceSegmentMapper.deleteBatchIds(actualIds); - System.out.println("删除影响行数: " + rows); + log.info("删除影响行数: " + rows); return rows; } } // 直接通过id删除 int rows = invoiceSegmentMapper.deleteBatchIds(idList); - System.out.println("删除影响行数: " + rows); + log.info("删除影响行数: " + rows); return rows; } diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/OutpatientNoSegmentServiceImpl.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/OutpatientNoSegmentServiceImpl.java index a89ada955..56980bd4d 100755 --- a/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/OutpatientNoSegmentServiceImpl.java +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/OutpatientNoSegmentServiceImpl.java @@ -1,5 +1,8 @@ package com.openhis.administration.service.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.openhis.administration.domain.OutpatientNoSegment; @@ -20,6 +23,7 @@ import java.util.regex.Pattern; */ @Service public class OutpatientNoSegmentServiceImpl implements IOutpatientNoSegmentService { + private static final Logger log = LoggerFactory.getLogger(OutpatientNoSegmentServiceImpl.class); @Autowired private OutpatientNoSegmentMapper outpatientNoSegmentMapper; @@ -76,27 +80,27 @@ public class OutpatientNoSegmentServiceImpl implements IOutpatientNoSegmentServi */ @Override public OutpatientNoSegment getById(Long id) { - System.out.println("=== 查询门诊号码段开始 ==="); - System.out.println("查询ID: " + id); - System.out.println("ID类型: " + (id != null ? id.getClass().getName() : "null")); - System.out.println("ID值(字符串): " + String.valueOf(id)); + log.info("=== 查询门诊号码段开始 ==="); + log.info("查询ID: " + id); + log.info("ID类型: " + (id != null ? id.getClass().getName() : "null")); + log.info("ID值(字符串): " + String.valueOf(id)); // 使用 selectById 查询(会自动过滤 delete_flag = '1' 的记录) OutpatientNoSegment segment = outpatientNoSegmentMapper.selectById(id); if (segment != null) { - System.out.println("查询成功 - 找到记录:"); - System.out.println(" - 记录ID: " + segment.getId()); - System.out.println(" - 操作员ID: " + segment.getOperatorId()); - System.out.println(" - 起始号码: " + segment.getStartNo()); - System.out.println(" - 终止号码: " + segment.getEndNo()); - System.out.println(" - 使用号码: " + segment.getUsedNo()); + log.info("查询成功 - 找到记录:"); + log.info(" - 记录ID: " + segment.getId()); + log.info(" - 操作员ID: " + segment.getOperatorId()); + log.info(" - 起始号码: " + segment.getStartNo()); + log.info(" - 终止号码: " + segment.getEndNo()); + log.info(" - 使用号码: " + segment.getUsedNo()); } else { - System.out.println("查询失败 - 未找到记录"); - System.out.println("可能原因:"); - System.out.println(" 1. 记录不存在"); - System.out.println(" 2. 记录已被软删除(delete_flag = '1')"); - System.out.println(" 3. ID 不匹配"); + log.info("查询失败 - 未找到记录"); + log.info("可能原因:"); + log.info(" 1. 记录不存在"); + log.info(" 2. 记录已被软删除(delete_flag = '1')"); + log.info(" 3. ID 不匹配"); // 尝试直接查询数据库(包括已删除的记录)来验证记录是否存在 try { @@ -106,12 +110,12 @@ public class OutpatientNoSegmentServiceImpl implements IOutpatientNoSegmentServi // 如果需要查询已删除的记录,需要使用原生 SQL 或禁用逻辑删除 OutpatientNoSegment segmentWithDeleted = outpatientNoSegmentMapper.selectOne(queryWrapper); if (segmentWithDeleted != null) { - System.out.println("使用 LambdaQueryWrapper 查询结果: 找到记录,ID=" + segmentWithDeleted.getId()); + log.info("使用 LambdaQueryWrapper 查询结果: 找到记录,ID=" + segmentWithDeleted.getId()); } else { - System.out.println("使用 LambdaQueryWrapper 查询结果: 未找到记录"); + log.info("使用 LambdaQueryWrapper 查询结果: 未找到记录"); } } catch (Exception e) { - System.out.println("使用 LambdaQueryWrapper 查询时出错: " + e.getMessage()); + log.info("使用 LambdaQueryWrapper 查询时出错: " + e.getMessage()); } // 尝试查询所有记录(不限制 delete_flag)来验证 ID 是否存在 @@ -121,10 +125,10 @@ public class OutpatientNoSegmentServiceImpl implements IOutpatientNoSegmentServi LambdaQueryWrapper allQuery = new LambdaQueryWrapper<>(); // 查询所有未删除的记录 List allSegments = outpatientNoSegmentMapper.selectList(allQuery); - System.out.println("数据库中所有未删除的记录数: " + allSegments.size()); - System.out.println("所有记录的 ID 列表:"); + log.info("数据库中所有未删除的记录数: " + allSegments.size()); + log.info("所有记录的 ID 列表:"); for (OutpatientNoSegment seg : allSegments) { - System.out.println(" - ID: " + seg.getId() + " (类型: " + seg.getId().getClass().getName() + ")"); + log.info(" - ID: " + seg.getId() + " (类型: " + seg.getId().getClass().getName() + ")"); // 检查是否有接近的 ID(可能是精度问题) if (seg.getId() != null) { String segIdStr = String.valueOf(seg.getId()); @@ -132,16 +136,16 @@ public class OutpatientNoSegmentServiceImpl implements IOutpatientNoSegmentServi if (segIdStr.length() == searchIdStr.length() && segIdStr.substring(0, Math.min(10, segIdStr.length())).equals( searchIdStr.substring(0, Math.min(10, searchIdStr.length())))) { - System.out.println(" 警告:发现相似的 ID!"); + log.info(" 警告:发现相似的 ID!"); } } } } catch (Exception e) { - System.out.println("查询所有记录时出错: " + e.getMessage()); + log.info("查询所有记录时出错: " + e.getMessage()); } } - System.out.println("=== 查询门诊号码段结束 ==="); + log.info("=== 查询门诊号码段结束 ==="); return segment; } diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/impl/LabActivityDefinitionServiceImpl.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/impl/LabActivityDefinitionServiceImpl.java index 00f74ca44..ea118544b 100755 --- a/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/impl/LabActivityDefinitionServiceImpl.java +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/impl/LabActivityDefinitionServiceImpl.java @@ -53,7 +53,8 @@ public class LabActivityDefinitionServiceImpl tenantId = loginUser.getTenantId() != null ? loginUser.getTenantId() : 1; } } catch (Exception ignored) { - } + // intentionally ignored + } entity.setCreateBy(createBy); entity.setTenantId(tenantId); if (entity.getCreateTime() == null) { diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/yb/service/YbDao.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/yb/service/YbDao.java index 99a0d5f45..7f5e47de5 100755 --- a/openhis-server-new/openhis-domain/src/main/java/com/openhis/yb/service/YbDao.java +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/yb/service/YbDao.java @@ -3,6 +3,9 @@ */ package com.openhis.yb.service; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.alibaba.fastjson2.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -71,6 +74,7 @@ import java.util.stream.Collectors; */ @Service public class YbDao { + private static final Logger log = LoggerFactory.getLogger(YbDao.class); /** * ****************************** 业务服务 ********************************** @@ -1388,12 +1392,12 @@ public class YbDao { // 分组处理 // for (PaymentDecDetailUniAccountDto paymentDecDetailUniAccountDto : paymentDecDetailUniAccountDtos) { // if(StringUtils.isEmpty(paymentDecDetailUniAccountDto.getContractNo())){ - // System.out.println(paymentDecDetailUniAccountDto.getId()); + // log.info(paymentDecDetailUniAccountDto.getId()); // } // } for (PaymentDecDetailUniAccountDto paymentDecDetailUniAccountDto : paymentDecDetailUniAccountDtos) { if (StringUtils.isEmpty(paymentDecDetailUniAccountDto.getContractNo())) { - System.out.println(paymentDecDetailUniAccountDto.getId() + "payment主键:" + log.info(paymentDecDetailUniAccountDto.getId() + "payment主键:" + paymentDecDetailUniAccountDto.getReconciliationId()); } } @@ -1577,9 +1581,9 @@ public class YbDao { // 该部分代码为辅助调试时使用,无任何业务处理 start // for (PaymentRecDetail paymentRecDetail : paymentRecDetailList) { // if (StringUtils.isEmpty(paymentRecDetail.getPayTransText())) { - // System.out.println("*******************************************************************"); - // System.out.println(paymentRecDetail.getId() + "主键:" + paymentRecDetail.getReconciliationId()); - // System.out.println(JSON.toJSONString(paymentRecDetail)); + // log.info("*******************************************************************"); + // log.info(paymentRecDetail.getId() + "主键:" + paymentRecDetail.getReconciliationId()); + // log.info(JSON.toJSONString(paymentRecDetail)); // // throw new ServiceException("paymentDetail无返回交易码"); // } // } @@ -1728,7 +1732,7 @@ public class YbDao { // 该部分代码为辅助调试时使用,无任何业务处理 start for (PaymentRecDetail paymentRecDetail : paymentRecDetailList) { if (StringUtils.isEmpty(paymentRecDetail.getPayTransText())) { - System.out.println(JSON.toJSONString(paymentRecDetail)); + log.info(JSON.toJSONString(paymentRecDetail)); throw new ServiceException("paymentDetail无返回交易码"); } } @@ -1906,7 +1910,7 @@ public class YbDao { // 该部分代码为辅助调试时使用,无任何业务处理 start for (PaymentRecDetail paymentRecDetail : paymentRecDetailList) { if (StringUtils.isEmpty(paymentRecDetail.getPayTransNo())) { - System.out.println(JSON.toJSONString(paymentRecDetail)); + log.info(JSON.toJSONString(paymentRecDetail)); throw new ServiceException("paymentDetail无返回交易码"); } } diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/yb/service/YbHttpUtils.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/yb/service/YbHttpUtils.java index 3c5d80205..f57fa97b4 100755 --- a/openhis-server-new/openhis-domain/src/main/java/com/openhis/yb/service/YbHttpUtils.java +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/yb/service/YbHttpUtils.java @@ -81,20 +81,20 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println(JSON.toJSONString(resultString)); + logger.info(JSON.toJSONString(resultString)); logger.info("【1101】返回参数:" + resultString); // 参数处理 ObjectMapper mapper = new ObjectMapper(); try { result = mapper.readValue(resultString, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(JSON.toJSONString(result.getResult())); + logger.info(JSON.toJSONString(result.getResult())); perinfo = parseObject(JSON.toJSONString(result.getResult()), Info1101Output.class); } else { throw new ServiceException(result.getMessage()); @@ -112,19 +112,19 @@ public class YbHttpUtils { if (StringUtils.isEmpty(s)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println(JSON.toJSONString(s)); + logger.info(JSON.toJSONString(s)); logger.info("【2201】返回参数:" + s); // 参数处理 ObjectMapper mapper = new ObjectMapper(); try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(JSON.toJSONString(result.getResult())); + logger.info(JSON.toJSONString(result.getResult())); clinicReg2201Output = parseObject(JSON.toJSONString(result.getResult()), ClinicReg2201Output.class); } else { throw new ServiceException(result.getMessage()); @@ -142,19 +142,19 @@ public class YbHttpUtils { if (StringUtils.isEmpty(s)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println(JSON.toJSONString(s)); + logger.info(JSON.toJSONString(s)); logger.info("【2202】返回参数:" + JSON.toJSONString(s)); // 参数处理 ObjectMapper mapper = new ObjectMapper(); try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(JSON.toJSONString(result.getResult())); + logger.info(JSON.toJSONString(result.getResult())); clinicReg2201Output = parseObject(JSON.toJSONString(result.getResult()), ClinicReg2201Output.class); } else { throw new ServiceException(result.getMessage()); @@ -172,20 +172,20 @@ public class YbHttpUtils { if (StringUtils.isEmpty(s)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println(JSON.toJSONString(s)); + logger.info(JSON.toJSONString(s)); logger.info("【2204】返回参数:" + s); // 参数处理 ObjectMapper mapper = new ObjectMapper(); try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(JSON.toJSONString(result.getResult())); + logger.info(JSON.toJSONString(result.getResult())); clinicFeedetail2204Result = parseObject(JSON.toJSONString(result.getResult()), Clinic2204OrderResult.class); } else { throw new ServiceException(result.getMessage()); @@ -206,20 +206,20 @@ public class YbHttpUtils { if (StringUtils.isEmpty(s)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【2206】返回参数:" + JSON.toJSONString(s)); + logger.info("【2206】返回参数:" + JSON.toJSONString(s)); logger.info(s); // 参数处理 ObjectMapper mapper = new ObjectMapper(); try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(JSON.toJSONString(result.getResult())); + logger.info(JSON.toJSONString(result.getResult())); clinic2206OrderResult = parseObject(JSON.toJSONString(result.getResult()), Clinic2206OrderOutput.class); } else { throw new ServiceException(result.getMessage()); @@ -239,20 +239,20 @@ public class YbHttpUtils { if (StringUtils.isEmpty(s)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println(JSON.toJSONString(s)); + logger.info(JSON.toJSONString(s)); logger.info("【2207】返回参数:" + s); // 参数处理 ObjectMapper mapper = new ObjectMapper(); try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(JSON.toJSONString(result.getResult())); + logger.info(JSON.toJSONString(result.getResult())); clinic2206OrderResult = parseObject(JSON.toJSONString(result.getResult()), Clinic2207OrderModel.class); } else { throw new ServiceException(result.getMessage()); @@ -268,7 +268,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println(JSON.toJSONString(resultString)); + logger.info(JSON.toJSONString(resultString)); logger.info("【9001】返回参数:" + resultString); // 参数处理 ObjectMapper mapper = new ObjectMapper(); @@ -276,13 +276,13 @@ public class YbHttpUtils { try { result = mapper.readValue(resultString, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(JSON.toJSONString(result.getResult())); + logger.info(JSON.toJSONString(result.getResult())); sign = parseObject(JSON.toJSONString(result.getResult()), Sign9001Result.class); } else { throw new ServiceException(result.getMessage()); @@ -301,14 +301,14 @@ public class YbHttpUtils { if (StringUtils.isEmpty(s)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println(JSON.toJSONString(s)); + logger.info(JSON.toJSONString(s)); logger.info(s); // 参数处理 ObjectMapper mapper = new ObjectMapper(); try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } if (result == null) { @@ -331,20 +331,20 @@ public class YbHttpUtils { if (StringUtils.isEmpty(s)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println(JSON.toJSONString(s)); + logger.info(JSON.toJSONString(s)); logger.info("【2208】返回参数:" + s); // 参数处理 ObjectMapper mapper = new ObjectMapper(); try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(JSON.toJSONString(result.getResult())); + logger.info(JSON.toJSONString(result.getResult())); clinicOrder2206Result = parseObject(JSON.toJSONString(result.getResult()), Clinic2208UnSetlInfoOutput.class); } else { @@ -362,7 +362,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(s)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println(JSON.toJSONString(s)); + logger.info(JSON.toJSONString(s)); logger.info("【3301】返回参数:" + s); // 参数处理 ObjectMapper mapper = new ObjectMapper(); @@ -370,7 +370,7 @@ public class YbHttpUtils { try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return result; } @@ -382,7 +382,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(s)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println(JSON.toJSONString(s)); + logger.info(JSON.toJSONString(s)); logger.info("【3302】返回参数:" + s); // 参数处理 ObjectMapper mapper = new ObjectMapper(); @@ -390,7 +390,7 @@ public class YbHttpUtils { try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return result; } @@ -414,7 +414,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(s)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println(JSON.toJSONString(s)); + logger.info(JSON.toJSONString(s)); logger.info(s); // 参数处理 ObjectMapper mapper = new ObjectMapper(); @@ -422,7 +422,7 @@ public class YbHttpUtils { try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return result; } @@ -434,7 +434,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(s)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println(JSON.toJSONString(s)); + logger.info(JSON.toJSONString(s)); logger.info(s); // 参数处理 ObjectMapper mapper = new ObjectMapper(); @@ -442,7 +442,7 @@ public class YbHttpUtils { try { result = mapper.readValue(s, FinancialSettlement3202Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return result; } @@ -455,7 +455,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(s)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println(JSON.toJSONString(s)); + logger.info(JSON.toJSONString(s)); logger.info(s); // 参数处理 ObjectMapper mapper = new ObjectMapper(); @@ -463,7 +463,7 @@ public class YbHttpUtils { try { result = mapper.readValue(s, List.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return result; } @@ -492,7 +492,7 @@ public class YbHttpUtils { try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return result; } @@ -510,7 +510,7 @@ public class YbHttpUtils { try { result = mapper.readValue(s, Clearing3205AResult.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return result; } @@ -528,7 +528,7 @@ public class YbHttpUtils { try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return result; } @@ -546,7 +546,7 @@ public class YbHttpUtils { try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return result; } @@ -564,7 +564,7 @@ public class YbHttpUtils { try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return result; } @@ -582,7 +582,7 @@ public class YbHttpUtils { try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return result; } @@ -600,7 +600,7 @@ public class YbHttpUtils { try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return result; } @@ -618,7 +618,7 @@ public class YbHttpUtils { try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return result; } @@ -636,7 +636,7 @@ public class YbHttpUtils { try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return result; } @@ -654,14 +654,14 @@ public class YbHttpUtils { try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } // 转业务参数 MedicalInventory3511Output medicalInventory3511Output = null; if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 401) { - System.out.println(JSON.toJSONString(result.getResult())); + logger.info(JSON.toJSONString(result.getResult())); medicalInventory3511Output = parseObject(JSON.toJSONString(result.getResult()), MedicalInventory3511Output.class); } else { @@ -683,7 +683,7 @@ public class YbHttpUtils { try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return result; } @@ -701,7 +701,7 @@ public class YbHttpUtils { try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return result; } @@ -719,7 +719,7 @@ public class YbHttpUtils { try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return result; } @@ -737,7 +737,7 @@ public class YbHttpUtils { try { result = mapper.readValue(s, Result.class); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return result; } @@ -772,7 +772,7 @@ public class YbHttpUtils { } resultString = EntityUtils.toString(response.getEntity(), "utf-8"); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); throw new ServiceException("Http请求异常,请稍后再试。"); } finally { if (response != null) { @@ -794,7 +794,7 @@ public class YbHttpUtils { String resultString = httpPost(SecurityUtils.getLoginUser().getOptionJson().getString("ybUrl") + "/queryYbCatalogue", catalogue1312QueryParam, null); - // System.out.println("--------1312resultString-------------" + resultString); + // logger.info("--------1312resultString-------------" + resultString); // 1. 解析外层 JSON ObjectMapper mapper = new ObjectMapper(); mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE); // 启用 Snake Case 自动映射 @@ -805,7 +805,7 @@ public class YbHttpUtils { outputList = mapper.readValue(resultStr, new TypeReference>() { }); } catch (JsonProcessingException e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return outputList; @@ -846,11 +846,11 @@ public class YbHttpUtils { response = restTemplate.postForEntity( SecurityUtils.getLoginUser().getOptionJson().getString("ybUrl") + "/file-up2", new HttpEntity<>(body, headers), String.class); - System.out.println(JSON.toJSONString(response)); + logger.info(JSON.toJSONString(response)); // 清理临时文件 // Files.deleteIfExists(tempFile); } catch (Exception e) { - e.printStackTrace(); + logger.error("Exception occurred", e); } return response; @@ -878,7 +878,7 @@ public class YbHttpUtils { // try { // String resultString = httpPost(SecurityUtils.getLoginUser().getOptionJson().getString("ybUrl") + "/file-up2", // file9101Param,null); - // // System.out.println("--------1312resultString-------------" + resultString); + // // logger.info("--------1312resultString-------------" + resultString); // // 1. 解析外层 JSON // ObjectMapper mapper = new ObjectMapper(); // mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE); // 启用 Snake Case 自动映射 @@ -886,20 +886,20 @@ public class YbHttpUtils { // try { // result = mapper.readValue(resultString, Result.class); // } catch (Exception e) { - // e.printStackTrace(); + // logger.error("Exception occurred", e); // } // // if (result == null) { // throw new ServiceException("未接收到医保返回参数"); // } else if (result.getCode() == 200) { - // System.out.println(JSON.toJSONString(result.getResult())); + // logger.info(JSON.toJSONString(result.getResult())); // fileResult = JSON.parseObject(JSON.toJSONString(result.getResult()), FileResult.class); // } else { // throw new ServiceException(result.getMessage()); // } // return fileResult; // }catch (Exception e){ - // e.printStackTrace(); + // logger.error("Exception occurred", e); // } // return fileResult; } @@ -916,7 +916,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【3101】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【3101】返回参数:" + JSON.toJSONString(resultString)); logger.info("【3101】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -928,7 +928,7 @@ public class YbHttpUtils { if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(JSON.toJSONString(result.getResult())); + logger.info(JSON.toJSONString(result.getResult())); return parseObject(JSON.toJSONString(result.getResult()), Yb3101OutputResult.class); } else { throw new ServiceException(result.getMessage()); @@ -946,7 +946,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【3103】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【3103】返回参数:" + JSON.toJSONString(resultString)); logger.info("【3103】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -958,7 +958,7 @@ public class YbHttpUtils { if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(JSON.toJSONString(result.getResult())); + logger.info(JSON.toJSONString(result.getResult())); } else { throw new ServiceException(result.getMessage()); } @@ -971,7 +971,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【2301】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【2301】返回参数:" + JSON.toJSONString(resultString)); logger.info("【2301】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -985,7 +985,7 @@ public class YbHttpUtils { } else if (result.getCode() == 200) { List yb2301OutputResults = new ArrayList<>(); JSONObject jsonObject = parseObject(String.valueOf(result.getResult())); - System.out.println(JSON.toJSONString(result.getResult())); + logger.info(JSON.toJSONString(result.getResult())); JSONArray jsonArray = jsonObject.getJSONArray("result"); for (Object o : jsonArray) { yb2301OutputResults.add(JSON.parseObject(String.valueOf(o), Yb2301OutputResult.class)); @@ -1003,7 +1003,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【2303】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【2303】返回参数:" + JSON.toJSONString(resultString)); logger.info("【2303】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -1028,7 +1028,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【2304】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【2304】返回参数:" + JSON.toJSONString(resultString)); logger.info("【2304】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -1061,7 +1061,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【2305】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【2305】返回参数:" + JSON.toJSONString(resultString)); logger.info("【2305】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -1094,7 +1094,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【5205】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【5205】返回参数:" + JSON.toJSONString(resultString)); logger.info("【5205】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -1103,7 +1103,7 @@ public class YbHttpUtils { if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(result.getResult().toString()); + logger.info(result.getResult().toString()); return JSON.parseArray(result.getResult().toString(), Yb5205OutputSpecialDisease.class); } else { throw new ServiceException(result.getMessage()); @@ -1126,7 +1126,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【" + catalogFileInput.getAddress() + "】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【" + catalogFileInput.getAddress() + "】返回参数:" + JSON.toJSONString(resultString)); logger.info("【" + catalogFileInput.getAddress() + "】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -1139,7 +1139,7 @@ public class YbHttpUtils { if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(result.getResult().toString()); + logger.info(result.getResult().toString()); return JSON.parseObject(JSON.toJSONString(result.getResult()), FileResult.class); } else { return new FileResult().setErrMsg(result.getMessage()); @@ -1158,7 +1158,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【9102】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【9102】返回参数:" + JSON.toJSONString(resultString)); logger.info("【9102】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -1167,7 +1167,7 @@ public class YbHttpUtils { if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(result.getResult().toString()); + logger.info(result.getResult().toString()); return result.getResult().toString(); } else { throw new ServiceException(result.getMessage()); @@ -1191,7 +1191,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【2401】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【2401】返回参数:" + JSON.toJSONString(resultString)); logger.info("【2401】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -1200,7 +1200,7 @@ public class YbHttpUtils { if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(result.getResult().toString()); + logger.info(result.getResult().toString()); return JSON.parseObject(result.getResult().toString(), InpatientReg.class); } else { throw new ServiceException(result.getMessage()); @@ -1224,7 +1224,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【2404】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【2404】返回参数:" + JSON.toJSONString(resultString)); logger.info("【2404】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -1233,7 +1233,7 @@ public class YbHttpUtils { if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(result.getResult().toString()); + logger.info(result.getResult().toString()); } else { throw new ServiceException(result.getMessage()); } @@ -1257,7 +1257,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【2402】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【2402】返回参数:" + JSON.toJSONString(resultString)); logger.info("【2402】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -1266,7 +1266,7 @@ public class YbHttpUtils { if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(result.getResult().toString()); + logger.info(result.getResult().toString()); return JSON.parseObject(result.getResult().toString(), Yb2402InputParam.class); } else { throw new ServiceException(result.getMessage()); @@ -1290,7 +1290,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【2404】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【2404】返回参数:" + JSON.toJSONString(resultString)); logger.info("【2404】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -1299,7 +1299,7 @@ public class YbHttpUtils { if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(result.getResult().toString()); + logger.info(result.getResult().toString()); } else { throw new ServiceException(result.getMessage()); } @@ -1322,7 +1322,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【2405】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【2405】返回参数:" + JSON.toJSONString(resultString)); logger.info("【2405】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -1331,7 +1331,7 @@ public class YbHttpUtils { if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(result.getResult().toString()); + logger.info(result.getResult().toString()); return; } else { throw new ServiceException(result.getMessage()); @@ -1348,7 +1348,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【4401】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【4401】返回参数:" + JSON.toJSONString(resultString)); logger.info("【4401】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -1357,7 +1357,7 @@ public class YbHttpUtils { if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(result.getResult().toString()); + logger.info(result.getResult().toString()); return; } else { throw new ServiceException(result.getMessage()); @@ -1380,7 +1380,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【4401】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【4401】返回参数:" + JSON.toJSONString(resultString)); logger.info("【4401】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -1389,7 +1389,7 @@ public class YbHttpUtils { if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(result.getResult().toString()); + logger.info(result.getResult().toString()); return; } else { throw new ServiceException(result.getMessage()); @@ -1407,7 +1407,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【4101A】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【4101A】返回参数:" + JSON.toJSONString(resultString)); logger.info("【4101A】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -1416,7 +1416,7 @@ public class YbHttpUtils { if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(result.getResult().toString()); + logger.info(result.getResult().toString()); return; } else { throw new ServiceException(result.getMessage()); @@ -1434,7 +1434,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【4102】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【4102】返回参数:" + JSON.toJSONString(resultString)); logger.info("【4102】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -1443,7 +1443,7 @@ public class YbHttpUtils { if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(result.getResult().toString()); + logger.info(result.getResult().toString()); return; } else { throw new ServiceException(result.getMessage()); @@ -1462,7 +1462,7 @@ public class YbHttpUtils { if (StringUtils.isEmpty(resultString)) { throw new ServiceException("未接收到医保返回参数"); } - System.out.println("【2302】返回参数:" + JSON.toJSONString(resultString)); + logger.info("【2302】返回参数:" + JSON.toJSONString(resultString)); logger.info("【2302】返回参数:" + resultString); ObjectMapper mapper = new ObjectMapper(); Result result = null; @@ -1471,7 +1471,7 @@ public class YbHttpUtils { if (result == null) { throw new ServiceException("未接收到医保返回参数"); } else if (result.getCode() == 200) { - System.out.println(result.getResult().toString()); + logger.info(result.getResult().toString()); return; } else { throw new ServiceException(result.getMessage()); diff --git a/openhis-server-new/openhis-miniapp/src/main/java/com/openhis/OpenHisMiniApp.java b/openhis-server-new/openhis-miniapp/src/main/java/com/openhis/OpenHisMiniApp.java index 08547d6d9..0b1c78391 100755 --- a/openhis-server-new/openhis-miniapp/src/main/java/com/openhis/OpenHisMiniApp.java +++ b/openhis-server-new/openhis-miniapp/src/main/java/com/openhis/OpenHisMiniApp.java @@ -1,5 +1,8 @@ package com.openhis; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.net.InetAddress; import java.net.UnknownHostException; @@ -11,6 +14,7 @@ import org.springframework.core.env.Environment; @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}, scanBasePackages = {"com.core", "com.openhis"}) public class OpenHisMiniApp { + private static final Logger log = LoggerFactory.getLogger(OpenHisMiniApp.class); public static void main(String[] args) throws UnknownHostException { // System.setProperty("spring.devtools.restart.enabled", "false"); ConfigurableApplicationContext application = SpringApplication.run(OpenHisMiniApp.class, args); @@ -18,7 +22,7 @@ public class OpenHisMiniApp { String ip = InetAddress.getLocalHost().getHostAddress(); String port = env.getProperty("server.port"); String path = env.getProperty("server.servlet.context-path"); - System.out.println("\n----------------------------------------------------------\n\t" + log.info("\n----------------------------------------------------------\n\t" + "Application OpenHis is running! Access URLs:\n\t" + "Local: \t\thttp://localhost:" + port + path + "/\n\t" + "External: \thttp://" + ip + ":" + port + path + "/\n" + "----------------------------------------------------------"); diff --git a/openhis-server-new/pom.xml b/openhis-server-new/pom.xml index 191f18396..fb82e25dd 100755 --- a/openhis-server-new/pom.xml +++ b/openhis-server-new/pom.xml @@ -46,7 +46,7 @@ 2.0.61 2.5.1 2.12.4.1 - 5.8.35 + 5.8.36 1.80 7.1.2 5.5.13.4