<%@language=vbscript codepage=936 %>
<!--#include file="conn.asp"-->
<!--#include file="admin.asp"-->
<!--#include file="Inc/Function.asp"-->
<style>
 .new{
  border-left-width:2px;
  border-bottom-width:2px;
  border-top-width:1px;
  border-right-width:1px;
  border-color:black;
  font-size:16px;
 }
 .input1
 {
  border-width:1px;
  border-color:black;
  font-size:16px;color:#F00;
  font-family:"黑体";
 }
  .input2
 {
  border-width:1px;
  border-color:black;
  font-size:16px;
  font-family:"宋体";
 }
</style>
<%
dim strFileName
const MaxPerPage=50
dim totalPut,CurrentPage,TotalPages
dim i,j
dim ArticleID
dim Title
dim sql,rs
dim BigClassName,SmallClassName,SpecialName,yyr
dim PurviewChecked
dim strAdmin,arrAdmin
dim cyyr
cyyr=session("AdminName")
PurviewChecked=false
strFileName="News_Manage.asp?BigClassName=" & BigClassName & "&SmallClassName=" & SmallClassName & "&SpecialName=" & SpecialName

BigClassName=Trim(request("BigClassName"))
SmallClassName=Trim(request("SmallClassName"))
yyr=Trim(request("yyr"))

if request("page")<>"" then
    currentPage=cint(request("page"))
else
	currentPage=1
end if
'if session("gly")=true  then
sql="select * from yy_tjxhz  where  yydate >= #2012-04-01# "
'else
'sql="select * from yy_tjxhz  where  yydate >= #2012-04-01# and yyr='"&cyyr&"'"
'end if
if yyr<>"" then
	sql=sql & "and yyr='" & yyr & "' "
	end if
if BigClassName<>"" then
	sql=sql & "and BigClassName='" & BigClassName & "' "
	end if
	if SmallClassName<>"" then
		sql=sql & " and SmallClassName='" & SmallClassName & "' "
	end if
	
sql=sql & " order by qxyy<>true,sfly<>true,id  desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
%>
<SCRIPT language=javascript>
function unselectall()
{
    if(document.del.chkAll.checked){
	document.del.chkAll.checked = document.del.chkAll.checked&0;
    } 	
}

function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != "chkAll")
       e.checked = form.chkAll.checked;
    }
  }
function ConfirmDel()
{
   if(confirm("确定要删除选中的预约信息吗？一旦删除将不能恢复！"))
     return true;
   else
     return false;
	 
}

</SCRIPT>
<!-- #include file="Inc/Head.asp" -->
<br>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="862" align="center" valign="top"> 
    <table width="1000" border="0" align="center" cellpadding="5" cellspacing="2" class="border">
        <tr class="title"> 
          <td width="717" height="70" bgcolor="#A4B6D7"><strong><font color="#FFFFFF" size="+3">预约管理系统</font></strong></td>
          <td width="257" bgcolor="#A4B6D7"><%if session("dyz")<>True then%><a href="News_add.asp" target="main"><font color="#FF0000" size="6">&nbsp;&nbsp;添加新患者</font></a><%end if%></td>
        </tr>
        <tr class="title">
          <td height="30" colspan="2" bgcolor="#A4B6D7"><form name="form" method="get" action="yyxt_search.asp" target="main" class="input2">
  &nbsp;&nbsp;查找预约:
  <input height="20" type="text" name="key" size="20" class="input2">
  &nbsp;&nbsp;
  <select name="otype" class="input2">
    <option value="name">患者姓名</option>
    <option value="tel">联系电话</option>
      <option value="id" selected>预约号</option>
  </select>
  <input type="submit" name="Submit2" value="搜索" class="input">
  &nbsp;&nbsp;提示:&nbsp;&nbsp;搜索以包含方式进行。
          </form></td>
        </tr>

      </table>
<!-- yuyueren-->
<table width="1000" border="0" align="center" cellpadding="5" cellspacing="2" class="border">
        <tr class="title"> 
          <td bgcolor="#A4B6D7" height="25"><font  size="3">预约人:&nbsp;</font> 
            <%
