Compare commits

...

4 Commits

@ -0,0 +1,3 @@
# 默认忽略的文件
/shelf/
/workspace.xml

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/Hospital/Login.java" charset="GBK" />
<file url="file://$PROJECT_DIR$/Hospital/Login.java" charset="GBK" />
<file url="PROJECT" charset="GBK" />
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_18" project-jdk-name="18" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/Hospital-management-system-master/Hospital management system/out" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Hospital-management-system-master.iml" filepath="$PROJECT_DIR$/.idea/Hospital-management-system-master.iml" />
</modules>
</component>
</project>

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

@ -0,0 +1,3 @@
# 默认忽略的文件
/shelf/
/workspace.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_18" project-jdk-name="18" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/Hospital management system/out" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Hospital-management-system-master.iml" filepath="$PROJECT_DIR$/.idea/Hospital-management-system-master.iml" />
</modules>
</component>
</project>

@ -0,0 +1,137 @@
package Hospital;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import Instrument.Deleteinstrument;
import Instrument.Insertinstrument;
import Instrument.Showinstrument;
import Medicine.Changemedicine;
import Medicine.Selectmedicine;
public class Wininstrument {
private JFrame frame;
/**
* Launch the application.
*/
public static void start() {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Wininstrument window = new Wininstrument();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Wininstrument() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u533B\u7597\u4EEA\u5668\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(0, 69, 784, 424);
frame.getContentPane().add(scrollPane);
JTextArea textArea = new JTextArea();
textArea.setFont(new Font("Monospaced", Font.PLAIN, 20));
scrollPane.setViewportView(textArea);
textArea.append("进入医疗仪器管理系统\n");
JButton btnNewButton = new JButton("\u589E\u52A0\u4EEA\u5668");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Insertinstrument.start();
textArea.append("增加医疗仪器成功\n");
}
});
btnNewButton.setBounds(0, 0, 131, 70);
JButton button = new JButton("\u5220\u9664\u4EEA\u5668");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Deleteinstrument.start();
textArea.append("删除仪器成功\n");
}
});
button.setBounds(129, 0, 131, 70);
JButton button_1 = new JButton("\u4FEE\u6539\u4EEA\u5668");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Changemedicine.start();
textArea.append("修改药品成功\n");
}
});
button_1.setBounds(259, 0, 131, 70);
JButton button_2 = new JButton("\u67E5\u8BE2\u4EEA\u5668");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Selectmedicine.start();
textArea.append("查询药品成功\n");
}
});
button_2.setBounds(389, 0, 131, 70);
JButton button_3 = new JButton("\u663E\u793A\u4EEA\u5668");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Showinstrument.start();
textArea.append("显示药品成功\n");
}
});
button_3.setBounds(519, 0, 131, 70);
JButton button_4 = new JButton("\u8FD4\u56DE\u4E3B\u83DC\u5355");
button_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
index.start();
}
});
button_4.setBounds(649, 0, 131, 70);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(button);
frame.getContentPane().add(button_1);
frame.getContentPane().add(button_2);
frame.getContentPane().add(button_3);
frame.getContentPane().add(button_4);
}
}

@ -0,0 +1,132 @@
package rootman;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import Hospital.index;
public class wintwo {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
wintwo window = new wintwo();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public wintwo() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u5458\u5DE5\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(0, 69, 784, 424);
frame.getContentPane().add(scrollPane);
JTextArea textArea = new JTextArea();
textArea.setFont(new Font("Monospaced", Font.PLAIN, 20));
scrollPane.setViewportView(textArea);
textArea.append("进入员工工资管理系统\n");
JButton btnNewButton = new JButton("\u589E\u52A0\u5458\u5DE5\u5DE5\u8D44");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Wininserttwo.start();
textArea.append("增加员工工资成功\n");
}
});
btnNewButton.setBounds(0, 0, 131, 70);
JButton button = new JButton("\u5220\u9664\u5458\u5DE5\u5DE5\u8D44");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Windeleteone.start();
textArea.append("删除员工成功\n");
}
});
button.setBounds(129, 0, 131, 70);
JButton button_1 = new JButton("\u4FEE\u6539\u5458\u5DE5\u5DE5\u8D44");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winchangeone.start();
textArea.append("员工信息修改成功\n");
}
});
button_1.setBounds(259, 0, 131, 70);
JButton button_2 = new JButton("\u67E5\u8BE2\u5458\u5DE5\u5DE5\u8D44");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winselectone.start();
textArea.append("查询员工信息成功\n");
}
});
button_2.setBounds(389, 0, 131, 70);
JButton button_3 = new JButton("\u663E\u793A\u5458\u5DE5\u5DE5\u8D44");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
WinShowtwo.start();
textArea.append("显示员工工资成功\n");
}
});
button_3.setBounds(519, 0, 131, 70);
JButton button_4 = new JButton("\u8FD4\u56DE\u4E3B\u83DC\u5355");
button_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
index.start();
}
});
button_4.setBounds(649, 0, 131, 70);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(button);
frame.getContentPane().add(button_1);
frame.getContentPane().add(button_2);
frame.getContentPane().add(button_3);
frame.getContentPane().add(button_4);
}
}

@ -0,0 +1,137 @@
package jobs;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import Hospital.index;
import rootman.WinShowone;
import rootman.Winchangeone;
import rootman.Windeleteone;
import rootman.Wininsertone;
import rootman.Winselectone;
public class Winjobs {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winjobs window = new Winjobs();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winjobs() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u5C97\u4F4D\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(0, 69, 784, 424);
frame.getContentPane().add(scrollPane);
JTextArea textArea = new JTextArea();
textArea.setFont(new Font("Monospaced", Font.PLAIN, 20));
scrollPane.setViewportView(textArea);
textArea.append("进入员工管理系统\n");
JButton btnNewButton = new JButton("\u589E\u52A0\u5C97\u4F4D");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Wininsertone.start();
textArea.append("增加员工成功\n");
}
});
btnNewButton.setBounds(0, 0, 131, 70);
JButton button = new JButton("\u5220\u9664\u5C97\u4F4D");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Windeleteone.start();
textArea.append("删除员工成功\n");
}
});
button.setBounds(129, 0, 131, 70);
JButton button_1 = new JButton("\u4FEE\u6539\u5C97\u4F4D");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winchangeone.start();
textArea.append("员工信息修改成功\n");
}
});
button_1.setBounds(259, 0, 131, 70);
JButton button_2 = new JButton("\u67E5\u8BE2\u5C97\u4F4D");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winselectone.start();
textArea.append("查询员工信息成功\n");
}
});
button_2.setBounds(389, 0, 131, 70);
JButton button_3 = new JButton("\u663E\u793A\u6240\u6709\u5C97\u4F4D");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
WinShowone.start();
textArea.append("显示员工信息成功\n");
}
});
button_3.setBounds(519, 0, 131, 70);
JButton button_4 = new JButton("\u8FD4\u56DE\u4E3B\u83DC\u5355");
button_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
index.start();
}
});
button_4.setBounds(649, 0, 131, 70);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(button);
frame.getContentPane().add(button_1);
frame.getContentPane().add(button_2);
frame.getContentPane().add(button_3);
frame.getContentPane().add(button_4);
}
}

@ -0,0 +1,138 @@
package Hospital;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import java.sql.SQLException;
import javax.swing.JFrame;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JPasswordField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Login {
private JFrame frame;
private JTextField textField;
private JPasswordField passwordField;
public static void main(String[] args) throws SQLException {
new Link();
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Login window = new Login();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Login() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u7528\u6237\u767B\u5F55\u754C\u9762");
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JLabel label = new JLabel("\u7528\u6237\u540D\uFF1A");
label.setFont(new Font("宋体", Font.PLAIN, 18));
JLabel label_1 = new JLabel("\u5BC6 \u7801\uFF1A");
label_1.setFont(new Font("宋体", Font.PLAIN, 18));
textField = new JTextField();
textField.setColumns(10);
passwordField = new JPasswordField();
JButton button = new JButton("\u767B\u5F55");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String username=textField.getText().trim();
char[] p=passwordField.getPassword();
String userpsd=new String(p);
if(Logins.identify(username,userpsd)==1) {
System.out.println("登陆成功");
frame.dispose();
}
}
});
JButton button_1 = new JButton("\u9000\u51FA");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(54)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)
.addGap(3)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 208, GroupLayout.PREFERRED_SIZE))
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label_1, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)
.addGap(3)
.addComponent(passwordField, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)))
.addContainerGap(93, Short.MAX_VALUE))
.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
.addContainerGap(186, Short.MAX_VALUE)
.addComponent(button, GroupLayout.PREFERRED_SIZE, 102, GroupLayout.PREFERRED_SIZE)
.addGap(15)
.addComponent(button_1, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE)
.addGap(25))
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(63)
.addComponent(label, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
.addGap(11)
.addComponent(label_1, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addGap(135))
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap(66, Short.MAX_VALUE)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addGap(11)
.addComponent(passwordField, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addGap(73)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(button_1, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE)
.addComponent(button, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE))
.addGap(19))
);
frame.getContentPane().setLayout(groupLayout);
}
}

@ -0,0 +1,109 @@
package jobs;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
public class Windeletejobs {
private JFrame frame;
private JTextField textField;
private JTextField textField_1;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Windeletejobs window = new Windeletejobs();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Windeletejobs() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u5C97\u4F4D\u7BA1\u7406");
frame.setBounds(100, 100, 870, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
JLabel label = new JLabel("\u4F60\u9700\u8981\u589E\u52A0\u7684\u5C97\u4F4D\u4FE1\u606F\uFF1A");
label.setBounds(10, 10, 506, 115);
label.setFont(new Font("宋体", Font.PLAIN, 30));
JLabel label_1 = new JLabel("\u5DE5\u4F5C\u5C97\u4F4D\u4EE3\u53F7\uFF1A");
label_1.setBounds(12, 157, 196, 75);
label_1.setFont(new Font("宋体", Font.PLAIN, 28));
frame.getContentPane().setLayout(null);
frame.getContentPane().add(label);
frame.getContentPane().add(label_1);
textField = new JTextField();
textField.setBounds(218, 176, 185, 36);
frame.getContentPane().add(textField);
textField.setColumns(10);
JButton btnNewButton = new JButton("\u786E\u5B9A");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String Num = textField.getText();
String Name = textField_1.getText();
Insertjobs.insert(Num, Name);
frame.dispose();
}
});
btnNewButton.setBounds(548, 385, 116, 70);
frame.getContentPane().add(btnNewButton);
JButton button = new JButton("\u91CD\u7F6E");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
textField_1.setText("");
}
});
button.setBounds(700, 385, 116, 70);
frame.getContentPane().add(button);
textField_1 = new JTextField();
textField_1.setColumns(10);
textField_1.setBounds(218, 282, 185, 36);
frame.getContentPane().add(textField_1);
JLabel label_2 = new JLabel("\u5DE5\u4F5C\u5C97\u4F4D\u540D\u79F0\uFF1A");
label_2.setFont(new Font("宋体", Font.PLAIN, 28));
label_2.setBounds(12, 264, 196, 75);
frame.getContentPane().add(label_2);
}
}

@ -0,0 +1,66 @@
package Hospital;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.BorderLayout;
public class three {
private JFrame frame;
/**
* Launch the application.
*/
public static void start() {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
three window = new three();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public three() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u836F\u54C1\u548C\u4EEA\u5668");
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
frame.getContentPane().setLayout(null);
JButton btnNewButton = new JButton("\u836F\u54C1\u7BA1\u7406");
btnNewButton.setBounds(0, 0, 221, 261);
frame.getContentPane().add(btnNewButton);
JButton btnNewButton_1 = new JButton("\u4EEA\u5668\u7BA1\u7406");
btnNewButton_1.setBounds(218, 0, 216, 261);
frame.getContentPane().add(btnNewButton_1);
}
}

@ -0,0 +1,31 @@
package Inpatient;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.JOptionPane;
public class Insert2 extends Insertinpatient {
public static void insert(String Name, String Sex, String Time, String Department, String Condition, String Doctor, String Room, String Bed) {
String sql_url = "jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=Hospital table";
String name = "sa"; // 用户名
String password = "wu123456"; // 密码
Connection conn;
PreparedStatement preparedStatement = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); // 连接驱动
conn = DriverManager.getConnection(sql_url, name, password); // 连接数据库
preparedStatement = conn.prepareStatement("insert into 病人信息表 (病人姓名,病人性别,入院时间,病人所属科室,病人状况,病人主治医生,病人房间号,病人床位号) values ('" + Name + "','"
+ Sex + "','" + Time + "','" + Department + "','" + Condition +"','"+ Doctor +"','"+ Room +"','"+ Bed + "')");
ResultSet result1 = preparedStatement.executeQuery();
if (result1.wasNull())
JOptionPane.showMessageDialog(null, "结果集中无记录");
} catch (ClassNotFoundException e) {
} catch (SQLException e) {
}
}
}

