lighter 5 месяцев назад
Родитель
Сommit
74587593e7

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

@@ -27,6 +27,7 @@ public interface SiChargeLimitDao {
             "from zy_detail_charge " +
             "where inpatient_no=#{patNo} and admiss_times=#{times} " +
             "and ledger_sn=#{ledgerSn} and charge_code_mx=#{currentCode} " +
+            "and isnull(yb_self_flag,'0')!='1' " +
             "order by detail_sn")
     LinkedList<BriefChargeInfo> getChargeInfos(SiLimitRequest request);
 

+ 27 - 17
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiChargeLimitService.java

@@ -22,17 +22,9 @@ public class SiChargeLimitService {
     }
 
     public String analyzeSiChargeLimit(SiLimitRequest request) {
-        if (StringUtil.isBlank(request.getPatNo())) {
-            return "参数错误:住院号不能为空!";
-        }
-        if (null == request.getTimes()) {
-            return "参数错误:住院次数不能为空!";
-        }
-        if (null == request.getLedgerSn()) {
-            return "参数错误:账页号不能为空!";
-        }
-        if (ListUtil.isBlank(request.getChargeList())) {
-            return "参数错误:收费列表不能为空!";
+        String paramsError = checkRequestParams(request);
+        if (null != paramsError) {
+            return paramsError;
         }
         List<ZdChargeLimitation> limitations = dao.getChargeLimitations(request.getChargeList());
         if (limitations.isEmpty()) {
@@ -54,7 +46,9 @@ public class SiChargeLimitService {
             for (BriefChargeInfo charge : tempList) {
                 if (charge.getAmount().compareTo(BigDecimal.ZERO) < 0) {
                     Integer oriSn = getPairedOriSn(chargeList, charge);
-                    if (null != oriSn) {
+                    if (null == oriSn) {
+                        chargeList.remove(charge);
+                    } else {
                         request.setOriSn(oriSn);
                         request.setSn(charge.getSn());
                         dao.updatePairSn(request);
@@ -64,16 +58,16 @@ public class SiChargeLimitService {
                 }
             }
 
-            Map<String, Integer> map = new HashMap<>();
+            List<String> dateList = new ArrayList<>();
             for (BriefChargeInfo charge: chargeList) {
                 String date = charge.getDate();
-                if (!map.containsKey(date)) {
-                    map.put(date, 1);
+                if (!dateList.contains(date)) {
+                    dateList.add(date);
                 }
             }
-            if (map.size() >= limit.getLimitDay()) {
+            if (dateList.size() >= limit.getLimitDay()) {
                 String type = limit.getChargeCode().length() == 5 ? "药品【" : "项目【";
-                String fact = map.size() == limit.getLimitDay() ? "即将超期支付。" : "已经超期支付。";
+                String fact = dateList.size() == limit.getLimitDay() ? "即将超期支付。" : "已经超期支付。";
                 builder.append(type)
                         .append(limit.getChargeName())
                         .append("(")
@@ -90,6 +84,22 @@ public class SiChargeLimitService {
         return builder.toString();
     }
 
+    private String checkRequestParams(SiLimitRequest request) {
+        if (StringUtil.isBlank(request.getPatNo())) {
+            return "参数错误:住院号不能为空!";
+        }
+        if (null == request.getTimes()) {
+            return "参数错误:住院次数不能为空!";
+        }
+        if (null == request.getLedgerSn()) {
+            return "参数错误:账页号不能为空!";
+        }
+        if (ListUtil.isBlank(request.getChargeList())) {
+            return "参数错误:收费列表不能为空!";
+        }
+        return null;
+    }
+
     private Integer getPairedOriSn(LinkedList<BriefChargeInfo> list, BriefChargeInfo charge) {
         for (BriefChargeInfo item : list) {
             BigDecimal sum = item.getAmount().add(charge.getAmount());