|
@@ -40,10 +40,14 @@ public class SiMzFeeService {
|
|
|
private final SiLogDao logDao;
|
|
|
@Value("${web-his-url}")
|
|
|
private String webHisUrl;
|
|
|
+ @Value("${thmz-url}")
|
|
|
+ private String thmzUrl;
|
|
|
|
|
|
@Autowired
|
|
|
public SiMzFeeService(SiMzDao mzDao, SiSetlinfoDao setlinfoDao,
|
|
|
- SiSetldetailDao setldetailDao, ExecService exec, WebHisService webHisService, MariadbService mariadbService, SiLogDao logDao) {
|
|
|
+ SiSetldetailDao setldetailDao, ExecService exec,
|
|
|
+ WebHisService webHisService, MariadbService mariadbService,
|
|
|
+ SiLogDao logDao) {
|
|
|
this.mzDao = mzDao;
|
|
|
this.setlinfoDao = setlinfoDao;
|
|
|
this.setldetailDao = setldetailDao;
|
|
@@ -390,6 +394,18 @@ public class SiMzFeeService {
|
|
|
fundDetail.setAcctPay(setlinfo.getString("acct_pay"));
|
|
|
fundDetail.setSelfPay(setlinfo.getString("psn_part_amt"));
|
|
|
fundDetail.setCardType(getCardType(mzPreSetlmt.getInsuplcAdmdvs()));
|
|
|
+
|
|
|
+ if (p.needSavePreSettleResult()) {
|
|
|
+ setlinfoDao.deletePreSettleInfo(p.getPatNo(), p.getTimes());
|
|
|
+ SiSetlinfo setlEntity = JSONObject.parseObject(setlinfo.toJSONString(), SiSetlinfo.class);
|
|
|
+ setlEntity.setPatNo(p.getPatNo());
|
|
|
+ setlEntity.setTimes(p.getTimes());
|
|
|
+ setlEntity.setLedgerSn(0);
|
|
|
+ setlEntity.setStaffId(p.getStaffId());
|
|
|
+ setlEntity.setSetlType(ClrType.OUTPATIENT.getCode());
|
|
|
+ setlinfoDao.insertPreSettleInfo(setlEntity);
|
|
|
+ }
|
|
|
+
|
|
|
return ResultVoUtil.success(fundDetail);
|
|
|
}
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
@@ -521,6 +537,9 @@ public class SiMzFeeService {
|
|
|
}
|
|
|
SiSetlinfo setlinfo = mzDao.selectSettledInfo(p.getPatNo(), p.getTimes(), 0);
|
|
|
if (null == setlinfo) {
|
|
|
+ if (p.needRevokeRegistration()) {
|
|
|
+ deletePresettleInfo(p);
|
|
|
+ }
|
|
|
setlinfo = mzDao.selectSettledInfo(p.getPatNo(), p.getTimes(), 1);
|
|
|
if (null == setlinfo) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有此患者的已结算数据。");
|
|
@@ -546,22 +565,18 @@ public class SiMzFeeService {
|
|
|
input.getJSONObject("input").put("data", data);
|
|
|
JSONObject result = exec.executeTrade(input, SiFunction.REVOKE_OUTPATIENT_SETTLEMENT);
|
|
|
log.info("【操作员:{}】门诊结算撤销:\n参数:{},\n结果:{}", p.getStaffId(), input, result);
|
|
|
- if (null == result) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
- }
|
|
|
Integer infcode = result.getInteger(RESULT_CODE);
|
|
|
logDao.insert(new SiLog(input, result, p.getPatNo(), p.getTimes(), infcode, setlinfo.getPsnNo()));
|
|
|
- if (null == infcode) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
- }
|
|
|
if (infcode == 0) {
|
|
|
afterRevokeSetl(p.getPatNo(), p.getTimes(), input.getString("msgid"));
|
|
|
- if (null != p.getNeedRevokeRegistration() && p.getNeedRevokeRegistration() == 1) {
|
|
|
- revokeOutpatientFeeDetails(p);
|
|
|
- revokeOutpatientRegistration(p);
|
|
|
+ if (p.needRevokeRegistration()) {
|
|
|
+ deletePresettleInfo(p);
|
|
|
}
|
|
|
return getFundDetailFromSetlinfo(setlinfo);
|
|
|
}
|
|
|
+ if (p.needRevokeRegistration()) {
|
|
|
+ deletePresettleInfo(p);
|
|
|
+ }
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
}
|
|
|
|
|
@@ -725,9 +740,10 @@ public class SiMzFeeService {
|
|
|
revokeOutpatientRegistration(mzptnt);
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, upldFeeRes.getMessage());
|
|
|
}
|
|
|
- // 上传完成之后结算并返回结算结果
|
|
|
+ // 上传完成之后试算并返回试算结果
|
|
|
mzptnt.setReadCardBizType(ReadCardBizType.SETTLEMENT.getCode());
|
|
|
- return outpatientSettlement(mzptnt);
|
|
|
+ mzptnt.setSavePreSettleResult(true);
|
|
|
+ return outpatientPreSettlement(mzptnt);
|
|
|
}
|
|
|
|
|
|
private ResultVo<String> mzChargeFee(String patientId, int times, String totalFee) {
|
|
@@ -736,13 +752,13 @@ public class SiMzFeeService {
|
|
|
params.put("times", times);
|
|
|
params.put("totalFee", totalFee);
|
|
|
int tryTimes = 1;
|
|
|
- JSONObject response = webHisService.mzChargeFee(params);
|
|
|
+ JSONObject response = webHisService.mzChargeFee(thmzUrl, params);
|
|
|
log.info("第{}次保存处方:\n参数:{}\n结果:{}", tryTimes, params, response);
|
|
|
while (0 != response.getInteger("code") && tryTimes < 5
|
|
|
&& !response.getString("message").contains("已经收费")) {
|
|
|
try {
|
|
|
tryTimes += 1;
|
|
|
- response = webHisService.mzChargeFee(params);
|
|
|
+ response = webHisService.mzChargeFee(thmzUrl, params);
|
|
|
log.info("第{}次保存处方:\n参数:{}\n结果:{}", tryTimes, params, response);
|
|
|
TimeUnit.SECONDS.sleep(Math.min(tryTimes, 3));
|
|
|
} catch (Exception e) {
|
|
@@ -759,4 +775,12 @@ public class SiMzFeeService {
|
|
|
int result = MzgjUtil.inProcessing(patientId) ? 1 : 0;
|
|
|
return ResultVoUtil.success(result);
|
|
|
}
|
|
|
+
|
|
|
+ public void deletePresettleInfo(MzPatientInfo p) {
|
|
|
+ int res = setlinfoDao.deletePreSettleInfo(p.getPatNo(), p.getTimes());
|
|
|
+ if (res == 1) {
|
|
|
+ revokeOutpatientFeeDetails(p);
|
|
|
+ revokeOutpatientRegistration(p);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|