@ -0,0 +1,81 @@
package user;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import rootman.Selectone;
public class Winusershow2 {
static String username;
public static void getname(String s) {
username=s;
}
private JFrame frame;
private JTable table;
/**
* Launch the application.
*/
public static void start() {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winusershow2 window = new Winusershow2();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winusershow2() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u4E2A\u4EBA\u5DE5\u8D44\u67E5\u8BE2");
frame.setBounds(100, 100, 800, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
frame.getContentPane().setLayout(null);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(-1, 0, 789, 483);
frame.getContentPane().add(scrollPane);
String[] dataTitle =Selectone.getHead();
table = new JTable();
scrollPane.setViewportView(table);
String[][] data=Selecttwo.getnumber(username);
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
}
}

@ -0,0 +1,63 @@
package Hospital;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Link extends Login {
static final Statement DBConnection = null;
static String urlSqlServer = "jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=Hospital table";
static String name = "sa"; //用户名
static String password = "wu123456"; //密码
static Connection connection = null;
public Link() throws SQLException {
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
} catch (ClassNotFoundException e1) {
System.out.println(e1.getMessage());
}
try {
connection = DriverManager.getConnection(urlSqlServer, name, password);
} catch (SQLException e) {
System.out.println(e.getMessage());
}
System.out.println("sqlserver 数据库驱动加载成功");
}
public static int identify(String username,String userpsd) {
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection con = DBConnection.getConnection();
Statement stmt = con.createStatement();
String sql="select * from 系统的用户口令表";
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()) {
String username1=rs.getString(1);
String userpsd1=rs.getString(2);
System.out.println(username);
System.out.println(userpsd);
System.out.println(username1);
System.out.println(userpsd1);
if(username.equals(username1)&&userpsd.equals(userpsd1)) {
return 1;
}
}
}catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
System.out.println("未成功加载驱动。");
e.printStackTrace();
}catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println("未成功打开数据库。");
e.printStackTrace();
}
return 0;
}
}

@ -0,0 +1,31 @@
package Inpatient;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.JOptionPane;
public class Insert2 extends Insertinpatient {
public static void insert(String Name, String Sex, String Time, String Department, String Condition, String Doctor, String Room, String Bed) {
String sql_url = "jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=Hospital table";
String name = "sa"; // 用户名
String password = "wu123456"; // 密码
Connection conn;
PreparedStatement preparedStatement = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); // 连接驱动
conn = DriverManager.getConnection(sql_url, name, password); // 连接数据库
preparedStatement = conn.prepareStatement("insert into 病人信息表 (病人姓名,病人性别,入院时间,病人所属科室,病人状况,病人主治医生,病人房间号,病人病床号) values ('" + Name + "','"
+ Sex + "','" + Time + "','" + Department + "','" + Condition +"','"+ Doctor +"','"+ Room +"','"+ Bed + "')");
ResultSet result1 = preparedStatement.executeQuery();
if (result1.wasNull())
JOptionPane.showMessageDialog(null, "结果集中无记录");
} catch (ClassNotFoundException e) {
} catch (SQLException e) {
}
}
}

@ -0,0 +1,79 @@
package rootman;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import Hospital.two;
public class Winthree {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winthree window = new Winthree();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winthree() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u5C97\u4F4D/\u90E8\u95E8\u7BA1\u7406");
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JButton btnNewButton = new JButton("\u5C97\u4F4D\u7BA1\u7406");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winjobs.start();
frame.dispose();
}
});
btnNewButton.setBounds(0, 0, 225, 261);
JButton btnNewButton_1 = new JButton("\u90E8\u95E8\u7BA1\u7406");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
}
});
btnNewButton_1.setBounds(224, 0, 212, 261);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(btnNewButton_1);
}
}

@ -0,0 +1,138 @@
package Hospital;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import java.sql.SQLException;
import javax.swing.JFrame;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JPasswordField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Login {
private JFrame frame;
private JTextField textField;
private JPasswordField passwordField;
public static void main(String[] args) throws SQLException {
new Link();
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Login window = new Login();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Login() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u7528\u6237\u767B\u5F55\u754C\u9762");
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JLabel label = new JLabel("\u7528\u6237\u540D\uFF1A");
label.setFont(new Font("宋体", Font.PLAIN, 18));
JLabel label_1 = new JLabel("\u5BC6 \u7801\uFF1A");
label_1.setFont(new Font("宋体", Font.PLAIN, 18));
textField = new JTextField();
textField.setColumns(10);
passwordField = new JPasswordField();
JButton button = new JButton("\u767B\u5F55");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String username=textField.getText().trim();
char[] p=passwordField.getPassword();
String userpsd=new String(p);
// if(Link.identify(username,userpsd)==1) {
// System.out.println("登陆成功");
// frame.dispose();
// }
}
});
JButton button_1 = new JButton("\u9000\u51FA");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(54)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)
.addGap(3)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 208, GroupLayout.PREFERRED_SIZE))
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label_1, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)
.addGap(3)
.addComponent(passwordField, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)))
.addContainerGap(93, Short.MAX_VALUE))
.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
.addContainerGap(186, Short.MAX_VALUE)
.addComponent(button, GroupLayout.PREFERRED_SIZE, 102, GroupLayout.PREFERRED_SIZE)
.addGap(15)
.addComponent(button_1, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE)
.addGap(25))
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(63)
.addComponent(label, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
.addGap(11)
.addComponent(label_1, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addGap(135))
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap(66, Short.MAX_VALUE)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addGap(11)
.addComponent(passwordField, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addGap(73)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(button_1, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE)
.addComponent(button, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE))
.addGap(19))
);
frame.getContentPane().setLayout(groupLayout);
}
}

@ -0,0 +1,32 @@
package Hospital;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Link extends Login {
Connection connection = null;
public Link() throws SQLException {
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
} catch (ClassNotFoundException e1) {
System.out.println(e1.getMessage());
}
// 接下来DriverManager试图从已注册的JDBC驱动程序集中选择一个适当的驱动程序。
// sqlserver 数据库 url
String urlSqlServer = "jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=Hospital table";
// sqlserver 数据库
@SuppressWarnings("unused")
Connection connection = null;
try {
connection = DriverManager.getConnection(urlSqlServer, "sa", "wu123456");
} catch (SQLException e) {
System.out.println(e.getMessage());
}
System.out.println("sqlserver 数据库驱动加载成功");
}
}

@ -0,0 +1,116 @@
package user;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import javax.swing.JOptionPane;
public class Usershow extends Winusershow {
static String username="GC001";
/* public static void getname(String s) {
username=s;
}*/
static int max=500;
public static String[][] getRows(){
String sql_url = "jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=Hospital table";
String name = "sa"; //用户名
String password = "wu123456"; //密码
Connection conn;
PreparedStatement preparedStatement = null;
String[][] rows = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //连接驱动
conn = DriverManager.getConnection(sql_url, name, password); //连接数据库
preparedStatement = conn.prepareStatement("select * from 员工基本状况表");
ResultSet result1 = preparedStatement.executeQuery();
if(result1.wasNull())
JOptionPane.showMessageDialog(null, "结果集中无记录");
rows = new String[max][19];
String[] s = null;
s = new String[19];
ResultSetMetaData rsmd = result1.getMetaData();
int i=0;
while(result1.next()){
s=getNextRow(result1,rsmd);
for(int p=0;p<19;p++)
{
rows[i][p]=s[p].trim();
}
i++;
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
System.out.println("未成功加载驱动。");
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println("未成功打开数据库。");
e.printStackTrace();
}
return rows;
}
// 得到数据库表头
public static String[] getHead(){
String sql_url = "jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=Hospital table"; //数据库路径一般都是这样写test是数据库名称
String name = "sa"; //用户名
String password = "wu123456"; //密码
Connection conn;
PreparedStatement preparedStatement = null;
String[] columnHeads = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //连接驱动
conn = DriverManager.getConnection(sql_url, name, password); //连接数据库
// if(!conn.isClosed())
// System.out.println("成功连接数据库");
preparedStatement = conn.prepareStatement("select * from 员工基本状况表");
ResultSet result1 = preparedStatement.executeQuery();
boolean moreRecords = result1.next();
if(!moreRecords)
JOptionPane.showMessageDialog(null, "结果集中无记录");
columnHeads = new String[19];
ResultSetMetaData rsmd = result1.getMetaData();
for(int i = 1; i <= rsmd.getColumnCount(); i++)
columnHeads[i-1]=rsmd.getColumnName(i).trim();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
System.out.println("未成功加载驱动。");
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println("未成功打开数据库。");
e.printStackTrace();
}
return columnHeads;
}
// 得到数据库中下一行数据
private static String[] getNextRow(ResultSet rs,ResultSetMetaData rsmd) throws SQLException{
String[] currentRow = null;
currentRow = new String[19];
for(int i = 1; i <= rsmd.getColumnCount(); i++){
{
currentRow[i-1]=rs.getString(i).trim();
//System.out.println(currentRow[i-1]+" "+(i-1));
}
}
return currentRow;
}
}

@ -0,0 +1,119 @@
package Hospital;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Winmedicine {
private JFrame frame;
private JTextField textField;
/**
* Launch the application.
*/
public static void start() {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winmedicine window = new Winmedicine();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winmedicine() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u836F\u54C1\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JButton btnNewButton = new JButton("\u589E\u52A0\u836F\u54C1");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
btnNewButton.setBounds(0, 0, 131, 70);
JButton button = new JButton("\u5220\u9664\u836F\u54C1");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
button.setBounds(129, 0, 131, 70);
JButton button_1 = new JButton("\u4FEE\u6539\u836F\u54C1");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
button_1.setBounds(259, 0, 131, 70);
JButton button_2 = new JButton("\u67E5\u8BE2\u836F\u54C1");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
button_2.setBounds(389, 0, 131, 70);
JButton button_3 = new JButton("\u663E\u793A\u836F\u54C1");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
button_3.setBounds(519, 0, 131, 70);
JButton button_4 = new JButton("\u8FD4\u56DE\u4E3B\u83DC\u5355");
button_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
index.start();
}
});
button_4.setBounds(649, 0, 131, 70);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(button);
frame.getContentPane().add(button_1);
frame.getContentPane().add(button_2);
frame.getContentPane().add(button_3);
frame.getContentPane().add(button_4);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(0, 69, 784, 424);
frame.getContentPane().add(scrollPane);
textField = new JTextField();
scrollPane.setViewportView(textField);
textField.setColumns(10);
}
}

@ -0,0 +1,43 @@
package Inpatient;
import java.awt.EventQueue;
import javax.swing.JFrame;
public class Selectinpatient {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Selectinpatient window = new Selectinpatient();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Selectinpatient() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

@ -0,0 +1,132 @@
package jobs;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import Hospital.index;
public class Winjobs {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winjobs window = new Winjobs();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winjobs() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u5C97\u4F4D\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(0, 69, 784, 424);
frame.getContentPane().add(scrollPane);
JTextArea textArea = new JTextArea();
textArea.setFont(new Font("Monospaced", Font.PLAIN, 20));
scrollPane.setViewportView(textArea);
textArea.append("进入岗位信息管理系统\n");
JButton btnNewButton = new JButton("\u589E\u52A0\u5C97\u4F4D");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Wininsertjobs.start();
textArea.append("增加岗位信息成功\n");
}
});
btnNewButton.setBounds(0, 0, 131, 70);
JButton button = new JButton("\u5220\u9664\u5C97\u4F4D");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Windeletejobs.start();
textArea.append("删除岗位信息成功\n");
}
});
button.setBounds(129, 0, 131, 70);
JButton button_1 = new JButton("\u4FEE\u6539\u5C97\u4F4D");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winchangejobs.start();
textArea.append("岗位信息修改成功\n");
}
});
button_1.setBounds(259, 0, 131, 70);
JButton button_2 = new JButton("\u67E5\u8BE2\u5C97\u4F4D");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winselectjobs.start();
textArea.append("查询岗位信息成功\n");
}
});
button_2.setBounds(389, 0, 131, 70);
JButton button_3 = new JButton("\u663E\u793A\u6240\u6709\u5C97\u4F4D");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winshowjobs.start();
textArea.append("显示岗位信息成功\n");
}
});
button_3.setBounds(519, 0, 131, 70);
JButton button_4 = new JButton("\u8FD4\u56DE\u4E3B\u83DC\u5355");
button_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
index.start();
}
});
button_4.setBounds(649, 0, 131, 70);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(button);
frame.getContentPane().add(button_1);
frame.getContentPane().add(button_2);
frame.getContentPane().add(button_3);
frame.getContentPane().add(button_4);
}
}

@ -0,0 +1,123 @@
package Medicine;
import java.sql.SQLException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import javax.swing.JOptionPane;
public class Show extends Showmedicine {
static int max=500;
public static String[][] getRows(){
String sql_url = "jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=Student"; //数据库路径一般都是这样写test是数据库名称
String name = "sa"; //用户名
String password = "wu123456"; //密码
Connection conn;
PreparedStatement preparedStatement = null;
String[][] rows = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //连接驱动
conn = DriverManager.getConnection(sql_url, name, password); //连接数据库
preparedStatement = conn.prepareStatement("select * from Student");
ResultSet result1 = preparedStatement.executeQuery();
if(result1.wasNull())
JOptionPane.showMessageDialog(null, "结果集中无记录");
rows = new String[max][5];
String[] s = null;
s = new String[5];
ResultSetMetaData rsmd = result1.getMetaData();
int i=0;
while(result1.next()){
s=getNextRow(result1,rsmd);
for(int p=0;p<5;p++)
{
rows[i][p]=s[p].trim();
// System.out.println(rows[i][p]+" "+i+" "+p);
}
i++;
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
System.out.println("未成功加载驱动。");
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println("未成功打开数据库。");
e.printStackTrace();
}
return rows;
}
// 得到数据库表头
public static String[] getHead(){
String sql_url = "jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=Student"; //数据库路径一般都是这样写test是数据库名称
String name = "sa"; //用户名
String password = "wu123456"; //密码
Connection conn;
PreparedStatement preparedStatement = null;
String[] columnHeads = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //连接驱动
conn = DriverManager.getConnection(sql_url, name, password); //连接数据库
// if(!conn.isClosed())
// System.out.println("成功连接数据库");
preparedStatement = conn.prepareStatement("select * from Student");
ResultSet result1 = preparedStatement.executeQuery();
boolean moreRecords = result1.next();
if(!moreRecords)
JOptionPane.showMessageDialog(null, "结果集中无记录");
columnHeads = new String[5];
ResultSetMetaData rsmd = result1.getMetaData();
for(int i = 1; i <= rsmd.getColumnCount(); i++)
columnHeads[i-1]=rsmd.getColumnName(i).trim();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
System.out.println("未成功加载驱动。");
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println("未成功打开数据库。");
e.printStackTrace();
}
return columnHeads;
}
// 得到数据库中下一行数据
private static String[] getNextRow(ResultSet rs,ResultSetMetaData rsmd) throws SQLException{
String[] currentRow = null;
currentRow = new String[5];
for(int i = 1; i <= rsmd.getColumnCount(); i++){
{
currentRow[i-1]=rs.getString(i).trim();
//System.out.println(currentRow[i-1]+" "+(i-1));
}
}
return currentRow;
}
/* public static void main(String[] args){
//System.out.println(getHead());
getRows();
}*/
}

