|
|
@@ -76,7 +76,7 @@ public class SiMzFeeService {
|
|
|
String[] out = p.getReadCardResult().split("\\|");
|
|
|
regstrtn.setMdtrtCertNo(out[2]);
|
|
|
regstrtn.setCardSn(out[3]);
|
|
|
- } else if (mdtrtCertType.getCode().equals(MdtrtCertType.MEDICAL_INSURANCE_ELECTRONIC_VOUCHER.getCode())) {
|
|
|
+ } else if (mdtrtCertType == MdtrtCertType.ELECTRONIC_VOUCHER) {
|
|
|
JSONObject qrinfo = JSONObject.parseObject(p.getReadCardResult());
|
|
|
regstrtn.setMdtrtCertNo(qrinfo.getString("ecToken"));
|
|
|
}
|
|
|
@@ -91,14 +91,8 @@ public class SiMzFeeService {
|
|
|
input.getJSONObject("input").put("data", JSONObject.parseObject(ref));
|
|
|
JSONObject result = exec.executeTrade(input, SiFunction.OUTPATIENT_REGISTRATION);
|
|
|
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, regstrtn.getPsnNo()));
|
|
|
- if (null == infcode) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
- }
|
|
|
if (infcode == 0) {
|
|
|
JSONObject output = result.getJSONObject(OUTPUT).getJSONObject("data");
|
|
|
p.setMdtrtId(output.getString("mdtrt_id"));
|
|
|
@@ -137,14 +131,8 @@ public class SiMzFeeService {
|
|
|
input.getJSONObject("input").put("data", data);
|
|
|
JSONObject result = exec.executeTrade(input, SiFunction.REVOKE_OUTPATIENT_REGISTRATION);
|
|
|
log.info("【操作员:{}】,取消门诊挂号:\n参数:{},\n结果:{}", request.getStaffId(), input, result);
|
|
|
- if (null == result) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
- }
|
|
|
Integer infcode = result.getInteger(RESULT_CODE);
|
|
|
logDao.insert(new SiLog(input, result, request.getPatNo(), request.getTimes(), infcode, request.getPsnNo()));
|
|
|
- if (null == infcode) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
- }
|
|
|
if (infcode == 0) {
|
|
|
mzDao.clearMdtrtIdForMz(request.getPatNo(), request.getTimes(), null);
|
|
|
return ResultVoUtil.success("取消门诊挂号成功。");
|
|
|
@@ -223,6 +211,7 @@ public class SiMzFeeService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "【门诊号:" + patNo +
|
|
|
"】未找到此患者的医保挂号信息,请核实。");
|
|
|
}
|
|
|
+ setlinfoDao.deletePreSettleInfo(patNo, p.getTimes());
|
|
|
if (!p.getFromDirectReg()) {
|
|
|
ResultVo<String> uplRes = uploadOutpatientInfo(p, siPatInfo);
|
|
|
if (null != uplRes && uplRes.getCode() != ExceptionEnum.SUCCESS.getCode()) {
|
|
|
@@ -258,14 +247,8 @@ public class SiMzFeeService {
|
|
|
input.getJSONObject("input").put("feedetail", feedetail);
|
|
|
JSONObject result = exec.executeTrade(input, SiFunction.UPLOAD_OUTPATIENT_FEE_DETAILS);
|
|
|
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, siPatInfo.getPsnNo()));
|
|
|
- if (null == infcode) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
- }
|
|
|
if (infcode == 0) {
|
|
|
JSONArray feeRes = result.getJSONObject(OUTPUT).getJSONArray("result");
|
|
|
double fulamtOwnpayAmt = 0d;
|
|
|
@@ -316,14 +299,8 @@ public class SiMzFeeService {
|
|
|
input.getJSONObject("input").put("data", data);
|
|
|
JSONObject result = exec.executeTrade(input, SiFunction.REVOKE_OUTPATIENT_FEE_DETAILS);
|
|
|
log.info("【操作员:{}】门诊费用明细信息撤销,参数:{},结果:{}", 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, siPatInfo.getPsnNo()));
|
|
|
- if (null == infcode) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
- }
|
|
|
if (infcode == 0) {
|
|
|
mzDao.afterRevokeFees(p.getPatNo(), p.getTimes());
|
|
|
return ResultVoUtil.success("门诊费用明细信息撤销成功。");
|
|
|
@@ -342,7 +319,7 @@ public class SiMzFeeService {
|
|
|
if (null == p.getTimes()) {
|
|
|
p.setTimes(mzDao.selectMaxTimes(p.getPatNo()));
|
|
|
}
|
|
|
- ResultVo<FundDetail> setlfund = getFundDetailByPatientInfo(p.getPatNo(), p.getTimes());
|
|
|
+ ResultVo<FundDetail> setlfund = getFundDetailByPatientInfo(p.getPatNo(), p.getTimes(), false);
|
|
|
if (setlfund != null) {
|
|
|
return setlfund;
|
|
|
}
|
|
|
@@ -358,7 +335,7 @@ public class SiMzFeeService {
|
|
|
String[] out = p.getReadCardResult().split("\\|");
|
|
|
mzPreSetlmt.setMdtrtCertNo(out[2]);
|
|
|
mzPreSetlmt.setCardSn(out[3]);
|
|
|
- } else if (mdtrtCertType.getCode().equals(MdtrtCertType.MEDICAL_INSURANCE_ELECTRONIC_VOUCHER.getCode())) {
|
|
|
+ } else if (mdtrtCertType == MdtrtCertType.ELECTRONIC_VOUCHER) {
|
|
|
JSONObject qrinfo = JSONObject.parseObject(p.getReadCardResult());
|
|
|
if (!p.getSocialNo().trim().equals(qrinfo.getString("idNo").trim())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "电子医保凭证身份证与HIS身份证不一致,请确认是否人证相符。");
|
|
|
@@ -377,14 +354,8 @@ public class SiMzFeeService {
|
|
|
input.getJSONObject("input").put("data", JSONObject.parseObject(ref));
|
|
|
JSONObject result = exec.executeTrade(input, SiFunction.OUTPATIENT_PRE_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, mzPreSetlmt.getPsnNo()));
|
|
|
- if (null == infcode) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
- }
|
|
|
if (infcode == 0) {
|
|
|
JSONObject setlinfo = result.getJSONObject(OUTPUT).getJSONObject("setlinfo");
|
|
|
FundDetail fundDetail = new FundDetail();
|
|
|
@@ -403,6 +374,7 @@ public class SiMzFeeService {
|
|
|
setlEntity.setLedgerSn(0);
|
|
|
setlEntity.setStaffId(p.getStaffId());
|
|
|
setlEntity.setSetlType(ClrType.OUTPATIENT.getCode());
|
|
|
+ setlEntity.setInsuplcAdmdvs(mzPreSetlmt.getInsuplcAdmdvs());
|
|
|
setlinfoDao.insertPreSettleInfo(setlEntity);
|
|
|
}
|
|
|
|
|
|
@@ -411,9 +383,14 @@ public class SiMzFeeService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
}
|
|
|
|
|
|
- private ResultVo<FundDetail> getFundDetailByPatientInfo(String patientId, int times) {
|
|
|
+ private ResultVo<FundDetail> getFundDetailByPatientInfo(String patientId, int times, boolean realSettle) {
|
|
|
SiSetlinfo sisetlinfo = mzDao.selectSettledInfo(patientId, times, 0);
|
|
|
- if (null != sisetlinfo && null != sisetlinfo.getSetlId()) {
|
|
|
+
|
|
|
+ if (!realSettle && null == sisetlinfo) {
|
|
|
+ sisetlinfo = setlinfoDao.selectPresettleInfo(patientId, times);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != sisetlinfo) {
|
|
|
return getFundDetailFromSetlinfo(sisetlinfo);
|
|
|
}
|
|
|
return null;
|
|
|
@@ -444,7 +421,7 @@ public class SiMzFeeService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<FundDetail> outpatientSettlement(MzPatientInfo p) {
|
|
|
- ResultVo<FundDetail> setlfund = getFundDetailByPatientInfo(p.getPatNo(), p.getTimes());
|
|
|
+ ResultVo<FundDetail> setlfund = getFundDetailByPatientInfo(p.getPatNo(), p.getTimes(), true);
|
|
|
if (setlfund != null) {
|
|
|
return setlfund;
|
|
|
}
|
|
|
@@ -455,11 +432,11 @@ public class SiMzFeeService {
|
|
|
if (readCardBizType == ReadCardBizType.SETTLEMENT) {
|
|
|
MdtrtCertType mdtrtCertType = MdtrtCertType.getByLabel(p.getMdtrtCertType());
|
|
|
setlmt.setMdtrtCertType(mdtrtCertType.getCode());
|
|
|
- if (mdtrtCertType.getCode().equals(MdtrtCertType.SOCIAL_SECURITY_CARD.getCode())) {
|
|
|
+ if (mdtrtCertType == MdtrtCertType.SOCIAL_SECURITY_CARD) {
|
|
|
String[] out = p.getReadCardResult().split("\\|");
|
|
|
setlmt.setMdtrtCertNo(out[2]);
|
|
|
setlmt.setCardSn(out[3]);
|
|
|
- } else if (mdtrtCertType.getCode().equals(MdtrtCertType.MEDICAL_INSURANCE_ELECTRONIC_VOUCHER.getCode())) {
|
|
|
+ } else if (mdtrtCertType == MdtrtCertType.ELECTRONIC_VOUCHER) {
|
|
|
JSONObject qrinfo = JSONObject.parseObject(p.getReadCardResult());
|
|
|
if (!p.getSocialNo().trim().equals(qrinfo.getString("idNo").trim())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "电子医保凭证身份证与HIS身份证不一致,请确认是否人证相符。");
|
|
|
@@ -477,14 +454,8 @@ public class SiMzFeeService {
|
|
|
input.getJSONObject("input").put("data", JSONObject.parseObject(ref));
|
|
|
JSONObject result = exec.executeTrade(input, SiFunction.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, setlmt.getPsnNo()));
|
|
|
- if (null == infcode) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
- }
|
|
|
if (infcode == 0) {
|
|
|
JSONObject setlinfo = result.getJSONObject(OUTPUT).getJSONObject("setlinfo");
|
|
|
SiSetlinfo setlEntity = JSONObject.parseObject(setlinfo.toJSONString(), SiSetlinfo.class);
|
|
|
@@ -526,6 +497,8 @@ public class SiMzFeeService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ setlinfoDao.deletePreSettleInfo(p.getPatNo(), p.getTimes());
|
|
|
+
|
|
|
return getFundDetailFromSetlinfo(setlEntity);
|
|
|
}
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
@@ -608,6 +581,7 @@ public class SiMzFeeService {
|
|
|
mzDao.deleteSetlInfo(patNo, times);
|
|
|
mzDao.deleteSetlDetail(patNo, times);
|
|
|
mzDao.updateRvkSetlMsgid(patNo, times, msgId);
|
|
|
+ setlinfoDao.deletePreSettleInfo(patNo, times);
|
|
|
} catch (Exception e) {
|
|
|
String sql1 = String.format("update t_si_setlinfo set revoked=1,mz_saved=0 where pat_no='%s' and times=%d;\n", patNo, times);
|
|
|
String sql2 = String.format("delete from t_si_setldetail where pat_no='%s' and times=%d;\n", patNo, times);
|
|
|
@@ -624,7 +598,7 @@ public class SiMzFeeService {
|
|
|
log.info("【{}】此患者上一次的共济流程尚未结束,请稍后再试。", param.getPatientId());
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者上一次的共济流程尚未结束,请稍后再试。");
|
|
|
}
|
|
|
- ResultVo<FundDetail> setlfund = getFundDetailByPatientInfo(param.getPatientId(), param.getTimes());
|
|
|
+ ResultVo<FundDetail> setlfund = getFundDetailByPatientInfo(param.getPatientId(), param.getTimes(), false);
|
|
|
if (setlfund != null) {
|
|
|
return setlfund;
|
|
|
}
|
|
|
@@ -665,12 +639,17 @@ public class SiMzFeeService {
|
|
|
mzptnt.setMdtrtCertType(mdtrtCertType.getLabel());
|
|
|
mzptnt.setReadCardBizType(ReadCardBizType.REGISTRATION.getCode());
|
|
|
mzptnt.setReadCardResult(param.getReadCardResult());
|
|
|
+
|
|
|
+ if (mdtrtCertType == MdtrtCertType.ELECTRONIC_VOUCHER) {
|
|
|
+ JSONObject obj = JSONObject.parseObject(param.getReadCardResult());
|
|
|
+ String admdvs = obj.getString("insuOrg");
|
|
|
+ if (StringUtil.isBlank(mzptnt.getInsuplcAdmdvs())) {
|
|
|
+ mzptnt.setInsuplcAdmdvs(admdvs);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
ResultVo<String> regres = outpatientRegistration(mzptnt);
|
|
|
- if (null == regres) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
- }
|
|
|
if (regres.getCode() != ExceptionEnum.SUCCESS.getCode()) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, regres.getMessage());
|
|
|
}
|
|
|
@@ -682,10 +661,6 @@ public class SiMzFeeService {
|
|
|
spcChrDiseAcct.setStaffId(param.getStaffId());
|
|
|
spcChrDiseAcct.setExpContent(param.getExpContent());
|
|
|
ResultVo<String> upldMdtrtRes = uploadOutpatientInfo(spcChrDiseAcct, siPatInfo);
|
|
|
- if (null == upldMdtrtRes) {
|
|
|
- revokeOutpatientRegistration(mzptnt);
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
- }
|
|
|
if (upldMdtrtRes.getCode() != ExceptionEnum.SUCCESS.getCode()) {
|
|
|
revokeOutpatientRegistration(mzptnt);
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, upldMdtrtRes.getMessage());
|
|
|
@@ -717,10 +692,6 @@ public class SiMzFeeService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有可以上传到医保的费用。");
|
|
|
}
|
|
|
ResultVo<String> insertSiMzFeeRes = webHisService.insertSiMzFees(webHisUrl, mzReceipts);
|
|
|
- if (null == insertSiMzFeeRes) {
|
|
|
- revokeOutpatientRegistration(mzptnt);
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
- }
|
|
|
if (insertSiMzFeeRes.getCode() != ExceptionEnum.SUCCESS.getCode()) {
|
|
|
revokeOutpatientRegistration(mzptnt);
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, insertSiMzFeeRes.getMessage());
|
|
|
@@ -732,10 +703,6 @@ public class SiMzFeeService {
|
|
|
spcChrDiseAcct.setTimes(mzptnt.getTimes());
|
|
|
spcChrDiseAcct.setFromDirectReg(true);
|
|
|
ResultVo<SiPatInfo> upldFeeRes = uploadOutpatientFeeDetails(spcChrDiseAcct);
|
|
|
- if (null == upldFeeRes) {
|
|
|
- revokeOutpatientRegistration(mzptnt);
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
- }
|
|
|
if (upldFeeRes.getCode() != ExceptionEnum.SUCCESS.getCode()) {
|
|
|
revokeOutpatientRegistration(mzptnt);
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, upldFeeRes.getMessage());
|