|
@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import thyyxxk.webserver.config.envionment.SystemConfig;
|
|
@@ -37,17 +38,19 @@ public class SiPsnRcdService {
|
|
|
private final TransHospRcdDao trsHspRcdDao;
|
|
|
private final PsnAsgnmtRcdDao psnAsgRcdDao;
|
|
|
private final PsnAccidentRcdDao psnAccdntDao;
|
|
|
+ private final BirthRcdDao birthRcdDao;
|
|
|
private final SiLogDao logDao;
|
|
|
private final UserCache userCache;
|
|
|
private final SystemConfig sysCfg;
|
|
|
|
|
|
@Autowired
|
|
|
- public SiPsnRcdService(ExecService exec, SlwSpcChrRcdDao dao, TransHospRcdDao trsHspRcdDao, PsnAsgnmtRcdDao psnAsgRcdDao, PsnAccidentRcdDao psnAccdntDao, SiLogDao logDao, UserCache userCache, SystemConfig sysCfg) {
|
|
|
+ public SiPsnRcdService(ExecService exec, SlwSpcChrRcdDao dao, TransHospRcdDao trsHspRcdDao, PsnAsgnmtRcdDao psnAsgRcdDao, PsnAccidentRcdDao psnAccdntDao, BirthRcdDao birthRcdDao, SiLogDao logDao, UserCache userCache, SystemConfig sysCfg) {
|
|
|
this.exec = exec;
|
|
|
this.slwSpcChrRcdDao = dao;
|
|
|
this.trsHspRcdDao = trsHspRcdDao;
|
|
|
this.psnAsgRcdDao = psnAsgRcdDao;
|
|
|
this.psnAccdntDao = psnAccdntDao;
|
|
|
+ this.birthRcdDao = birthRcdDao;
|
|
|
this.logDao = logDao;
|
|
|
this.userCache = userCache;
|
|
|
this.sysCfg = sysCfg;
|
|
@@ -245,6 +248,72 @@ public class SiPsnRcdService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
}
|
|
|
|
|
|
+ public ResultVo<String> revokePersonnelAccidentRecord(RvkPsnRcd rvkPsnRcd) {
|
|
|
+ JSONObject input = exec.makeTradeHeader(SiFunction.REVOKE_PERSONNEL_ACCIDENT_RECORD);
|
|
|
+ String ref = JSONObject.toJSONString(rvkPsnRcd);
|
|
|
+ input.getJSONObject("input").put("data", JSONObject.parseObject(ref));
|
|
|
+ JSONObject result = exec.executeTrade(input, SiFunction.REVOKE_PERSONNEL_ACCIDENT_RECORD);
|
|
|
+ if (null == result) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
+ Integer infcode = result.getInteger(RESULT_CODE);
|
|
|
+ logDao.insert(new SiLog(input, result, null, null, null, infcode, rvkPsnRcd.getPsnNo()));
|
|
|
+ if (null == infcode) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
+ }
|
|
|
+ if (infcode == 0) {
|
|
|
+ psnAsgRcdDao.deleteById(rvkPsnRcd.getId());
|
|
|
+ return ResultVoUtil.success("人员意外伤害备案撤销成功。");
|
|
|
+ }
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
+ }
|
|
|
+
|
|
|
+ public ResultVo<String> birthRecord(BirthRcd birthRcd) {
|
|
|
+ JSONObject input = exec.makeTradeHeader(SiFunction.BIRTH_RECORD);
|
|
|
+ String ref = JSONObject.toJSONStringWithDateFormat(birthRcd, "yyyy-MM-dd");
|
|
|
+ input.getJSONObject("input").put("data", JSONObject.parseObject(ref));
|
|
|
+ JSONObject result = exec.executeTrade(input, SiFunction.BIRTH_RECORD);
|
|
|
+ if (null == result) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
+ Integer infcode = result.getInteger(RESULT_CODE);
|
|
|
+ logDao.insert(new SiLog(input, result, null, null, null, infcode, birthRcd.getPsnNo()));
|
|
|
+ if (null == infcode) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
+ }
|
|
|
+ if (infcode == 0) {
|
|
|
+ JSONObject output = result.getJSONObject(OUTPUT);
|
|
|
+ String trtDclaDetlSn = output.getJSONObject("result").getString("trt_dcla_detl_sn");
|
|
|
+ if(StringUtils.isBlank(trtDclaDetlSn)) {
|
|
|
+ trtDclaDetlSn = output.getJSONObject("result").getString("trtDclaDetlSn");
|
|
|
+ }
|
|
|
+ birthRcd.setTrtDclaDetlSn(trtDclaDetlSn);
|
|
|
+ birthRcdDao.insert(birthRcd);
|
|
|
+ return ResultVoUtil.success("生育待遇备案登记成功,备案明细流水号为:" + trtDclaDetlSn);
|
|
|
+ }
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
+ }
|
|
|
+
|
|
|
+ public ResultVo<String> revokeBirthRecord(RvkPsnRcd rvkPsnRcd) {
|
|
|
+ JSONObject input = exec.makeTradeHeader(SiFunction.REVOKE_BIRTH_RECORD);
|
|
|
+ String ref = JSONObject.toJSONString(rvkPsnRcd);
|
|
|
+ input.getJSONObject("input").put("data", JSONObject.parseObject(ref));
|
|
|
+ JSONObject result = exec.executeTrade(input, SiFunction.REVOKE_BIRTH_RECORD);
|
|
|
+ if (null == result) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
+ Integer infcode = result.getInteger(RESULT_CODE);
|
|
|
+ logDao.insert(new SiLog(input, result, null, null, null, infcode, rvkPsnRcd.getPsnNo()));
|
|
|
+ if (null == infcode) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
+ }
|
|
|
+ if (infcode == 0) {
|
|
|
+ psnAsgRcdDao.deleteById(rvkPsnRcd.getId());
|
|
|
+ return ResultVoUtil.success("生育待遇备案登记撤销成功。");
|
|
|
+ }
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
+ }
|
|
|
+
|
|
|
public ResultVo<List<SlwSpcDiseRcd>> selectAllSpcSlwRcds(String begntime, String endtime) {
|
|
|
begntime = begntime + " 00:00:00.000";
|
|
|
endtime = endtime + " 23:59:59.999";
|