|
@@ -10,12 +10,13 @@ import org.springframework.stereotype.Service;
|
|
|
import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.webserver.constants.Capacity;
|
|
|
import thyyxxk.webserver.constants.SiFunction;
|
|
|
-import thyyxxk.webserver.constants.ResponceType;
|
|
|
import thyyxxk.webserver.dao.his.medicalinsurance.SiZyDao;
|
|
|
import thyyxxk.webserver.entity.ResultVo;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.*;
|
|
|
+import thyyxxk.webserver.entity.yibao.dismiss.YbSettleFee;
|
|
|
import thyyxxk.webserver.entity.yibao.patient.Overview;
|
|
|
import thyyxxk.webserver.entity.yibao.patient.ZyInYbDiag;
|
|
|
+import thyyxxk.webserver.service.yibao.DismissService;
|
|
|
import thyyxxk.webserver.service.yibao.SettleService;
|
|
|
import thyyxxk.webserver.utils.*;
|
|
|
import thyyxxk.webserver.websocket.WebSocketServer;
|
|
@@ -47,12 +48,14 @@ public class SiZyService {
|
|
|
private final SiZyDao dao;
|
|
|
private final ExecService exec;
|
|
|
private final SettleService settleService;
|
|
|
+ private final DismissService dismissService;
|
|
|
|
|
|
@Autowired
|
|
|
- public SiZyService(SiZyDao dao, ExecService exec, SettleService settleService) {
|
|
|
+ public SiZyService(SiZyDao dao, ExecService exec, SettleService settleService, DismissService dismissService) {
|
|
|
this.dao = dao;
|
|
|
this.exec = exec;
|
|
|
this.settleService = settleService;
|
|
|
+ this.dismissService = dismissService;
|
|
|
}
|
|
|
|
|
|
public ResultVo<JSONObject> admissRegister(ZyPatientInfo p) {
|
|
@@ -339,7 +342,16 @@ public class SiZyService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
}
|
|
|
|
|
|
- private ResultVo<JSONObject> inpatientSettlement(ZyPatientInfo p) {
|
|
|
+ public ResultVo<String> inpatientSettlement(ZyPatientInfo p) {
|
|
|
+ SiZyInfo siZyInfo = dao.selectSiZyInfo(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
+ if (null == siZyInfo || StringUtil.isBlank(siZyInfo.getMdtrtId())) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的医保在院信息!");
|
|
|
+ }
|
|
|
+ p.setMdtrtId(siZyInfo.getMdtrtId());
|
|
|
+ p.setPsnNo(siZyInfo.getPsnNo());
|
|
|
+ p.setPsnType(siZyInfo.getPsnType());
|
|
|
+ p.setInsuType(siZyInfo.getInsuType());
|
|
|
+ p.setInsuplcAdmdvs(siZyInfo.getInsuplcAdmdvs());
|
|
|
JSONObject input = exec.makeSettleInput(SiFunction.HOSPITALIZATION_SETTLEMENT, p);
|
|
|
JSONObject result = exec.executeTrade(input, SiFunction.HOSPITALIZATION_SETTLEMENT);
|
|
|
log.info("结算:参数:{},结果:{}", input, result);
|
|
@@ -348,19 +360,45 @@ public class SiZyService {
|
|
|
}
|
|
|
if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
JSONObject setlinfo = result.getJSONObject(OUTPUT).getJSONObject("setlinfo");
|
|
|
- // TODO: 2021-06-15 结算ID(setl_id),需要入库
|
|
|
String setlId = setlinfo.getString("setl_id");
|
|
|
- return ResultVoUtil.success(setlinfo);
|
|
|
+ String medinsSetlId = setlinfo.getString("medins_setl_id");
|
|
|
+ dao.updateSiZyInfoSetlId(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn(), setlId, medinsSetlId);
|
|
|
+ // todo 结算
|
|
|
+ YbSettleFee settleFee = new YbSettleFee();
|
|
|
+ if (p.getDismissFlag() == 2) {
|
|
|
+ settleFee.setZjdzDatetime(p.getMidSetlDate());
|
|
|
+ }
|
|
|
+ // todo 慢慢删除responceType字段
|
|
|
+ settleFee.setResponceType("03");
|
|
|
+ settleFee.setFlag(p.getDismissFlag());
|
|
|
+ settleFee.setStaffId(TokenUtil.getTokenUserId());
|
|
|
+ settleFee.setInpatientNo(p.getInpatientNo());
|
|
|
+ settleFee.setAdmissTimes(p.getAdmissTimes());
|
|
|
+ settleFee.setBedNo(p.getBedNo());
|
|
|
+ settleFee.setWardCode(p.getWardCode());
|
|
|
+ settleFee.setDeptCode(p.getDeptCode());
|
|
|
+ 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_part_amt"));
|
|
|
+ settleFee.setTable(p.getTable());
|
|
|
+ return dismissService.doDismiss(settleFee);
|
|
|
}
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
}
|
|
|
|
|
|
- public ResultVo<String> revokeSettlement(GeneralRevoke r) {
|
|
|
+ public ResultVo<String> revokeSettlement(ZyPatientInfo p) {
|
|
|
+ SiZyInfo siZyInfo = dao.selectSiZyInfo(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
+ if (null == siZyInfo || StringUtil.isBlank(siZyInfo.getSetlId())) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的医保结算信息,无法撤销结算!");
|
|
|
+ }
|
|
|
JSONObject input = exec.makeTradeHeader(SiFunction.REVOKE_HOSPITALIZATION_SETTLEMENT);
|
|
|
JSONObject data = new JSONObject();
|
|
|
- data.put("mdtrt_id", r.getMdtrtId());
|
|
|
- data.put("setl_id", r.getSetlId());
|
|
|
- data.put("psn_no", r.getPsnNo());
|
|
|
+ data.put("mdtrt_id", siZyInfo.getMdtrtId());
|
|
|
+ data.put("setl_id", siZyInfo.getSetlId());
|
|
|
+ data.put("psn_no", siZyInfo.getPsnNo());
|
|
|
input.getJSONObject("input").put("data", data);
|
|
|
JSONObject result = exec.executeTrade(input, SiFunction.REVOKE_HOSPITALIZATION_SETTLEMENT);
|
|
|
log.info("【操作员:{}】取消医保结算:参数:{},结果:{}", TokenUtil.getTokenUserId(), input, result);
|
|
@@ -376,7 +414,6 @@ public class SiZyService {
|
|
|
JSONObject dscginfo = new JSONObject();
|
|
|
dscginfo.put("mdtrt_id", p.getMdtrtId());
|
|
|
dscginfo.put("psn_no", p.getPsnNo());
|
|
|
- // TODO: 2021-06-11 insutype:险种类型
|
|
|
dscginfo.put("insutype", p.getInsuType());
|
|
|
dscginfo.put("endtime", DateUtil.formatDatetime(p.getDismissDate()));
|
|
|
dscginfo.put("dscg_dept_codg", p.getDeptCode());
|
|
@@ -390,7 +427,7 @@ public class SiZyService {
|
|
|
diag.put("mdtrt_id", p.getMdtrtId());
|
|
|
diag.put("psn_no", p.getPsnNo());
|
|
|
// TODO: 2021-06-11 诊断类别:1-西医主要诊断 2-西医其他诊断 3-中医主病诊断 4-中医主证诊断
|
|
|
- diag.put("diag_type", "");
|
|
|
+ diag.put("diag_type", item.getDisDiagType());
|
|
|
diag.put("maindiag_flag", item.getDisDiagNo() == 1 ? 1 : 0);
|
|
|
diag.put("diag_srt_no", item.getDisDiagNo());
|
|
|
diag.put("diag_code", item.getDisDiag());
|
|
@@ -407,11 +444,15 @@ public class SiZyService {
|
|
|
return SiUtil.makeReturnWithoutOutput(result, "医保出院办理成功。");
|
|
|
}
|
|
|
|
|
|
- public ResultVo<String> revokeDischarge(GeneralRevoke r) {
|
|
|
+ public ResultVo<String> revokeDischarge(ZyPatientInfo p) {
|
|
|
+ SiZyInfo siZyInfo = dao.selectSiZyInfo(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
|
|
|
+ if (null == siZyInfo || StringUtil.isBlank(siZyInfo.getSetlId())) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的医保出院信息,无法撤销出院!");
|
|
|
+ }
|
|
|
JSONObject input = exec.makeTradeHeader(SiFunction.REVOKE_DISCHARGE);
|
|
|
JSONObject data = new JSONObject();
|
|
|
- data.put("mdtrt_id", r.getMdtrtId());
|
|
|
- data.put("psn_no", r.getPsnNo());
|
|
|
+ data.put("mdtrt_id", siZyInfo.getMdtrtId());
|
|
|
+ data.put("psn_no", siZyInfo.getPsnNo());
|
|
|
input.getJSONObject("input").put("data", data);
|
|
|
JSONObject result = exec.executeTrade(input, SiFunction.REVOKE_DISCHARGE);
|
|
|
return SiUtil.makeReturnWithoutOutput(result, "取消医保出院办理成功。");
|