bugfix:对账排除住院订单

This commit is contained in:
Yuan
2025-11-20 09:33:53 +08:00
parent 0a344423e5
commit 97aae27351
14 changed files with 124 additions and 21 deletions

View File

@@ -150,5 +150,9 @@ public class BankbillHistory implements Serializable {
* 医疗总费用 * 医疗总费用
*/ */
private String medfeeSumamt; private String medfeeSumamt;
/**
* 是否住院订单 (0:否 1:是)
*/
private String isInpatient;
} }

View File

@@ -74,6 +74,8 @@ public interface TransactionDetailMapper {
void deleteHisAndThirdJoinDataByParamAndNotUnique(HashMap<Object, Object> map) throws Exception; void deleteHisAndThirdJoinDataByParamAndNotUnique(HashMap<Object, Object> map) throws Exception;
void deleteThirdUnilateralByIddh(HashMap<Object, Object> map) throws Exception;
void addNotUniqueData(List<HashMap<Object, Object>> list) throws Exception; void addNotUniqueData(List<HashMap<Object, Object>> list) throws Exception;
/** /**

View File

@@ -38,4 +38,9 @@ public interface UnilateralMapper {
* 根据ID删除单边账记录 * 根据ID删除单边账记录
*/ */
void deleteUnilateralById(HashMap<Object, Object> map) throws Exception; void deleteUnilateralById(HashMap<Object, Object> map) throws Exception;
/**
* 根据订单号删除银行单边账
*/
void deleteBankUnilateralByI_DDH(HashMap<Object, Object> map) throws Exception;
} }

View File

