refactor: 代码质量优化 + 安全修复 + 性能提升

P0 安全修复:
- 修复 DatabaseFieldAdder.java 硬编码密码 → 改为环境变量
- 修复 11 个文件空 catch 块 → 添加日志记录
- 修复 40 个文件 System.out → 改为 SLF4J Logger

P1 性能优化:
- 启用 Spring Boot Actuator 健康检查 (health/info/metrics)
- 为字典数据查询添加 @Cacheable 缓存

P2 测试:
- 添加 Convert 工具类单元测试 (10 个测试用例)
- 添加 spring-boot-starter-test 依赖

P3 版本升级:
- hutool: 5.8.35 → 5.8.36
- httpclient 5.x (跳过, 改动量大)

验证: 编译通过 / 测试通过
This commit is contained in:
2026-06-05 11:08:05 +08:00
parent c0149693f5
commit af5d411e52
58 changed files with 621 additions and 321 deletions

View File

@@ -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"
+ "----------------------------------------------------------");

View File

@@ -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<Location> 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("执行无参方法");
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -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<String, Object> 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("删除失败");
}
}

View File

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

View File

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

View File

@@ -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<AutoRollNursingDto> 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<AutoRollBasicServiceDto> 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****************");
}
}
}

View File

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

View File

@@ -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 "<html><body><h2>渲染发票凭条失败:" + e.getMessage() + "</h2></body></html>";
}
}
@@ -239,9 +239,9 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
try {
Map<String, Object> 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));

View File

@@ -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<ChargeItem> chargeItemList = chargeItemService.list(new LambdaQueryWrapper<ChargeItem>()
.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<ChargeItem> list1 = chargeItemService.list(new LambdaQueryWrapper<ChargeItem>()
@@ -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) {

View File

@@ -84,7 +84,7 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//获取动态参数
Map<String, String> 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<String, String> 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;

View File

@@ -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 获取手术名称

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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<String, Object> param, Map<String, String> 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;
}

View File

@@ -810,7 +810,7 @@ public class TriageQueueAppServiceImpl implements TriageQueueAppService {
} catch (Exception e) {
// SSE 推送失败不应该影响业务逻辑
System.err.println("推送显示屏更新失败:" + e.getMessage());
log.error("推送显示屏更新失败:" + e.getMessage());
}
}

View File

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

View File

@@ -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转换失败");
}
}

View File

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

View File

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

View File

@@ -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