@ -0,0 +1,109 @@
package rootman;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
public class Winchangetwo {
private JFrame frame;
private JTextField textField;
private JTextField textField_1;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winchangetwo window = new Winchangetwo();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winchangetwo() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u5458\u5DE5\u7BA1\u7406");
frame.setBounds(100, 100, 870, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
JLabel label = new JLabel("\u4F60\u9700\u8981\u589E\u52A0\u7684\u5458\u5DE5\u5DE5\u8D44\u4FE1\u606F\uFF1A");
label.setBounds(10, 10, 506, 115);
label.setFont(new Font("宋体", Font.PLAIN, 30));
JLabel label_1 = new JLabel("\u5458\u5DE5\u53F7\uFF1A");
label_1.setBounds(13, 147, 130, 75);
label_1.setFont(new Font("宋体", Font.PLAIN, 28));
JLabel label_2 = new JLabel("\u5DE5\u8D44\uFF1A");
label_2.setBounds(18, 268, 89, 75);
label_2.setFont(new Font("宋体", Font.PLAIN, 28));
frame.getContentPane().setLayout(null);
frame.getContentPane().add(label);
frame.getContentPane().add(label_1);
frame.getContentPane().add(label_2);
textField = new JTextField();
textField.setBounds(139, 169, 185, 28);
frame.getContentPane().add(textField);
textField.setColumns(10);
textField_1 = new JTextField();
textField_1.setColumns(10);
textField_1.setBounds(141, 296, 185, 28);
frame.getContentPane().add(textField_1);
JButton btnNewButton = new JButton("\u786E\u5B9A");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String Num = textField.getText();
String Money = textField_1.getText();
Inserttwo.insert(Num, Money);
frame.dispose();
}
});
btnNewButton.setBounds(548, 385, 116, 70);
frame.getContentPane().add(btnNewButton);
JButton button = new JButton("\u91CD\u7F6E");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
textField_1.setText("");
}
});
button.setBounds(700, 385, 116, 70);
frame.getContentPane().add(button);
}
}

@ -0,0 +1,43 @@
package rootman;
import java.awt.EventQueue;
import javax.swing.JFrame;
public class Wininserttwo {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Wininserttwo window = new Wininserttwo();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Wininserttwo() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

@ -0,0 +1,76 @@
package user;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTable;
public class Winusershow {
private JFrame frame;
private JTable table;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winusershow window = new Winusershow();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winusershow() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u4E2A\u4EBA\u4FE1\u606F\u67E5\u8BE2");
frame.setBounds(100, 100, 800, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
frame.getContentPane().setLayout(null);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(-1, 0, 789, 483);
frame.getContentPane().add(scrollPane);
table = new JTable();
scrollPane.setViewportView(table);
}
}

@ -0,0 +1,134 @@
package Hospital;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import java.sql.SQLException;
import javax.swing.JFrame;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JPasswordField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Login {
private JFrame frame;
private JTextField textField;
private JPasswordField passwordField;
public static void main(String[] args) throws SQLException {
new Link();
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Login window = new Login();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Login() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u7528\u6237\u767B\u5F55\u754C\u9762");
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JLabel label = new JLabel("\u7528\u6237\u540D\uFF1A");
label.setFont(new Font("宋体", Font.PLAIN, 18));
JLabel label_1 = new JLabel("\u5BC6 \u7801\uFF1A");
label_1.setFont(new Font("宋体", Font.PLAIN, 18));
textField = new JTextField();
textField.setColumns(10);
passwordField = new JPasswordField();
JButton button = new JButton("\u767B\u5F55");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String username=textField.getText().trim();
frame.dispose();
}
});
JButton button_1 = new JButton("\u9000\u51FA");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(54)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)
.addGap(3)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 208, GroupLayout.PREFERRED_SIZE))
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label_1, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)
.addGap(3)
.addComponent(passwordField, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)))
.addContainerGap(93, Short.MAX_VALUE))
.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
.addContainerGap(186, Short.MAX_VALUE)
.addComponent(button, GroupLayout.PREFERRED_SIZE, 102, GroupLayout.PREFERRED_SIZE)
.addGap(15)
.addComponent(button_1, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE)
.addGap(25))
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(63)
.addComponent(label, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
.addGap(11)
.addComponent(label_1, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addGap(135))
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap(66, Short.MAX_VALUE)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addGap(11)
.addComponent(passwordField, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addGap(73)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(button_1, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE)
.addComponent(button, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE))
.addGap(19))
);
frame.getContentPane().setLayout(groupLayout);
}
}

@ -0,0 +1,175 @@
package Inpatient;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import Instrument.Select1;
public class Selectinpatientbed {
private JFrame frame;
private JTextField textField;
private JTable table;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Selectinpatientbed window = new Selectinpatientbed();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Selectinpatientbed() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u533B\u7597\u4EEA\u5668\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
JLabel label = new JLabel("\u4F60\u60F3\u67E5\u8BE2\uFF1A");
label.setBounds(15, 39, 140, 37);
label.setFont(new Font("宋体", Font.PLAIN, 25));
textField = new JTextField();
textField.setBounds(140, 41, 164, 27);
textField.setColumns(10);
JComboBox<String> comboBox = new JComboBox<String>();
comboBox.setBounds(305, 41, 95, 27);
comboBox.addItem("仪器代号");
comboBox.addItem("仪器名称");
comboBox.addItem("仪器价格");
comboBox.addItem("仪器数量");
comboBox.addItem("备注");
frame.getContentPane().setLayout(null);
frame.getContentPane().add(label);
frame.getContentPane().add(textField);
frame.getContentPane().add(comboBox);
JButton button = new JButton("\u786E\u5B9A");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(frame, "查询成功!");
}
});
button.setBounds(526, 33, 95, 35);
frame.getContentPane().add(button);
JButton button_1 = new JButton("\u91CD\u7F6E");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
}
});
button_1.setBounds(636, 32, 95, 35);
frame.getContentPane().add(button_1);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(-1, 81, 789, 402);
frame.getContentPane().add(scrollPane);
table = new JTable();
scrollPane.setViewportView(table);
button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String content = textField.getText();
String[] dataTitle =Select1.getHead();
if(comboBox.getSelectedIndex() == 0)
{
// System.out.println(content);
String[][] data=Select1.getnumber(content);
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
}
else if(comboBox.getSelectedIndex() == 1)
{
// System.out.println(content);
String[][] data=Select1.getname(content);
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
}
else if(comboBox.getSelectedIndex() == 2)
{
// System.out.println(content);
String[][] data=Select1.getage(content);
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
}
else if(comboBox.getSelectedIndex() == 3)
{
// System.out.println(content);
String[][] data=Select1.getsex(content);
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
}
else if(comboBox.getSelectedIndex() == 4)
{
// System.out.println(content);
String[][] data=Select1.getdepartments(content);
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
}
}
});
}
}

@ -0,0 +1,128 @@
package Hospital;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import java.sql.SQLException;
import javax.swing.JFrame;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JButton;
import javax.swing.JPasswordField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Login {
private JFrame frame;
private JTextField textField;
private JPasswordField passwordField;
public static void main(String[] args) throws SQLException {
new Link();
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Login window = new Login();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Login() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u7528\u6237\u767B\u5F55\u754C\u9762");
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JLabel label = new JLabel("\u7528\u6237\u540D\uFF1A");
label.setFont(new Font("宋体", Font.PLAIN, 18));
JLabel label_1 = new JLabel("\u5BC6 \u7801\uFF1A");
label_1.setFont(new Font("宋体", Font.PLAIN, 18));
textField = new JTextField();
textField.setColumns(10);
JButton button = new JButton("\u767B\u5F55");
JButton button_1 = new JButton("\u9000\u51FA");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
passwordField = new JPasswordField();
GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(54)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)
.addGap(3)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 208, GroupLayout.PREFERRED_SIZE))
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label_1, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)
.addGap(3)
.addComponent(passwordField, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)))
.addContainerGap(93, Short.MAX_VALUE))
.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
.addContainerGap(186, Short.MAX_VALUE)
.addComponent(button, GroupLayout.PREFERRED_SIZE, 102, GroupLayout.PREFERRED_SIZE)
.addGap(15)
.addComponent(button_1, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE)
.addGap(25))
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(63)
.addComponent(label, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
.addGap(11)
.addComponent(label_1, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addGap(135))
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap(66, Short.MAX_VALUE)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addGap(11)
.addComponent(passwordField, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addGap(73)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(button_1, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE)
.addComponent(button, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE))
.addGap(19))
);
frame.getContentPane().setLayout(groupLayout);
}
}

@ -0,0 +1,109 @@
package jobs;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import rootman.Inserttwo;
public class Winshowjobs {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winshowjobs window = new Winshowjobs();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winshowjobs() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u5458\u5DE5\u7BA1\u7406");
frame.setBounds(100, 100, 870, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
JLabel label = new JLabel("\u4F60\u9700\u8981\u589E\u52A0\u7684\u5458\u5DE5\u5DE5\u8D44\u4FE1\u606F\uFF1A");
label.setBounds(10, 10, 506, 115);
label.setFont(new Font("宋体", Font.PLAIN, 30));
JLabel label_1 = new JLabel("\u5458\u5DE5\u53F7\uFF1A");
label_1.setBounds(13, 147, 130, 75);
label_1.setFont(new Font("宋体", Font.PLAIN, 28));
JLabel label_2 = new JLabel("\u5DE5\u8D44\uFF1A");
label_2.setBounds(18, 268, 89, 75);
label_2.setFont(new Font("宋体", Font.PLAIN, 28));
frame.getContentPane().setLayout(null);
frame.getContentPane().add(label);
frame.getContentPane().add(label_1);
frame.getContentPane().add(label_2);
textField = new JTextField();
textField.setBounds(139, 169, 185, 28);
frame.getContentPane().add(textField);
textField.setColumns(10);
textField_1 = new JTextField();
textField_1.setColumns(10);
textField_1.setBounds(141, 296, 185, 28);
frame.getContentPane().add(textField_1);
JButton btnNewButton = new JButton("\u786E\u5B9A");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String Num = textField.getText();
String Money = textField_1.getText();
Inserttwo.insert(Num, Money);
frame.dispose();
}
});
btnNewButton.setBounds(548, 385, 116, 70);
frame.getContentPane().add(btnNewButton);
JButton button = new JButton("\u91CD\u7F6E");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
textField_1.setText("");
}
});
button.setBounds(700, 385, 116, 70);
frame.getContentPane().add(button);
}
}

@ -0,0 +1,132 @@
package rootman;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import Hospital.index;
public class wintwo {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
wintwo window = new wintwo();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public wintwo() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u5458\u5DE5\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(0, 69, 784, 424);
frame.getContentPane().add(scrollPane);
JTextArea textArea = new JTextArea();
textArea.setFont(new Font("Monospaced", Font.PLAIN, 20));
scrollPane.setViewportView(textArea);
textArea.append("进入员工管理系统\n");
JButton btnNewButton = new JButton("\u589E\u52A0\u5458\u5DE5");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Wininsertone.start();
textArea.append("增加员工成功\n");
}
});
btnNewButton.setBounds(0, 0, 131, 70);
JButton button = new JButton("\u5220\u9664\u5458\u5DE5");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Windeleteone.start();
textArea.append("删除员工成功\n");
}
});
button.setBounds(129, 0, 131, 70);
JButton button_1 = new JButton("\u4FEE\u6539\u5458\u5DE5");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winchangeone.start();
textArea.append("员工信息修改成功\n");
}
});
button_1.setBounds(259, 0, 131, 70);
JButton button_2 = new JButton("\u67E5\u8BE2\u5458\u5DE5");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winselectone.start();
textArea.append("查询员工信息成功\n");
}
});
button_2.setBounds(389, 0, 131, 70);
JButton button_3 = new JButton("\u663E\u793A\u6240\u6709\u5458\u5DE5");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
WinShowone.start();
textArea.append("显示员工信息成功\n");
}
});
button_3.setBounds(519, 0, 131, 70);
JButton button_4 = new JButton("\u8FD4\u56DE\u4E3B\u83DC\u5355");
button_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
index.start();
}
});
button_4.setBounds(649, 0, 131, 70);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(button);
frame.getContentPane().add(button_1);
frame.getContentPane().add(button_2);
frame.getContentPane().add(button_3);
frame.getContentPane().add(button_4);
}
}

