|
@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON;
|
|
|
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;
|
|
|
import org.apache.commons.collections4.ListUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -25,10 +27,9 @@ import thyyxxk.webserver.entity.medicalinsurance.query.SiPatInfo;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.query.SiSetlFeeDetl;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetlinfo;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SlctSetlPrm;
|
|
|
-import thyyxxk.webserver.entity.medicalinsurance.setllistupload.IcuinfoUpld;
|
|
|
-import thyyxxk.webserver.entity.medicalinsurance.setllistupload.IteminfoUpld;
|
|
|
-import thyyxxk.webserver.entity.medicalinsurance.setllistupload.OprninfoUpld;
|
|
|
-import thyyxxk.webserver.entity.medicalinsurance.setllistupload.SetlinfoUpld;
|
|
|
+import thyyxxk.webserver.entity.medicalinsurance.setllistupload.*;
|
|
|
+import thyyxxk.webserver.entity.querydata.JieSuanDanChaXun;
|
|
|
+import thyyxxk.webserver.entity.querydata.TSiSetlinfo;
|
|
|
import thyyxxk.webserver.service.PublicServer;
|
|
|
import thyyxxk.webserver.utils.*;
|
|
|
import thyyxxk.webserver.websocket.WebSocketServer;
|
|
@@ -316,6 +317,46 @@ public class SiManageService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<String> upldSetlList(String patNo, Integer times, Integer ledgerSn) throws Exception {
|
|
|
+ ResultVo<UpldCollection> upldCollection = getUploadInfo(patNo, times, ledgerSn);
|
|
|
+ if (upldCollection.getCode() != 200) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, upldCollection.getMessage());
|
|
|
+ }
|
|
|
+ JSONObject input = new JSONObject();
|
|
|
+ input.put("setlinfo", JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(upldCollection.getData().getSetlinfo(), "yyyy-MM-dd HH:mm:ss")));
|
|
|
+ input.put("payinfo", JSONArray.parseArray(JSONArray.toJSONString(upldCollection.getData().getPayinfo())));
|
|
|
+ input.put("opspdiseinfo", new JSONArray());
|
|
|
+ input.put("diseinfo", JSONArray.parseArray(JSONArray.toJSONString(upldCollection.getData().getDiseinfo())));
|
|
|
+ input.put("iteminfo", JSONArray.parseArray(JSONArray.toJSONString(upldCollection.getData().getIteminfo())));
|
|
|
+ input.put("oprninfo", JSONArray.parseArray(JSONArray.toJSONString(upldCollection.getData().getOprninfo())));
|
|
|
+ input.put("icuinfo", JSONArray.parseArray(JSONArray.toJSONString(upldCollection.getData().getIcuinfo())));
|
|
|
+ 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", "知道你为啥失败吗?");
|
|
|
+// }
|
|
|
+ log.info("医保结算信息上传 \n操作人:{}\n参数:{} \n结果:{}", TokenUtil.getTokenUserId(), jsonObject, result);
|
|
|
+ if (null == result) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
+ if (null == result.getInteger(RESULT_CODE)) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("医保中心报错:【%s】 ", result.getString("message")));
|
|
|
+ }
|
|
|
+ if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
+ upIdCollectionDao.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")));
|
|
|
+ }
|
|
|
+
|
|
|
+ public ResultVo<UpldCollection> getUploadInfo(String patNo, Integer times, Integer ledgerSn) throws Exception {
|
|
|
+ log.info("住院号:{},次数:{},账页:{}", patNo, times, ledgerSn);
|
|
|
SetlinfoUpld setlinfoUpld = upIdCollectionDao.setlinfo1(patNo, times, ledgerSn);
|
|
|
if (StringUtil.isBlank(setlinfoUpld.getSetlId())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "结算id为空");
|
|
@@ -372,7 +413,7 @@ public class SiManageService {
|
|
|
if (null == amtAndOthAmt || amtAndOthAmt.isEmpty()) {
|
|
|
ResultVo<String> chrgitems = getChrgitems(patNo, setlId, setlinfoUpld.getMdtrtId(), setlinfoUpld.getInsuplc());
|
|
|
if (chrgitems.getCode() != 200) {
|
|
|
- return chrgitems;
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, chrgitems.getMessage());
|
|
|
}
|
|
|
}
|
|
|
setlinfoUpld.setSetlBegnDate(setlinfoUpld.getAdmTime());
|
|
@@ -427,48 +468,34 @@ public class SiManageService {
|
|
|
long days = diff / (1000 * 60 * 60 * 24); // 天
|
|
|
long hours = (diff - days * (1000 * 60 * 60 * 24)) / (1000 * 60 * 60); // 小时
|
|
|
long minutes = (diff - days * (1000 * 60 * 60 * 24) - hours * (1000 * 60 * 60)) / (1000 * 60); // 分钟
|
|
|
- String heJi = days + "/" + hours + "/" + minutes;
|
|
|
+ String zhongZhengJianHuShiJian = days + "/" + hours + "/" + minutes;
|
|
|
IcuinfoUpld icuinfoUpld = new IcuinfoUpld();
|
|
|
icuinfoUpld.setScsCutdWardType("1");
|
|
|
icuinfoUpld.setScsCutdInpoolTime(inpoolTime);
|
|
|
icuinfoUpld.setScsCutdExitTime(exitTime);
|
|
|
- icuinfoUpld.setScsCutdSumDura(heJi);
|
|
|
+ icuinfoUpld.setScsCutdSumDura(zhongZhengJianHuShiJian);
|
|
|
zhongZhenJianHu.add(icuinfoUpld);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- JSONObject input = new JSONObject();
|
|
|
- input.put("setlinfo", JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(setlinfoUpld, "yyyy-MM-dd HH:mm:ss")));
|
|
|
- input.put("payinfo", JSONArray.parseArray(JSONArray.toJSONString(upIdCollectionDao.payinfoUpld(patNo, times, ledgerSn))));
|
|
|
- input.put("opspdiseinfo", new JSONArray());
|
|
|
- input.put("diseinfo", JSONArray.parseArray(JSONArray.toJSONString(upIdCollectionDao.diseinfo(patNo, times))));
|
|
|
- input.put("iteminfo", JSONArray.parseArray(JSONArray.toJSONString(amtAndOthAmt)));
|
|
|
- input.put("oprninfo", JSONArray.parseArray(JSONArray.toJSONString(oprninfoUpld)));
|
|
|
- input.put("icuinfo", JSONArray.parseArray(JSONArray.toJSONString(zhongZhenJianHu)));
|
|
|
- JSONObject jsonObject = exec.makeTradeHeaderWithInsureArea(SiFunction.UPLOAD_SI_SETTLE_INFO, setlinfoUpld.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", "知道你为啥失败吗?");
|
|
|
- }
|
|
|
- log.info("医保结算信息上传 \n操作人:{}\n参数:{} \n结果:{}", TokenUtil.getTokenUserId(), jsonObject, result);
|
|
|
- if (null == result) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
- }
|
|
|
- if (null == result.getInteger(RESULT_CODE)) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("医保中心报错:【%s】 ", result.getString("message")));
|
|
|
- }
|
|
|
- if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
- //upIdCollectionDao.fanHuiLiuShuiHao(result.getJSONObject(OUTPUT).getString("setl_list_id"), setlinfoUpld.getSetlId());
|
|
|
- return ResultVoUtil.success(ExceptionEnum.SUCCESS, "上传成功");
|
|
|
- }
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("医保中心报错:【%s】 ", result.getString("err_msg")));
|
|
|
+ List<PayinfoUpld> payinfo = upIdCollectionDao.payinfoUpld(patNo, times, ledgerSn);
|
|
|
+ List<DiseinfoUpld> diseinfos = upIdCollectionDao.diseinfo(patNo, times);
|
|
|
+
|
|
|
+ UpldCollection upldCollection = new UpldCollection();
|
|
|
+ // 患者的基本信息
|
|
|
+ upldCollection.setSetlinfo(setlinfoUpld);
|
|
|
+ // 基金支付信息
|
|
|
+ upldCollection.setPayinfo(payinfo);
|
|
|
+ // 门特慢特病诊断信息 目前还没有
|
|
|
+ // upldCollection.setOpspdiseinfo(new ArrayList<>());
|
|
|
+ // 住院诊断信息
|
|
|
+ upldCollection.setDiseinfo(diseinfos);
|
|
|
+ // 收费项目信息
|
|
|
+ upldCollection.setIteminfo(amtAndOthAmt);
|
|
|
+ // 手术操作信息
|
|
|
+ upldCollection.setOprninfo(oprninfoUpld);
|
|
|
+ // 重症监护信息
|
|
|
+ upldCollection.setIcuinfo(zhongZhenJianHu);
|
|
|
+ return ResultVoUtil.success(upldCollection);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -540,6 +567,12 @@ public class SiManageService {
|
|
|
return (int) (per * 100);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取最大值的下标
|
|
|
+ *
|
|
|
+ * @param arr int 数组
|
|
|
+ * @return 返回下标
|
|
|
+ */
|
|
|
public int getMaxIndex(int[] arr) {
|
|
|
int maxIndex = 0; //获取到的最大值的角标
|
|
|
for (int i = 0; i < arr.length; i++) {
|
|
@@ -551,7 +584,6 @@ public class SiManageService {
|
|
|
}
|
|
|
|
|
|
private ResultVo<String> getChrgitems(String patNo, String setlId, String mdtrtId, String admdvs) {
|
|
|
-
|
|
|
JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.QUERY_FEE_DETAILS, admdvs);
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("psn_no", queryDao.selectPsnNo(patNo));
|
|
@@ -586,4 +618,54 @@ public class SiManageService {
|
|
|
}
|
|
|
return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public ResultVo<IPage<TSiSetlinfo>> huoQuJieSuanRenYuan(JieSuanDanChaXun param) {
|
|
|
+ log.info("参数:{}", JSONObject.toJSONString(param));
|
|
|
+ IPage<TSiSetlinfo> page = new Page<>();
|
|
|
+ page.setRecords(upIdCollectionDao.huoQuJieSuanRenYuan(param.getStartTime(), param.getEndTime(), param.getClrType(), param.getPatNo(),
|
|
|
+ param.getInsutype(), param.getOutDept(), param.getMedType(), param.getPsnType(), param.getCurrentPage(), param.getPageSize()));
|
|
|
+ if (ListUtil.isBlank(page.getRecords())) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
|
|
|
+ }
|
|
|
+ for (TSiSetlinfo item : page.getRecords()) {
|
|
|
+ item.setGendName(item.getGend().equals("1") ? "男" : "女");
|
|
|
+ Admdvs admdvs = Admdvs.get(item.getClrOptins());
|
|
|
+ if (null == admdvs) {
|
|
|
+ item.setClrOptinsName(dao.selectRegion(item.getClrOptins()));
|
|
|
+ } else {
|
|
|
+ item.setClrOptinsName(admdvs.getName());
|
|
|
+ }
|
|
|
+ Insutype insutype = Insutype.get(item.getInsutype());
|
|
|
+ if (null != insutype) {
|
|
|
+ item.setInsutypeName(insutype.getName());
|
|
|
+ }
|
|
|
+ PsnType psnType = PsnType.get(item.getPsnType());
|
|
|
+ if (null != psnType) {
|
|
|
+ item.setPsnTypeName(psnType.getName());
|
|
|
+ }
|
|
|
+ MedType medType = MedType.get(item.getMedType());
|
|
|
+ if (null != medType) {
|
|
|
+ item.setMedTypeName(medType.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (param.getTotal() == 0) {
|
|
|
+ page.setTotal(upIdCollectionDao.huoQuJieSuanRenYuanTotal(param.getStartTime(), param.getEndTime(), param.getClrType(), param.getPatNo(),
|
|
|
+ param.getInsutype(), param.getOutDept(), param.getMedType(), param.getPsnType()));
|
|
|
+ }
|
|
|
+ return ResultVoUtil.success(page);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public ResultVo<List<Object>> getMedType() {
|
|
|
+ JSONArray jsonArray = new JSONArray();
|
|
|
+ for (MedType e : MedType.values()) {
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ object.put("code", e.getCode());
|
|
|
+ object.put("name", e.getName());
|
|
|
+ jsonArray.add(object);
|
|
|
+ }
|
|
|
+ return ResultVoUtil.success(jsonArray);
|
|
|
+ }
|
|
|
+
|
|
|
}
|