lighter 1 년 전
부모
커밋
a4a6970880
1개의 변경된 파일18개의 추가작업 그리고 19개의 파일을 삭제
  1. 18 19
      src/main/java/thyyxxk/simzfeeoprnsystm/service/SiMzFeeService.java

+ 18 - 19
src/main/java/thyyxxk/simzfeeoprnsystm/service/SiMzFeeService.java

@@ -482,7 +482,6 @@ public class SiMzFeeService {
             setlEntity.setBegntime(mzDao.selectBegntime(p.getPatNo(), p.getTimes()));
             setlEntity.setEndtime(setlEntity.getSetlTime());
             setlEntity.setMzSaved(p.getSaved());
-
             BigDecimal hospitalPart = BigDecimal.ZERO;
             JSONArray setldetail = result.getJSONObject(OUTPUT).getJSONArray("setldetail");
             for (int i = 0; i < setldetail.size(); i++) {
@@ -500,8 +499,17 @@ public class SiMzFeeService {
             setlinfoDao.insert(setlEntity);
             setlinfoDao.updateSiZyInfoSetlId(p.getPatNo(), p.getTimes(), 0, setlEntity.getSetlId(),
                     setlEntity.getMedinsSetlId(), input.getString("msgid"));
-
             webHisService.saveCumInfo(webHisUrl, setlEntity);
+
+            if (BigDecimal.ZERO.compareTo(BigDecimal.valueOf(setlEntity.getPsnCashPay())) == 0) {
+                ResultVo<String> mzChargeResponse = mzChargeFee(p.getPatNo(), p.getTimes(),
+                        String.valueOf(setlEntity.getMedfeeSumamt()));
+                if (mzChargeResponse.getCode() != ExceptionEnum.SUCCESS.getCode()) {
+                    revokeOutpatientSettlementForTask(setlEntity);
+                    return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, mzChargeResponse.getMessage());
+                }
+            }
+
             return getFundDetailFromSetlinfo(setlEntity);
         }
         return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
@@ -521,9 +529,11 @@ public class SiMzFeeService {
         }
 
         String staffDept = mzDao.selectStaffDepartment(p.getStaffId());
-        if (!Objects.equals(staffDept, "3020100")) {
+        if (!Objects.equals(staffDept, "3020100") &&
+                !Objects.equals(staffDept, "3060000") &&
+                !Objects.equals(staffDept, "3100000")) {
             if (!Objects.equals(p.getStaffId(), setlinfo.getStaffId())) {
-                return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, "您没有权限撤销本条医保业务,请联系医保科处理。");
+                return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, "您没有权限撤销本条医保业务,请到收费窗口退处方,或者联系医保科处理。");
             }
         }
 
@@ -717,19 +727,7 @@ public class SiMzFeeService {
         }
         // 上传完成之后结算并返回结算结果
         mzptnt.setReadCardBizType(ReadCardBizType.SETTLEMENT.getCode());
-        ResultVo<FundDetail> settlementResponse = outpatientSettlement(mzptnt);
-        if (settlementResponse.getCode() != ExceptionEnum.SUCCESS.getCode()) {
-            return settlementResponse;
-        }
-        String cashPay = settlementResponse.getData().getCashPay();
-        if (BigDecimal.ZERO.compareTo(new BigDecimal(cashPay)) == 0) {
-            ResultVo<String> mzChargeResponse = mzChargeFee(param.getPatientId(), param.getTimes(), settlementResponse.getData().getTotalCost());
-            if (mzChargeResponse.getCode() != ExceptionEnum.SUCCESS.getCode()) {
-                revokeOutpatientSettlementForTask(settlementResponse.getData().getSetlinfo());
-                return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, mzChargeResponse.getMessage());
-            }
-        }
-        return settlementResponse;
+        return outpatientSettlement(mzptnt);
     }
 
     private ResultVo<String> mzChargeFee(String patientId, int times, String totalFee) {
@@ -740,7 +738,8 @@ public class SiMzFeeService {
         int tryTimes = 1;
         JSONObject response = webHisService.mzChargeFee(params);
         log.info("第{}次保存处方:\n参数:{}\n结果:{}", tryTimes, params, response);
-        while ((null == response || 0 != response.getInteger("code")) && tryTimes < 5) {
+        while (0 != response.getInteger("code") && tryTimes < 5
+                && !response.getString("message").contains("已经收费")) {
             try {
                 tryTimes += 1;
                 response = webHisService.mzChargeFee(params);
@@ -750,7 +749,7 @@ public class SiMzFeeService {
                 log.error("TIMEUNIT SLEEP ERROR", e);
             }
         }
-        if (null == response || 0 != response.getInteger("code")) {
+        if (0 != response.getInteger("code") && !response.getString("message").contains("已经收费")) {
             return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR, "自动保存处方失败,将为您撤销门诊医保业务。");
         }
         return ResultVoUtil.success();