@ -0,0 +1,137 @@
package permissions;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import Hospital.index;
import department.Winchangedepartment;
import department.Windeletedepartment;
import department.Wininsertdepartment;
import department.Winselectdepartment;
public class Winpermissions {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winpermissions window = new Winpermissions();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winpermissions() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u6743\u9650\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(0, 69, 784, 424);
frame.getContentPane().add(scrollPane);
JTextArea textArea = new JTextArea();
textArea.setFont(new Font("Monospaced", Font.PLAIN, 20));
scrollPane.setViewportView(textArea);
textArea.append("进入权限管理系统\n");
JButton btnNewButton = new JButton("\u589E\u52A0\u6743\u9650\u7528\u6237");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Wininsertpermission.start();
textArea.append("增加权限信息成功\n");
}
});
btnNewButton.setBounds(0, 0, 131, 70);
JButton button = new JButton("\u5220\u9664\u6743\u9650\u7528\u6237");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Windeletedepartment.start();
textArea.append("删除部门信息成功\n");
}
});
button.setBounds(129, 0, 131, 70);
JButton button_1 = new JButton("\u4FEE\u6539\u6743\u9650\u7528\u6237");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winchangedepartment.start();
textArea.append("部门信息修改成功\n");
}
});
button_1.setBounds(259, 0, 131, 70);
JButton button_2 = new JButton("\u67E5\u8BE2\u6743\u9650\u7528\u6237");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winselectdepartment.start();
textArea.append("查询部门信息成功\n");
}
});
button_2.setBounds(389, 0, 131, 70);
JButton button_3 = new JButton("\u663E\u793A\u6240\u6709\u6743\u9650");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winshowpermission.start();
textArea.append("显示权限信息成功\n");
}
});
button_3.setBounds(519, 0, 131, 70);
JButton button_4 = new JButton("\u8FD4\u56DE\u4E3B\u83DC\u5355");
button_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
index.start();
}
});
button_4.setBounds(649, 0, 131, 70);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(button);
frame.getContentPane().add(button_1);
frame.getContentPane().add(button_2);
frame.getContentPane().add(button_3);
frame.getContentPane().add(button_4);
}
}

@ -0,0 +1,112 @@
package permissions;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import javax.swing.JOptionPane;
public class Showpermission extends Winshowpermission {
static int max=500;
public static String[][] getRows(){
String sql_url = "jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=Hospital table";
String name = "sa"; //用户名
String password = "wu123456"; //密码
Connection conn;
PreparedStatement preparedStatement = null;
String[][] rows = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //连接驱动
conn = DriverManager.getConnection(sql_url, name, password); //连接数据库
preparedStatement = conn.prepareStatement("select * from 部门信息表");
ResultSet result1 = preparedStatement.executeQuery();
if(result1.wasNull())
JOptionPane.showMessageDialog(null, "结果集中无记录");
rows = new String[max][4];
String[] s = null;
s = new String[4];
ResultSetMetaData rsmd = result1.getMetaData();
int i=0;
while(result1.next()){
s=getNextRow(result1,rsmd);
for(int p=0;p<4;p++)
{
rows[i][p]=s[p].trim();
}
i++;
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
System.out.println("未成功加载驱动。");
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println("未成功打开数据库。");
e.printStackTrace();
}
return rows;
}
// 得到数据库表头
public static String[] getHead(){
String sql_url = "jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=Hospital table"; //数据库路径一般都是这样写test是数据库名称
String name = "sa"; //用户名
String password = "wu123456"; //密码
Connection conn;
PreparedStatement preparedStatement = null;
String[] columnHeads = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //连接驱动
conn = DriverManager.getConnection(sql_url, name, password); //连接数据库
// if(!conn.isClosed())
// System.out.println("成功连接数据库");
preparedStatement = conn.prepareStatement("select * from 部门信息表");
ResultSet result1 = preparedStatement.executeQuery();
boolean moreRecords = result1.next();
if(!moreRecords)
JOptionPane.showMessageDialog(null, "结果集中无记录");
columnHeads = new String[4];
ResultSetMetaData rsmd = result1.getMetaData();
for(int i = 1; i <= rsmd.getColumnCount(); i++)
columnHeads[i-1]=rsmd.getColumnName(i).trim();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
System.out.println("未成功加载驱动。");
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println("未成功打开数据库。");
e.printStackTrace();
}
return columnHeads;
}
// 得到数据库中下一行数据
private static String[] getNextRow(ResultSet rs,ResultSetMetaData rsmd) throws SQLException{
String[] currentRow = null;
currentRow = new String[4];
for(int i = 1; i <= rsmd.getColumnCount(); i++){
{
currentRow[i-1]=rs.getString(i).trim();
//System.out.println(currentRow[i-1]+" "+(i-1));
}
}
return currentRow;
}
}

@ -0,0 +1,194 @@
package Instrument;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import Medicine.Insert;
public class Insertinstrument {
private JFrame frame;
private JTextField textField;
private JTextField textField_1;
private JTextField textField_2;
private JTextField textField_3;
private JTextField textField_4;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Insertinstrument window = new Insertinstrument();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Insertinstrument() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u836F\u54C1\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
JLabel lblNewLabel = new JLabel("\u4F60\u9700\u8981\u589E\u52A0\u7684\u836F\u54C1\u4E3A\uFF1A");
lblNewLabel.setFont(new Font("宋体", Font.PLAIN, 20));
JLabel label = new JLabel("\u836F\u5242\u4EE3\u53F7\uFF1A");
label.setFont(new Font("宋体", Font.PLAIN, 18));
JLabel label_1 = new JLabel("\u836F\u5242\u540D\u79F0\uFF1A");
label_1.setFont(new Font("宋体", Font.PLAIN, 18));
JLabel label_2 = new JLabel("\u836F\u5242\u4EF7\u683C\uFF1A");
label_2.setFont(new Font("宋体", Font.PLAIN, 18));
JLabel label_3 = new JLabel("\u836F\u5242\u5E93\u5B58\u6570\u91CF\uFF1A");
label_3.setFont(new Font("宋体", Font.PLAIN, 18));
JLabel label_4 = new JLabel("\u5907\u6CE8\uFF1A");
label_4.setFont(new Font("宋体", Font.PLAIN, 18));
textField = new JTextField();
textField.setColumns(10);
textField_1 = new JTextField();
textField_1.setColumns(10);
textField_2 = new JTextField();
textField_2.setColumns(10);
textField_3 = new JTextField();
textField_3.setColumns(10);
textField_4 = new JTextField();
textField_4.setColumns(10);
JButton btnNewButton = new JButton("\u786E\u5B9A");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@SuppressWarnings("unused")
String Num = textField.getText();
@SuppressWarnings("unused")
String Name = textField_1.getText();
@SuppressWarnings("unused")
String Price = textField_2.getText();
@SuppressWarnings("unused")
String Quantity = textField_3.getText();
@SuppressWarnings("unused")
String Note = textField_4.getText();
Insert.insert(Num, Name, Price, Quantity, Note);
frame.dispose();
}
});
JButton button = new JButton("\u91CD\u7F6E");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
textField_1.setText("");
textField_2.setText("");
textField_3.setText("");
textField_4.setText("");
}
});
GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(23)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 200, GroupLayout.PREFERRED_SIZE)
.addGroup(groupLayout.createSequentialGroup()
.addGap(10)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false)
.addComponent(label, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(label_1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(label_2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(label_3, GroupLayout.PREFERRED_SIZE, 147, GroupLayout.PREFERRED_SIZE)
.addComponent(label_4, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(textField_4, GroupLayout.PREFERRED_SIZE, 251, GroupLayout.PREFERRED_SIZE)
.addComponent(textField_3, GroupLayout.PREFERRED_SIZE, 251, GroupLayout.PREFERRED_SIZE)
.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, 251, GroupLayout.PREFERRED_SIZE)
.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, 251, GroupLayout.PREFERRED_SIZE)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 251, GroupLayout.PREFERRED_SIZE))))
.addContainerGap(349, Short.MAX_VALUE))
.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
.addContainerGap(474, Short.MAX_VALUE)
.addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 127, GroupLayout.PREFERRED_SIZE)
.addGap(18)
.addComponent(button, GroupLayout.PREFERRED_SIZE, 127, GroupLayout.PREFERRED_SIZE)
.addGap(38))
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(label)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(27)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(label_1, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(27)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(label_2, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE)
.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(26)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(label_3, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
.addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(27)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(label_4)
.addComponent(textField_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(58)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(button, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE)
.addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE))
.addContainerGap(23, Short.MAX_VALUE))
);
frame.getContentPane().setLayout(groupLayout);
}
}
}

@ -0,0 +1,31 @@
package Medicine;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.JOptionPane;
public class Insert extends Insertmedicine {
public static void insert(String Num, String Name, String Price, String Quantity, String Note) {
String sql_url = "jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=Hospital table"; // 数据库路径一般都是这样写test是数据库名称
String name = "sa"; // 用户名
String password = "wu123456"; // 密码
Connection conn;
PreparedStatement preparedStatement = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); // 连接驱动
conn = DriverManager.getConnection(sql_url, name, password); // 连接数据库
preparedStatement = conn.prepareStatement("insert into 药剂信息表 (药剂代号,药剂名称,药剂价格,药剂库存数量,备注) values ('" + Num + "','"
+ Name + "','" + Price + "','" + Quantity + "','" + Note + "')");
ResultSet result1 = preparedStatement.executeQuery();
if (result1.wasNull())
JOptionPane.showMessageDialog(null, "结果集中无记录");
} catch (ClassNotFoundException e) {
} catch (SQLException e) {
}
}
}

@ -0,0 +1,97 @@
package Medicine;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JComboBox;
import javax.swing.JButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
public class Selectmedicine {
private JFrame frame;
private JTextField textField;
private JTable table;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Selectmedicine window = new Selectmedicine();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Selectmedicine() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u836F\u54C1\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
JLabel label = new JLabel("\u4F60\u60F3\u67E5\u8BE2\uFF1A");
label.setBounds(15, 39, 140, 37);
label.setFont(new Font("宋体", Font.PLAIN, 25));
textField = new JTextField();
textField.setBounds(140, 41, 164, 27);
textField.setColumns(10);
JComboBox<String> comboBox = new JComboBox<String>();
comboBox.setBounds(305, 41, 95, 27);
comboBox.addItem("药剂代号");
comboBox.addItem("药剂名称");
comboBox.addItem("药剂价格");
comboBox.addItem("药剂库存数量");
comboBox.addItem("备注");
frame.getContentPane().setLayout(null);
frame.getContentPane().add(label);
frame.getContentPane().add(textField);
frame.getContentPane().add(comboBox);
JButton button = new JButton("\u786E\u5B9A");
button.setBounds(526, 33, 95, 35);
frame.getContentPane().add(button);
JButton button_1 = new JButton("\u91CD\u7F6E");
button_1.setBounds(636, 32, 95, 35);
frame.getContentPane().add(button_1);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(-1, 81, 789, 402);
frame.getContentPane().add(scrollPane);
table = new JTable();
scrollPane.setViewportView(table);
}
}

@ -0,0 +1,81 @@
package department;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import javax.swing.GroupLayout;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.GroupLayout.Alignment;
public class Winshowdepartment {
private JFrame frame;
private JTable table_1;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winshowdepartment window = new Winshowdepartment();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winshowdepartment() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u5C97\u4F4D\u7BA1\u7406");
frame.setBounds(100, 100, 870, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
JScrollPane scrollPane = new JScrollPane();
String[][] data=Showdepartment.getRows();
String[] dataTitle =Showdepartment.getHead();
table_1 = new JTable(data,dataTitle);
table_1.setFont(new Font("宋体", Font.PLAIN, 20));
table_1.setEnabled(false);
table_1.setRowHeight(25);
scrollPane.setViewportView(table_1);
GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 856, Short.MAX_VALUE)
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 473, GroupLayout.PREFERRED_SIZE)
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
frame.getContentPane().setLayout(groupLayout);
}
}

@ -0,0 +1,162 @@
package department;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
public class Winselectdepartment {
private JFrame frame;
private JTextField textField;
private JTable table;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winselectdepartment window = new Winselectdepartment();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winselectdepartment() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u5C97\u4F4D\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
JLabel label = new JLabel("\u4F60\u60F3\u67E5\u8BE2\uFF1A");
label.setBounds(15, 39, 140, 37);
label.setFont(new Font("宋体", Font.PLAIN, 25));
textField = new JTextField();
textField.setBounds(140, 41, 164, 27);
textField.setColumns(10);
JComboBox<String> comboBox = new JComboBox<String>();
comboBox.setBounds(305, 41, 118, 27);
comboBox.addItem("部门代号");
comboBox.addItem("部门名称");
comboBox.addItem("部门主任代号");
comboBox.addItem("部门副主任代号");
frame.getContentPane().setLayout(null);
frame.getContentPane().add(label);
frame.getContentPane().add(textField);
frame.getContentPane().add(comboBox);
JButton button = new JButton("\u786E\u5B9A");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(frame, "查询成功!");
}
});
button.setBounds(526, 33, 95, 35);
frame.getContentPane().add(button);
JButton button_1 = new JButton("\u91CD\u7F6E");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
}
});
button_1.setBounds(636, 32, 95, 35);
frame.getContentPane().add(button_1);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(-1, 81, 789, 402);
frame.getContentPane().add(scrollPane);
table = new JTable();
scrollPane.setViewportView(table);
button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String content = textField.getText();
String[] dataTitle =Selectdepartment.getHead();
if(comboBox.getSelectedIndex() == 0)
{
// System.out.println(content);
String[][] data=Selectdepartment.getnumber(content);
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
}
else if(comboBox.getSelectedIndex() == 1)
{
// System.out.println(content);
String[][] data=Selectdepartment.getname(content);
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
}
else if(comboBox.getSelectedIndex() == 2)
{
// System.out.println(content);
String[][] data=Selectdepartment.getage(content);
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
}
else if(comboBox.getSelectedIndex() == 3)
{
// System.out.println(content);
String[][] data=Selectdepartment.getsex(content);
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
}
}
});
}
}

