📄 edit_patient.java
字号:
package clinique;
import java.awt.*;
import javax.swing.*;
import java.awt.Rectangle;
import com.borland.dbswing.JdbTable;
import com.borland.dx.sql.dataset.Database;
import com.borland.dx.sql.dataset.QueryDataSet;
import com.borland.dx.sql.dataset.ConnectionDescriptor;
import com.borland.dx.sql.dataset.Load;
import com.borland.dx.sql.dataset.QueryDescriptor;
import com.borland.dx.dataset.Column;
import java.awt.event.MouseEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.Connection;
import java.sql.SQLException;
import java.awt.Font;
import javax.swing.BorderFactory;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class edit_patient extends JPanel {
int n;
String id;
int x=-1;
public edit_patient() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
this.setLayout(null);
jScrollPane1.setBounds(new Rectangle(10, 13, 660, 203));
database1.setConnection(new ConnectionDescriptor(
"jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=clinique",
"sa", "", false, "com.microsoft.jdbc.sqlserver.SQLServerDriver"));
jdbTable1.setDataSet(queryDataSet1);
jdbTable1.setEditable(false);
jdbTable1.addMouseListener(new edit_patient_jdbTable1_mouseAdapter(this));
queryDataSet1.setQuery(new QueryDescriptor(database1,
"select * from patient", null, true, Load.ALL));
column1.setColumnName("patient_id");
column1.setDataType(com.borland.dx.dataset.Variant.INT);
column1.setRowId(true);
column1.setTableName("patient");
column1.setWidth(6);
column1.setServerColumnName("patient_id");
column1.setSqlType(4);
column2.setColumnName("name");
column2.setDataType(com.borland.dx.dataset.Variant.STRING);
column2.setPrecision(50);
column2.setTableName("patient");
column2.setWidth(6);
column2.setServerColumnName("name");
column2.setSqlType(1);
column3.setColumnName("birthday");
column3.setDataType(com.borland.dx.dataset.Variant.DATE);
column3.setTableName("patient");
column3.setWidth(6);
column3.setServerColumnName("birthday");
column3.setSqlType(93);
column4.setColumnName("stature");
column4.setDataType(com.borland.dx.dataset.Variant.INT);
column4.setTableName("patient");
column4.setWidth(4);
column4.setServerColumnName("stature");
column4.setSqlType(4);
column5.setColumnName("avoirdupois");
column5.setDataType(com.borland.dx.dataset.Variant.INT);
column5.setTableName("patient");
column5.setWidth(6);
column5.setServerColumnName("AVOIRDUPOIS");
column5.setSqlType(4);
name.setBounds(new Rectangle(89, 16, 81, 20));
sex.setBounds(new Rectangle(263, 18, 81, 20));
bloodtype.setBounds(new Rectangle(263, 58, 81, 20));
shengao.setBounds(new Rectangle(89, 96, 66, 20));
tizhong.setBounds(new Rectangle(263, 96, 65, 20));
jLabel1.setText("病人姓名:");
jLabel1.setBounds(new Rectangle(15, 20, 71, 15));
jLabel2.setText("性别:");
jLabel2.setBounds(new Rectangle(212, 22, 42, 15));
jLabel3.setText("出生日期:");
jLabel3.setBounds(new Rectangle(15, 57, 70, 15));
jLabel4.setText("血型:");
jLabel4.setBounds(new Rectangle(213, 61, 42, 15));
jLabel5.setText("身高:");
jLabel5.setBounds(new Rectangle(36, 99, 42, 15));
jLabel6.setText("体重:");
jLabel6.setBounds(new Rectangle(213, 100, 42, 15));
jButton1.setBounds(new Rectangle(448, 373, 86, 23));
jButton1.setText("提交修改");
jButton1.addActionListener(new edit_patient_jButton1_actionAdapter(this));
jButton2.setBounds(new Rectangle(568, 373, 65, 23));
jButton2.setText("取消");
jButton2.addActionListener(new edit_patient_jButton2_actionAdapter(this));
jLabel7.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
jLabel7.setText("病人信息修改");
jLabel7.setBounds(new Rectangle(30, 12, 114, 30));
column6.setColumnName("sex");
column6.setDataType(com.borland.dx.dataset.Variant.STRING);
column6.setPrecision(4);
column6.setTableName("patient");
column6.setWidth(4);
column6.setServerColumnName("SEX");
column6.setSqlType(1);
column7.setColumnName("bloodtype");
column7.setDataType(com.borland.dx.dataset.Variant.STRING);
column7.setPrecision(4);
column7.setTableName("patient");
column7.setWidth(4);
column7.setServerColumnName("BLOODTYPE");
column7.setSqlType(1);
jPanel1.setBorder(BorderFactory.createEtchedBorder());
jPanel1.setBounds(new Rectangle(10, 233, 393, 132));
jPanel1.setLayout(null);
jPanel2.setBorder(BorderFactory.createEtchedBorder());
jPanel2.setBounds(new Rectangle(411, 233, 259, 132));
jPanel2.setLayout(null);
mname.setBounds(new Rectangle(132, 11, 77, 20));
mnumber.setBounds(new Rectangle(132, 38, 77, 20));
pdoctor.setBounds(new Rectangle(132, 96, 77, 20));
jLabel8.setText("所用药品:");
jLabel8.setBounds(new Rectangle(32, 14, 69, 15));
jLabel9.setText("药品数量:");
jLabel9.setBounds(new Rectangle(32, 44, 70, 15));
jLabel10.setText("主治医生:");
jLabel10.setBounds(new Rectangle(32, 101, 71, 15));
jLabel11.setText("药品价格:");
jLabel11.setBounds(new Rectangle(32, 73, 69, 15));
jPanel3.setBorder(BorderFactory.createEtchedBorder());
jPanel3.setBounds(new Rectangle(53, 40, 679, 409));
jPanel3.setLayout(null);
lookname.setBounds(new Rectangle(127, 376, 77, 20));
jLabel12.setText("姓名查询:");
jLabel12.setBounds(new Rectangle(43, 379, 72, 15));
jButton3.setBounds(new Rectangle(242, 373, 65, 23));
jButton3.setText("查询");
jButton3.addActionListener(new edit_patient_jButton3_actionAdapter(this));
column8.setColumnName("doctor");
column8.setDataType(com.borland.dx.dataset.Variant.STRING);
column8.setPrecision(50);
column8.setTableName("patient");
column8.setWidth(6);
column8.setServerColumnName("DOCTOR");
column8.setSqlType(1);
column11.setColumnName("date");
column11.setDataType(com.borland.dx.dataset.Variant.DATE);
column11.setTableName("patient");
column11.setWidth(6);
column11.setServerColumnName("DATE");
column11.setSqlType(93);
column9.setColumnName("nenumber");
column9.setDataType(com.borland.dx.dataset.Variant.INT);
column9.setTableName("patient");
column9.setWidth(6);
column9.setServerColumnName("NENUMBER");
column9.setSqlType(4);
column10.setColumnName("medname");
column10.setDataType(com.borland.dx.dataset.Variant.STRING);
column10.setPrecision(50);
column10.setTableName("patient");
column10.setWidth(8);
column10.setServerColumnName("MEDNAME");
column10.setSqlType(1);
birthday.setBounds(new Rectangle(89, 58, 81, 20));
price.setBounds(new Rectangle(132, 67, 62, 20));
column12.setColumnName("price");
column12.setDataType(com.borland.dx.dataset.Variant.BIGDECIMAL);
column12.setPrecision(10);
column12.setScale(2);
column12.setTableName("patient");
column12.setWidth(6);
column12.setServerColumnName("PRICE");
column12.setSqlType(3);
show.setBounds(new Rectangle(332, 373, 94, 23));
show.setMnemonic('0');
show.setText("显示全部");
show.addActionListener(new edit_patient_show_actionAdapter(this));
jLabel13.setText("cm");
jLabel13.setBounds(new Rectangle(159, 98, 23, 15));
jLabel14.setText("kg");
jLabel14.setBounds(new Rectangle(332, 98, 24, 15));
jLabel15.setText("元");
jLabel15.setBounds(new Rectangle(198, 70, 20, 15));
jPanel1.add(sex);
jPanel1.add(shengao);
jPanel1.add(jLabel3);
jPanel1.add(jLabel1);
jPanel1.add(name);
jPanel1.add(bloodtype);
jPanel1.add(jLabel4);
jPanel1.add(jLabel6);
jPanel1.add(jLabel2);
jPanel1.add(jLabel5);
jPanel1.add(tizhong);
jPanel1.add(birthday);
jPanel1.add(jLabel13);
jPanel1.add(jLabel14);
jPanel3.add(jButton2);
jPanel3.add(jLabel12);
jPanel3.add(lookname);
jPanel3.add(jButton3);
jPanel3.add(jButton1);
jPanel3.add(show);
this.add(jLabel7);
this.add(jPanel3);
jPanel3.add(jScrollPane1);
jPanel3.add(jPanel2);
jScrollPane1.getViewport().add(jdbTable1);
jPanel2.add(mname);
jPanel2.add(jLabel8);
jPanel2.add(jLabel9);
jPanel2.add(mnumber);
jPanel2.add(jLabel11);
jPanel2.add(jLabel10);
jPanel2.add(price);
jPanel2.add(pdoctor);
jPanel2.add(jLabel15);
jPanel3.add(jPanel1);
sex.addItem("");
sex.addItem("男");
sex.addItem("女");
bloodtype.addItem("");
bloodtype.addItem("A");
bloodtype.addItem("B");
bloodtype.addItem("O");
bloodtype.addItem("AB");
queryDataSet1.setColumns(new Column[] {column1, column2, column6,
column3, column7, column4, column5, column8,
column10, column9, column12, column11});
}
JScrollPane jScrollPane1 = new JScrollPane();
JdbTable jdbTable1 = new JdbTable();
Database database1 = new Database();
QueryDataSet queryDataSet1 = new QueryDataSet();
Column column1 = new Column();
Column column2 = new Column();
Column column3 = new Column();
Column column4 = new Column();
Column column5 = new Column();
JTextField name = new JTextField();
JComboBox sex = new JComboBox();
JComboBox bloodtype = new JComboBox();
JTextField shengao = new JTextField();
JTextField tizhong = new JTextField();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JLabel jLabel6 = new JLabel();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JLabel jLabel7 = new JLabel();
Column column6 = new Column();
Column column7 = new Column();
JPanel jPanel1 = new JPanel();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -