bugfix:对账对平
This commit is contained in:
@@ -0,0 +1,418 @@
|
||||
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.excel.ExportXLSX;
|
||||
import com.saye.hospitalgd.commons.excel.HashMapConversionImpl;
|
||||
import com.saye.hospitalgd.commons.excel.IConversionByExport;
|
||||
import com.saye.hospitalgd.commons.log.ExceptionDUtil;
|
||||
import com.saye.hospitalgd.commons.log.LogUtil;
|
||||
import com.saye.hospitalgd.commons.string.StringDUtil;
|
||||
import com.saye.hospitalgd.model.Dicinfo;
|
||||
import com.saye.hospitalgd.model.StatusDefine;
|
||||
import com.saye.hospitalgd.service.InpatientBillService;
|
||||
import com.saye.hospitalgd.service.system.DicinfoService;
|
||||
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.io.File;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: 住院账单查询
|
||||
* @date 2025/11/21
|
||||
*/
|
||||
@Api(value = "住院账单查询相关接口")
|
||||
@Controller
|
||||
@RequestMapping("/inpatientBill")
|
||||
public class InpatientBillController {
|
||||
|
||||
@Autowired
|
||||
private InpatientBillService inpatientBillService;
|
||||
|
||||
@Autowired
|
||||
private DicinfoService dicinfoService;
|
||||
|
||||
/**
|
||||
* 跳转到住院账单查询页面
|
||||
*/
|
||||
@RequestMapping("/toInpatientBill")
|
||||
public String toInpatientBill(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);
|
||||
|
||||
// 支付方式
|
||||
List<Dicinfo> pay_type = dicinfoService.findDicinfoTreeNodeList("PAY_TYPE");
|
||||
modelMap.addAttribute("payTypeList", pay_type);
|
||||
|
||||
// 业务类型
|
||||
List<Dicinfo> biz_type = dicinfoService.findDicinfoTreeNodeList("BIZ_TYPE");
|
||||
modelMap.addAttribute("bizTypeList", biz_type);
|
||||
|
||||
// 三方支付方式
|
||||
List<Dicinfo> third_pay = dicinfoService.findDicinfoTreeNodeList("THIRD_PAY");
|
||||
modelMap.addAttribute("thirdPayList", third_pay);
|
||||
|
||||
return "financialReconciliation/inpatientBill";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询HIS住院账单明细
|
||||
*/
|
||||
@ApiOperation(value = "查询HIS住院账单明细", notes = "")
|
||||
@GetMapping("/findHisInpatientDetail")
|
||||
@ResponseBody
|
||||
public HashMap<Object, Object> findHisInpatientDetail(
|
||||
@ApiParam(value = "开始时间") String startTime,
|
||||
@ApiParam(value = "结束时间") String endTime,
|
||||
@ApiParam(value = "支付方式") String payType,
|
||||
@ApiParam(value = "业务类型") String bizType,
|
||||
@ApiParam(value = "模糊查询字段") String likeFiled,
|
||||
@ApiParam(value = "页码") int page,
|
||||
@ApiParam(value = "每页限制个数") int limit) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
HashMap<Object, Object> map = new HashMap<>();
|
||||
map.put("startTime", startTime);
|
||||
map.put("endTime", endTime);
|
||||
map.put("payType", payType);
|
||||
map.put("bizType", bizType);
|
||||
map.put("likeFiled", likeFiled);
|
||||
|
||||
String militaryPaymentCode = getPayTypeCodeByNames("军保支付", "医院垫支");
|
||||
String checkPaymentCode = getPayTypeCodeByNames("支票支付", "支票");
|
||||
if (checkPaymentCode == null || "".equals(checkPaymentCode)) {
|
||||
checkPaymentCode = "无";
|
||||
}
|
||||
map.put("military_payment_code", militaryPaymentCode);
|
||||
map.put("check_payment_code", checkPaymentCode);
|
||||
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<HashMap<Object, Object>> pageInfo = new PageInfo<>(inpatientBillService.findHisInpatientDetail(map));
|
||||
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
responseMap.put("count", pageInfo.getTotal());
|
||||
responseMap.put("data", pageInfo.getList());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String msg = e.getMessage();
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "查询失败,原因:" + msg);
|
||||
}
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询银行住院账单明细
|
||||
*/
|
||||
@ApiOperation(value = "查询银行住院账单明细", notes = "")
|
||||
@GetMapping("/findBankInpatientDetail")
|
||||
@ResponseBody
|
||||
public HashMap<Object, Object> findBankInpatientDetail(
|
||||
@ApiParam(value = "开始时间") String startTime,
|
||||
@ApiParam(value = "结束时间") String endTime,
|
||||
@ApiParam(value = "支付方式") String c_zffs,
|
||||
@ApiParam(value = "模糊查询字段") String likeFiled,
|
||||
@ApiParam(value = "页码") int page,
|
||||
@ApiParam(value = "每页限制个数") int limit) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
HashMap<Object, Object> map = new HashMap<>();
|
||||
map.put("startTime", startTime);
|
||||
map.put("endTime", endTime);
|
||||
map.put("c_zffs", c_zffs);
|
||||
map.put("likeFiled", likeFiled);
|
||||
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<HashMap<Object, Object>> pageInfo = new PageInfo<>(inpatientBillService.findBankInpatientDetail(map));
|
||||
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
responseMap.put("count", pageInfo.getTotal());
|
||||
responseMap.put("data", pageInfo.getList());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String msg = e.getMessage();
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "查询失败,原因:" + msg);
|
||||
}
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询每日汇总数据
|
||||
*/
|
||||
@ApiOperation(value = "查询每日汇总数据", notes = "")
|
||||
@GetMapping("/findDailySummary")
|
||||
@ResponseBody
|
||||
public HashMap<Object, Object> findDailySummary(
|
||||
@ApiParam(value = "开始时间") String startTime,
|
||||
@ApiParam(value = "结束时间") String endTime) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
HashMap<Object, Object> map = new HashMap<>();
|
||||
map.put("startTime", startTime);
|
||||
map.put("endTime", endTime);
|
||||
|
||||
String militaryPaymentCode = getPayTypeCodeByNames("军保支付", "医院垫支");
|
||||
String checkPaymentCode = getPayTypeCodeByNames("支票支付", "支票");
|
||||
if (checkPaymentCode == null || "".equals(checkPaymentCode)) {
|
||||
checkPaymentCode = "无";
|
||||
}
|
||||
map.put("military_payment_code", militaryPaymentCode);
|
||||
map.put("check_payment_code", checkPaymentCode);
|
||||
|
||||
List<HashMap<Object, Object>> summaryList = inpatientBillService.findDailySummary(map);
|
||||
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
responseMap.put("data", summaryList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String msg = e.getMessage();
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "查询失败,原因:" + msg);
|
||||
}
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出HIS住院账单明细
|
||||
*/
|
||||
@RequestMapping("/exportHisInpatientDetail")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "导出HIS住院账单明细", notes = "")
|
||||
public HashMap<Object, Object> exportHisInpatientDetail(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
String dlName = "";
|
||||
String fileName = "";
|
||||
|
||||
String dowloadName = StringDUtil.changeNullToEmpty(map.get("dowloadName"));
|
||||
|
||||
try {
|
||||
String militaryPaymentCode = getPayTypeCodeByNames("军保支付", "医院垫支");
|
||||
String checkPaymentCode = getPayTypeCodeByNames("支票支付", "支票");
|
||||
if (checkPaymentCode == null || "".equals(checkPaymentCode)) {
|
||||
checkPaymentCode = "无";
|
||||
}
|
||||
map.put("military_payment_code", militaryPaymentCode);
|
||||
map.put("check_payment_code", checkPaymentCode);
|
||||
|
||||
List<HashMap<Object, Object>> list = inpatientBillService.findHisInpatientDetail(map);
|
||||
|
||||
// 支付方式
|
||||
List<Dicinfo> pay_type = dicinfoService.findDicinfoTreeNodeList("PAY_TYPE");
|
||||
HashMap<String, String> payTypeMap = new HashMap<>();
|
||||
for (Dicinfo dicinfo : pay_type) {
|
||||
payTypeMap.put(dicinfo.getDicvalue(), dicinfo.getDicname());
|
||||
}
|
||||
|
||||
// 业务类型
|
||||
List<Dicinfo> biz_type = dicinfoService.findDicinfoTreeNodeList("BIZ_TYPE");
|
||||
HashMap<String, String> bizTypeMap = new HashMap<>();
|
||||
for (Dicinfo dicinfo : biz_type) {
|
||||
bizTypeMap.put(dicinfo.getDicvalue(), dicinfo.getDicname());
|
||||
}
|
||||
|
||||
for (HashMap<Object, Object> hashMap : list) {
|
||||
String tradingStatus = StringDUtil.changeNullToEmpty(hashMap.get("TRADINGSTATUS"));
|
||||
if ("1".equals(tradingStatus)) {
|
||||
hashMap.put("TRADINGSTATUS", "收款记录");
|
||||
} else if ("2".equals(tradingStatus)) {
|
||||
hashMap.put("TRADINGSTATUS", "退款记录");
|
||||
} else {
|
||||
hashMap.put("TRADINGSTATUS", "");
|
||||
}
|
||||
|
||||
String biztype = StringDUtil.changeNullToEmpty(hashMap.get("BIZTYPE"));
|
||||
hashMap.put("BIZTYPE", bizTypeMap.get(biztype));
|
||||
|
||||
// 支付方式字典转换
|
||||
String paytype = StringDUtil.changeNullToEmpty(hashMap.get("PAYTYPE"));
|
||||
hashMap.put("PAYTYPE", payTypeMap.get(paytype));
|
||||
|
||||
hashMap.put("PAYMETHOD", "住院");
|
||||
}
|
||||
|
||||
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"};
|
||||
|
||||
List<Object> rulList = new ArrayList<>(list);
|
||||
|
||||
// 创建工作表
|
||||
ExportXLSX exportXLS = new ExportXLSX(DISTANCE_HEADERNAME, sqlKey, ExportXLSX.A3, false);
|
||||
exportXLS.setTitleName(dowloadName);
|
||||
IConversionByExport conversion = new HashMapConversionImpl();
|
||||
exportXLS.setConversion(conversion);
|
||||
exportXLS.setData(rulList);
|
||||
|
||||
exportXLS.modifyWidthOfHeader("5000", 0);
|
||||
exportXLS.modifyWidthOfHeader("5000", 1);
|
||||
exportXLS.modifyWidthOfHeader("5000", 2);
|
||||
exportXLS.modifyWidthOfHeader("5000", 3);
|
||||
exportXLS.modifyWidthOfHeader("5000", 4);
|
||||
exportXLS.modifyWidthOfHeader("5000", 5);
|
||||
exportXLS.modifyWidthOfHeader("8000", 6);
|
||||
exportXLS.modifyWidthOfHeader("5000", 7);
|
||||
exportXLS.modifyWidthOfHeader("5000", 8);
|
||||
exportXLS.modifyWidthOfHeader("5000", 9);
|
||||
exportXLS.modifyWidthOfHeader("5000", 10);
|
||||
exportXLS.modifyWidthOfHeader("10000", 11);
|
||||
|
||||
// 文件名称
|
||||
String randomStr = StringDUtil.generateRandomCodeForLength(4);
|
||||
dlName = DateDUtil.DateToStr(DateDUtil.yyyyMMddHHmmss, new Date()) + randomStr;
|
||||
fileName = dlName + ".xlsx";
|
||||
|
||||
String uploadPath = StatusDefine.filePath + "/InpatientBill/";
|
||||
File uploadPathFile = new File(uploadPath);
|
||||
if (!uploadPathFile.exists()) uploadPathFile.mkdirs();
|
||||
|
||||
String savePath = uploadPath + fileName;
|
||||
exportXLS.execGenerateExcel(savePath);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
errCode = "999";
|
||||
errMsg = "未知异常:" + ExceptionDUtil.getDetailExceptionMsg(e);
|
||||
LogUtil.error(this.getClass(), "@@@系统出错!【" + errMsg + "】");
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
responseMap.put("dlName", "InpatientBill/" + fileName);
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
private String getPayTypeCodeByNames(String... names) {
|
||||
for (String name : names) {
|
||||
HashMap<String, String> param = new HashMap<>();
|
||||
param.put("parentCode", "PAY_TYPE");
|
||||
param.put("dicname", name);
|
||||
List<HashMap<Object, Object>> list = dicinfoService.selectDicinfoListByCondition(param);
|
||||
if (list != null && list.size() > 0) {
|
||||
Object val = list.get(0).get("dicvalue");
|
||||
String code = StringDUtil.changeNullToEmpty(val);
|
||||
if (!"".equals(code)) {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出银行住院账单明细
|
||||
*/
|
||||
@RequestMapping("/exportBankInpatientDetail")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "导出银行住院账单明细", notes = "")
|
||||
public HashMap<Object, Object> exportBankInpatientDetail(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
String dlName = "";
|
||||
String fileName = "";
|
||||
|
||||
String dowloadName = StringDUtil.changeNullToEmpty(map.get("dowloadName"));
|
||||
|
||||
try {
|
||||
List<HashMap<Object, Object>> list = inpatientBillService.findBankInpatientDetail(map);
|
||||
|
||||
// 支付方式
|
||||
List<Dicinfo> pay_type = dicinfoService.findDicinfoTreeNodeList("THIRD_PAY");
|
||||
HashMap<String, String> peyTypeMap = new HashMap<>();
|
||||
for (Dicinfo dicinfo : pay_type) {
|
||||
peyTypeMap.put(dicinfo.getDicvalue(), dicinfo.getDicname());
|
||||
}
|
||||
|
||||
for (HashMap<Object, Object> hashMap : list) {
|
||||
String c_zffs = StringDUtil.changeNullToEmpty(hashMap.get("C_ZFFS"));
|
||||
hashMap.put("C_ZFFS", peyTypeMap.get(c_zffs));
|
||||
}
|
||||
|
||||
if (list.size() > 0) {
|
||||
// 定义标题头和文件名
|
||||
String[] DISTANCE_HEADERNAME = {"交易日期", "交易时间", "清算日期", "流水号", "商户订单号", "银商订单号", "交易类型", "卡号", "发卡行", "交易金额", "清算金额", "手续费", "实际支付金额", "终端号", "支付方式", "卡类型"};
|
||||
String[] sqlKey = {"C_JYRQ", "C_JYSJ", "C_QSRQ", "C_LSH", "C_SHDDH", "C_YSDDH", "C_JYLX", "C_CARD", "C_FKH", "C_JYJE", "C_QSJE", "C_SXF", "C_SJZFJE", "C_ZDH", "C_ZFFS", "C_KLX"};
|
||||
|
||||
List<Object> rulList = new ArrayList<>(list);
|
||||
|
||||
// 创建工作表
|
||||
ExportXLSX exportXLS = new ExportXLSX(DISTANCE_HEADERNAME, sqlKey, ExportXLSX.A3, false);
|
||||
exportXLS.setTitleName(dowloadName);
|
||||
IConversionByExport conversion = new HashMapConversionImpl();
|
||||
exportXLS.setConversion(conversion);
|
||||
exportXLS.setData(rulList);
|
||||
|
||||
exportXLS.modifyWidthOfHeader("5000", 0);
|
||||
exportXLS.modifyWidthOfHeader("5000", 1);
|
||||
exportXLS.modifyWidthOfHeader("5000", 2);
|
||||
exportXLS.modifyWidthOfHeader("10000", 3);
|
||||
exportXLS.modifyWidthOfHeader("6000", 4);
|
||||
exportXLS.modifyWidthOfHeader("10000", 5);
|
||||
exportXLS.modifyWidthOfHeader("5000", 6);
|
||||
exportXLS.modifyWidthOfHeader("5000", 7);
|
||||
exportXLS.modifyWidthOfHeader("5000", 8);
|
||||
exportXLS.modifyWidthOfHeader("5000", 9);
|
||||
exportXLS.modifyWidthOfHeader("5000", 10);
|
||||
exportXLS.modifyWidthOfHeader("5000", 11);
|
||||
exportXLS.modifyWidthOfHeader("5000", 12);
|
||||
exportXLS.modifyWidthOfHeader("5000", 13);
|
||||
exportXLS.modifyWidthOfHeader("5000", 14);
|
||||
exportXLS.modifyWidthOfHeader("10000", 15);
|
||||
|
||||
// 文件名称
|
||||
String randomStr = StringDUtil.generateRandomCodeForLength(4);
|
||||
dlName = DateDUtil.DateToStr(DateDUtil.yyyyMMddHHmmss, new Date()) + randomStr;
|
||||
fileName = dlName + ".xlsx";
|
||||
|
||||
String uploadPath = StatusDefine.filePath + "/InpatientBill/";
|
||||
File uploadPathFile = new File(uploadPath);
|
||||
if (!uploadPathFile.exists()) uploadPathFile.mkdirs();
|
||||
|
||||
String savePath = uploadPath + fileName;
|
||||
exportXLS.execGenerateExcel(savePath);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
errCode = "999";
|
||||
errMsg = "未知异常:" + ExceptionDUtil.getDetailExceptionMsg(e);
|
||||
LogUtil.error(this.getClass(), "@@@系统出错!【" + errMsg + "】");
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
responseMap.put("dlName", "InpatientBill/" + fileName);
|
||||
return responseMap;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
package com.saye.hospitalgd.mapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: 住院账单查询Mapper接口
|
||||
* @date 2025/11/21
|
||||
*/
|
||||
public interface InpatientBillMapper {
|
||||
|
||||
/**
|
||||
* 查询HIS住院账单明细
|
||||
*/
|
||||
List<HashMap<Object, Object>> findHisInpatientDetail(HashMap<Object, Object> map) throws Exception;
|
||||
|
||||
/**
|
||||
* 查询银行住院账单明细
|
||||
*/
|
||||
List<HashMap<Object, Object>> findBankInpatientDetail(HashMap<Object, Object> map) throws Exception;
|
||||
|
||||
/**
|
||||
* 查询每日汇总数据
|
||||
*/
|
||||
List<HashMap<Object, Object>> findDailySummary(HashMap<Object, Object> map) throws Exception;
|
||||
}
|
||||
|
||||
|
||||
@@ -696,7 +696,7 @@ public class BankGetDataMethodByJHLZF {
|
||||
|
||||
// 根据终端号判断是否为住院订单
|
||||
// 终端号为10091548或10091549的为住院订单,不参与对账
|
||||
if ("10091548".equals(zdh) || "10091549".equals(zdh) || "10091546".equals(zdh)) {
|
||||
if ("10091548".equals(zdh) || "10091549".equals(zdh) || "10091546".equals(zdh) || "10091547".equals(zdh) || "10091544".equals(zdh) || "10091545".equals(zdh)) {
|
||||
bankbillHistory.setIsInpatient("1"); // 标记为住院订单
|
||||
log.info("标记为住院订单: 终端号=" + zdh + ", 订单号=" + bankbillHistory.getCShddh());
|
||||
} else {
|
||||
|
||||
@@ -34,6 +34,8 @@ public class HISGetDataMethodByJH {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(HISGetDataMethodByJH.class);
|
||||
|
||||
|
||||
|
||||
public HashMap<Object,Object> getDate(String id, String name, String trade_date, String his_wsdl_id){
|
||||
HashMap<Object,Object> responseMap=new HashMap<>();
|
||||
String errCode="0";
|
||||
@@ -48,6 +50,8 @@ public class HISGetDataMethodByJH {
|
||||
|
||||
HisInterFaceConfigService hisInterFaceConfigService = GetBeanUtil.getBean(HisInterFaceConfigServiceImpl.class);
|
||||
|
||||
|
||||
|
||||
try {
|
||||
//查询需要用到的参数
|
||||
|
||||
@@ -146,7 +150,7 @@ public class HISGetDataMethodByJH {
|
||||
//获取PowerTranID和ReceiptNO作为唯一标识
|
||||
String powerTranID = StringDUtil.changeNullToEmpty(hisBillHashMap.get("powerTranID"));
|
||||
String receiptNO = StringDUtil.changeNullToEmpty(hisBillHashMap.get("receiptNO"));
|
||||
String hisTransId = StringDUtil.changeNullToEmpty(hisBillHashMap.get("hisTransId"));
|
||||
// String hisTransId = StringDUtil.changeNullToEmpty(hisBillHashMap.get("hisTransId")); // 已在HisUtil中赋值,此处不再重复获取
|
||||
|
||||
// 修改跳过逻辑:只有当关键业务信息都缺失时才跳过
|
||||
// 检查是否有足够的业务信息来处理这条记录
|
||||
@@ -163,13 +167,13 @@ public class HISGetDataMethodByJH {
|
||||
|
||||
// 只有当缺少关键业务信息时才跳过(患者ID、金额、交易时间都为空)
|
||||
if ("".equals(patientId) && "".equals(amount) && "".equals(tradeTime)){
|
||||
log.warn("跳过缺少关键业务信息的记录: powerTranID={}, receiptNO={}, hisTransId={}",
|
||||
powerTranID, receiptNO, hisTransId);
|
||||
log.warn("跳过缺少关键业务信息的记录: powerTranID={}, receiptNO={}",
|
||||
powerTranID, receiptNO);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 对于没有唯一标识的记录,记录警告但继续处理
|
||||
if ("".equals(powerTranID) && "".equals(receiptNO) && "".equals(hisTransId)){
|
||||
if ("".equals(powerTranID) && "".equals(receiptNO)){
|
||||
log.warn("处理无唯一标识的记录: patientID={}, amount={}, tradeTime={}",
|
||||
patientId, amount, tradeTime);
|
||||
}
|
||||
@@ -189,6 +193,10 @@ public class HISGetDataMethodByJH {
|
||||
|
||||
//支付方式 严格按照字典表转换
|
||||
String originalPayType = StringDUtil.changeNullToEmpty(hisBillHashMap.get("payType"));
|
||||
|
||||
// 保持接口原始的医保账户金额和统筹金额,不做按支付类型的替换或清零
|
||||
|
||||
// 转换PayType为标准编码
|
||||
String payType = convertPayTypeByDictionary(originalPayType, payTypeMap);
|
||||
|
||||
//操作员
|
||||
@@ -197,10 +205,10 @@ public class HISGetDataMethodByJH {
|
||||
//说明
|
||||
String remarks = "";
|
||||
|
||||
//银商订单号:优先使用PowerTranID,如果为空则使用ReceiptNO或HisTransId
|
||||
//银商订单号:优先使用PowerTranID,如果为空则使用ReceiptNO
|
||||
String platformTransId = powerTranID;
|
||||
if ("".equals(platformTransId)) {
|
||||
platformTransId = "".equals(receiptNO) ? hisTransId : receiptNO;
|
||||
platformTransId = receiptNO;
|
||||
}
|
||||
|
||||
//患者姓名
|
||||
@@ -209,7 +217,6 @@ public class HISGetDataMethodByJH {
|
||||
//交易日期
|
||||
String thistrade_date = StringDUtil.changeNullToEmpty(hisBillHashMap.get("trade_date"));
|
||||
|
||||
|
||||
//接口厂商
|
||||
HashMap<Object,Object> addMap=new HashMap<>();
|
||||
addMap.put("payMethod",payMethod);
|
||||
@@ -230,6 +237,7 @@ public class HISGetDataMethodByJH {
|
||||
addMap.put("ybzhAmount",ybzhAmount); // 医保账户金额
|
||||
addMap.put("ybtcAmount",ybtcAmount); // 医保统筹金额
|
||||
addMap.put("zfAmount",zfAmount); // 自费金额(混合支付中的自费部分)
|
||||
addMap.put("hisTransId",receiptNO); // HisTransId字段使用ReceiptNO的值
|
||||
|
||||
// 不再合并现金和支票记录,直接保留原始数据
|
||||
// 因为有些医保账户余额不足时会用现金支付,但仍然属于医保相关记录
|
||||
|
||||
@@ -70,15 +70,18 @@ public class MedicalInsuranceReconciliationMethod {
|
||||
try {
|
||||
LogUtil.info(this.getClass(), "开始执行医保对账,日期:" + trade_date);
|
||||
|
||||
LogUtil.info(this.getClass(), "开始查询医保数据(不限制PayType)");
|
||||
LogUtil.info(this.getClass(), "开始查询医保数据(仅统计PayType为9和10的记录,包含账户支付和统筹支付,按HisTransId去重合并统计)");
|
||||
|
||||
// 1. 从数据库查询医保数据,按险种和清算类别分组统计(不限制PayType)
|
||||
// 1. 从数据库查询医保数据,按险种和清算类别分组统计
|
||||
// 只统计PayType为'9'(账户支付)和'10'(统筹支付)的记录
|
||||
// 同一个HisTransId可能有多条记录(账户支付和统筹支付),需要合并统计金额
|
||||
// 通过HisTransId去重,确保每个交易只统计一次
|
||||
HisDetailService hisDetailService = GetBeanUtil.getBean(HisDetailServiceImpl.class);
|
||||
|
||||
HashMap<Object, Object> queryMap = new HashMap<>();
|
||||
queryMap.put("trade_date", trade_date);
|
||||
|
||||
// 查询所有有险种和清算类别的记录(不限制PayType)
|
||||
// 查询医保数据(仅统计PayType为9和10的记录,按HisTransId去重合并统计)
|
||||
List<HashMap<Object, Object>> medicalRecords = hisDetailService.findMedicalInsuranceGroupData(queryMap);
|
||||
|
||||
if (medicalRecords == null || medicalRecords.size() == 0) {
|
||||
|
||||
@@ -297,6 +297,7 @@ public class ReconciliationMethod {
|
||||
manyToOneSearchMap.put("h_jylx", i_jylx);
|
||||
manyToOneSearchMap.put("trade_date", thistrade_date);
|
||||
manyToOneSearchMap.put("orderby_je", "true");
|
||||
manyToOneSearchMap.put("payType", "2");
|
||||
|
||||
List<HashMap<Object, Object>> hisList = hisbillsHistoryService.findHisDetailByParam(manyToOneSearchMap);
|
||||
|
||||
@@ -634,6 +635,7 @@ public class ReconciliationMethod {
|
||||
|
||||
|
||||
searchNotUniqueObjMap.put("orderby_je", "true");
|
||||
searchNotUniqueObjMap.put("payType", "2");
|
||||
|
||||
// his端重复记录
|
||||
List<HashMap<Object, Object>> list = hisbillsHistoryService.findHisDetailByParam(searchNotUniqueObjMap);
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.saye.hospitalgd.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: 住院账单查询服务接口
|
||||
* @date 2025/11/21
|
||||
*/
|
||||
public interface InpatientBillService {
|
||||
|
||||
/**
|
||||
* 查询HIS住院账单明细
|
||||
*/
|
||||
List<HashMap<Object, Object>> findHisInpatientDetail(HashMap<Object, Object> map) throws Exception;
|
||||
|
||||
/**
|
||||
* 查询银行住院账单明细
|
||||
*/
|
||||
List<HashMap<Object, Object>> findBankInpatientDetail(HashMap<Object, Object> map) throws Exception;
|
||||
|
||||
/**
|
||||
* 查询每日汇总数据
|
||||
*/
|
||||
List<HashMap<Object, Object>> findDailySummary(HashMap<Object, Object> map) throws Exception;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.saye.hospitalgd.service.impl;
|
||||
|
||||
import com.saye.hospitalgd.mapper.InpatientBillMapper;
|
||||
import com.saye.hospitalgd.service.InpatientBillService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: 住院账单查询服务实现
|
||||
* @date 2025/11/21
|
||||
*/
|
||||
@Service
|
||||
public class InpatientBillServiceImpl implements InpatientBillService {
|
||||
|
||||
@Autowired
|
||||
private InpatientBillMapper inpatientBillMapper;
|
||||
|
||||
@Override
|
||||
public List<HashMap<Object, Object>> findHisInpatientDetail(HashMap<Object, Object> map) throws Exception {
|
||||
return inpatientBillMapper.findHisInpatientDetail(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HashMap<Object, Object>> findBankInpatientDetail(HashMap<Object, Object> map) throws Exception {
|
||||
return inpatientBillMapper.findBankInpatientDetail(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HashMap<Object, Object>> findDailySummary(HashMap<Object, Object> map) throws Exception {
|
||||
return inpatientBillMapper.findDailySummary(map);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user