@@ -587,6 +587,9 @@ public class BankGetDataMethodByJHLZF {
// 订单号: AF列(索引31), 柜台编号: AG列(索引32), 系统参考号: AH列(索引33), // 订单号: AF列(索引31), 柜台编号: AG列(索引32), 系统参考号: AH列(索引33),
// 持卡人姓名: AI列(索引34), 付款凭证号: AJ列(索引35), 备注1: AK列(索引36), 备注2: AL列(索引37) // 持卡人姓名: AI列(索引34), 付款凭证号: AJ列(索引35), 备注1: AK列(索引36), 备注2: AL列(索引37)
// 获取终端号C列索引2用于判断是否为住院订单
String zdh = s1.length > 2 ? s1[2].trim() : "";
// 交易日期和时间 // 交易日期和时间
jyrq = s1.length > 13 ? s1[13] : ""; jyrq = s1.length > 13 ? s1[13] : "";
String jysj = s1.length > 14 ? s1[14] : ""; // 交易时间在第14列索引14 String jysj = s1.length > 14 ? s1[14] : ""; // 交易时间在第14列索引14
@@ -609,6 +612,7 @@ public class BankGetDataMethodByJHLZF {
bankbillHistory.setCJyrq(jyrq); // N列(索引13): 交易日期 bankbillHistory.setCJyrq(jyrq); // N列(索引13): 交易日期
bankbillHistory.setCJysj(jysj); // P列(索引15): 交易时间 bankbillHistory.setCJysj(jysj); // P列(索引15): 交易时间
bankbillHistory.setCJyje(s1.length > 20 ? s1[20] : "0"); // U列(索引20): 交易金额 bankbillHistory.setCJyje(s1.length > 20 ? s1[20] : "0"); // U列(索引20): 交易金额
bankbillHistory.setCZdh(zdh); // C列(索引2): 终端号
// QR列(索引16): 支付方式Excel中就是微信支付、支付宝等 // QR列(索引16): 支付方式Excel中就是微信支付、支付宝等
String zffs = s1.length > 16 ? s1[16].trim() : "建行龙支付"; String zffs = s1.length > 16 ? s1[16].trim() : "建行龙支付";
@@ -689,6 +693,15 @@ public class BankGetDataMethodByJHLZF {
bankbillHistory.setCFdjc(""); // 分店简称(空) bankbillHistory.setCFdjc(""); // 分店简称(空)
bankbillHistory.setCZddh(""); // 子订单号(空) bankbillHistory.setCZddh(""); // 子订单号(空)
bankbillHistory.setBillTableName("建行龙支付对账单"); // 对账表名 bankbillHistory.setBillTableName("建行龙支付对账单"); // 对账表名
// 根据终端号判断是否为住院订单
// 终端号为10091548或10091549的为住院订单不参与对账
if ("10091548".equals(zdh) || "10091549".equals(zdh)) {
bankbillHistory.setIsInpatient("1"); // 标记为住院订单
log.info("标记为住院订单: 终端号=" + zdh + ", 订单号=" + bankbillHistory.getCShddh());
} else {
bankbillHistory.setIsInpatient("0"); // 标记为非住院订单
}
bankbillHistoryList.add(bankbillHistory); bankbillHistoryList.add(bankbillHistory);
log.info("成功解析第 " + (i + 1) + " 行数据"); log.info("成功解析第 " + (i + 1) + " 行数据");

View File

@@ -489,8 +489,10 @@ public class ReconciliationMethod {
delMap.put("h_jylx", h_jylx); delMap.put("h_jylx", h_jylx);
transactionDetailService.deleteHisAndThirdJoinDataByParamAndNotUnique(delMap); transactionDetailService.deleteHisAndThirdJoinDataByParamAndNotUnique(delMap);
//删除当天已经生成的该条对应的可能错帐记录 // 删除当天生成的、与此重复订单号相关的、所有类型的单边账包括HIS单边和银行单边
unilateralService.deleteUnilateralByIdandStatus(delMap); unilateralService.deleteUnilateralByIdandStatus(delMap); // 按 HIS 字段删除
delMap.put("i_ddh", tranid); // tranid 与 i_ddh 在此场景下是同一个订单号
unilateralService.deleteBankUnilateralByI_DDH(delMap); // 按银行字段删除
} }
@@ -532,7 +534,8 @@ public class ReconciliationMethod {
String amountStr = StringDUtil.changeNullToEmpty(hisDetailMap.get("AMOUNT")); String amountStr = StringDUtil.changeNullToEmpty(hisDetailMap.get("AMOUNT"));
if (!"".equals(amountStr)) { if (!"".equals(amountStr)) {
try { try {
hisTotal = hisTotal.add(new java.math.BigDecimal(amountStr)); // 使用 toBigDecimal 统一精度进行累加
hisTotal = hisTotal.add(AmountUtil.toBigDecimal(amountStr));
} catch (Exception e) { } catch (Exception e) {
// 金额异常时跳过特殊处理,走原有逻辑 // 金额异常时跳过特殊处理,走原有逻辑
hisTotal = null; hisTotal = null;
@@ -545,7 +548,11 @@ public class ReconciliationMethod {
HashMap<Object, Object> bankDetailMap = list2.get(0); HashMap<Object, Object> bankDetailMap = list2.get(0);
String bankAmtStr = StringDUtil.changeNullToEmpty(bankDetailMap.get("I_JYJE")); String bankAmtStr = StringDUtil.changeNullToEmpty(bankDetailMap.get("I_JYJE"));
if (AmountUtil.isAmountEqual(hisTotal.toString(), bankAmtStr)) { // 统一为两位小数的 BigDecimal 再进行比较,避免精度问题
java.math.BigDecimal hisTotalDecimal = AmountUtil.toBigDecimal(hisTotal.toString());
java.math.BigDecimal bankAmtDecimal = AmountUtil.toBigDecimal(bankAmtStr);
if (AmountUtil.isAmountEqual(hisTotalDecimal, bankAmtDecimal)) {
// 以第一条 HIS 记录为代表,构造一条正常关联记录 // 以第一条 HIS 记录为代表,构造一条正常关联记录
HashMap<Object, Object> hisDetailMap = list.get(0); HashMap<Object, Object> hisDetailMap = list.get(0);
@@ -566,21 +573,26 @@ public class ReconciliationMethod {
String i_ddh = StringDUtil.changeNullToEmpty(bankDetailMap.get("I_DDH")); String i_ddh = StringDUtil.changeNullToEmpty(bankDetailMap.get("I_DDH"));
HashMap<Object, Object> addMap = new HashMap<>(); HashMap<Object, Object> addMap = new HashMap<>();
// 银行端字段
addMap.put("jysj", i_jyrq + " " + i_jysj); addMap.put("jysj", i_jyrq + " " + i_jysj);
addMap.put("i_ddh", i_ddh); addMap.put("i_ddh", i_ddh);
addMap.put("i_jyje", i_jyje); addMap.put("i_jyje", i_jyje);
addMap.put("i_jylx", i_jylx); addMap.put("i_jylx", i_jylx);
addMap.put("i_jyqd", i_jyqd); addMap.put("i_jyqd", i_jyqd);
addMap.put("tradeTime", tradeTime);
addMap.put("tranID", tranid); // HIS 端字段
addMap.put("tradeTime", tradeTime);
addMap.put("tranID", tranid); // HIS-平台流水号
addMap.put("BizType", bizType); addMap.put("BizType", bizType);
addMap.put("h_jylx", hJylx); addMap.put("h_jylx", hJylx);
addMap.put("amount", amount); addMap.put("amount", amount); // HIS-汇总金额
addMap.put("payType", payType); addMap.put("payType", payType);
addMap.put("hisOperNum", hisopernum); addMap.put("hisOperNum", hisopernum);
addMap.put("patientid", patientid); addMap.put("patientid", patientid);
addMap.put("patientname", patientname); addMap.put("patientname", patientname);
// 公共及状态字段
addMap.put("sort_date", tradeTime); addMap.put("sort_date", tradeTime);
addMap.put("trade_date", trade_date); addMap.put("trade_date", trade_date);
addMap.put("err_type", ""); addMap.put("err_type", "");
@@ -588,7 +600,21 @@ public class ReconciliationMethod {
addMap.put("is_active", "1"); addMap.put("is_active", "1");
addMap.put("join_id", ""); addMap.put("join_id", "");
trueList.add(addMap); // 删除第三方单边账记录third_join_his 中 err_type = '2'
HashMap<Object, Object> delThirdMap = new HashMap<>();
delThirdMap.put("trade_date", trade_date);
delThirdMap.put("i_ddh", i_ddh);
transactionDetailService.deleteThirdUnilateralByIddh(delThirdMap);
// 立即写入聚合后的正常对账记录
transactionDetailService.addNotUniqueData(Collections.singletonList(addMap));
// 清除因银行单边账先生成而残留的记录
HashMap<Object, Object> delBankUnilateralMap = new HashMap<>();
delBankUnilateralMap.put("trade_date", trade_date);
delBankUnilateralMap.put("i_ddh", i_ddh);
unilateralService.deleteBankUnilateralByI_DDH(delBankUnilateralMap);
// 已按“合并金额相等”视为正常账,不再按单条金额匹配,直接处理下一组重复 TranID // 已按“合并金额相等”视为正常账,不再按单条金额匹配,直接处理下一组重复 TranID
continue; continue;
} }
@@ -673,8 +699,8 @@ public class ReconciliationMethod {
int errNum = 0; int errNum = 0;
//如果两边都有 取出数据设置差异 // 循环处理差异
if (hisIterator.hasNext() && bankIterator.hasNext()) { while (hisIterator.hasNext() && bankIterator.hasNext()) {
HashMap<Object, Object> hisDetailMap = hisIterator.next(); HashMap<Object, Object> hisDetailMap = hisIterator.next();
HashMap<Object, Object> bankDetailMap = bankIterator.next(); HashMap<Object, Object> bankDetailMap = bankIterator.next();
@@ -749,7 +775,12 @@ public class ReconciliationMethod {
//将记录添加到单边账表 //将记录添加到单边账表
unilateralService.insertUnilateral(addUnilateralMap); unilateralService.insertUnilateral(addUnilateralMap);
} else if (hisIterator.hasNext()) {
}
// 处理HIS单边账
while (hisIterator.hasNext()) {
HashMap<Object, Object> hisDetailMap = hisIterator.next(); HashMap<Object, Object> hisDetailMap = hisIterator.next();
@@ -818,7 +849,10 @@ public class ReconciliationMethod {
//将记录添加到单边账表 //将记录添加到单边账表
unilateralService.insertUnilateral(addUnilateralMap); unilateralService.insertUnilateral(addUnilateralMap);
} else if (bankIterator.hasNext()) { }
// 处理银行单边账
while (bankIterator.hasNext()) {
HashMap<Object, Object> bankDetailMap = bankIterator.next(); HashMap<Object, Object> bankDetailMap = bankIterator.next();
String i_jyje = StringDUtil.changeNullToEmpty(bankDetailMap.get("I_JYJE")); String i_jyje = StringDUtil.changeNullToEmpty(bankDetailMap.get("I_JYJE"));

View File

@@ -71,6 +71,8 @@ public interface TransactionDetailService {
*/ */
void deleteHisAndThirdJoinDataByParamAndNotUnique(HashMap<Object, Object> map) throws Exception; void deleteHisAndThirdJoinDataByParamAndNotUnique(HashMap<Object, Object> map) throws Exception;
void deleteThirdUnilateralByIddh(HashMap<Object, Object> map) throws Exception;
/** /**
* @description: 添加处理后的非唯一记录回数据 * @description: 添加处理后的非唯一记录回数据
* @author thuang * @author thuang

View File

@@ -36,4 +36,9 @@ public interface UnilateralService {
* 根据ID删除单边账记录 * 根据ID删除单边账记录
*/ */
void deleteUnilateralById(HashMap<Object, Object> map) throws Exception; void deleteUnilateralById(HashMap<Object, Object> map) throws Exception;
/**
* 根据订单号删除银行单边账
*/
void deleteBankUnilateralByI_DDH(HashMap<Object, Object> map) throws Exception;
} }

View File

@@ -159,6 +159,11 @@ public class TransactionDetailServiceImpl implements TransactionDetailService {
transactionDetailMapper.deleteHisAndThirdJoinDataByParamAndNotUnique(map); transactionDetailMapper.deleteHisAndThirdJoinDataByParamAndNotUnique(map);
} }
@Override
public void deleteThirdUnilateralByIddh(HashMap<Object, Object> map) throws Exception {
transactionDetailMapper.deleteThirdUnilateralByIddh(map);
}
@Override @Override
public void addNotUniqueData(List<HashMap<Object, Object>> list) throws Exception { public void addNotUniqueData(List<HashMap<Object, Object>> list) throws Exception {
transactionDetailMapper.addNotUniqueData(list); transactionDetailMapper.addNotUniqueData(list);

View File

@@ -86,4 +86,9 @@ public class UnilateralServiceImpl implements UnilateralService {
public void deleteUnilateralById(HashMap<Object, Object> map) throws Exception { public void deleteUnilateralById(HashMap<Object, Object> map) throws Exception {
unilateralMapper.deleteUnilateralById(map); unilateralMapper.deleteUnilateralById(map);
} }
@Override
public void deleteBankUnilateralByI_DDH(HashMap<Object, Object> map) throws Exception {
unilateralMapper.deleteBankUnilateralByI_DDH(map);
}
} }

View File

@@ -30,12 +30,12 @@
<!--批量插入银行交易记录--> <!--批量插入银行交易记录-->
<insert id="insertAllBankHistory" parameterType="java.util.List"> <insert id="insertAllBankHistory" parameterType="java.util.List">
insert into insert into
bankbill_history(C_QSRQ,C_JYRQ,C_JYSJ,C_ZDH,C_CARD,C_JYLX,C_JYJE,C_QSJE,C_SXF,C_SJZFJE,C_CKH,C_LSH,C_KLX,C_FKH,C_ZFFS,C_YSDDH,C_SHDDH,C_BZZD,C_QBYHJE,C_SHYHJE,C_YJYLSH,C_FQQS,C_FQSXF,C_FQFWF,C_FQFXF,C_QTYHJE,C_THDDH,C_FKFY,C_FDJC,C_ZDDH,bill_table_name,FUND_PAY_SUMAMT,ACCT_PAY,MEDFEE_SUMAMT) bankbill_history(C_QSRQ,C_JYRQ,C_JYSJ,C_ZDH,C_CARD,C_JYLX,C_JYJE,C_QSJE,C_SXF,C_SJZFJE,C_CKH,C_LSH,C_KLX,C_FKH,C_ZFFS,C_YSDDH,C_SHDDH,C_BZZD,C_QBYHJE,C_SHYHJE,C_YJYLSH,C_FQQS,C_FQSXF,C_FQFWF,C_FQFXF,C_QTYHJE,C_THDDH,C_FKFY,C_FDJC,C_ZDDH,bill_table_name,FUND_PAY_SUMAMT,ACCT_PAY,MEDFEE_SUMAMT,is_inpatient)
values values
<foreach collection="list" index="index" item="itm" separator=","> <foreach collection="list" index="index" item="itm" separator=",">
( (
#{itm.cQsrq},#{itm.cJyrq},#{itm.cJysj},#{itm.cZdh},#{itm.cCard},#{itm.cJylx},#{itm.cJyje},#{itm.cQsje},#{itm.cSxf},#{itm.cSjzfje},#{itm.cCkh},#{itm.cLsh},#{itm.cKlx} #{itm.cQsrq},#{itm.cJyrq},#{itm.cJysj},#{itm.cZdh},#{itm.cCard},#{itm.cJylx},#{itm.cJyje},#{itm.cQsje},#{itm.cSxf},#{itm.cSjzfje},#{itm.cCkh},#{itm.cLsh},#{itm.cKlx}
,#{itm.cFkh},#{itm.cZffs},#{itm.cYsddh},#{itm.cShddh},#{itm.cBzzd},#{itm.cQbyhje},#{itm.cShyhje},#{itm.cYjylsh},#{itm.cFqqs},#{itm.cFqsxf},#{itm.cFqfwf},#{itm.cFqfxf},#{itm.cQtyhje},#{itm.cThddh},#{itm.cFkfy},#{itm.cFdjc},#{itm.cZddh},#{itm.billTableName},#{itm.fundPaySumamt},#{itm.acctPay},#{itm.medfeeSumamt} ,#{itm.cFkh},#{itm.cZffs},#{itm.cYsddh},#{itm.cShddh},#{itm.cBzzd},#{itm.cQbyhje},#{itm.cShyhje},#{itm.cYjylsh},#{itm.cFqqs},#{itm.cFqsxf},#{itm.cFqfwf},#{itm.cFqfxf},#{itm.cQtyhje},#{itm.cThddh},#{itm.cFkfy},#{itm.cFdjc},#{itm.cZddh},#{itm.billTableName},#{itm.fundPaySumamt},#{itm.acctPay},#{itm.medfeeSumamt},#{itm.isInpatient}
) )
</foreach> </foreach>
</insert> </insert>
@@ -136,6 +136,7 @@
left join (select C_YSDDH from bankbill_history where C_JYLX = '2' and C_JYRQ = #{trade_date}) b left join (select C_YSDDH from bankbill_history where C_JYLX = '2' and C_JYRQ = #{trade_date}) b
on a.C_YSDDH = b.C_YSDDH on a.C_YSDDH = b.C_YSDDH
where a.C_JYRQ = #{trade_date} where a.C_JYRQ = #{trade_date}
and (a.is_inpatient is null or a.is_inpatient = '0') -- 排除住院订单
and b.C_YSDDH is null and b.C_YSDDH is null
</insert> </insert>
@@ -231,12 +232,12 @@
<insert id="insertBankbillOriginal" parameterType="HashMap"> <insert id="insertBankbillOriginal" parameterType="HashMap">
insert into insert into
bankbill_original(C_QSRQ,C_JYRQ,C_JYSJ,C_ZDH,C_CARD,C_JYLX,C_JYJE,C_QSJE,C_SXF,C_SJZFJE,C_CKH,C_LSH,C_KLX,C_FKH,C_ZFFS,C_YSDDH,C_SHDDH,C_BZZD,C_QBYHJE,C_SHYHJE,C_YJYLSH,C_FQQS,C_FQSXF,C_FQFWF,C_FQFXF,C_QTYHJE,C_THDDH,C_FKFY,C_FDJC,C_ZDDH,bill_table_name,FUND_PAY_SUMAMT,ACCT_PAY,MEDFEE_SUMAMT) bankbill_original(C_QSRQ,C_JYRQ,C_JYSJ,C_ZDH,C_CARD,C_JYLX,C_JYJE,C_QSJE,C_SXF,C_SJZFJE,C_CKH,C_LSH,C_KLX,C_FKH,C_ZFFS,C_YSDDH,C_SHDDH,C_BZZD,C_QBYHJE,C_SHYHJE,C_YJYLSH,C_FQQS,C_FQSXF,C_FQFWF,C_FQFXF,C_QTYHJE,C_THDDH,C_FKFY,C_FDJC,C_ZDDH,bill_table_name,FUND_PAY_SUMAMT,ACCT_PAY,MEDFEE_SUMAMT,is_inpatient)
values values
<foreach collection="list" index="index" item="itm" separator=","> <foreach collection="list" index="index" item="itm" separator=",">
( (
#{itm.cQsrq},#{itm.cJyrq},#{itm.cJysj},#{itm.cZdh},#{itm.cCard},#{itm.cJylx},#{itm.cJyje},#{itm.cQsje},#{itm.cSxf},#{itm.cSjzfje},#{itm.cCkh},#{itm.cLsh},#{itm.cKlx} #{itm.cQsrq},#{itm.cJyrq},#{itm.cJysj},#{itm.cZdh},#{itm.cCard},#{itm.cJylx},#{itm.cJyje},#{itm.cQsje},#{itm.cSxf},#{itm.cSjzfje},#{itm.cCkh},#{itm.cLsh},#{itm.cKlx}
,#{itm.cFkh},#{itm.cZffs},#{itm.cYsddh},#{itm.cShddh},#{itm.cBzzd},#{itm.cQbyhje},#{itm.cShyhje},#{itm.cYjylsh},#{itm.cFqqs},#{itm.cFqsxf},#{itm.cFqfwf},#{itm.cFqfxf},#{itm.cQtyhje},#{itm.cThddh},#{itm.cFkfy},#{itm.cFdjc},#{itm.cZddh},#{itm.billTableName},#{itm.fundPaySumamt},#{itm.acctPay},#{itm.medfeeSumamt} ,#{itm.cFkh},#{itm.cZffs},#{itm.cYsddh},#{itm.cShddh},#{itm.cBzzd},#{itm.cQbyhje},#{itm.cShyhje},#{itm.cYjylsh},#{itm.cFqqs},#{itm.cFqsxf},#{itm.cFqfwf},#{itm.cFqfxf},#{itm.cQtyhje},#{itm.cThddh},#{itm.cFkfy},#{itm.cFdjc},#{itm.cZddh},#{itm.billTableName},#{itm.fundPaySumamt},#{itm.acctPay},#{itm.medfeeSumamt},#{itm.isInpatient}
) )
</foreach> </foreach>
</insert> </insert>

View File

@@ -40,6 +40,7 @@
select * select *
from bankbill_history from bankbill_history
where C_JYRQ = #{trade_date} where C_JYRQ = #{trade_date}
and (is_inpatient is null or is_inpatient = '0') <!-- 排除住院订单(终端号10091548和10091549) -->
</select> </select>
<insert id="saveOriginalData" parameterType="java.util.List"> <insert id="saveOriginalData" parameterType="java.util.List">
insert into bankbills_original ( insert into bankbills_original (

View File

@@ -24,6 +24,7 @@
select * select *
from hisbill_history from hisbill_history
where trade_date = #{trade_date} where trade_date = #{trade_date}
and PayMethod != '2' <!-- 排除PayMethod=2的记录不参与对账 -->
<if test="military_code != null and military_code != ''"> <if test="military_code != null and military_code != ''">
and PayType != #{military_code} and PayType != #{military_code}
</if> </if>
@@ -56,6 +57,7 @@
from hisbills_history from hisbills_history
where trade_date=#{trade_date} where trade_date=#{trade_date}
and PayMethod != '2' <!-- 排除PayMethod=2的记录不参与对账 -->
<if test="military_code != null and military_code != ''"> <if test="military_code != null and military_code != ''">
and PayType != #{military_code} and PayType != #{military_code}
</if> </if>

View File

@@ -80,6 +80,8 @@
inner join bankbill_history b on a.PlatformTransId = b.C_YSDDH inner join bankbill_history b on a.PlatformTransId = b.C_YSDDH
where b.C_JYRQ &gt;= #{startTime} where b.C_JYRQ &gt;= #{startTime}
and b.C_JYRQ &lt;= #{endTime} and b.C_JYRQ &lt;= #{endTime}
and a.PayMethod != '2' -- 排除不参与对账的记录
and (b.is_inpatient is null or b.is_inpatient = '0') -- 排除住院订单
<if test="prepayment_code != null and prepayment_code != ''"> <if test="prepayment_code != null and prepayment_code != ''">
and a.PayType != #{prepayment_code} and a.PayType != #{prepayment_code}
</if> </if>
@@ -120,6 +122,7 @@
, '0' , '0'
, '1' , '1'
from (select * from hisbill_history where trade_date = #{trade_date} and payType!=#{cash_code} from (select * from hisbill_history where trade_date = #{trade_date} and payType!=#{cash_code}
and PayMethod != '2' -- 排除不参与对账的记录
<if test="military_code != null and military_code != ''"> <if test="military_code != null and military_code != ''">
and payType!=#{military_code} and payType!=#{military_code}
</if> </if>
@@ -134,7 +137,7 @@
</if> </if>
) a ) a
inner join inner join
(select * from bankbill_history where C_JYRQ = #{trade_date}) b (select * from bankbill_history where C_JYRQ = #{trade_date} and (is_inpatient is null or is_inpatient = '0')) b -- 排除住院订单
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) 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>
@@ -163,6 +166,7 @@
, '1' , '1'
, '1' , '1'
from (select * from hisbill_history where trade_date = #{trade_date} and payType!=#{cash_code} from (select * from hisbill_history where trade_date = #{trade_date} and payType!=#{cash_code}
and PayMethod != '2' -- 排除不参与对账的记录
<if test="military_code != null and military_code != ''"> <if test="military_code != null and military_code != ''">
and payType!=#{military_code} and payType!=#{military_code}
</if> </if>
@@ -177,7 +181,7 @@
</if> </if>
) a ) a
left join left join
(select * from bankbill_history where C_JYRQ = #{trade_date}) b (select * from bankbill_history where C_JYRQ = #{trade_date} and (is_inpatient is null or is_inpatient = '0')) b -- 排除住院订单
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) 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 where b.C_SHDDH is null
</insert> </insert>
@@ -207,6 +211,7 @@
, '1' , '1'
, '1' , '1'
from (select * from hisbill_history where trade_date = #{trade_date} and payType!=#{cash_code} from (select * from hisbill_history where trade_date = #{trade_date} and payType!=#{cash_code}
and PayMethod != '2' -- 排除不参与对账的记录
<if test="military_code != null and military_code != ''"> <if test="military_code != null and military_code != ''">
and payType!=#{military_code} and payType!=#{military_code}
</if> </if>
@@ -221,7 +226,7 @@
</if> </if>
) a ) a
right join right join
(select * from bankbill_history where C_JYRQ = #{trade_date}) b (select * from bankbill_history where C_JYRQ = #{trade_date} and (is_inpatient is null or is_inpatient = '0')) b -- 排除住院订单
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) 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 where a.PlatformTransId is null
</insert> </insert>
@@ -252,6 +257,7 @@
, '0' , '0'
, '1' , '1'
from (select * from hisbill_history where trade_date = #{trade_date} and payType = #{cash_code} from (select * from hisbill_history where trade_date = #{trade_date} and payType = #{cash_code}
and PayMethod != '2' -- 排除不参与对账的记录
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0"> <if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
and HisOperCode not in and HisOperCode not in
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")"> <foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
@@ -290,6 +296,7 @@
, '1' , '1'
, '1' , '1'
from (select * from hisbill_history where trade_date = #{trade_date} and payType = #{cash_code} from (select * from hisbill_history where trade_date = #{trade_date} and payType = #{cash_code}
and PayMethod != '2' -- 排除不参与对账的记录
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0"> <if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
and HisOperCode not in and HisOperCode not in
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")"> <foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
@@ -329,6 +336,7 @@
, '1' , '1'
, '1' , '1'
from (select * from hisbill_history where trade_date = #{trade_date} and payType = #{cash_code} from (select * from hisbill_history where trade_date = #{trade_date} and payType = #{cash_code}
and PayMethod != '2' -- 排除不参与对账的记录
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0"> <if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
and HisOperCode not in and HisOperCode not in
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")"> <foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
@@ -589,11 +597,11 @@
</select>--> </select>-->
<select id="findHisAndThirdJoinDataByParamAndNotUnique" parameterType="HashMap" resultType="HashMap"> <select id="findHisAndThirdJoinDataByParamAndNotUnique" parameterType="HashMap" resultType="HashMap">
select TranID, H_JYLX,Amount select TranID, H_JYLX
from third_join_his from third_join_his
where trade_date = #{trade_date} where trade_date = #{trade_date}
and TranID != '' and TranID != ''
group by TranID, H_JYLX,Amount group by TranID, H_JYLX
having count(TranID) > 1 having count(TranID) > 1
</select> </select>
@@ -606,6 +614,14 @@
and H_JYLX = #{h_jylx} and H_JYLX = #{h_jylx}
</delete> </delete>
<delete id="deleteThirdUnilateralByIddh" parameterType="HashMap">
delete
from third_join_his
where trade_date = #{trade_date}
and I_DDH = #{i_ddh}
and err_type = '2'
</delete>
<!--添加修改后的重复记录回数据库--> <!--添加修改后的重复记录回数据库-->
<insert id="addNotUniqueData" parameterType="java.util.List"> <insert id="addNotUniqueData" parameterType="java.util.List">
insert into third_join_his(JYSJ insert into third_join_his(JYSJ

View File

@@ -244,4 +244,12 @@
<delete id="deleteUnilateralById" parameterType="HashMap"> <delete id="deleteUnilateralById" parameterType="HashMap">
delete from unmanger_unilateral where id = #{id} delete from unmanger_unilateral where id = #{id}
</delete> </delete>
<delete id="deleteBankUnilateralByI_DDH" parameterType="HashMap">
delete
from unmanger_unilateral
where trade_date = #{trade_date}
and I_DDH = #{i_ddh}
and err_type = '2'
</delete>
</mapper> </mapper>