@ -0,0 +1,42 @@
package Inpatient;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.JOptionPane;
public class Delete2 extends Deleteinpatient {
public static void delete(String Name) {
String sql_url = "jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=Hospital table"; // 数据库路径一般都是这样写test是数据库名称
String name = "sa"; // 用户名
String password = "wu123456"; // 密码
Connection conn;
PreparedStatement preparedStatement = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); // 连接驱动
conn = DriverManager.getConnection(sql_url, name, password); // 连接数据库
preparedStatement = conn.prepareStatement("delete from 病人信息表 where 病人姓名='"+Name+"'");
ResultSet result1 = preparedStatement.executeQuery();
if (result1.wasNull())
JOptionPane.showMessageDialog(null, "结果集中无记录");
} catch (ClassNotFoundException e) {
} catch (SQLException e) {
}
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //连接驱动
conn = DriverManager.getConnection(sql_url, name, password); //连接数据库
preparedStatement = conn.prepareStatement("update 床位信息表 set 床位号 = '"+Bed+"', 床位状态 ='有人' where 床位号 = '"+Bed+"'");
ResultSet result1 = preparedStatement.executeQuery();
if(result1.wasNull())
JOptionPane.showMessageDialog(null, "结果集中无记录");
} catch (ClassNotFoundException e) {
} catch (SQLException e) {
}
}
}

@ -0,0 +1,43 @@
package Inpatient;
import java.awt.EventQueue;
import javax.swing.JFrame;
public class Showinpatientbed {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Showinpatientbed window = new Showinpatientbed();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Showinpatientbed() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

@ -0,0 +1,138 @@
package rootman;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
public class Winselecttwo {
private JFrame frame;
private JTextField textField;
private JTable table;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winselecttwo window = new Winselecttwo();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winselecttwo() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u5458\u5DE5\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
JLabel label = new JLabel("\u4F60\u60F3\u67E5\u8BE2\uFF1A");
label.setBounds(15, 39, 140, 37);
label.setFont(new Font("宋体", Font.PLAIN, 25));
textField = new JTextField();
textField.setBounds(140, 41, 164, 27);
textField.setColumns(10);
JComboBox<String> comboBox = new JComboBox<String>();
comboBox.setBounds(305, 41, 95, 27);
comboBox.addItem("员工号");
comboBox.addItem("工资");
frame.getContentPane().setLayout(null);
frame.getContentPane().add(label);
frame.getContentPane().add(textField);
frame.getContentPane().add(comboBox);
JButton button = new JButton("\u786E\u5B9A");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(frame, "查询成功!");
}
});
button.setBounds(526, 33, 95, 35);
frame.getContentPane().add(button);
JButton button_1 = new JButton("\u91CD\u7F6E");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
}
});
button_1.setBounds(636, 32, 95, 35);
frame.getContentPane().add(button_1);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(-1, 81, 789, 402);
frame.getContentPane().add(scrollPane);
table = new JTable();
scrollPane.setViewportView(table);
button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String content = textField.getText();
String[] dataTitle =Selecttwo.getHead();
if(comboBox.getSelectedIndex() == 0)
{
// System.out.println(content);
String[][] data=Selectone.getnumber(content);
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
}
else if(comboBox.getSelectedIndex() == 1)
{
// System.out.println(content);
String[][] data=Selectone.getname(content);
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
}
}
});
}
}

@ -0,0 +1,93 @@
package user;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import Hospital.rootman;
import Hospital.three;
import Hospital.two;
public class Winuser {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winuser window = new Winuser();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winuser() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u7528\u6237\u754C\u9762");
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JButton btnNewButton = new JButton("\u4F4F\u9662\u90E8");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
two.start();
frame.dispose();
}
});
btnNewButton.setBounds(0, 0, 150, 261);
JButton btnNewButton_1 = new JButton("\u4E2A\u4EBA\u4FE1\u606F\u67E5\u8BE2");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
rootman.start();
frame.dispose();
}
});
btnNewButton_1.setBounds(148, 0, 144, 261);
JButton btnNewButton_2 = new JButton("\u836F\u54C1\u548C\u4EEA\u5668");
btnNewButton_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
three.start();
}
});
btnNewButton_2.setBounds(290, 0, 144, 261);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(btnNewButton_1);
frame.getContentPane().add(btnNewButton_2);
}
}

@ -0,0 +1,116 @@
package user;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import javax.swing.JOptionPane;
public class Usershow extends Winusershow {
static String username="root";
/* public static void getname(String s) {
username=s;
}*/
static int max=500;
public static String[][] getRows(){
String sql_url = "jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=Hospital table";
String name = "sa"; //用户名
String password = "wu123456"; //密码
Connection conn;
PreparedStatement preparedStatement = null;
String[][] rows = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //连接驱动
conn = DriverManager.getConnection(sql_url, name, password); //连接数据库
preparedStatement = conn.prepareStatement("select * from 员工基本状况表");
ResultSet result1 = preparedStatement.executeQuery();
if(result1.wasNull())
JOptionPane.showMessageDialog(null, "结果集中无记录");
rows = new String[max][19];
String[] s = null;
s = new String[19];
ResultSetMetaData rsmd = result1.getMetaData();
int i=0;
while(result1.next()){
s=getNextRow(result1,rsmd);
for(int p=0;p<19;p++)
{
rows[i][p]=s[p].trim();
}
i++;
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
System.out.println("未成功加载驱动。");
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println("未成功打开数据库。");
e.printStackTrace();
}
return rows;
}
// 得到数据库表头
public static String[] getHead(){
String sql_url = "jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=Hospital table"; //数据库路径一般都是这样写test是数据库名称
String name = "sa"; //用户名
String password = "wu123456"; //密码
Connection conn;
PreparedStatement preparedStatement = null;
String[] columnHeads = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //连接驱动
conn = DriverManager.getConnection(sql_url, name, password); //连接数据库
// if(!conn.isClosed())
// System.out.println("成功连接数据库");
preparedStatement = conn.prepareStatement("select * from 员工基本状况表");
ResultSet result1 = preparedStatement.executeQuery();
boolean moreRecords = result1.next();
if(!moreRecords)
JOptionPane.showMessageDialog(null, "结果集中无记录");
columnHeads = new String[19];
ResultSetMetaData rsmd = result1.getMetaData();
for(int i = 1; i <= rsmd.getColumnCount(); i++)
columnHeads[i-1]=rsmd.getColumnName(i).trim();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
System.out.println("未成功加载驱动。");
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println("未成功打开数据库。");
e.printStackTrace();
}
return columnHeads;
}
// 得到数据库中下一行数据
private static String[] getNextRow(ResultSet rs,ResultSetMetaData rsmd) throws SQLException{
String[] currentRow = null;
currentRow = new String[19];
for(int i = 1; i <= rsmd.getColumnCount(); i++){
{
currentRow[i-1]=rs.getString(i).trim();
//System.out.println(currentRow[i-1]+" "+(i-1));
}
}
return currentRow;
}
}

@ -0,0 +1,80 @@
package Inpatient;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import javax.swing.JOptionPane;
public class Delete2 extends Deleteinpatient {
public static void delete(String Name) {
String sql_url = "jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=Hospital table"; // 数据库路径一般都是这样写test是数据库名称
String name = "sa"; // 用户名
String password = "wu123456"; // 密码
Connection conn;
PreparedStatement preparedStatement = null;
String[][] rows = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); // 连接驱动
conn = DriverManager.getConnection(sql_url, name, password); // 连接数据库
preparedStatement = conn.prepareStatement("select 病人床位号 from 病人信息表 where 病人姓名='"+Name+"'");
ResultSet result1 = preparedStatement.executeQuery();
ResultSetMetaData rsmd = result1.getMetaData();
System.out.println(rsmd);
String[] s;
s = new String[1];
ResultSetMetaData rsmd = result1.getMetaData();
int i=0;
while(result1.next()){
s=getNextRow(result1,rsmd);
for(int p=0;p<2;p++)
{
rows[i][p]=s[p].trim();
}
i++;
}
if (result1.wasNull())
JOptionPane.showMessageDialog(null, "结果集中无记录");
} catch (ClassNotFoundException e) {
} catch (SQLException e) {
}
/* try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); // 连接驱动
conn = DriverManager.getConnection(sql_url, name, password); // 连接数据库
preparedStatement = conn.prepareStatement("delete from 病人信息表 where 病人姓名='"+Name+"'");
ResultSet result1 = preparedStatement.executeQuery();
if (result1.wasNull())
JOptionPane.showMessageDialog(null, "结果集中无记录");
} catch (ClassNotFoundException e) {
} catch (SQLException e) {
}
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //连接驱动
conn = DriverManager.getConnection(sql_url, name, password); //连接数据库
preparedStatement = conn.prepareStatement("update 床位信息表 set 床位号 = '"+Bed+"', 床位状态 ='空闲' where 床位号 = '"+Bed+"'");
ResultSet result1 = preparedStatement.executeQuery();
if(result1.wasNull())
JOptionPane.showMessageDialog(null, "结果集中无记录");
} catch (ClassNotFoundException e) {
} catch (SQLException e) {
}
*/
}
private static String[] getNextRow(ResultSet rs,ResultSetMetaData rsmd) throws SQLException{
String[] currentRow = null;
currentRow = new String[2];
for(int i = 1; i <= rsmd.getColumnCount(); i++){
{
currentRow[i-1]=rs.getString(i).trim();
//System.out.println(currentRow[i-1]+" "+(i-1));
}
}
return currentRow;
}
}

@ -0,0 +1,222 @@
package Instrument;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import Medicine.Change;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
public class Changeinstrument {
private JFrame frame;
private JTextField textField;
private JTextField textField_1;
private JTextField textField_2;
private JTextField textField_3;
private JTextField textField_4;
private JTextField textField_5;
private JButton button;
private JButton button_1;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Changeinstrument window = new Changeinstrument();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Changeinstrument() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u533B\u7597\u4EEA\u5668\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
JLabel label = new JLabel("\u4F60\u60F3\u8981\u4FEE\u6539\u7684\u4EEA\u5668\u4EE3\u53F7\u4E3A\uFF1A");
label.setFont(new Font("宋体", Font.PLAIN, 25));
textField = new JTextField();
textField.setColumns(10);
JLabel label_1 = new JLabel("\u4EEA\u5668\u4EE3\u53F7\uFF1A");
label_1.setFont(new Font("宋体", Font.PLAIN, 22));
JLabel label_2 = new JLabel("\u4EEA\u5668\u540D\u79F0\uFF1A");
label_2.setFont(new Font("宋体", Font.PLAIN, 22));
JLabel label_3 = new JLabel("\u4EEA\u5668\u4EF7\u683C\uFF1A");
label_3.setFont(new Font("宋体", Font.PLAIN, 22));
JLabel label_4 = new JLabel("\u4EEA\u5668\u6570\u91CF\uFF1A");
label_4.setFont(new Font("宋体", Font.PLAIN, 22));
JLabel label_5 = new JLabel("\u5907\u6CE8\uFF1A");
label_5.setFont(new Font("宋体", Font.PLAIN, 22));
textField_1 = new JTextField();
textField_1.setColumns(10);
textField_2 = new JTextField();
textField_2.setColumns(10);
textField_3 = new JTextField();
textField_3.setColumns(10);
textField_4 = new JTextField();
textField_4.setColumns(10);
textField_5 = new JTextField();
textField_5.setColumns(10);
button = new JButton("\u786E\u5B9A");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String S = textField.getText();
String Num = textField_1.getText();
String Name = textField_2.getText();
String Age = textField_3.getText();
String Sex = textField_4.getText();
String SelectedIndex = textField_5.getText();
Change.change(S,Num,Name,Age,Sex,SelectedIndex);
JOptionPane.showMessageDialog(frame, "修改成功!");
frame.dispose();
}
});
button_1 = new JButton("\u91CD\u7F6E");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
textField_1.setText("");
textField_2.setText("");
textField_3.setText("");
textField_4.setText("");
textField_5.setText("");
}
});
GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(10)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(295)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 181, GroupLayout.PREFERRED_SIZE))
.addComponent(label, GroupLayout.PREFERRED_SIZE, 339, GroupLayout.PREFERRED_SIZE)))
.addGroup(groupLayout.createSequentialGroup()
.addGap(20)
.addComponent(label_1)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, 295, GroupLayout.PREFERRED_SIZE))
.addGroup(groupLayout.createSequentialGroup()
.addGap(20)
.addComponent(label_2)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, 295, GroupLayout.PREFERRED_SIZE))
.addGroup(groupLayout.createSequentialGroup()
.addGap(20)
.addComponent(label_3)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(textField_3, GroupLayout.PREFERRED_SIZE, 295, GroupLayout.PREFERRED_SIZE))
.addGroup(groupLayout.createSequentialGroup()
.addGap(20)
.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING, false)
.addComponent(label_4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(label_5, GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE))
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(398)
.addComponent(button, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
.addGap(25)
.addComponent(button_1, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE))
.addGroup(groupLayout.createSequentialGroup()
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(textField_5, GroupLayout.PREFERRED_SIZE, 295, GroupLayout.PREFERRED_SIZE)
.addComponent(textField_4, GroupLayout.PREFERRED_SIZE, 295, GroupLayout.PREFERRED_SIZE))))))
.addContainerGap(31, Short.MAX_VALUE))
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(25)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(25)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE))
.addComponent(label, GroupLayout.PREFERRED_SIZE, 87, GroupLayout.PREFERRED_SIZE))
.addGap(6)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(label_1, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)
.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE))
.addGap(18)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(label_2, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)
.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE))
.addGap(18)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(label_3, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)
.addComponent(textField_3, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE))
.addGap(18)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(label_4, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)
.addComponent(textField_4, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE))
.addGap(16)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(34)
.addComponent(button, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE))
.addGroup(groupLayout.createSequentialGroup()
.addGap(34)
.addComponent(button_1, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE))
.addGroup(groupLayout.createSequentialGroup()
.addGap(2)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(textField_5, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE)
.addComponent(label_5, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE))
.addGap(47))))
);
frame.getContentPane().setLayout(groupLayout);
}
}

