<!--#include file="conn.asp"-->
<!--#include file="admin.asp"-->
<!-- #include file="Inc/Head.asp" -->
<%
name=request("name")
sex=request("sex")
nl=request("nl")
tel=request("tel")
yylydate=request("yylydate")
yhfdate=request("yhfdate")
yydate=request("yydate")
yyys=request("yyys")
BigClassName=request("BigClassName")
SmallClassName=request("SmallClassName")
content=request("content")
swxw=request("swxw")

bz=request("bz")
'kf=request("kf")
'qq=request("qq")
ltjl=request("ltjl")
'llfx=request("llfx")
yyr=request("yyr")
'yb=request("yb")
yylydatebz=request("yylydatebz")
wlybz="true"
'================验证表单内容是否合法(开始)====================================================================

set rs1=server.createobject("adodb.recordset")
sql1="select * from yy_tjxhz where name='"&request("name")&"'"
rs1.open sql1,conn,1,3
if not rs1.bof and not rs1.eof then '表示如果存在
   response.write "<script>alert('此姓名已预约过请核实 如需强制保存 请对姓名稍做修改');history.back();</script>"
    Response.end
end if 

set rs2=server.createobject("adodb.recordset")
sql2="select * from yy_tjxhz where tel='"&request("tel")&"'"
rs2.open sql2,conn,1,3
if not rs2.bof and not rs2.eof then '表示如果存在
   response.write "<script>alert('此电话号码已预约过请核实 如需强制保存 请对电话号码稍做修改');history.back();</script>"
    Response.end
end if 


if name="" then
	response.write "<SCRIPT language=JavaScript>alert('用户名称不能为空 或 输入字符非法！');"
	response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
	response.end
end if

if yylydate="" then
	response.write "<SCRIPT language=JavaScript>alert('预约来院日期不能为空！');"
	response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
	response.end
end if

if yhfdate="" then
	response.write "<SCRIPT language=JavaScript>alert('预回访日期不能为空！');"
	response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
	response.end
end if


if content="" then
	response.write "<SCRIPT language=JavaScript>alert('疾病描述不能为空');"
	response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
	response.end
end if

if bz="" then
	response.write "<SCRIPT language=JavaScript>alert('预约号不能为空');"
	response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
	response.end
end if

if tel="" then
	response.write "<SCRIPT language=JavaScript>alert('电话号码不能为空');"
	response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
	response.end
end if

if tel<>"" then
  if not(isnumeric(tel)) then 
     response.write "<SCRIPT language=JavaScript>alert('电话号码必须是数字');"
     Response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
     Response.End
  end if
end if


if yyr="请选择预约人" then
	response.write "<SCRIPT language=JavaScript>alert('预约人不能为空');"
	response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
	response.end
end if


if bz<>"" then
  if not(isnumeric(bz)) then 
     response.write "<SCRIPT language=JavaScript>alert('预约号必须是数字');"
     Response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
     Response.End
  end if
end if

if nl<>"" then
  if not(isnumeric(nl)) then 
     response.write "<SCRIPT language=JavaScript>alert('年龄必须是数字');"
     Response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
     Response.End
  end if
end if

if yydate="" then
	response.write "<SCRIPT language=JavaScript>alert('预约日期不能为空');"
	response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
	response.end
end if



if SmallClassName="" then
	response.write "<SCRIPT language=JavaScript>alert('请选择预约病种!!!');"
	response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
	response.end
end if


set rs=server.createobject("adodb.recordset")
sql="select * from yy_tjxhz where (id is null)"
rs.open sql,conn,1,3
rs.addnew
rs("name")=name
rs("sex")=sex
rs("nl")=nl
rs("swxw")=swxw
rs("tel")=tel
rs("yylydate")=yylydate
rs("yhfdate")=yhfdate
rs("yydate")=yydate

if request("yyys")="请选择医生" then 
rs("yyys")=""
else
rs("yyys")=yyys
end if
rs("BigClassName")=BigClassName
rs("SmallClassName")=SmallClassName
rs("content")=content
rs("bz")=bz
rs("yyr")=yyr
'rs("kf")=kf
'rs("qq")=qq
rs("ltjl")=ltjl
'rs("llfx")=llfx
rs("js")=1
rs("yydjdate")=now()
'rs("yb") = yb
rs("yylydatebz") = yylydatebz
rs("wlybz")=wlybz

rs.update
rs.close
set rs=nothing
conn.close  
set conn=nothing
response.write "<script language='javascript'>" & chr(13)
		response.write "alert('预约信息提交成功！');" & Chr(13)
		response.write "window.document.location.href='News_Manage.asp';"&Chr(13)
		response.write "</script>" & Chr(13)
Response.End
%>
