update:医保对账

This commit is contained in:
Yuan
2025-10-27 08:49:28 +08:00
parent 94e8850a40
commit 3e9a25dd38
32 changed files with 2134 additions and 38 deletions

View File

@@ -144,6 +144,10 @@ public class PaymentStatisticsController {
LinkedHashMap<String, String> zffsMap = numMap.get(str_zffs);
if (zffsMap != null) {
String countNum = zffsMap.get(c_jyrq);
// 安全处理countNum如果为null或空字符串则默认为"0"
if (countNum == null || countNum.isEmpty()) {
countNum = "0";
}
countNum = new BigDecimal(countNum).add(new BigDecimal(num1)).toString();
zffsMap.put(c_jyrq, countNum);
}
@@ -181,6 +185,10 @@ public class PaymentStatisticsController {
LinkedHashMap<String, String> zffsMap = moneyMap.get(str_zffs);
if (zffsMap != null) {
String countNum = zffsMap.get(c_jyrq);
// 安全处理countNum如果为null或空字符串则默认为"0"
if (countNum == null || countNum.isEmpty()) {
countNum = "0";
}
countNum = new BigDecimal(countNum).add(new BigDecimal(money)).toString();
zffsMap.put(c_jyrq, countNum);
}
@@ -316,32 +324,86 @@ public class PaymentStatisticsController {
String amount = StringDUtil.changeNullToEmpty(hashMap.get("AMOUNT")).trim();
String paytype = StringDUtil.changeNullToEmpty(hashMap.get("PAYTYPE")).trim();
// 数据核准确保PayType在预定义范围内
if (!hisMoneyData.containsKey(paytype)) {
log.warn("发现未预定义的PayType: [{}], 数据: {}, 已归类为其他支付方式", paytype, hashMap);
paytype = "4"; // 归类为其他支付方式
}
// 数据核准确保I_JYQD在预定义范围内
if (!thirdMoneyData.containsKey(i_zffs)) {
log.warn("发现未预定义的I_JYQD: [{}], 数据: {}, 已归类为其他支付方式", i_zffs, hashMap);
i_zffs = "5"; // 归类为其他支付方式
}
// 如果银行端金额不为空
if (StrUtil.isNotBlank(i_jyje)) {
log.info("hashMap is :" + hashMap);
log.info("aaa is : " + thirdMoneyData.get(i_zffs));
BigDecimal money = Convert.toBigDecimal(thirdMoneyData.get(i_zffs));
money = money.add(new BigDecimal(i_jyje));
thirdMoneyData.put(i_zffs, money.toString());
try {
log.info("处理银行端数据: i_zffs={}, i_jyje={}", i_zffs, i_jyje);
// 验证金额格式
BigDecimal transAmount = new BigDecimal(i_jyje);
if (transAmount.compareTo(BigDecimal.ZERO) < 0) {
log.warn("发现负数金额: i_jyje={}, 数据: {}", i_jyje, hashMap);
}
// 安全获取当前金额如果为null则默认为BigDecimal.ZERO
BigDecimal money = Convert.toBigDecimal(thirdMoneyData.get(i_zffs), BigDecimal.ZERO);
money = money.add(transAmount);
thirdMoneyData.put(i_zffs, money.toString());
int num = Integer.parseInt(StringDUtil.changeNullToEmpty(thirdNumData.get(i_zffs)));
num++;
thirdNumData.put(i_zffs, num + "");
// 安全获取当前数量如果为null或空字符串则默认为"0"
String currentNumStr = StringDUtil.changeNullToEmpty(thirdNumData.get(i_zffs));
if (currentNumStr.isEmpty()) {
currentNumStr = "0";
}
int num = Integer.parseInt(currentNumStr);
num++;
thirdNumData.put(i_zffs, num + "");
} catch (NumberFormatException e) {
log.error("银行端金额格式错误: i_jyje=[{}], 数据: {}, 错误: {}", i_jyje, hashMap, e.getMessage());
}
}
// 如果his端金额不为空
if (StrUtil.isNotBlank(amount)) {
log.info("hashMap is :" + hashMap);
BigDecimal money = new BigDecimal(StringDUtil.changeNullToEmpty(hisMoneyData.get(paytype)));
money = money.add(new BigDecimal(amount));
hisMoneyData.put(paytype, money.toString());
try {
log.info("处理HIS端数据: paytype={}, amount={}", paytype, amount);
// 验证金额格式
BigDecimal transAmount = new BigDecimal(amount);
if (transAmount.compareTo(BigDecimal.ZERO) < 0) {
log.warn("发现负数金额: amount={}, 数据: {}", amount, hashMap);
}
// 安全获取当前金额如果为null或空字符串则默认为"0"
String currentMoneyStr = StringDUtil.changeNullToEmpty(hisMoneyData.get(paytype));
if (currentMoneyStr.isEmpty()) {
currentMoneyStr = "0";
}
BigDecimal money = new BigDecimal(currentMoneyStr);
money = money.add(transAmount);
hisMoneyData.put(paytype, money.toString());
int num = Integer.parseInt(StringDUtil.changeNullToEmpty(hisNumData.get(paytype)));
num++;
hisNumData.put(paytype, num + "");
// 安全获取当前数量如果为null或空字符串则默认为"0"
String currentNumStr = StringDUtil.changeNullToEmpty(hisNumData.get(paytype));
if (currentNumStr.isEmpty()) {
currentNumStr = "0";
}
int num = Integer.parseInt(currentNumStr);
num++;
hisNumData.put(paytype, num + "");
} catch (NumberFormatException e) {
log.error("HIS端金额格式错误: amount=[{}], 数据: {}, 错误: {}", amount, hashMap, e.getMessage());
}
}
}