|
|
@@ -3,6 +3,7 @@ package thyyxxk.simzfeeoprnsystm.service;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import thyyxxk.simzfeeoprnsystm.dao.SiLogDao;
|
|
|
import thyyxxk.simzfeeoprnsystm.dao.SiMzDao;
|
|
|
import thyyxxk.simzfeeoprnsystm.dao.SiSetldetailDao;
|
|
|
import thyyxxk.simzfeeoprnsystm.dao.SiSetlinfoDao;
|
|
|
@@ -29,13 +30,16 @@ public class SiMzFeeService {
|
|
|
private static final String RESULT_CODE = "infcode";
|
|
|
private static final String ERROR_MESSAGE = "err_msg";
|
|
|
private static final String OUTPUT = "output";
|
|
|
+ private final SiLogDao logDao;
|
|
|
|
|
|
@Autowired
|
|
|
- public SiMzFeeService(SiMzDao mzDao, SiSetlinfoDao setlinfoDao, SiSetldetailDao setldetailDao, ExecService exec) {
|
|
|
+ public SiMzFeeService(SiMzDao mzDao, SiSetlinfoDao setlinfoDao,
|
|
|
+ SiSetldetailDao setldetailDao, ExecService exec, SiLogDao logDao) {
|
|
|
this.mzDao = mzDao;
|
|
|
this.setlinfoDao = setlinfoDao;
|
|
|
this.setldetailDao = setldetailDao;
|
|
|
this.exec = exec;
|
|
|
+ this.logDao = logDao;
|
|
|
}
|
|
|
|
|
|
public ResultVo<String> outpatientRegistration(MzPatientInfo p) {
|
|
|
@@ -56,10 +60,12 @@ public class SiMzFeeService {
|
|
|
if (null == result) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
}
|
|
|
- if (null == result.getInteger(RESULT_CODE)) {
|
|
|
+ Integer infcode = result.getInteger(RESULT_CODE);
|
|
|
+ logDao.insert(new SiLog(input, result, p.getPatNo(), p.getTimes(), infcode));
|
|
|
+ if (null == infcode) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
}
|
|
|
- if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
+ if (infcode == 0) {
|
|
|
JSONObject output = result.getJSONObject(OUTPUT).getJSONObject("data");
|
|
|
p.setMdtrtId(output.getString("mdtrt_id"));
|
|
|
p.setVisitDate(regstrtn.getBegntime());
|
|
|
@@ -89,10 +95,12 @@ public class SiMzFeeService {
|
|
|
if (null == result) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
}
|
|
|
- if (null == result.getInteger(RESULT_CODE)) {
|
|
|
+ Integer infcode = result.getInteger(RESULT_CODE);
|
|
|
+ logDao.insert(new SiLog(input, result, p.getPatNo(), p.getTimes(), infcode));
|
|
|
+ if (null == infcode) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
}
|
|
|
- if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
+ if (infcode == 0) {
|
|
|
mzDao.clearMdtrtIdForMz(p.getPatNo(), p.getTimes(), null);
|
|
|
return ResultVoUtil.success("取消门诊挂号成功。");
|
|
|
}
|
|
|
@@ -132,6 +140,8 @@ public class SiMzFeeService {
|
|
|
input.getJSONObject("input").put("diseinfo", JSONArray.parse(ref));
|
|
|
JSONObject result = exec.executeTrade(input, SiFunction.UPLOAD_OUTPATIENT_INFO);
|
|
|
log.info("【操作员:{}】门诊就诊信息上传:\n参数:{},\n结果:{}", staffId, input, result);
|
|
|
+ Integer infcode = result.getInteger(RESULT_CODE);
|
|
|
+ logDao.insert(new SiLog(input, result, p.getPatNo(), p.getTimes(), infcode));
|
|
|
return SiUtil.makeReturnWithoutOutput(result, "门诊就诊信息上传成功。");
|
|
|
}
|
|
|
|
|
|
@@ -174,10 +184,12 @@ public class SiMzFeeService {
|
|
|
if (null == result) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
}
|
|
|
- if (null == result.getInteger(RESULT_CODE)) {
|
|
|
+ Integer infcode = result.getInteger(RESULT_CODE);
|
|
|
+ logDao.insert(new SiLog(input, result, p.getPatNo(), p.getTimes(), infcode));
|
|
|
+ if (null == infcode) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
}
|
|
|
- if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
+ if (infcode == 0) {
|
|
|
JSONArray feeRes = result.getJSONObject(OUTPUT).getJSONArray("result");
|
|
|
double fulamtOwnpayAmt = 0d;
|
|
|
double overlmtAmt = 0d;
|
|
|
@@ -215,7 +227,6 @@ public class SiMzFeeService {
|
|
|
p.setTimes(mzDao.selectMaxTimes(p.getPatNo()));
|
|
|
}
|
|
|
SiPatInfo siPatInfo = mzDao.selectSiPatInfoForMz(p.getPatNo(), p.getTimes());
|
|
|
- log.info("patNo: {}, times: {}, sipatinfo: {}", p.getPatNo(), p.getTimes(), siPatInfo);
|
|
|
if (null == siPatInfo || StringUtil.isBlank(siPatInfo.getMdtrtId())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有此患者的医保挂号信息!");
|
|
|
}
|
|
|
@@ -231,10 +242,12 @@ public class SiMzFeeService {
|
|
|
if (null == result) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
}
|
|
|
- if (null == result.getInteger(RESULT_CODE)) {
|
|
|
+ Integer infcode = result.getInteger(RESULT_CODE);
|
|
|
+ logDao.insert(new SiLog(input, result, p.getPatNo(), p.getTimes(), infcode));
|
|
|
+ if (null == infcode) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
}
|
|
|
- if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
+ if (infcode == 0) {
|
|
|
mzDao.afterRevokeFees(p.getPatNo(), p.getTimes());
|
|
|
return ResultVoUtil.success("门诊费用明细信息撤销成功。");
|
|
|
}
|
|
|
@@ -262,10 +275,12 @@ public class SiMzFeeService {
|
|
|
if (null == result) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
}
|
|
|
- if (null == result.getInteger(RESULT_CODE)) {
|
|
|
+ Integer infcode = result.getInteger(RESULT_CODE);
|
|
|
+ logDao.insert(new SiLog(input, result, p.getPatNo(), p.getTimes(), infcode));
|
|
|
+ if (null == infcode) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
}
|
|
|
- if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
+ if (infcode == 0) {
|
|
|
int mtPartCount = mzDao.selectMtPartCount(p.getPatNo(), p.getTimes());
|
|
|
if (mtPartCount == 0) {
|
|
|
MtPartInfo mtinfo = new MtPartInfo();
|
|
|
@@ -327,10 +342,12 @@ public class SiMzFeeService {
|
|
|
if (null == result) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR, "与医保中心的连接出现网络异常!");
|
|
|
}
|
|
|
- if (null == result.getInteger(RESULT_CODE)) {
|
|
|
+ Integer infcode = result.getInteger(RESULT_CODE);
|
|
|
+ logDao.insert(new SiLog(input, result, p.getPatNo(), p.getTimes(), infcode));
|
|
|
+ if (null == infcode) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
}
|
|
|
- if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
+ if (infcode == 0) {
|
|
|
JSONObject setlinfo = result.getJSONObject(OUTPUT).getJSONObject("setlinfo");
|
|
|
SiSetlinfo setlEntity = JSONObject.parseObject(setlinfo.toJSONString(), SiSetlinfo.class);
|
|
|
setlEntity.setPatNo(p.getPatNo());
|
|
|
@@ -380,10 +397,12 @@ public class SiMzFeeService {
|
|
|
if (null == result) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
}
|
|
|
- if (null == result.getInteger(RESULT_CODE)) {
|
|
|
+ Integer infcode = result.getInteger(RESULT_CODE);
|
|
|
+ logDao.insert(new SiLog(input, result, p.getPatNo(), p.getTimes(), infcode));
|
|
|
+ if (null == infcode) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
}
|
|
|
- if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
+ if (infcode == 0) {
|
|
|
mzDao.deleteSetlInfo(p.getPatNo(), p.getTimes());
|
|
|
mzDao.deleteSetlDetail(p.getPatNo(), p.getTimes());
|
|
|
mzDao.updateRvkSetlMsgid(p.getPatNo(), p.getTimes(), input.getString("msgid"));
|