|
|
@@ -1,5 +1,6 @@
|
|
|
package thyyxxk.webserver.service.medicalinsurance;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
@@ -19,6 +20,7 @@ import thyyxxk.webserver.entity.ResultVo;
|
|
|
import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
|
|
|
import thyyxxk.webserver.entity.dictionary.PureCodeName;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.manage.*;
|
|
|
+import thyyxxk.webserver.entity.medicalinsurance.query.SiPatInfo;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetlinfo;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SlctSetlPrm;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.setllistupload.IcuinfoUpld;
|
|
|
@@ -26,6 +28,7 @@ import thyyxxk.webserver.entity.medicalinsurance.setllistupload.IteminfoUpld;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.setllistupload.SetlinfoUpld;
|
|
|
import thyyxxk.webserver.service.PublicServer;
|
|
|
import thyyxxk.webserver.utils.*;
|
|
|
+import thyyxxk.webserver.websocket.WebSocketServer;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.nio.file.Files;
|
|
|
@@ -308,13 +311,12 @@ public class SiManageService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<JSONObject> upldSetlList(String patNo, Integer times, Integer ledgerSn) throws Exception {
|
|
|
- log.info("入参 住院/门诊:{},次数:{}", patNo, times);
|
|
|
SetlinfoUpld setlinfoUpld = upIdCollectionDao.setlinfo1(patNo, times);
|
|
|
if (StringUtil.isBlank(setlinfoUpld.getSetlId())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "结算id为空");
|
|
|
}
|
|
|
if (!setlinfoUpld.getInsuplc().startsWith("4301") || setlinfoUpld.getInsuplc().equals("430182")) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "该患者参保地不属于长沙市,无法上传结算清单。");
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该患者参保地不属于长沙市,无法上传结算清单。");
|
|
|
}
|
|
|
setlinfoUpld.setFixmedinsName(SiUtil.INSTITUTION_NAME);
|
|
|
// 特级护理
|
|
|
@@ -419,19 +421,77 @@ public class SiManageService {
|
|
|
|
|
|
JSONObject jsonObject = exec.makeTradeHeaderWithInsureArea(SiFunction.UPLOAD_SI_SETTLE_INFO, setlinfoUpld.getInsuplc());
|
|
|
jsonObject.replace("input", input);
|
|
|
-// log.info("查询结算单上传信息:{}", input);
|
|
|
-// return ResultVoUtil.success(input);
|
|
|
JSONObject result = exec.executeTrade(jsonObject, SiFunction.UPLOAD_SI_SETTLE_INFO);
|
|
|
log.info("医保结算信息上传:\n参数:{} \n结果:{}", jsonObject, result);
|
|
|
if (null == result) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
}
|
|
|
if (null == result.getInteger(RESULT_CODE)) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("医保中心报错:【%s】 ", result.getString("message")));
|
|
|
}
|
|
|
if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
- return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "上传成功");
|
|
|
+ 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")));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 多个患者上传
|
|
|
+ *
|
|
|
+ * @param param 患者信息
|
|
|
+ * @return 返回
|
|
|
+ */
|
|
|
+ public ResultVo<String> upldSetlListBatch(List<SiPatInfo> param) {
|
|
|
+ if (ListUtil.isBlank(param)) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请选择需要上传的患者。");
|
|
|
+ }
|
|
|
+ for (SiPatInfo siPatInfo : param) {
|
|
|
+ try {
|
|
|
+ ResultVo<JSONObject> resultVo = upldSetlList(siPatInfo.getPatNo(), siPatInfo.getTimes(), siPatInfo.getLedgerSn());
|
|
|
+ if (resultVo.getCode() != ExceptionEnum.SUCCESS.getCode()) {
|
|
|
+ upldSetlErrorMessage(siPatInfo.getPatNo(), siPatInfo.getTimes(), siPatInfo.getLedgerSn(), resultVo.getMessage());
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("批量上传结算单错误:{}", JSON.toJSONString(e));
|
|
|
+ upldSetlErrorMessage(siPatInfo.getPatNo(), siPatInfo.getTimes(), siPatInfo.getLedgerSn(), e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("err_msg"));
|
|
|
+ return ResultVoUtil.success();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据时间上传
|
|
|
+ *
|
|
|
+ * @param startTime 开始时间
|
|
|
+ * @param endTime 结算时间
|
|
|
+ * @return 返回信息
|
|
|
+ */
|
|
|
+ public ResultVo<String> upldSetlListTimes(String startTime, String endTime) {
|
|
|
+ try {
|
|
|
+ upldSetlListBatch(upIdCollectionDao.getHuanZheXinXi(startTime, endTime));
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("时间范围上传结算单错误:{}", JSON.toJSONString(e));
|
|
|
+ }
|
|
|
+ return ResultVoUtil.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发送医保上传的错误信息
|
|
|
+ *
|
|
|
+ * @param meg 错误消息
|
|
|
+ */
|
|
|
+ public void upldSetlErrorMessage(String patNo, Integer times, Integer ledgerSn, String meg) {
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
+ obj.put("name", "upldSetlListMessage");
|
|
|
+ obj.put("message", meg);
|
|
|
+ obj.put("patNo", patNo);
|
|
|
+ obj.put("times", times);
|
|
|
+ obj.put("ledgerSn", ledgerSn);
|
|
|
+ String message = obj.toJSONString();
|
|
|
+ // 先写死成我的 02896
|
|
|
+ WebSocketServer.sendMessageByUserCode(TokenUtil.getTokenUserId(), message);
|
|
|
+ log.info("发送错误通知:{}", message);
|
|
|
+ }
|
|
|
+
|
|
|
}
|