Bladeren bron

根据标签获取居民数量 sql优化

zdm 6 jaren geleden
bovenliggende
commit
5c7645aba8
1 gewijzigde bestanden met toevoegingen van 9 en 9 verwijderingen
  1. 9 9
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

+ 9 - 9
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -256,13 +256,13 @@ public class SpecialistService{
        String sql = "SELECT " +
                " COUNT(1) as total " +
                " FROM " +
                " ( " +
                "  SELECT " +
                "   i.label_type AS labelType, " +
                "   i.label, " +
                "   i.label_name AS labelName, " +
                "   i.patient " +
                "  FROM " +
//                " ( " +
//                "  SELECT " +
//                "   i.label_type AS labelType, " +
//                "   i.label, " +
//                "   i.label_name AS labelName, " +
//                "   i.patient " +
//                "  FROM " +
                "   "+basedb+".wlyy_sign_patient_label_info i " +
                "  WHERE " +
                "   i.label = '"+label+"' "+
@ -270,8 +270,8 @@ public class SpecialistService{
                "  AND i.`status` = '1' " +
                " AND i.patient in ( " +
                " select patient from  wlyy_specialist_patient_relation  WHERE " +
                "( doctor = '"+doctor+"' OR health_doctor = '"+doctor+"' OR health_assistant='"+doctor+ "' ) AND STATUS >= 0 AND sign_status > 0 )"+
                " ) lb ";
                "( doctor = '"+doctor+"' OR health_doctor = '"+doctor+"' OR health_assistant='"+doctor+ "' ) AND STATUS >= 0 AND sign_status > 0 )";
//                +" ) lb ";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){