13 收费工作站-》门诊挂号1、将医生改成出诊医生。
2、将出诊医生字段选中‘内科医生1’,点击【确认】按钮,重新打开出诊医生字段的内容保存成功
This commit is contained in:
45
openhis-server-new/com/openhis/tool/DatabaseFieldAdder.java
Normal file
45
openhis-server-new/com/openhis/tool/DatabaseFieldAdder.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package com.openhis.tool;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.Statement;
|
||||
|
||||
/**
|
||||
* Database field adder tool
|
||||
*/
|
||||
public class DatabaseFieldAdder {
|
||||
public static void main(String[] args) {
|
||||
String url = "jdbc:postgresql://192.168.110.252:15432/postgresql?currentSchema=public";
|
||||
String username = "postgresql";
|
||||
String password = "Jchl1528";
|
||||
|
||||
try (Connection conn = DriverManager.getConnection(url, username, password);
|
||||
Statement stmt = conn.createStatement()) {
|
||||
|
||||
// Check if field exists
|
||||
String checkSql = "SELECT column_name FROM information_schema.columns " +
|
||||
"WHERE table_name = 'adm_healthcare_service' AND column_name = 'practitioner_id'";
|
||||
|
||||
boolean fieldExists = stmt.executeQuery(checkSql).next();
|
||||
|
||||
if (!fieldExists) {
|
||||
// Add field
|
||||
String addSql = "ALTER TABLE \"public\".\"adm_healthcare_service\" " +
|
||||
"ADD COLUMN \"practitioner_id\" int8";
|
||||
stmt.execute(addSql);
|
||||
|
||||
// Add comment
|
||||
String commentSql = "COMMENT ON COLUMN \"public\".\"adm_healthcare_service\".\"practitioner_id\" IS 'practitioner_id'";
|
||||
stmt.execute(commentSql);
|
||||
|
||||
System.out.println("Successfully added practitioner_id field to adm_healthcare_service table");
|
||||
} else {
|
||||
System.out.println("practitioner_id field already exists");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error executing SQL: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user