Browse Source

结算单上传

xiaochan 4 years ago
parent
commit
36ac2156e7

+ 1 - 1
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/UpIdCollectionDao.java

@@ -61,7 +61,7 @@ public interface UpIdCollectionDao {
             "        rtrim(employer_tel) as  emp_tel, " +
             "        rtrim(employer_zipcode) as poscode, " +
             "       rtrim(relation_name) as coner_name, " +
-            "       relation_code as  patn_rlts,  " + // TODO: 2021/11/26  这里可能要转成医保的类型
+            "       (select  isnull(rtrim(yb_code),80) from zy_zd_relative_code where code = relation_code)  as  patn_rlts,  " + // 与患者的关系
             "       rtrim(relation_tel) as  coner_tel " + //  联系人电话
             "from a_patient_mi " +
             "where inpatient_no = #{patNo} or mz_no = #{patNo}")

+ 25 - 19
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiManageService.java

@@ -346,11 +346,17 @@ public class SiManageService {
         List<OprninfoUpld> oprninfoUpld = upIdCollectionDao.oprninfoUplds(patNo, times);
 
         if (ListUtil.notBlank(oprninfoUpld)) {
+            // 用来存放最大的手术级别
             int[] zhuYaoShouShu = new int[oprninfoUpld.size()];
             for (int i = 0; i < oprninfoUpld.size(); i++) {
-                zhuYaoShouShu[i] = Integer.parseInt(oprninfoUpld.get(i).getOprnOprtType());
-                oprninfoUpld.get(i).setOprnOprtType("2");
+                String ssjb = oprninfoUpld.get(i).getOprnOprtType();
+                if (ssjb.equals("")) { // 判断手术级别是否为空
+                    ssjb = "1"; // 为空就设置为 1
+                }
+                zhuYaoShouShu[i] = Integer.parseInt(ssjb); // 存放手术级别
+                oprninfoUpld.get(i).setOprnOprtType("2"); //全部设置为 2
             }
+            // 最大的设置为一
             oprninfoUpld.get(getMaxIndex(zhuYaoShouShu)).setOprnOprtType("1");
         }
         // 手术计数
@@ -441,8 +447,15 @@ public class SiManageService {
         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 = 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);
@@ -451,7 +464,7 @@ public class SiManageService {
             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());
+            //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")));
@@ -467,12 +480,6 @@ public class SiManageService {
         if (ListUtil.isBlank(param)) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请选择需要上传的患者。");
         }
-        List<PureCodeName> keys = new ArrayList<>();
-        keys.add(new PureCodeName("patNo", "住院号"));
-        keys.add(new PureCodeName("times", "住院次数"));
-        keys.add(new PureCodeName("ledgerSn", "账页号"));
-        keys.add(new PureCodeName("message", "上传结果"));
-        keys.add(new PureCodeName("type", "错误类型"));
 
         for (int i = 0; i < param.size(); i++) {
             SiPatInfo siPatInfo = param.get(i);
@@ -480,12 +487,12 @@ public class SiManageService {
             try {
                 ResultVo<String> resultVo = upldSetlList(siPatInfo.getPatNo(), siPatInfo.getTimes(), siPatInfo.getLedgerSn());
                 upldSetlErrorMessage(siPatInfo.getPatNo(), siPatInfo.getTimes(), siPatInfo.getLedgerSn(),
-                        resultVo.getMessage(), resultVo.getCode() == 200 ? 1 : 2, percentage, keys);
+                        resultVo.getMessage(), resultVo.getCode() == 200 ? 0 : 1, percentage);
             } catch (Exception e) {
                 log.info("批量上传结算单错误:{}", JSON.toJSONString(e));
                 e.printStackTrace();
                 upldSetlErrorMessage(siPatInfo.getPatNo(), siPatInfo.getTimes(), siPatInfo.getLedgerSn(),
-                        e.getMessage(), 3, percentage, keys);
+                        e.getMessage(), 2, percentage);
             }
         }
         return ResultVoUtil.success();
@@ -512,15 +519,14 @@ public class SiManageService {
      *
      * @param meg 错误消息
      */
-    public void upldSetlErrorMessage(String patNo, Integer times, Integer ledgerSn, String meg, int type, int percentage, List<PureCodeName> keys) {
+    public void upldSetlErrorMessage(String patNo, Integer times, Integer ledgerSn, String meg, int type, int percentage) {
         JSONObject obj = new JSONObject();
         obj.put("name", "upldSetlListMessage");
-        obj.put("message", meg);
-        obj.put("patNo", patNo);
-        obj.put("keys", JSONArray.parseArray(JSONArray.toJSONString(keys)));
-        obj.put("times", times);
-        obj.put("ledgerSn", ledgerSn);
-        obj.put("type", type);
+        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("percentage", percentage);
         obj.put("title", String.format("住院号:【%s】,住院次数:【%d】,账页号:【%d】。", patNo, times, ledgerSn));
         String message = obj.toJSONString();