- 重命名目录: openhis-server-new → healthlink-his-server - 重命名目录: openhis-ui-vue3 → healthlink-his-ui - 重命名Java类: OpenHisApplication → HealthLinkHisApplication - 重命名Java类: OpenHisMiniApp → HealthLinkHisMiniApp - 重命名组件目录: OpenHis → HealthLinkHis - 重命名样式文件: openhis.scss → healthlink-his.scss - 重命名配置: nginx-openhis.conf → nginx-healthlink-his.conf - 更新所有源码引用 (0个残留) - 更新所有文档/脚本/配置中的引用
50 lines
1.9 KiB
Java
Executable File
50 lines
1.9 KiB
Java
Executable File
package com.healthlink.his.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 = System.getenv("DB_URL");
|
|
String username = System.getenv("DB_USERNAME");
|
|
String password = System.getenv("DB_PASSWORD");
|
|
|
|
if (url == null || username == null || password == null) {
|
|
System.err.println("Please set DB_URL, DB_USERNAME, DB_PASSWORD environment variables");
|
|
return;
|
|
}
|
|
|
|
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();
|
|
}
|
|
}
|
|
} |