|
@@ -0,0 +1,45 @@
|
|
|
+package org.diagbot.graph.scale;
|
|
|
+
|
|
|
+import org.diagbot.graph.util.MysqlConnUtil;
|
|
|
+
|
|
|
+import java.sql.*;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 把量表数据从mysql中读出,存到neo4j
|
|
|
+ */
|
|
|
+public class ProcessScale {
|
|
|
+ private MysqlConnUtil mysqlConnUtil =null;
|
|
|
+ private Connection mysqlConnection =null;
|
|
|
+ private PreparedStatement preparedStatement =null;
|
|
|
+ private ResultSet resultSet =null;
|
|
|
+ private String sql;
|
|
|
+ public void selctData() throws SQLException {
|
|
|
+ mysqlConnUtil = new MysqlConnUtil();
|
|
|
+ if(mysqlConnection == null){
|
|
|
+ mysqlConnection = mysqlConnUtil.getMysqlConnection();
|
|
|
+ }
|
|
|
+ sql = "SELECT item,name,symptom,score,computing_method FROM `mdns`";
|
|
|
+ try {
|
|
|
+ preparedStatement = mysqlConnection.prepareStatement(sql);
|
|
|
+ resultSet = preparedStatement.executeQuery();
|
|
|
+ while (resultSet.next()){
|
|
|
+ String item = resultSet.getString(1);
|
|
|
+ String name = resultSet.getString(2);
|
|
|
+ String symptom = resultSet.getString(3);
|
|
|
+ Double score = resultSet.getDouble(4);
|
|
|
+ String computing_method = resultSet.getString(5);
|
|
|
+ System.out.println(item+"\t"+name+"\t"+symptom+"\t"+score+"\t"+computing_method);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }finally {
|
|
|
+ if(resultSet !=null){
|
|
|
+ resultSet.close();
|
|
|
+ }
|
|
|
+ if(mysqlConnection !=null){
|
|
|
+ mysqlConnection.close();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|