|
@@ -170,23 +170,31 @@ public class SiManageService {
|
|
|
public ResultVo<String> institutionSettlementLedgerCheck(InstStlLdgChk instStlLdgChk) {
|
|
|
String startdate = DateUtil.getDayStartTime(instStlLdgChk.getStmtBegndate());
|
|
|
String enddate = DateUtil.getDayEndTime(instStlLdgChk.getStmtEnddate());
|
|
|
- List<InstSetlLdgChkBrf> brfs = dao.selectSetlChkBrfsWithInsutype(instStlLdgChk.getClrType(), instStlLdgChk.getInsutype(),
|
|
|
- instStlLdgChk.getSetlOptins(), startdate, enddate);
|
|
|
- BigDecimal medfeesum = new BigDecimal("0");
|
|
|
- BigDecimal acctpaysum = new BigDecimal("0");
|
|
|
- BigDecimal fundpaysum = new BigDecimal("0");
|
|
|
- for (InstSetlLdgChkBrf brf : brfs) {
|
|
|
- medfeesum = DecimalUtil.add(medfeesum, brf.getMedfeeSumamt());
|
|
|
- acctpaysum = DecimalUtil.add(acctpaysum, brf.getAcctPay());
|
|
|
- fundpaysum = DecimalUtil.add(fundpaysum, brf.getFundPaySumamt());
|
|
|
- if (null != brf.getHospPartAmt()) {
|
|
|
- fundpaysum = DecimalUtil.minus(fundpaysum, brf.getHospPartAmt());
|
|
|
+ List<InstSetlLdgChkBrf> setlBrfs = instStlLdgChk.getMode() == 1 ?
|
|
|
+ dao.selectSetlChkBrfsWithInsutype(instStlLdgChk.getClrType(), instStlLdgChk.getInsutype(),
|
|
|
+ instStlLdgChk.getSetlOptins(), startdate, enddate) :
|
|
|
+ dao.selectSetlinfoBrfsForHisCheck(instStlLdgChk.getClrType(), startdate, enddate);
|
|
|
+ fillInstStlLdgChk(instStlLdgChk, setlBrfs);
|
|
|
+
|
|
|
+ if (instStlLdgChk.getMode() == 2) {
|
|
|
+ List<InstSetlLdgChkBrf> hisBrfs = dao.selectLedgerBrfsForHisCheck(startdate, enddate);
|
|
|
+ if (hisBrfs.size() != setlBrfs.size()) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR,
|
|
|
+ "对账结果:不平。对账结果说明:医保结算笔数:" + setlBrfs.size() + ";HIS结算笔数:" + hisBrfs.size());
|
|
|
}
|
|
|
+ InstStlLdgChk hisLdgChk = new InstStlLdgChk();
|
|
|
+ fillInstStlLdgChk(hisLdgChk, hisBrfs);
|
|
|
+ if (hisLdgChk.getMedfeeSumamt().compareTo(instStlLdgChk.getMedfeeSumamt()) == 0 &&
|
|
|
+ hisLdgChk.getFundPaySumamt().compareTo(instStlLdgChk.getFundPaySumamt()) == 0) {
|
|
|
+ return ResultVoUtil.success("对账结果:平。对账结果说明:结算笔数:" + hisBrfs.size() +
|
|
|
+ ",医疗费总额:" + hisLdgChk.getMedfeeSumamt() + ",基金支付总额:" + hisLdgChk.getFundPaySumamt());
|
|
|
+ }
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR,
|
|
|
+ "对账结果:不平。对账结果说明:医保结算笔数:" + setlBrfs.size() + ",HIS结算笔数:" + hisBrfs.size() +
|
|
|
+ ";医保医疗费总额:" + instStlLdgChk.getMedfeeSumamt() + ",HIS医疗费总额:" + hisLdgChk.getMedfeeSumamt() +
|
|
|
+ ";医保基金支付总额:" + instStlLdgChk.getFundPaySumamt() + ";HIS基金支付总额:" + hisLdgChk.getFundPaySumamt());
|
|
|
}
|
|
|
- instStlLdgChk.setMedfeeSumamt(medfeesum);
|
|
|
- instStlLdgChk.setAcctPay(acctpaysum);
|
|
|
- instStlLdgChk.setFundPaySumamt(fundpaysum);
|
|
|
- instStlLdgChk.setFixmedinsSetlCnt(brfs.size());
|
|
|
+
|
|
|
JSONObject input = exec.makeTradeHeader(SiFunction.INSTITUTION_SETTLEMENT_LEDGER_CHECK);
|
|
|
String ref = JSONObject.toJSONStringWithDateFormat(instStlLdgChk, "yyyy-MM-dd");
|
|
|
input.getJSONObject("input").put("data", JSONObject.parseObject(ref));
|
|
@@ -217,8 +225,8 @@ public class SiManageService {
|
|
|
}
|
|
|
String dscr = info.getString("stmt_rslt_dscr");
|
|
|
if (StringUtil.isBlank(dscr)) {
|
|
|
- dscr = "结算笔数:" + brfs.size() +
|
|
|
- ",医疗费总额:" + medfeesum + ",基金支付总额:" + fundpaysum;
|
|
|
+ dscr = "结算笔数:" + setlBrfs.size() +
|
|
|
+ ",医疗费总额:" + instStlLdgChk.getMedfeeSumamt() + ",基金支付总额:" + instStlLdgChk.getFundPaySumamt();
|
|
|
}
|
|
|
String data = "【清算机构:" + optins + "】对账结果:" + rslt + "。对账结果说明:" + dscr;
|
|
|
if (rslt.equals(StmtRslt.CORRECT.getName())) {
|
|
@@ -229,6 +237,24 @@ public class SiManageService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
}
|
|
|
|
|
|
+ private void fillInstStlLdgChk(InstStlLdgChk instStlLdgChk, List<InstSetlLdgChkBrf> brfs) {
|
|
|
+ BigDecimal medfeesum = new BigDecimal("0");
|
|
|
+ BigDecimal acctpaysum = new BigDecimal("0");
|
|
|
+ BigDecimal fundpaysum = new BigDecimal("0");
|
|
|
+ for (InstSetlLdgChkBrf brf : brfs) {
|
|
|
+ medfeesum = DecimalUtil.add(medfeesum, brf.getMedfeeSumamt());
|
|
|
+ acctpaysum = DecimalUtil.add(acctpaysum, brf.getAcctPay());
|
|
|
+ fundpaysum = DecimalUtil.add(fundpaysum, brf.getFundPaySumamt());
|
|
|
+ if (null != brf.getHospPartAmt()) {
|
|
|
+ fundpaysum = DecimalUtil.minus(fundpaysum, brf.getHospPartAmt());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ instStlLdgChk.setMedfeeSumamt(medfeesum);
|
|
|
+ instStlLdgChk.setAcctPay(acctpaysum);
|
|
|
+ instStlLdgChk.setFundPaySumamt(fundpaysum);
|
|
|
+ instStlLdgChk.setFixmedinsSetlCnt(brfs.size());
|
|
|
+ }
|
|
|
+
|
|
|
public ResultVo<List<InsSetlDetlChkRslt>> institutionSettlementDetailCheck(InsSetlDetlChk insSetlDetlChk) {
|
|
|
String snowId = SnowFlakeId.instance().nextId();
|
|
|
String filename = snowId + ".txt";
|
|
@@ -237,7 +263,6 @@ public class SiManageService {
|
|
|
String enddate = DateUtil.getDayEndTime(insSetlDetlChk.getStmtEnddate());
|
|
|
List<InstSetlLdgChkBrf> brfs = dao.selectSetlChkBrfs(insSetlDetlChk.getClrType(),
|
|
|
insSetlDetlChk.getSetlOptins(), startdate, enddate);
|
|
|
-
|
|
|
BigDecimal medfeesum = new BigDecimal("0");
|
|
|
BigDecimal psnCashPay = new BigDecimal("0");
|
|
|
BigDecimal fundpaysum = new BigDecimal("0");
|
|
@@ -316,14 +341,16 @@ public class SiManageService {
|
|
|
if (StringUtil.notBlank(prm.getPatNo())) {
|
|
|
wrapper.and(i -> i.like("pat_no", prm.getPatNo()).or().like("psn_name", prm.getPatNo()));
|
|
|
}
|
|
|
- String begndate = DateUtil.formatDatetime(prm.getStmtBegndate(), "yyyy-MM-dd") + " 00:00:00";
|
|
|
- String enddate = DateUtil.formatDatetime(prm.getStmtEnddate(), "yyyy-MM-dd") + " 23:59:59";
|
|
|
- wrapper.eq("clr_type", prm.getClrType());
|
|
|
+ String begndate = DateUtil.formatDatetime(prm.getStmtBegndate(), "yyyy-MM-dd") + " 00:00:00.000";
|
|
|
+ String enddate = DateUtil.formatDatetime(prm.getStmtEnddate(), "yyyy-MM-dd") + " 23:59:59.999";
|
|
|
+ wrapper.eq(prm.getMode() == 1 ? "clr_type" : "setl_type", prm.getClrType());
|
|
|
wrapper.eq("revoked", YesOrNo.NO.getCode());
|
|
|
- wrapper.apply("fund_pay_sumamt!=0");
|
|
|
wrapper.apply("setl_time>='" + begndate + "'");
|
|
|
wrapper.apply("setl_time<='" + enddate + "'");
|
|
|
- wrapper.apply("insuplc_admdvs like '43%' ");
|
|
|
+ if (prm.getMode() == 1) {
|
|
|
+ wrapper.apply("fund_pay_sumamt!=0");
|
|
|
+ wrapper.apply("insuplc_admdvs like '43%' ");
|
|
|
+ }
|
|
|
List<SiSetlinfo> list = setlinfoDao.selectList(wrapper);
|
|
|
if (null == list || list.isEmpty()) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有查询到符合条件的数据。");
|