<%@ page import="java.util.Map" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%

    String parentCode = request.getParameter("adcode");
    List<Map<String,String>> list = new ArrayList<Map<String,String>>();
    RecordSet rs = new RecordSet();
    if(StringUtils.isNotBlank(parentCode)){


        String sql =" select t.qm,t.yb,t.jd,t.wd,count(k.id) as cou\n" +
                    " from uf_qjsj t\n" +
                    " left join uf_zzdwdzxx k on k.szq = t.id\n" +
                    " inner join uf_sjsj p on p.id = t.sss\n" +
                    " where p.yb = '"+parentCode+"'\n" +
                    " group by t.qm,t.yb,t.jd,t.wd ";

        rs.executeQuery(sql);
        while (rs.next()){
            String adcode = rs.getString("yb");
            String name = rs.getString("qm");
            String jd = rs.getString("jd");
            String wd = rs.getString("wd");
            String center = "["+jd+","+wd+"]";
            String cou = rs.getString("cou");

            Map<String,String> map = new HashMap<String,String>();
            map.put("adcode",adcode);
            map.put("name",name);
            map.put("center",center);
            map.put("num",cou);
            list.add(map);
        }

    }


    JSONObject dataJson = new JSONObject();
    dataJson.put("data",list);

%>

<%=dataJson.toJSONString() %>

