|
@@ -3,11 +3,13 @@ package thyyxxk.webserver.service.medicalinsurance;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.ListUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.webserver.constants.GetDateFormat;
|
|
|
import thyyxxk.webserver.constants.sidicts.*;
|
|
@@ -17,6 +19,9 @@ import thyyxxk.webserver.dao.his.yibao.DismissDao;
|
|
|
import thyyxxk.webserver.entity.ResultVo;
|
|
|
import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
|
|
|
import thyyxxk.webserver.entity.datamodify.TYbSetModifyTime;
|
|
|
+import thyyxxk.webserver.entity.datamodify.TYbSetlModifyReq;
|
|
|
+import thyyxxk.webserver.entity.medicalinsurance.inpatient.BatjBa4;
|
|
|
+import thyyxxk.webserver.entity.medicalinsurance.inpatient.YbZyDisDiag;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.inpatient.ZyDisDiagYb;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.inpatient.ZyInactpatient;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.query.SiSetlFeeDetl;
|
|
@@ -28,7 +33,6 @@ import thyyxxk.webserver.utils.*;
|
|
|
import thyyxxk.webserver.websocket.WebSocketServer;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -77,15 +81,15 @@ public class SetlListUpldService {
|
|
|
JSONObject jsonObject = exec.makeTradeHeaderWithInsureArea(SiFunction.UPLOAD_SI_SETTLE_INFO, upldCollection.getData().getSetlinfo().getInsuplc());
|
|
|
jsonObject.replace("input", input);
|
|
|
// 这里是上传
|
|
|
- JSONObject result = exec.executeTrade(jsonObject, SiFunction.UPLOAD_SI_SETTLE_INFO);
|
|
|
-
|
|
|
-// JSONObject result = new JSONObject();
|
|
|
-// if (times % 2 == 0) {
|
|
|
-// result.put("infcode", 0);
|
|
|
-// } else {
|
|
|
-// result.put("infcode", -1);
|
|
|
-// result.put("err_msg", "知道你为啥失败吗?");
|
|
|
-// }
|
|
|
+// JSONObject result = exec.executeTrade(jsonObject, SiFunction.UPLOAD_SI_SETTLE_INFO);
|
|
|
+
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ if (times % 2 == 0) {
|
|
|
+ result.put("infcode", 0);
|
|
|
+ } else {
|
|
|
+ result.put("infcode", -1);
|
|
|
+ result.put("err_msg", "知道你为啥失败吗?");
|
|
|
+ }
|
|
|
log.info("医保结算信息上传 \n操作人:{}\n参数:{} \n结果:{}", TokenUtil.getTokenUserId(), jsonObject, result);
|
|
|
if (null == result) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
@@ -94,7 +98,7 @@ public class SetlListUpldService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("医保中心报错:【%s】 ", result.getString("message")));
|
|
|
}
|
|
|
if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
- dao.fanHuiLiuShuiHao(result.getJSONObject(OUTPUT).getString("setl_list_id"), upldCollection.getData().getSetlinfo().getSetlId());
|
|
|
+// dao.fanHuiLiuShuiHao(result.getJSONObject(OUTPUT).getString("setl_list_id"), upldCollection.getData().getSetlinfo().getSetlId());
|
|
|
return ResultVoUtil.success(ExceptionEnum.SUCCESS, "上传成功");
|
|
|
}
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("医保中心报错:【%s】 ", result.getString("err_msg")));
|
|
@@ -257,12 +261,13 @@ public class SetlListUpldService {
|
|
|
try {
|
|
|
ResultVo<String> resultVo = upldSetlList(siPatInfo.getPatNo(), siPatInfo.getTimes(), siPatInfo.getLedgerSn());
|
|
|
upldSetlErrorMessage(siPatInfo.getPatNo(), siPatInfo.getTimes(), siPatInfo.getLedgerSn(),
|
|
|
- resultVo.getMessage(), resultVo.getCode() == 200 ? 0 : 1, percentage);
|
|
|
+ resultVo.getMessage(), resultVo.getCode() == 200 ? 0 : 1, percentage, siPatInfo.getOutDeptName(),
|
|
|
+ siPatInfo.getPsnName(), siPatInfo.getReferPhysicianName());
|
|
|
} catch (Exception e) {
|
|
|
log.info("批量上传结算单错误:{}", JSON.toJSONString(e));
|
|
|
e.printStackTrace();
|
|
|
upldSetlErrorMessage(siPatInfo.getPatNo(), siPatInfo.getTimes(), siPatInfo.getLedgerSn(),
|
|
|
- e.getMessage(), 2, percentage);
|
|
|
+ e.getMessage(), 2, percentage, siPatInfo.getOutDeptName(), siPatInfo.getPsnName(), siPatInfo.getReferPhysicianName());
|
|
|
}
|
|
|
}
|
|
|
return ResultVoUtil.success();
|
|
@@ -293,14 +298,18 @@ public class SetlListUpldService {
|
|
|
*
|
|
|
* @param meg 错误消息
|
|
|
*/
|
|
|
- public void upldSetlErrorMessage(String patNo, Integer times, Integer ledgerSn, String meg, int type, int percentage) {
|
|
|
+ public void upldSetlErrorMessage(String patNo, Integer times, Integer ledgerSn, String meg,
|
|
|
+ int type, int percentage, String outDeptName, String psnName, String referPhysicianName) {
|
|
|
JSONObject obj = new JSONObject();
|
|
|
obj.put("name", "upldSetlListMessage");
|
|
|
- obj.put("patNo#住院号|1", patNo);
|
|
|
- obj.put("times#住院次数|2", times);
|
|
|
- obj.put("ledgerSn#账页号|3", ledgerSn);
|
|
|
- obj.put("message#上传结果|4", meg);
|
|
|
- obj.put("type#类型|5", type);
|
|
|
+ obj.put("psnName#患者姓名|1", psnName);
|
|
|
+ obj.put("patNo#住院号|2", patNo);
|
|
|
+ obj.put("times#住院次数|3", times);
|
|
|
+ obj.put("ledgerSn#账页号|4", ledgerSn);
|
|
|
+ obj.put("message#上传结果|5", meg);
|
|
|
+ obj.put("outDeptName#出院科室|6", outDeptName);
|
|
|
+ obj.put("referPhysicianName#管床医生|7", referPhysicianName);
|
|
|
+ obj.put("type#类型|8", type);
|
|
|
obj.put("percentage", percentage);
|
|
|
obj.put("title", String.format("住院号:【%s】,住院次数:【%d】,账页号:【%d】。", patNo, times, ledgerSn));
|
|
|
String message = obj.toJSONString();
|
|
@@ -375,7 +384,8 @@ public class SetlListUpldService {
|
|
|
public ResultVo<IPage<SiSetlinfoTemp>> huoQuJieSuanRenYuan(JieSuanDanChaXun param) {
|
|
|
IPage<SiSetlinfoTemp> page = new Page<>();
|
|
|
page.setRecords(dao.huoQuJieSuanRenYuan(param.getStartTime(), param.getEndTime(), param.getClrType(), param.getPatNo(),
|
|
|
- param.getInsutype(), param.getOutDept(), param.getMedType(), param.getPsnType(), param.getClrOptins(), param.getFlag(), param.getReferPhysician(), param.getCurrentPage(),
|
|
|
+ param.getInsutype(), param.getOutDept(), param.getMedType(), param.getPsnType(), param.getClrOptins(), param.getFlag(),
|
|
|
+ param.getReferPhysician(), param.getAuditFlag(), param.getCurrentPage(),
|
|
|
param.getPageSize()));
|
|
|
if (ListUtil.isBlank(page.getRecords())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
|
|
@@ -413,7 +423,8 @@ public class SetlListUpldService {
|
|
|
}
|
|
|
if (param.getTotal() == 0) {
|
|
|
page.setTotal(dao.huoQuJieSuanRenYuanTotal(param.getStartTime(), param.getEndTime(), param.getClrType(), param.getPatNo(),
|
|
|
- param.getInsutype(), param.getOutDept(), param.getMedType(), param.getPsnType(), param.getClrOptins(), param.getFlag(), param.getReferPhysician()));
|
|
|
+ param.getInsutype(), param.getOutDept(), param.getMedType(), param.getPsnType(), param.getClrOptins(), param.getFlag(),
|
|
|
+ param.getReferPhysician(), param.getAuditFlag()));
|
|
|
}
|
|
|
return ResultVoUtil.success(page);
|
|
|
}
|
|
@@ -445,7 +456,7 @@ public class SetlListUpldService {
|
|
|
param.setCurrentPage(1);
|
|
|
log.info("医保结算单: {}", JSON.toJSONStringWithDateFormat(param, GetDateFormat.DATE));
|
|
|
List<SiSetlinfoTemp> list = huoQuJieSuanRenYuan(param).getData().getRecords();
|
|
|
- String[] title = {"姓名", "出院科室", "住院号/门诊号", "性别", "住院天数", "诊断编码", "诊断名称", "治疗方式", "总费用", "报销金额", "险种类型", "人员类别", "结算时间", "医疗类别", "清算机构"};
|
|
|
+ String[] title = {"姓名", "出院科室", "住院号/门诊号", "性别", "住院天数", "诊断编码", "诊断名称", "治疗方式", "总费用", "报销金额", "险种类型", "人员类别", "结算时间", "医疗类别", "清算机构", "管床医生"};
|
|
|
String[][] content = new String[list.size()][];
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
content[i] = new String[title.length];
|
|
@@ -465,6 +476,7 @@ public class SetlListUpldService {
|
|
|
content[i][12] = DateUtil.formatDatetime(pojo.getSetlTime(), GetDateFormat.DATE_TIME);
|
|
|
content[i][13] = pojo.getMedTypeName();
|
|
|
content[i][14] = pojo.getClrOptinsName();
|
|
|
+ content[i][15] = pojo.getReferPhysicianName();
|
|
|
}
|
|
|
//传三个参数 一个是 固定的 response ,excel的头部信息,excel的内容
|
|
|
ExcelUtil.exportExcel(response, title, content);
|
|
@@ -479,15 +491,10 @@ public class SetlListUpldService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该患者参保地不属于长沙市,无法上传结算清单。");
|
|
|
}
|
|
|
ZyInactpatient zy = dao.huanZheXinXi(patNo, times);
|
|
|
- String[] strNow1 = new SimpleDateFormat("yyyy-MM").format(setlinfoUpld.getSetlEndDate()).split("-");
|
|
|
- String[] strNow2 = new SimpleDateFormat("yyyy-MM").format(new Date()).split("-");
|
|
|
List<Integer> code = publicServer.getRoleCode().getData();
|
|
|
if (!code.contains(1) && !code.contains(8)) {
|
|
|
- if (!strNow1[0].equals(strNow2[0])) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "当前年份和患者的结算年份不一致。");
|
|
|
- }
|
|
|
- if (!strNow1[1].equals(strNow2[1])) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "当前月份和患者的结算月份不一致。");
|
|
|
+ if (zy.getReferPhysician() == null || !zy.getReferPhysician().equals(TokenUtil.getTokenUserId())) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您不是该患者的管床医生。");
|
|
|
}
|
|
|
TYbSetModifyTime modifyTime = dao.keXiuGaiShiJian();
|
|
|
if (!DateUtil.isEffectiveDate(new Date(), modifyTime.getStartTime(), modifyTime.getEndTime())) {
|
|
@@ -500,10 +507,12 @@ public class SetlListUpldService {
|
|
|
if (zy == null) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "未查询到患者信息。");
|
|
|
}
|
|
|
- // 手术
|
|
|
- zy.setBatjBa4(dao.shouShuXinXi(patNo, times));
|
|
|
+ // 新老一起查
|
|
|
+ zy.setBatjBa4(dao.shouShuXinXi(patNo, times, "batj_ba4"));
|
|
|
+ zy.setNewBatjBa4(dao.shouShuXinXi(patNo, times, "batj_ba4_modify"));
|
|
|
// 诊断编码
|
|
|
- zy.setYbZyDisDiag(dao.zhenDuanXinXi(patNo, times));
|
|
|
+ zy.setYbZyDisDiag(dao.zhenDuanXinXi(patNo, times, "zy_dis_diag_yb"));
|
|
|
+ zy.setNewYbZyDisDiag(dao.zhenDuanXinXi(patNo, times, "zy_dis_diag_yb_modify"));
|
|
|
return ResultVoUtil.success(zy);
|
|
|
}
|
|
|
|
|
@@ -514,4 +523,134 @@ public class SetlListUpldService {
|
|
|
return ResultVoUtil.success(page);
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @DS("dev")
|
|
|
+ public ResultVo<String> setlModifyReq(ZyInactpatient param) {
|
|
|
+ log.info("申请入参:{}", JSONObject.toJSONStringWithDateFormat(param, DateUtil.DEFAULT_PATTERN));
|
|
|
+ param.setLedgerSn(publicServer.getLedgerSn(param.getInpatientNo(), param.getAdmissTimes()));
|
|
|
+ Set<String> zhenDuanBianMa = new HashSet<>();
|
|
|
+ Set<String> shouShuBianMa = new HashSet<>();
|
|
|
+ for (YbZyDisDiag item : param.getYbZyDisDiag()) {
|
|
|
+ zhenDuanBianMa.add(item.getDisDiag());
|
|
|
+ if (item.getNewData()) {
|
|
|
+ item.setInpatientNo(param.getInpatientNo());
|
|
|
+ item.setAdmissTimes(param.getAdmissTimes());
|
|
|
+ item.setOpDiagDate(new Date());
|
|
|
+ item.setOpIdCode(param.getOpIdCode());
|
|
|
+ } else {
|
|
|
+ if (StringUtil.isBlank(item.getDisDiagStatus()) || item.getDisDiagStatus().trim().equals("0")) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("诊断为【%s】请填写出院病情,出院病情不能为 0 。", item.getDisDiagComment()));
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(item.getDisDiag())) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请填写诊断。");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ int ssxh = 0;
|
|
|
+ for (BatjBa4 item : param.getBatjBa4()) {
|
|
|
+ shouShuBianMa.add(item.getSsbm());
|
|
|
+ item.setZyh(param.getInpatientNo());
|
|
|
+ item.setZycs(param.getAdmissTimes());
|
|
|
+ item.setSsxh(ssxh + 1);
|
|
|
+ if (!item.getNewData()) {
|
|
|
+ if (item.getSsrq() == null) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "手术日期不能为空。");
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(item.getSsys())) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "手术医生不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(item.getSsmc())) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "手术名称不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(item.getSsjb())) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "手术级别不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(item.getSsbm())) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "手术编码不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(item.getSszs1())) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "手术助手至少有一个不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(item.getQkjb()) || StringUtil.isBlank(item.getYhqk())) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "切口愈合等级不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(item.getMzys())) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "麻醉医生不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(item.getMzff())) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "麻醉方法不能为空");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (param.getYbZyDisDiag().size() != zhenDuanBianMa.size()) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "不可以有相同的诊断。");
|
|
|
+ }
|
|
|
+ if (param.getBatjBa4().size() != shouShuBianMa.size()) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "不可以有相同的手术编码。");
|
|
|
+ }
|
|
|
+ dao.delReq(param.getInpatientNo(), param.getAdmissTimes());
|
|
|
+ dao.setlModifyReq(param);
|
|
|
+ dao.setlModDis(param.getYbZyDisDiag(), "zy_dis_diag_yb_modify");
|
|
|
+ dao.setlModBat(param.getBatjBa4(), "batj_ba4_modify");
|
|
|
+ dao.shenBao(param.getOperation(), param.getDecType(), param.getInpatientNo(), param.getAdmissTimes());
|
|
|
+ return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "申请成功,请等待医保科审核。");
|
|
|
+ }
|
|
|
+
|
|
|
+ @DS("dev")
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public ResultVo<String> setlUploadAudit(Integer id, Integer auditFlag, String remark, String auditStaff, String auditName) {
|
|
|
+ TYbSetlModifyReq req = dao.shenHeXinXi(id);
|
|
|
+ if (req == null) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有找到对应的信息,可能医生重新提交了,请刷新页面后重试。");
|
|
|
+ } else if (req.getAuditFlag() != 0) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR,
|
|
|
+ String.format("该数据已被审核<br>审核人:【%s】<br>审核日期:【%s】"
|
|
|
+ , req.getAuditName(), DateUtil.formatDatetime(req.getAuditDate())));
|
|
|
+ }
|
|
|
+ dao.upAuditFlag(id, 3);
|
|
|
+ if (auditFlag == 1) {
|
|
|
+ // 审核通过需要 删除 并更新
|
|
|
+ dao.delYuanShuJu(req.getPatNo(), req.getTimes());
|
|
|
+ dao.auditTongGuo(req.getPatNo(), req.getTimes());
|
|
|
+ dao.updateReq(id, remark, auditStaff, auditName);
|
|
|
+ return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "审核已通过 (*^▽^*)");
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(remark)) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "驳回信息不能为空。");
|
|
|
+ }
|
|
|
+ dao.upAuditFlag(id, auditFlag);
|
|
|
+ return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "审核已驳回 (╯﹏╰)b");
|
|
|
+ }
|
|
|
+
|
|
|
+ public ResultVo<TYbSetModifyTime> xianZhiShiJian() {
|
|
|
+ return ResultVoUtil.success(dao.xianZhiShiJian());
|
|
|
+ }
|
|
|
+
|
|
|
+ public ResultVo<String> sheZhiShiJian(String startTime, String endTime, String opId) {
|
|
|
+ dao.sheZhiShiJian(startTime, endTime, opId);
|
|
|
+ return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "设置成功 (o゚▽゚)o ");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取患者的科室费用
|
|
|
+ *
|
|
|
+ * @param patNo 住院号
|
|
|
+ * @param times 住院次数
|
|
|
+ * @return 返回费用
|
|
|
+ */
|
|
|
+ public ResultVo<List<Map<String, String>>> getHuanZheFeiYong(String patNo, Integer times) {
|
|
|
+ return ResultVoUtil.success(dao.getHuanZheFeiYong(patNo, times));
|
|
|
+ }
|
|
|
+
|
|
|
+ public ResultVo<String> xiuGaiGuanChuangYiShen(String patNo, Integer times, String code) {
|
|
|
+ if (StringUtil.isBlank(patNo) || times == null || times == 0) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "住院号或住院次数为空。");
|
|
|
+ } else if (StringUtil.isBlank(code)) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "管床医生不能设置为空。");
|
|
|
+ }
|
|
|
+ dao.xiuGaiGuanChaungYiShen(patNo, times, code);
|
|
|
+ return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "管床医生修改成功。");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|