update:修复军保统计页面bug
This commit is contained in:
@@ -1,90 +0,0 @@
|
||||
# 自定义PayType配置总结
|
||||
|
||||
## 用户自定义的PayType编码方案
|
||||
|
||||
基于用户要求,配置如下PayType编码:
|
||||
|
||||
| HIS支付方式 | PayType编码 | 说明 |
|
||||
|------------|------------|------|
|
||||
| 现金 | 5 | 现金支付 |
|
||||
| 微信 | 1 | 微信支付 |
|
||||
| 聚合支付 | 2 | 聚合支付 |
|
||||
| 军保支付 | 3 | 军保支付 |
|
||||
| 其他 | 4 | 其他/未知支付方式 |
|
||||
|
||||
## 字典表SQL配置
|
||||
|
||||
```sql
|
||||
-- 清理现有数据
|
||||
DELETE FROM `dicinfo` WHERE `parent_code` = 'PAY_TYPE' AND `diccode` != 'PAY_TYPE';
|
||||
|
||||
-- 用户自定义编码配置
|
||||
INSERT INTO `dicinfo` VALUES ('his_pay_001', '现金', '5', 'PAY_TYPE', '2024-01-01 00:00:00', '2024-01-01 00:00:00', 1);
|
||||
INSERT INTO `dicinfo` VALUES ('his_pay_002', '微信', '1', 'PAY_TYPE', '2024-01-01 00:00:00', '2024-01-01 00:00:00', 2);
|
||||
INSERT INTO `dicinfo` VALUES ('his_pay_003', '聚合支付', '2', 'PAY_TYPE', '2024-01-01 00:00:00', '2024-01-01 00:00:00', 3);
|
||||
INSERT INTO `dicinfo` VALUES ('his_pay_004', '军保支付', '3', 'PAY_TYPE', '2024-01-01 00:00:00', '2024-01-01 00:00:00', 4);
|
||||
INSERT INTO `dicinfo` VALUES ('his_pay_005', '其他', '4', 'PAY_TYPE', '2024-01-01 00:00:00', '2024-01-01 00:00:00', 5);
|
||||
```
|
||||
|
||||
## 汇总统计分类适配
|
||||
|
||||
### HIS端统计适配
|
||||
```java
|
||||
// PaymentStatisticsController.java 中的统计分类
|
||||
hisMoneyData.put("1", "0"); // 微信支付
|
||||
hisMoneyData.put("2", "0"); // 聚合支付
|
||||
hisMoneyData.put("3", "0"); // 军保支付
|
||||
hisMoneyData.put("4", "0"); // 其他
|
||||
hisMoneyData.put("5", "0"); // 现金支付
|
||||
```
|
||||
|
||||
### 转换逻辑适配
|
||||
```java
|
||||
// HISGetDataMethodByJH.java 中的转换方法
|
||||
private String convertPayTypeByDictionary(String originalPayType, HashMap<String, String> payTypeMap) {
|
||||
// 严格字典匹配,未匹配则返回"4"(其他)
|
||||
// 支持的精确匹配:现金、微信、聚合支付、军保支付
|
||||
}
|
||||
```
|
||||
|
||||
## 实施检查清单
|
||||
|
||||
### 1. 数据库配置 ✓
|
||||
- [x] 执行字典表SQL脚本
|
||||
- [x] 验证字典数据正确插入
|
||||
|
||||
### 2. 代码配置 ✓
|
||||
- [x] 更新HISGetDataMethodByJH转换逻辑
|
||||
- [x] 更新PaymentStatisticsController统计逻辑
|
||||
- [x] 修改默认值从"5"改为"4"
|
||||
|
||||
### 3. 验证测试 ⚠️
|
||||
- [ ] 重启应用加载新字典数据
|
||||
- [ ] 执行HIS数据同步测试
|
||||
- [ ] 验证PayType转换结果
|
||||
- [ ] 检查汇总统计页面数据
|
||||
|
||||
## 预期结果
|
||||
|
||||
执行配置后,HIS数据入库时:
|
||||
- `现金` → PayType: `5`
|
||||
- `微信` → PayType: `1`
|
||||
- `聚合支付` → PayType: `2`
|
||||
- `军保支付` → PayType: `3`
|
||||
- 未匹配 → PayType: `4`
|
||||
|
||||
汇总统计页面将按照这5种分类正确显示交易数据。
|
||||
|
||||
## 监控要点
|
||||
|
||||
1. **日志监控**: 关注转换过程中的警告日志
|
||||
2. **数据验证**: 检查入库后PayType分布是否符合预期
|
||||
3. **统计准确性**: 验证汇总页面各支付方式统计数据
|
||||
|
||||
## 问题排查
|
||||
|
||||
如果发现PayType全部变成"4":
|
||||
1. 检查字典表数据是否正确
|
||||
2. 确认HIS原始数据支付方式名称与字典表dicname完全一致
|
||||
3. 查看应用日志中的转换警告信息
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
# HIS支付方式配置指南
|
||||
|
||||
## 问题背景
|
||||
HIS系统有四种支付方式:现金、微信、聚合支付、军保支付,需要与汇总统计接口的逻辑匹配。
|
||||
|
||||
## 汇总统计接口期望的PayType编码
|
||||
|
||||
### HIS端统计分类:
|
||||
- `1` - 扫码支付(聚合支付,包含微信/支付宝等)
|
||||
- `2` - 银行卡支付
|
||||
- `3` - 掌医支付
|
||||
- `4` - 现金支付
|
||||
- `5` - 其他
|
||||
|
||||
### 三方端统计分类:
|
||||
- `1_1` - 微信支付
|
||||
- `1_2` - 刷卡支付
|
||||
- `1_3` - 支付宝支付
|
||||
- `1_4` - 其他支付
|
||||
- `2` - 银行卡支付
|
||||
- `3` - 掌医支付
|
||||
- `4` - 现金支付
|
||||
- `5` - 其他
|
||||
|
||||
## 解决方案
|
||||
|
||||
### 1. 字典表配置
|
||||
|
||||
执行以下SQL更新字典表:
|
||||
|
||||
```sql
|
||||
-- 方案A:更新现有数据
|
||||
UPDATE `dicinfo` SET `dicvalue` = '4' WHERE `dicname` = '现金支付' AND `parent_code` = 'PAY_TYPE';
|
||||
UPDATE `dicinfo` SET `dicvalue` = '1' WHERE `dicname` = '微信' AND `parent_code` = 'PAY_TYPE';
|
||||
INSERT INTO `dicinfo` VALUES ('juhezf001', '聚合支付', '1', 'PAY_TYPE', '2024-01-01 00:00:00', '2024-01-01 00:00:00', 6);
|
||||
INSERT INTO `dicinfo` VALUES ('junbao001', '军保支付', '3', 'PAY_TYPE', '2024-01-01 00:00:00', '2024-01-01 00:00:00', 7);
|
||||
|
||||
-- 方案B:重新创建(推荐)
|
||||
DELETE FROM `dicinfo` WHERE `parent_code` = 'PAY_TYPE' AND `diccode` != 'PAY_TYPE';
|
||||
|
||||
INSERT INTO `dicinfo` VALUES ('pay_type_001', '扫码支付', '1', 'PAY_TYPE', '2024-01-01 00:00:00', '2024-01-01 00:00:00', 1);
|
||||
INSERT INTO `dicinfo` VALUES ('pay_type_002', '银行卡支付', '2', 'PAY_TYPE', '2024-01-01 00:00:00', '2024-01-01 00:00:00', 2);
|
||||
INSERT INTO `dicinfo` VALUES ('pay_type_003', '军保支付', '3', 'PAY_TYPE', '2024-01-01 00:00:00', '2024-01-01 00:00:00', 3);
|
||||
INSERT INTO `dicinfo` VALUES ('pay_type_004', '现金支付', '4', 'PAY_TYPE', '2024-01-01 00:00:00', '2024-01-01 00:00:00', 4);
|
||||
INSERT INTO `dicinfo` VALUES ('pay_type_005', '其他', '5', 'PAY_TYPE', '2024-01-01 00:00:00', '2024-01-01 00:00:00', 5);
|
||||
```
|
||||
|
||||
### 2. HIS数据转换映射
|
||||
|
||||
已在 `HISGetDataMethodByJH.java` 中添加了 `convertPayTypeToStandard()` 方法:
|
||||
|
||||
```java
|
||||
private String convertPayTypeToStandard(String originalPayType) {
|
||||
if (originalPayType == null || originalPayType.trim().isEmpty()) {
|
||||
return "5"; // 其他
|
||||
}
|
||||
|
||||
String payType = originalPayType.trim().toLowerCase();
|
||||
|
||||
// 根据你的四种HIS支付方式进行转换
|
||||
if (payType.contains("现金")) {
|
||||
return "4"; // 现金支付
|
||||
} else if (payType.contains("微信") || payType.contains("聚合")) {
|
||||
return "1"; // 扫码支付(包含微信和聚合支付)
|
||||
} else if (payType.contains("军保") || payType.contains("掌医")) {
|
||||
return "3"; // 军保支付/掌医支付
|
||||
} else if (payType.contains("银行卡") || payType.contains("刷卡")) {
|
||||
return "2"; // 银行卡支付
|
||||
} else {
|
||||
return "5"; // 其他
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3. 转换逻辑说明
|
||||
|
||||
| HIS原始支付方式 | 转换后PayType | 汇总统计分类 |
|
||||
|----------------|--------------|-------------|
|
||||
| 现金 | 4 | 现金支付 |
|
||||
| 微信 | 1 | 扫码支付 |
|
||||
| 聚合支付 | 1 | 扫码支付 |
|
||||
| 军保支付 | 3 | 掌医支付 |
|
||||
| 其他未知 | 5 | 其他 |
|
||||
|
||||
### 4. 验证步骤
|
||||
|
||||
1. **执行字典表更新SQL**
|
||||
2. **重启应用**确保字典数据重新加载
|
||||
3. **执行HIS数据同步任务**
|
||||
4. **查看汇总统计页面**验证数据是否正确分类
|
||||
5. **检查日志**确认转换逻辑是否正常工作
|
||||
|
||||
### 5. 注意事项
|
||||
|
||||
1. **数据一致性**:确保所有历史数据也按新的PayType编码存储
|
||||
2. **缓存清理**:如果系统有缓存,需要清理字典缓存
|
||||
3. **测试环境验证**:先在测试环境验证转换逻辑
|
||||
4. **监控异常**:关注转换过程中的异常日志
|
||||
|
||||
### 6. 扩展性考虑
|
||||
|
||||
如果未来需要新增支付方式,只需要:
|
||||
1. 在字典表中添加新的记录
|
||||
2. 在 `convertPayTypeToStandard()` 方法中添加转换逻辑
|
||||
3. 确保汇总统计接口能正确处理新的PayType
|
||||
|
||||
## 完成后的效果
|
||||
|
||||
完成配置后,汇总统计接口将能正确统计四种支付方式的数据,并在页面上正确显示各支付方式的交易笔数和金额统计。
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
# HIS支付方式严格匹配配置方案
|
||||
|
||||
## 配置要求
|
||||
严格按照以下四种HIS支付方式进行字典表配置和转换:
|
||||
1. **现金** (一字不差)
|
||||
2. **微信** (一字不差)
|
||||
3. **聚合支付** (一字不差)
|
||||
4. **军保支付** (一字不差)
|
||||
|
||||
## 字典表配置
|
||||
|
||||
### 执行SQL脚本
|
||||
```sql
|
||||
-- 1. 清理现有PAY_TYPE数据(保留父节点)
|
||||
DELETE FROM `dicinfo` WHERE `parent_code` = 'PAY_TYPE' AND `diccode` != 'PAY_TYPE';
|
||||
|
||||
-- 2. 添加严格匹配的四种支付方式
|
||||
INSERT INTO `dicinfo` VALUES ('his_pay_001', '现金', '4', 'PAY_TYPE', '2024-01-01 00:00:00', '2024-01-01 00:00:00', 1);
|
||||
INSERT INTO `dicinfo` VALUES ('his_pay_002', '微信', '1', 'PAY_TYPE', '2024-01-01 00:00:00', '2024-01-01 00:00:00', 2);
|
||||
INSERT INTO `dicinfo` VALUES ('his_pay_003', '聚合支付', '1', 'PAY_TYPE', '2024-01-01 00:00:00', '2024-01-01 00:00:00', 3);
|
||||
INSERT INTO `dicinfo` VALUES ('his_pay_004', '军保支付', '3', 'PAY_TYPE', '2024-01-01 00:00:00', '2024-01-01 00:00:00', 4);
|
||||
INSERT INTO `dicinfo` VALUES ('his_pay_005', '其他', '5', 'PAY_TYPE', '2024-01-01 00:00:00', '2024-01-01 00:00:00', 5);
|
||||
```
|
||||
|
||||
### 字典映射关系(用户自定义编码)
|
||||
| HIS支付方式 | 字典dicname | 字典dicvalue | 汇总统计分类 |
|
||||
|------------|-------------|-------------|-------------|
|
||||
| 现金 | 现金 | 5 | 现金支付 |
|
||||
| 微信 | 微信 | 1 | 微信支付 |
|
||||
| 聚合支付 | 聚合支付 | 2 | 聚合支付 |
|
||||
| 军保支付 | 军保支付 | 3 | 军保支付 |
|
||||
| 其他 | 其他 | 4 | 其他 |
|
||||
|
||||
## 代码转换逻辑
|
||||
|
||||
### 转换方法特点
|
||||
```java
|
||||
private String convertPayTypeByDictionary(String originalPayType, HashMap<String, String> payTypeMap) {
|
||||
// 1. 严格字符串匹配 - 一字不差
|
||||
// 2. 先trim()去除空格
|
||||
// 3. 直接通过字典表Map查找
|
||||
// 4. 找不到记录警告日志并返回"5"(其他)
|
||||
}
|
||||
```
|
||||
|
||||
### 转换流程
|
||||
1. **获取HIS原始支付方式**: `hisBillHashMap.get("payType")`
|
||||
2. **去除空格**: `originalPayType.trim()`
|
||||
3. **字典表查找**: `payTypeMap.get(payTypeName)`
|
||||
4. **严格匹配**: 必须完全一致才能匹配成功
|
||||
5. **异常处理**: 匹配失败记录日志,返回"4"(其他)
|
||||
|
||||
## 验证方法
|
||||
|
||||
### 1. 数据库验证
|
||||
```sql
|
||||
-- 查看字典表配置
|
||||
SELECT diccode, dicname, dicvalue, sort_no
|
||||
FROM dicinfo
|
||||
WHERE parent_code = 'PAY_TYPE'
|
||||
ORDER BY sort_no;
|
||||
```
|
||||
|
||||
### 2. 日志验证
|
||||
查看应用日志中是否有警告信息:
|
||||
```
|
||||
WARN - 未在字典表中找到支付方式映射: [异常支付方式名称], 已转换为其他支付方式
|
||||
```
|
||||
|
||||
### 3. 数据验证
|
||||
```sql
|
||||
-- 查看转换后的PayType分布
|
||||
SELECT PayType, COUNT(*) as count
|
||||
FROM hisbills_history
|
||||
WHERE trade_date = '2024-01-01'
|
||||
GROUP BY PayType;
|
||||
```
|
||||
|
||||
## 严格匹配的优势
|
||||
|
||||
1. **精确性**: 完全按照字典表配置,避免模糊匹配错误
|
||||
2. **可维护性**: 新增支付方式只需要在字典表添加记录
|
||||
3. **可追溯性**: 未匹配的支付方式会记录日志
|
||||
4. **数据一致性**: 确保入库的PayType值完全符合汇总统计接口要求
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. **字符严格匹配**: HIS数据中的支付方式名称必须与字典表中的dicname完全一致
|
||||
2. **空格处理**: 系统会自动trim()处理首尾空格
|
||||
3. **大小写敏感**: 字典表中是"现金",HIS数据必须也是"现金"
|
||||
4. **新增支付方式**: 必须先在字典表中添加对应记录
|
||||
5. **历史数据**: 建议重新同步历史数据以保证数据一致性
|
||||
|
||||
## 故障排查
|
||||
|
||||
### 如果PayType都变成"4"(其他):
|
||||
1. 检查字典表是否正确配置
|
||||
2. 检查HIS数据中的支付方式名称是否与字典表完全一致
|
||||
3. 查看应用日志中的警告信息
|
||||
4. 验证payTypeMap是否正确加载
|
||||
|
||||
### 日志示例
|
||||
```
|
||||
正常: HIS支付方式 [现金] 成功转换为 PayType [5]
|
||||
异常: WARN - 未在字典表中找到支付方式映射: [現金], 已转换为其他支付方式
|
||||
```
|
||||
@@ -125,13 +125,29 @@ public class MilitaryInsuranceController {
|
||||
|
||||
// 如果没有传递时间参数,设置默认查询今日数据
|
||||
if (map.get("startTime") == null || "".equals(map.get("startTime"))) {
|
||||
map.put("startTime", DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd) + " 00:00:00");
|
||||
map.put("startTime", DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd));
|
||||
}
|
||||
if (map.get("endTime") == null || "".equals(map.get("endTime"))) {
|
||||
map.put("endTime", DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd) + " 23:59:59");
|
||||
map.put("endTime", DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd));
|
||||
}
|
||||
|
||||
// 处理前端传递的带时间格式的日期,提取日期部分
|
||||
if (map.get("startTime") != null && map.get("startTime").toString().contains(" ")) {
|
||||
String startTime = map.get("startTime").toString();
|
||||
map.put("startTime", startTime.substring(0, 10)); // 提取日期部分
|
||||
}
|
||||
if (map.get("endTime") != null && map.get("endTime").toString().contains(" ")) {
|
||||
String endTime = map.get("endTime").toString();
|
||||
map.put("endTime", endTime.substring(0, 10)); // 提取日期部分
|
||||
}
|
||||
|
||||
// 添加调试信息
|
||||
System.out.println("军保统计查询参数: " + map.toString());
|
||||
|
||||
List<HashMap<Object, Object>> hisDetailCount = hisDetailService.findHisDetailCountData(map);
|
||||
|
||||
// 添加调试信息
|
||||
System.out.println("军保统计查询结果: " + (hisDetailCount != null ? hisDetailCount.toString() : "null"));
|
||||
|
||||
if (hisDetailCount != null && hisDetailCount.size() > 0) {
|
||||
responseMap.put("money", hisDetailCount.get(0).get("MONEY"));
|
||||
|
||||
@@ -66,3 +66,10 @@ public interface FinanceUserMapper {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,3 +34,10 @@ public class FinanceUser {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,9 +6,12 @@ import com.saye.hospitalgd.commons.string.StringDUtil;
|
||||
import com.saye.hospitalgd.commons.uuid.UUIDGenerator;
|
||||
import com.saye.hospitalgd.service.*;
|
||||
import com.saye.hospitalgd.service.historyLog.ReconciliationLogService;
|
||||
import com.saye.hospitalgd.util.AmountUtil;
|
||||
import com.saye.hospitalgd.service.historyLog.impl.ReconciliationLogServiceImpl;
|
||||
import com.saye.hospitalgd.service.impl.*;
|
||||
import com.saye.hospitalgd.service.system.DicinfoService;
|
||||
import com.saye.hospitalgd.service.system.ServiceParamsService;
|
||||
import com.saye.hospitalgd.service.system.impl.DicinfoServiceImpl;
|
||||
import com.saye.hospitalgd.service.system.impl.ServiceParamsServiceImpl;
|
||||
|
||||
|
||||
@@ -56,12 +59,6 @@ public class ReconciliationMethod {
|
||||
searchMap.put("trade_date", trade_date);
|
||||
searchMap.put("is_ok", 1);
|
||||
|
||||
//查询军保操作员,用于排除军保账单
|
||||
List<HashMap<Object, Object>> militaryOperators = operatorService.findMilitaryOperators(new HashMap<>());
|
||||
if (militaryOperators != null && militaryOperators.size() > 0) {
|
||||
searchMap.put("excludeMilitaryOperators", militaryOperators);
|
||||
}
|
||||
|
||||
//先判断是否已生成
|
||||
List<HashMap<Object, Object>> reconciliationLog = reconciliationLogService.findReconciliationLogByParam(searchMap);
|
||||
|
||||
@@ -69,6 +66,20 @@ public class ReconciliationMethod {
|
||||
managerNum = Integer.parseInt(StringDUtil.changeNullToEmpty(reconciliationLog.get(0).get("MANAGER_NUM")));
|
||||
}
|
||||
|
||||
// 提前获取过滤参数
|
||||
DicinfoService dicinfoService = GetBeanUtil.getBean(DicinfoServiceImpl.class);
|
||||
|
||||
// 查询军保支付方式(医院垫支)的dicvalue
|
||||
String military_code = ""; // 默认为空,表示不过滤
|
||||
HashMap<String, String> dicinfoSearchMap = new HashMap<>();
|
||||
dicinfoSearchMap.put("parentCode", "PAY_TYPE"); // 支付方式的父节点
|
||||
dicinfoSearchMap.put("dicname", "医院垫支");
|
||||
List<HashMap<Object, Object>> militaryPayTypeList = dicinfoService.selectDicinfoListByCondition(dicinfoSearchMap);
|
||||
if (militaryPayTypeList != null && militaryPayTypeList.size() > 0) {
|
||||
military_code = StringDUtil.changeNullToEmpty(militaryPayTypeList.get(0).get("DICVALUE"));
|
||||
}
|
||||
searchMap.put("military_code", military_code);
|
||||
|
||||
//查询his和三方记录
|
||||
List<HashMap<Object, Object>> hisbillsList = hisbillsHistoryService.findHisBillsByDate(searchMap);
|
||||
|
||||
@@ -80,10 +91,16 @@ public class ReconciliationMethod {
|
||||
TransactionDetailService transactionDetailService = GetBeanUtil.getBean(TransactionDetailServiceImpl.class);
|
||||
UnilateralService unilateralService = GetBeanUtil.getBean(UnilateralServiceImpl.class);
|
||||
|
||||
String cash_code = StringDUtil.changeNullToEmpty(serviceParamsService.findParamValByParamCode("cash_code"));
|
||||
// 正确获取 cash_code 参数值
|
||||
String cash_code = "5"; // 默认值
|
||||
List<HashMap<Object, Object>> cashCodeList = serviceParamsService.findParamValByParamCode("cash_code");
|
||||
if (cashCodeList != null && cashCodeList.size() > 0) {
|
||||
cash_code = StringDUtil.changeNullToEmpty(cashCodeList.get(0).get("PARAM_VAL"));
|
||||
}
|
||||
|
||||
//先创建关联表 用来后面查询交易明细
|
||||
searchMap.put("cash_code", cash_code);
|
||||
// military_code 已经在前面添加到 searchMap 中了
|
||||
transactionDetailService.insertHisAndThirdJoinData(searchMap);
|
||||
|
||||
|
||||
@@ -202,7 +219,7 @@ public class ReconciliationMethod {
|
||||
String thirdJe = StringDUtil.changeNullToEmpty(list.get(0).get("I_JYJE"));
|
||||
HashMap<Object, Object> updateHisMap = new HashMap<>();
|
||||
HashMap<Object, Object> updateThirdMap = new HashMap<>();
|
||||
if (new BigDecimal(thirdJe).compareTo(new BigDecimal(amount)) == 0) {
|
||||
if (AmountUtil.isAmountEqual(thirdJe, amount)) {
|
||||
|
||||
|
||||
//修改该记录状态为自动核销
|
||||
@@ -320,7 +337,7 @@ public class ReconciliationMethod {
|
||||
HashMap<Object, Object> updateThirdMap = new HashMap<>();
|
||||
|
||||
//如果两边金额相同 设置核销 更新关联明细表为核销
|
||||
if (new BigDecimal(hisJe).compareTo(new BigDecimal(i_jyje)) == 0) {
|
||||
if (AmountUtil.isAmountEqual(hisJe, i_jyje)) {
|
||||
//修改该记录状态为自动核销
|
||||
updateHisMap.put("is_manager", "0");
|
||||
updateHisMap.put("remark", "系统自动核销");
|
||||
@@ -508,7 +525,7 @@ public class ReconciliationMethod {
|
||||
String i_jylx = StringDUtil.changeNullToEmpty(bankDetailMap.get("I_JYLX"));
|
||||
String i_ddh = StringDUtil.changeNullToEmpty(bankDetailMap.get("I_DDH"));
|
||||
|
||||
if (new BigDecimal(amount).compareTo(new BigDecimal(i_jyje)) == 0) {
|
||||
if (AmountUtil.isAmountEqual(amount, i_jyje)) {
|
||||
|
||||
HashMap<Object, Object> addMap = new HashMap<>();
|
||||
addMap.put("jysj", i_jyrq + " " + i_jysj);
|
||||
|
||||
@@ -70,3 +70,10 @@ public interface FinanceUserService {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -100,3 +100,10 @@ public class FinanceUserServiceImpl implements FinanceUserService {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
121
src/main/java/com/saye/hospitalgd/util/AmountUtil.java
Normal file
121
src/main/java/com/saye/hospitalgd/util/AmountUtil.java
Normal file
@@ -0,0 +1,121 @@
|
||||
package com.saye.hospitalgd.util;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
/**
|
||||
* 金额处理工具类
|
||||
* 用于处理金额比较、格式化等操作
|
||||
*
|
||||
* @author system
|
||||
* @version 1.0
|
||||
* @date 2024/10/22
|
||||
*/
|
||||
public class AmountUtil {
|
||||
|
||||
/**
|
||||
* 默认精度为2位小数
|
||||
*/
|
||||
private static final int DEFAULT_SCALE = 2;
|
||||
|
||||
/**
|
||||
* 默认舍入模式为四舍五入
|
||||
*/
|
||||
private static final RoundingMode DEFAULT_ROUNDING_MODE = RoundingMode.HALF_UP;
|
||||
|
||||
/**
|
||||
* 比较两个金额是否相等
|
||||
* 会自动处理精度问题,如8.00和8会被认为是相等的
|
||||
*
|
||||
* @param amount1 金额1(字符串格式)
|
||||
* @param amount2 金额2(字符串格式)
|
||||
* @return true表示相等,false表示不相等
|
||||
*/
|
||||
public static boolean isAmountEqual(String amount1, String amount2) {
|
||||
if (amount1 == null || amount2 == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 处理空字符串情况
|
||||
if (amount1.trim().isEmpty() || amount2.trim().isEmpty()) {
|
||||
return amount1.trim().equals(amount2.trim());
|
||||
}
|
||||
|
||||
try {
|
||||
BigDecimal bd1 = new BigDecimal(amount1.trim()).setScale(DEFAULT_SCALE, DEFAULT_ROUNDING_MODE);
|
||||
BigDecimal bd2 = new BigDecimal(amount2.trim()).setScale(DEFAULT_SCALE, DEFAULT_ROUNDING_MODE);
|
||||
return bd1.compareTo(bd2) == 0;
|
||||
} catch (NumberFormatException e) {
|
||||
// 如果转换失败,则进行字符串比较
|
||||
return amount1.trim().equals(amount2.trim());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较两个金额是否相等
|
||||
*
|
||||
* @param amount1 金额1(BigDecimal格式)
|
||||
* @param amount2 金额2(BigDecimal格式)
|
||||
* @return true表示相等,false表示不相等
|
||||
*/
|
||||
public static boolean isAmountEqual(BigDecimal amount1, BigDecimal amount2) {
|
||||
if (amount1 == null || amount2 == null) {
|
||||
return amount1 == amount2;
|
||||
}
|
||||
|
||||
BigDecimal bd1 = amount1.setScale(DEFAULT_SCALE, DEFAULT_ROUNDING_MODE);
|
||||
BigDecimal bd2 = amount2.setScale(DEFAULT_SCALE, DEFAULT_ROUNDING_MODE);
|
||||
return bd1.compareTo(bd2) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化金额为标准格式(保留2位小数)
|
||||
*
|
||||
* @param amount 金额字符串
|
||||
* @return 格式化后的金额字符串
|
||||
*/
|
||||
public static String formatAmount(String amount) {
|
||||
if (amount == null || amount.trim().isEmpty()) {
|
||||
return "0.00";
|
||||
}
|
||||
|
||||
try {
|
||||
BigDecimal bd = new BigDecimal(amount.trim()).setScale(DEFAULT_SCALE, DEFAULT_ROUNDING_MODE);
|
||||
return bd.toString();
|
||||
} catch (NumberFormatException e) {
|
||||
return amount;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化金额为标准格式(保留2位小数)
|
||||
*
|
||||
* @param amount 金额BigDecimal
|
||||
* @return 格式化后的金额字符串
|
||||
*/
|
||||
public static String formatAmount(BigDecimal amount) {
|
||||
if (amount == null) {
|
||||
return "0.00";
|
||||
}
|
||||
|
||||
return amount.setScale(DEFAULT_SCALE, DEFAULT_ROUNDING_MODE).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串金额转换为BigDecimal
|
||||
*
|
||||
* @param amount 金额字符串
|
||||
* @return BigDecimal对象
|
||||
*/
|
||||
public static BigDecimal toBigDecimal(String amount) {
|
||||
if (amount == null || amount.trim().isEmpty()) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
try {
|
||||
return new BigDecimal(amount.trim()).setScale(DEFAULT_SCALE, DEFAULT_ROUNDING_MODE);
|
||||
} catch (NumberFormatException e) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -202,3 +202,10 @@ public class HttpClientUtil {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -187,13 +187,13 @@
|
||||
from hisbill_history
|
||||
<where>
|
||||
<if test="payType!=null and payType!=''">
|
||||
and PayType = #{payType}
|
||||
and (PayType = #{payType} or PayType = CAST(#{payType} AS UNSIGNED))
|
||||
</if>
|
||||
<if test="startTime!=null and startTime!=''">
|
||||
and (TradeTime >= #{startTime} or trade_date >= #{startTime})
|
||||
and trade_date >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime!=null and endTime!=''">
|
||||
and (TradeTime <= #{endTime} or trade_date <= #{endTime})
|
||||
and trade_date <= #{endTime}
|
||||
</if>
|
||||
<if test="likeFiled!=null and likeFiled!=''">
|
||||
and PlatformTransId like concat('%',concat(#{likeFiled},'%'))
|
||||
|
||||
@@ -24,11 +24,8 @@
|
||||
select *
|
||||
from hisbill_history
|
||||
where trade_date = #{trade_date}
|
||||
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
|
||||
and HisOperCode not in
|
||||
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
|
||||
#{operator.HISOPERCODE}
|
||||
</foreach>
|
||||
<if test="military_code != null and military_code != ''">
|
||||
and PayType != #{military_code}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
@@ -50,11 +47,8 @@
|
||||
|
||||
from hisbills_history
|
||||
where trade_date=#{trade_date}
|
||||
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
|
||||
and HisOperCode not in
|
||||
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
|
||||
#{operator.HISOPERCODE}
|
||||
</foreach>
|
||||
<if test="military_code != null and military_code != ''">
|
||||
and PayType != #{military_code}
|
||||
</if>
|
||||
<if test="tranID!=null and tranID!=''">
|
||||
and HisTransId=#{tranID}
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
select a.PlatformTransId, a.Amount, b.C_JYJE, a.PayType, b.C_ZFFS, a.trade_date, a.TradeTime
|
||||
from temp_hisbill_history a
|
||||
left join temp_bankbill_history b on a.PlatformTransId = b.C_YSDDH
|
||||
where a.Amount != b.C_JYJE
|
||||
where ROUND(CAST(a.Amount AS DECIMAL(18,2)), 2) != ROUND(CAST(b.C_JYJE AS DECIMAL(18,2)), 2)
|
||||
</select>
|
||||
|
||||
<select id="findHisAndThirdJoinDataNumByTime" parameterType="HashMap" resultType="HashMap">
|
||||
@@ -95,7 +95,7 @@
|
||||
, HisOperNum, PatientID, PatientName
|
||||
, sort_date, trade_date, err_type, check_result, is_active)
|
||||
select concat(b.C_JYRQ, ' ', b.C_JYSJ) as jysj
|
||||
, b.C_YSDDH
|
||||
, b.C_SHDDH
|
||||
, b.C_JYJE
|
||||
, b.C_JYLX
|
||||
, b.C_ZFFS
|
||||
@@ -114,16 +114,13 @@
|
||||
, '0'
|
||||
, '1'
|
||||
from (select * from hisbill_history where trade_date = #{trade_date} and payType!=#{cash_code}
|
||||
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
|
||||
and HisOperCode not in
|
||||
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
|
||||
#{operator.HisOperCode}
|
||||
</foreach>
|
||||
<if test="military_code != null and military_code != ''">
|
||||
and payType!=#{military_code}
|
||||
</if>
|
||||
) a
|
||||
inner join
|
||||
(select * from bankbill_history where C_JYRQ = #{trade_date}) b
|
||||
on a.PlatformTransId = b.C_SHDDH and a.TradingStatus = b.C_JYLX and a.Amount+0 = b.C_JYJE+0
|
||||
on a.PlatformTransId = b.C_SHDDH and a.TradingStatus = b.C_JYLX and ROUND(CAST(a.Amount AS DECIMAL(18,2)), 2) = ROUND(CAST(b.C_JYJE AS DECIMAL(18,2)), 2)
|
||||
</insert>
|
||||
|
||||
<insert id="insertHisUnilateral" parameterType="HashMap">
|
||||
@@ -132,7 +129,7 @@
|
||||
, HisOperNum, PatientID, PatientName
|
||||
, sort_date, trade_date, err_type, check_result, is_active)
|
||||
select a.TradeTime as jysj
|
||||
, b.C_YSDDH
|
||||
, b.C_SHDDH
|
||||
, b.C_JYJE
|
||||
, b.C_JYLX
|
||||
, b.C_ZFFS
|
||||
@@ -151,16 +148,13 @@
|
||||
, '1'
|
||||
, '1'
|
||||
from (select * from hisbill_history where trade_date = #{trade_date} and payType!=#{cash_code}
|
||||
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
|
||||
and HisOperCode not in
|
||||
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
|
||||
#{operator.HisOperCode}
|
||||
</foreach>
|
||||
<if test="military_code != null and military_code != ''">
|
||||
and payType!=#{military_code}
|
||||
</if>
|
||||
) a
|
||||
left join
|
||||
(select * from bankbill_history where C_JYRQ = #{trade_date}) b
|
||||
on a.PlatformTransId = b.C_SHDDH and a.TradingStatus = b.C_JYLX and a.Amount+0 = b.C_JYJE+0
|
||||
on a.PlatformTransId = b.C_SHDDH and a.TradingStatus = b.C_JYLX and ROUND(CAST(a.Amount AS DECIMAL(18,2)), 2) = ROUND(CAST(b.C_JYJE AS DECIMAL(18,2)), 2)
|
||||
where b.C_SHDDH is null
|
||||
</insert>
|
||||
|
||||
@@ -170,12 +164,12 @@
|
||||
, HisOperNum, PatientID, PatientName
|
||||
, sort_date, trade_date, err_type, check_result, is_active)
|
||||
select concat(b.C_JYRQ, ' ', b.C_JYSJ) as jysj
|
||||
, b.C_YSDDH
|
||||
, b.C_SHDDH
|
||||
, b.C_JYJE
|
||||
, b.C_JYLX
|
||||
, b.C_ZFFS
|
||||
, b.C_JYSJ
|
||||
, a.HisTransId
|
||||
, a.PlatformTransId
|
||||
, a.BizType
|
||||
, a.TradingStatus
|
||||
, a.Amount
|
||||
@@ -189,16 +183,13 @@
|
||||
, '1'
|
||||
, '1'
|
||||
from (select * from hisbill_history where trade_date = #{trade_date} and payType!=#{cash_code}
|
||||
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
|
||||
and HisOperCode not in
|
||||
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
|
||||
#{operator.HisOperCode}
|
||||
</foreach>
|
||||
<if test="military_code != null and military_code != ''">
|
||||
and payType!=#{military_code}
|
||||
</if>
|
||||
) a
|
||||
right join
|
||||
(select * from bankbill_history where C_JYRQ = #{trade_date}) b
|
||||
on a.PlatformTransId = b.C_SHDDH and a.TradingStatus = b.C_JYLX and a.Amount + 0 = b.C_JYJE + 0
|
||||
on a.PlatformTransId = b.C_SHDDH and a.TradingStatus = b.C_JYLX and ROUND(CAST(a.Amount AS DECIMAL(18,2)), 2) = ROUND(CAST(b.C_JYJE AS DECIMAL(18,2)), 2)
|
||||
where a.PlatformTransId is null
|
||||
</insert>
|
||||
|
||||
@@ -324,7 +315,7 @@
|
||||
check_result='1'
|
||||
where trade_date = #{trade_date}
|
||||
and check_result = '0'
|
||||
and (I_JYJE + 0) != (Amount + 0)
|
||||
and ROUND(CAST(I_JYJE AS DECIMAL(18,2)), 2) != ROUND(CAST(Amount AS DECIMAL(18,2)), 2)
|
||||
</update>
|
||||
|
||||
<delete id="deleteHisAndThirdJoinData" parameterType="HashMap">
|
||||
|
||||
@@ -122,3 +122,10 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -67,3 +67,10 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user