資源簡介
Java Swing 實現的醫院管理系統課程設計,壓縮包內含有SQL Server2005的數據庫腳本文件,實現了醫院員工管理,病人管理,藥品管理等等功能,適合初學者

代碼片段和文件信息
package?hospital.frame;
import?hospital.util.JdbcUtil;
import?java.awt.*;
import?java.awt.event.*;
import?java.sql.Connection;
import?java.sql.DriverManager;
import?java.sql.ResultSet;
import?java.sql.Statement;
import?java.awt.Button;
import?java.awt.Label;
import?java.awt.TextField;
import?javax.swing.JOptionPane;
public?class?Chufangframe?implements?ActionListener?{
Statement?stmt?=?null;
String?sql;
frame?frm3?=?new?frame(“醫院管理系統“);
//?處方管理界面
Label?labe9?=?new?Label(“????E處方管理:(查詢,刪除時直接輸入處方編號)“);
Label?labe10?=?new?Label(“????處方編號:“);
Label?labe11?=?new?Label(“????處方內容:“);
Button?qry?=?new?Button(“E?查詢“);
Button?del?=?new?Button(“E?刪除“);
Button?add?=?new?Button(“E?錄入“);
TextField?lst41?=?new?TextField();
TextArea?txa1?=?new?TextArea();
public?void?clearframe()?{
lst41.setText(““);
txa1.setText(““);
}
public?Chufangframe()?{
//?處方管理系統界面
labe9.setBounds(5?45?400?20);
labe10.setBounds(5?70?90?20);
labe11.setBounds(5?100?90?20);
lst41.setBounds(100?70?100?20);
txa1.setBounds(20?125?400?175);
add.setBounds(30?325?50?20);
del.setBounds(140?325?50?20);
qry.setBounds(250?325?50?20);
frm3.add(labe9);
frm3.add(labe10);
frm3.add(labe11);
frm3.add(lst41);
frm3.add(txa1);
frm3.add(qry);
frm3.add(del);
frm3.add(add);
qry.addActionListener(this);
del.addActionListener(this);
add.addActionListener(this);
frm3.setLayout(null);
frm3.setBounds(500?200?460?400);
frm3.setBackground(Color.ORANGE);
frm3.setVisible(true);
//?實現窗口關閉按扭的事件
frm3.addWindowListener(new?WindowAdapter()?{
public?void?windowClosing(WindowEvent?e)?{
frm3.dispose();
}
});
frm3.setResizable(false);//?固定窗口的大小
try?{
stmt?=?JdbcUtil.getConnection().createStatement();
}?catch?(Exception?e)?{
e.printStackTrace();
}
}
public?void?actionPerformed(ActionEvent?e)?{
object?soruce?=?e.getSource();
ResultSet?rs?=?null;
String?_id?=?lst41.getText().trim();
if?(soruce?==?qry)?{
try?{
if?(_id.equals(““))?{
JOptionPane.showMessageDialog(null?“請先輸入要查詢的處方編號!“);
return;
}
sql?=?“select?*?from?Presno?where?Presno=‘“?+?_id?+?“‘“;
rs?=?stmt.executeQuery(sql);
if?(rs.next())?{
txa1.setText(rs.getString(2));
}?else?{
JOptionPane.showMessageDialog(null?“沒有查詢到【“?+?_id?+?“】!“);
}
}?catch?(Exception?e1)?{
e1.printStackTrace();
}
}?else?if?(soruce?==?del)?{
try?{
if?(_id.equals(““))?{
JOptionPane.showMessageDialog(null?“請先輸入要刪除的處方編號!“);
return;
}
sql?=?“delete?from?Presno?where?Presno=‘“?+?_id?+?“‘“;
int?result?=?stmt.executeUpdate(sql);
if?(result?==?0)?{
JOptionPane.showMessageDialog(null?“沒有查詢到【“?+?_id?+?“】!“);
}?else?{
JOptionPane.showMessageDialog(null?“刪除【“?+?_id?+?“】成功!“);
clearframe();
}
}?catch?(Exception?e1)?{
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????361??2014-12-27?22:31??HospitalSystem\.classpath
?????文件????????390??2014-12-27?22:22??HospitalSystem\.project
?????文件????????109??2014-12-28?13:09??HospitalSystem\.settings\org.eclipse.core.resources.prefs
?????文件????????629??2014-12-27?22:22??HospitalSystem\.settings\org.eclipse.jdt.core.prefs
?????文件????????744??2014-12-28?13:57??HospitalSystem\bin\hospital\fr
?????文件???????4916??2014-12-28?13:57??HospitalSystem\bin\hospital\fr
?????文件????????720??2014-12-28?13:57??HospitalSystem\bin\hospital\fr
?????文件???????6779??2014-12-28?13:57??HospitalSystem\bin\hospital\fr
?????文件????????708??2014-12-28?13:57??HospitalSystem\bin\hospital\fr
?????文件???????2342??2014-12-28?13:57??HospitalSystem\bin\hospital\fr
?????文件????????750??2014-12-28?13:57??HospitalSystem\bin\hospital\fr
?????文件???????7593??2014-12-28?13:57??HospitalSystem\bin\hospital\fr
?????文件????????744??2014-12-28?13:57??HospitalSystem\bin\hospital\fr
?????文件??????12618??2014-12-28?13:57??HospitalSystem\bin\hospital\fr
?????文件????????666??2014-12-28?13:31??HospitalSystem\bin\hospital\login\Login$1.class
?????文件???????3572??2014-12-28?13:31??HospitalSystem\bin\hospital\login\Login.class
?????文件???????1429??2014-12-28?13:09??HospitalSystem\bin\hospital\util\JdbcUtil.class
?????文件???????1612??2014-12-29?13:10??HospitalSystem\hospital.sql
?????文件?????583286??2014-12-17?15:37??HospitalSystem\lib\sqljdbc-1.2.0.jar
?????文件???????3877??2014-12-28?13:57??HospitalSystem\src\hospital\fr
?????文件???????6288??2014-12-28?13:57??HospitalSystem\src\hospital\fr
?????文件???????1620??2014-12-28?13:57??HospitalSystem\src\hospital\fr
?????文件???????7625??2014-12-28?13:57??HospitalSystem\src\hospital\fr
?????文件??????15405??2014-12-28?13:57??HospitalSystem\src\hospital\fr
?????文件???????2673??2014-12-28?13:31??HospitalSystem\src\hospital\login\Login.java
?????文件????????697??2014-12-28?13:09??HospitalSystem\src\hospital\util\JdbcUtil.java
?????目錄??????????0??2015-01-04?21:14??HospitalSystem\bin\hospital\fr
?????目錄??????????0??2015-01-04?21:14??HospitalSystem\bin\hospital\login
?????目錄??????????0??2015-01-04?21:14??HospitalSystem\bin\hospital\util
?????目錄??????????0??2015-01-04?21:14??HospitalSystem\src\hospital\fr
............此處省略12個文件信息
- 上一篇:java版 工資管理系統
- 下一篇:java 物流管理系統
評論
共有 條評論