Procházet zdrojové kódy

新增测试条目

lantone před 5 roky
rodič
revize
c480b154b5

+ 96 - 0
src/main/java/com/diagbot/util/DBConn.java

@@ -0,0 +1,96 @@
+package com.diagbot.util;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+
+public class DBConn {
+	public static void main(String[] args) throws Exception{
+
+        String username = "root";// 数据库用户名
+        String password = "langtong";// 数据库密码
+
+        //sqlServer
+        String sqlServerDriver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
+        String sqlServerUrl = "jdbc:sqlserver://192.1.2.92:1433;DatabaseName=lis";
+
+        //mysql8.0以上
+        String mysqlHighDriver = "com.mysql.cj.jdbc.Driver";
+        String mysqlHighUrl = "jdbc:mysql://localhost:3306/RUNOOB?useSSL=false&serverTimezone=UTC";
+
+        //mysql8.0以下
+        String mysqlLowDriver = "com.mysql.jdbc.Driver";
+        String mysqlLowUrl = "jdbc:mysql://localhost:3306/world";
+
+        //oracle
+        String oracleDriver = "oracle.jdbc.OracleDriver";
+        String oracleUrl = "jdbc:oracle:thin:@localhost:1521:XE";
+
+        File file1;
+        File file2;
+
+        FileOutputStream fop = null;
+
+        Connection conn = null;
+        try {
+            Class.forName(mysqlLowDriver);
+            conn = DriverManager.getConnection(mysqlLowUrl, username, password);
+
+            /*System.out.println("国家代码:");
+            Scanner input = new Scanner(System.in);
+            input.useDelimiter("\n");
+            String countryCode = input.next();*/
+
+            PreparedStatement pst = null;
+            pst =  conn.prepareStatement("select DISTINCT (CountryCode) from city");
+            ResultSet rs = pst.executeQuery();
+
+            while(rs.next()){
+                String filePar = "C:/Users/94556/Desktop/test/" + rs.getString("CountryCode");// 文件夹路径
+                file1 = new File(filePar);
+                if (!file1.exists()) {
+                    file1.mkdirs();
+                }
+
+                PreparedStatement pst1 = null;
+                pst1 =  conn.prepareStatement("select * from city where CountryCode = '" + rs.getString("CountryCode") +"'");
+                ResultSet rs1 = pst1.executeQuery();
+
+                while(rs1.next()){
+
+                    file2 = new File("C:/Users/94556/Desktop/test/" + rs.getString("CountryCode") + "/" + rs1.getString("Name") + ".txt");
+                    fop = new FileOutputStream(file2);
+
+                    if (!file2.exists()) {
+                        file2.createNewFile();
+                    }
+
+                    StringBuffer content = new StringBuffer("城市:" + rs1.getString("Name") +
+                            ",国家代号:" + rs1.getString("CountryCode") +
+                            ",行政区:" + rs1.getString("District") +
+                            ",人口:" + rs1.getString("Population") + "\n");
+
+                    byte[] contentInBytes = content.toString().getBytes();
+                    fop.write(contentInBytes);
+
+                }
+                fop.flush();
+                fop.close();
+
+                rs1.close();
+                pst1.close();
+            }
+
+            rs.close();
+            pst.close();
+            conn.close();
+
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 32 - 0
src/main/java/com/diagbot/util/ReadProperties.java

@@ -0,0 +1,32 @@
+package com.diagbot.util;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.stereotype.Component;
+
+@Component
+@PropertySource(value={"classpath:jdbc.properties"})
+public class ReadProperties {
+
+	@Value(value="${remote.address.ver}")
+	public String remoteAddressVer;
+	
+	@Value(value="${remote.address.hor}")
+	public String remoteAddressHor;
+
+	public String getRemoteAddressVer() {
+		return remoteAddressVer;
+	}
+
+	public String getRemoteAddressHor() {
+		return remoteAddressHor;
+	}
+
+	@Value(value="${his.patient.url}")
+	public String hisPatientUrl;
+
+	public String getHisPatientUrl() {
+		return hisPatientUrl;
+	}
+	
+}

+ 17 - 0
src/main/resources/jdbc.properties

@@ -0,0 +1,17 @@
+#\u6570\u636e\u5e93\u914d\u7f6e
+#jdbc.driverClassName=com.mysql.jdbc.Driver
+#jdbc.url=jdbc:mysql://127.0.0.1:3306/diagbot-app?useUnicode=true&characterEncoding=UTF-8
+#jdbc.username=root
+#jdbc.password=root
+
+jdbc.driverClassName=oracle.jdbc.OracleDriver
+jdbc.url=jdbc:oracle:thin:@192.168.2.246:1521:ETRACKMRQC
+jdbc.username=ETRACKMRQC
+jdbc.password=ETRACKMRQC
+
+#\u6570\u636e\u670d\u52a1\u6a21\u5f0f
+remote.address.ver=http://192.18.101.207:2030/index.html
+remote.address.hor=http://192.18.101.207:2030/indexHorizontal.html
+
+#his\u65b9\u60a3\u8005\u63a5\u53e3\u5730\u5740
+his.patient.url=