|
@@ -345,8 +345,9 @@ public class SiMzFeeService {
|
|
|
mzPreSetlmt.setMdtrtCertNo(out[2]);
|
|
|
mzPreSetlmt.setCardSn(out[3]);
|
|
|
} else if (mdtrtCertType.getCode().equals(MdtrtCertType.ELECTRONIC_VOUCHER.getCode())) {
|
|
|
+ String socialNo = mzDao.selectSocialNo(p.getPatNo());
|
|
|
JSONObject qrinfo = JSONObject.parseObject(p.getReadCardResult());
|
|
|
- if (!p.getSocialNo().trim().equals(qrinfo.getString("idNo").trim())) {
|
|
|
+ if (!Objects.equals(socialNo, qrinfo.getString("idNo").trim())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "电子医保凭证身份证与HIS身份证不一致,请确认是否人证相符。");
|
|
|
}
|
|
|
mzPreSetlmt.setMdtrtCertNo(qrinfo.getString("ecToken"));
|
|
@@ -445,8 +446,9 @@ public class SiMzFeeService {
|
|
|
setlmt.setMdtrtCertNo(out[2]);
|
|
|
setlmt.setCardSn(out[3]);
|
|
|
} else if (mdtrtCertType.getCode().equals(MdtrtCertType.ELECTRONIC_VOUCHER.getCode())) {
|
|
|
+ String socialNo = mzDao.selectSocialNo(p.getPatNo());
|
|
|
JSONObject qrinfo = JSONObject.parseObject(p.getReadCardResult());
|
|
|
- if (!p.getSocialNo().trim().equals(qrinfo.getString("idNo").trim())) {
|
|
|
+ if (!Objects.equals(socialNo, qrinfo.getString("idNo").trim())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "电子医保凭证身份证与HIS身份证不一致,请确认是否人证相符。");
|
|
|
}
|
|
|
setlmt.setMdtrtCertNo(qrinfo.getString("ecToken"));
|
|
@@ -456,17 +458,16 @@ public class SiMzFeeService {
|
|
|
setlmt.setPsnSetlway(PsnSetlWay.SETTLE_BY_ITEMS.getCode());
|
|
|
setlmt.setChrgBchno(p.getPatNo() + "_" + p.getTimes());
|
|
|
|
|
|
- String acctUsedFlag = p.getRealAcctUsedFlag();
|
|
|
- if (StringUtil.isBlank(acctUsedFlag)) {
|
|
|
+ Integer acctUsedFlag = p.getRealAcctUsedFlag();
|
|
|
+ if (null == acctUsedFlag) {
|
|
|
Double acctPay = mzDao.selectAcctPayInPreSettle(setlmt.getMdtrtId());
|
|
|
if (null != acctPay && acctPay > 0) {
|
|
|
- acctUsedFlag = "1";
|
|
|
+ acctUsedFlag = 1;
|
|
|
} else {
|
|
|
- acctUsedFlag = "0";
|
|
|
+ acctUsedFlag = 0;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- setlmt.setAcctUsedFlag(acctUsedFlag);
|
|
|
+ setlmt.setAcctUsedFlag(String.valueOf(acctUsedFlag));
|
|
|
setlmt.setInvono(SnowFlakeId.getInstance().nextId());
|
|
|
setlmt.setExpContent(p.getExpContent());
|
|
|
String ref = JSONObject.toJSONString(setlmt);
|
|
@@ -507,7 +508,7 @@ public class SiMzFeeService {
|
|
|
setlEntity.getMedinsSetlId(), input.getString("msgid"));
|
|
|
webHisService.saveCumInfo(webHisUrl, setlEntity);
|
|
|
|
|
|
- if (BigDecimal.ZERO.compareTo(BigDecimal.valueOf(setlEntity.getPsnCashPay())) == 0) {
|
|
|
+ if (!p.getStraitSettle() && BigDecimal.ZERO.compareTo(BigDecimal.valueOf(setlEntity.getPsnCashPay())) == 0) {
|
|
|
ResultVo<String> mzChargeResponse = mzHisChargeProcess(p.getPatNo(), p.getTimes(),
|
|
|
String.valueOf(setlEntity.getMedfeeSumamt()));
|
|
|
if (mzChargeResponse.getCode() != ExceptionEnum.SUCCESS.getCode()) {
|
|
@@ -515,6 +516,7 @@ public class SiMzFeeService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, mzChargeResponse.getMessage());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
setlinfoDao.deletePreSettleInfo(p.getPatNo(), p.getTimes());
|
|
|
return getFundDetailFromSetlinfo(setlEntity);
|
|
|
}
|
|
@@ -651,8 +653,9 @@ public class SiMzFeeService {
|
|
|
mzptnt.setStaffId(param.getStaffId());
|
|
|
mzptnt.setPatNo(param.getPatientId());
|
|
|
mzptnt.setTimes(param.getTimes());
|
|
|
- mzptnt.setMedType("11");
|
|
|
- mzptnt.setAcctUsedFlag(String.valueOf(param.getAcctUsedFlag()));
|
|
|
+ mzptnt.setMedType(param.getMedType());
|
|
|
+ mzptnt.setAcctUsedFlag(param.getAcctUsedFlag());
|
|
|
+ mzptnt.setStraitSettle(param.getStraitSettle());
|
|
|
|
|
|
// 生成医保费用
|
|
|
String mzReceipts = generateSiMzFees(mzptnt);
|
|
@@ -694,6 +697,8 @@ public class SiMzFeeService {
|
|
|
siPatInfo.setFromDirectReg(true);
|
|
|
SpcChrDiseAcct spcChrDiseAcct = new SpcChrDiseAcct();
|
|
|
spcChrDiseAcct.setStaffId(param.getStaffId());
|
|
|
+ spcChrDiseAcct.setOpspDiseCode(param.getOpspDiseCode());
|
|
|
+ spcChrDiseAcct.setOpspDiseName(param.getOpspDiseName());
|
|
|
spcChrDiseAcct.setExpContent(param.getExpContent());
|
|
|
ResultVo<String> upldMdtrtRes = uploadOutpatientInfo(spcChrDiseAcct, siPatInfo);
|
|
|
if (upldMdtrtRes.getCode() != ExceptionEnum.SUCCESS.getCode()) {
|
|
@@ -711,9 +716,24 @@ public class SiMzFeeService {
|
|
|
revokeOutpatientRegistration(mzptnt);
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, upldFeeRes.getMessage());
|
|
|
}
|
|
|
- // 试算并返回试算结果
|
|
|
+
|
|
|
+ // 如果是退费重收,直接结算
|
|
|
+ if (param.getStraitSettle()) {
|
|
|
+ return outpatientSettlement(mzptnt);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果试算个人现金支付为0,直接结算
|
|
|
mzptnt.setReadCardBizType(ReadCardBizType.SETTLEMENT.getCode());
|
|
|
- return outpatientPreSettlement(mzptnt);
|
|
|
+ ResultVo<FundDetail> presetlResponse = outpatientPreSettlement(mzptnt);
|
|
|
+ if (presetlResponse.getCode() == ExceptionEnum.SUCCESS.getCode()) {
|
|
|
+ FundDetail fundDetail = presetlResponse.getData();
|
|
|
+ BigDecimal cashpay = new BigDecimal(fundDetail.getCashPay());
|
|
|
+ if (cashpay.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
+ return outpatientSettlement(mzptnt);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return presetlResponse;
|
|
|
}
|
|
|
|
|
|
private String generateSiMzFees(MzPatientInfo mzptnt) {
|
|
@@ -799,4 +819,15 @@ public class SiMzFeeService {
|
|
|
revokeOutpatientRegistration(p);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public void test() {
|
|
|
+ JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.REVOKE_OUTPATIENT_SETTLEMENT, "430105", "01897");
|
|
|
+ JSONObject data = new JSONObject();
|
|
|
+ data.put("setl_id", "421253439");
|
|
|
+ data.put("mdtrt_id", "758032270");
|
|
|
+ data.put("psn_no", "43000020100034025147");
|
|
|
+ input.getJSONObject("input").put("data", data);
|
|
|
+ JSONObject result = exec.executeTrade(input, SiFunction.REVOKE_OUTPATIENT_SETTLEMENT);
|
|
|
+ log.info("【操作员:01897】门诊结算撤销:\n参数:{},\n结果:{}",input, result);
|
|
|
+ }
|
|
|
}
|