bugfix:对账完成

This commit is contained in:
Yuan
2025-12-07 11:46:49 +08:00
parent 3f931c2e29
commit 66620d51ae
23 changed files with 664 additions and 124 deletions

View File

@@ -62,13 +62,17 @@ public class RefundStatisticsController {
modelMap.addAttribute("startTime", startTime);
modelMap.addAttribute("endTime", endTime);
//支付方式
List<Dicinfo> payType = dicinfoService.findDicinfoTreeNodeList("PAY_TYPE");
modelMap.addAttribute("payTypeList", payType);
//支付方式
List<Dicinfo> payType = dicinfoService.findDicinfoTreeNodeList("PAY_TYPE");
modelMap.addAttribute("payTypeList", payType);
//退款类型
List<Dicinfo> refundType = dicinfoService.findDicinfoTreeNodeList("REFUND_TYPE");
modelMap.addAttribute("refundTypeList", refundType);
//退款类型
List<Dicinfo> refundType = dicinfoService.findDicinfoTreeNodeList("REFUND_TYPE");
modelMap.addAttribute("refundTypeList", refundType);
//业务类型
List<Dicinfo> bizType = dicinfoService.findDicinfoTreeNodeList("BIZ_TYPE");
modelMap.addAttribute("bizTypeList", bizType);
} catch (Exception e) {
e.printStackTrace();
@@ -89,6 +93,7 @@ public class RefundStatisticsController {
@ApiParam("开始时间") String startTime,
@ApiParam("结束时间") String endTime,
@ApiParam("支付方式") String payType,
@ApiParam("业务类型") String bizType,
@ApiParam("退款类型") String refundType,
@ApiParam("统计维度") String dimension,
@ApiParam("页码") int page,
@@ -101,6 +106,7 @@ public class RefundStatisticsController {
map.put("startTime", startTime);
map.put("endTime", endTime);
map.put("payType", payType);
map.put("bizType", bizType);
map.put("refundType", refundType);
map.put("dimension", dimension);
@@ -133,6 +139,7 @@ public class RefundStatisticsController {
@ApiParam("开始时间") String startTime,
@ApiParam("结束时间") String endTime,
@ApiParam("支付方式") String payType,
@ApiParam("业务类型") String bizType,
@ApiParam("退款类型") String refundType) {
HashMap<Object, Object> responseMap = new HashMap<Object, Object>();
@@ -142,6 +149,7 @@ public class RefundStatisticsController {
map.put("startTime", startTime);
map.put("endTime", endTime);
map.put("payType", payType);
map.put("bizType", bizType);
map.put("refundType", refundType);
HashMap<Object, Object> summaryData = refundStatisticsService.getRefundSummary(map);
@@ -171,6 +179,7 @@ public class RefundStatisticsController {
@ApiParam("开始时间") String startTime,
@ApiParam("结束时间") String endTime,
@ApiParam("支付方式") String payType,
@ApiParam("业务类型") String bizType,
@ApiParam("退款类型") String refundType) {
HashMap<Object, Object> responseMap = new HashMap<Object, Object>();
@@ -180,6 +189,7 @@ public class RefundStatisticsController {
map.put("startTime", startTime);
map.put("endTime", endTime);
map.put("payType", payType);
map.put("bizType", bizType);
map.put("refundType", refundType);
List<HashMap<Object, Object>> trendData = refundStatisticsService.getRefundTrend(map);
@@ -209,6 +219,7 @@ public class RefundStatisticsController {
@ApiParam("开始时间") String startTime,
@ApiParam("结束时间") String endTime,
@ApiParam("支付方式") String payType,
@ApiParam("业务类型") String bizType,
@ApiParam("退款类型") String refundType,
@ApiParam("统计维度") String dimension) {
@@ -219,6 +230,7 @@ public class RefundStatisticsController {
map.put("startTime", startTime);
map.put("endTime", endTime);
map.put("payType", payType);
map.put("bizType", bizType);
map.put("refundType", refundType);
map.put("dimension", dimension);
@@ -236,5 +248,3 @@ public class RefundStatisticsController {
return responseMap;
}
}

View File

@@ -76,7 +76,9 @@ public class HisDetailController {
@ApiOperation(value = "查询his详细记录", notes = "")
@GetMapping("/findHisDetail")
@ResponseBody
public HashMap<Object, Object> findHisDetail(@ApiParam(value = "付款方式") String payType, String startTime, String endTime, String likeFiled, int page, int limit) {
public HashMap<Object, Object> findHisDetail(@ApiParam(value = "付款方式") String payType,
@ApiParam(value = "业务类型") String bizType,
String startTime, String endTime, String likeFiled, int page, int limit) {
HashMap<Object, Object> responseMap = new HashMap<>();
try {
@@ -85,6 +87,7 @@ public class HisDetailController {
map.put("startTime", startTime);
map.put("endTime", endTime);
map.put("likeFiled", likeFiled);
map.put("bizType", bizType);
PageHelper.startPage(page, limit);
PageInfo<HashMap<Object, Object>> pageInfo = new PageInfo<HashMap<Object, Object>>(hisDetailService.findHisDetail(map));

View File

@@ -9,6 +9,7 @@ import com.saye.hospitalgd.service.BankbillHistoryService;
import com.saye.hospitalgd.service.TransactionDetailService;
import com.saye.hospitalgd.service.system.DicinfoService;
import com.saye.hospitalgd.service.system.ServiceParamsService;
import com.saye.hospitalgd.service.FinancialReconciliation.TenpaySummaryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -49,6 +50,9 @@ public class PaymentStatisticsController {
@Autowired
private ServiceParamsService serviceParamsService;
@Autowired
private TenpaySummaryService tenpaySummaryService;
@RequestMapping("/toPaymentStatistics")
public String toPaymentStatistics(ModelMap modelMap) {
return "paymentStatistics/paymentStatistics";
@@ -259,6 +263,27 @@ public class PaymentStatisticsController {
return "paymentStatistics/summary";
}
@RequestMapping("/toTenpaySummary")
@ApiOperation("财付通汇款汇总表")
public String toTenpaySummary(HttpServletRequest request, ModelMap modelMap) {
String trade_date = StringDUtil.changeNullToEmpty(request.getParameter("trade_date"));
if ("".equals(trade_date)) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.DATE, -1);
Date startDate = calendar.getTime();
String startTime = DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd, startDate);
String endTime = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd);
modelMap.addAttribute("startTime", startTime);
modelMap.addAttribute("endTime", endTime);
} else {
modelMap.addAttribute("startTime", trade_date);
modelMap.addAttribute("endTime", trade_date);
modelMap.addAttribute("isClick", "1");
}
return "paymentStatistics/tenpaySummary";
}
/**
* @description: 查询汇总表数据
* @author thuang
@@ -421,4 +446,26 @@ public class PaymentStatisticsController {
return resultMap;
}
@RequestMapping("/findTenpaySummary")
@ResponseBody
@ApiOperation("查询财付通汇款汇总数据")
public HashMap<Object, Object> findTenpaySummary(String startTime, String endTime) {
HashMap<Object, Object> response = new HashMap<>();
try {
HashMap<Object, Object> map = new HashMap<>();
map.put("startTime", startTime);
map.put("endTime", endTime);
List<HashMap<Object, Object>> bankList = tenpaySummaryService.findTenpayBankSummary(map);
List<HashMap<Object, Object>> hisList = tenpaySummaryService.findTenpayHisSummary(map);
response.put("code", 0);
response.put("msg", "OK");
response.put("bankData", bankList);
response.put("hisData", hisList);
} catch (Exception e) {
response.put("code", 1);
response.put("msg", e.getMessage());
}
return response;
}
}

View File

@@ -0,0 +1,10 @@
package com.saye.hospitalgd.mapper.FinancialReconciliation;
import java.util.HashMap;
import java.util.List;
public interface TenpaySummaryMapper {
List<HashMap<Object, Object>> findTenpaySummary(HashMap<Object, Object> map);
List<HashMap<Object, Object>> findTenpayBankSummary(HashMap<Object, Object> map);
List<HashMap<Object, Object>> findTenpayHisSummary(HashMap<Object, Object> map);
}

View File

@@ -149,12 +149,7 @@ public class HISGetDataMethodByHY {
//业务类型 0发病历1办卡2就诊卡充值3当日挂号-3 挂号退费4门诊缴费-4 单据退费5现场预约-5 预约退费6预约取号7住院缴费-7出院结算退费-77 预存作废退费
String bizType = StringDUtil.changeNullToEmpty(hisBillHashMap.get("bizType"));
String tradingStatus="1";
//如果业务类型是负数 那就是退款记录
int i1 = new BigDecimal(0).compareTo(new BigDecimal(bizType));
if (i1>0){
tradingStatus="2";
}
String tradingStatus = "1";
//支付方式 修改为字典表对应
String payType = StringDUtil.changeNullToEmpty(hisBillHashMap.get("payType"));
@@ -167,6 +162,13 @@ public class HISGetDataMethodByHY {
//交易金额
String amount = StringDUtil.changeNullToEmpty(hisBillHashMap.get("amount"));
try {
if (new BigDecimal(amount).compareTo(BigDecimal.ZERO) < 0) {
tradingStatus = "2";
}
} catch (Exception ex) {
tradingStatus = "1";
}
//说明
String remarks = "";

View File

@@ -184,11 +184,13 @@ public class HISGetDataMethodByJH {
//业务类型 0发病历1办卡2就诊卡充值3当日挂号-3 挂号退费4门诊缴费-4 单据退费5现场预约-5 预约退费6预约取号7住院缴费-7出院结算退费-77 预存作废退费
String bizType = StringDUtil.changeNullToEmpty(hisBillHashMap.get("bizType"));
String tradingStatus="1";
//如果业务类型是负数 那就是退款记录
int i1 = new BigDecimal(0).compareTo(new BigDecimal(bizType));
if (i1>0){
tradingStatus="2";
String tradingStatus = "1";
try {
if (new BigDecimal(amount).compareTo(BigDecimal.ZERO) < 0) {
tradingStatus = "2";
}
} catch (Exception ex) {
tradingStatus = "1";
}
//支付方式 严格按照字典表转换

View File

@@ -95,9 +95,21 @@ public class MedicalInsuranceReconciliationMethod {
LogUtil.info(this.getClass(), "查询到医保分组数据:" + medicalRecords.size() + "");
// 删除当天旧的对账结果
// 先查询当日已存在的结果(用于判断是否为二次核对)
MedicalInsuranceReconciliationService reconciliationService =
GetBeanUtil.getBean(MedicalInsuranceReconciliationServiceImpl.class);
HashMap<Object, Object> prevQueryMap = new HashMap<>();
prevQueryMap.put("trade_date", trade_date);
List<HashMap<Object, Object>> prevResults = reconciliationService.findMedicalInsuranceReconciliationResult(prevQueryMap);
HashMap<String, String> prevStatusMap = new HashMap<>();
if (prevResults != null) {
for (HashMap<Object, Object> prev : prevResults) {
String key = StringDUtil.changeNullToEmpty(prev.get("insutype")) + "|" + StringDUtil.changeNullToEmpty(prev.get("clr_type"));
prevStatusMap.put(key, StringDUtil.changeNullToEmpty(prev.get("stmt_rslt")));
}
}
// 删除当天旧的对账结果,再写入新结果
HashMap<Object, Object> deleteMap = new HashMap<>();
deleteMap.put("trade_date", trade_date);
reconciliationService.deleteMedicalInsuranceReconciliationResult(deleteMap);
@@ -140,8 +152,20 @@ public class MedicalInsuranceReconciliationMethod {
resultMap.put("acct_pay", acct_pay);
resultMap.put("fixmedins_setl_cnt", fixmedins_setl_cnt);
resultMap.put("setl_optins", callResult.get("setl_optins"));
resultMap.put("stmt_rslt", callResult.get("stmt_rslt"));
String newStmtRslt = StringDUtil.changeNullToEmpty(callResult.get("stmt_rslt"));
resultMap.put("stmt_rslt", newStmtRslt);
resultMap.put("stmt_rslt_dscr", callResult.get("stmt_rslt_dscr"));
// 二次核对标志计算
String key = insutype + "|" + clrType;
String prevStmt = prevStatusMap.get(key);
String recheckFlag = ("1".equals(prevStmt) && "0".equals(newStmtRslt)) ? "1" : "0";
int checkRound = prevStatusMap.containsKey(key) ? 2 : 1;
resultMap.put("execute_type", "manual");
resultMap.put("check_round", checkRound);
resultMap.put("recheck_flag", recheckFlag);
resultMap.put("prev_stmt_rslt", prevStmt);
resultMap.put("recheck_time", "1".equals(recheckFlag) ? DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss) : null);
resultMap.put("recheck_user", "");
resultMap.put("infcode", callResult.get("infcode"));
resultMap.put("err_msg", callResult.get("err_msg"));
resultMap.put("warn_msg", callResult.get("warn_msg"));
@@ -170,6 +194,12 @@ public class MedicalInsuranceReconciliationMethod {
resultMap.put("fixmedins_setl_cnt", fixmedins_setl_cnt);
resultMap.put("stmt_rslt", "9");
resultMap.put("stmt_rslt_dscr", "调用医保局接口失败:" + e.getMessage());
resultMap.put("execute_type", "manual");
resultMap.put("check_round", prevStatusMap.size() > 0 ? 2 : 1);
resultMap.put("recheck_flag", "0");
resultMap.put("prev_stmt_rslt", "");
resultMap.put("recheck_time", null);
resultMap.put("recheck_user", "");
resultMap.put("api_result", "ERROR");
resultMap.put("create_time", DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss));
resultMap.put("modify_time", DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss));
@@ -355,4 +385,3 @@ public class MedicalInsuranceReconciliationMethod {
return result;
}
}

View File

@@ -180,7 +180,7 @@ public class ReconciliationMethod {
//数据库中对比完是只有三种状态 his单边 三方单边 差异 分别判断3种账单实际情况 如单边是因为跨天
//err_type 1 his单边 2 三方单边 3 差异
if ("1".equals(check_result) && "1".equals(err_type)) {
if (("1".equals(check_result) || "2".equals(check_result)) && "1".equals(err_type)) {
//his单边账 查询历史单边账表是否是否已有记录 有不动 没有添加
List<HashMap<Object, Object>> unilateralList = null;
HashMap<Object, Object> noCashSearchMap = new HashMap<>();
@@ -256,19 +256,23 @@ public class ReconciliationMethod {
//修改该记录状态为自动核销
updateHisMap.put("is_manager", "0");
updateHisMap.put("is_manager", "1");
updateHisMap.put("remark", "系统自动核销");
updateHisMap.put("manager_time", DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss));
updateHisMap.put("modify_time", DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss));
updateHisMap.put("tranID", tranid);
updateHisMap.put("h_jylx", h_jylx);
updateHisMap.put("trade_date", thistrade_date);
updateHisMap.put("check_result", "2");
updateThirdMap.put("is_manager", "0");
updateThirdMap.put("is_manager", "1");
updateThirdMap.put("remark", "系统自动核销");
updateThirdMap.put("manager_time", DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss));
updateThirdMap.put("modify_time", DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss));
updateThirdMap.put("i_ddh", tranid);
updateThirdMap.put("i_jylx", h_jylx);
updateThirdMap.put("trade_date", thistrade_date);
updateThirdMap.put("check_result", "2");
// updateThirdMap.put("is_manager", "0");
@@ -488,18 +492,22 @@ public class ReconciliationMethod {
//如果两边金额相同 设置核销 更新关联明细表为核销
if (AmountUtil.isAmountEqual(hisJe, i_jyje)) {
//修改该记录状态为自动核销
updateHisMap.put("is_manager", "0");
updateHisMap.put("is_manager", "1");
updateHisMap.put("remark", "系统自动核销");
updateHisMap.put("manager_time", DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss));
updateHisMap.put("modify_time", DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss));
updateHisMap.put("tranID", i_ddh);
updateHisMap.put("h_jylx", h_jylx);
updateHisMap.put("trade_date", thistrade_date);
updateHisMap.put("check_result", "2");
updateThirdMap.put("is_manager", "0");
updateThirdMap.put("is_manager", "1");
updateThirdMap.put("remark", "系统自动核销");
updateThirdMap.put("manager_time", DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss));
updateThirdMap.put("modify_time", DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss));
updateThirdMap.put("i_ddh", i_ddh);
updateThirdMap.put("i_jylx", i_jylx);
updateThirdMap.put("trade_date", thistrade_date);
updateThirdMap.put("check_result", "2");
@@ -509,6 +517,14 @@ public class ReconciliationMethod {
//修改单边账记录表
unilateralService.updateUnilateral(updateThirdMap);
HashMap<Object, Object> updateHisUnilateral = new HashMap<>();
updateHisUnilateral.put("is_manager", "1");
updateHisUnilateral.put("remark", "系统自动核销");
updateHisUnilateral.put("manager_time", DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss));
updateHisUnilateral.put("modify_time", DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss));
updateHisUnilateral.put("tranID", i_ddh);
updateHisUnilateral.put("h_jylx", h_jylx);
unilateralService.updateUnilateral(updateHisUnilateral);
}
}

View File

@@ -0,0 +1,10 @@
package com.saye.hospitalgd.service.FinancialReconciliation;
import java.util.HashMap;
import java.util.List;
public interface TenpaySummaryService {
List<HashMap<Object, Object>> findTenpaySummary(HashMap<Object, Object> map);
List<HashMap<Object, Object>> findTenpayBankSummary(HashMap<Object, Object> map);
List<HashMap<Object, Object>> findTenpayHisSummary(HashMap<Object, Object> map);
}

View File

@@ -0,0 +1,31 @@
package com.saye.hospitalgd.service.impl.FinancialReconciliation;
import com.saye.hospitalgd.mapper.FinancialReconciliation.TenpaySummaryMapper;
import com.saye.hospitalgd.service.FinancialReconciliation.TenpaySummaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
@Service
public class TenpaySummaryServiceImpl implements TenpaySummaryService {
@Autowired
private TenpaySummaryMapper tenpaySummaryMapper;
@Override
public List<HashMap<Object, Object>> findTenpaySummary(HashMap<Object, Object> map) {
return tenpaySummaryMapper.findTenpaySummary(map);
}
@Override
public List<HashMap<Object, Object>> findTenpayBankSummary(HashMap<Object, Object> map) {
return tenpaySummaryMapper.findTenpayBankSummary(map);
}
@Override
public List<HashMap<Object, Object>> findTenpayHisSummary(HashMap<Object, Object> map) {
return tenpaySummaryMapper.findTenpayHisSummary(map);
}
}