dim sqlyyr,rsyyr,sqlSpecial1,rsSpecial1
sqlyyr="select * from yy_zxy where yyr=true and yxbz=true and tsbz=false "
Set rsyyr= Server.CreateObject("ADODB.Recordset")
rsyyr.open sqlyyr,conn,1,1
if rsyyr.eof then 
	response.Write("还没有任何预约人，请首先添加预约人。")
end if
do while not rsyyr.eof
	if rsyyr("name")=yyr then
		response.Write("<a href='news_manage.asp?yyr=" & rsyyr("name") & "'><font color='red' size='3'>" & rsyyr("name") & "</font></a> | ")
		if session("purview")=3 then
			strAdmin=rsyyr("Admin")
			if Instr(strAdmin,"|")>0 then
				arrAdmin=split(strAdmin)
				for i=0 to ubound(arrAdmin)
					if trim(arrAdmin(i))=session("admin") then
						PurviewChecked=True
						exit for
					end if
				next
			else
				if trim(strAdmin)=session("Admin") then
					PurviewChecked=True
				end if
			end if
		end if
	else
		response.Write("<a href='news_manage.asp?yyr=" & rsyyr("name") & "'><font  size='3'>" & rsyyr("name") & "</font></a> | ")
	end if
	rsyyr.movenext
loop
rsyyr.close
set rsyyr=nothing
%>
          </td>
        </tr>
       

      </table>
<!-- yuyuerenjiesu-->

      <table width="1000" border="0" align="center" cellpadding="5" cellspacing="2" class="border">
        <tr class="title"> 
          <td bgcolor="#A4B6D7" height="25"><font  size="3">预约途径:&nbsp;</font> 
            <%
dim sqlBigClass,sqlSmallClass,rsBigClass,rsSmallClass,sqlSpecial,rsSpecial
sqlBigClass="select * from BigClass_new "
Set rsBigClass= Server.CreateObject("ADODB.Recordset")
rsBigClass.open sqlBigClass,conn,1,1
if rsBigClass.eof then 
	response.Write("还没有任何栏目，请首先添加栏目。")
end if
do while not rsBigClass.eof
	if rsBigClass("BigClassName")=BigClassName then
		response.Write("<a href='News_Manage.asp?BigClassName=" & rsBigClass("BigClassName") & "'><font color='red' size='3'>" & rsBigClass("BigClassName") & "</font></a> | ")
		if session("purview")=3 then
			strAdmin=rsBigClass("Admin")
			if Instr(strAdmin,"|")>0 then
				arrAdmin=split(strAdmin)
				for i=0 to ubound(arrAdmin)
					if trim(arrAdmin(i))=session("admin") then
						PurviewChecked=True
						exit for
					end if
				next
			else
				if trim(strAdmin)=session("Admin") then
					PurviewChecked=True
				end if
			end if
		end if
	else
		response.Write("<a href='News_Manage.asp?BigClassName=" & rsBigClass("BigClassName") & "'><font  size='3'>" & rsBigClass("BigClassName") & "</font></a> | ")
	end if
	rsBigClass.movenext
loop
rsBigClass.close
set rsBigClass=nothing
%>
         </td>
        </tr>
        <%
if BigClassName<>"" then
	sqlSmallClass="select * from SmallClass_new where BigClassName='" & BigClassName & "'"
	Set rsSmallClass= Server.CreateObject("ADODB.Recordset")
	rsSmallClass.open sqlSmallClass,conn,1,1
	if not (rsSmallClass.bof and rsSmallClass.eof) then
		response.write "<tr class='tdbg'><td bgcolor='#C0C0C0'>"
		do while not rsSmallClass.eof
			if rsSmallClass("SmallClassName")=SmallClassName then
				response.Write("&nbsp;<a href='News_Manage.asp?BigClassName=" & rsSmallClass("BigClassName") & "&SmallClassName=" & rsSmallClass("SmallClassName") & "'><font color='red'>" & rsSmallClass("SmallClassName") & "</font></a>&nbsp;&nbsp;")
				if session("purview")=4 then
					strAdmin=rsSmallClass("Admin")
					if Instr(strAdmin,"|")>0 then
						arrAdmin=split(strAdmin)
						for i=0 to ubound(arrAdmin)
							if trim(arrAdmin(i))=session("admin") then
								PurviewChecked=True
								exit for
							end if
						next
					else
						if trim(strAdmin)=session("Admin") then
							PurviewChecked=True
						end if
					end if
				end if
			else
				response.Write("&nbsp;<a href='News_Manage.asp?BigClassName=" & rsSmallClass("BigClassName") & "&SmallClassName=" & rsSmallClass("SmallClassName") & "'><font  size='3'>" & rsSmallClass("SmallClassName") & "</font></a>&nbsp;&nbsp;")
			end if
			rsSmallClass.movenext
		loop
		response.write "</td></tr>"
	end if
	rsSmallClass.close
	set rsSmallClass=nothing