@ -0,0 +1,137 @@
package Hospital;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import Medicine.Changemedicine;
import Medicine.Deletemedicine;
import Medicine.Insertmedicine;
import Medicine.Selectmedicine;
import Medicine.Showmedicine;
public class Wininpatient {
private JFrame frame;
/**
* Launch the application.
*/
public static void start() {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Wininpatient window = new Wininpatient();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Wininpatient() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u75C5\u4EBA\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(0, 69, 784, 424);
frame.getContentPane().add(scrollPane);
JTextArea textArea = new JTextArea();
textArea.setFont(new Font("Monospaced", Font.PLAIN, 20));
scrollPane.setViewportView(textArea);
textArea.append("进入药品管理系统\n");
JButton btnNewButton = new JButton("\u5165\u9662");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Insertmedicine.start();
textArea.append("增加药品成功\n");
}
});
btnNewButton.setBounds(0, 0, 131, 70);
JButton button = new JButton("\u51FA\u9662");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Deletemedicine.start();
textArea.append("删除药品成功\n");
}
});
button.setBounds(129, 0, 131, 70);
JButton button_1 = new JButton("\u4FEE\u6539\u75C5\u4EBA\u4FE1\u606F");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Changemedicine.start();
textArea.append("修改药品成功\n");
}
});
button_1.setBounds(259, 0, 131, 70);
JButton button_2 = new JButton("\u67E5\u8BE2\u75C5\u4EBA\u4FE1\u606F");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Selectmedicine.start();
textArea.append("查询药品成功\n");
}
});
button_2.setBounds(389, 0, 131, 70);
JButton button_3 = new JButton("\u663E\u793A\u75C5\u4EBA\u4FE1\u606F");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Showmedicine.start();
textArea.append("显示药品成功\n");
}
});
button_3.setBounds(519, 0, 131, 70);
JButton button_4 = new JButton("\u8FD4\u56DE\u4E3B\u83DC\u5355");
button_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
index.start();
}
});
button_4.setBounds(649, 0, 131, 70);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(button);
frame.getContentPane().add(button_1);
frame.getContentPane().add(button_2);
frame.getContentPane().add(button_3);
frame.getContentPane().add(button_4);
}
}

@ -0,0 +1,10 @@
package Hospital;
public class Start {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("hello word");
}
}

@ -0,0 +1,107 @@
package rootman;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
public class Winchangetwo {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winchangetwo window = new Winchangetwo();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winchangetwo() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u5458\u5DE5\u7BA1\u7406");
frame.setBounds(100, 100, 870, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
JLabel label = new JLabel("\u4F60\u9700\u8981\u589E\u52A0\u7684\u5458\u5DE5\u5DE5\u8D44\u4FE1\u606F\uFF1A");
label.setBounds(10, 10, 506, 115);
label.setFont(new Font("宋体", Font.PLAIN, 30));
JLabel label_1 = new JLabel("\u5458\u5DE5\u53F7\uFF1A");
label_1.setBounds(13, 147, 130, 75);
label_1.setFont(new Font("宋体", Font.PLAIN, 28));
JLabel label_2 = new JLabel("\u5DE5\u8D44\uFF1A");
label_2.setBounds(18, 268, 89, 75);
label_2.setFont(new Font("宋体", Font.PLAIN, 28));
frame.getContentPane().setLayout(null);
frame.getContentPane().add(label);
frame.getContentPane().add(label_1);
frame.getContentPane().add(label_2);
textField = new JTextField();
textField.setBounds(139, 169, 185, 28);
frame.getContentPane().add(textField);
textField.setColumns(10);
textField_1 = new JTextField();
textField_1.setColumns(10);
textField_1.setBounds(141, 296, 185, 28);
frame.getContentPane().add(textField_1);
JButton btnNewButton = new JButton("\u786E\u5B9A");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String Num = textField.getText();
String Money = textField_1.getText();
Inserttwo.insert(Num, Money);
frame.dispose();
}
});
btnNewButton.setBounds(548, 385, 116, 70);
frame.getContentPane().add(btnNewButton);
JButton button = new JButton("\u91CD\u7F6E");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
textField_1.setText("");
}
});
button.setBounds(700, 385, 116, 70);
frame.getContentPane().add(button);
}
}

@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8

@ -0,0 +1,136 @@
package department;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import Hospital.index;
import jobs.Winchangejobs;
import jobs.Windeletejobs;
import jobs.Winselectjobs;
public class Windepartment {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Windepartment window = new Windepartment();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Windepartment() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u90E8\u95E8\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(0, 69, 784, 424);
frame.getContentPane().add(scrollPane);
JTextArea textArea = new JTextArea();
textArea.setFont(new Font("Monospaced", Font.PLAIN, 20));
scrollPane.setViewportView(textArea);
textArea.append("进入岗位信息管理系统\n");
JButton btnNewButton = new JButton("\u589E\u52A0\u90E8\u95E8");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Wininsertdepartment.start();
textArea.append("增加部门信息成功\n");
}
});
btnNewButton.setBounds(0, 0, 131, 70);
JButton button = new JButton("\u5220\u9664\u90E8\u95E8");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Windeletedepartment.start();
textArea.append("删除部门信息成功\n");
}
});
button.setBounds(129, 0, 131, 70);
JButton button_1 = new JButton("\u4FEE\u6539\u90E8\u95E8");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winchangejobs.start();
textArea.append("岗位信息修改成功\n");
}
});
button_1.setBounds(259, 0, 131, 70);
JButton button_2 = new JButton("\u67E5\u8BE2\u90E8\u95E8");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winselectjobs.start();
textArea.append("查询岗位信息成功\n");
}
});
button_2.setBounds(389, 0, 131, 70);
JButton button_3 = new JButton("\u663E\u793A\u6240\u6709\u90E8\u95E8");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winshowdepartment.start();
textArea.append("显示部门信息成功\n");
}
});
button_3.setBounds(519, 0, 131, 70);
JButton button_4 = new JButton("\u8FD4\u56DE\u4E3B\u83DC\u5355");
button_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
index.start();
}
});
button_4.setBounds(649, 0, 131, 70);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(button);
frame.getContentPane().add(button_1);
frame.getContentPane().add(button_2);
frame.getContentPane().add(button_3);
frame.getContentPane().add(button_4);
}
}

@ -0,0 +1,137 @@
package Hospital;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import Medicine.Changemedicine;
import Medicine.Deletemedicine;
import Medicine.Insertmedicine;
import Medicine.Selectmedicine;
import Medicine.Showmedicine;
public class Wininpatient {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Wininpatient window = new Wininpatient();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Wininpatient() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u836F\u54C1\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(0, 69, 784, 424);
frame.getContentPane().add(scrollPane);
JTextArea textArea = new JTextArea();
textArea.setFont(new Font("Monospaced", Font.PLAIN, 20));
scrollPane.setViewportView(textArea);
textArea.append("进入药品管理系统\n");
JButton btnNewButton = new JButton("\u589E\u52A0\u836F\u54C1");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Insertmedicine.start();
textArea.append("增加药品成功\n");
}
});
btnNewButton.setBounds(0, 0, 131, 70);
JButton button = new JButton("\u5220\u9664\u836F\u54C1");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Deletemedicine.start();
textArea.append("删除药品成功\n");
}
});
button.setBounds(129, 0, 131, 70);
JButton button_1 = new JButton("\u4FEE\u6539\u836F\u54C1");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Changemedicine.start();
textArea.append("修改药品成功\n");
}
});
button_1.setBounds(259, 0, 131, 70);
JButton button_2 = new JButton("\u67E5\u8BE2\u836F\u54C1");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Selectmedicine.start();
textArea.append("查询药品成功\n");
}
});
button_2.setBounds(389, 0, 131, 70);
JButton button_3 = new JButton("\u663E\u793A\u836F\u54C1");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Showmedicine.start();
textArea.append("显示药品成功\n");
}
});
button_3.setBounds(519, 0, 131, 70);
JButton button_4 = new JButton("\u8FD4\u56DE\u4E3B\u83DC\u5355");
button_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
index.start();
}
});
button_4.setBounds(649, 0, 131, 70);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(button);
frame.getContentPane().add(button_1);
frame.getContentPane().add(button_2);
frame.getContentPane().add(button_3);
frame.getContentPane().add(button_4);
}
}

@ -0,0 +1,43 @@
package department;
import java.awt.EventQueue;
import javax.swing.JFrame;
public class Winchangedepartment {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winchangedepartment window = new Winchangedepartment();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winchangedepartment() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

@ -0,0 +1,137 @@
package Hospital;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import Inpatient.Changeinpatientbed;
import Inpatient.Deleteinpatientbed;
import Inpatient.Insertpatientbed;
import Inpatient.Showinpatientbed;
import Medicine.Changemedicine;
import Medicine.Selectmedicine;
public class wininpatientbed {
private JFrame frame;
/**
* Launch the application.
*/
public static void start() {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
wininpatientbed window = new wininpatientbed();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public wininpatientbed() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u5E8A\u4F4D\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(0, 69, 784, 424);
frame.getContentPane().add(scrollPane);
JTextArea textArea = new JTextArea();
textArea.setFont(new Font("Monospaced", Font.PLAIN, 20));
scrollPane.setViewportView(textArea);
textArea.append("进入床位管理系统\n");
JButton btnNewButton = new JButton("\u589E\u52A0\u5E8A\u4F4D");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Insertpatientbed.start();
textArea.append("增加床位信息成功\n");
}
});
btnNewButton.setBounds(0, 0, 131, 70);
JButton button = new JButton("\u5220\u9664\u5E8A\u4F4D");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Deleteinpatientbed.start();
textArea.append("删除床位信息成功\n");
}
});
button.setBounds(129, 0, 131, 70);
JButton button_1 = new JButton("\u4FEE\u6539\u5E8A\u4F4D\u4FE1\u606F");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Changeinpatientbed.start();
textArea.append("修改床位信息成功\n");
}
});
button_1.setBounds(259, 0, 131, 70);
JButton button_2 = new JButton("\u67E5\u8BE2\u5E8A\u4F4D\u4FE1\u606F");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Selectmedicine.start();
textArea.append("查询药品成功\n");
}
});
button_2.setBounds(389, 0, 131, 70);
JButton button_3 = new JButton("\u663E\u793A\u5E8A\u4F4D\u4FE1\u606F");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Showinpatientbed.start();
textArea.append("显示床位信息成功\n");
}
});
button_3.setBounds(519, 0, 131, 70);
JButton button_4 = new JButton("\u8FD4\u56DE\u4E3B\u83DC\u5355");
button_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
index.start();
}
});
button_4.setBounds(649, 0, 131, 70);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(button);
frame.getContentPane().add(button_1);
frame.getContentPane().add(button_2);
frame.getContentPane().add(button_3);
frame.getContentPane().add(button_4);
}
}

@ -0,0 +1,43 @@
package rootman;
import java.awt.EventQueue;
import javax.swing.JFrame;
public class Winchangeone {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winchangeone window = new Winchangeone();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winchangeone() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

@ -0,0 +1,43 @@
package jobs;
import java.awt.EventQueue;
import javax.swing.JFrame;
public class Winchangejobs {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winchangejobs window = new Winchangejobs();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winchangejobs() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

@ -0,0 +1,147 @@
package user;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import javax.swing.JOptionPane;
public class Usertshow2 extends Winusershow2 {
static String sql_url = "jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=Hospital table";
static String name = "sa"; //用户名
static String password = "wu123456"; //密码
static int max=500;
public static String[][] getnumber(String S){
Connection conn;
PreparedStatement preparedStatement = null;
String[][] rows = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //连接驱动
conn = DriverManager.getConnection(sql_url, name, password); //连接数据库
preparedStatement = conn.prepareStatement("select * from 员工工资信息表 where 员工号='"+S+"'");
ResultSet result1 = preparedStatement.executeQuery();
if(result1.wasNull())
JOptionPane.showMessageDialog(null, "结果集中无记录");
rows = new String[max][2];
String[] s = null;
s = new String[2];
ResultSetMetaData rsmd = result1.getMetaData();
int i=0;
while(result1.next()){
s=getNextRow(result1,rsmd);
for(int p=0;p<2;p++)
{
rows[i][p]=s[p].trim();
}
i++;
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
System.out.println("未成功加载驱动。");
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println("未成功打开数据库。");
e.printStackTrace();
}
return rows;
}
public static String[][] getname(String S){
Connection conn;
PreparedStatement preparedStatement = null;
String[][] rows = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //连接驱动
conn = DriverManager.getConnection(sql_url, name, password); //连接数据库
preparedStatement = conn.prepareStatement("select * from 员工工资信息表 where 工资='"+S+"'");
ResultSet result1 = preparedStatement.executeQuery();
if(result1.wasNull())
JOptionPane.showMessageDialog(null, "结果集中无记录");
rows = new String[max][2];
String[] s = null;
s = new String[2];
ResultSetMetaData rsmd = result1.getMetaData();
int i=0;
while(result1.next()){
s=getNextRow(result1,rsmd);
for(int p=0;p<2;p++)
{
rows[i][p]=s[p].trim();
// System.out.println(rows[i][p]+" "+i+" "+p);
}
i++;
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
System.out.println("未成功加载驱动。");
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println("未成功打开数据库。");
e.printStackTrace();
}
return rows;
}
// 得到数据库表头
public static String[] getHead(){
Connection conn;
PreparedStatement preparedStatement = null;
String[] columnHeads = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //连接驱动
conn = DriverManager.getConnection(sql_url, name, password); //连接数据库
// if(!conn.isClosed())
// System.out.println("成功连接数据库");
preparedStatement = conn.prepareStatement("select * from 员工工资信息表");
ResultSet result1 = preparedStatement.executeQuery();
boolean moreRecords = result1.next();
if(!moreRecords)
JOptionPane.showMessageDialog(null, "结果集中无记录");
columnHeads = new String[2];
ResultSetMetaData rsmd = result1.getMetaData();
for(int i = 1; i <= rsmd.getColumnCount(); i++)
columnHeads[i-1]=rsmd.getColumnName(i).trim();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
System.out.println("未成功加载驱动。");
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println("未成功打开数据库。");
e.printStackTrace();
}
return columnHeads;
}
// 得到数据库中下一行数据
private static String[] getNextRow(ResultSet rs,ResultSetMetaData rsmd) throws SQLException{
String[] currentRow = null;
currentRow = new String[2];
for(int i = 1; i <= rsmd.getColumnCount(); i++){
{
currentRow[i-1]=rs.getString(i).trim();
//System.out.println(currentRow[i-1]+" "+(i-1));
}
}
return currentRow;
}
}

@ -0,0 +1,84 @@
package rootman;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import javax.swing.GroupLayout;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.GroupLayout.Alignment;
import Inpatient.Show2;
public class WinShowone {
private JFrame frame;
private JTable table_1;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
WinShowone window = new WinShowone();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public WinShowone() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u5458\u5DE5\u7BA1\u7406");
frame.setBounds(100, 100, 870, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
JScrollPane scrollPane = new JScrollPane();
String[][] data=Show2.getRows();
String[] dataTitle =Show2.getHead();
table_1 = new JTable(data,dataTitle);
table_1.setFont(new Font("宋体", Font.PLAIN, 20));
table_1.setEnabled(false);
table_1.setRowHeight(25);
scrollPane.setViewportView(table_1);
GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 856, Short.MAX_VALUE)
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 473, GroupLayout.PREFERRED_SIZE)
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
frame.getContentPane().setLayout(groupLayout);
}
}

