📄 frmjbdmdb.java
字号:
package myprojects.FrmJBDMDb;
import java.sql.*;
public class FrmJBDMDb
{
public ResultSet rs = null;
//public boolean flg = false;
private String dbDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
private String dbConn = "jdbc:odbc:Dbserver";
private Connection con;
private Statement stmt;
//连接数据库
public boolean getConnection() {
try {
//加载驱动程序
Class.forName(dbDriver);
//建立连接
con = DriverManager.getConnection(dbConn);
//关闭自动提交
con.setAutoCommit(false);
//设定事务级别
con.setTransactionIsolation(con.TRANSACTION_SERIALIZABLE);
//创建一个JDBC声明
stmt = con.createStatement();
}
catch (Exception e)
{
System.out.println(e.getMessage());
e.printStackTrace();
return false;
}
return true;
}
/**
* 函数名:getJBDM
* 编写者:LC
* 功 能:查询所有疾病代码
* 输入参数:无
* 输出参数:无
* 备 注:
*/
public boolean getJBDM(){
//查询所有记录
try{
//ResultSet rs=new ResultSet();
String strSQL="";
strSQL="select * from JBDM";
rs=stmt.executeQuery(strSQL);
}
catch (SQLException e) {
System.out.println(e.getMessage());
e.printStackTrace();
return false;
}
return true;
}
/**
* 函数名:delJBDM
* 编写者:LC
* 功 能:删除疾病代码表中一项记录
* 输入参数:疾病代码ICD编号
* 输出参数:成功删除记录的数目
* 备 注:
*/
public int delJBDM(String strIcd){
//删除记录
int count=0;
String strSQL="";
strSQL="delete from JBDM ";
strSQL=strSQL+"where ICD='"+strIcd+"'";
System.out.println(strSQL);
try {
count=stmt.executeUpdate(strSQL);
con.commit();
}
catch(SQLException e){
System.out.println(count);
return -1;
}
System.out.println(count);
return count;
}
/**
* 函数名:insertJBDM
* 编写者:LC
* 功 能:插入记录到疾病代码表中
* 输入参数:疾病代码ICD编号,疾病名称,是否慢性病,是否大额病,结算定额
* 输出参数:成功插入疾病代码表的记录的数目
* 备 注:
*/
public int insertJBDM(String strIcd,String strJbmc,
String strSfmx,String strSfde,String strJsde){
int count=0;
if(strJsde.trim().equals(""))
strJsde = "null";
String strSQL = "";
strSQL = "insert into JBDM values";
strSQL = strSQL + "('"+strIcd+"','"+strJbmc+"','"+strSfmx+"','"+strSfde+"',";
strSQL = strSQL + strJsde + ")";
System.out.println(strSQL);
try{
count=stmt.executeUpdate(strSQL);
con.commit();
}
catch(SQLException e){
System.out.println(count);
return -1;
}
System.out.println(count);
return count;
}
/**
* 函数名:updateJBDM
* 编写者:LC
* 功 能:修改疾病代码表中记录
* 输入参数:疾病代码ICD编号,疾病名称,是否慢性病,是否大额病,结算定额
* 输出参数:成功修改疾病代码表中记录的数目
* 备 注:
*/
public int updateJBDM(String strIcd,String strJbmc,
String strSfmx,String strSfde,String strJsde){
int count = 0;
if(strJsde.trim().equals(""))
strJsde = "null";
String strSQL = "";
strSQL = "Update JBDM SET ";
strSQL = strSQL + "JBMC='"+strJbmc+"',SFMX='"+strSfmx;
strSQL = strSQL +"',SFDE='"+strSfde+"',JSDE="+strJsde;
strSQL = strSQL+" where ICD='"+strIcd+"'";
System.out.println(strSQL);
try{
count=stmt.executeUpdate(strSQL);
con.commit();
}
catch(SQLException e){
return -1;
}
return count;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -