|
@@ -656,17 +656,21 @@ public class SiZyFeeService {
|
|
|
log.info("【操作员:{}】撤销工伤已上传的费用明细{}:\n参数:{},\n结果:{}",
|
|
|
p.getStaffId(), detailSn, input, result);
|
|
|
|
|
|
- if (null == result || null == result.getInteger(RESULT_CODE)) {
|
|
|
+ // 工伤接口返回结果处理(支持模拟接口和真实接口切换)
|
|
|
+ Integer infcode = extractWorkInjuryResultCode(result);
|
|
|
+
|
|
|
+ if (null == result || null == infcode) {
|
|
|
log.error("工伤撤销接口调用失败,明细:{}", detailSn);
|
|
|
failedDetailSns.add(detailSn);
|
|
|
continue; // 继续撤销下一个,不中断整个流程
|
|
|
}
|
|
|
|
|
|
- if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
+ if (infcode == 0) {
|
|
|
log.info("工伤撤销成功,明细:{}", detailSn);
|
|
|
successDetailSns.add(detailSn);
|
|
|
} else {
|
|
|
- log.error("工伤撤销失败,明细:{},错误:{}", detailSn, result.getString(ERROR_MESSAGE));
|
|
|
+ String errorMsg = extractWorkInjuryErrorMessage(result);
|
|
|
+ log.error("工伤撤销失败,明细:{},错误:{}", detailSn, errorMsg);
|
|
|
failedDetailSns.add(detailSn);
|
|
|
}
|
|
|
}
|
|
@@ -817,13 +821,17 @@ public class SiZyFeeService {
|
|
|
|
|
|
// 调用工伤费用上传接口
|
|
|
JSONObject result = exec.executeWorkInjuryTrade(input);
|
|
|
- int infcode = result.getIntValue(RESULT_CODE);
|
|
|
- String logMsg = infcode + "," + result.getString("inf_refmsgid");
|
|
|
+
|
|
|
+ // 工伤接口返回结果处理(支持模拟接口和真实接口切换)
|
|
|
+ Integer infcode = extractWorkInjuryResultCode(result);
|
|
|
+ String logMsg = (infcode != null ? infcode.toString() : "null") + "," +
|
|
|
+ (result != null ? result.getString("inf_refmsgid") : "null");
|
|
|
log.info("【操作员:{}】,工伤费用上传:\n患者:{},\n结果:{}", p.getStaffId(),
|
|
|
p.getPsnInfo(), logMsg);
|
|
|
|
|
|
if (infcode == 0) {
|
|
|
- JSONArray array = result.getJSONObject(OUTPUT).getJSONArray("result");
|
|
|
+ // 工伤接口返回结果提取(支持模拟接口和真实接口切换)
|
|
|
+ JSONArray array = extractWorkInjuryUploadResult(result);
|
|
|
List<SiChargeTemp> tempList = new ArrayList<>();
|
|
|
for (int i = 0; i < array.size(); i++) {
|
|
|
JSONObject upldretrn = array.getJSONObject(i);
|
|
@@ -837,7 +845,7 @@ public class SiZyFeeService {
|
|
|
zyDao.insertSiChargeTempFeeBatch(tempList);
|
|
|
return new int[]{tempList.size(), fees.size() - tempList.size()};
|
|
|
} else {
|
|
|
- String message = result.getString(ERROR_MESSAGE);
|
|
|
+ String message = extractWorkInjuryErrorMessage(result);
|
|
|
sendUploadResponse(p, message);
|
|
|
return new int[]{fees.size(), 0};
|
|
|
}
|
|
@@ -908,16 +916,19 @@ public class SiZyFeeService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
}
|
|
|
|
|
|
- Integer infcode = result.getInteger(RESULT_CODE);
|
|
|
+ // 工伤接口返回结果处理(支持模拟接口和真实接口切换)
|
|
|
+ Integer infcode = extractWorkInjuryResultCode(result);
|
|
|
logDao.insert(new SiLog(input, result, p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn(), infcode, zyPreSetlmt.getPsnNo()));
|
|
|
|
|
|
if (null == infcode) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "工伤中心报错:" + result.getString("message"));
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "工伤中心报错:" +
|
|
|
+ (result != null ? result.getString("message") : "未知错误"));
|
|
|
}
|
|
|
|
|
|
if (infcode == 0) {
|
|
|
- JSONObject setlinfo = result.getJSONObject(OUTPUT).getJSONObject("setlinfo");
|
|
|
- String fundPay = setlinfo.getString("fund_pay_sumamt");
|
|
|
+ // 工伤接口返回结果提取(支持模拟接口和真实接口切换)
|
|
|
+ JSONObject setlinfo = extractWorkInjuryPreSettlementResult(result);
|
|
|
+ String fundPay = setlinfo != null ? setlinfo.getString("hifp_pay") : "0"; // 工伤使用 hifp_pay 字段
|
|
|
|
|
|
// 更新工伤报销金额(使用相同的表)
|
|
|
zyDao.updateFundPay(fundPay, p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
@@ -934,7 +945,133 @@ public class SiZyFeeService {
|
|
|
return ResultVoUtil.success(message);
|
|
|
}
|
|
|
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, extractWorkInjuryErrorMessage(result));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 工伤接口返回结果代码提取(支持模拟接口和真实接口切换)
|
|
|
+ */
|
|
|
+ private Integer extractWorkInjuryResultCode(JSONObject result) {
|
|
|
+ if (result == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 模拟接口返回结构:result.getJSONObject("data").getJSONObject("data").getString("infcode")
|
|
|
+ // 真实接口返回结构:result.getJSONObject("data").getString("infcode")
|
|
|
+
|
|
|
+ // 模拟接口处理(注释掉,需要时手动切换)
|
|
|
+ if (result.containsKey("data") && result.getJSONObject("data").containsKey("data")) {
|
|
|
+ JSONObject innerData = result.getJSONObject("data").getJSONObject("data");
|
|
|
+ return innerData != null ? innerData.getInteger(RESULT_CODE) : null;
|
|
|
+ }
|
|
|
+ // 真实接口处理(当前使用)
|
|
|
+ else if (result.containsKey("data")) {
|
|
|
+ JSONObject data = result.getJSONObject("data");
|
|
|
+ return data != null ? data.getInteger(RESULT_CODE) : null;
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 工伤费用上传返回结果提取(支持模拟接口和真实接口切换)
|
|
|
+ */
|
|
|
+ private JSONArray extractWorkInjuryUploadResult(JSONObject result) {
|
|
|
+ if (result == null) {
|
|
|
+ return new JSONArray();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 模拟接口返回结构:result.getJSONObject("data").getJSONObject("data").getJSONObject("output")
|
|
|
+ // 真实接口返回结构:result.getJSONObject("data").getJSONObject("output")
|
|
|
+
|
|
|
+ // 模拟接口处理(注释掉,需要时手动切换)
|
|
|
+ if (result.containsKey("data") && result.getJSONObject("data").containsKey("data")) {
|
|
|
+ JSONObject innerData = result.getJSONObject("data").getJSONObject("data");
|
|
|
+ if (innerData != null && innerData.containsKey(OUTPUT)) {
|
|
|
+ Object output = innerData.get(OUTPUT);
|
|
|
+ if (output instanceof JSONArray) {
|
|
|
+ return (JSONArray) output;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 真实接口处理(当前使用)
|
|
|
+ else if (result.containsKey("data")) {
|
|
|
+ JSONObject data = result.getJSONObject("data");
|
|
|
+ if (data != null && data.containsKey(OUTPUT)) {
|
|
|
+ Object output = data.get(OUTPUT);
|
|
|
+ if (output instanceof JSONArray) {
|
|
|
+ return (JSONArray) output;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return new JSONArray();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 工伤预结算返回结果提取(支持模拟接口和真实接口切换)
|
|
|
+ */
|
|
|
+ private JSONObject extractWorkInjuryPreSettlementResult(JSONObject result) {
|
|
|
+ if (result == null) {
|
|
|
+ return new JSONObject();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 模拟接口返回结构:result.getJSONObject("data").getJSONObject("data").getJSONObject("output")
|
|
|
+ // 真实接口返回结构:result.getJSONObject("data").getJSONObject("output")
|
|
|
+
|
|
|
+ // 模拟接口处理(注释掉,需要时手动切换)
|
|
|
+ if (result.containsKey("data") && result.getJSONObject("data").containsKey("data")) {
|
|
|
+ JSONObject innerData = result.getJSONObject("data").getJSONObject("data");
|
|
|
+ if (innerData != null && innerData.containsKey(OUTPUT)) {
|
|
|
+ Object output = innerData.get(OUTPUT);
|
|
|
+ if (output instanceof JSONObject) {
|
|
|
+ return (JSONObject) output;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 真实接口处理(当前使用)
|
|
|
+ else if (result.containsKey("data")) {
|
|
|
+ JSONObject data = result.getJSONObject("data");
|
|
|
+ if (data != null && data.containsKey(OUTPUT)) {
|
|
|
+ Object output = data.get(OUTPUT);
|
|
|
+ if (output instanceof JSONObject) {
|
|
|
+ return (JSONObject) output;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return new JSONObject();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 工伤接口错误信息提取(支持模拟接口和真实接口切换)
|
|
|
+ */
|
|
|
+ private String extractWorkInjuryErrorMessage(JSONObject result) {
|
|
|
+ if (result == null) {
|
|
|
+ return "未知错误";
|
|
|
+ }
|
|
|
+
|
|
|
+ // 模拟接口返回结构:result.getJSONObject("data").getJSONObject("data").getString("err_msg")
|
|
|
+ // 真实接口返回结构:result.getJSONObject("data").getString("err_msg")
|
|
|
+
|
|
|
+ // 模拟接口处理(注释掉,需要时手动切换)
|
|
|
+ if (result.containsKey("data") && result.getJSONObject("data").containsKey("data")) {
|
|
|
+ JSONObject innerData = result.getJSONObject("data").getJSONObject("data");
|
|
|
+ if (innerData != null) {
|
|
|
+ String errorMsg = innerData.getString(ERROR_MESSAGE);
|
|
|
+ return StringUtil.isBlank(errorMsg) ? "未知错误" : errorMsg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 真实接口处理(当前使用)
|
|
|
+ else if (result.containsKey("data")) {
|
|
|
+ JSONObject data = result.getJSONObject("data");
|
|
|
+ if (data != null) {
|
|
|
+ String errorMsg = data.getString(ERROR_MESSAGE);
|
|
|
+ return StringUtil.isBlank(errorMsg) ? "未知错误" : errorMsg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return "未知错误";
|
|
|
}
|
|
|
|
|
|
/**
|