hzj_sellaction.jsp

来自「服务器tomcat 数据库mysql Hospital Managemen」· JSP 代码 · 共 496 行 · 第 1/2 页

JSP
496
字号
<%@ page language="java" import="java.sql.*, java.util.*" %>
<%! 
         Connection con=null;
		 int medicine_id=0;
		 int patient_id=0;
		 int [] medicine_id=null;
		 int [] medicine_number = null;
		 float [] medicine_price=null;
		 java.sql.Date sell_date=null;
		  Calendar rightNow = null;
		    java.util.Date now=null;
		 float total_price=0;
 %>
 <% 
      try{
	      
		   patient_id=Integer.parseInt(request.getParameter("patient_id"));	
		    medicine_id=new int[8];
		    medicine_number=new int[8];
		    medicine_price=new float[8];	   
		   Class.forName("com.mysql.jdbc.Driver");		  
		   con=DriverManager.getConnection("jdbc:mysql:///lenovo_db?user=root&password=amethyst&useUnicode=true&characterEncoding=gb2312");
		   for(int i=1;i<8;i++)
		   {
		    medicine_id[i]=Integer.parseInt(request.getParameter("medicine_id"+String.valueOf(i))); 
			if(medicine_id[i]<=0)
			break;
		    medicine_number[i]=Integer.parseInt(request.getParameter("medicine_number"+String.valueOf(i)));  
			Statement st=con.createStatement();		
		    ResultSet rs=st.executeQuery("select * from medicine where Medicine_id="+medicine_id[i]);
			rs.next();
		    medicine_price[i]=rs.getFloat(6);
		    rs.close();
		    st.close();
		    total_price=total_price+medicine_number[i]*medicine_price[i];			  
		   		   
		   PreparedStatement ps=con.prepareStatement("insert into sell values(?,?,?,?,?)");			
		   ps.setInt(2,medicine_id[i]);
		   ps.setInt(3,medicine_number[i]);
		   ps.setInt(4,patient_id);
		   ps.setDate(5,output_date);
		    rightNow = Calendar.getInstance();
		     now=rightNow.getTime();			
		   output_date=new java.sql.Date(now.getTime());		   
		   ps.setFloat(6,total_price);		  
		   ps.executeUpdate();
		   ps.close();
   }		   
%>
<% 
         }
  catch(Exception ex)
     {	
	 
   System.out.println(ex);
      }

 %>		     
 <HTML>
<HEAD>
<TITLE>Hospital Management System</TITLE>
<!--CharSet-->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<link rel="stylesheet" href="images/CSS.CSS" type="text/css">
<SCRIPT  LANGUAGE=javascript type="text/javascript">
<!--

function window_onload() {
<!--Page.OnLoad-->
}

//-->
</SCRIPT>
</HEAD>
<BODY BGCOLOR=#CC9933 leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!--Counter-->
<!--Something Here-->
<table width="778" border="0" cellspacing="0" cellpadding="0" align="center" height="203">
  <tr>
    <td colspan="3" height="20"><img src="images/index_top1.gif" width="778" height="20"></td>
  </tr>
  <tr>
    <td height="165" width="50"><img src="images/index_top2.gif" width="50" height="165"></td>
    <td height="165" width="165" background="images/01.gif"><img src="images/index_pic.gif" width="165" height="165"></td>
    <td height="165" width="563" background="images/index_top3.gif" valign="top"><table border="0" cellspacing="0" cellpadding="0" width="563" align="center">
        <tr>
          <td height="25" width="303"><font color="#FFFFFF"><b></b></font>
            <div align="center"><font color="#000000"><b><font size="5">
              <!--Your Company Name-->
              Hospital Management System </font></b></font></div></td>
          <td height="25" width="260">&nbsp;</td>
        </tr>
        <tr>
          <td height="30" width="303"><font color="#FFFFFF"><b></b></font>
            <div align="center"><font size="4" color="#000000">
              <!--Your Company Name.English-->
              By Lenovo Group </font></div></td>
          <td height="30" width="260">&nbsp;</td>
        </tr>
        <tr>
          <td height="30" width="303"><div align="center"></div></td>
          <td height="30" width="260">&nbsp;</td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td colspan="3" height="18"><img src="images/index_top4.gif" width="778" height="18"></td>
  </tr>
