|
@@ -2,6 +2,7 @@ package thyyxxk.webserver.service.medicalinsurance;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -11,10 +12,7 @@ import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.webserver.constants.Capacity;
|
|
|
import thyyxxk.webserver.constants.sidicts.*;
|
|
|
import thyyxxk.webserver.constants.YesOrNo;
|
|
|
-import thyyxxk.webserver.dao.his.medicalinsurance.SiQueryDao;
|
|
|
-import thyyxxk.webserver.dao.his.medicalinsurance.SiSetldetailDao;
|
|
|
-import thyyxxk.webserver.dao.his.medicalinsurance.SiSetlinfoDao;
|
|
|
-import thyyxxk.webserver.dao.his.medicalinsurance.SiZyDao;
|
|
|
+import thyyxxk.webserver.dao.his.medicalinsurance.*;
|
|
|
import thyyxxk.webserver.entity.ResultVo;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.inpatient.*;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.query.SiPatInfo;
|
|
@@ -54,23 +52,25 @@ public class SiZyService {
|
|
|
private static final String ERROR_MESSAGE = "err_msg";
|
|
|
private static final String OUTPUT = "output";
|
|
|
private final SiZyDao dao;
|
|
|
- private final SiQueryDao queryDao;
|
|
|
- private final SiSetlinfoDao setlinfoDao;
|
|
|
- private final SiSetldetailDao setldetailDao;
|
|
|
+ private final SiQueryDao qrydao;
|
|
|
+ private final SiSetlinfoDao setlinfodao;
|
|
|
+ private final SiSetldetailDao setldetldao;
|
|
|
+ private final SiChargeTempDao chrgtmpdao;
|
|
|
private final ExecService exec;
|
|
|
private final SettleService settleService;
|
|
|
private final DismissService dismissService;
|
|
|
private final XiangMuLuRuService xmlrService;
|
|
|
|
|
|
@Autowired
|
|
|
- public SiZyService(SiZyDao dao, SiQueryDao queryDao, SiSetlinfoDao setlinfoDao,
|
|
|
- SiSetldetailDao setldetailDao, ExecService exec,
|
|
|
+ public SiZyService(SiZyDao dao, SiQueryDao qrydao, SiSetlinfoDao setlinfoDao,
|
|
|
+ SiSetldetailDao setldetldao, SiChargeTempDao chrgtmpdao, ExecService exec,
|
|
|
SettleService settleService, DismissService dismissService,
|
|
|
XiangMuLuRuService xmlrService) {
|
|
|
this.dao = dao;
|
|
|
- this.queryDao = queryDao;
|
|
|
- this.setlinfoDao = setlinfoDao;
|
|
|
- this.setldetailDao = setldetailDao;
|
|
|
+ this.qrydao = qrydao;
|
|
|
+ this.setlinfodao = setlinfoDao;
|
|
|
+ this.setldetldao = setldetldao;
|
|
|
+ this.chrgtmpdao = chrgtmpdao;
|
|
|
this.exec = exec;
|
|
|
this.settleService = settleService;
|
|
|
this.dismissService = dismissService;
|
|
@@ -148,7 +148,7 @@ public class SiZyService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<String> revokeAdmission(ZyPatientInfo p) {
|
|
|
- SiPatInfo siPatInfo = queryDao.selectSiPatInfoForZy(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
+ SiPatInfo siPatInfo = qrydao.selectSiPatInfoForZy(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
if (null == siPatInfo || StringUtil.isBlank(siPatInfo.getMdtrtId())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的医保在院信息!");
|
|
|
}
|
|
@@ -163,14 +163,14 @@ public class SiZyService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
}
|
|
|
if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
- queryDao.clearMdtrtIdForZy(siPatInfo.getPatNo(), siPatInfo.getTimes(), siPatInfo.getLedgerSn(), null);
|
|
|
+ qrydao.clearMdtrtIdForZy(siPatInfo.getPatNo(), siPatInfo.getTimes(), siPatInfo.getLedgerSn(), null);
|
|
|
return ResultVoUtil.success("取消入院登记成功。");
|
|
|
}
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
}
|
|
|
|
|
|
public ResultVo<String> uploadFeeDetail(Overview o) {
|
|
|
- SiPatInfo siPatInfo = queryDao.selectSiPatInfoForZy(o.getInpatientNo(), o.getAdmissTimes(), o.getLedgerSn());
|
|
|
+ SiPatInfo siPatInfo = qrydao.selectSiPatInfoForZy(o.getInpatientNo(), o.getAdmissTimes(), o.getLedgerSn());
|
|
|
if (null == siPatInfo || StringUtil.isBlank(siPatInfo.getMdtrtId())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的医保在院信息!");
|
|
|
}
|
|
@@ -237,26 +237,33 @@ public class SiZyService {
|
|
|
log.info("【操作员:{}】,医保费用上传:参数:{},结果:{}", TokenUtil.getTokenUserId(), input, result);
|
|
|
if (null != result) {
|
|
|
if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
+ dao.updateTransFlag(p.getInpatientNo(), p.getAdmissTimes(), fees);
|
|
|
JSONArray array = result.getJSONObject(OUTPUT).getJSONArray("result");
|
|
|
for (int i = 0; i < array.size(); i++) {
|
|
|
+ SiChargeTemp chrgtemp = new SiChargeTemp();
|
|
|
+ chrgtemp.setPatNo(p.getInpatientNo());
|
|
|
+ chrgtemp.setTimes(p.getAdmissTimes());
|
|
|
+ chrgtemp.setLedgerSn(p.getLedgerSn());
|
|
|
JSONObject upldretrn = array.getJSONObject(i);
|
|
|
- String feedetlSn = upldretrn.getString("feedetl_sn");
|
|
|
- int detailSn = Integer.parseInt(feedetlSn);
|
|
|
- Double sum = upldretrn.getDouble("det_item_fee_sumamt");
|
|
|
- Double cnt = upldretrn.getDouble("cnt");
|
|
|
- Double pric = upldretrn.getDouble("pric");
|
|
|
- Double inscpScpAmt = upldretrn.getDouble("inscp_scp_amt");
|
|
|
- if (null == inscpScpAmt) {
|
|
|
- inscpScpAmt = 0d;
|
|
|
- }
|
|
|
- Double self = upldretrn.getDouble("selfpay_prop");
|
|
|
- if (null == self) {
|
|
|
- self = 0d;
|
|
|
- }
|
|
|
- String chrglv = upldretrn.getString("chrgitm_lv");
|
|
|
- String chrgtype = upldretrn.getString("med_chrgitm_type");
|
|
|
- dao.updtZydtelchrgAftrupld(sum, cnt, pric, self, chrglv, inscpScpAmt, chrgtype,
|
|
|
- p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn(), detailSn);
|
|
|
+ int detailSn = Integer.parseInt(upldretrn.getString("feedetl_sn"));
|
|
|
+ String chargeFee = upldretrn.getString("det_item_fee_sumamt");
|
|
|
+ Double chargeAmt = upldretrn.getDouble("cnt");
|
|
|
+ String chrgitmLv = upldretrn.getString("chrgitm_lv");
|
|
|
+ String medChrgitemType = upldretrn.getString("med_chrgitm_type");
|
|
|
+ String selfpayProp = upldretrn.getString("self_pay_prop");
|
|
|
+ String fulamtOwnpayAmt = upldretrn.getString("fulamt_ownpay_amt;");
|
|
|
+ String preselfpayAmt = upldretrn.getString("preselfpay_amt");
|
|
|
+ String inscpScpAmt = upldretrn.getString("inscp_scp_amt");
|
|
|
+ chrgtemp.setDetailSn(detailSn);
|
|
|
+ chrgtemp.setChargeFee(chargeFee);
|
|
|
+ chrgtemp.setChargeAmt(chargeAmt);
|
|
|
+ chrgtemp.setChrgitemLv(chrgitmLv);
|
|
|
+ chrgtemp.setMedChrgitmType(medChrgitemType);
|
|
|
+ chrgtemp.setSelfpayProp(selfpayProp);
|
|
|
+ chrgtemp.setFulamtOwnpayAmt(fulamtOwnpayAmt);
|
|
|
+ chrgtemp.setPreselfpayAmt(preselfpayAmt);
|
|
|
+ chrgtemp.setInscpScpAmt(inscpScpAmt);
|
|
|
+ chrgtmpdao.insert(chrgtemp);
|
|
|
}
|
|
|
} else {
|
|
|
String message = result.getString(ERROR_MESSAGE);
|
|
@@ -301,7 +308,7 @@ public class SiZyService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<String> revokeUploadFees(ZyPatientInfo p) {
|
|
|
- SiPatInfo siPatInfo = queryDao.selectSiPatInfoForZy(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
+ SiPatInfo siPatInfo = qrydao.selectSiPatInfoForZy(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
if (null == siPatInfo || StringUtil.isBlank(siPatInfo.getMdtrtId())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的医保在院信息!");
|
|
|
}
|
|
@@ -329,9 +336,16 @@ public class SiZyService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
}
|
|
|
if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
+ QueryWrapper<SiChargeTemp> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.eq("pat_no", p.getInpatientNo());
|
|
|
+ wrapper.eq("times", p.getAdmissTimes());
|
|
|
+ wrapper.eq("ledger_sn", p.getLedgerSn());
|
|
|
if (null == p.getDetailSns() || p.getDetailSns().isEmpty()) {
|
|
|
dao.revokeAllUploadFee(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
+ chrgtmpdao.delete(wrapper);
|
|
|
} else {
|
|
|
+ wrapper.in("detail_sn", p.getDetailSns());
|
|
|
+ chrgtmpdao.delete(wrapper);
|
|
|
dao.revokePartUploadFee(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn(), p.getDetailSns());
|
|
|
}
|
|
|
return ResultVoUtil.success("撤销费用上传成功。");
|
|
@@ -375,7 +389,7 @@ public class SiZyService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<String> revokeDischarge(ZyPatientInfo p) {
|
|
|
- SiPatInfo siPatInfo = queryDao.selectSiPatInfoForZy(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
+ SiPatInfo siPatInfo = qrydao.selectSiPatInfoForZy(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
if (null == siPatInfo) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的医保出院信息,无法撤销出院!");
|
|
|
}
|
|
@@ -423,8 +437,8 @@ public class SiZyService {
|
|
|
setlEntity.setLedgerSn(p.getLedgerSn());
|
|
|
setlEntity.setStaffId(TokenUtil.getTokenUserId());
|
|
|
setlEntity.setRevoked(YesOrNo.NO.getCode());
|
|
|
- setlinfoDao.insert(setlEntity);
|
|
|
- setlinfoDao.updateSiZyInfoSetlId(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn(),
|
|
|
+ setlinfodao.insert(setlEntity);
|
|
|
+ setlinfodao.updateSiZyInfoSetlId(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn(),
|
|
|
setlEntity.getSetlId(), setlEntity.getMedinsSetlId(), input.getString("msgid"));
|
|
|
JSONArray setldetail = result.getJSONObject(OUTPUT).getJSONArray("setldetail");
|
|
|
for (int i = 0; i < setldetail.size(); i++) {
|
|
@@ -432,7 +446,7 @@ public class SiZyService {
|
|
|
setldetailEntity.setPatNo(p.getInpatientNo());
|
|
|
setldetailEntity.setTimes(p.getAdmissTimes());
|
|
|
setldetailEntity.setLedgerSn(p.getLedgerSn());
|
|
|
- setldetailDao.insert(setldetailEntity);
|
|
|
+ setldetldao.insert(setldetailEntity);
|
|
|
}
|
|
|
// todo 结算,需要改造,慢慢删除responceType字段
|
|
|
YbSettleFee settleFee = new YbSettleFee();
|
|
@@ -460,7 +474,7 @@ public class SiZyService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<String> revokeSettlement(ZyPatientInfo p) {
|
|
|
- SiPatInfo siPatInfo = queryDao.selectSiPatInfoForZy(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
+ SiPatInfo siPatInfo = qrydao.selectSiPatInfoForZy(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
if (null == siPatInfo || StringUtil.isBlank(siPatInfo.getSetlId())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的医保结算信息,无法撤销结算!");
|
|
|
}
|