Browse Source

费用明细以收费项目等级显示

lighter 3 years ago
parent
commit
98e8b0f6be

+ 40 - 17
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiQueryService.java

@@ -452,28 +452,20 @@ public class SiQueryService {
 
     private Map<String, String[]> analyseFeedtle(List<SiSetlFeeDetl> fees) {
         Map<String, String[]> map = new HashMap<>();
-        map.put("zhj", new String[]{"合计", "0.00", "0.00", "0.00"});
+        map.put("zhj", new String[]{"合计", "0.00", "0.00", "0.00", "0.00"});
         fees.forEach(itm -> {
-            if (StringUtil.isBlank(itm.getChrgitmLvName())) {
-                ChrgitmLv chrgitmLv = ChrgitmLv.get(itm.getChrgitmLv());
-                if (null == chrgitmLv) {
-                    chrgitmLv = ChrgitmLv.SELF_PAY;
-                }
+            ChrgitmLv chrgitmLv = ChrgitmLv.get(itm.getChrgitmLv());
+            if (null == chrgitmLv) {
+                chrgitmLv = ChrgitmLv.SELF_PAY;
                 itm.setChrgitmLvName(chrgitmLv.getName());
             }
-
             String[] all = map.get("zhj");
-            all[1] = DecimalUtil.add(all[1], itm.getDetItemFeeSumamt());
-            all[2] = DecimalUtil.add(all[2], itm.getInscpScpAmt());
-            all[3] = DecimalUtil.add(all[3], DecimalUtil.minus(itm.getDetItemFeeSumamt(), itm.getInscpScpAmt()));
-
+            sumChargeFeeByType(itm, chrgitmLv, all);
             if (map.containsKey(itm.getMedChrgitmType())) {
                 String[] dtle = map.get(itm.getMedChrgitmType());
-                dtle[1] = DecimalUtil.add(dtle[1], itm.getDetItemFeeSumamt());
-                dtle[2] = DecimalUtil.add(dtle[2], itm.getInscpScpAmt());
-                dtle[3] = DecimalUtil.add(dtle[3], DecimalUtil.minus(itm.getDetItemFeeSumamt(), itm.getInscpScpAmt()));
+                sumChargeFeeByType(itm, chrgitmLv, dtle);
             } else {
-                String[] dtle = new String[4];
+                String[] dtle = new String[5];
                 MedChrgitmType type = MedChrgitmType.get(itm.getMedChrgitmType());
                 if (type == null) {
                     type = MedChrgitmType.OTH;
@@ -481,8 +473,24 @@ public class SiQueryService {
                 }
                 dtle[0] = type.getName();
                 dtle[1] = itm.getDetItemFeeSumamt();
-                dtle[2] = itm.getInscpScpAmt();
-                dtle[3] = DecimalUtil.minus(itm.getDetItemFeeSumamt(), itm.getInscpScpAmt());
+
+                switch (chrgitmLv) {
+                    case FIRST_CLASS:
+                        dtle[2] = itm.getDetItemFeeSumamt();
+                        dtle[3] = "0.00";
+                        dtle[4] = "0.00";
+                        break;
+                    case SECOND_CLASS:
+                        dtle[3] = itm.getDetItemFeeSumamt();
+                        dtle[2] = "0.00";
+                        dtle[4] = "0.00";
+                        break;
+                    case SELF_PAY:
+                        dtle[4] = itm.getDetItemFeeSumamt();
+                        dtle[3] = "0.00";
+                        dtle[2] = "0.00";
+                        break;
+                }
                 map.put(type.getCode(), dtle);
             }
         });
@@ -496,6 +504,21 @@ public class SiQueryService {
         return map;
     }
 
+    private void sumChargeFeeByType(SiSetlFeeDetl itm, ChrgitmLv chrgitmLv, String[] dtle) {
+        dtle[1] = DecimalUtil.add(dtle[1], itm.getDetItemFeeSumamt());
+        switch (chrgitmLv) {
+            case FIRST_CLASS:
+                dtle[2] = DecimalUtil.add(dtle[2], itm.getDetItemFeeSumamt());
+                break;
+            case SECOND_CLASS:
+                dtle[3] = DecimalUtil.add(dtle[3], itm.getDetItemFeeSumamt());
+                break;
+            case SELF_PAY:
+                dtle[4] = DecimalUtil.add(dtle[4], itm.getDetItemFeeSumamt());
+                break;
+        }
+    }
+
     public ResultVo<List<TrtInfo>> checkPersonTreatment(BscQryPrm q) {
         JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.CHECK_PERSON_TREATMENT, dao.selectAdmdvs(q.getPatNo(), q.getTimes()));
         JSONObject data = new JSONObject();