</table>
<!--横幅条-->
<table width="778" border="0" cellspacing="0" cellpadding="0" align="center" background="images/index_lmbg.gif" height="60">
  <tr>
    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" height="35">
        <tr>
          <td width="9%"><table width="100%" border="0" cellspacing="0" cellpadding="0" height="35" background="images/index_lm.gif">
              <tr>
                <td width="100%"><div align="center"><b><a href="index.html">index</a></b> </div></td>
              </tr>
            </table></td>
          <!--Button1.Content.Begin-->
          <td width="13%"><table width="100%" border="0" cellspacing="0" cellpadding="0" height="35" background="images/index_lm.gif">
              <tr>
                <td width="100%"><div align="center"><b>
                    <!--Button1.Link-->
                    <a href="#">
                    <!--Button1-->
                    appointment schedule </a></b></div></td>
              </tr>
            </table></td>
          <!--Button1.Content.End-->
          <!--Button2.Content.Begin-->
          <td width="9%"><table width="100%" height="35"  border="0" cellpadding="0" cellspacing="0" background="images/index_lm.gif">
              <tr>
                <td width="100%"><div align="center"><b>
                    <!--Button2.Link-->
                    <a href="#">
                    <!--Button2-->
                    ADT</a></b></div></td>
              </tr>
            </table></td>
          <!--Button2.Content.End-->
          <!--Button3.Content.Begin-->
          <td width="10%"><table width="100%" border="0" cellspacing="0" cellpadding="0" height="35" background="images/index_lm.gif">
              <tr>
                <td width="100%"><div align="center"><b>
                    <!--Button3.Link-->
                    <a href="#">
                    <!--Button3-->
                    bed mangement </a></b></div></td>
              </tr>
            </table></td>
          <!--Button3.Content.End-->
          <!--Button4.Content.Begin-->
          <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0" height="35" background="images/index_lm.gif">
              <tr>
                <td width="100%"><div align="center"><b>
                    <!--Button4.Link-->
                    <a href="#">
                    <!--Button4-->
                    doctor workstation </a></b></div></td>
              </tr>
            </table></td>
          <!--Button4.Content.End-->
          <!--Button5.Content.Begin-->
          <td width="8%"><table width="100%" border="0" cellspacing="0" cellpadding="0" height="35" background="images/index_lm.gif">
              <tr>
                <td width="100%"><div align="center"><b>
                    <!--Button5.Link-->
                    <a href="#">
                    <!--Button5-->
                    LIS</a></b></div></td>
              </tr>
            </table></td>
          <!--Button5.Content.End-->
          <!--Button6.Content.Begin-->
          <td width="8%"><table width="100%" border="0" cellspacing="0" cellpadding="0" height="35" background="images/index_lm.gif">
              <tr>
                <td width="100%"><div align="center"><b>
                    <!--Button6.Link-->
                    <a href="#">
                    <!--Button6-->
                    EMS</a></b></div></td>
              </tr>
            </table></td>
          <!--Button6.Content.End-->
          <!--Button7.Content.Begin-->
          <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0" height="35" background="images/index_lm.gif">
              <tr>
                <td width="100%"><div align="center"><b>
                    <!--Button7.Link-->
                    <a href="#">
                    <!--Button7-->
                    pharmacy management </a></b></div></td>
              </tr>
            </table></td>
          <!--Button7.Content.End-->
          <!--Button8.Content.Begin-->
          <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0" height="35" background="images/index_lm.gif">
              <tr>
                <td width="100%"><div align="center"><b>
                    <!--Button8.Link-->
                    <a href="#">
                    <!--Button8-->
                    finance management </a></b></div></td>
              </tr>
            </table></td>
          <!--Button8.Content.End-->
          <!--Button9.Content.Begin-->
          <td width="9%"><table width="100%" border="0" cellspacing="0" cellpadding="0" height="35" background="images/index_lm.gif">
              <tr>
                <td width="100%"><div align="center"><b>
                    <!--Button9.Link-->
                    <a href="#">
                    <!--Button9-->
                    LSS</a></b></div></td>
              </tr>
            </table></td>
          <!--Button9.Content.End-->
          <!--Button10.Content.Begin-->
          <td width="9%"><table width="100%" border="0" cellspacing="0" cellpadding="0" height="35" background="images/index_lm.gif">
              <tr>
                <td width="100%"><div align="center"><b>
                    <!--Button10.Link-->
                    <a href="#">
                    <!--Button10-->
                    SMS</a></b></div></td>
              </tr>
            </table></td>
          <!--Button10.Content.End-->
        </tr>
      </table></td>
  </tr>
</table>
<!--横幅条-->
<!--内容-->
<table width="778" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#E4EDFB">
  <tr>
    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td></td>
        </tr>
        <tr>
          <td><!--IndexPage.Content.Begin-->
            <table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
              <tr>
                <td height="1"></td>
              </tr>
              <tr>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?