n年龄 和 出生日期 比较的转换
<%
DBService dbservice = new DBService();
DateTime datetime = new DateTime();
String strAgentID=(String)session.getAttribute("AgentID");
String strDeptID = (String)session.getAttribute("DeptID");
String strSQL="";
int iPage=1;
int iPageSize=20;
DBSet dbset = null;
String strTH="";
String strTD="";
String strDoType="";
int iTR=0;
try
{
iPage = Integer.parseInt(request.getParameter("page"));
strSQL = (String)session.getAttribute("sjcx_cxdx_list.sql");
strTH = (String)session.getAttribute("sjcx_cxdx_list.th");
strTD = (String)session.getAttribute("sjcx_cxdx_list.td");
iPageSize=dbservice.stringToInt((String)session.getAttribute("sjcx_cxdx_list.pagesize"));
}catch(Exception err)
{
strSQL = "select * from j_cadreinfo where 1=1 ";
//对象名称
String strA0101=request.getParameter("A0101").trim();
strA0101=dbservice.postGBK(strA0101);
if(strA0101.compareTo("")!=0)
{
strSQL = strSQL+" and A0101 ='"+strA0101+"' ";
}
//证件号码
String strA0184=request.getParameter("A0184").trim();
if(strA0184.compareTo("")!=0)
{
strSQL = strSQL+" and A0184 ='"+strA0184+"' ";
}
//性别
String strA0104A=request.getParameter("A0104A").trim();
strA0104A=dbservice.postGBK(strA0104A);
if(strA0104A.compareTo("")!=0)
{
strSQL = strSQL+" and A0104A ='"+strA0104A+"' ";
}
//籍贯
String strA0111A=request.getParameter("A0111A").trim();
strA0111A=dbservice.postGBK(strA0111A);
if(strA0111A.compareTo("")!=0)
{
strSQL = strSQL+" and A0111A ='"+strA0111A+"' ";
}
//出生日期范围
String strBeginDate=request.getParameter("BeginDate").trim();
String strEndDate=request.getParameter("EndDate").trim();
if(strBeginDate.compareTo("")!=0)
{
// strSQL = strSQL+" and A0107 >='"+strBeginDate+"' ";
}
if(strEndDate.compareTo("")!=0)
{
// strSQL = strSQL+" and A0107 <='"+strEndDate+"' ";
}
//年龄
String strAgeStart=request.getParameter("AgeStart").trim();
String strAgeEnd=request.getParameter("AgeEnd").trim();
int ageStart=Integer.parseInt(strAgeStart);
int ageEnd=Integer.parseInt(strAgeEnd);
String strDate=datetime.getDate();
if(strAgeStart.compareTo("")!=0)
{
String strBeginDate1=datetime.getDateChange(strDate,-365*ageStart);
strSQL = strSQL+" and A0107 <='"+strBeginDate1+"' ";
}
if(strAgeEnd.compareTo("")!=0)
{
String strBeginDate1=datetime.getDateChange(strDate,-365*ageEnd);
strSQL = strSQL+" and A0107 >='"+strBeginDate1+"' ";
}
String strPageSize=request.getParameter("PageSize");
if(strPageSize.compareTo("")==0)
{
strPageSize="20";
}
else
{
iPageSize=dbservice.stringToInt(strPageSize);
}
String strOrderBy=request.getParameter("resultvalue");
if(strOrderBy.length()>1)
{
strOrderBy=strOrderBy.substring(0,strOrderBy.length()-1);
}
String strSortType=request.getParameter("SortType");
if(strOrderBy.length()>1)
{
strSQL=strSQL+" order by "+strOrderBy+" "+strSortType;
}
String[] strFieldName = request.getParameterValues("FieldName");
StringTokenizer tokens;
int iFieldCount=strFieldName.length;
iTR = iFieldCount+1;
for(int i=0;i<iFieldCount;i++)
{
String strFieldAndLable=strFieldName[i];
tokens = new StringTokenizer(strFieldAndLable,"-");
String strField=tokens.nextToken();
String strLable=tokens.nextToken();
strTH=strTH+"<td height='24' align='center' class='right_line_th' >"+strLable+"</td>\n";
strTD=strTD+strField+",";
}
if(strTD.length()>2)
{
strTD=strTD.substring(0,strTD.length()-1);
}
strTH= dbservice.postGBK(strTH);
session.setAttribute("sjcx_cxdx_list.sql",strSQL);
session.setAttribute("sjcx_cxdx_list.th",strTH);
session.setAttribute("sjcx_cxdx_list.td",strTD);
session.setAttribute("sjcx_cxdx_list.pagesize",strPageSize);
}
if(strSQL != null && strSQL.length()>0)
{
dbset = dbservice.getPageData(strSQL,iPage,iPageSize);
}
String strExpSQL=java.net.URLEncoder.encode(strSQL);
int iWindowHeight=608;
int iWindowWidth=1002;
%>