|
@@ -160,7 +160,7 @@ public class SiZyService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<String> modifyAdmissionInfo(ZyPatientInfo p) {
|
|
|
- SiPatInfo siPatInfo = queryDao.selectSiPatInfoForZy(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
+ SiPatInfo siPatInfo = queryDao.selectSiPatInfo(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
if (null == siPatInfo || StringUtil.isBlank(siPatInfo.getMdtrtId())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "患者医保不在院!");
|
|
|
}
|
|
@@ -196,7 +196,7 @@ public class SiZyService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<String> revokeAdmission(ZyPatientInfo p) {
|
|
|
- SiPatInfo siPatInfo = queryDao.selectSiPatInfoForZy(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
+ SiPatInfo siPatInfo = queryDao.selectSiPatInfo(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
if (null == siPatInfo || StringUtil.isBlank(siPatInfo.getMdtrtId())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的医保在院信息!");
|
|
|
}
|
|
@@ -297,7 +297,7 @@ public class SiZyService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<String> revokeUploadFees(ZyPatientInfo p) {
|
|
|
- SiPatInfo siPatInfo = queryDao.selectSiPatInfoForZy(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
+ SiPatInfo siPatInfo = queryDao.selectSiPatInfo(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
if (null == siPatInfo || StringUtil.isBlank(siPatInfo.getMdtrtId())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的医保在院信息!");
|
|
|
}
|
|
@@ -352,7 +352,7 @@ public class SiZyService {
|
|
|
if (null == fee.getOriDetailSn()) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请先处理违规退费。");
|
|
|
}
|
|
|
- SiPatInfo siPatInfo = queryDao.selectSiPatInfoForZy(fee.getPatNo(), fee.getTimes(), fee.getLedgerSn());
|
|
|
+ SiPatInfo siPatInfo = queryDao.selectSiPatInfo(fee.getPatNo(), fee.getTimes(), fee.getLedgerSn());
|
|
|
JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.REVOKE_HOSPITALIZATION_FEE_DETAILS,
|
|
|
siPatInfo.getInsuplcAdmdvs());
|
|
|
JSONArray data = new JSONArray();
|
|
@@ -385,7 +385,7 @@ public class SiZyService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<String> revokeSingleCharge(String patNo, int times, int ledgerSn, int detailSn) {
|
|
|
- SiPatInfo siPatInfo = queryDao.selectSiPatInfoForZy(patNo, times, ledgerSn);
|
|
|
+ SiPatInfo siPatInfo = queryDao.selectSiPatInfo(patNo, times, ledgerSn);
|
|
|
JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.REVOKE_HOSPITALIZATION_FEE_DETAILS,
|
|
|
siPatInfo.getInsuplcAdmdvs());
|
|
|
JSONArray data = new JSONArray();
|
|
@@ -487,7 +487,7 @@ public class SiZyService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<String> revokeDischarge(ZyPatientInfo p) {
|
|
|
- SiPatInfo siPatInfo = queryDao.selectSiPatInfoForZy(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
+ SiPatInfo siPatInfo = queryDao.selectSiPatInfo(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
if (null == siPatInfo || StringUtil.isBlank(siPatInfo.getMdtrtId())) {
|
|
|
transbackTables(p);
|
|
|
return ResultVoUtil.success("取消出院办理成功。");
|
|
@@ -517,15 +517,19 @@ public class SiZyService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
}
|
|
|
|
|
|
+ private void fillBeginTime(ZyPatientInfo p) {
|
|
|
+ if (null == p.getYbRegisterDate()) {
|
|
|
+ Date beginTime = dismissService.getBegntime(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn(), "zy_actpatient");
|
|
|
+ p.setYbRegisterDate(beginTime);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private ResultVo<String> inpatientSettlement(ZyPatientInfo p) {
|
|
|
PreSetlmt preSetlmt;
|
|
|
- Date begntime = p.getYbRegisterDate();
|
|
|
- if (null == begntime) {
|
|
|
- begntime = dismissService.getBegntime(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn(), "zy_actpatient");
|
|
|
- }
|
|
|
+ fillBeginTime(p);
|
|
|
if (p.getMidSetl()) {
|
|
|
preSetlmt = dao.selectPreSetlmtForMidSetl(p.getInpatientNo(), p.getAdmissTimes(),
|
|
|
- p.getLedgerSn(), begntime, p.getZjdzDatetime());
|
|
|
+ p.getLedgerSn(), p.getYbRegisterDate(), p.getZjdzDatetime());
|
|
|
} else {
|
|
|
preSetlmt = dao.selectPreSetlmt(p.getInpatientNo(), p.getAdmissTimes(),
|
|
|
p.getLedgerSn(), "2999-12-31 23:59:59.999");
|
|
@@ -579,102 +583,118 @@ public class SiZyService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
}
|
|
|
if (infcode == 0) {
|
|
|
- JSONObject setlinfo = result.getJSONObject(OUTPUT).getJSONObject("setlinfo");
|
|
|
- SiSetlinfo setlinfoEntity = JSONObject.parseObject(setlinfo.toJSONString(), SiSetlinfo.class);
|
|
|
- setlinfoEntity.setPatNo(p.getInpatientNo());
|
|
|
- setlinfoEntity.setTimes(p.getAdmissTimes());
|
|
|
- setlinfoEntity.setLedgerSn(p.getLedgerSn());
|
|
|
- setlinfoEntity.setStaffId(TokenUtil.getInstance().getTokenUserId());
|
|
|
- setlinfoEntity.setRevoked(YesOrNo.NO.getCode());
|
|
|
- setlinfoEntity.setSetlType(ClrType.INPATIENT.getCode());
|
|
|
- setlinfoEntity.setInsuplcAdmdvs(preSetlmt.getInsuplcAdmdvs());
|
|
|
- setlinfoEntity.setBegntime(begntime);
|
|
|
- setlinfoEntity.setEndtime(p.getDismissDate());
|
|
|
- setlinfoEntity.setHiPaymtd(CommonUtil.calcHiPaymtd(setlinfoEntity.getInsuplcAdmdvs(),setlinfoEntity.getMedType(),setlinfoEntity.getInsutype(),setlinfoEntity.getSetlTime()));
|
|
|
- setlinfoEntity.setMedinsType(MedInsTypeUtil.getMedInsType(setlinfoEntity));
|
|
|
- JSONArray setldetail = result.getJSONObject(OUTPUT).getJSONArray("setldetail");
|
|
|
- BigDecimal hospitalPart = BigDecimal.ZERO;
|
|
|
- for (int i = 0; i < setldetail.size(); i++) {
|
|
|
- SiSetldetail setldetailEntity = JSONObject.parseObject(setldetail.getJSONObject(i).toJSONString(), SiSetldetail.class);
|
|
|
- setldetailEntity.setPatNo(p.getInpatientNo());
|
|
|
- setldetailEntity.setTimes(p.getAdmissTimes());
|
|
|
- setldetailEntity.setLedgerSn(p.getLedgerSn());
|
|
|
- if (setldetailEntity.getFundPayType().equals("999996") || setldetailEntity.getSetlProcInfo().equals("999996")) {
|
|
|
- hospitalPart = hospitalPart.add(setldetailEntity.getFundPayamt());
|
|
|
- }
|
|
|
- setldetldao.insert(setldetailEntity);
|
|
|
+ p.setInsuplcAdmdvs(preSetlmt.getInsuplcAdmdvs());
|
|
|
+ return executeHisSettlement(result.getJSONObject(OUTPUT), p);
|
|
|
+ }
|
|
|
+ revokeDischarge(p);
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
+ }
|
|
|
+
|
|
|
+ public ResultVo<String> timeoutSettlement(ZyPatientInfo p) {
|
|
|
+ SiPatInfo siPatInfo = queryDao.selectSiPatInfo(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
+ if (null == siPatInfo) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "[t_si_pat_info]没有此患者的就诊信息。");
|
|
|
+ }
|
|
|
+ fillBeginTime(p);
|
|
|
+ p.setInsuplcAdmdvs(siPatInfo.getInsuplcAdmdvs());
|
|
|
+ JSONObject output = queryService.execute5203(siPatInfo);
|
|
|
+ return executeHisSettlement(output, p);
|
|
|
+ }
|
|
|
+
|
|
|
+ private ResultVo<String> executeHisSettlement(JSONObject output, ZyPatientInfo p) {
|
|
|
+ JSONObject setlinfo = output.getJSONObject("setlinfo");
|
|
|
+ SiSetlinfo setlinfoEntity = JSONObject.parseObject(setlinfo.toJSONString(), SiSetlinfo.class);
|
|
|
+ setlinfoEntity.setPatNo(p.getInpatientNo());
|
|
|
+ setlinfoEntity.setTimes(p.getAdmissTimes());
|
|
|
+ setlinfoEntity.setLedgerSn(p.getLedgerSn());
|
|
|
+ setlinfoEntity.setStaffId(TokenUtil.getInstance().getTokenUserId());
|
|
|
+ setlinfoEntity.setRevoked(YesOrNo.NO.getCode());
|
|
|
+ setlinfoEntity.setSetlType(ClrType.INPATIENT.getCode());
|
|
|
+ setlinfoEntity.setInsuplcAdmdvs(p.getInsuplcAdmdvs());
|
|
|
+ setlinfoEntity.setBegntime(p.getYbRegisterDate());
|
|
|
+ setlinfoEntity.setEndtime(p.getDismissDate());
|
|
|
+ setlinfoEntity.setHiPaymtd(CommonUtil.calcHiPaymtd(setlinfoEntity.getInsuplcAdmdvs(),setlinfoEntity.getMedType(),setlinfoEntity.getInsutype(),setlinfoEntity.getSetlTime()));
|
|
|
+ setlinfoEntity.setMedinsType(MedInsTypeUtil.getMedInsType(setlinfoEntity));
|
|
|
+ JSONArray setldetail = output.getJSONArray("setldetail");
|
|
|
+ BigDecimal hospitalPart = BigDecimal.ZERO;
|
|
|
+ for (int i = 0; i < setldetail.size(); i++) {
|
|
|
+ SiSetldetail setldetailEntity = JSONObject.parseObject(setldetail.getJSONObject(i).toJSONString(), SiSetldetail.class);
|
|
|
+ setldetailEntity.setPatNo(p.getInpatientNo());
|
|
|
+ setldetailEntity.setTimes(p.getAdmissTimes());
|
|
|
+ setldetailEntity.setLedgerSn(p.getLedgerSn());
|
|
|
+ if (setldetailEntity.getFundPayType().equals("999996") || setldetailEntity.getSetlProcInfo().equals("999996")) {
|
|
|
+ hospitalPart = hospitalPart.add(setldetailEntity.getFundPayamt());
|
|
|
}
|
|
|
- setlinfoEntity.setHospPartAmt(hospitalPart.doubleValue());
|
|
|
- setlinfodao.insert(setlinfoEntity);
|
|
|
- setlinfodao.updateSiZyInfoSetlId(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn(),
|
|
|
- setlinfoEntity.getSetlId(), setlinfoEntity.getMedinsSetlId(), input.getString("msgid"));
|
|
|
- setlinfodao.updateApplySettled(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn(), YesOrNo.YES.getCode());
|
|
|
+ setldetldao.insert(setldetailEntity);
|
|
|
+ }
|
|
|
+ setlinfoEntity.setHospPartAmt(hospitalPart.doubleValue());
|
|
|
+ setlinfodao.insert(setlinfoEntity);
|
|
|
+ setlinfodao.updateSiZyInfoSetlId(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn(),
|
|
|
+ setlinfoEntity.getSetlId(), setlinfoEntity.getMedinsSetlId(), setlinfoEntity.getMedinsSetlId());
|
|
|
+ setlinfodao.updateApplySettled(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn(), YesOrNo.YES.getCode());
|
|
|
|
|
|
- // 跨省异地数据不参与对账,对总账时无需统计进去。
|
|
|
- if (setlinfoEntity.getFundPaySumamt() > 0 && setlinfoEntity.getInsuplcAdmdvs().startsWith("43")) {
|
|
|
- InstStlLdgChk ldgChk = new InstStlLdgChk();
|
|
|
- ldgChk.setInsutype(setlinfoEntity.getInsutype());
|
|
|
- ldgChk.setClrType(setlinfoEntity.getClrType());
|
|
|
- ldgChk.setSetlOptins(setlinfoEntity.getClrOptins());
|
|
|
- ldgChk.setStmtBegndate(setlinfoEntity.getSetlTime());
|
|
|
- ldgChk.setStmtEnddate(setlinfoEntity.getSetlTime());
|
|
|
- ResultVo<String> totalLedgerCheck = manageService.institutionSettlementLedgerCheck(ldgChk);
|
|
|
- if (totalLedgerCheck.getCode() != ExceptionEnum.SUCCESS.getCode()) {
|
|
|
- InstStlLdgChk detlChk = new InstStlLdgChk();
|
|
|
- detlChk.setSetlOptins(ldgChk.getSetlOptins());
|
|
|
- detlChk.setStmtBegndate(ldgChk.getStmtBegndate());
|
|
|
- detlChk.setStmtEnddate(ldgChk.getStmtEnddate());
|
|
|
- detlChk.setClrType(ldgChk.getClrType());
|
|
|
- detlChk.setRefdSetlFlag(YesOrNo.NO.getCodeStr());
|
|
|
- ResultVo<List<InsSetlDetlChkRslt>> detailLedgerCheck = manageService.institutionSettlementDetailCheck(detlChk);
|
|
|
- if (detailLedgerCheck.getCode() != ExceptionEnum.SUCCESS.getCode()) {
|
|
|
- revokeSettlement(p);
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, detailLedgerCheck.getMessage());
|
|
|
- }
|
|
|
- for (InsSetlDetlChkRslt insSetlDetlChkRslt : detailLedgerCheck.getData()) {
|
|
|
- if (Objects.equals(insSetlDetlChkRslt.getSetlId(), setlinfoEntity.getSetlId())) {
|
|
|
- if (!Objects.equals(insSetlDetlChkRslt.getStmtRslt(), "0")) {
|
|
|
- revokeSettlement(p);
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, insSetlDetlChkRslt.getMemo());
|
|
|
- }
|
|
|
- break;
|
|
|
+ // 跨省异地数据不参与对账,对总账时无需统计进去。
|
|
|
+ if (setlinfoEntity.getFundPaySumamt() > 0 && setlinfoEntity.getInsuplcAdmdvs().startsWith("43")) {
|
|
|
+ InstStlLdgChk ldgChk = new InstStlLdgChk();
|
|
|
+ ldgChk.setInsutype(setlinfoEntity.getInsutype());
|
|
|
+ ldgChk.setClrType(setlinfoEntity.getClrType());
|
|
|
+ ldgChk.setSetlOptins(setlinfoEntity.getClrOptins());
|
|
|
+ ldgChk.setStmtBegndate(setlinfoEntity.getSetlTime());
|
|
|
+ ldgChk.setStmtEnddate(setlinfoEntity.getSetlTime());
|
|
|
+ ResultVo<String> totalLedgerCheck = manageService.institutionSettlementLedgerCheck(ldgChk);
|
|
|
+ if (totalLedgerCheck.getCode() != ExceptionEnum.SUCCESS.getCode()) {
|
|
|
+ InstStlLdgChk detlChk = new InstStlLdgChk();
|
|
|
+ detlChk.setSetlOptins(ldgChk.getSetlOptins());
|
|
|
+ detlChk.setStmtBegndate(ldgChk.getStmtBegndate());
|
|
|
+ detlChk.setStmtEnddate(ldgChk.getStmtEnddate());
|
|
|
+ detlChk.setClrType(ldgChk.getClrType());
|
|
|
+ detlChk.setRefdSetlFlag(YesOrNo.NO.getCodeStr());
|
|
|
+ ResultVo<List<InsSetlDetlChkRslt>> detailLedgerCheck = manageService.institutionSettlementDetailCheck(detlChk);
|
|
|
+ if (detailLedgerCheck.getCode() != ExceptionEnum.SUCCESS.getCode()) {
|
|
|
+ revokeSettlement(p);
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, detailLedgerCheck.getMessage());
|
|
|
+ }
|
|
|
+ for (InsSetlDetlChkRslt insSetlDetlChkRslt : detailLedgerCheck.getData()) {
|
|
|
+ if (Objects.equals(insSetlDetlChkRslt.getSetlId(), setlinfoEntity.getSetlId())) {
|
|
|
+ if (!Objects.equals(insSetlDetlChkRslt.getStmtRslt(), "0")) {
|
|
|
+ revokeSettlement(p);
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, insSetlDetlChkRslt.getMemo());
|
|
|
}
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- queryService.saveCumInfo(setlinfoEntity);
|
|
|
- MedinsSettleFee settleFee = new MedinsSettleFee();
|
|
|
- if (p.getMidSetl()) {
|
|
|
- settleFee.setZjdzDatetime(p.getZjdzDatetime());
|
|
|
- }
|
|
|
- settleFee.setMidSetl(p.getMidSetl());
|
|
|
- settleFee.setStaffId(TokenUtil.getInstance().getTokenUserId());
|
|
|
- settleFee.setInpatientNo(p.getInpatientNo());
|
|
|
- settleFee.setAdmissTimes(p.getAdmissTimes());
|
|
|
- settleFee.setBedNo(p.getBedNo());
|
|
|
- settleFee.setWardCode(p.getAdmissWard());
|
|
|
- settleFee.setDeptCode(p.getAdmissDept());
|
|
|
- settleFee.setTotalCost(setlinfo.getString("medfee_sumamt"));
|
|
|
- settleFee.setTczf(setlinfo.getString("fund_pay_sumamt"));
|
|
|
- settleFee.setHospitalPay(setlinfo.getString("hosp_part_amt"));
|
|
|
- settleFee.setGrzhzf(setlinfo.getString("acct_pay"));
|
|
|
- settleFee.setDbzf(setlinfo.getString("hifmi_pay"));
|
|
|
- settleFee.setXjzf(setlinfo.getString("psn_cash_pay"));
|
|
|
- settleFee.setTable(p.getTable());
|
|
|
- return dismissService.executeDischarging(settleFee);
|
|
|
}
|
|
|
- revokeDischarge(p);
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
+ queryService.saveCumInfo(setlinfoEntity);
|
|
|
+ MedinsSettleFee settleFee = new MedinsSettleFee();
|
|
|
+ if (p.getMidSetl()) {
|
|
|
+ settleFee.setZjdzDatetime(p.getZjdzDatetime());
|
|
|
+ }
|
|
|
+ settleFee.setMidSetl(p.getMidSetl());
|
|
|
+ settleFee.setStaffId(TokenUtil.getInstance().getTokenUserId());
|
|
|
+ settleFee.setInpatientNo(p.getInpatientNo());
|
|
|
+ settleFee.setAdmissTimes(p.getAdmissTimes());
|
|
|
+ settleFee.setBedNo(p.getBedNo());
|
|
|
+ settleFee.setWardCode(p.getAdmissWard());
|
|
|
+ settleFee.setDeptCode(p.getAdmissDept());
|
|
|
+ settleFee.setTotalCost(setlinfo.getString("medfee_sumamt"));
|
|
|
+ settleFee.setTczf(setlinfo.getString("fund_pay_sumamt"));
|
|
|
+ settleFee.setHospitalPay(setlinfo.getString("hosp_part_amt"));
|
|
|
+ settleFee.setGrzhzf(setlinfo.getString("acct_pay"));
|
|
|
+ settleFee.setDbzf(setlinfo.getString("hifmi_pay"));
|
|
|
+ settleFee.setXjzf(setlinfo.getString("psn_cash_pay"));
|
|
|
+ settleFee.setTable(p.getTable());
|
|
|
+ return dismissService.executeDischarging(settleFee);
|
|
|
}
|
|
|
|
|
|
public ResultVo<String> revokeSettlement(ZyPatientInfo p) {
|
|
|
- SiPatInfo siPatInfo = queryDao.selectSiPatInfoForZy(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
if (null == p.getStaffId()) {
|
|
|
p.setStaffId(TokenUtil.getInstance().getTokenUserId());
|
|
|
}
|
|
|
if (null == p.getLedgerSn()) {
|
|
|
p.setLedgerSn(dao.selectMaxLedgerSn(p.getInpatientNo(), p.getAdmissTimes()));
|
|
|
}
|
|
|
+ SiPatInfo siPatInfo = queryDao.selectSiPatInfo(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
if (null == siPatInfo || StringUtil.isBlank(siPatInfo.getSetlId())) {
|
|
|
return revokeDischarge(p);
|
|
|
}
|