end if
%>
      </table>


      
      <form name="del" method="Post" action="yyxt_Del.asp" onSubmit="return ConfirmDel();">
        <table width="1000" border="0" cellpadding="0" cellspacing="2">
          <tr bgcolor="#A4B6D7"> 
            <td height="25"><a href="News_Manage.asp">&nbsp;预约信息管理</a> &gt;&gt; 
              <%
if request.name="" then
	response.write "所有预约信息"
else
	if request("name")<>"" then
		if name<>"" then
			response.write "名称中含有“<font color=blue>" & name & "</font>”的预约信息"
		else
			response.Write("所有预约信息")
		end if
 	else
		if BigClassName<>"" then
			response.write "<a href='News_Manage.asp?BigClassName=" & BigClassName & "'>" & BigClassName & "</a>&nbsp;&gt;&gt;&nbsp;"
			if SmallClassName<>"" then
				response.write "<a href='News_Manage.asp?BigClassName=" & BigClassName & "&SmallClassName=" & SmallClassName & "'>" & SmallClassName & "</a>"
			else
				response.write "所有小类"
			end if
		end if		
	end if
end if
%> </td>
            <td width="150" >&nbsp; 
              <%
  	if rs.eof and rs.bof then
		response.write "共找到 0 条预约信息</td></tr></table>"
	else
    	totalPut=rs.recordcount
		if currentpage<1 then
       		currentpage=1
    	end if
    	if (currentpage-1)*MaxPerPage>totalput then
	   		if (totalPut mod MaxPerPage)=0 then
	     		currentpage= totalPut \ MaxPerPage
		  	else
		      	currentpage= totalPut \ MaxPerPage + 1
	   		end if

    	end if
		response.Write "共找到 " & totalPut & " 条预约信息"
%> </td>
          </tr>
        </table>
        <%		
	    if currentPage=1 then
        	showContent
        	showpage strFileName,totalput,MaxPerPage,true,false,"条预约信息"
   	 	else
   	     	if (currentPage-1)*MaxPerPage<totalPut then
         	   	rs.move  (currentPage-1)*MaxPerPage
         		dim bookmark
           		bookmark=rs.bookmark
            	showContent
            	showpage strFileName,totalput,MaxPerPage,true,false,"条预约信息"
        	else
	        	currentPage=1
           		showContent
           		showpage strFileName,totalput,MaxPerPage,true,false,"条预约信息"
	    	end if
		end if
	end if
%>
        <%  
sub showContent
   	dim i
    i=0
