|
|
@@ -315,7 +315,7 @@ public class SiMzFeeService {
|
|
|
if (null == p.getTimes()) {
|
|
|
p.setTimes(mzDao.selectMaxTimes(p.getPatNo()));
|
|
|
}
|
|
|
- ResultVo<FundDetail> setlfund = getFundDetailResultVo(p);
|
|
|
+ ResultVo<FundDetail> setlfund = getFundDetailByPatientInfo(p.getPatNo(), p.getTimes());
|
|
|
if (setlfund != null) {
|
|
|
return setlfund;
|
|
|
}
|
|
|
@@ -371,15 +371,15 @@ public class SiMzFeeService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
}
|
|
|
|
|
|
- private ResultVo<FundDetail> getFundDetailResultVo(MzPatientInfo p) {
|
|
|
- SiSetlinfo sisetl = mzDao.selectSettledInfo(p.getPatNo(), p.getTimes(), 0);
|
|
|
- if (null != sisetl && null != sisetl.getSetlId()) {
|
|
|
- return getFundDetailResultVo(sisetl);
|
|
|
+ private ResultVo<FundDetail> getFundDetailByPatientInfo(String patientId, int times) {
|
|
|
+ SiSetlinfo sisetlinfo = mzDao.selectSettledInfo(patientId, times, 0);
|
|
|
+ if (null != sisetlinfo && null != sisetlinfo.getSetlId()) {
|
|
|
+ return getFundDetailFromSetlinfo(sisetlinfo);
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- private ResultVo<FundDetail> getFundDetailResultVo(SiSetlinfo sisetl) {
|
|
|
+ private ResultVo<FundDetail> getFundDetailFromSetlinfo(SiSetlinfo sisetl) {
|
|
|
FundDetail fundDetail = new FundDetail();
|
|
|
fundDetail.setCardType(getCardType(sisetl.getInsuplcAdmdvs()));
|
|
|
fundDetail.setTotalCost(String.valueOf(sisetl.getMedfeeSumamt()));
|
|
|
@@ -403,7 +403,7 @@ public class SiMzFeeService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<FundDetail> outpatientSettlement(MzPatientInfo p) {
|
|
|
- ResultVo<FundDetail> setlfund = getFundDetailResultVo(p);
|
|
|
+ ResultVo<FundDetail> setlfund = getFundDetailByPatientInfo(p.getPatNo(), p.getTimes());
|
|
|
if (setlfund != null) {
|
|
|
return setlfund;
|
|
|
}
|
|
|
@@ -469,7 +469,7 @@ public class SiMzFeeService {
|
|
|
setldetailDao.insert(setldetailEntity);
|
|
|
}
|
|
|
webHisSrvc.saveCumInfo(webHisUrl, setlEntity);
|
|
|
- return getFundDetailResultVo(setlEntity);
|
|
|
+ return getFundDetailFromSetlinfo(setlEntity);
|
|
|
}
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
}
|
|
|
@@ -481,7 +481,7 @@ public class SiMzFeeService {
|
|
|
SiSetlinfo setlinfo = mzDao.selectSettledInfo(p.getPatNo(), p.getTimes(), 0);
|
|
|
if (null == setlinfo) {
|
|
|
setlinfo = mzDao.selectSettledInfo(p.getPatNo(), p.getTimes(), 1);
|
|
|
- return getFundDetailResultVo(setlinfo);
|
|
|
+ return getFundDetailFromSetlinfo(setlinfo);
|
|
|
}
|
|
|
JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.REVOKE_OUTPATIENT_SETTLEMENT,
|
|
|
mzDao.selectAdmdvs(setlinfo.getPatNo(), setlinfo.getTimes(), setlinfo.getLedgerSn()), p.getStaffId());
|
|
|
@@ -504,7 +504,7 @@ public class SiMzFeeService {
|
|
|
mzDao.deleteSetlInfo(p.getPatNo(), p.getTimes());
|
|
|
mzDao.deleteSetlDetail(p.getPatNo(), p.getTimes());
|
|
|
mzDao.updateRvkSetlMsgid(p.getPatNo(), p.getTimes(), input.getString("msgid"));
|
|
|
- return getFundDetailResultVo(setlinfo);
|
|
|
+ return getFundDetailFromSetlinfo(setlinfo);
|
|
|
}
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
}
|
|
|
@@ -536,10 +536,29 @@ public class SiMzFeeService {
|
|
|
|
|
|
public ResultVo<FundDetail> directRegistration(DirectionRegParam param) {
|
|
|
log.info("门诊共济:{}", param);
|
|
|
+ if (MzgjUtil.inProcessing(param.getPatientId())) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者上一次的共济流程尚未结束,请稍后再试。");
|
|
|
+ }
|
|
|
+ MzgjUtil.addProcess(param.getPatientId());
|
|
|
+ try {
|
|
|
+ return executeMzgj(param);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("门诊共济出错:", e);
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, e.getMessage());
|
|
|
+ } finally {
|
|
|
+ MzgjUtil.finishProcessing(param.getPatientId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private ResultVo<FundDetail> executeMzgj(DirectionRegParam param) {
|
|
|
if (mzDao.selectExistCount(param.getPatientId(), param.getTimes()) == 0) {
|
|
|
mzDao.updateMzTimes(param.getPatientId(), param.getTimes());
|
|
|
}
|
|
|
mzDao.deleteTempPatinfo(param.getPatientId(), param.getTimes());
|
|
|
+ ResultVo<FundDetail> setlfund = getFundDetailByPatientInfo(param.getPatientId(), param.getTimes());
|
|
|
+ if (setlfund != null) {
|
|
|
+ return setlfund;
|
|
|
+ }
|
|
|
MzPatientInfo mzptnt = new MzPatientInfo();
|
|
|
mzptnt.setStaffId(param.getStaffId());
|
|
|
mzptnt.setPatNo(param.getPatientId());
|