chenweida 8 年 前
コミット
c9781c7d00

+ 15 - 4
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

@ -238,11 +238,22 @@ public class StatisticsController extends BaseController {
            }
            }
            //遍历合并2个指标中key值一样的
            //遍历合并2个指标中key值一样的
            for (int i = 0; i < jsonArrays.get(0).length(); i++) {
            for (int i = 0; i < jsonArrays.get(0).length(); i++) {
                for (int j = 0; j < jsonArrays.get(1).length(); j++) {
                if (jsonArrays.get(1).length() == 0) {
                    //未回复咨询不存在的时候默认是0
                    JSONObject map1 = jsonArrays.get(0).getJSONObject(i);
                    JSONObject map1 = jsonArrays.get(0).getJSONObject(i);
                    JSONObject map2 = jsonArrays.get(1).getJSONObject(j);
                    if (map1.get("code").equals(map2.get("code"))) {
                        String amount = map1.get("amount").toString() + "," + map2.get("amount").toString();
                    String amount = map1.get("amount").toString() + ",0";
                    map1.put("amount", amount);
                    returnJa.put(map1);
                } else {
                    for (int j = 0; j < jsonArrays.get(1).length(); j++) {
                        JSONObject map1 = jsonArrays.get(0).getJSONObject(i);
                        JSONObject map2 = jsonArrays.get(1).getJSONObject(j);
                        String amount = "";
                        if (map1.get("code").equals(map2.get("code"))) {
                            amount = map1.get("amount").toString() + "," + map2.get("amount").toString();
                        } else {
                            amount = map1.get("amount").toString() + ",0";
                        }
                        map1.put("amount", amount);
                        map1.put("amount", amount);
                        returnJa.put(map1);
                        returnJa.put(map1);
                    }
                    }