%>
        <table class="border" border="0" cellspacing="2" width="1000" cellpadding="0" style="word-break:break-all">
          <tr  bgcolor="#A4B6D7" class="title"> 
            <%if session("gly")=True then%><td  width="32" height="30" align="center">选中</td><%end if%>
            <td width="32"  height="30" align="center">ID</td>
            <td width="70" align="center" bgcolor="#A4B6D7" ><font size="2">患者姓名</font></td>
            <td width="70" align="center" bgcolor="#A4B6D7" ><font size="2">预约时间</font></td>
            <td width="110" align="center" >预约来院时间</td>
            <td width="80" align="center" ><font size="2">预约号/备注</font></td>
            <td width="80" align="center" ><font size="2">联系电话</font></td>
            <td width="70" align="center" ><font size="2">病种</font></td>
            <td width="60" align="center" ><font size="2">预约途经</font></td>
            <td width="60" align="center" ><font size="2">预约人</font></td>
            <td width="60" align="center" ><font size="2">来院状态</font></td>
            <td width="80" align="center" ><font size="2">来院时间</font></td>
            <td width="60" align="center" ><font size="2">指定专家</font></td><%if session("gly")=True then%>
            <td width="75" align="center" ><font size="2">操作</font></td><%end if%>
          </tr>
          <%do while not rs.eof%>
          <tr  class="tdbg"> 
            <%if session("gly")=True then%><td width="32" height="30" align="center"bgcolor="#A4B6D7" > 
              <input name='ID' type='checkbox' onClick="unselectall()" id="ID" value='<%=cstr(rs("ID"))%>'>
            </td><%end if%>
            <td width="32" height="30" align="center" bgcolor="#A4B6D7"><%=rs("id")%></td>
            <td width="70" align="center"  bgcolor="#CCCCFF"><%if rs("sfly")=true then%><a href="yyxt_ylymodi.asp?ID=<%=rs("id")%>"><%else%><a href="news_modi.asp?ID=<%=rs("id")%>"><%end if%><font size="3"><% if rs("BigClassName")="市场部"  then %><font color="#FF0000" ><%=rs("Name")%></font><%end if%><% if rs("sfly")=true  then %><font color="#FF0000" ><%=rs("Name")%></font><%end if%><% if rs("qxyy")=true then %><font color="#0000FF" ><%=rs("Name")%></font><%end if%><% if rs("BigClassName")<>"市场部" and rs("qxyy")<>true and rs("sfly")<>true then %><%=rs("Name")%><%end if%></font></a></td>
            <td width="70" align="center"  bgcolor="#CCCCFF"><%if rs("sfly")=true then%><a href="yyxt_ylymodi.asp?ID=<%=rs("id")%>"><%else%><a href="news_modi.asp?ID=<%=rs("id")%>"><%end if%><font size="2"><% if rs("BigClassName")="市场部"  then %><font color="#FF0000" size="2"><%=rs("yydate")%></font><%end if%><% if rs("qxyy")=true then %><font color="#0000FF" size="2"><%=rs("yydate")%></font><%end if%><% if rs("BigClassName")<>"市场部" and rs("qxyy")<>true then %><%=rs("yydate")%><%end if%></font></a></td>
            <td width="110" align="center"  bgcolor="#CCCCFF"><%if rs("sfly")=true then%><a href="yyxt_ylymodi.asp?ID=<%=rs("id")%>"><%else%><a href="news_modi.asp?ID=<%=rs("id")%>"><%end if%><font size="2"><% if rs("BigClassName")="市场部"  then %><font color="#FF0000" size="2"><%=rs("yylydate")%><%=rs("swxw")%></font><%end if%><% if rs("yylydate")<>"" and rs("yylydatebz")=true then %><font color="#0000FF" size="2"><%=rs("yylydate")%><%=rs("swxw")%>左右</font><%end if%><% if rs("yylydate")="" and rs("yylydatebz")=true then %><font color="#0000FF" size="2">未确定</font><%end if%><% if rs("qxyy")=true then %><font color="#0000FF" size="2">预约已取消</font><%end if%><% if rs("BigClassName")<>"市场部" and rs("qxyy")<>true and rs("yylydatebz")<>true then %><%=rs("yylydate")%><%=rs("swxw")%><%end if%></font></a></td>
            <td align="center"  bgcolor="#CCCCFF"><a href="News_modi.asp?ID=<%=rs("id")%>"><font size="2"><font color="#FF0000" size="2"><%=left(rs("bz"),30)%></font></font></a>
              <% if rs("lmtj")=false then %>
              <a style="color:#006600" href="news_lmtjxg.asp?action=yes&amp;id=<%=rs("id")%>">未发</a>
              <% end if %>
              <% if rs("lmtj")=true then %>
              <a style="color:#FF0000"  href="news_lmtjxg.asp?action=No&amp;id=<%=rs("id")%>">已发</a>
            <% end if %></td>
            <td align="center"  bgcolor="#CCCCFF"><%if rs("sfly")=true then%><a href="yyxt_ylymodi.asp?ID=<%=rs("id")%>"><%else%><a href="news_modi.asp?ID=<%=rs("id")%>"><%end if%><% if rs("BigClassName")<>"市场部" and  session("scb")="True" then %><font size="2"><%=left(rs("tel"),5)%>****</font><%else%><font size="2"><%=rs("tel")%></font><%end if%></a></td>
            <td width="70" align="center"  bgcolor="#CCCCFF"><%if rs("sfly")=true then%><a href="yyxt_ylymodi.asp?ID=<%=rs("id")%>"><%else%><a href="news_modi.asp?ID=<%=rs("id")%>"><%end if%>
            <font size="2"><% if rs("BigClassName")="市场部"  then %><font color="#FF0000" size="2"><%=rs("SmallClassName")%></font><%else%><%=rs("SmallClassName")%><%end if%></font></a></td>
            <td  align="center"  bgcolor="#CCCCFF"><%=rs("BigClassName")%><BR></td>
            <td width="60" align="center"  bgcolor="#CCCCFF"><%if rs("sfly")=true then%><a href="yyxt_ylymodi.asp?ID=<%=rs("id")%>"><%else%><a href="news_modi.asp?ID=<%=rs("id")%>"><%end if%><font size="2"><% if rs("BigClassName")="市场部"  then %><font color="#FF0000" size="2"><%=rs("yyr")%></font><%else%><%=rs("yyr")%><%end if%></font></a></td>
            <td width="60" align="center" bgcolor="#CCCCFF"><%if rs("sfly")=true then%><a href="yyxt_ylymodi.asp?ID=<%=rs("id")%>"><%else%><a href="news_modi.asp?ID=<%=rs("id")%>"><%end if%>
              <% if rs("qxyy")=true then %>
            </a><%if rs("sfly")=true then%><a href="yyxt_ylymodi.asp?ID=<%=rs("id")%>"><%else%><a href="news_modi.asp?ID=<%=rs("id")%>"><%end if%><font color="#0000FF" size="2">已取消</font><%else%>
              <% if rs("sfly")=false then %>
              <font color="#006600" size="2">未来院</font>
              <% end if %>
          <% if rs("sfly")=true then %>
          <font color="#FF0000" size="2">已来院</font>
          <% end if %>
          <%end if%>
            </a></td>
            <td width="80"  align="center" bgcolor="#CCCCFF"><% if rs("sfly")=True then %><%=rs("lydate")%><%end if%></td>
            <td width="60" align="center" bgcolor="#CCCCFF"><font size="2"><%=rs("yyys")%></font></td>
            <%if session("gly")=True then%><td width="75" align="center" bgcolor="#CCCCFF"> <%if rs("sfly")=true then%><a href="yyxt_ylymodi.asp?ID=<%=rs("id")%>"><%else%><a href="ADMIN_news_modi.asp?ID=<%=rs("id")%>"><%end if%><font size="2">查看</font>&nbsp;&nbsp;</a> 
              <%if session("gly")=True then%><a href="yyxt_Del.asp?ID=<%=rs("ID")%>&Action=Del" onClick="return ConfirmDel();">删除</a><%end if%> 
            </td><%end if%>
          </tr>
          <%
	i=i+1
	      if i>=MaxPerPage then exit do
	      rs.movenext
	loop
