update:医保对账
This commit is contained in:
@@ -0,0 +1,150 @@
|
||||
package com.saye.hospitalgd.controller;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.commons.log.LogUtil;
|
||||
import com.saye.hospitalgd.scheduler.jobMethod.MedicalInsuranceReconciliationMethod;
|
||||
import com.saye.hospitalgd.service.MedicalInsuranceReconciliationService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: 医保对账Controller
|
||||
* @date 2025/10/24
|
||||
*/
|
||||
@Api(value = "医保对账相关接口")
|
||||
@Controller
|
||||
@RequestMapping("/medicalInsuranceReconciliation")
|
||||
public class MedicalInsuranceReconciliationController {
|
||||
|
||||
@Autowired
|
||||
private MedicalInsuranceReconciliationService medicalInsuranceReconciliationService;
|
||||
|
||||
/**
|
||||
* 跳转到医保对账页面
|
||||
*/
|
||||
@RequestMapping("/toMedicalInsuranceReconciliation")
|
||||
public String toMedicalInsuranceReconciliation(ModelMap modelMap) {
|
||||
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);
|
||||
|
||||
return "financialReconciliation/medicalInsuranceReconciliation";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到医保对账结果页面
|
||||
*/
|
||||
@RequestMapping("/toMedicalInsuranceReconciliationResult")
|
||||
public String toMedicalInsuranceReconciliationResult(ModelMap modelMap) {
|
||||
return "financialReconciliation/medicalInsuranceReconciliationResult";
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行医保对账
|
||||
*/
|
||||
@ApiOperation(value = "执行医保对账", notes = "")
|
||||
@PostMapping("/executeMedicalInsuranceReconciliation")
|
||||
@ResponseBody
|
||||
public HashMap<Object, Object> executeMedicalInsuranceReconciliation(
|
||||
@ApiParam(value = "对账日期") @RequestParam String trade_date) {
|
||||
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
LogUtil.info(this.getClass(), "开始执行医保对账,日期:" + trade_date);
|
||||
|
||||
MedicalInsuranceReconciliationMethod reconciliationMethod = new MedicalInsuranceReconciliationMethod();
|
||||
HashMap<Object, Object> result = reconciliationMethod.executeMedicalInsuranceReconciliation(trade_date);
|
||||
|
||||
responseMap.put("code", "0".equals(result.get("errCode")) ? 0 : 1);
|
||||
responseMap.put("msg", result.get("errMsg"));
|
||||
responseMap.put("data", result.get("reconciliationResults"));
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(this.getClass(), "医保对账失败:" + e.getMessage());
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "医保对账失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询医保对账结果
|
||||
*/
|
||||
@ApiOperation(value = "查询医保对账结果", notes = "")
|
||||
@GetMapping("/findMedicalInsuranceReconciliationResult")
|
||||
@ResponseBody
|
||||
public HashMap<Object, Object> findMedicalInsuranceReconciliationResult(
|
||||
@ApiParam(value = "开始日期") String startDate,
|
||||
@ApiParam(value = "结束日期") String endDate,
|
||||
@ApiParam(value = "险种类型") String insutype,
|
||||
@ApiParam(value = "清算类别") String clrType,
|
||||
@ApiParam(value = "对账结果") String stmtRslt,
|
||||
@ApiParam(value = "页码") int page,
|
||||
@ApiParam(value = "每页数量") int limit) {
|
||||
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
HashMap<Object, Object> queryMap = new HashMap<>();
|
||||
if (startDate != null && !"".equals(startDate)) {
|
||||
queryMap.put("startDate", startDate);
|
||||
}
|
||||
if (endDate != null && !"".equals(endDate)) {
|
||||
queryMap.put("endDate", endDate);
|
||||
}
|
||||
if (insutype != null && !"".equals(insutype)) {
|
||||
queryMap.put("insutype", insutype);
|
||||
}
|
||||
if (clrType != null && !"".equals(clrType)) {
|
||||
queryMap.put("clr_type", clrType);
|
||||
}
|
||||
if (stmtRslt != null && !"".equals(stmtRslt)) {
|
||||
queryMap.put("stmt_rslt", stmtRslt);
|
||||
}
|
||||
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<HashMap<Object, Object>> pageInfo = new PageInfo<>(
|
||||
medicalInsuranceReconciliationService.findMedicalInsuranceReconciliationResult(queryMap)
|
||||
);
|
||||
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
responseMap.put("count", pageInfo.getTotal());
|
||||
responseMap.put("data", pageInfo.getList());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(this.getClass(), "查询医保对账结果失败:" + e.getMessage());
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "查询失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -141,13 +141,7 @@ public class MilitaryInsuranceController {
|
||||
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"));
|
||||
@@ -236,8 +230,8 @@ public class MilitaryInsuranceController {
|
||||
|
||||
if (list.size() > 0) {
|
||||
// 定义标题头和文件名
|
||||
String[] DISTANCE_HEADERNAME = {"交易状态", "业务类型", "支付方式", "交易时间", "交易日期", "操作员", "总金额", "平台交易号", "his订单号", "HIS交易ID", "患者id", "患者姓名", "来源"};
|
||||
String[] sqlKey = {"TRADINGSTATUS", "BIZTYPE", "PAYTYPE", "TRADETIME", "TRADE_DATE", "HISOPERCODE", "AMOUNT", "PLATFORMTRANSID", "HISTRANSID", "HISTRANSID", "PATIENTID", "PATIENTNAME", "SOURCE"};
|
||||
String[] DISTANCE_HEADERNAME = {"交易状态", "业务类型", "支付方式", "交易时间", "交易日期", "操作员", "总金额", "平台交易号", "his订单号", "HIS交易ID", "患者id", "患者姓名", "来源", "清算类别", "险种类型"};
|
||||
String[] sqlKey = {"TRADINGSTATUS", "BIZTYPE", "PAYTYPE", "TRADETIME", "TRADE_DATE", "HISOPERCODE", "AMOUNT", "PLATFORMTRANSID", "HISTRANSID", "HISTRANSID", "PATIENTID", "PATIENTNAME", "SOURCE", "CLR_TYPE", "INSUTYPE"};
|
||||
|
||||
List<Object> rulList = new ArrayList<Object>(list);
|
||||
|
||||
@@ -263,6 +257,9 @@ public class MilitaryInsuranceController {
|
||||
exportXLS.modifyWidthOfHeader("5000", 9);
|
||||
exportXLS.modifyWidthOfHeader("5000", 10);
|
||||
exportXLS.modifyWidthOfHeader("10000", 11);
|
||||
exportXLS.modifyWidthOfHeader("5000", 12); // 来源
|
||||
exportXLS.modifyWidthOfHeader("5000", 13); // 清算类别
|
||||
exportXLS.modifyWidthOfHeader("5000", 14); // 险种类型
|
||||
|
||||
// 文件名称
|
||||
// 产生4位长度的随机码(由字母和数字组成)
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,17 @@ public class BaseQuartzConfigController{
|
||||
@Autowired
|
||||
private DicinfoService dicinfoService;
|
||||
|
||||
/**
|
||||
* @description 跳转到定时任务管理页面
|
||||
* @author thuang
|
||||
* @created 2025/10/24
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/toQuartzManage")
|
||||
public String toQuartzManage() {
|
||||
return "system/quartzManage";
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询所有的定时任务
|
||||
* @author thuang
|
||||
|
||||
Reference in New Issue
Block a user