@ -0,0 +1,43 @@
package rootman;
import java.awt.EventQueue;
import javax.swing.JFrame;
public class WinShowtwo {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
WinShowtwo window = new WinShowtwo();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public WinShowtwo() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

@ -0,0 +1,53 @@
package rootman;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import javax.swing.JFrame;
public class Wininsertone {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Wininsertone window = new Wininsertone();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Wininsertone() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u5458\u5DE5\u7BA1\u7406");
frame.setBounds(100, 100, 870, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
}
}

@ -0,0 +1,43 @@
package rootman;
import java.awt.EventQueue;
import javax.swing.JFrame;
public class Winselectone {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winselectone window = new Winselectone();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winselectone() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

@ -0,0 +1,133 @@
package permissions;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import Hospital.index;
public class Winpermissions {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winpermissions window = new Winpermissions();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winpermissions() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u6743\u9650\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(0, 69, 784, 424);
frame.getContentPane().add(scrollPane);
JTextArea textArea = new JTextArea();
textArea.setFont(new Font("Monospaced", Font.PLAIN, 20));
scrollPane.setViewportView(textArea);
textArea.append("进入权限管理系统\n");
JButton btnNewButton = new JButton("\u589E\u52A0\u6743\u9650\u7528\u6237");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Wininsertpermission.start();
textArea.append("增加权限信息成功\n");
}
});
btnNewButton.setBounds(0, 0, 131, 70);
JButton button = new JButton("\u5220\u9664\u6743\u9650\u7528\u6237");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Windeletepermission.start();
textArea.append("删除权限信息成功\n");
}
});
button.setBounds(129, 0, 131, 70);
JButton button_1 = new JButton("\u4FEE\u6539\u6743\u9650\u7528\u6237");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winchangepermission.start();
textArea.append("权限信息修改成功\n");
}
});
button_1.setBounds(259, 0, 131, 70);
JButton button_2 = new JButton("\u67E5\u8BE2\u6743\u9650\u7528\u6237");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winselectpermission.start();
textArea.append("查询权限信息成功\n");
}
});
button_2.setBounds(389, 0, 131, 70);
JButton button_3 = new JButton("\u663E\u793A\u6240\u6709\u6743\u9650");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winshowpermission.start();
textArea.append("显示权限信息成功\n");
}
});
button_3.setBounds(519, 0, 131, 70);
JButton button_4 = new JButton("\u8FD4\u56DE\u4E3B\u83DC\u5355");
button_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
index.start();
}
});
button_4.setBounds(649, 0, 131, 70);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(button);
frame.getContentPane().add(button_1);
frame.getContentPane().add(button_2);
frame.getContentPane().add(button_3);
frame.getContentPane().add(button_4);
}
}

@ -0,0 +1,43 @@
package Hospital;
import java.awt.EventQueue;
import javax.swing.JFrame;
public class index {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
index window = new index();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public index() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

@ -0,0 +1,137 @@
package permissions;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import Hospital.index;
import department.Winchangedepartment;
import department.Windeletedepartment;
import department.Wininsertdepartment;
import department.Winselectdepartment;
import department.Winshowdepartment;
public class Winpermissions {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winpermissions window = new Winpermissions();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winpermissions() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u6743\u9650\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(0, 69, 784, 424);
frame.getContentPane().add(scrollPane);
JTextArea textArea = new JTextArea();
textArea.setFont(new Font("Monospaced", Font.PLAIN, 20));
scrollPane.setViewportView(textArea);
textArea.append("进入权限管理系统\n");
JButton btnNewButton = new JButton("\u589E\u52A0\u6743\u9650\u7528\u6237");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Wininsertdepartment.start();
textArea.append("增加部门信息成功\n");
}
});
btnNewButton.setBounds(0, 0, 131, 70);
JButton button = new JButton("\u5220\u9664\u6743\u9650\u7528\u6237");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Windeletedepartment.start();
textArea.append("删除部门信息成功\n");
}
});
button.setBounds(129, 0, 131, 70);
JButton button_1 = new JButton("\u4FEE\u6539\u6743\u9650\u7528\u6237");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winchangedepartment.start();
textArea.append("部门信息修改成功\n");
}
});
button_1.setBounds(259, 0, 131, 70);
JButton button_2 = new JButton("\u67E5\u8BE2\u6743\u9650\u7528\u6237");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winselectdepartment.start();
textArea.append("查询部门信息成功\n");
}
});
button_2.setBounds(389, 0, 131, 70);
JButton button_3 = new JButton("\u663E\u793A\u6240\u6709\u6743\u9650");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Winshowpermission.start();
textArea.append("显示权限信息成功\n");
}
});
button_3.setBounds(519, 0, 131, 70);
JButton button_4 = new JButton("\u8FD4\u56DE\u4E3B\u83DC\u5355");
button_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
index.start();
}
});
button_4.setBounds(649, 0, 131, 70);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(button);
frame.getContentPane().add(button_1);
frame.getContentPane().add(button_2);
frame.getContentPane().add(button_3);
frame.getContentPane().add(button_4);
}
}

@ -0,0 +1,175 @@
package Instrument;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import Medicine.Select;
public class Selectinstruemt {
private JFrame frame;
private JTextField textField;
private JTable table;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Selectinstruemt window = new Selectinstruemt();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Selectinstruemt() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u836F\u54C1\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
JLabel label = new JLabel("\u4F60\u60F3\u67E5\u8BE2\uFF1A");
label.setBounds(15, 39, 140, 37);
label.setFont(new Font("宋体", Font.PLAIN, 25));
textField = new JTextField();
textField.setBounds(140, 41, 164, 27);
textField.setColumns(10);
JComboBox<String> comboBox = new JComboBox<String>();
comboBox.setBounds(305, 41, 95, 27);
comboBox.addItem("药剂代号");
comboBox.addItem("药剂名称");
comboBox.addItem("药剂价格");
comboBox.addItem("药剂库存数量");
comboBox.addItem("备注");
frame.getContentPane().setLayout(null);
frame.getContentPane().add(label);
frame.getContentPane().add(textField);
frame.getContentPane().add(comboBox);
JButton button = new JButton("\u786E\u5B9A");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(frame, "查询成功!");
}
});
button.setBounds(526, 33, 95, 35);
frame.getContentPane().add(button);
JButton button_1 = new JButton("\u91CD\u7F6E");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
}
});
button_1.setBounds(636, 32, 95, 35);
frame.getContentPane().add(button_1);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(-1, 81, 789, 402);
frame.getContentPane().add(scrollPane);
table = new JTable();
scrollPane.setViewportView(table);
button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String content = textField.getText();
String[] dataTitle =Select.getHead();
if(comboBox.getSelectedIndex() == 0)
{
// System.out.println(content);
String[][] data=Select.getnumber(content);
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
}
else if(comboBox.getSelectedIndex() == 1)
{
// System.out.println(content);
String[][] data=Select.getname(content);
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
}
else if(comboBox.getSelectedIndex() == 2)
{
// System.out.println(content);
String[][] data=Select.getage(content);
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
}
else if(comboBox.getSelectedIndex() == 3)
{
// System.out.println(content);
String[][] data=Select.getsex(content);
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
}
else if(comboBox.getSelectedIndex() == 4)
{
// System.out.println(content);
String[][] data=Select.getdepartments(content);
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
}
}
});
}
}

@ -0,0 +1,117 @@
package Inpatient;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
import Instrument.Insert1;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Insertpatientbed {
private JFrame frame;
private JTextField textField;
private JTextField textField_1;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Insertpatientbed window = new Insertpatientbed();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Insertpatientbed() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 800, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
JLabel label = new JLabel("\u4F60\u9700\u8981\u589E\u52A0\u7684\u5E8A\u4F4D\u4FE1\u606F\uFF1A");
label.setBounds(26, 29, 422, 104);
label.setFont(new Font("宋体", Font.PLAIN, 25));
JLabel label_1 = new JLabel("\u5E8A\u4F4D\u53F7\uFF1A");
label_1.setBounds(34, 170, 119, 29);
label_1.setFont(new Font("宋体", Font.PLAIN, 25));
JLabel label_2 = new JLabel("\u5E8A\u4F4D\u72B6\u6001\uFF1A");
label_2.setBounds(34, 294, 151, 29);
label_2.setFont(new Font("宋体", Font.PLAIN, 25));
textField = new JTextField();
textField.setBounds(165, 170, 168, 29);
textField.setColumns(10);
textField_1 = new JTextField();
textField_1.setBounds(165, 294, 168, 29);
textField_1.setColumns(10);
frame.getContentPane().setLayout(null);
JLabel label_3 = new JLabel("\u7A7A\u95F2/\u6709\u4EBA");
label_3.setBounds(337, 294, 151, 29);
label_3.setFont(new Font("宋体", Font.PLAIN, 25));
frame.getContentPane().add(label_3);
frame.getContentPane().add(label);
frame.getContentPane().add(label_2);
frame.getContentPane().add(textField_1);
frame.getContentPane().add(label_1);
frame.getContentPane().add(textField);
JButton button = new JButton("\u786E\u5B9A");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@SuppressWarnings("unused")
String Num = textField.getText();
@SuppressWarnings("unused")
String State = textField_1.getText();
Insert3.insert(Num, State);
frame.dispose();
}
});
button.setBounds(445, 384, 134, 65);
frame.getContentPane().add(button);
JButton button_1 = new JButton("\u91CD\u7F6E");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
textField_1.setText("");
}
});
button_1.setBounds(606, 384, 134, 65);
frame.getContentPane().add(button_1);
}
}

@ -0,0 +1,133 @@
package Hospital;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import java.sql.SQLException;
import javax.swing.JFrame;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JButton;
import javax.swing.JPasswordField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Login {
private JFrame frame;
private JTextField textField;
private JPasswordField passwordField;
public static void main(String[] args) throws SQLException {
new Link();
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Login window = new Login();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Login() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u7528\u6237\u767B\u5F55\u754C\u9762");
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JLabel label = new JLabel("\u7528\u6237\u540D\uFF1A");
label.setFont(new Font("宋体", Font.PLAIN, 18));
JLabel label_1 = new JLabel("\u5BC6 \u7801\uFF1A");
label_1.setFont(new Font("宋体", Font.PLAIN, 18));
textField = new JTextField();
textField.setColumns(10);
JButton button = new JButton("\u767B\u5F55");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
this.dispose();
}
});
JButton button_1 = new JButton("\u9000\u51FA");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
passwordField = new JPasswordField();
GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(54)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)
.addGap(3)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 208, GroupLayout.PREFERRED_SIZE))
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label_1, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)
.addGap(3)
.addComponent(passwordField, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)))
.addContainerGap(93, Short.MAX_VALUE))
.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
.addContainerGap(186, Short.MAX_VALUE)
.addComponent(button, GroupLayout.PREFERRED_SIZE, 102, GroupLayout.PREFERRED_SIZE)
.addGap(15)
.addComponent(button_1, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE)
.addGap(25))
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(63)
.addComponent(label, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
.addGap(11)
.addComponent(label_1, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addGap(135))
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap(66, Short.MAX_VALUE)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addGap(11)
.addComponent(passwordField, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addGap(73)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(button_1, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE)
.addComponent(button, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE))
.addGap(19))
);
frame.getContentPane().setLayout(groupLayout);
}
}