%>
        </table>
		<%if session("gly")=True then%>
        <table width="1000" border="0" cellpadding="0" cellspacing="0">
          <tr> 
            <td width="250" height="30" bgcolor="#A4B6D7"><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
            选中本页显示的所有预约信息</td>
            <td bgcolor="#A4B6D7"><input name="submit" type='submit' value='删除选定的预约信息' <%if session("purview")>=3 and session("purview")<=4 and PurviewChecked=False then response.write "disabled"%>> 
              <input name="Action" type="hidden" id="Action" value="Del"></td>
              
          </tr> 
        </table>
         <% end if%>
        <%
   end sub 
%>
      </form>
      <br><br> <table width="1000" border="0" cellpadding="0" cellspacing="0" class="border">
        <tr > 
          
            <td height="30" align="left" valign="middle"  bgcolor="#A4B6D7"><form name="form" method="get" action="yyxt_search.asp" target="main">
              &nbsp;&nbsp;查询条件:
<input height="20" type="text" name="key" size="20" class="input">&nbsp;&nbsp;
<select name="otype" class="input">
  <option value="name">患者姓名</option>
  <option value="tel">联系电话</option>
</select> 
<input type="submit" name="Submit" value="搜索" class="input"></form>
</td>
          
        </tr>
                <tr > 
          
            <td height="30" align="left"  bgcolor="#A4B6D7"><font size="2">提示:&nbsp;&nbsp;搜索以包含方式进行。</font>
</td>
          
        </tr>
        
      </table></td>
  </tr>
</table>
<!-- #include file="Inc/Foot.asp" -->
<%
rs.close
set rs=nothing  
call CloseConn()
%>