فهرست منبع

未关注提醒实现

lyr 8 سال پیش
والد
کامیت
3bb13d8d68

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -329,7 +329,7 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
	 * @param status
	 * @return
	 */
	@Query("select count(f) from SignFamily f where f.adminTeamId = ?1 and status >= ?2 ")
	@Query("select count(f) from SignFamily f where f.adminTeamId = ?1 and f.status >= ?2 ")
	int findByAdminTeamIdAndStatus(long teamCode,int status);
}

+ 171 - 9
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -23,6 +23,7 @@ import org.apache.commons.lang3.StringUtils;
import org.hibernate.type.descriptor.sql.JdbcTypeFamilyInformation;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
@ -173,6 +174,18 @@ public class SignPatientLabelInfoService extends BaseService {
            }
        }
        String epTime = "";
        try {
            epTime = redisTemplate.opsForValue().get("wechat:focus:remind:" + p.getCode());
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (StringUtils.isEmpty(epTime)) {
            json.put("wechatFocusRemind", 0);
        } else {
            json.put("wechatFocusRemind",  new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
        }
        return json;
    }
@ -192,7 +205,7 @@ public class SignPatientLabelInfoService extends BaseService {
            throw new Exception("doctor info can not find");
        }
        Map<String, JSONObject> result = new HashMap<>();
        Map<String, JSONObject> result = new TreeMap<>();
        List<Map<String, Object>> signList = new ArrayList<>();
        int start = page * pagesize;
        String sql = "";
@ -227,7 +240,7 @@ public class SignPatientLabelInfoService extends BaseService {
            } else {
                throw new Exception("label is not exist");
            }
            sql += " order by openid desc ";
            args = new Object[]{doctor, doctor, teamCode};
        } else {
            if (labelCode.equals("0")) {
@ -242,7 +255,7 @@ public class SignPatientLabelInfoService extends BaseService {
                        "    t2.patient is null " +
                        "    AND (t1.doctor = ? or t1.doctor_health = ?) " +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? ";
                        "    AND t1.admin_team_code = ? order by t1.openid desc ";
                args = new Object[]{labelType, doctor, doctor, teamCode};
            } else {
@ -258,7 +271,7 @@ public class SignPatientLabelInfoService extends BaseService {
                        "    AND t1.patient = t2.patient " +
                        "    AND (t1.doctor = ? or t1.doctor_health = ?)" +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? ";
                        "    AND t1.admin_team_code = ? order by t1.openid desc ";
                args = new Object[]{labelCode, labelType, doctor, doctor, teamCode};
            }
@ -302,6 +315,17 @@ public class SignPatientLabelInfoService extends BaseService {
                                jsonP.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                            }
                        }
                        String epTime = "";
                        try {
                            epTime = redisTemplate.opsForValue().get("wechat:focus:remind:" + p.getCode());
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        if (StringUtils.isEmpty(epTime)) {
                            jsonP.put("wechatFocusRemind", 0);
                        } else {
                            jsonP.put("wechatFocusRemind",  new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                        }
                    }
                    continue;
@ -361,6 +385,17 @@ public class SignPatientLabelInfoService extends BaseService {
                    // 缴费情况
                    json.put("expensesStatus", "1");
                }
                String epTime = "";
                try {
                    epTime = redisTemplate.opsForValue().get("wechat:focus:remind:" + p.getCode());
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (StringUtils.isEmpty(epTime)) {
                    json.put("wechatFocusRemind", 0);
                } else {
                    json.put("wechatFocusRemind",  new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                }
                // 患者标签
                //json.put("labels", labels == null ? "" : labels);
@ -434,6 +469,17 @@ public class SignPatientLabelInfoService extends BaseService {
                                jsonP.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                            }
                        }
                        String epTime = "";
                        try {
                            epTime = redisTemplate.opsForValue().get("wechat:focus:remind:" + p.getCode());
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        if (StringUtils.isEmpty(epTime)) {
                            jsonP.put("wechatFocusRemind", 0);
                        } else {
                            jsonP.put("wechatFocusRemind",  new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                        }
                    }
                    continue;
                }
@ -506,6 +552,17 @@ public class SignPatientLabelInfoService extends BaseService {
                    // 缴费情况
                    json.put("expensesStatus", "1");
                }
                String epTime = "";
                try {
                    epTime = redisTemplate.opsForValue().get("wechat:focus:remind:" + p.getCode());
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (StringUtils.isEmpty(epTime)) {
                    json.put("wechatFocusRemind", 0);
                } else {
                    json.put("wechatFocusRemind",  new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                }
                // 患者标签
                json.put("labels", labels == null ? "" : labels);
@ -665,6 +722,23 @@ public class SignPatientLabelInfoService extends BaseService {
        return count;
    }
    /**
     * 获取团队签约人数
     *
     * @param teamCode
     * @return
     * @throws Exception
     */
    public int getPatientFocusAmountByTeam(Long teamCode) throws Exception {
        String sql = "select count(distinct patient) count from wlyy_sign_family where admin_team_code = ? and status > 0 and length(trim(ifnull(openid,''))) > 1";
        List<Map<String, Object>> count = jdbcTemplate.queryForList(sql, new Object[]{teamCode});
        if (count != null && count.size() > 0 && count.get(0).containsKey("count")) {
            return Integer.valueOf(String.valueOf(count.get(0).get("count")));
        } else {
            return 0;
        }
    }
    /**
     * 查询某个标签类型的所有标签居民数统计,或者所有类型
     *
@ -1152,7 +1226,7 @@ public class SignPatientLabelInfoService extends BaseService {
            if (StringUtils.isNotEmpty(labelCode)) {
                args = new Object[]{doctor, doctor, labelCode, labelType, "%" + filter + "%"};
            } else {
                args = new Object[]{doctor, doctor, "%" + filter  + "%"};
                args = new Object[]{doctor, doctor, "%" + filter + "%"};
            }
        } else {
            sql = "select " +
@ -1220,6 +1294,17 @@ public class SignPatientLabelInfoService extends BaseService {
                                jsonP.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                            }
                        }
                        String epTime = "";
                        try {
                            epTime = redisTemplate.opsForValue().get("wechat:focus:remind:" + p.getCode());
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        if (StringUtils.isEmpty(epTime)) {
                            jsonP.put("wechatFocusRemind", 0);
                        } else {
                            jsonP.put("wechatFocusRemind",  new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                        }
                    }
                    continue;
@ -1302,6 +1387,17 @@ public class SignPatientLabelInfoService extends BaseService {
                    // 缴费情况
                    json.put("expensesStatus", "1");
                }
                String epTime = "";
                try {
                    epTime = redisTemplate.opsForValue().get("wechat:focus:remind:" + p.getCode());
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (StringUtils.isEmpty(epTime)) {
                    json.put("wechatFocusRemind", 0);
                } else {
                    json.put("wechatFocusRemind",  new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                }
                // 患者标签
                json.put("labels", labels == null ? "" : labels);
@ -1662,6 +1758,17 @@ public class SignPatientLabelInfoService extends BaseService {
                                jsonP.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                            }
                        }
                        String epTime = "";
                        try {
                            epTime = redisTemplate.opsForValue().get("wechat:focus:remind:" + p.getCode());
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        if (StringUtils.isEmpty(epTime)) {
                            jsonP.put("wechatFocusRemind", 0);
                        } else {
                            jsonP.put("wechatFocusRemind",  new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                        }
                    }
                    continue;
@ -1741,6 +1848,17 @@ public class SignPatientLabelInfoService extends BaseService {
                    // 缴费情况
                    json.put("expensesStatus", "1");
                }
                String epTime = "";
                try {
                    epTime = redisTemplate.opsForValue().get("wechat:focus:remind:" + p.getCode());
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (StringUtils.isEmpty(epTime)) {
                    json.put("wechatFocusRemind", 0);
                } else {
                    json.put("wechatFocusRemind",  new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                }
                // 患者标签
                json.put("labels", labels == null ? "" : labels);
@ -1819,6 +1937,17 @@ public class SignPatientLabelInfoService extends BaseService {
                                jsonP.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                            }
                        }
                        String epTime = "";
                        try {
                            epTime = redisTemplate.opsForValue().get("wechat:focus:remind:" + p.getCode());
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        if (StringUtils.isEmpty(epTime)) {
                            jsonP.put("wechatFocusRemind", 0);
                        } else {
                            jsonP.put("wechatFocusRemind",  new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                        }
                    }
                    continue;
@ -1884,6 +2013,17 @@ public class SignPatientLabelInfoService extends BaseService {
                    // 缴费情况
                    json.put("expensesStatus", "1");
                }
                String epTime = "";
                try {
                    epTime = redisTemplate.opsForValue().get("wechat:focus:remind:" + p.getCode());
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (StringUtils.isEmpty(epTime)) {
                    json.put("wechatFocusRemind", 0);
                } else {
                    json.put("wechatFocusRemind",  new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                }
                // 患者标签
                json.put("labels", labels == null ? "" : labels);
@ -1906,7 +2046,7 @@ public class SignPatientLabelInfoService extends BaseService {
     */
    public JSONArray getPatientByTeamCodeExitDoctor(long teamCode, String labelCode, String labelType, int page, int pagesize) throws Exception {
        Map<String, JSONObject> result = new HashMap<>();
        Map<String, JSONObject> result = new TreeMap<>();
        List<Map<String, Object>> signList = new ArrayList<>();
        int start = page * pagesize;
        String sql = "";
@ -1941,7 +2081,7 @@ public class SignPatientLabelInfoService extends BaseService {
            } else {
                throw new Exception("label is not exist");
            }
            sql += " order by openid desc ";
            args = new Object[]{teamCode};
        } else {
            if (labelCode.equals("0")) {
@ -1955,7 +2095,7 @@ public class SignPatientLabelInfoService extends BaseService {
                        " WHERE " +
                        "    t2.patient is null " +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? ";
                        "    AND t1.admin_team_code = ? order by t1.openid desc ";
                args = new Object[]{teamCode, labelType, teamCode};
            } else {
@ -1970,7 +2110,7 @@ public class SignPatientLabelInfoService extends BaseService {
                        "    AND t2.status = 1 " +
                        "    AND t1.patient = t2.patient " +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? ";
                        "    AND t1.admin_team_code = ? order by t1.openid desc ";
                args = new Object[]{labelCode, labelType, teamCode};
            }
@ -2015,6 +2155,17 @@ public class SignPatientLabelInfoService extends BaseService {
                                jsonP.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                            }
                        }
                        String epTime = "";
                        try {
                            epTime = redisTemplate.opsForValue().get("wechat:focus:remind:" + p.getCode());
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        if (StringUtils.isEmpty(epTime)) {
                            jsonP.put("wechatFocusRemind", 0);
                        } else {
                            jsonP.put("wechatFocusRemind",  new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                        }
                    }
                    continue;
@ -2074,6 +2225,17 @@ public class SignPatientLabelInfoService extends BaseService {
                    // 缴费情况
                    json.put("expensesStatus", "1");
                }
                String epTime = "";
                try {
                    epTime = redisTemplate.opsForValue().get("wechat:focus:remind:" + p.getCode());
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (StringUtils.isEmpty(epTime)) {
                    json.put("wechatFocusRemind", 0);
                } else {
                    json.put("wechatFocusRemind",  new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                }
                // 患者标签
                //json.put("labels", labels == null ? "" : labels);

+ 17 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -2020,6 +2020,23 @@ public class FamilyContractService extends BaseService {
        return signFamilyDao.findNoHealthSignFamilyNum(teamCode);
    }
    /**
     * 获取未分配健管师关注公众号人数
     *
     * @param teamCode
     * @return
     * @throws Exception
     */
    public int findNoHealthSignFamilyFocusNum(Long teamCode) throws Exception {
        String sql = "select count(distinct patient) count from wlyy_sign_family where admin_team_code = ? and doctor_health is null and status > 0 and length(trim(ifnull(openid,''))) > 1";
        List<Map<String, Object>> count = jdbcTemplate.queryForList(sql, new Object[]{teamCode});
        if (count != null && count.size() > 0 && count.get(0).containsKey("count")) {
            return Integer.valueOf(String.valueOf(count.get(0).get("count")));
        } else {
            return 0;
        }
    }
    /**
     * 判断居民与医生是否存在签约关系
     *

+ 2 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java

@ -201,7 +201,8 @@ public class SignPatientLabelInfoController extends BaseController {
    public String getAmountByTeam(@RequestParam(required = true) Long teamCode) {
        try {
            int result = labelInfoService.getPatientAmountByTeam(teamCode);
            return write(200, "查询成功", "data", result);
            int resultFocus =labelInfoService.getPatientFocusAmountByTeam(teamCode);
            return write(200, "查询成功", "data", resultFocus + "/" + result);
        } catch (Exception e) {
            return error(-1, "查询失败");
        }

+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java

@ -880,12 +880,15 @@ public class DoctorFamilyContractController extends WeixinBaseController {
    public String findNoHealthSignFamilyNum(long teamCode) {
        try {
            List<SignFamily> signFamily = familyContractService.findNoHealthSignFamilyNum(teamCode);
            int count = familyContractService.findNoHealthSignFamilyFocusNum(teamCode);
            JSONObject jo = new JSONObject();
            if (signFamily != null && signFamily.size() > 0) {
                jo.put("date", DateUtil.dateToStr(signFamily.get(0).getCzrq(), "yyyy-MM-dd"));
                jo.put("num", signFamily.size());
                jo.put("focusNum",count);
            } else {
                jo.put("num", 0);
                jo.put("focusNum",0);
            }
            return write(200, "查询成功", "data", jo);
        } catch (Exception e) {

+ 13 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java

@ -268,6 +268,19 @@ public class DoctorSignController extends BaseController {
                            json.put("expensesRemindStatus", df.format(new Date()).equals(epTime) ? 1 : 0);
                        }
                    }
                    if (status == 3) {
                        String epTime = "";
                        try {
                            epTime = redisTemplate.opsForValue().get("wechat:focus:remind:" + temp.get("patient"));
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        if (StringUtils.isEmpty(epTime)) {
                            json.put("wechatFocusRemind", 0);
                        } else {
                            json.put("wechatFocusRemind", df.format(new Date()).equals(epTime) ? 1 : 0);
                        }
                    }
                    jsonArray.add(json);
                }
            }