浏览代码

代码提交

chenweida 8 年之前
父节点
当前提交
7bd9c40393
共有 1 个文件被更改,包括 34 次插入6 次删除
  1. 34 6
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/message/NoticeJob.java

+ 34 - 6
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/message/NoticeJob.java

@ -219,7 +219,7 @@ public class NoticeJob implements Job {
    private void getImMsgAmount(JSONObject obj, String doctor) {
        String urlall = url + "/api/v1/chats/msg/amount?user_id=" + doctor;
        String response = HttpClientUtil.get(url, "UTF-8");
        String response = HttpClientUtil.get(urlall, "UTF-8");
        obj.put("imMsgCount", response);
    }
@ -228,11 +228,39 @@ public class NoticeJob implements Job {
         * {"msg":"获取消息总数成功!","data":{"imMsgCount":"{\"doctor\":0,\"patient\":0}","healthIndex":{"amount":0},"sign":{"amount":0}},"status":200}
         */
        JSONObject jo = findDoctorAllMessage(doctor);
        JSONObject jochildren = jo.getJSONObject("data");
        Integer countAll = jochildren.getJSONObject("imMsgCount").getInt("doctor") +
                jochildren.getJSONObject("imMsgCount").getInt("patient") +
                jochildren.getJSONObject("healthIndex").getInt("amount") +
                jochildren.getJSONObject("sign").getInt("amount");
        Integer countAll = 0;
        Integer doctorCount = 0;
        Integer patientCount = 0;
        Integer healthIndexAmountCount = 0;
        Integer signAmountCount = 0;
        if (jo.has("imMsgCount")) {
            JSONObject imMsgCounnt = jo.getJSONObject("imMsgCount");
            if (imMsgCounnt.has("doctor")) {
                doctorCount = imMsgCounnt.getInt("doctor");
            }
            if (imMsgCounnt.has("patient")) {
                patientCount = imMsgCounnt.getInt("patient");
            }
        }
        if (jo.has("healthIndex")) {
            JSONObject healthIndexCount = jo.getJSONObject("healthIndex");
            if (healthIndexCount.has("amount")) {
                healthIndexAmountCount = healthIndexCount.getInt("amount");
            }
        }
        if (jo.has("sign")) {
            JSONObject signAmountCountJO = jo.getJSONObject("sign");
            if (signAmountCountJO.has("amount")) {
                signAmountCount = signAmountCountJO.getInt("amount");
            }
        }
        if (jo.has("system")) {
            JSONObject signAmountCountJO = jo.getJSONObject("system");
            if (signAmountCountJO.has("amount")) {
                signAmountCount = signAmountCountJO.getInt("amount");
            }
        }
        countAll = doctorCount + patientCount + healthIndexAmountCount + signAmountCount;
        return countAll;
    }
}