| 
					
				 | 
			
			
				@ -572,6 +572,8 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return object; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 首页统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1627,5 +1629,714 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 首页头部统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level  1院级管理员,2科室管理员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject selectIndexHeader(String dept, int level) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject object = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String day = "0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer total = 0;//总人次 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (level==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doctorSql +=" and d.id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> map = jdbcTemplate.queryForMap(doctorSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String doctorTotal = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (map != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doctorTotal = map.get("total").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(doctorTotal)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //总人次 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (!day.equalsIgnoreCase("0")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                total = Integer.parseInt(doctorTotal) * Integer.parseInt(day); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                total = Integer.parseInt(doctorTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tCOUNT(DISTINCT d.doctor_id) AS total\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\td3.*\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\t*, MAX(d1.create_time) AS createTime\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\tbase_doctor_health_upload d1\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tGROUP BY\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\td1.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t) d2\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tLEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id = d3.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tAND d2.createTime = d3.create_time\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t) d "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String highSql = sql +" where d.is_high=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String redSql = sql +" where d.health_code=2 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String yellowSql = sql +" where d.health_code=3 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (level==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            highSql +=" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            redSql +=" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            yellowSql +=" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> highMap = jdbcTemplate.queryForMap(highSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String highTotals = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer highTotal = 0;//中高风险统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (highMap != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            highTotals = highMap.get("total").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(highTotals)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //中高风险统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            highTotal = Integer.parseInt(highTotals); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> redMap = jdbcTemplate.queryForMap(redSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String redTotals = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer redTotal = 0;//红码统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (redMap != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            redTotals = redMap.get("total").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(redTotals)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //红码统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            redTotal = Integer.parseInt(redTotals); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> yellowMap = jdbcTemplate.queryForMap(yellowSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String yellowTotals = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer yellowTotal = 0;//黄码统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (yellowMap != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            yellowTotals = yellowMap.get("total").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(yellowTotals)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //黄码统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            yellowTotal = Integer.parseInt(yellowTotals); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("total", total);//总人次 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("highTotal", highTotal);//中高风险统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("redTotal", redTotal);//红码统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("yellowTotal", yellowTotal);//黄码统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return object; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 首页出差科室统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level  1院级管理员,2科室管理员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> selectIndexScheduleDept(String dept, int level) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String condition = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (level==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            condition +=" and dh.dept_code = '"+dept+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tdh.dept_name as deptName,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tCOUNT(DISTINCT d.doctor_id) AS total\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\td3.*\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\t*, MAX(d1.create_time) AS createTime\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\tbase_doctor_health_upload d1\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tGROUP BY\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\td1.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t) d2\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tLEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id = d3.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tAND d2.createTime = d3.create_time\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t) d\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id and dh.del=1 \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "where dh.dept_name IS NOT NULL and d.schedule_status = 2  "+condition + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "GROUP BY dh.dept_code \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "ORDER BY COUNT(DISTINCT d.doctor_id) DESC  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return mapList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 首页出差分布统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level  1院级管理员,2科室管理员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> selectIndexScheduleCityName(String dept, int level) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String condition = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (level==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            condition +=" and dh.dept_code = '"+dept+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\td.city_name  as cityName,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tCOUNT(DISTINCT d.doctor_id) AS total\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\td3.*\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\t*, MAX(d1.create_time) AS createTime\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\tbase_doctor_health_upload d1\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tGROUP BY\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\td1.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t) d2\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tLEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id = d3.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tAND d2.createTime = d3.create_time\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t) d\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id and dh.del=1 \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "where  dh.dept_name IS NOT NULL and d.schedule_status = 2\n" +condition+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "GROUP BY d.city_name \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "ORDER BY COUNT(DISTINCT d.doctor_id) DESC "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return mapList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 首页本地分布统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level  1院级管理员,2科室管理员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> selectIndexScheduleTown(String dept, int level) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String condition = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (level==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            condition +=" and dh.dept_code = '"+dept+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\td.town_name  as townName,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tCOUNT(DISTINCT d.doctor_id) AS total\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\td3.*\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\t*, MAX(d1.create_time) AS createTime\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\tbase_doctor_health_upload d1\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tGROUP BY\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\td1.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t) d2\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tLEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id = d3.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tAND d2.createTime = d3.create_time\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t) d\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id and dh.del=1 \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "where  dh.dept_name IS NOT NULL and d.schedule_status = 1 and d.town_name  !=''\n" + condition + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "GROUP BY d.town_name \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "ORDER BY COUNT(DISTINCT d.doctor_id) DESC "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return mapList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 首页异常实时情况 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level  1院级管理员,2科室管理员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> selectIndexYichangList(String dept, int level) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String condition = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (level==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            condition +=" and dh.dept_code = '"+dept+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tdh.dept_name AS deptName,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\td.doctor_name AS doctorName,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\td.health_code AS healthCode,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\td.temperature AS temperature,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\td.is_symptoms AS isSymptoms,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\td.is_epidemic AS isEpidemic,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\td.abnormal_symptoms AS abnormalSymptoms,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\td.epidemic_person AS epidemicPerson,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tdate_format(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\td.create_time,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t'%Y-%m-%d %H:%i:%S'\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t) AS createTime\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\td3.*\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\t*, MAX(d1.create_time) AS createTime\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\tbase_doctor_health_upload d1\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tGROUP BY\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\td1.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t) d2\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tLEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id = d3.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tAND d2.createTime = d3.create_time\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t) d\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\td.health_code IN (2, 3)\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tOR CAST(d.temperature AS DECIMAL) >= 37.3\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tOR d.is_symptoms = 1\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tOR d.is_epidemic = 1\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t)\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND dh.dept_code IS NOT NULL\n" + condition+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "ORDER BY\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\td.create_time DESC "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return mapList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 首页核酸检测情况 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level  1院级管理员,2科室管理员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject selectIndexNucleicTotal(String dept, int level) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String condition = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (level==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            condition +=" and dh.dept_code = '"+dept+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //已做核酸 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String yizuohesuanSql = "SELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tCOUNT(DISTINCT d.doctor_id) as total\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\td3.*\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\t*, MAX(d1.create_time) AS createTime\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\tbase_doctor_health_upload d1\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tGROUP BY\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\td1.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t) d2\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tLEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id = d3.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tAND d2.createTime = d3.create_time\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t) d\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id \n" + condition+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "where d.is_nucleate !=1 and dh.dept_code is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> yizuoMap = jdbcTemplate.queryForMap(yizuohesuanSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String yizuoTotals = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer yizuoTotal = 0;//已做核酸统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (yizuoMap != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            yizuoTotals = yizuoMap.get("total").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(yizuoTotals)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //已做核酸统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            yizuoTotal = Integer.parseInt(yizuoTotals); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //未做核酸 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String weizuohesuanSql = "SELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tCOUNT(DISTINCT d.doctor_id) as total\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\td3.*\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\t*, MAX(d1.create_time) AS createTime\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\tbase_doctor_health_upload d1\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tGROUP BY\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\td1.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t) d2\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tLEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id = d3.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tAND d2.createTime = d3.create_time\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t) d\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id \n" +condition+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "where d.is_nucleate =1 and dh.dept_code is not null \n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> weizuoMap = jdbcTemplate.queryForMap(weizuohesuanSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String weizuoTotals = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer weizuoTotal = 0;//未做核酸统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (weizuoMap != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            weizuoTotals = weizuoMap.get("total").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(weizuoTotals)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //未做核酸统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            weizuoTotal = Integer.parseInt(weizuoTotals); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject object = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("weizuoTotal",weizuoTotal);//未做核酸统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("yizuoTotal",yizuoTotal);//已做核酸统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return object; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 首页当日新增统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level  1院级管理员,2科室管理员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject selectIndexNewAdd(String dept, int level) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String condition = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (level==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            condition +=" and dh.dept_code = '"+dept+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String startDate = DateUtil.getStringDateShort()+" 00:00:00"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String endDate = DateUtil.getStringDateShort()+" 23:59:59"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject object = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tCOUNT(DISTINCT d.doctor_id) AS total\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\td3.*\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\t*, MAX(d1.create_time) AS createTime\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\tbase_doctor_health_upload d1\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\tGROUP BY\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t\t\td1.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t) d2\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tLEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id = d3.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tAND d2.createTime = d3.create_time\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t) d "+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id \n where 1=1 and dh.dept_code is not null  "+condition+" "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String highSql = sql +" AND d.is_high=1 and d.create_time >='"+startDate+"' and d.create_time <='"+endDate+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String redSql = sql +" AND d.health_code=2 and d.create_time >='"+startDate+"' and d.create_time <='"+endDate+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String yellowSql = sql +" AND d.health_code=3 and d.create_time >='"+startDate+"' and d.create_time <='"+endDate+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String greenSql = sql +" AND d.health_code=1 and d.create_time >='"+startDate+"' and d.create_time <='"+endDate+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> highMap = jdbcTemplate.queryForMap(highSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String highTotals = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer highTotal = 0;//中高风险统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (highMap != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            highTotals = highMap.get("total").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(highTotals)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //中高风险统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            highTotal = Integer.parseInt(highTotals); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> redMap = jdbcTemplate.queryForMap(redSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String redTotals = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer redTotal = 0;//红码统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (redMap != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            redTotals = redMap.get("total").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(redTotals)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //红码统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            redTotal = Integer.parseInt(redTotals); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> yellowMap = jdbcTemplate.queryForMap(yellowSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String yellowTotals = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer yellowTotal = 0;//黄码统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (yellowMap != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            yellowTotals = yellowMap.get("total").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(yellowTotals)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //黄码统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            yellowTotal = Integer.parseInt(yellowTotals); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> greenMap = jdbcTemplate.queryForMap(greenSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String greenTotals = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer greenTotal = 0;//中高风险统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (greenMap != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            greenTotals = greenMap.get("total").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(greenTotals)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //中高风险统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            greenTotal = Integer.parseInt(greenTotals); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("highTotal", highTotal);//中高风险统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("redTotal", redTotal);//红码统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("yellowTotal", yellowTotal);//黄码统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("greenTotal", greenTotal);//绿码统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return object; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 首页上报分析 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param flag 1周2月 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level  1院级管理员,2科室管理员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject selectIndexTotalCircle(Integer flag,String dept, int level) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject object = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String startDate=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String endDate=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (flag==1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            startDate = DateUtil.getMondayOfThisWeek(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            endDate = DateUtil.getSundayOfThisWeek(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if (flag==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            startDate = DateUtil.getFristDayOfMonth(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            endDate = DateUtil.getLastDayOfMonth(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String day = DateUtil.getTwoDay(endDate, startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer total = 0;//总人次 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlCondition = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (level==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition =" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT SUM(d1.total) as total from (select COUNT(DISTINCT d.doctor_id) as \"total\",date_format(d.create_time ,'%Y-%m-%d' ) from base_doctor_health_upload d where 1=1 "+sqlCondition+" and  d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' GROUP BY date_format(d.create_time ,'%Y-%m-%d' ))d1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (level==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doctorSql +=" and d.id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> map = jdbcTemplate.queryForMap(doctorSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String doctorTotal = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (map != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doctorTotal = map.get("total").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(doctorTotal)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //总人次 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (!day.equalsIgnoreCase("0")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                total = Integer.parseInt(doctorTotal) * Integer.parseInt(day); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                total = Integer.parseInt(doctorTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer yishangbaoTotal = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer weishangbaoTotal = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer zhengchangTotal = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer yichangTotal = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //已上传 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> yishangchaungMap = jdbcTemplate.queryForMap(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (yishangchaungMap != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (yishangchaungMap.get("total") != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                yishangbaoTotal = Integer.parseInt(yishangchaungMap.get("total").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //未上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        weishangbaoTotal = total - yishangbaoTotal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //上传总次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer shangchuanTotal = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String shangchuanTotalSql = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(startDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            shangchuanTotalSql += " and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (level==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            shangchuanTotalSql +=" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> shangchuanMap = jdbcTemplate.queryForMap(shangchuanTotalSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (shangchuanMap != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (shangchuanMap.get("total") != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                shangchuanTotal = Integer.parseInt(shangchuanMap.get("total").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //正常、异常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlZhengchang = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1 and (d.health_code not in(2,3) AND CAST(d.temperature as DECIMAL)<37.3 AND  d.is_symptoms=2 and  d.is_epidemic=2) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(startDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlZhengchang += " and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (level==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlZhengchang +=" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //正常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> zhengchangMap = jdbcTemplate.queryForMap(sqlZhengchang); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (zhengchangMap != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (zhengchangMap.get("total") != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                zhengchangTotal = Integer.parseInt(zhengchangMap.get("total").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlYichang = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1 and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(startDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlYichang += " and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (level==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlYichang +=" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //正常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> yichangMap = jdbcTemplate.queryForMap(sqlYichang); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (yichangMap != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (yichangMap.get("total") != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                yichangTotal = Integer.parseInt(yichangMap.get("total").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("total", total);//总人次 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("yishangbaoTotal", yishangbaoTotal);//已上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("weishangbaoTotal", weishangbaoTotal);//未上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("zhengchangTotal", zhengchangTotal);//上报正常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("yichangTotal", yichangTotal);//上报异常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("shangchuanTotal", shangchuanTotal);//上传总次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return object; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 首页未报科室统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param level  1院级管理员,2科室管理员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> selectIndexDeptList(String dept, int level) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String startDate = DateUtil.getStringDateShort(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String condition = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(startDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            condition = "  and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + startDate + " 23:59:59'  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String deptSql = "SELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tcode,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tname,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tdh1.total,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tdh2.total as yishangbaoTotal,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tdh3.total as shangchuanTotal,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tdh4.total as zhengchangTotal,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tdh5.total as yichangTotal,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tdh6.total as yichangPersonTotal\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tdict_hospital_dept hd\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN (\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tdh.dept_code,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tCOUNT(1) AS \"total\"\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tbase_doctor d\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tWHERE\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\td.del = 1\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tAND dh.del = 1\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tGROUP BY\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tdh.dept_code\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ") dh1 ON hd. CODE = dh1.dept_code\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN (\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tdh.dept_code,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tCOUNT(DISTINCT d.doctor_id) AS total\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tbase_doctor_health_upload d\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tWHERE\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t1 = 1\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                condition+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tGROUP BY\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tdh.dept_code\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ")dh2 ON dh2.dept_code=hd.code\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN (\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tdh.dept_code,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tCOUNT(1) AS total\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tbase_doctor_health_upload d\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tWHERE\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t1 = 1\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                condition+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tGROUP BY\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tdh.dept_code\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ")dh3 ON dh3.dept_code=hd.code\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN (\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tdh.dept_code,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tCOUNT(1) AS total\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tbase_doctor_health_upload d\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tWHERE\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t1 = 1\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                condition+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tand (d.health_code not in(2,3) AND CAST(d.temperature as DECIMAL)<37.3 AND  d.is_symptoms=2 and  d.is_epidemic=2)\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tGROUP BY\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tdh.dept_code\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ")dh4 ON dh4.dept_code=hd.code\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN (\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tdh.dept_code,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tCOUNT(1) AS total\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tbase_doctor_health_upload d\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tWHERE\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t1 = 1\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                condition+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tand (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tGROUP BY\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tdh.dept_code\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ")dh5 ON dh5.dept_code=hd.code\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN (\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tSELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tdh.dept_code,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tCOUNT(DISTINCT d.doctor_id) AS total\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tFROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tbase_doctor_health_upload d\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tWHERE\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t1 = 1\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                condition+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tand (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tGROUP BY\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tdh.dept_code\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ")dh6 ON dh6.dept_code=hd.code\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\thd.consult_dept_flag = 1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (level==2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            deptSql += " and hd.code = '" + dept + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        deptSql +=" ORDER BY (IF(ISNULL(dh1.total),0,dh1.total)-IF(ISNULL(dh2.total),0,dh2.total)) DESC "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(deptSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String,Object> deptMap:mapList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String day = DateUtil.getTwoDay(startDate, startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer total = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer yishangbaoTotal = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer weishangbaoTotal = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer zhengchangTotal = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer yichangTotal = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer shangchuanTotal = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer yichangPersonTotal = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (deptMap.get("total")!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String doctorTotal = deptMap.get("total").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //总人次 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (!day.equalsIgnoreCase("0")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    total = Integer.parseInt(doctorTotal) * Integer.parseInt(day); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    total = Integer.parseInt(doctorTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (deptMap.get("yishangbaoTotal")!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                yishangbaoTotal = Integer.parseInt(deptMap.get("yishangbaoTotal").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //未上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            weishangbaoTotal = total - yishangbaoTotal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (deptMap.get("zhengchangTotal")!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                zhengchangTotal = Integer.parseInt(deptMap.get("zhengchangTotal").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (deptMap.get("yichangTotal")!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                yichangTotal = Integer.parseInt(deptMap.get("yichangTotal").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (deptMap.get("yichangPersonTotal")!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                yichangPersonTotal = Integer.parseInt(deptMap.get("yichangPersonTotal").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (deptMap.get("shangchuanTotal")!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                shangchuanTotal = Integer.parseInt(deptMap.get("shangchuanTotal").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject object = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("total", total);//总人次 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("yishangbaoTotal", yishangbaoTotal);//已上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("weishangbaoTotal", weishangbaoTotal);//未上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("zhengchangTotal", zhengchangTotal);//上报正常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("yichangTotal", yichangTotal);//上报异常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("yichangPersonTotal", yichangPersonTotal);//上报人异常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("shangchuanTotal", shangchuanTotal);//上传总次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            deptMap.put("tongyishuju", object); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return mapList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |