资源描述
武汉理工大学《java语言程序设计A》课程设计说明书
医院管理信息系统
1需求分析
1.1现状
当前,医院作为病人就诊的地方,有许多信息需要处理和管理。现今,有很多门诊信息都是初步开始使用,甚至尚未使用计算机进行信息处理。根据调查得知,他们以前对信息管理的主要方式是基于文本、表格等纸介质的手工处理,对于医历等很多信息都是用人工计算、手抄进行。数据信息处理工作量大,容易出错;由于数据繁多,容易丢失,且不易查找。总的来说,缺乏系统,规范的信息管理手段。
数据处理手工操作,工作量大,出错率高,出错后不易更改。基于这此问题,我认为有必要建立一个医院管理系统,使医院管理工作规范化,系统化,程序化,避免医院管理的随意性,提高信息处理的速度和准确性,能够及时、准确、有效的查询和修改医院情况。
医院信息系统简称HIS,是Hospital Information System的简称,是指利用计算机和网络通信设备,为医院所属的各个部门提供病人诊疗和行政管理信息的手机、存储、处理提取和数据交换的能力。此次我课程设计的目标就是设计一个能使医院的管理工作系统化、规范化、自动化的系统,从而提高医院管理工作的效率。
1.2模块功能
本系统功能主要包括:员工信息、病人信息、药剂管理、仪器管理、工资管理、病床管理。
员工信息:储存了医院的医务人员的基本情况,包括员工编号,姓名,性别,所在部门,联系电话等信息。员工各种的查询、修改,包括员工基本信息、职称、岗位、工资等。 员工的人事调动管理。病人信息:病人基本资料表中所有项目(姓名,性别,婚否,出生日期,职业,职称,门诊诊断),病人基本资料表录入、修改、删除、复制。
药剂管理:实现对医院药品信息的分类管理和数据分析,从而使信息整理快速、准确、简单,以便于相关部门给予统筹安排,从而提高改进传统的管理方法,提高企业管理水平。
仪器管理:保存了医院所需医疗用品的基本情况,库存量和单品价格。以便管理人员查看,随时进行补货。
工资管理:存储医生员工号,工资级别和工资总额,管理人员可以进行增删查改。
病床管理:实现床位分配、空床查询、包床/退床、转床出院处理。
图1.功能结构图
1.3用例图
图2.用例图
2系统设计
2.1识别需求文档中的类
1.管理员管理员工编号,姓名,性别,所在部门,联系电话等信息,进行增删查改。普通用户查看员工信息。
2.管理员设置病人姓名,性别,婚否,出生日期,职业,职称,门诊诊断,进行病人基本资料表录入、修改、删除、查询。
3.管理员实现对医院药品信息的分类管理,进行增删查改。
4.管理员保存医院所需医疗用品的基本情况,库存量和单品价格。
5.管理员录入医生员工号,工资级别和工资总额,进行增删查改。普通用户查看自己的工资。
6.管理员实现床位分配、空床查询、包床/退床、转床出院处理。
需求文档中的名词/名词短语,按照出现顺序,从左到右排列(不重复):
管理员(admin)、普通用户(person)、病人(invalid)、药品(stuff)、医疗用品)(apparatus、工资(pay)、床位(bed)。
2.2初步建模类及类间关系
员工信息包括:医生编号、姓名、性别、学历、职务、所在科室。病人基本情况描述包括病人的病人编号、姓名、性别、联系电话、籍贯、国家、民族、身份证号、健康状况、科室名称、病房号、床号。病号唯一确定一个病人。药品信息描述包括:药品编号、药品名称、库存量、单价。仪器信息描述包括:仪器代号、名称、单价、数量。床位信息描述包括床号、病房号、是否已住人。一个床号和病房号唯一确定一个床位情况。
2.3初步的UML图
Database
+sql:String
+url:String
+user:String
+password:String
+<<create>>Database()
+OpenConn():void
+executeQuery(in sql:String):ResultSet
+executeUpdate(in sql:Sring):boolean
+closestmt():void
+closeConn():void
图3.Database UML设计
Apparatus
+Datas:String
+Columntitles:String
+type:int
+<<create>>Apparatus(in datas:String[][],in type:int)
+actionPerformed(in e:ActionEvent):void
图4.Apparatus UML设计
Invalid
+datas:String
+columntitles:String
+type:int
+<<create>>Invalid(in datas:String[][],in type:int)
+actionPerformed(in e:ActionEvent):void
图5.Invalid UML设计
Personcheck
-pclass:String
+columns:String
+datas:String
+<<create>>Personcheck(in data:String[][])
+actionPerformed(in e:ActionEvent):void
图6.Personcheck UML设计
Invalidupdate
+<<create>>Invalidupdate()
+actionPerformed(in e:ActionEvent):void
图7.Invalidupate UML设计
Invalidcheck
-pclass:String
+columns:String
+datas:String
+<<create>>Invalidcheck(in data:String[][])
+actionPerformed(in e:ActionEvent):void
图8.Invalidcheck UML设计
Invalidadd
-pclass:String
+<<create>>Invalidadd()
+actionPerformed(in e:ActionEvent):void
图9.Invalidadd UML设计
InvalidBean
sql:String
iname:String
sex:string
pclass: String
state:String
doctor: String
itime: String
rno: String
bno: String
Add(in name:String,in sex:String,in time:String,in plass:String,in state:String,in doctor:String,in rno:String,in bno:String):void
searchInvalidiname(in iname:String):String[]
editInvalid(in iname:String,in sex:String,in itime:String,in plass:String,in state:String,in doctor:String,in rno:String,in bno:String):void
deleteInvalid(in iname:String):void
searchAllInvalidor(in iname:String,in itime:String,in pclass:String,in state:String,in rno:String,in bno:String):String[][]
searchAllInvalidand(in iname:String,in itime:String,in pclass:String,in state:String,in rno:String,in bno:String):String[][]
getAlliname():String[]
refresh():String[][]
图10.InvalidBean UML设计
3系统实现
3.1UML类图转换成Java代码框架
① Database.Java是数据库连接,源代码如下:
public class Database {
public Database(){
}
public void OpenConn()throws Exception{
try{
}
catch(Exception e){
}
}
public ResultSet executeQuery(String sql){
}
catch(SQLException e){
}
}
public boolean executeUpdate(String sql){
}
public void closeStmt(){
}
}
public void closeConn(){
public static void main(String[]args) throws Exception
}
}
② Personframe.java为员工信息窗口的代码,可以进行查询,删除,刷新,修改,源代码如下:
public class PersonFrame extends JFrame implements ActionListener
{ private JButton button_add;
private JButton button_check;
private JButton button_delete;
private JButton button_refresh;
private JButton button_update;
private JTable table; //表格组件
private DefaultTableModel tableModel;
String datas[][];
String []columntitles={"员工号","员工姓名","性别","所在部门","身份证","生日","籍贯","国家","民族","婚姻状况","健康状况","工作时间","家庭住址","联系电话 "};
public PersonFrame(String datas[][],int type)
{
public boolean isCellEditable(int row, int column)
{
return false;}//表格不允许被编辑
};
}
@Override
public void actionPerformed(ActionEvent e) {
}
public static void main(String []args) //测试方法
{
//new PersonFrame(null,0);
}
}
③ Invalid.java是病人管理模块的代码,可以进行入院,查询,刷新和更新的操作,源代码如下:
public class Invalid extends JFrame implements ActionListener
{
private JButton button_add;
private JButton button_check;
private JButton button_edit;
private JButton button_refresh;
private JButton button_delete;
private JTable table; //表格组件
private DefaultTableModel tableModel;
String datas[][];
String []columntitles={"病人姓名","病人性别","入院时间","所属科室","病人状况","主治医生","病房号","病床号"};
public Invalid(String datas[][], int type)
{
public boolean isCellEditable(int row, int column)
{
return false;}//表格不允许被编辑
};
}
@Override
public void actionPerformed(ActionEvent e) {
}
public static void main(String []args) //测试方法
{
//new Invalid(null,0);
}
}
④ Apparatus.java是对仪器进行管理,源代码如下:
public class Apparatus extends JFrame implements ActionListener
{
private JButton button_add;
private JButton button_check;
private JButton button_edit;
private JButton button_refresh;
private JButton button_delete;
private JTable table; //表格组件
private DefaultTableModel tableModel;
String datas[][];
String []columntitles={"仪器代号","仪器名称","仪器价格","仪器数量","备注"};
int type;
public Apparatus(String datas[][],int type)
{
public boolean isCellEditable(int row, int column)
{
return false;}//表格不允许被编辑
};
}
@Override
public void actionPerformed(ActionEvent e) {
public static void main(String []args) //测试方法
{
new Apparatus(null,0);
}
}
⑤ Stuff.java是药剂管理,可以查询库存药品的信息,源代码如下:
public class Stuff extends JFrame implements ActionListener
{ private JButton button_add;
private JButton button_check;
private JButton button_edit;
private JButton button_refresh;
private JButton button_delete;
private JTable table; //表格组件
private DefaultTableModel tableModel;
String datas[][];
String []columntitles={"药剂代号","药剂名称","药剂价格","储存量","备注"};
int type;
public Stuff(String datas[][],int type)
{
}
@Override
public void actionPerformed(ActionEvent e) {
}
public static void main(String []args) //测试方法
{
new Stuff(null,0);
}
}
⑥ Pay.Java是对员工工资进行管理录入的操作,源代码如下:
public class Pay extends JFrame implements ActionListener
{ private JButton button_add;
private JButton button_check;
private JButton button_edit;
private JButton button_refresh;
private JButton button_delete;
private JTable table; //表格组件
private DefaultTableModel tableModel;
String datas[][];
String []columntitles={"员工号","工资等级","工资总额"}
public Pay(String datas[][])
{
}
@Override
public void actionPerformed(ActionEvent e) {
}
public static void main(String []args) //测试方法
{
new Pay(null);
}
}
⑦ Bed.java是对医院病床进行管理,显示病房及病床的使用信息,源代码如下:
Public class Bed extends JFrame implements ActionListener
{ private JButton button_add;
private JButton button_check;
private JButton button_refresh;
private JButton button_delete;
private JTable table; //表格组件
private DefaultTableModel tableModel;
String datas[][];
String []columntitles={"病床号","病房号","状态"};
public Bed(String datas[][])
{
public boolean isCellEditable(int row, int column)
{ return false;}//表格不允许被编辑
};
}
@Override
public void actionPerformed(ActionEvent e) {
}
public static void main(String []args) //测试方法
{
new Bed(null);
}
3.2添加表示层,实现交互功能
3.2.1Login类
系统的用户有管理员、医生,因此,在进入主界面之前,应该先弹出登录界面,要求用户输入用户编号(姓名可能重名)和登录口令,以验证用户身份。因此,我们首先需要设计一个登录界面——Login类。
设计思路:实现界面外观,添加交互功能。登录过程中需要进行用户ID与密码的验证。
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Login extends JFrame implements ActionListener
{
private JLabel user,password;
private JTextField text_user; //用户名文本行
private JPasswordField text_password; //密码文本行
private JButton button_ok,button_cancel;
private JComboBox typeBox;
JLabel jlabel;
public boolean isLogin=false; //判断登录是否成功
public Login()
{ super("用户登录");
this.setSize(240,150);
this.setLocation(550,200);
this.setBackground(Color.lightGray);
this.setResizable(false);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.getContentPane().setLayout(new FlowLayout());
jlabel=new JLabel("欢迎登陆医院管理信息系统 ",JLabel.CENTER);
this.getContentPane().add(jlabel);
user=new JLabel("用户名:");
user.setFont(new Font("Dialog",0,12));
this.getContentPane().add(user);
text_user = new JTextField(15);
text_user.setEditable(true);
this.getContentPane().add(text_user);
password=new JLabel("密 码:");
password.setFont(new Font("Dialog",0,12));
this.getContentPane().add(password);
text_password = new JPasswordField(15);
this.getContentPane().add(text_password);
String types[] = {"普通用户","管理员"};
typeBox = new JComboBox(types);
button_ok = new JButton("登录");
button_ok.setFont(new Font("Dialog",0,12));
this.getContentPane().add(new Label());
this.getContentPane().add(typeBox);
this.getContentPane().add(button_ok);
button_ok.addActionListener(this);
button_cancel = new JButton("取消");
button_cancel.setFont(new Font("Dialog",0,12));
this.getContentPane().add(button_cancel);
button_cancel.addActionListener(this);
this.setVisible(true);
}
public void actionPerformed(ActionEvent e) //单击事件处理方法
{ String username = text_user.getText();
String password = new String(text_password.getPassword());
if (e.getSource()==button_cancel) //单击退出按钮
{this.setVisible(false);}
else
if (username.equals(""))
JOptionPane.showMessageDialog(this, "请输入用户名");
else if (password.equals(""))
JOptionPane.showMessageDialog(this, "密码不能为空,请输入密码");
else
if (e.getSource()==button_ok) //单击登录按钮
{
LoginBean login=new LoginBean();
isLogin=login.enter(username,password);
int type = typeBox.getSelectedIndex();
if(isLogin)
{
if(login.Flag==type){
new HOSMain(type);
}else{
JOptionPane.showMessageDialog(this, "登陆身份不正确!");
return;
}
{
text_user.setText("");
text_password.setText("");
}
this.setVisible(false);
}
}
}
public void windowClosing(WindowEvent e) {}
public void windowOpened(WindowEvent e) {} //打开窗口
public void windowClosed(WindowEvent e){} //关闭窗口后
public void windowIconified(WindowEvent e) {} //窗口最小化
public void windowDeiconified(WindowEvent e) {} //窗口恢复
public void windowActivated(WindowEvent e) {} //激活窗口
public void windowDeactivated(WindowEvent e) {} //变为不活动窗口
public static void main(String args[]) throws Exception //测试方法
{new Login();
}
}
3.2.2HosMain类
HosMain类是登录完成后进入的医院管理信息系统的主界面,该界面显示了整个系统的功能模块。
代码如下:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
/**
* 系统主界面
*/
public class HOSMain extends JFrame implements ActionListener
{
Dimension faceSize = new Dimension(450, 550);
JPanel contentPane;
JButton buttonPersonFrame;
JButton buttonInvalid;
JButton buttonStuff;
JButton buttonApparatus;
JButton buttonPay;
JButton buttonBed;
JButton buttonExit;
int type;
public HOSMain(int type) {
this.type=type;
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setSize(800,500);
this.setTitle("医院管理系统");
this.setLocation(400,100);
buttonPersonFrame=new JButton("员工信息");
buttonInvalid=new JButton("病人信息");
buttonStuff=new JButton("药剂管理");
buttonApparatus=new JButton("仪器管理");
buttonPay=new JButton("工资管理");
buttonBed=new JButton("病床管理");
buttonExit=new JButton("退出系统");
JPanel panel1=new JPanel();
panel1.add(buttonPersonFrame);
JPanel panel2=new JPanel();
panel2.add(buttonInvalid);
JPanel panel3=new JPanel();
panel3.add(buttonStuff);
JPanel panel4=new JPanel();
panel4.add(buttonApparatus);
JPanel panel5=new JPanel();
panel5.add(buttonPay);
JPanel panel6=new JPanel();
panel6.add(buttonBed);
JPanel panel7=new JPanel();
panel7.add(buttonExit);
ImageIcon firstpage=new ImageIcon("abc.PNG");
this.getContentPane().setLayout(new BorderLayout());
JPanel panel = new JPanel();
panel.add(panel1);
panel.add(panel2);
panel.add(panel3);
panel.add(panel4);
panel.add(panel5);
panel.add(panel6);
panel.add(panel7);
this.getContentPane().add(panel,BorderLayout.NORTH);
this.getContentPane().add(new JLabel(firstpage),BorderLayout.CENTER);
buttonPersonFrame.addActionListener(this);
buttonInvalid.addActionListener(this);
buttonStuff.addActionListener(this);
buttonApparatus.addActionListener(this);
buttonPay.addActionListener(this);
buttonBed.addActionListener(this);
buttonExit.addActionListener(this);
//关闭程序时的操作
this.addWindowListener(
new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
this.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==buttonPersonFrame)
{
new PersonFrame(null,type);
}
if(e.getSource()==buttonInvalid)
{
new Invalid(null,type);
}
if(e.getSource()==buttonStuf
展开阅读全文