<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.Util" %>


<%--
  User: wangj
  Design Ideas：
  数智-数据中心--通过手机号获取简历信息（姓名，性别，年龄，身份证号，民族，应聘企业，意向岗位）
    表名：edc_uf_table160
    需要：通过手机号获取简历信息（姓名，性别，年龄，身份证号，民族，应聘企业，意向岗位）
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%

    JSONObject data = new JSONObject();
    JSONObject res = new JSONObject();
    RecordSet rs = new RecordSet();
    String mobile = Util.null2String(request.getParameter("mobile"));
    boolean flag = false;
    String xm = "";
    String xb = "";
    String age = "";
    String cardno = "";
    String mz = "";
    String ypqy = "";
    String gw = "";

    String sql = "select field001 as xm,field002 as xb,field008 as age,field004 as cardno,field013 as mz,field011 as ypqy,field007 as gw " +
                 " from edc_uf_table160 where field005 = '"+mobile+"'";

    rs.execute(sql);
    while (rs.next()){
        flag = true;
        xm = Util.null2String(rs.getString("xm"));
        xb = getFildName("edc_uf_table160","field002",Util.null2String(rs.getString("xb")));
        age = Util.null2String(rs.getString("age"));
        cardno = Util.null2String(rs.getString("cardno"));
        mz = getFildName("edc_uf_table160","field013",Util.null2String(rs.getString("mz")));
        ypqy = getFildName("edc_uf_table160","field011",Util.null2String(rs.getString("ypqy")));
        gw = Util.null2String(rs.getString("gw"));

        res.put("xm",xm);
        res.put("xb",xb);
        res.put("age",age);
        res.put("cardno",cardno);
        res.put("mz",mz);
        res.put("ypqy",ypqy);
        res.put("gw",gw);
    }


    data.put("flag",flag);
    data.put("data",res);
    out.print(data.toJSONString());
%>

<%!
    private String getFildName(String tablename,String fieldname,String value){
        String selectname = "";
        if("".equals(value)){
            return selectname;
        }
        String sql = " select c.selectname from workflow_billfield a, workflow_bill b,workflow_selectitem c where a.billid=b.id and c.fieldid=a.id  and b.tablename='"+tablename+"' and a.fieldname='"+fieldname+"' and c.selectvalue='" + value + "'";
        RecordSet rs = new RecordSet();
        rs.execute(sql);
        while (rs.next()){
            selectname = Util.null2String(rs.getString("selectname"));
        }
        return selectname;
    }
%>