@ -0,0 +1,71 @@
package Hospital;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class three {
private JFrame frame;
/**
* Launch the application.
*/
public static void start() {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
three window = new three();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public three() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u836F\u54C1\u548C\u4EEA\u5668");
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
frame.getContentPane().setLayout(null);
JButton btnNewButton = new JButton("\u836F\u54C1\u7BA1\u7406");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
btnNewButton.setBounds(0, 0, 221, 261);
frame.getContentPane().add(btnNewButton);
JButton btnNewButton_1 = new JButton("\u4EEA\u5668\u7BA1\u7406");
btnNewButton_1.setBounds(218, 0, 216, 261);
frame.getContentPane().add(btnNewButton_1);
}
}

@ -0,0 +1,117 @@
package Inpatient;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import Instrument.Delete1;
import Instrument.Show1;
public class Deleteinpatientbed {
private JFrame frame;
private JTextField textField;
private JTable table;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Deleteinpatientbed window = new Deleteinpatientbed();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Deleteinpatientbed() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u533B\u7597\u4EEA\u5668\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
JLabel label = new JLabel("\u4F60\u9700\u8981\u5220\u9664\u7684\u4EEA\u5668\u4EE3\u53F7\u4E3A\uFF1A");
label.setBounds(10, 29, 307, 79);
label.setFont(new Font("宋体", Font.PLAIN, 25));
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(0, 92, 786, 391);
frame.getContentPane().add(scrollPane);
textField = new JTextField();
textField.setBounds(304, 52, 249, 29);
textField.setColumns(10);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(label);
frame.getContentPane().add(textField);
String[][] data=Show1.getRows();
String[] dataTitle =Show1.getHead();
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
JButton btnNewButton = new JButton("\u786E\u5B9A");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String Num = textField.getText();
Delete1.delete(Num);
JOptionPane.showMessageDialog(frame, "删除成功!");
String[][] data=Show1.getRows();
String[] dataTitle =Show1.getHead();
table = new JTable(data,dataTitle);
table.setFont(new Font("宋体", Font.PLAIN, 18));
table.setRowHeight(25);
scrollPane.setViewportView(table);
table.setEnabled(false);
}
});
btnNewButton.setBounds(579, 46, 88, 40);
frame.getContentPane().add(btnNewButton);
JButton button = new JButton("\u91CD\u7F6E");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
}
});
button.setBounds(677, 46, 88, 40);
frame.getContentPane().add(button);
}
}

@ -0,0 +1,96 @@
package Hospital;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import rootman.winone;
import rootman.wintwo;
public class rootman {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
rootman window = new rootman();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public rootman() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u5458\u5DE5\u7BA1\u7406");
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JButton btnNewButton = new JButton("\u4E2A\u4EBA\u4FE1\u606F\u7BA1\u7406");
btnNewButton.setBounds(0, 0, 105, 261);
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
winone.start();
frame.dispose();
}
});
JButton btnNewButton_1 = new JButton("\u5DE5\u8D44\u7BA1\u7406");
btnNewButton_1.setBounds(103, 0, 105, 261);
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
wintwo.start();
frame.dispose();
}
});
JButton btnNewButton_2 = new JButton("\u5C97\u4F4D/\u90E8\u95E8\u7BA1\u7406");
btnNewButton_2.setBounds(206, 0, 120, 261);
btnNewButton_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
three.start();
}
});
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(btnNewButton_1);
frame.getContentPane().add(btnNewButton_2);
JButton btnNewButton_3 = new JButton("\u6743\u9650\u7BA1\u7406");
btnNewButton_3.setBounds(321, 0, 115, 261);
frame.getContentPane().add(btnNewButton_3);
}
}

@ -0,0 +1,82 @@
package Instrument;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import javax.swing.GroupLayout;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.GroupLayout.Alignment;
import Medicine.Show;
public class Showinstrument {
private JFrame frame;
private JTable table_1;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Showinstrument window = new Showinstrument();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Showinstrument() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u836F\u54C1\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);
JScrollPane scrollPane = new JScrollPane();
String[][] data=Show.getRows();
String[] dataTitle =Show.getHead();
table_1 = new JTable(data,dataTitle);
table_1.setFont(new Font("宋体", Font.PLAIN, 25));
table_1.setEnabled(false);
table_1.setRowHeight(25);
scrollPane.setViewportView(table_1);
GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 782, GroupLayout.PREFERRED_SIZE)
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 473, GroupLayout.PREFERRED_SIZE)
);
frame.getContentPane().setLayout(groupLayout);
}
}

@ -0,0 +1,129 @@
package department;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Wininsertdepartment {
private JFrame frame;
private JTextField textField;
private JTextField textField_1;
private JTextField textField_2;
private JTextField textField_3;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Wininsertdepartment window = new Wininsertdepartment();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Wininsertdepartment() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u90E8\u95E8\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JLabel label = new JLabel("\u4F60\u9700\u8981\u589E\u52A0\u7684\u90E8\u95E8\u4FE1\u606F\uFF1A");
label.setBounds(31, 17, 364, 107);
label.setFont(new Font("宋体", Font.PLAIN, 30));
JLabel lblNewLabel = new JLabel("\u90E8\u95E8\u4EE3\u53F7\uFF1A");
lblNewLabel.setBounds(30, 132, 168, 47);
lblNewLabel.setFont(new Font("宋体", Font.PLAIN, 25));
JLabel label_1 = new JLabel("\u90E8\u95E8\u540D\u79F0\uFF1A");
label_1.setBounds(30, 204, 168, 47);
label_1.setFont(new Font("宋体", Font.PLAIN, 25));
JLabel label_2 = new JLabel("\u90E8\u95E8\u4E3B\u4EFB\u4EE3\u53F7\uFF1A");
label_2.setBounds(30, 279, 190, 47);
label_2.setFont(new Font("宋体", Font.PLAIN, 25));
JLabel label_3 = new JLabel("\u90E8\u95E8\u526F\u4E3B\u4EFB\u4EE3\u53F7\uFF1A");
label_3.setBounds(30, 345, 207, 47);
label_3.setFont(new Font("宋体", Font.PLAIN, 25));
frame.getContentPane().setLayout(null);
frame.getContentPane().add(label);
frame.getContentPane().add(lblNewLabel);
frame.getContentPane().add(label_1);
frame.getContentPane().add(label_2);
frame.getContentPane().add(label_3);
textField = new JTextField();
textField.setBounds(225, 148, 157, 21);
frame.getContentPane().add(textField);
textField.setColumns(10);
textField_1 = new JTextField();
textField_1.setColumns(10);
textField_1.setBounds(225, 212, 157, 21);
frame.getContentPane().add(textField_1);
textField_2 = new JTextField();
textField_2.setColumns(10);
textField_2.setBounds(225, 290, 157, 21);
frame.getContentPane().add(textField_2);
textField_3 = new JTextField();
textField_3.setColumns(10);
textField_3.setBounds(225, 361, 157, 21);
frame.getContentPane().add(textField_3);
JButton button = new JButton("\u786E\u5B9A");
button.setBounds(519, 385, 112, 69);
frame.getContentPane().add(button);
JButton button_1 = new JButton("\u91CD\u7F6E");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
textField_1.setText("");
textField_2.setText("");
textField_3.setText("");
}
});
button_1.setBounds(647, 385, 112, 69);
frame.getContentPane().add(button_1);
}
}

@ -0,0 +1,136 @@
package Hospital;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JScrollPane;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JTextArea;
import Medicine.Changemedicine;
import Medicine.Deletemedicine;
import Medicine.Insertmedicine;
import Medicine.Showmedicine;
import java.awt.Font;
public class Winmedicine {
private JFrame frame;
/**
* Launch the application.
*/
public static void start() {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winmedicine window = new Winmedicine();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winmedicine() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u836F\u54C1\u7BA1\u7406");
frame.setBounds(100, 100, 800, 520);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(0, 69, 784, 424);
frame.getContentPane().add(scrollPane);
JTextArea textArea = new JTextArea();
textArea.setFont(new Font("Monospaced", Font.PLAIN, 20));
scrollPane.setViewportView(textArea);
textArea.append("进入药品管理系统\n");
JButton btnNewButton = new JButton("\u589E\u52A0\u836F\u54C1");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Insertmedicine.start();
textArea.append("增加药品成功\n");
}
});
btnNewButton.setBounds(0, 0, 131, 70);
JButton button = new JButton("\u5220\u9664\u836F\u54C1");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Deletemedicine.start();
textArea.append("删除药品成功\n");
}
});
button.setBounds(129, 0, 131, 70);
JButton button_1 = new JButton("\u4FEE\u6539\u836F\u54C1");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Changemedicine.start();
textArea.append("修改药品成功\n");
}
});
button_1.setBounds(259, 0, 131, 70);
JButton button_2 = new JButton("\u67E5\u8BE2\u836F\u54C1");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Selectmedicine.start();
textArea.append("查询药品成功\n");
}
});
button_2.setBounds(389, 0, 131, 70);
JButton button_3 = new JButton("\u663E\u793A\u836F\u54C1");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Showmedicine.start();
textArea.append("显示药品成功\n");
}
});
button_3.setBounds(519, 0, 131, 70);
JButton button_4 = new JButton("\u8FD4\u56DE\u4E3B\u83DC\u5355");
button_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
index.start();
}
});
button_4.setBounds(649, 0, 131, 70);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(button);
frame.getContentPane().add(button_1);
frame.getContentPane().add(button_2);
frame.getContentPane().add(button_3);
frame.getContentPane().add(button_4);
}
}

@ -0,0 +1,94 @@
package user;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import Hospital.three;
import Hospital.two;
public class Winuser {
static String username;
public static void getname(String s) {
username=s;
}
private JFrame frame;
/**
* Launch the application.
*/
public static void start() {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Winuser window = new Winuser();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Winuser() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u7528\u6237\u754C\u9762");
frame.setBounds(100, 100, 450, 300);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JButton btnNewButton = new JButton("\u4F4F\u9662\u90E8");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
two.start();
frame.dispose();
}
});
btnNewButton.setBounds(0, 0, 150, 261);
JButton btnNewButton_1 = new JButton("\u4E2A\u4EBA\u4FE1\u606F\u67E5\u8BE2");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println(username);
Winuser2.start();
frame.dispose();
}
});
btnNewButton_1.setBounds(148, 0, 144, 261);
JButton btnNewButton_2 = new JButton("\u836F\u54C1\u548C\u4EEA\u5668");
btnNewButton_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
three.start();
}
});
btnNewButton_2.setBounds(290, 0, 144, 261);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(btnNewButton_1);
frame.getContentPane().add(btnNewButton_2);
}
}

@ -0,0 +1,138 @@
package Hospital;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import java.sql.SQLException;
import javax.swing.JFrame;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JPasswordField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Login {
private JFrame frame;
private JTextField textField;
private JPasswordField passwordField;
public static void main(String[] args) throws SQLException {
new Link();
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Login window = new Login();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Login() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u7528\u6237\u767B\u5F55\u754C\u9762");
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JLabel label = new JLabel("\u7528\u6237\u540D\uFF1A");
label.setFont(new Font("宋体", Font.PLAIN, 18));
JLabel label_1 = new JLabel("\u5BC6 \u7801\uFF1A");
label_1.setFont(new Font("宋体", Font.PLAIN, 18));
textField = new JTextField();
textField.setColumns(10);
passwordField = new JPasswordField();
JButton button = new JButton("\u767B\u5F55");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String username=textField.getText().trim();
char[] p=passwordField.getPassword();
String userpsd=new String(p);
if(Link.identify(username,userpsd)==1) {
System.out.println("登陆成功");
frame.dispose();
}
}
});
JButton button_1 = new JButton("\u9000\u51FA");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(54)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)
.addGap(3)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 208, GroupLayout.PREFERRED_SIZE))
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label_1, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)
.addGap(3)
.addComponent(passwordField, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)))
.addContainerGap(93, Short.MAX_VALUE))
.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
.addContainerGap(186, Short.MAX_VALUE)
.addComponent(button, GroupLayout.PREFERRED_SIZE, 102, GroupLayout.PREFERRED_SIZE)
.addGap(15)
.addComponent(button_1, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE)
.addGap(25))
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(63)
.addComponent(label, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
.addGap(11)
.addComponent(label_1, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addGap(135))
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap(66, Short.MAX_VALUE)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addGap(11)
.addComponent(passwordField, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
.addGap(73)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(button_1, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE)
.addComponent(button, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE))
.addGap(19))
);
frame.getContentPane().setLayout(groupLayout);
}
}

@ -0,0 +1,87 @@
package Hospital;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class index {
private JFrame frame;
/**
* Launch the application.
*/
public static void start() {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
index window = new index();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public index() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u4E3B\u754C\u9762");
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int windowWidth = frame.getWidth(); //获得窗口宽
int windowHeight = frame.getHeight(); //获得窗口高
Toolkit kit = Toolkit.getDefaultToolkit(); //定义工具包
Dimension screenSize = kit.getScreenSize(); //获取屏幕的尺寸
int screenWidth = screenSize.width; //获取屏幕的宽
int screenHeight = screenSize.height; //获取屏幕的高
frame.setLocation(screenWidth/2-windowWidth/2, screenHeight/2-windowHeight/2);//设置窗口居中显示
JButton btnNewButton = new JButton("\u4F4F\u9662\u90E8");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
}
});
btnNewButton.setBounds(0, 0, 150, 261);
JButton btnNewButton_1 = new JButton("\u5458\u5DE5\u7BA1\u7406");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
}
});
btnNewButton_1.setBounds(148, 0, 144, 261);
JButton btnNewButton_2 = new JButton("\u836F\u54C1\u548C\u4EEA\u5668");
btnNewButton_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
three.start();
}
});
btnNewButton_2.setBounds(290, 0, 144, 261);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnNewButton);
frame.getContentPane().add(btnNewButton_1);
frame.getContentPane().add(btnNewButton_2);
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save