Browse Source

Merge branch 'dev' of chenweida/patient-co-management into dev

chenweida 8 years ago
parent
commit
e1b5691d1d

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

@ -72,6 +72,7 @@ public class NoticeJob implements Job {
                //判断医生是不是在工作时间内
                String noticeContent1 = " 您当前有[zxsize]条未处理消息,其中有[qysize]条签约消息。请尽快处理~";
                String noticeContent2 = " 您当前有[zxsize]条未处理消息,请尽快处理~";
                String noticeContent3 = " 您当前有[qysize]条签约消息,请尽快处理~";
                if ("1".equals(doctorWorkTimeService.isDoctorWorking(doctor.getCode(), -1).get("status"))) {
                    //得到医生多少条咨询消息
                    Integer zxsize = getDoctorMesssageCount(doctor.getCode(), 1);
@ -80,8 +81,8 @@ public class NoticeJob implements Job {
                    //如果既有签约又有咨询
                    if (zxsize > 0 && qysize > 0) {
                        JSONObject jo = new JSONObject();
                        noticeContent1.replace("[zxsize]", zxsize + "");
                        noticeContent1.replace("[qysize]", qysize + "");
                        noticeContent1 = noticeContent1.replace("[zxsize]", zxsize + "");
                        noticeContent1 = noticeContent1.replace("[qysize]", qysize + "");
                        jo.put("content", noticeContent1);
                        jo.put("level", doctor.getLevel());
                        maps.put(doctor.getCode(), jo);
@ -89,11 +90,19 @@ public class NoticeJob implements Job {
                    //只有咨询
                    if (zxsize > 0 && qysize == 0) {
                        JSONObject jo = new JSONObject();
                        noticeContent2.replace("[zxsize]", zxsize + "");
                        noticeContent2 = noticeContent2.replace("[zxsize]", zxsize + "");
                        jo.put("content", noticeContent2);
                        jo.put("level", doctor.getLevel());
                        maps.put(doctor.getCode(), jo);
                    }
                    //只有咨询
                    if (zxsize == 0 && qysize > 0) {
                        JSONObject jo = new JSONObject();
                        noticeContent3 = noticeContent3.replace("[qysize]", qysize + "");
                        jo.put("content", noticeContent3);
                        jo.put("level", doctor.getLevel());
                        maps.put(doctor.getCode(), jo);
                    }
                }
            }
            JSONArray jsonArray = new JSONArray();
@ -160,7 +169,7 @@ public class NoticeJob implements Job {
                return getImMsgAmount(doctorCode);
            }
            case 2: {
                String sql = "select count(a.id) from wlyy_message a where a.type =1 and a.readonly=1 and a.receiver=?";
                String sql = "select count(a.id) from wlyy_message a where a.type =1 and a.has_read=1 and a.receiver=?";
                return jdbcTemplate.queryForObject(sql, Integer.class, doctorCode);
            }
        }
@ -219,7 +228,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 +237,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;
    }
}