├── .gitignore ├── DataMiningPretreat ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── demo │ │ │ ├── DemoApplication.java │ │ │ ├── GetAuth │ │ │ └── getAuth.java │ │ │ ├── GetData │ │ │ └── getData.java │ │ │ ├── SmartContract │ │ │ └── KCliteWithToken2_sol_KCliteWithToken2.java │ │ │ ├── controller │ │ │ └── DataMiningController.java │ │ │ ├── entity │ │ │ └── getColumnBySQLForm.java │ │ │ └── service │ │ │ └── WriteCSV.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── example │ └── demo │ └── DemoApplicationTests.java ├── DataSQL ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── DataSQL.iml ├── mvnw ├── mvnw.cmd ├── mybatisGenerator │ ├── generator.properties │ ├── generator.sh │ ├── generatorConfig.xml │ ├── mybatis-generator-core-1.3.2.jar │ └── mysql-connector-java-5.1.37-bin.jar ├── pom.xml ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── demo │ │ │ │ ├── DemoApplication.java │ │ │ │ ├── SmartContact │ │ │ │ └── KCliteWithToken2_sol_KCliteWithToken2.java │ │ │ │ ├── component │ │ │ │ └── InfoDaoEM.java │ │ │ │ ├── controller │ │ │ │ └── DataSqlController.java │ │ │ │ ├── entity │ │ │ │ ├── ColumnRequestForm.java │ │ │ │ ├── Ehr.java │ │ │ │ ├── EhrRequestForm.java │ │ │ │ ├── Mdata.java │ │ │ │ ├── SQLRequestForm.java │ │ │ │ ├── SolveRequestForm.java │ │ │ │ └── Web3jConnection.java │ │ │ │ └── service │ │ │ │ ├── DataSqlService.java │ │ │ │ ├── DataSqlServiceImpl.java │ │ │ │ ├── EhrService.java │ │ │ │ └── ProcessData.java │ │ └── resources │ │ │ └── application.yml │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── demo │ │ └── DemoApplicationTests.java └── target │ ├── classes │ ├── application.yml │ └── com │ │ └── example │ │ └── demo │ │ ├── DemoApplication.class │ │ ├── component │ │ └── InfoDaoEM.class │ │ ├── controller │ │ └── DataSqlController.class │ │ ├── entity │ │ ├── ColumnRequestForm.class │ │ ├── Ehr.class │ │ └── EhrRequestForm.class │ │ └── service │ │ ├── DataSqlService.class │ │ ├── DataSqlServiceImpl.class │ │ └── EhrService.class │ └── test-classes │ └── com │ └── example │ └── demo │ └── DemoApplicationTests.class ├── Kernel Contract ├── KCfullVersionSol0.4.25.sol ├── KCfullVersionSol0.5.0sol.sol ├── KClite.sol ├── KCliteWithToken.sol ├── KCliteWithToken1.sol ├── KCliteWithToken2.sol ├── KCwithoutTime.sol ├── KernelContractOldVersion.sol └── listRequest.sol ├── README.md ├── bhreact ├── .gitignore ├── LICENSE ├── box-img-lg.png ├── box-img-sm.png ├── config │ ├── env.js │ ├── jest │ │ ├── cssTransform.js │ │ └── fileTransform.js │ ├── paths.js │ ├── polyfills.js │ ├── webpack.config.dev.js │ └── webpack.config.prod.js ├── contracts │ ├── KClite.sol │ ├── Migrations.sol │ └── zeppelin │ │ ├── lifecycle │ │ └── Killable.sol │ │ └── ownership │ │ └── Ownable.sol ├── migrations │ ├── 1_initial_migration.js │ └── 2_deploy_contracts.js ├── package-lock.json ├── package.json ├── public │ ├── favicon.ico │ ├── index.html │ └── server │ │ └── queryEhr.json ├── scripts │ ├── build.js │ ├── start.js │ └── test.js ├── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── css │ │ ├── open-sans.css │ │ ├── oswald.css │ │ └── pure-min.css │ ├── ehr │ │ ├── authorize │ │ │ ├── AuthorizeActions.js │ │ │ ├── AuthorizeContainer.js │ │ │ ├── AuthorizeForm.js │ │ │ └── AuthorizeReducer.js │ │ ├── constant │ │ │ └── EhrConstants.js │ │ ├── datamining │ │ │ ├── DataMiningActions.js │ │ │ ├── DataMiningContainer.js │ │ │ ├── DataMiningForm.js │ │ │ └── DataMiningReducer.js │ │ ├── homepage │ │ │ ├── AuthCard.js │ │ │ ├── HomePage.js │ │ │ ├── QueryCard.js │ │ │ └── SignupCard.js │ │ ├── queryehr │ │ │ ├── LoginButton.js │ │ │ ├── QueryEhrActions.js │ │ │ ├── QueryEhrContainer.js │ │ │ ├── QueryEhrQuery.js │ │ │ ├── QueryEhrTable.js │ │ │ ├── queryEhrReducer.js │ │ │ └── tableform.less │ │ └── signup │ │ │ ├── SignUpActions.js │ │ │ ├── SignUpContainer.js │ │ │ └── SignUpForm.js │ ├── fonts │ │ ├── Open-Sans-regular │ │ │ ├── LICENSE.txt │ │ │ ├── Open-Sans-regular.eot │ │ │ ├── Open-Sans-regular.svg │ │ │ ├── Open-Sans-regular.ttf │ │ │ ├── Open-Sans-regular.woff │ │ │ └── Open-Sans-regular.woff2 │ │ ├── Oswald-300 │ │ │ ├── LICENSE.txt │ │ │ ├── Oswald-300.eot │ │ │ ├── Oswald-300.svg │ │ │ ├── Oswald-300.ttf │ │ │ ├── Oswald-300.woff │ │ │ └── Oswald-300.woff2 │ │ └── Oswald-regular │ │ │ ├── LICENSE.txt │ │ │ ├── Oswald-regular.eot │ │ │ ├── Oswald-regular.svg │ │ │ ├── Oswald-regular.ttf │ │ │ ├── Oswald-regular.woff │ │ │ └── Oswald-regular.woff2 │ ├── index.css │ ├── index.js │ ├── reducer.js │ ├── store.js │ └── util │ │ ├── httpRequest.js │ │ ├── web3 │ │ ├── getWeb3.js │ │ └── web3Reducer.js │ │ └── wrappers.js ├── test │ ├── TestAuthentication.sol │ └── authentication.js ├── truffle-config.js └── truffle.js ├── createdata ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── mybatisGenerator │ ├── generator.properties │ ├── generator.sh │ ├── generatorConfig.xml │ ├── mybatis-generator-core-1.3.2.jar │ └── mysql-connector-java-5.1.37-bin.jar ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── createdata │ │ │ ├── CreatedataApplication.java │ │ │ ├── controller │ │ │ └── TestController.java │ │ │ ├── entity │ │ │ ├── EhrData.java │ │ │ └── EhrDataExample.java │ │ │ ├── mapper │ │ │ ├── EhrDataMapper.java │ │ │ └── EhrMapper.java │ │ │ └── service │ │ │ ├── CreateDataService.java │ │ │ └── HadoopService.java │ └── resources │ │ ├── application.yml │ │ └── com │ │ └── example │ │ └── createdata │ │ └── mapper │ │ └── EhrDataMapper.xml │ └── test │ └── java │ └── com │ └── example │ └── createdata │ └── CreatedataApplicationTests.java ├── doc ├── BlockHealth软件构架文档.docx ├── WorkSummary │ ├── 第七周工作总结.docx │ ├── 第九周工作总结.docx │ ├── 第五周工作总结.docx │ ├── 第八周工作总结.docx │ ├── 第六周工作总结.docx │ ├── 第十一周工作总结.docx │ ├── 第十三周工作总结.docx │ ├── 第十五周工作总结.docx │ ├── 第十六到十八周工作总结.docx │ ├── 第十周工作总结.docx │ └── 第十四周工作总结.docx ├── 第四小组_答辩.pptx ├── 第四组_立项建议书.docx ├── 第四组_立项建议书V2.doc ├── 第四组_立项建议书V4.doc ├── 第四组软件需求规约1.0.2.docx ├── 迭代一 │ ├── .~lock.搭建私有链.docx# │ ├── 搭建私有链.docx │ ├── 智能合约部署.docx │ ├── 迭代一计划.docx │ └── 迭代一评估报告.docx ├── 迭代三 │ ├── 迭代三测试报告.docx │ ├── 迭代三测试计划.docx │ ├── 迭代三计划.docx │ └── 迭代三评估报告.docx ├── 迭代二 │ ├── 迭代二测试报告.docx │ ├── 迭代二测试计划.docx │ ├── 迭代二计划.docx │ └── 迭代二评估报告.docx ├── 迭代五 │ ├── 迭代五测试报告.docx │ ├── 迭代五测试计划.docx │ ├── 迭代五计划.docx │ └── 迭代五评估报告.docx ├── 迭代六 │ ├── ~$Doc2.docx │ ├── 对比实验报告.docx │ ├── 性能对比测试数据.xlsx │ ├── 迭代六测试报告.docx │ ├── 迭代六测试计划.docx │ ├── 迭代六计划.docx │ └── 迭代六评估报告.docx ├── 迭代四 │ ├── 迭代四测试报告.docx │ ├── 迭代四测试计划.docx │ ├── 迭代四计划.docx │ └── 迭代四评估报告.docx └── 项目总结报告.docx └── genesis.json /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | .settings 4 | target 5 | .project 6 | .classpath 7 | 8 | # Numerous always-ignore extensions 9 | *.bak 10 | *.patch 11 | *.diff 12 | *.err 13 | 14 | # temp file for git conflict merging 15 | *.orig 16 | *.log 17 | *.rej 18 | *.swo 19 | *.swp 20 | *.zip 21 | *.vi 22 | *~ 23 | *.sass-cache 24 | *.tmp.html 25 | *.dump 26 | 27 | # OS or Editor folders 28 | .DS_Store 29 | ._* 30 | .cache 31 | .project 32 | .settings 33 | .tmproj 34 | *.esproj 35 | *.sublime-project 36 | *.sublime-workspace 37 | nbproject 38 | thumbs.db 39 | *.iml 40 | 41 | # Folders to ignore 42 | .hg 43 | .svn 44 | .CVS 45 | .idea 46 | node_modules/ 47 | jscoverage_lib/ 48 | 49 | src/main/webapp/dist/ 50 | src/main/webapp/rsrc/ 51 | webpack-assets.json 52 | spring-config.properties 53 | .DS_Store 54 | -------------------------------------------------------------------------------- /DataMiningPretreat/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ -------------------------------------------------------------------------------- /DataMiningPretreat/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/DataMiningPretreat/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /DataMiningPretreat/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip 2 | -------------------------------------------------------------------------------- /DataMiningPretreat/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" 124 | FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( 125 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 126 | ) 127 | 128 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 129 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 130 | if exist %WRAPPER_JAR% ( 131 | echo Found %WRAPPER_JAR% 132 | ) else ( 133 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 134 | echo Downloading from: %DOWNLOAD_URL% 135 | powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" 136 | echo Finished downloading %WRAPPER_JAR% 137 | ) 138 | @REM End of extension 139 | 140 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 141 | if ERRORLEVEL 1 goto error 142 | goto end 143 | 144 | :error 145 | set ERROR_CODE=1 146 | 147 | :end 148 | @endlocal & set ERROR_CODE=%ERROR_CODE% 149 | 150 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 151 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 152 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 153 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 154 | :skipRcPost 155 | 156 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 157 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 158 | 159 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 160 | 161 | exit /B %ERROR_CODE% 162 | -------------------------------------------------------------------------------- /DataMiningPretreat/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.1.1.RELEASE 9 | 10 | 11 | com.example 12 | demo 13 | 0.0.1-SNAPSHOT 14 | demo 15 | Demo project for Spring Boot 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-starter-web 25 | 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-test 30 | test 31 | 32 | 33 | 34 | org.web3j 35 | abi 36 | 4.0.1 37 | 38 | 39 | net.sourceforge.javacsv 40 | javacsv 41 | 2.0 42 | 43 | 44 | org.apache.poi 45 | poi 46 | 4.0.1 47 | 48 | 49 | 50 | org.apache.poi 51 | poi-ooxml 52 | 4.0.1 53 | 54 | 55 | org.web3j 56 | core 57 | 4.0.1 58 | 59 | 60 | org.web3j 61 | crypto 62 | 4.0.1 63 | 64 | 65 | org.web3j 66 | tuples 67 | 4.0.1 68 | 69 | 70 | org.web3j 71 | rlp 72 | 4.0.1 73 | 74 | 75 | org.web3j 76 | utils 77 | 4.0.1 78 | 79 | 80 | org.web3j 81 | web3j-spring-boot-starter 82 | 1.6.0 83 | 84 | 85 | 86 | au.com.dius 87 | pact-jvm-provider-maven_2.12 88 | 3.6.0 89 | 90 | 91 | com.alibaba 92 | fastjson 93 | 1.2.54 94 | 95 | 96 | com.squareup.okhttp3 97 | okhttp 98 | 3.8.1 99 | 100 | 101 | com.opencsv 102 | opencsv 103 | 3.3 104 | 105 | 106 | com.opencsv 107 | opencsv 108 | 3.3 109 | 110 | 111 | 112 | 113 | 114 | 115 | org.springframework.boot 116 | spring-boot-maven-plugin 117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /DataMiningPretreat/src/main/java/com/example/demo/DemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DemoApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DemoApplication.class, args); 11 | } 12 | 13 | } 14 | 15 | -------------------------------------------------------------------------------- /DataMiningPretreat/src/main/java/com/example/demo/GetAuth/getAuth.java: -------------------------------------------------------------------------------- 1 | package com.example.demo.GetAuth; 2 | 3 | import com.example.demo.SmartContract.KCliteWithToken2_sol_KCliteWithToken2; 4 | import com.google.common.collect.Lists; 5 | import org.apache.commons.lang3.StringUtils; 6 | import org.web3j.abi.FunctionEncoder; 7 | import org.web3j.abi.datatypes.Function; 8 | import org.web3j.crypto.CipherException; 9 | import org.web3j.crypto.Credentials; 10 | import org.web3j.crypto.WalletUtils; 11 | import org.web3j.protocol.Web3j; 12 | import org.web3j.protocol.core.DefaultBlockParameterName; 13 | import org.web3j.protocol.core.methods.request.Transaction; 14 | import org.web3j.protocol.core.methods.response.EthGetTransactionCount; 15 | import org.web3j.protocol.http.HttpService; 16 | 17 | import java.io.IOException; 18 | import java.math.BigInteger; 19 | import java.util.Arrays; 20 | import java.util.List; 21 | 22 | public class getAuth { 23 | private KCliteWithToken2_sol_KCliteWithToken2 smartContract = null; 24 | private Credentials credentials = null; 25 | Web3j web3j = Web3j.build(new HttpService("http://127.0.0.1:8080/")); 26 | public boolean get() { 27 | //建立以太坊连接 28 | // String URL = ""; 29 | // Web3j web3j = Web3j.build(new HttpService(URL)); 30 | 31 | //加载账户信息 32 | try { 33 | credentials = WalletUtils.loadCredentials("123", "H:/app/Ethereum/Blockchain Env/node5/keystore/UTC--2018-12-22T07-27-09.853000000Z--ce64c933e5570ba77b7825f97804b7dcecb184ae"); 34 | System.out.println("credentials=" + credentials.getAddress()); 35 | } catch (IOException e1) { 36 | // TODO Auto-generated catch block 37 | e1.printStackTrace(); 38 | } catch (CipherException e1) { 39 | // TODO Auto-generated catch block 40 | e1.printStackTrace(); 41 | } 42 | 43 | //合约地址 44 | String address1 ="0xe696d0d3ac6f059fb35db2a05b1a3326b665544d"; 45 | 46 | //加载合约 47 | smartContract = KCliteWithToken2_sol_KCliteWithToken2.load(address1, web3j, credentials, BigInteger.valueOf(2000000), BigInteger.valueOf(50000000)); 48 | 49 | return true; 50 | 51 | } 52 | public String getToken(){ 53 | String token=""; 54 | try { 55 | Function function=new Function("getToken", Lists.newArrayList(),Lists.newArrayList()); 56 | String encodedFunction = FunctionEncoder.encode(function); 57 | 58 | EthGetTransactionCount ethGetTransactionCount = web3j.ethGetTransactionCount(credentials.getAddress(), DefaultBlockParameterName.LATEST).sendAsync().get(); 59 | BigInteger nonce = ethGetTransactionCount.getTransactionCount(); 60 | 61 | Transaction transaction = Transaction.createFunctionCallTransaction( "0xce64c933e5570ba77b7825f97804b7dcecb184ae", nonce, smartContract.GAS_PRICE,smartContract.GAS_LIMIT, "0xe696d0d3ac6f059fb35db2a05b1a3326b665544d", encodedFunction); 62 | 63 | org.web3j.protocol.core.methods.response.EthSendTransaction transactionResponse = web3j.ethSendTransaction(transaction).sendAsync().get(); 64 | String transactionHash = transactionResponse.getTransactionHash(); 65 | if (StringUtils.isEmpty(transactionHash)){ 66 | throw new RuntimeException("token failed"); 67 | } 68 | token=smartContract.whatIsMyToken().send().toString(); 69 | System.out.println(token); 70 | return token; 71 | } catch (Exception e) { 72 | e.printStackTrace(); 73 | System.out.println("failed get token"); 74 | throw new RuntimeException(e); 75 | } 76 | } 77 | 78 | public List split(){ 79 | String hsptname = null; 80 | try { 81 | hsptname = smartContract.getHpstIp().send().toString(); 82 | System.out.println(hsptname); 83 | } catch (Exception e) { 84 | // TODO Auto-generated catch block 85 | e.printStackTrace(); 86 | } 87 | List addr= Arrays.asList(hsptname.split(",")); 88 | return addr; 89 | } 90 | 91 | 92 | 93 | } 94 | 95 | -------------------------------------------------------------------------------- /DataMiningPretreat/src/main/java/com/example/demo/GetData/getData.java: -------------------------------------------------------------------------------- 1 | package com.example.demo.GetData; 2 | 3 | import com.example.demo.GetAuth.getAuth; 4 | import com.alibaba.fastjson.JSON; 5 | import com.google.common.collect.Lists; 6 | import com.example.demo.entity.getColumnBySQLForm; 7 | import org.apache.http.HttpResponse; 8 | import org.apache.http.client.HttpClient; 9 | import org.apache.http.client.methods.HttpPost; 10 | import org.apache.http.entity.StringEntity; 11 | import org.apache.http.impl.client.DefaultHttpClient; 12 | import org.apache.http.params.CoreConnectionPNames; 13 | import org.apache.http.util.EntityUtils; 14 | import org.springframework.stereotype.Service; 15 | 16 | import java.io.IOException; 17 | import java.io.InputStream; 18 | import java.nio.charset.Charset; 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | 23 | @Service 24 | public class getData { 25 | public HttpClient getHttpClient(){ 26 | HttpClient httpClient = new DefaultHttpClient(); 27 | httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 200000); 28 | httpClient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 200000); 29 | return httpClient; 30 | } 31 | 32 | 33 | public List getResultByPost(List Sqlcolumn) { 34 | getAuth g=new getAuth(); 35 | g.get(); 36 | getColumnBySQLForm gCBSQLF = new getColumnBySQLForm(); 37 | gCBSQLF.setSqlcolumn(Sqlcolumn); 38 | gCBSQLF.setToken(g.getToken()); 39 | List addresslist=g.split(); 40 | List strResult=new ArrayList<>(); 41 | for(int i = 0 ; i getString(List Sqlcolumn){ 75 | List strResult=this.getResultByPost(Sqlcolumn); 76 | String[] rettmp = new String[]{}; 77 | List ret = Lists.newArrayList(); 78 | try { 79 | for (int i = 0; i < strResult.size(); i++) { 80 | String retList=strResult.get(i); 81 | System.out.println(retList); 82 | rettmp=retList.split("]"); 83 | for (int j = 0; j < rettmp.length; j++) { 84 | String[] tmp1=new String[]{}; 85 | tmp1=rettmp[j].split("\\[|,"); 86 | String[] tmp2=new String[tmp1.length]; 87 | for (int k = 0; k < tmp1.length-2; k++) { 88 | tmp2[k]=tmp1[k+2]; 89 | } 90 | ret.add(tmp2); 91 | } 92 | } 93 | 94 | 95 | return ret; 96 | } catch (Exception e) { 97 | e.printStackTrace(); 98 | } 99 | return new ArrayList() ; 100 | } 101 | } 102 | 103 | -------------------------------------------------------------------------------- /DataMiningPretreat/src/main/java/com/example/demo/controller/DataMiningController.java: -------------------------------------------------------------------------------- 1 | package com.example.demo.controller; 2 | 3 | 4 | import com.example.demo.GetData.getData; 5 | import com.example.demo.entity.getColumnBySQLForm; 6 | import org.springframework.beans.factory.ListableBeanFactory; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.*; 9 | import com.example.demo.service.WriteCSV; 10 | 11 | import java.util.List; 12 | import java.util.ArrayList; 13 | 14 | @RestController 15 | @RequestMapping(value="/") 16 | @CrossOrigin 17 | public class DataMiningController { 18 | @Autowired 19 | private WriteCSV writeCSV; 20 | @Autowired 21 | private getData getdata; 22 | 23 | @RequestMapping(value = "/getMiningData",method = RequestMethod.POST) 24 | public String getMiningData(@RequestBody getColumnBySQLForm form){ 25 | writeCSV.write(getdata.getString(form.getSqlcolumn())); 26 | return writeCSV.getFilePath(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /DataMiningPretreat/src/main/java/com/example/demo/entity/getColumnBySQLForm.java: -------------------------------------------------------------------------------- 1 | package com.example.demo.entity; 2 | 3 | 4 | import java.util.List; 5 | 6 | public class getColumnBySQLForm { 7 | private String token; 8 | private List sqlcolumn; 9 | 10 | public String getToken() { 11 | return token; 12 | } 13 | 14 | public void setToken(String token) { 15 | this.token = token; 16 | } 17 | 18 | public List getSqlcolumn() { 19 | return sqlcolumn; 20 | } 21 | 22 | public void setSqlcolumn(List sqlcolumn) { 23 | this.sqlcolumn = sqlcolumn; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /DataMiningPretreat/src/main/java/com/example/demo/service/WriteCSV.java: -------------------------------------------------------------------------------- 1 | package com.example.demo.service; 2 | 3 | import com.example.demo.GetData.getData; 4 | import com.csvreader.CsvWriter; 5 | import org.apache.poi.ss.usermodel.Cell; 6 | import org.apache.poi.ss.usermodel.Row; 7 | import org.apache.poi.ss.usermodel.Sheet; 8 | import org.apache.poi.ss.usermodel.Workbook; 9 | import org.apache.poi.xssf.usermodel.XSSFWorkbook; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.io.File; 13 | import java.io.FileOutputStream; 14 | import java.io.IOException; 15 | import java.io.OutputStream; 16 | import java.nio.charset.Charset; 17 | import java.util.Iterator; 18 | import java.util.List; 19 | import java.util.Map; 20 | 21 | @Service 22 | public class WriteCSV { 23 | 24 | private String filePath = "G:/DataMining/DataMining.csv"; 25 | 26 | public String getFilePath() { 27 | return filePath; 28 | } 29 | 30 | public void write(List content){ 31 | 32 | try { 33 | // 创建CSV写对象 34 | CsvWriter csvWriter = new CsvWriter(filePath,',', Charset.forName("gbk")); 35 | //CsvWriter csvWriter = new CsvWriter(filePath); 36 | 37 | // 写表头 38 | String[] headers = {"身高","体重","体重指数(18.5-23.9)","糖化血红蛋白","血清间接胆红素","血清球蛋白","血清碱性磷酸酶","血清r-谷氨酰转肽酶","血清谷丙转氨酶","血清谷草转氨酶","血清总蛋白","血清白/球比值","血清总胆红素","血清直接胆红素","血清白蛋白","AST/ALT比值","血清低密度脂蛋白","血清高密度脂蛋白","血清甘油三酯","血清总胆固醇","血清尿素","血清肌酐","血清尿酸"}; 39 | csvWriter.writeRecord(headers); 40 | for(String[] s : content){ 41 | csvWriter.writeRecord(s); 42 | } 43 | 44 | csvWriter.close(); 45 | 46 | } catch (IOException e) { 47 | e.printStackTrace(); 48 | } 49 | } 50 | 51 | // public boolean generateWorkbook(String path, List titles, List> values) { 52 | // Workbook workbook=new XSSFWorkbook(); 53 | // // 生成一个表格 54 | // Sheet sheet=workbook.createSheet(); 55 | // // 设置表格默认列宽度为15个字节 56 | // sheet.setDefaultColumnWidth((short) 15); 57 | // /* 58 | // * 创建标题行 59 | // */ 60 | // Row row = sheet.createRow(0); 61 | // for (int i = 0; i < titles.size(); i++) { 62 | // Cell cell = row.createCell(i); 63 | // cell.setCellValue(titles.get(i)); 64 | // } 65 | // /* 66 | // * 写入正文 67 | // */ 68 | // Iterator> iterator = values.iterator(); 69 | // int index = 0; 70 | // while (iterator.hasNext()) { 71 | // index++; 72 | // row = sheet.createRow(index); 73 | // Map value = iterator.next(); 74 | // String content = ""; 75 | // for (Map.Entry map : value.entrySet()) { 76 | // Object object = map.getValue(); 77 | // content = object.toString(); 78 | // } 79 | // for (int i = 0; i < value.size(); i++) { 80 | // Cell cell = row.createCell(i); 81 | // cell.setCellValue(content); 82 | // } 83 | // } 84 | // /* 85 | // * 写入到文件中 86 | // */ 87 | // boolean isCorrect = false; 88 | // File file = new File(path); 89 | // // 如果文件存在,则删除已有的文件,重新创建一份新的 90 | // if (file.exists()) { 91 | // file.deleteOnExit(); 92 | // file = new File(path); 93 | // } 94 | // OutputStream outputStream = null; 95 | // try { 96 | // outputStream = new FileOutputStream(file); 97 | // workbook.write(outputStream); 98 | // isCorrect = true; 99 | // } catch (IOException e) { 100 | // e.printStackTrace(); 101 | // } finally { 102 | // try { 103 | // if (null != outputStream) { 104 | // outputStream.close(); 105 | // } 106 | // } catch (IOException e) { 107 | // e.printStackTrace(); 108 | // } 109 | // } 110 | // return isCorrect; 111 | // } 112 | } 113 | -------------------------------------------------------------------------------- /DataMiningPretreat/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | Server: 2 | port: 8082 -------------------------------------------------------------------------------- /DataMiningPretreat/src/test/java/com/example/demo/DemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.example.demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class DemoApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /DataSQL/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ -------------------------------------------------------------------------------- /DataSQL/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/DataSQL/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /DataSQL/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip 2 | -------------------------------------------------------------------------------- /DataSQL/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" 124 | FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( 125 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 126 | ) 127 | 128 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 129 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 130 | if exist %WRAPPER_JAR% ( 131 | echo Found %WRAPPER_JAR% 132 | ) else ( 133 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 134 | echo Downloading from: %DOWNLOAD_URL% 135 | powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" 136 | echo Finished downloading %WRAPPER_JAR% 137 | ) 138 | @REM End of extension 139 | 140 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 141 | if ERRORLEVEL 1 goto error 142 | goto end 143 | 144 | :error 145 | set ERROR_CODE=1 146 | 147 | :end 148 | @endlocal & set ERROR_CODE=%ERROR_CODE% 149 | 150 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 151 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 152 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 153 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 154 | :skipRcPost 155 | 156 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 157 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 158 | 159 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 160 | 161 | exit /B %ERROR_CODE% 162 | -------------------------------------------------------------------------------- /DataSQL/mybatisGenerator/generator.properties: -------------------------------------------------------------------------------- 1 | tableName=column 2 | schemaName=innerSSO 3 | -------------------------------------------------------------------------------- /DataSQL/mybatisGenerator/generator.sh: -------------------------------------------------------------------------------- 1 | java -jar D:\IdeaProjects\DataSQL\mybatisGenerator\mybatis-generator-core-1.3.2.jar -configfile D:\IdeaProjects\DataSQL\mybatisGenerator\generatorConfig.xml -------------------------------------------------------------------------------- /DataSQL/mybatisGenerator/mybatis-generator-core-1.3.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/DataSQL/mybatisGenerator/mybatis-generator-core-1.3.2.jar -------------------------------------------------------------------------------- /DataSQL/mybatisGenerator/mysql-connector-java-5.1.37-bin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/DataSQL/mybatisGenerator/mysql-connector-java-5.1.37-bin.jar -------------------------------------------------------------------------------- /DataSQL/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.example 7 | demo 8 | 0.0.1-SNAPSHOT 9 | jar 10 | 11 | demo 12 | Demo project for Spring Boot 13 | 14 | 15 | org.springframework.boot 16 | spring-boot-starter-parent 17 | 2.1.0.RELEASE 18 | 19 | 20 | 21 | 22 | UTF-8 23 | UTF-8 24 | 1.8 25 | 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter-data-jpa 31 | 32 | 33 | org.springframework.boot 34 | spring-boot-starter-web 35 | 36 | 37 | 38 | mysql 39 | mysql-connector-java 40 | runtime 41 | 42 | 43 | org.springframework.boot 44 | spring-boot-starter-test 45 | test 46 | 47 | 48 | org.web3j 49 | web3j-spring-boot-starter 50 | 1.6.0 51 | 52 | 53 | 54 | org.web3j 55 | core 56 | 4.0.1 57 | 58 | 59 | org.projectlombok 60 | lombok 61 | 1.18.2 62 | 63 | 64 | org.assertj 65 | assertj-core 66 | 3.11.1 67 | 68 | 69 | org.mybatis.spring.boot 70 | mybatis-spring-boot-starter 71 | 1.3.2 72 | 73 | 74 | com.alibaba 75 | druid-spring-boot-starter 76 | 1.1.9 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | org.springframework.boot 85 | spring-boot-maven-plugin 86 | 87 | 88 | 89 | 90 | 91 | src/main/resources/com/example/demo/mapper 92 | false 93 | 94 | **/*.xml 95 | 96 | 97 | 98 | src/main/resources 99 | false 100 | 101 | **/*.yml 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /DataSQL/src/main/java/com/example/demo/DemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.demo; 2 | 3 | import com.example.demo.entity.Web3jConnection; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @SpringBootApplication 8 | public class DemoApplication { 9 | 10 | public static void main(String[] args) { 11 | SpringApplication springApplication = new SpringApplication(DemoApplication.class); 12 | springApplication.addListeners(new Web3jConnection()); 13 | springApplication.run(args); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /DataSQL/src/main/java/com/example/demo/component/InfoDaoEM.java: -------------------------------------------------------------------------------- 1 | package com.example.demo.component; 2 | 3 | import com.example.demo.entity.Ehr; 4 | import org.springframework.stereotype.Component; 5 | 6 | import javax.persistence.EntityManager; 7 | import javax.persistence.PersistenceContext; 8 | import java.util.List; 9 | 10 | @Component 11 | public class InfoDaoEM { 12 | 13 | @PersistenceContext 14 | EntityManager entityManager; 15 | 16 | //根据vid字段查找数据 17 | public List getInfoByVid(String vid , List list){ 18 | String SQL="select "; 19 | for(int i=0;i result=entityManager.createNativeQuery(SQL).getResultList(); 27 | return result; 28 | } 29 | 30 | //查找某几列字段的值 31 | public List getColumn(List list){ 32 | String SQL="select "; 33 | for(int i=0;i result=entityManager.createNativeQuery(SQL).getResultList(); 41 | System.out.println(result.size()); 42 | return result; 43 | } 44 | 45 | //自定义SQL语句查询 46 | public List getColumnBySQL(List SQLColumn){ 47 | String SQL="select "; 48 | for (int i = 0; i < SQLColumn.size(); i++) { 49 | SQL=SQL+SQLColumn.get(i); 50 | if(i != ( SQLColumn.size()-1 ) ){ 51 | SQL+=","; 52 | } 53 | } 54 | SQL+=" FROM mdata"; 55 | System.out.println(SQL); 56 | List result=entityManager.createNativeQuery(SQL).getResultList(); 57 | return result; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /DataSQL/src/main/java/com/example/demo/controller/DataSqlController.java: -------------------------------------------------------------------------------- 1 | package com.example.demo.controller; 2 | 3 | import com.example.demo.entity.*; 4 | import com.example.demo.service.EhrService; 5 | import com.example.demo.service.ProcessData; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | 14 | @RestController 15 | @RequestMapping(value="/") 16 | @CrossOrigin 17 | public class DataSqlController { 18 | @Autowired 19 | private EhrService ehrService; 20 | @Autowired 21 | private ProcessData processData; 22 | 23 | //通过vid查询某一病人的某几项数据 24 | @RequestMapping(value = "/getByVid",method = RequestMethod.POST) 25 | public List>> getByVid(@RequestBody EhrRequestForm ehrRequestForm){ 26 | try { 27 | List temp=ehrService.getByVid(ehrRequestForm.getVid(), ehrRequestForm.getToken(), ehrRequestForm.getColumnList()); 28 | return processData.Deal(ehrRequestForm.getColumnList(),temp); 29 | }catch(Exception e){ 30 | return new ArrayList<>(); 31 | } 32 | } 33 | 34 | //获取数据表中某几列数据 35 | @RequestMapping(value = "/getColumn",method = RequestMethod.POST) 36 | public Object getColumn(@RequestBody ColumnRequestForm columnRequestForm){ 37 | return ehrService.getColumn(columnRequestForm.getToken(),columnRequestForm.getColumn()); 38 | } 39 | 40 | //自定义sql语句查询 41 | @RequestMapping(value="/getColumnBySQL",method = RequestMethod.POST) 42 | public List>> getColumnBySQL(@RequestBody SQLRequestForm sqlRequestForm){ 43 | List temp=ehrService.getColumnBySQL(sqlRequestForm.getToken(),sqlRequestForm.getSqlcolumn()); 44 | return processData.Deal(sqlRequestForm.getSqlcolumn(),temp); 45 | } 46 | 47 | //授予权限 48 | @RequestMapping(value="/solveRequest",method =RequestMethod.POST) 49 | public String solveRequest(@RequestBody SolveRequestForm solveRequestForm){ 50 | return ehrService.solveRequest(solveRequestForm.getName(),solveRequestForm.getAuth()); 51 | } 52 | 53 | @RequestMapping(value="/getMiningData",method = RequestMethod.POST) 54 | public List getMiningData(@RequestBody SQLRequestForm sqlRequestForm){ 55 | return ehrService.getColumnBySQL(sqlRequestForm.getToken(),sqlRequestForm.getSqlcolumn()); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /DataSQL/src/main/java/com/example/demo/entity/ColumnRequestForm.java: -------------------------------------------------------------------------------- 1 | package com.example.demo.entity; 2 | 3 | import java.util.List; 4 | 5 | public class ColumnRequestForm { 6 | 7 | private String token; 8 | private List column; 9 | 10 | public String getToken() { 11 | return token; 12 | } 13 | 14 | public void setToken(String token) { 15 | this.token = token; 16 | } 17 | 18 | public List getColumn() { 19 | return column; 20 | } 21 | 22 | public void setColumn(List column) { 23 | this.column = column; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /DataSQL/src/main/java/com/example/demo/entity/EhrRequestForm.java: -------------------------------------------------------------------------------- 1 | package com.example.demo.entity; 2 | 3 | import java.util.List; 4 | 5 | public class EhrRequestForm { 6 | 7 | private String vid; 8 | private String token; 9 | private List columnList; 10 | 11 | public List getColumnList() { 12 | return columnList; 13 | } 14 | 15 | public void setColumnList(List columnList) { 16 | this.columnList = columnList; 17 | } 18 | 19 | public String getVid() { 20 | return vid; 21 | } 22 | 23 | public void setVid(String vid) { 24 | this.vid = vid; 25 | } 26 | 27 | public String getToken() { 28 | return token; 29 | } 30 | 31 | public void setToken(String token) { 32 | this.token = token; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /DataSQL/src/main/java/com/example/demo/entity/Mdata.java: -------------------------------------------------------------------------------- 1 | package com.example.demo.entity; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.Id; 5 | 6 | @Entity 7 | public class Mdata { 8 | @Id 9 | private int id; 10 | 11 | private int height; 12 | private int weight; 13 | private double bmi; 14 | private double bz1; 15 | private double bz2; 16 | private double bz3; 17 | private double bz4; 18 | private double bz5; 19 | private double bz6; 20 | private double bz7; 21 | private double bz8; 22 | private double bz9; 23 | private double bz10; 24 | private double bz11; 25 | private double bz12; 26 | private double bz13; 27 | private double bz14; 28 | private double bz15; 29 | private double bz16; 30 | private double bz17; 31 | private double bz18; 32 | private double bz19; 33 | private double bz20; 34 | 35 | public int getId() { 36 | return id; 37 | } 38 | 39 | public void setId(int id) { 40 | this.id = id; 41 | } 42 | 43 | public int getHeight() { 44 | return height; 45 | } 46 | 47 | public void setHeight(int height) { 48 | this.height = height; 49 | } 50 | 51 | public int getWeight() { 52 | return weight; 53 | } 54 | 55 | public void setWeight(int weight) { 56 | this.weight = weight; 57 | } 58 | 59 | public double getBmi() { 60 | return bmi; 61 | } 62 | 63 | public void setBmi(double bmi) { 64 | this.bmi = bmi; 65 | } 66 | 67 | public double getBz1() { 68 | return bz1; 69 | } 70 | 71 | public void setBz1(double bz1) { 72 | this.bz1 = bz1; 73 | } 74 | 75 | public double getBz2() { 76 | return bz2; 77 | } 78 | 79 | public void setBz2(double bz2) { 80 | this.bz2 = bz2; 81 | } 82 | 83 | public double getBz3() { 84 | return bz3; 85 | } 86 | 87 | public void setBz3(double bz3) { 88 | this.bz3 = bz3; 89 | } 90 | 91 | public double getBz4() { 92 | return bz4; 93 | } 94 | 95 | public void setBz4(double bz4) { 96 | this.bz4 = bz4; 97 | } 98 | 99 | public double getBz5() { 100 | return bz5; 101 | } 102 | 103 | public void setBz5(double bz5) { 104 | this.bz5 = bz5; 105 | } 106 | 107 | public double getBz6() { 108 | return bz6; 109 | } 110 | 111 | public void setBz6(double bz6) { 112 | this.bz6 = bz6; 113 | } 114 | 115 | public double getBz7() { 116 | return bz7; 117 | } 118 | 119 | public void setBz7(double bz7) { 120 | this.bz7 = bz7; 121 | } 122 | 123 | public double getBz8() { 124 | return bz8; 125 | } 126 | 127 | public void setBz8(double bz8) { 128 | this.bz8 = bz8; 129 | } 130 | 131 | public double getBz9() { 132 | return bz9; 133 | } 134 | 135 | public void setBz9(double bz9) { 136 | this.bz9 = bz9; 137 | } 138 | 139 | public double getBz10() { 140 | return bz10; 141 | } 142 | 143 | public void setBz10(double bz10) { 144 | this.bz10 = bz10; 145 | } 146 | 147 | public double getBz11() { 148 | return bz11; 149 | } 150 | 151 | public void setBz11(double bz11) { 152 | this.bz11 = bz11; 153 | } 154 | 155 | public double getBz12() { 156 | return bz12; 157 | } 158 | 159 | public void setBz12(double bz12) { 160 | this.bz12 = bz12; 161 | } 162 | 163 | public double getBz13() { 164 | return bz13; 165 | } 166 | 167 | public void setBz13(double bz13) { 168 | this.bz13 = bz13; 169 | } 170 | 171 | public double getBz14() { 172 | return bz14; 173 | } 174 | 175 | public void setBz14(double bz14) { 176 | this.bz14 = bz14; 177 | } 178 | 179 | public double getBz15() { 180 | return bz15; 181 | } 182 | 183 | public void setBz15(double bz15) { 184 | this.bz15 = bz15; 185 | } 186 | 187 | public double getBz16() { 188 | return bz16; 189 | } 190 | 191 | public void setBz16(double bz16) { 192 | this.bz16 = bz16; 193 | } 194 | 195 | public double getBz17() { 196 | return bz17; 197 | } 198 | 199 | public void setBz17(double bz17) { 200 | this.bz17 = bz17; 201 | } 202 | 203 | public double getBz18() { 204 | return bz18; 205 | } 206 | 207 | public void setBz18(double bz18) { 208 | this.bz18 = bz18; 209 | } 210 | 211 | public double getBz19() { 212 | return bz19; 213 | } 214 | 215 | public void setBz19(double bz19) { 216 | this.bz19 = bz19; 217 | } 218 | 219 | public double getBz20() { 220 | return bz20; 221 | } 222 | 223 | public void setBz20(double bz20) { 224 | this.bz20 = bz20; 225 | } 226 | } 227 | -------------------------------------------------------------------------------- /DataSQL/src/main/java/com/example/demo/entity/SQLRequestForm.java: -------------------------------------------------------------------------------- 1 | package com.example.demo.entity; 2 | 3 | import java.util.List; 4 | 5 | public class SQLRequestForm { 6 | private String token; 7 | private List sqlcolumn; 8 | 9 | public String getToken() { 10 | return token; 11 | } 12 | 13 | public void setToken(String token) { 14 | this.token = token; 15 | } 16 | 17 | public List getSqlcolumn() { 18 | return sqlcolumn; 19 | } 20 | 21 | public void setSqlcolumn(List sqlcolumn) { 22 | this.sqlcolumn = sqlcolumn; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /DataSQL/src/main/java/com/example/demo/entity/SolveRequestForm.java: -------------------------------------------------------------------------------- 1 | package com.example.demo.entity; 2 | 3 | public class SolveRequestForm { 4 | private String name; 5 | private int auth; 6 | 7 | public String getName() { 8 | return name; 9 | } 10 | 11 | public void setName(String name) { 12 | this.name = name; 13 | } 14 | 15 | public int getAuth() { 16 | return auth; 17 | } 18 | 19 | public void setAuth(int auth) { 20 | this.auth = auth; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /DataSQL/src/main/java/com/example/demo/entity/Web3jConnection.java: -------------------------------------------------------------------------------- 1 | package com.example.demo.entity; 2 | 3 | import com.example.demo.SmartContact.KCliteWithToken2_sol_KCliteWithToken2; 4 | import org.springframework.context.ApplicationListener; 5 | import org.springframework.context.event.ContextRefreshedEvent; 6 | import org.springframework.stereotype.Component; 7 | import org.web3j.crypto.CipherException; 8 | import org.web3j.crypto.Credentials; 9 | import org.web3j.crypto.WalletUtils; 10 | import org.web3j.protocol.Web3j; 11 | import org.web3j.protocol.http.HttpService; 12 | 13 | import java.io.IOException; 14 | import java.math.BigInteger; 15 | 16 | @Component 17 | public class Web3jConnection implements ApplicationListener { 18 | 19 | private KCliteWithToken2_sol_KCliteWithToken2 smartContract; 20 | private Credentials credentials; 21 | private Web3j web3j; 22 | 23 | @Override 24 | public void onApplicationEvent(ContextRefreshedEvent event) { 25 | String URL = "http://127.0.0.1:8080/"; 26 | web3j = Web3j.build(new HttpService(URL)); 27 | 28 | //加载账户信息 29 | try { 30 | credentials = WalletUtils.loadCredentials("123","D:/Blockchain/node6/keystore/UTC--2019-01-08T13-47-49.609770800Z--a16be9d29747ea312030b13b21cc50b59f1af997"); 31 | System.out.println("credentials=" + credentials.getAddress()); 32 | } catch (IOException e1) { 33 | // TODO Auto-generated catch block 34 | e1.printStackTrace(); 35 | } catch (CipherException e1) { 36 | // TODO Auto-generated catch block 37 | e1.printStackTrace(); 38 | } 39 | 40 | //合约地址 41 | String address1="0xe696d0d3ac6f059fb35db2a05b1a3326b665544d"; 42 | smartContract = KCliteWithToken2_sol_KCliteWithToken2.load(address1,web3j,credentials, BigInteger.valueOf(200000),BigInteger.valueOf(20000000)); 43 | } 44 | 45 | public KCliteWithToken2_sol_KCliteWithToken2 getSmartContract() { 46 | return smartContract; 47 | } 48 | 49 | public Credentials getCredentials() { 50 | return credentials; 51 | } 52 | 53 | public Web3j getWeb3j() { 54 | return web3j; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /DataSQL/src/main/java/com/example/demo/service/DataSqlService.java: -------------------------------------------------------------------------------- 1 | package com.example.demo.service; 2 | import java.util.List; 3 | 4 | 5 | import org.springframework.stereotype.Service; 6 | 7 | 8 | @Service 9 | public abstract class DataSqlService { 10 | public abstract List getColumn(List list1); 11 | public abstract List getInfoByVid(String name , List list1); 12 | public abstract List getColumnBySQL(List SQLColumn); 13 | } 14 | -------------------------------------------------------------------------------- /DataSQL/src/main/java/com/example/demo/service/DataSqlServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.demo.service; 2 | 3 | import com.example.demo.component.InfoDaoEM; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.stereotype.Service; 6 | 7 | import java.util.List; 8 | 9 | @Service 10 | public class DataSqlServiceImpl extends DataSqlService{ 11 | 12 | @Autowired 13 | private InfoDaoEM infoDaoEM; 14 | 15 | @Override 16 | public List getColumn(List list1) { 17 | return infoDaoEM.getColumn(list1); 18 | } 19 | 20 | @Override 21 | public List getInfoByVid(String name, List list1) { 22 | return infoDaoEM.getInfoByVid(name,list1); 23 | } 24 | 25 | @Override 26 | public List getColumnBySQL(List SQLColumn) { 27 | return infoDaoEM.getColumnBySQL(SQLColumn); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /DataSQL/src/main/java/com/example/demo/service/EhrService.java: -------------------------------------------------------------------------------- 1 | package com.example.demo.service; 2 | 3 | import com.example.demo.entity.Web3jConnection; 4 | import org.assertj.core.util.Lists; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | import org.springframework.util.StringUtils; 8 | import org.web3j.abi.FunctionEncoder; 9 | import org.web3j.abi.datatypes.Bool; 10 | import org.web3j.abi.datatypes.Function; 11 | import org.web3j.abi.datatypes.Utf8String; 12 | import org.web3j.protocol.core.DefaultBlockParameterName; 13 | import org.web3j.protocol.core.methods.request.Transaction; 14 | import org.web3j.protocol.core.methods.response.EthGetTransactionCount; 15 | import java.math.BigInteger; 16 | import java.util.Arrays; 17 | import java.util.List; 18 | 19 | 20 | @Service 21 | public class EhrService { 22 | 23 | @Autowired DataSqlService dataSqlService; 24 | 25 | public List getByVid(String name,String token,List list1) { 26 | if(authVert(token)) { 27 | return dataSqlService.getInfoByVid(name, list1); 28 | } else { 29 | throw new RuntimeException("无权限!"); 30 | } 31 | } 32 | 33 | public List getColumn(String token,List list2){ 34 | //权限验证 35 | if(authVert(token)) { 36 | return dataSqlService.getColumn(list2); 37 | } else { 38 | throw new RuntimeException("无权限!"); 39 | } 40 | } 41 | 42 | public List getColumnBySQL(String token, List SQLColumn){ 43 | if(authVert(token)) { 44 | return dataSqlService.getColumnBySQL(SQLColumn); 45 | } else { 46 | throw new RuntimeException("无权限!"); 47 | } 48 | } 49 | 50 | @Autowired 51 | private Web3jConnection web3jConnection; 52 | 53 | public String solveRequest(String name,int auth){ 54 | 55 | try { 56 | //对要调用的方法名转码 57 | Function function=new Function("solveRqst", Arrays.asList(new Utf8String(name)), Lists.newArrayList()); 58 | String encodedFunction = FunctionEncoder.encode(function); 59 | 60 | //获取nonce,用作此次交易的标识 61 | EthGetTransactionCount ethGetTransactionCount = web3jConnection.getWeb3j().ethGetTransactionCount(web3jConnection.getCredentials().getAddress(), DefaultBlockParameterName.LATEST).sendAsync().get(); 62 | BigInteger nonce = ethGetTransactionCount.getTransactionCount(); 63 | 64 | //发起调用方法的交易 65 | Transaction transaction = Transaction.createFunctionCallTransaction( "0xa16be9d29747ea312030b13b21cc50b59f1af997", nonce, web3jConnection.getSmartContract().GAS_PRICE,web3jConnection.getSmartContract().GAS_LIMIT, "0xe696d0d3ac6f059fb35db2a05b1a3326b665544d", encodedFunction); 66 | 67 | //获得TransactionResponse 68 | org.web3j.protocol.core.methods.response.EthSendTransaction transactionResponse = web3jConnection.getWeb3j().ethSendTransaction(transaction).sendAsync().get(); 69 | String transactionHash = transactionResponse.getTransactionHash(); 70 | if (StringUtils.isEmpty(transactionHash)) { 71 | throw new RuntimeException("交易失败"); 72 | } 73 | }catch (Exception e){ 74 | e.printStackTrace(); 75 | throw new RuntimeException(e); 76 | } 77 | return "SUCCESS"; 78 | } 79 | 80 | 81 | public Boolean authVert(String token){ 82 | Bool result = null; 83 | try { 84 | System.out.println(token); 85 | result=web3jConnection.getSmartContract().tokenVerification(new Utf8String(token)).send(); 86 | System.out.println(result.getValue()); 87 | } catch (Exception e) { 88 | // TODO Auto-generated catch block 89 | e.printStackTrace(); 90 | } 91 | return result.getValue(); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /DataSQL/src/main/java/com/example/demo/service/ProcessData.java: -------------------------------------------------------------------------------- 1 | package com.example.demo.service; 2 | 3 | import org.springframework.stereotype.Service; 4 | 5 | import java.util.*; 6 | @Service 7 | public class ProcessData { 8 | public List>> Deal(List columnname,List temp){ 9 | List>> result=new ArrayList<>(); 10 | List> restmp=new ArrayList<>(); 11 | for (int i = 0; i < temp.size(); i++) { 12 | Object[] objtmp=temp.get(i); 13 | for(int j=0; j < columnname.size(); j++){ 14 | Map oneResult=new HashMap(); 15 | if(objtmp[j]!=null){ 16 | oneResult.put("value",objtmp[j].toString()); 17 | oneResult.put("columnname",columnname.get(j)); 18 | oneResult.put("hspt","第一医院"); 19 | restmp.add(oneResult); 20 | } 21 | } 22 | result.add(restmp); 23 | 24 | } 25 | return result; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /DataSQL/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | name: mysql_test 4 | type: com.alibaba.druid.pool.DruidDataSource 5 | #druid相关配置 6 | druid: 7 | #监控统计拦截的filters 8 | filters: stat 9 | driver-class-name: com.mysql.jdbc.Driver 10 | #基本属性 11 | url: jdbc:mysql://127.0.0.1:3306/blockhealth?useSSL=false&serverTimezone=GMT%2B8 12 | username: root 13 | password: 123456 14 | #配置初始化大小/最小/最大 15 | initial-size: 1 16 | min-idle: 1 17 | max-active: 20 18 | #获取连接等待超时时间 19 | max-wait: 60000 20 | #间隔多久进行一次检测,检测需要关闭的空闲连接 21 | time-between-eviction-runs-millis: 60000 22 | #一个连接在池中最小生存的时间 23 | min-evictable-idle-time-millis: 300000 24 | validation-query: SELECT 'x' 25 | test-while-idle: true 26 | test-on-borrow: false 27 | test-on-return: false 28 | #打开PSCache,并指定每个连接上PSCache的大小。oracle设为true,mysql设为false。分库分表较多推荐设置为false 29 | pool-prepared-statements: false 30 | max-pool-prepared-statement-per-connection-size: 20 31 | 32 | server: 33 | port: 8081 34 | 35 | mybatis: 36 | mapper-locations: classpath:mapper/*.xml #注意:一定要对应mapper映射xml文件的所在路径 37 | type-aliases-package: com.example.demo.entity.Ehr # 注意:对应实体类的路径 -------------------------------------------------------------------------------- /DataSQL/src/test/java/com/example/demo/DemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.example.demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class DemoApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /DataSQL/target/classes/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | name: mysql_test 4 | type: com.alibaba.druid.pool.DruidDataSource 5 | #druid相关配置 6 | druid: 7 | #监控统计拦截的filters 8 | filters: stat 9 | driver-class-name: com.mysql.jdbc.Driver 10 | #基本属性 11 | url: jdbc:mysql://127.0.0.1:3306/blockhealth?useSSL=false&serverTimezone=GMT%2B8 12 | username: root 13 | password: 123456 14 | #配置初始化大小/最小/最大 15 | initial-size: 1 16 | min-idle: 1 17 | max-active: 20 18 | #获取连接等待超时时间 19 | max-wait: 60000 20 | #间隔多久进行一次检测,检测需要关闭的空闲连接 21 | time-between-eviction-runs-millis: 60000 22 | #一个连接在池中最小生存的时间 23 | min-evictable-idle-time-millis: 300000 24 | validation-query: SELECT 'x' 25 | test-while-idle: true 26 | test-on-borrow: false 27 | test-on-return: false 28 | #打开PSCache,并指定每个连接上PSCache的大小。oracle设为true,mysql设为false。分库分表较多推荐设置为false 29 | pool-prepared-statements: false 30 | max-pool-prepared-statement-per-connection-size: 20 31 | 32 | server: 33 | port: 8081 34 | 35 | mybatis: 36 | mapper-locations: classpath:mapper/*.xml #注意:一定要对应mapper映射xml文件的所在路径 37 | type-aliases-package: com.example.demo.entity.Ehr # 注意:对应实体类的路径 -------------------------------------------------------------------------------- /DataSQL/target/classes/com/example/demo/DemoApplication.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/DataSQL/target/classes/com/example/demo/DemoApplication.class -------------------------------------------------------------------------------- /DataSQL/target/classes/com/example/demo/component/InfoDaoEM.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/DataSQL/target/classes/com/example/demo/component/InfoDaoEM.class -------------------------------------------------------------------------------- /DataSQL/target/classes/com/example/demo/controller/DataSqlController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/DataSQL/target/classes/com/example/demo/controller/DataSqlController.class -------------------------------------------------------------------------------- /DataSQL/target/classes/com/example/demo/entity/ColumnRequestForm.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/DataSQL/target/classes/com/example/demo/entity/ColumnRequestForm.class -------------------------------------------------------------------------------- /DataSQL/target/classes/com/example/demo/entity/Ehr.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/DataSQL/target/classes/com/example/demo/entity/Ehr.class -------------------------------------------------------------------------------- /DataSQL/target/classes/com/example/demo/entity/EhrRequestForm.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/DataSQL/target/classes/com/example/demo/entity/EhrRequestForm.class -------------------------------------------------------------------------------- /DataSQL/target/classes/com/example/demo/service/DataSqlService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/DataSQL/target/classes/com/example/demo/service/DataSqlService.class -------------------------------------------------------------------------------- /DataSQL/target/classes/com/example/demo/service/DataSqlServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/DataSQL/target/classes/com/example/demo/service/DataSqlServiceImpl.class -------------------------------------------------------------------------------- /DataSQL/target/classes/com/example/demo/service/EhrService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/DataSQL/target/classes/com/example/demo/service/EhrService.class -------------------------------------------------------------------------------- /DataSQL/target/test-classes/com/example/demo/DemoApplicationTests.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/DataSQL/target/test-classes/com/example/demo/DemoApplicationTests.class -------------------------------------------------------------------------------- /Kernel Contract/KClite.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.24; 2 | 3 | contract KClite { 4 | 5 | struct Hspt { 6 | string name; 7 | string ip; 8 | address addr; 9 | } 10 | 11 | Hspt [] public HsptList; 12 | Hspt [] public RqstList; 13 | 14 | address minter; 15 | 16 | function KClite() { 17 | minter = msg.sender ; 18 | } 19 | 20 | function strCompare(string a, string b) internal returns (bool) { 21 | bytes memory ba = bytes(a); 22 | bytes memory bb = bytes(b); 23 | if (ba.length != bb.length) { 24 | return false; 25 | } 26 | for (uint i = 0; i < ba.length; i ++) { 27 | if(ba[i] != bb[i]) { 28 | return false; 29 | } 30 | } 31 | return true; 32 | } 33 | 34 | function strConcat(string memory _a, string memory _b) internal returns ( string memory ){ 35 | bytes memory _ba = bytes(_a); 36 | bytes memory _bb = bytes(_b); 37 | bytes memory bret = new bytes(_ba.length + _bb.length); 38 | uint k = 0; 39 | for (uint i = 0; i < _ba.length; i++) bret[k++] = _ba[i]; 40 | for (i = 0; i < _bb.length; i++) bret[k++] = _bb[i]; 41 | return string(bret); 42 | } 43 | 44 | function getHpstIp() public view returns ( string memory ){ 45 | 46 | // require(addressVerfication( msg.sender ),"you have not been authorized."); 47 | 48 | if( HsptList.length == 0 ) return "no hosptial yet"; 49 | string memory ret ; 50 | for( uint i = 0 ; i < HsptList.length ; i++ ){ 51 | ret = strConcat(ret, HsptList[i].ip ); 52 | ret = strConcat(ret, ","); 53 | } 54 | return ret; 55 | } 56 | 57 | function sendRqst ( string _HsptName , string _Ip ) public{ 58 | 59 | RqstList.push(Hspt({ name: _HsptName , ip: _Ip , addr: msg.sender })); 60 | 61 | } 62 | 63 | function solveRqst ( string _HsptName ) public{ 64 | 65 | // require( msg.sender == minter , " get out !"); 66 | 67 | for( uint i = 0 ; i < RqstList.length ; i ++ ){ 68 | if( strCompare(_HsptName,RqstList[i].name) ){ 69 | HsptList.push( RqstList[i] ); 70 | for( uint j = i ; j < RqstList.length-1 ; j ++ ){ 71 | RqstList[j] = RqstList[j+1]; 72 | } 73 | RqstList.length--; 74 | return; 75 | } 76 | } 77 | // require( i != RqstList.length, "this hspt has not send a request."); 78 | } 79 | 80 | } -------------------------------------------------------------------------------- /Kernel Contract/KCliteWithToken.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.24; 2 | 3 | contract KCliteWithToken { 4 | 5 | struct Hspt { 6 | string name; 7 | string ip; 8 | address addr; 9 | } 10 | 11 | struct Token { 12 | string token; 13 | address addr; 14 | } 15 | 16 | Hspt [] public HsptList; 17 | Hspt [] public RqstList; 18 | Token [] public TokenList; 19 | 20 | 21 | address minter; 22 | 23 | function KCliteWithToken() { 24 | minter = msg.sender ; 25 | } 26 | 27 | function strCompare(string a, string b) internal returns (bool) { 28 | 29 | bytes memory ba = bytes(a); 30 | bytes memory bb = bytes(b); 31 | if (ba.length != bb.length) { 32 | return false; 33 | } 34 | for (uint i = 0; i < ba.length; i ++) { 35 | if(ba[i] != bb[i]) { 36 | return false; 37 | } 38 | } 39 | return true; 40 | 41 | } 42 | 43 | function strConcat(string memory _a, string memory _b) internal returns ( string memory ){ 44 | 45 | bytes memory _ba = bytes(_a); 46 | bytes memory _bb = bytes(_b); 47 | bytes memory bret = new bytes(_ba.length + _bb.length); 48 | uint k = 0; 49 | for (uint i = 0; i < _ba.length; i++) bret[k++] = _ba[i]; 50 | for (i = 0; i < _bb.length; i++) bret[k++] = _bb[i]; 51 | return string(bret); 52 | 53 | } 54 | 55 | function addressVerfication ( address _addr ) constant internal returns (bool) { 56 | 57 | uint listLength = HsptList.length; 58 | for ( uint i = 0 ; i < listLength ; i ++ ){ 59 | if ( HsptList[i].addr == _addr ){ 60 | return true; 61 | break; 62 | } 63 | } 64 | return false; 65 | 66 | } 67 | 68 | function getHpstIp() public view returns ( string memory ){ 69 | 70 | require( msg.sender == minter ||addressVerfication( msg.sender ) ,"you have not been authorized."); 71 | 72 | if( HsptList.length == 0 ) return "no hosptial yet"; 73 | string memory ret ; 74 | for( uint i = 0 ; i < HsptList.length ; i++ ){ 75 | ret = strConcat(ret, HsptList[i].ip ); 76 | ret = strConcat(ret, ","); 77 | } 78 | return ret; 79 | } 80 | 81 | function getRqstList() public view returns ( string memory ){ 82 | 83 | require( msg.sender == minter || addressVerfication( msg.sender ) ,"you have not been authorized."); 84 | 85 | if( RqstList.length == 0 ) return "no Rqst yet"; 86 | string memory ret ; 87 | for( uint i = 0 ; i < RqstList.length ; i++ ){ 88 | ret = strConcat(ret, RqstList[i].name ); 89 | ret = strConcat(ret, ","); 90 | } 91 | return ret; 92 | } 93 | 94 | function sendRqst ( string _HsptName , string _Ip ) public{ 95 | 96 | RqstList.push(Hspt({ name: _HsptName , ip: _Ip , addr: msg.sender })); 97 | 98 | } 99 | 100 | function solveRqst ( string _HsptName ) public{ 101 | 102 | require( msg.sender == minter ||addressVerfication( msg.sender ) , " get out !"); 103 | 104 | for( uint i = 0 ; i < RqstList.length ; i ++ ){ 105 | if( strCompare(_HsptName,RqstList[i].name) ){ 106 | HsptList.push( RqstList[i] ); 107 | for( uint j = i ; j < RqstList.length-1 ; j ++ ){ 108 | RqstList[j] = RqstList[j+1]; 109 | } 110 | RqstList.length--; 111 | return; 112 | } 113 | } 114 | } 115 | 116 | byte [5] rettmp ; 117 | function tokenGeneration () constant internal returns ( string ){ 118 | 119 | bytes memory alfbt = "abcdefghijklmnopqrstuvwxyz0123456789"; 120 | bytes memory ret = "qwert"; 121 | // byte [5] rettmp ; 122 | uint randNonce = 0 ; 123 | for( uint i = 0 ; i < 5 ; i ++ ){ 124 | rettmp[i] = alfbt[uint(sha256( now, msg.sender , randNonce++)) % 36]; 125 | } 126 | for( uint j = 0 ; j < 5 ; j ++ ){ 127 | ret[j] = rettmp[j]; 128 | } 129 | return string(ret); 130 | 131 | } 132 | 133 | function getToken () public { 134 | 135 | require( msg.sender == minter ||addressVerfication( msg.sender ),"you have not been authorized."); 136 | 137 | for( uint i = 0 ; i < TokenList.length ; i ++ ){ 138 | if( TokenList[i].addr == msg.sender ){ 139 | TokenList[i].token = tokenGeneration(); 140 | return; 141 | } 142 | } 143 | TokenList.push( Token({ addr:msg.sender , token: tokenGeneration() })); 144 | } 145 | 146 | function whatIsMyToken() public constant returns( string ){ 147 | 148 | for ( uint i = 0 ; i < TokenList.length ; i ++ ){ 149 | if ( TokenList[i].addr == msg.sender ){ 150 | return TokenList[i].token; 151 | } 152 | } 153 | } 154 | 155 | function tokenVerification ( string _token ) public constant returns (bool) { 156 | 157 | require( msg.sender == minter ||addressVerfication( msg.sender ),"you have not been authorized."); 158 | 159 | uint list_length = TokenList.length ; 160 | for ( uint i = 0 ; i < list_length ; i ++ ){ 161 | if ( strCompare(TokenList[i].token, _token )){ 162 | return true; 163 | } 164 | } 165 | return false; 166 | } 167 | 168 | 169 | } -------------------------------------------------------------------------------- /Kernel Contract/KCliteWithToken1.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.24; 2 | 3 | contract KCliteWithToken1 { 4 | 5 | struct Hspt { 6 | string name; 7 | string ip; 8 | address addr; 9 | } 10 | 11 | struct Token { 12 | string token; 13 | address addr; 14 | } 15 | 16 | Hspt[] public HsptList; 17 | Hspt[] public RqstList; 18 | Token[] public TokenList; 19 | 20 | function test() public constant returns (uint){ 21 | return HsptList.length; 22 | } 23 | 24 | address minter; 25 | 26 | function KCliteWithToken1() { 27 | minter = msg.sender ; 28 | } 29 | 30 | function strCompare(string a, string b) internal returns (bool) { 31 | 32 | bytes memory ba = bytes(a); 33 | bytes memory bb = bytes(b); 34 | if (ba.length != bb.length) { 35 | return false; 36 | } 37 | for (uint i = 0; i < ba.length; i ++) { 38 | if(ba[i] != bb[i]) { 39 | return false; 40 | } 41 | } 42 | return true; 43 | 44 | } 45 | 46 | function strConcat(string memory _a, string memory _b) internal returns ( string memory ){ 47 | 48 | bytes memory _ba = bytes(_a); 49 | bytes memory _bb = bytes(_b); 50 | bytes memory bret = new bytes(_ba.length + _bb.length); 51 | uint k = 0; 52 | for (uint i = 0; i < _ba.length; i++) bret[k++] = _ba[i]; 53 | for (i = 0; i < _bb.length; i++) bret[k++] = _bb[i]; 54 | return string(bret); 55 | 56 | } 57 | 58 | function addressVerfication ( address _addr ) constant internal returns (bool) { 59 | 60 | uint listLength = HsptList.length; 61 | for ( uint i = 0 ; i < listLength ; i ++ ){ 62 | if ( HsptList[i].addr == _addr ){ 63 | return true; 64 | break; 65 | } 66 | } 67 | return false; 68 | 69 | } 70 | 71 | function getHpstIp() public view returns ( string memory ){ 72 | 73 | require( msg.sender == minter ||addressVerfication( msg.sender ) ,"you have not been authorized."); 74 | 75 | if( HsptList.length == 0 ) return "no hosptial yet"; 76 | string memory ret ; 77 | for( uint i = 0 ; i < HsptList.length ; i++ ){ 78 | ret = strConcat(ret, HsptList[i].ip ); 79 | ret = strConcat(ret, ","); 80 | } 81 | return ret; 82 | } 83 | 84 | function getRqstList() public view returns ( string memory ){ 85 | 86 | require( msg.sender == minter || addressVerfication( msg.sender ) ,"you have not been authorized."); 87 | 88 | if( RqstList.length == 0 ) return "no Rqst yet"; 89 | string memory ret ; 90 | for( uint i = 0 ; i < RqstList.length ; i++ ){ 91 | ret = strConcat(ret, RqstList[i].name ); 92 | ret = strConcat(ret, ","); 93 | } 94 | return ret; 95 | } 96 | 97 | function sendRqst ( string _HsptName , string _Ip ) public{ 98 | 99 | RqstList.push(Hspt({ name: _HsptName , ip: _Ip , addr: msg.sender })); 100 | 101 | } 102 | 103 | function solveRqst ( string _HsptName ) public{ 104 | 105 | require( msg.sender == minter ||addressVerfication( msg.sender ) , " get out !"); 106 | 107 | for( uint i = 0 ; i < RqstList.length ; i ++ ){ 108 | if( strCompare(_HsptName,RqstList[i].name) ){ 109 | HsptList.push( RqstList[i] ); 110 | for( uint j = i ; j < RqstList.length-1 ; j ++ ){ 111 | RqstList[j] = RqstList[j+1]; 112 | } 113 | RqstList.length--; 114 | return; 115 | } 116 | } 117 | } 118 | 119 | // byte [5] rettmp ; 120 | function tokenGeneration () constant internal returns ( string ){ 121 | 122 | bytes memory alfbt = "abcdefghijklmnopqrstuvwxyz0123456789"; 123 | bytes memory ret = "qwert"; 124 | byte[5] rettmp; 125 | uint randNonce = 0 ; 126 | for( uint i = 0 ; i < 5 ; i ++ ){ 127 | rettmp[i] = alfbt[uint(sha256( now, msg.sender , randNonce++)) % 36]; 128 | } 129 | for( uint j = 0 ; j < 5 ; j ++ ){ 130 | ret[j] = rettmp[j]; 131 | } 132 | return string(ret); 133 | 134 | } 135 | 136 | function getToken () public { 137 | 138 | require( msg.sender == minter ||addressVerfication( msg.sender ),"you have not been authorized."); 139 | 140 | for( uint i = 0 ; i < TokenList.length ; i ++ ){ 141 | if( TokenList[i].addr == msg.sender ){ 142 | TokenList[i].token = tokenGeneration(); 143 | return; 144 | } 145 | } 146 | TokenList.push( Token({ addr:msg.sender , token: tokenGeneration() })); 147 | } 148 | 149 | function whatIsMyToken() public constant returns( string ){ 150 | 151 | for ( uint i = 0 ; i < TokenList.length ; i ++ ){ 152 | if ( TokenList[i].addr == msg.sender ){ 153 | return TokenList[i].token; 154 | } 155 | } 156 | } 157 | 158 | function tokenVerification ( string _token ) public constant returns (bool) { 159 | 160 | require( msg.sender == minter ||addressVerfication( msg.sender ),"you have not been authorized."); 161 | 162 | uint list_length = TokenList.length ; 163 | for ( uint i = 0 ; i < list_length ; i ++ ){ 164 | if ( strCompare(TokenList[i].token, _token )){ 165 | return true; 166 | } 167 | } 168 | return false; 169 | } 170 | 171 | 172 | } -------------------------------------------------------------------------------- /Kernel Contract/KCliteWithToken2.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.24; 2 | 3 | contract KCliteWithToken2 { 4 | 5 | struct Hspt { 6 | string name; 7 | string ip; 8 | address addr; 9 | } 10 | 11 | struct Token { 12 | string token; 13 | address addr; 14 | } 15 | 16 | Hspt[] public HsptList; 17 | Hspt[] public RqstList; 18 | Token[] public TokenList; 19 | 20 | function test() public constant returns (uint){ 21 | return HsptList.length; 22 | } 23 | 24 | address minter; 25 | 26 | function KCliteWithToken2() { 27 | minter = msg.sender ; 28 | } 29 | 30 | function strCompare(string a, string b) internal returns (bool) { 31 | 32 | bytes memory ba = bytes(a); 33 | bytes memory bb = bytes(b); 34 | if (ba.length != bb.length) { 35 | return false; 36 | } 37 | for (uint i = 0; i < ba.length; i ++) { 38 | if(ba[i] != bb[i]) { 39 | return false; 40 | } 41 | } 42 | return true; 43 | 44 | } 45 | 46 | function strConcat(string memory _a, string memory _b) internal returns ( string memory ){ 47 | 48 | bytes memory _ba = bytes(_a); 49 | bytes memory _bb = bytes(_b); 50 | bytes memory bret = new bytes(_ba.length + _bb.length); 51 | uint k = 0; 52 | for (uint i = 0; i < _ba.length; i++) bret[k++] = _ba[i]; 53 | for (i = 0; i < _bb.length; i++) bret[k++] = _bb[i]; 54 | return string(bret); 55 | 56 | } 57 | 58 | function addressVerfication ( address _addr ) constant internal returns (bool) { 59 | 60 | uint listLength = HsptList.length; 61 | for ( uint i = 0 ; i < listLength ; i ++ ){ 62 | if ( HsptList[i].addr == _addr ){ 63 | return true; 64 | break; 65 | } 66 | } 67 | return false; 68 | 69 | } 70 | 71 | function getHpstIp() public view returns ( string memory ){ 72 | 73 | require( msg.sender == minter ||addressVerfication( msg.sender ) ,"you have not been authorized."); 74 | 75 | if( HsptList.length == 0 ) return "no hosptial yet"; 76 | string memory ret ; 77 | for( uint i = 0 ; i < HsptList.length ; i++ ){ 78 | ret = strConcat(ret, HsptList[i].ip ); 79 | ret = strConcat(ret, ","); 80 | } 81 | return ret; 82 | } 83 | 84 | function getRqstList() public view returns ( string memory ){ 85 | 86 | if( RqstList.length == 0 ) return "no Rqst yet"; 87 | string memory ret ; 88 | for( uint i = 0 ; i < RqstList.length ; i++ ){ 89 | ret = strConcat(ret, RqstList[i].name ); 90 | ret = strConcat(ret, ","); 91 | } 92 | return ret; 93 | } 94 | 95 | function sendRqst ( string _HsptName , string _Ip ) public{ 96 | 97 | RqstList.push(Hspt({ name: _HsptName , ip: _Ip , addr: msg.sender })); 98 | 99 | } 100 | 101 | function solveRqst ( string _HsptName ) public{ 102 | 103 | require( msg.sender == minter ||addressVerfication( msg.sender ) , " get out !"); 104 | 105 | for( uint i = 0 ; i < RqstList.length ; i ++ ){ 106 | if( strCompare(_HsptName,RqstList[i].name) ){ 107 | HsptList.push( RqstList[i] ); 108 | for( uint j = i ; j < RqstList.length-1 ; j ++ ){ 109 | RqstList[j] = RqstList[j+1]; 110 | } 111 | RqstList.length--; 112 | return; 113 | } 114 | } 115 | } 116 | 117 | function tokenGeneration () constant internal returns ( string ){ 118 | return "af8ix"; 119 | } 120 | 121 | function getToken () public { 122 | 123 | require( msg.sender == minter ||addressVerfication( msg.sender ),"you have not been authorized."); 124 | 125 | for( uint i = 0 ; i < TokenList.length ; i ++ ){ 126 | if( TokenList[i].addr == msg.sender ){ 127 | TokenList[i].token = tokenGeneration(); 128 | return; 129 | } 130 | } 131 | TokenList.push( Token({ addr:msg.sender , token: tokenGeneration() })); 132 | } 133 | 134 | function whatIsMyToken() public constant returns( string ){ 135 | 136 | for ( uint i = 0 ; i < TokenList.length ; i ++ ){ 137 | if ( TokenList[i].addr == msg.sender ){ 138 | return TokenList[i].token; 139 | } 140 | } 141 | } 142 | 143 | function tokenVerification ( string _token ) public constant returns (bool) { 144 | 145 | require( msg.sender == minter ||addressVerfication( msg.sender ),"you have not been authorized."); 146 | 147 | uint list_length = TokenList.length ; 148 | for ( uint i = 0 ; i < list_length ; i ++ ){ 149 | if ( strCompare(TokenList[i].token, _token )){ 150 | return true; 151 | } 152 | } 153 | return false; 154 | } 155 | 156 | 157 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # blockhealth 2 | 基于以太坊的电子病历共享信息系统 3 | -------------------------------------------------------------------------------- /bhreact/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | .settings 4 | target 5 | .project 6 | .classpath 7 | build 8 | build_webpack 9 | 10 | # Numerous always-ignore extensions 11 | *.bak 12 | *.patch 13 | *.diff 14 | *.err 15 | 16 | # temp file for git conflict merging 17 | *.orig 18 | *.log 19 | *.rej 20 | *.swo 21 | *.swp 22 | *.zip 23 | *.vi 24 | *~ 25 | *.sass-cache 26 | *.tmp.html 27 | *.dump 28 | 29 | # OS or Editor folders 30 | .DS_Store 31 | ._* 32 | .cache 33 | .project 34 | .settings 35 | .tmproj 36 | *.esproj 37 | *.sublime-project 38 | *.sublime-workspace 39 | nbproject 40 | thumbs.db 41 | *.iml 42 | 43 | # Folders to ignore 44 | .hg 45 | .svn 46 | .CVS 47 | .idea 48 | node_modules/ 49 | jscoverage_lib/ 50 | 51 | src/main/webapp/dist/ 52 | src/main/webapp/rsrc/ 53 | webpack-assets.json 54 | spring-config.properties 55 | -------------------------------------------------------------------------------- /bhreact/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Truffle 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /bhreact/box-img-lg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/bhreact/box-img-lg.png -------------------------------------------------------------------------------- /bhreact/box-img-sm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/bhreact/box-img-sm.png -------------------------------------------------------------------------------- /bhreact/config/env.js: -------------------------------------------------------------------------------- 1 | // Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be 2 | // injected into the application via DefinePlugin in Webpack configuration. 3 | 4 | var REACT_APP = /^REACT_APP_/i; 5 | 6 | function getClientEnvironment(publicUrl) { 7 | var processEnv = Object 8 | .keys(process.env) 9 | .filter(key => REACT_APP.test(key)) 10 | .reduce((env, key) => { 11 | env[key] = JSON.stringify(process.env[key]); 12 | return env; 13 | }, { 14 | // Useful for determining whether we’re running in production mode. 15 | // Most importantly, it switches React into the correct mode. 16 | 'NODE_ENV': JSON.stringify( 17 | process.env.NODE_ENV || 'development' 18 | ), 19 | // Useful for resolving the correct path to static assets in `public`. 20 | // For example, . 21 | // This should only be used as an escape hatch. Normally you would put 22 | // images into the `src` and `import` them in code to get their paths. 23 | 'PUBLIC_URL': JSON.stringify(publicUrl) 24 | }); 25 | return {'process.env': processEnv}; 26 | } 27 | 28 | module.exports = getClientEnvironment; 29 | -------------------------------------------------------------------------------- /bhreact/config/jest/cssTransform.js: -------------------------------------------------------------------------------- 1 | // This is a custom Jest transformer turning style imports into empty objects. 2 | // http://facebook.github.io/jest/docs/tutorial-webpack.html 3 | 4 | module.exports = { 5 | process() { 6 | return 'module.exports = {};'; 7 | }, 8 | getCacheKey(fileData, filename) { 9 | // The output is always the same. 10 | return 'cssTransform'; 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /bhreact/config/jest/fileTransform.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | // This is a custom Jest transformer turning file imports into filenames. 4 | // http://facebook.github.io/jest/docs/tutorial-webpack.html 5 | 6 | module.exports = { 7 | process(src, filename) { 8 | return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';'; 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /bhreact/config/paths.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var fs = require('fs'); 3 | 4 | // Make sure any symlinks in the project folder are resolved: 5 | // https://github.com/facebookincubator/create-react-app/issues/637 6 | var appDirectory = fs.realpathSync(process.cwd()); 7 | function resolveApp(relativePath) { 8 | return path.resolve(appDirectory, relativePath); 9 | } 10 | 11 | // We support resolving modules according to `NODE_PATH`. 12 | // This lets you use absolute paths in imports inside large monorepos: 13 | // https://github.com/facebookincubator/create-react-app/issues/253. 14 | 15 | // It works similar to `NODE_PATH` in Node itself: 16 | // https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders 17 | 18 | // We will export `nodePaths` as an array of absolute paths. 19 | // It will then be used by Webpack configs. 20 | // Jest doesn’t need this because it already handles `NODE_PATH` out of the box. 21 | 22 | // Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored. 23 | // Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims. 24 | // https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421 25 | 26 | var nodePaths = (process.env.NODE_PATH || '') 27 | .split(process.platform === 'win32' ? ';' : ':') 28 | .filter(Boolean) 29 | .filter(folder => !path.isAbsolute(folder)) 30 | .map(resolveApp); 31 | 32 | // config after eject: we're in ./config/ 33 | module.exports = { 34 | // Changed from build to build_webpack so smart contract compilations are not overwritten. 35 | appBuild: resolveApp('build_webpack'), 36 | appPublic: resolveApp('public'), 37 | appHtml: resolveApp('public/index.html'), 38 | appIndexJs: resolveApp('src/index.js'), 39 | appPackageJson: resolveApp('package.json'), 40 | appSrc: resolveApp('src'), 41 | yarnLockFile: resolveApp('yarn.lock'), 42 | testsSetup: resolveApp('src/setupTests.js'), 43 | appNodeModules: resolveApp('node_modules'), 44 | ownNodeModules: resolveApp('node_modules'), 45 | nodePaths: nodePaths 46 | }; 47 | -------------------------------------------------------------------------------- /bhreact/config/polyfills.js: -------------------------------------------------------------------------------- 1 | if (typeof Promise === 'undefined') { 2 | // Rejection tracking prevents a common issue where React gets into an 3 | // inconsistent state due to an error, but it gets swallowed by a Promise, 4 | // and the user has no idea what causes React's erratic future behavior. 5 | require('promise/lib/rejection-tracking').enable(); 6 | window.Promise = require('promise/lib/es6-extensions.js'); 7 | } 8 | 9 | // fetch() polyfill for making API calls. 10 | require('whatwg-fetch'); 11 | 12 | // Object.assign() is commonly used with React. 13 | // It will use the native implementation if it's present and isn't buggy. 14 | Object.assign = require('object-assign'); 15 | -------------------------------------------------------------------------------- /bhreact/contracts/KClite.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.24; 2 | 3 | contract KCliteWithToken2 { 4 | 5 | struct Hspt { 6 | string name; 7 | string ip; 8 | address addr; 9 | } 10 | 11 | struct Token { 12 | string token; 13 | address addr; 14 | } 15 | 16 | Hspt[] public HsptList; 17 | Hspt[] public RqstList; 18 | Token[] public TokenList; 19 | 20 | function test() public constant returns (uint){ 21 | return HsptList.length; 22 | } 23 | 24 | address minter; 25 | 26 | function KCliteWithToken2() { 27 | minter = msg.sender ; 28 | } 29 | 30 | function strCompare(string a, string b) internal returns (bool) { 31 | 32 | bytes memory ba = bytes(a); 33 | bytes memory bb = bytes(b); 34 | if (ba.length != bb.length) { 35 | return false; 36 | } 37 | for (uint i = 0; i < ba.length; i ++) { 38 | if(ba[i] != bb[i]) { 39 | return false; 40 | } 41 | } 42 | return true; 43 | 44 | } 45 | 46 | function strConcat(string memory _a, string memory _b) internal returns ( string memory ){ 47 | 48 | bytes memory _ba = bytes(_a); 49 | bytes memory _bb = bytes(_b); 50 | bytes memory bret = new bytes(_ba.length + _bb.length); 51 | uint k = 0; 52 | for (uint i = 0; i < _ba.length; i++) bret[k++] = _ba[i]; 53 | for (i = 0; i < _bb.length; i++) bret[k++] = _bb[i]; 54 | return string(bret); 55 | 56 | } 57 | 58 | function addressVerfication ( address _addr ) constant internal returns (bool) { 59 | 60 | uint listLength = HsptList.length; 61 | for ( uint i = 0 ; i < listLength ; i ++ ){ 62 | if ( HsptList[i].addr == _addr ){ 63 | return true; 64 | break; 65 | } 66 | } 67 | return false; 68 | 69 | } 70 | 71 | function getHpstIp() public view returns ( string memory ){ 72 | 73 | require( msg.sender == minter ||addressVerfication( msg.sender ) ,"you have not been authorized."); 74 | 75 | if( HsptList.length == 0 ) return "no hosptial yet"; 76 | string memory ret ; 77 | for( uint i = 0 ; i < HsptList.length ; i++ ){ 78 | ret = strConcat(ret, HsptList[i].ip ); 79 | ret = strConcat(ret, ","); 80 | } 81 | return ret; 82 | } 83 | 84 | function getRqstList() public view returns ( string memory ){ 85 | 86 | require( msg.sender == minter || addressVerfication( msg.sender ) ,"you have not been authorized."); 87 | 88 | if( RqstList.length == 0 ) return "no Rqst yet"; 89 | string memory ret ; 90 | for( uint i = 0 ; i < RqstList.length ; i++ ){ 91 | ret = strConcat(ret, RqstList[i].name ); 92 | ret = strConcat(ret, ","); 93 | } 94 | return ret; 95 | } 96 | 97 | function sendRqst ( string _HsptName , string _Ip ) public{ 98 | 99 | RqstList.push(Hspt({ name: _HsptName , ip: _Ip , addr: msg.sender })); 100 | 101 | } 102 | 103 | function solveRqst ( string _HsptName ) public{ 104 | 105 | require( msg.sender == minter ||addressVerfication( msg.sender ) , " get out !"); 106 | 107 | for( uint i = 0 ; i < RqstList.length ; i ++ ){ 108 | if( strCompare(_HsptName,RqstList[i].name) ){ 109 | HsptList.push( RqstList[i] ); 110 | for( uint j = i ; j < RqstList.length-1 ; j ++ ){ 111 | RqstList[j] = RqstList[j+1]; 112 | } 113 | RqstList.length--; 114 | return; 115 | } 116 | } 117 | } 118 | 119 | function tokenGeneration () constant internal returns ( string ){ 120 | return "af8ix"; 121 | } 122 | 123 | function getToken () public { 124 | 125 | require( msg.sender == minter ||addressVerfication( msg.sender ),"you have not been authorized."); 126 | 127 | for( uint i = 0 ; i < TokenList.length ; i ++ ){ 128 | if( TokenList[i].addr == msg.sender ){ 129 | TokenList[i].token = tokenGeneration(); 130 | return; 131 | } 132 | } 133 | TokenList.push( Token({ addr:msg.sender , token: tokenGeneration() })); 134 | } 135 | 136 | function whatIsMyToken() public constant returns( string ){ 137 | 138 | for ( uint i = 0 ; i < TokenList.length ; i ++ ){ 139 | if ( TokenList[i].addr == msg.sender ){ 140 | return TokenList[i].token; 141 | } 142 | } 143 | } 144 | 145 | function tokenVerification ( string _token ) public constant returns (bool) { 146 | 147 | require( msg.sender == minter ||addressVerfication( msg.sender ),"you have not been authorized."); 148 | 149 | uint list_length = TokenList.length ; 150 | for ( uint i = 0 ; i < list_length ; i ++ ){ 151 | if ( strCompare(TokenList[i].token, _token )){ 152 | return true; 153 | } 154 | } 155 | return false; 156 | } 157 | 158 | 159 | } -------------------------------------------------------------------------------- /bhreact/contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.24; 2 | 3 | contract Migrations { 4 | address public owner; 5 | uint public last_completed_migration; 6 | 7 | modifier restricted() { 8 | if (msg.sender == owner) _; 9 | } 10 | 11 | constructor() public { 12 | owner = msg.sender; 13 | } 14 | 15 | function setCompleted(uint completed) public restricted { 16 | last_completed_migration = completed; 17 | } 18 | 19 | function upgrade(address new_address) public restricted { 20 | Migrations upgraded = Migrations(new_address); 21 | upgraded.setCompleted(last_completed_migration); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /bhreact/contracts/zeppelin/lifecycle/Killable.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.4; 2 | 3 | 4 | import "./../ownership/Ownable.sol"; 5 | 6 | 7 | /* 8 | * Killable 9 | * Base contract that can be killed by owner. All funds in contract will be sent to the owner. 10 | */ 11 | contract Killable is Ownable { 12 | function kill() onlyOwner { 13 | selfdestruct(owner); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /bhreact/contracts/zeppelin/ownership/Ownable.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.4; 2 | 3 | 4 | /* 5 | * Ownable 6 | * 7 | * Base contract with an owner. 8 | * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner. 9 | */ 10 | contract Ownable { 11 | address public owner; 12 | 13 | function Ownable() { 14 | owner = msg.sender; 15 | } 16 | 17 | modifier onlyOwner() { 18 | if (msg.sender == owner) 19 | _; 20 | } 21 | 22 | function transferOwnership(address newOwner) onlyOwner { 23 | if (newOwner != address(0)) owner = newOwner; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /bhreact/migrations/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | var Migrations = artifacts.require("./Migrations.sol"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(Migrations); 5 | }; 6 | -------------------------------------------------------------------------------- /bhreact/migrations/2_deploy_contracts.js: -------------------------------------------------------------------------------- 1 | var Ownable = artifacts.require("./zeppelin/ownership/Ownable.sol"); 2 | var Killable = artifacts.require("./zeppelin/lifecycle/Killable.sol"); 3 | var Kernel = artifacts.require("./KClite.sol"); 4 | 5 | module.exports = function(deployer) { 6 | deployer.deploy(Ownable); 7 | deployer.link(Ownable, Killable); 8 | deployer.deploy(Killable); 9 | deployer.link(Killable, Kernel); 10 | deployer.deploy(Kernel); 11 | }; 12 | -------------------------------------------------------------------------------- /bhreact/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-uport-box", 3 | "version": "0.1.0", 4 | "private": true, 5 | "devDependencies": { 6 | "antd": "^3.5.4", 7 | "autoprefixer": "6.5.1", 8 | "babel-core": "6.17.0", 9 | "babel-eslint": "7.1.1", 10 | "babel-jest": "17.0.2", 11 | "babel-loader": "6.2.7", 12 | "babel-plugin-import": "^1.11.0", 13 | "babel-plugin-transform-decorators-legacy": "^1.3.5", 14 | "babel-preset-react-app": "^2.0.1", 15 | "case-sensitive-paths-webpack-plugin": "1.1.4", 16 | "chalk": "1.1.3", 17 | "connect-history-api-fallback": "1.3.0", 18 | "cross-spawn": "4.0.2", 19 | "css-loader": "0.26.0", 20 | "detect-port": "1.0.1", 21 | "dotenv": "2.0.0", 22 | "eslint": "3.8.1", 23 | "eslint-config-react-app": "^0.5.0", 24 | "eslint-loader": "1.6.0", 25 | "eslint-plugin-flowtype": "2.21.0", 26 | "eslint-plugin-import": "2.0.1", 27 | "eslint-plugin-jsx-a11y": "2.2.3", 28 | "eslint-plugin-no-unused-vars-rest": "^1.0.4", 29 | "eslint-plugin-react": "6.4.1", 30 | "extract-text-webpack-plugin": "1.0.1", 31 | "file-loader": "0.9.0", 32 | "filesize": "3.3.0", 33 | "fs-extra": "0.30.0", 34 | "gzip-size": "3.0.0", 35 | "html-webpack-plugin": "2.24.0", 36 | "http-proxy-middleware": "0.17.2", 37 | "jest": "18.1.0", 38 | "json-loader": "0.5.4", 39 | "object-assign": "4.1.0", 40 | "path-exists": "2.1.0", 41 | "postcss-loader": "1.0.0", 42 | "promise": "7.1.1", 43 | "rc-form": "^2.0.0", 44 | "react-dev-utils": "^0.4.2", 45 | "recursive-readdir": "2.1.0", 46 | "strip-ansi": "3.0.1", 47 | "style-loader": "0.13.1", 48 | "truffle-contract": "^3.0.0", 49 | "url-loader": "0.5.7", 50 | "webpack": "1.14.0", 51 | "webpack-dev-server": "1.16.2", 52 | "webpack-manifest-plugin": "1.1.0", 53 | "whatwg-fetch": "1.0.0" 54 | }, 55 | "dependencies": { 56 | "jquery": "^3.3.1", 57 | "react": "^16.0.0", 58 | "react-dom": "^16.0.0", 59 | "react-redux": "^5.0.2", 60 | "react-router": "^3.0.2", 61 | "react-router-redux": "^4.0.7", 62 | "redux": "^3.6.0", 63 | "redux-auth-wrapper": "^1.0.0", 64 | "redux-thunk": "^2.2.0", 65 | "start": "^5.1.0", 66 | "superagent": "^4.0.0", 67 | "uport-connect": "^0.7.3" 68 | }, 69 | "scripts": { 70 | "start": "node scripts/start.js", 71 | "build": "node scripts/build.js", 72 | "test": "node scripts/test.js --env=jsdom" 73 | }, 74 | "jest": { 75 | "collectCoverageFrom": [ 76 | "src/**/*.{js,jsx}" 77 | ], 78 | "setupFiles": [ 79 | "/config/polyfills.js" 80 | ], 81 | "testMatch": [ 82 | "/src/**/__tests__/**/*.js?(x)", 83 | "/src/**/?(*.)(spec|test).js?(x)" 84 | ], 85 | "testEnvironment": "node", 86 | "testURL": "http://localhost", 87 | "transform": { 88 | "^.+\\.(js|jsx)$": "/node_modules/babel-jest", 89 | "^.+\\.css$": "/config/jest/cssTransform.js", 90 | "^(?!.*\\.(js|jsx|css|json)$)": "/config/jest/fileTransform.js" 91 | }, 92 | "transformIgnorePatterns": [ 93 | "[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$" 94 | ], 95 | "moduleNameMapper": { 96 | "^react-native$": "react-native-web" 97 | }, 98 | "moduleFileExtensions": [ 99 | "web.js", 100 | "js", 101 | "json", 102 | "web.jsx", 103 | "jsx" 104 | ] 105 | }, 106 | "babel": { 107 | "presets": [ 108 | "react-app" 109 | ], 110 | "plugins": [ 111 | [ 112 | "import", 113 | { 114 | "libraryName": "antd", 115 | "style": true 116 | } 117 | ], 118 | "transform-decorators-legacy" 119 | ] 120 | }, 121 | "eslintConfig": { 122 | "extends": "react-app" 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /bhreact/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/bhreact/public/favicon.ico -------------------------------------------------------------------------------- /bhreact/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 16 | 医疗数据查询 17 | 18 | 19 |
20 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /bhreact/public/server/queryEhr.json: -------------------------------------------------------------------------------- 1 | [{ 2 | "idNo":"123456", 3 | "diseaseName":"abc", 4 | "ehr":"test" 5 | }] -------------------------------------------------------------------------------- /bhreact/scripts/test.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = 'test'; 2 | process.env.PUBLIC_URL = ''; 3 | 4 | // Load environment variables from .env file. Suppress warnings using silent 5 | // if this file is missing. dotenv will never modify any environment variables 6 | // that have already been set. 7 | // https://github.com/motdotla/dotenv 8 | require('dotenv').config({silent: true}); 9 | 10 | const jest = require('jest'); 11 | const argv = process.argv.slice(2); 12 | 13 | // Watch unless on CI or in coverage mode 14 | if (!process.env.CI && argv.indexOf('--coverage') < 0) { 15 | argv.push('--watch'); 16 | } 17 | 18 | // A temporary hack to clear terminal correctly. 19 | // You can remove this after updating to Jest 18 when it's out. 20 | // https://github.com/facebook/jest/pull/2230 21 | var realWrite = process.stdout.write; 22 | var CLEAR = process.platform === 'win32' ? '\x1Bc' : '\x1B[2J\x1B[3J\x1B[H'; 23 | process.stdout.write = function(chunk, encoding, callback) { 24 | if (chunk === '\x1B[2J\x1B[H') { 25 | chunk = CLEAR; 26 | } 27 | return realWrite.call(this, chunk, encoding, callback); 28 | }; 29 | 30 | 31 | jest.run(argv); 32 | -------------------------------------------------------------------------------- /bhreact/src/App.css: -------------------------------------------------------------------------------- 1 | @import "~antd/dist/antd.css"; 2 | 3 | body, 4 | .pure-g [class*=pure-u] { 5 | font-family: 'Open Sans', sans-serif; 6 | } 7 | 8 | h1, h2, h3 { 9 | font-family: 'Oswald', 'Arial Narrow', sans-serif; 10 | } 11 | 12 | code { 13 | display: block; 14 | margin: 20px 0 15px 0; 15 | padding: 10px; 16 | background: #eee; 17 | } 18 | 19 | .container { 20 | box-sizing: border-box; 21 | width: 100%; 22 | padding: 45px 20px; 23 | } 24 | 25 | .search { 26 | padding: 15px; 27 | background: #f8f8f8; 28 | border: 1px solid #d9d9d9; 29 | border-radius: 6px; 30 | margin-bottom: 16px; 31 | } 32 | 33 | .pure-button-primary { 34 | background-color: #0c1a2b; 35 | } 36 | 37 | .pure-button-primary:hover { 38 | background-color: #233e5e; 39 | } 40 | 41 | .pure-form input[type="text"]:focus { 42 | border-color: #0c1a2b; 43 | } 44 | 45 | /* NAVBAR */ 46 | 47 | .navbar { 48 | position: fixed; 49 | padding: 5px; 50 | background: #0c1a2b; 51 | font-family: 'Oswald', 'Arial Narrow', sans-serif; 52 | } 53 | 54 | .navbar a { 55 | color: #fff; 56 | } 57 | 58 | .navbar a:active, 59 | .navbar a:focus, 60 | .navbar a:hover { 61 | background: #233e5e; 62 | } 63 | 64 | .navbar .pure-menu-heading { 65 | font-weight: bold; 66 | text-transform: none; 67 | } 68 | 69 | .navbar .navbar-right { 70 | float: right; 71 | } 72 | 73 | .navbar .uport-logo { 74 | height: 16px; 75 | margin-right: 10px; 76 | } 77 | -------------------------------------------------------------------------------- /bhreact/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react' 2 | 3 | import './css/oswald.css' 4 | import './css/open-sans.css' 5 | import './css/pure-min.css' 6 | import './App.css' 7 | 8 | class App extends Component { 9 | render() { 10 | 11 | return ( 12 |
13 | {this.props.children} 14 |
15 | ); 16 | } 17 | } 18 | 19 | export default App 20 | -------------------------------------------------------------------------------- /bhreact/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom' 3 | import App from './App' 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div') 7 | ReactDOM.render(, div) 8 | }) 9 | -------------------------------------------------------------------------------- /bhreact/src/css/open-sans.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Open Sans'; 3 | font-weight: 400; 4 | font-style: normal; 5 | src: url('../fonts/Open-Sans-regular/Open-Sans-regular.eot'); 6 | src: url('../fonts/Open-Sans-regular/Open-Sans-regular.eot?#iefix') format('embedded-opentype'), 7 | local('Open Sans'), 8 | local('Open-Sans-regular'), 9 | url('../fonts/Open-Sans-regular/Open-Sans-regular.woff2') format('woff2'), 10 | url('../fonts/Open-Sans-regular/Open-Sans-regular.woff') format('woff'), 11 | url('../fonts/Open-Sans-regular/Open-Sans-regular.ttf') format('truetype'), 12 | url('../fonts/Open-Sans-regular/Open-Sans-regular.svg#OpenSans') format('svg'); 13 | } 14 | -------------------------------------------------------------------------------- /bhreact/src/css/oswald.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Oswald'; 3 | font-weight: 300; 4 | font-style: normal; 5 | src: url('../fonts/Oswald-300/Oswald-300.eot'); 6 | src: url('../fonts/Oswald-300/Oswald-300.eot?#iefix') format('embedded-opentype'), 7 | local('Oswald Light'), 8 | local('Oswald-300'), 9 | url('../fonts/Oswald-300/Oswald-300.woff2') format('woff2'), 10 | url('../fonts/Oswald-300/Oswald-300.woff') format('woff'), 11 | url('../fonts/Oswald-300/Oswald-300.ttf') format('truetype'), 12 | url('../fonts/Oswald-300/Oswald-300.svg#Oswald') format('svg'); 13 | } 14 | 15 | @font-face { 16 | font-family: 'Oswald'; 17 | font-weight: 400; 18 | font-style: normal; 19 | src: url('../fonts/Oswald-regular/Oswald-regular.eot'); 20 | src: url('../fonts/Oswald-regular/Oswald-regular.eot?#iefix') format('embedded-opentype'), 21 | local('Oswald Regular'), 22 | local('Oswald-regular'), 23 | url('../fonts/Oswald-regular/Oswald-regular.woff2') format('woff2'), 24 | url('../fonts/Oswald-regular/Oswald-regular.woff') format('woff'), 25 | url('../fonts/Oswald-regular/Oswald-regular.ttf') format('truetype'), 26 | url('../fonts/Oswald-regular/Oswald-regular.svg#Oswald') format('svg'); 27 | } 28 | -------------------------------------------------------------------------------- /bhreact/src/ehr/authorize/AuthorizeActions.js: -------------------------------------------------------------------------------- 1 | import store from "../../store"; 2 | import KernelContract from '../../../build/contracts/KClite.json'; 3 | import {message} from 'antd'; 4 | var request = require('superagent'); 5 | 6 | const contract = require('truffle-contract'); 7 | 8 | export function submitAuth(param) { 9 | request.post('http://10.0.3.161:8081/solveRequest') 10 | .send(param) 11 | .end(function (err, res) { 12 | if(err){ 13 | alert(err); 14 | } else { 15 | if (res.text === 'SUCCESS') { 16 | message.info("操作成功"); 17 | } 18 | } 19 | }); 20 | } 21 | 22 | export function getRequestList() { 23 | let web3 = store.getState().web3.web3Instance; 24 | 25 | if (typeof web3 !== 'undefined') { 26 | 27 | return function(dispatch) { 28 | const listRequest = contract(KernelContract); 29 | listRequest.setProvider(web3.currentProvider); 30 | let listRequestInstance; 31 | web3.eth.getAccounts(function (error, accounts) { 32 | if (error) { 33 | console.log(error); 34 | } 35 | 36 | var account = accounts[0]; 37 | listRequest.deployed().then(function (instance) { 38 | listRequestInstance = instance; 39 | listRequestInstance.getRqstList({from: account}) 40 | .then(function (result) { 41 | return dispatch({ 42 | type: 'GET_REQUEST_LIST', 43 | data: result, 44 | }) 45 | }) 46 | }) 47 | 48 | }) 49 | } 50 | } else { 51 | console.error('Web3 is not initialized.'); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /bhreact/src/ehr/authorize/AuthorizeContainer.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import AuthorizeForm from './AuthorizeForm'; 3 | import {Link} from "react-router"; 4 | 5 | export class AuthorizeContainer extends Component { 6 | 7 | render() { 8 | return ( 9 |
10 | 15 | 16 |
17 | ); 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /bhreact/src/ehr/authorize/AuthorizeForm.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import {bindActionCreators} from 'redux'; 3 | import {Col, Row, Form, Button, message, Select, Input} from 'antd'; 4 | import * as AuthorizeActions from './AuthorizeActions'; 5 | import {connect} from 'react-redux'; 6 | 7 | const FormItem = Form.Item; 8 | 9 | @connect(state => ({ 10 | authorize: state.authorize 11 | })) 12 | class AuthorizeForm extends Component { 13 | constructor(props) { 14 | super(props); 15 | this.action = bindActionCreators(AuthorizeActions, props.dispatch); 16 | } 17 | 18 | onSubmit() { 19 | const infoForm = this.props.form.getFieldsValue(); 20 | 21 | if (infoForm.name === undefined || infoForm.name === '') { 22 | message.warning("请输入信息!"); 23 | } else { 24 | this.action.submitAuth({ 25 | name: infoForm.name, 26 | auth: infoForm.auth 27 | }); 28 | } 29 | } 30 | 31 | getReqList() { 32 | this.action.getRequestList(); 33 | } 34 | 35 | render() { 36 | const {getFieldProps} = this.props.form; 37 | const {requestList} = this.props.authorize; 38 | return ( 39 |
40 |
41 |
42 | 43 | 44 | 49 | 54 | {/**/} 55 | 56 | 57 | 58 | 60 | 61 | 62 | 63 | 64 | 66 | 67 | 68 |
69 |
70 |
71 | ) 72 | } 73 | 74 | } 75 | 76 | export default Form.create()(AuthorizeForm); -------------------------------------------------------------------------------- /bhreact/src/ehr/authorize/AuthorizeReducer.js: -------------------------------------------------------------------------------- 1 | const initialState = { 2 | requestList: [], 3 | }; 4 | 5 | export default function (state = initialState, action) { 6 | switch (action.type) { 7 | case 'GET_REQUEST_LIST': 8 | 9 | let reqList = []; 10 | let reqs = action.data.split(','); 11 | for (let i=0; i 9 | 10 | 11 | ); 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /bhreact/src/ehr/datamining/DataMiningForm.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import {bindActionCreators} from 'redux'; 3 | import {Col, Row, Form, Button, message, Input} from 'antd'; 4 | import * as DataMiningActions from './DataMiningActions'; 5 | import {connect} from 'react-redux'; 6 | 7 | const FormItem = Form.Item; 8 | 9 | @connect(state => ({ 10 | authorize: state.authorize 11 | })) 12 | class DataMiningForm extends Component { 13 | constructor(props) { 14 | super(props); 15 | this.action = bindActionCreators(DataMiningActions, props.dispatch); 16 | } 17 | 18 | onSubmit() { 19 | const infoForm = this.props.form.getFieldsValue(); 20 | 21 | if (infoForm.name === undefined || infoForm.name === '') { 22 | message.warning("请输入信息!"); 23 | } else { 24 | this.action.submitAuth({ 25 | name: infoForm.name, 26 | auth: infoForm.auth 27 | }); 28 | } 29 | } 30 | 31 | getReqList() { 32 | this.action.getRequestList(); 33 | } 34 | 35 | render() { 36 | const {getFieldProps} = this.props.form; 37 | // const {requestList} = this.props.authorize; 38 | return ( 39 |
40 |
41 |
42 | 43 | 44 | 49 | {/**/} 54 | 55 | 56 | 57 | 58 | 60 | 61 | 62 | 63 | 64 | 66 | 67 | 68 |
69 |
70 |
71 | ) 72 | } 73 | 74 | } 75 | 76 | export default Form.create()(DataMiningForm); -------------------------------------------------------------------------------- /bhreact/src/ehr/datamining/DataMiningReducer.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/bhreact/src/ehr/datamining/DataMiningReducer.js -------------------------------------------------------------------------------- /bhreact/src/ehr/homepage/AuthCard.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import { Card,Button } from 'antd'; 3 | 4 | const { Meta } = Card; 5 | 6 | export default class SignupCard extends Component { 7 | constructor(props) { 8 | super(props); 9 | } 10 | 11 | enter() { 12 | window.location.href="http://localhost:3000/auth"; 13 | } 14 | 15 | render() { 16 | return ( 17 | } 21 | actions={[]} 22 | > 23 | {/*审核}/>*/} 24 | 25 | ) 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /bhreact/src/ehr/homepage/HomePage.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import SignupCard from './SignupCard'; 3 | import QueryCard from './QueryCard'; 4 | import AuthCard from './AuthCard'; 5 | import {Row, Col} from 'antd'; 6 | 7 | export class HomePage extends Component { 8 | 9 | render() { 10 | return ( 11 |
12 | 13 |

14 | 15 | 16 |

17 | 18 | 19 |

20 | 21 | 22 |

23 | 24 | 25 |

26 | 27 | 28 |

29 | 30 | 31 |

32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |

45 | ); 46 | } 47 | 48 | } -------------------------------------------------------------------------------- /bhreact/src/ehr/homepage/QueryCard.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import { Card,Button } from 'antd'; 3 | 4 | const { Meta } = Card; 5 | 6 | export default class QueryCard extends Component { 7 | constructor(props) { 8 | super(props); 9 | } 10 | 11 | enter() { 12 | window.location.href="http://localhost:3000/query"; 13 | } 14 | 15 | render() { 16 | return ( 17 | } 21 | actions={[]} 22 | > 23 | {/*查询数据}/>*/} 24 | 25 | ) 26 | } 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /bhreact/src/ehr/homepage/SignupCard.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import { Card,Button } from 'antd'; 3 | 4 | const { Meta } = Card; 5 | 6 | export default class SignupCard extends Component { 7 | constructor(props) { 8 | super(props); 9 | } 10 | 11 | enter() { 12 | window.location.href="http://localhost:3000/signup"; 13 | } 14 | 15 | render() { 16 | return ( 17 | } 21 | actions={[]} 22 | > 23 | {/*申请}/>*/} 24 | 25 | ) 26 | } 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /bhreact/src/ehr/queryehr/LoginButton.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import {bindActionCreators} from 'redux'; 3 | import {connect} from 'react-redux'; 4 | import {Button} from 'antd'; 5 | import * as QueryEhrActions from './QueryEhrActions'; 6 | 7 | @connect(state => ({ 8 | queryEhr: state.queryEhr 9 | })) 10 | export default class LoginButton extends Component { 11 | constructor(props) { 12 | super(props); 13 | this.action = bindActionCreators(QueryEhrActions, props.dispatch); 14 | } 15 | 16 | login() { 17 | this.action.login(); 18 | } 19 | 20 | render() { 21 | return ( 22 | 24 | ) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /bhreact/src/ehr/queryehr/QueryEhrActions.js: -------------------------------------------------------------------------------- 1 | import store from "../../store"; 2 | import KernelContract from '../../../build/contracts/KClite.json'; 3 | import {message} from "antd"; 4 | var request = require('superagent'); 5 | 6 | const contract = require('truffle-contract'); 7 | 8 | export function queryEhrById(param) { 9 | 10 | let web3 = store.getState().web3.web3Instance; 11 | 12 | if (typeof web3 !== 'undefined') { 13 | 14 | return function(dispatch) { 15 | const listRequest = contract(KernelContract); 16 | listRequest.setProvider(web3.currentProvider); 17 | let listRequestInstance; 18 | 19 | web3.eth.getCoinbase((error, coinbase) => { 20 | 21 | if (error) { 22 | console.error(error); 23 | } 24 | 25 | listRequest.deployed().then(function(instance) { 26 | listRequestInstance = instance; 27 | listRequestInstance.getHpstIp() 28 | .then(function(result) { 29 | let addressList = result.split(','); 30 | 31 | return dispatch(() => { 32 | for (let i=0; i ({ 10 | queryEhr: state.queryEhr 11 | })) 12 | export default class QueryEhrContainer extends Component { 13 | 14 | OnlyGuestLinks() { 15 | const {token} = this.props.queryEhr; 16 | if (token === '' || token === undefined) { 17 | return ( 18 | 19 | ) 20 | } 21 | } 22 | 23 | OnlyUserShow() { 24 | const {token} = this.props.queryEhr; 25 | if (token !== '' && token !== undefined) { 26 | return ( 27 |
28 | 29 | 30 |
31 | ) 32 | } 33 | } 34 | 35 | render() { 36 | 37 | return ( 38 |
39 | 45 | {this.OnlyUserShow()} 46 |
47 | ); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /bhreact/src/ehr/queryehr/QueryEhrQuery.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import {bindActionCreators} from 'redux'; 3 | import {connect} from 'react-redux'; 4 | import {Col, Row, Form, Input, Button, message, Select} from 'antd'; 5 | import * as QueryEhrActions from './QueryEhrActions'; 6 | import {ITEM, ITEM_MAP} from "../constant/EhrConstants"; 7 | 8 | const FormItem = Form.Item; 9 | const Option = Select.Option; 10 | 11 | @connect(state => ({ 12 | queryEhr: state.queryEhr 13 | })) 14 | class QueryEhrQuery extends Component { 15 | constructor(props) { 16 | super(props); 17 | this.action = bindActionCreators(QueryEhrActions, props.dispatch); 18 | } 19 | 20 | onQuery() { 21 | const query = this.props.form.getFieldsValue(); 22 | const {token} = this.props.queryEhr; 23 | 24 | if (query.vid === undefined || query.vid === '' 25 | || query.columnNames === undefined || query.columnNames === '') { 26 | message.warning("请输入参数!"); 27 | } else { 28 | const {ehrs} = this.props.queryEhr; 29 | while (ehrs.length > 0) { 30 | this.action.clearEhrs(); 31 | } 32 | 33 | let columnList = []; 34 | for (let i=0; i 50 |
51 |
52 | 53 | 54 | 59 | 60 | 61 | 62 | 63 | 68 | 73 | 74 | 75 | 76 | 78 | 79 | 80 |
81 |
82 | 83 | ) 84 | } 85 | 86 | } 87 | 88 | export default Form.create()(QueryEhrQuery); -------------------------------------------------------------------------------- /bhreact/src/ehr/queryehr/QueryEhrTable.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import { connect } from 'react-redux'; 3 | import { Table, Row, Col } from 'antd'; 4 | import './tableform.less'; 5 | 6 | @connect(state => ({ 7 | queryEhr: state.queryEhr 8 | })) 9 | export default class QueryEhrTable extends Component { 10 | 11 | render(){ 12 | const {ehrs} = this.props.queryEhr; 13 | 14 | const ehrColumns = [{ 15 | title: '序号', 16 | dataIndex: 'no', 17 | key: 'no', 18 | className: "infoForm", 19 | }, { 20 | title: '来源', 21 | dataIndex: 'hspt', 22 | key: 'hspt', 23 | className: "infoForm", 24 | }, { 25 | title: '类型', 26 | dataIndex: 'columnname', 27 | key: 'columnname', 28 | className: "infoForm", 29 | }, { 30 | title: '详细信息', 31 | dataIndex: 'value', 32 | key: 'value', 33 | className: "infoForm", 34 | }]; 35 | 36 | return ( 37 | 38 | 39 | 40 | 41 | 42 | ) 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /bhreact/src/ehr/queryehr/queryEhrReducer.js: -------------------------------------------------------------------------------- 1 | import {ITEM} from '../constant/EhrConstants'; 2 | 3 | const initialState = { 4 | ehrs:[], 5 | token: '', 6 | diseaseList: [], 7 | }; 8 | 9 | export default function (state = initialState, action) { 10 | switch (action.type) { 11 | case 'QUERY_EHR': 12 | 13 | let newEhrs = state.ehrs; 14 | let index = state.ehrs.length; 15 | for (let i = 0; i < action.data.length; i++) { 16 | for (let j = 0; j < action.data[i].length; j++) { 17 | newEhrs.push(action.data[i][j]); 18 | newEhrs[index].columnname = ITEM[action.data[i][j].columnname]; 19 | newEhrs[index].no = ++index; 20 | } 21 | } 22 | 23 | return { 24 | ...state, 25 | ehrs: newEhrs 26 | }; 27 | 28 | case 'CLEAR_EHRS': 29 | return { 30 | ...state, 31 | ehrs: [] 32 | }; 33 | 34 | case 'LOGIN': 35 | return { 36 | ...state, 37 | token:action.data 38 | }; 39 | 40 | default: 41 | return state; 42 | } 43 | } -------------------------------------------------------------------------------- /bhreact/src/ehr/queryehr/tableform.less: -------------------------------------------------------------------------------- 1 | .center-table { 2 | margin-top:15px; 3 | th,td{ 4 | text-align: center; 5 | } 6 | .opera{ 7 | span{ cursor: pointer; } 8 | } 9 | } 10 | 11 | .infoForm{ 12 | text-align: center; 13 | } -------------------------------------------------------------------------------- /bhreact/src/ehr/signup/SignUpActions.js: -------------------------------------------------------------------------------- 1 | import store from "../../store"; 2 | import KernelContract from '../../../build/contracts/KClite.json' 3 | import {message} from 'antd'; 4 | 5 | const contract = require('truffle-contract'); 6 | 7 | export function signUp(param) { 8 | 9 | let web3 = store.getState().web3.web3Instance; 10 | 11 | if (typeof web3 !== 'undefined') { 12 | 13 | const listRequest = contract(KernelContract); 14 | listRequest.setProvider(web3.currentProvider); 15 | let listRequestInstance; 16 | web3.eth.getAccounts(function(error, accounts) { 17 | if (error) { 18 | console.log(error); 19 | } 20 | 21 | var account = accounts[0]; 22 | listRequest.deployed().then(function(instance) { 23 | listRequestInstance = instance; 24 | listRequestInstance.sendRqst(param.name, param.ip, {from: account}) 25 | .then(function() { 26 | message.info("申请成功,请等待审核"); 27 | }) 28 | }) 29 | }) 30 | 31 | } else { 32 | console.error('Web3 is not initialized.'); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /bhreact/src/ehr/signup/SignUpContainer.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import SignUpForm from './SignUpForm'; 3 | import {Link} from "react-router"; 4 | 5 | export class SignUpContainer extends Component { 6 | 7 | render() { 8 | return ( 9 |
10 | 15 | 16 |
17 | ); 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /bhreact/src/ehr/signup/SignUpForm.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import {bindActionCreators} from 'redux'; 3 | import {Col, Row, Form, Input, Button, message} from 'antd'; 4 | import * as SignUpActions from './SignUpActions'; 5 | 6 | const FormItem = Form.Item; 7 | 8 | class SignUpForm extends Component { 9 | constructor(props) { 10 | super(props); 11 | this.action = bindActionCreators(SignUpActions, props.dispatch); 12 | } 13 | 14 | onSubmit() { 15 | const infoForm = this.props.form.getFieldsValue(); 16 | 17 | if (infoForm.name === undefined || infoForm.name === '' 18 | || infoForm.ip === undefined || infoForm.ip === '' ) { 19 | message.warning("请输入信息!"); 20 | } else { 21 | this.action.signUp(infoForm); 22 | } 23 | } 24 | 25 | render() { 26 | const {getFieldProps} = this.props.form; 27 | return ( 28 |
29 |
30 |
31 | 32 |
33 | 38 | 39 | 40 | 41 | 42 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 55 | 56 | 57 | 58 | 59 | 60 | ) 61 | } 62 | 63 | } 64 | 65 | export default Form.create()(SignUpForm); -------------------------------------------------------------------------------- /bhreact/src/fonts/Open-Sans-regular/Open-Sans-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/bhreact/src/fonts/Open-Sans-regular/Open-Sans-regular.eot -------------------------------------------------------------------------------- /bhreact/src/fonts/Open-Sans-regular/Open-Sans-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/bhreact/src/fonts/Open-Sans-regular/Open-Sans-regular.ttf -------------------------------------------------------------------------------- /bhreact/src/fonts/Open-Sans-regular/Open-Sans-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/bhreact/src/fonts/Open-Sans-regular/Open-Sans-regular.woff -------------------------------------------------------------------------------- /bhreact/src/fonts/Open-Sans-regular/Open-Sans-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/bhreact/src/fonts/Open-Sans-regular/Open-Sans-regular.woff2 -------------------------------------------------------------------------------- /bhreact/src/fonts/Oswald-300/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2016 The Oswald Project Authors (contact@sansoxygen.com) 2 | 3 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 4 | This license is copied below, and is also available with a FAQ at: 5 | http://scripts.sil.org/OFL 6 | 7 | 8 | ----------------------------------------------------------- 9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 10 | ----------------------------------------------------------- 11 | 12 | PREAMBLE 13 | The goals of the Open Font License (OFL) are to stimulate worldwide 14 | development of collaborative font projects, to support the font creation 15 | efforts of academic and linguistic communities, and to provide a free and 16 | open framework in which fonts may be shared and improved in partnership 17 | with others. 18 | 19 | The OFL allows the licensed fonts to be used, studied, modified and 20 | redistributed freely as long as they are not sold by themselves. The 21 | fonts, including any derivative works, can be bundled, embedded, 22 | redistributed and/or sold with any software provided that any reserved 23 | names are not used by derivative works. The fonts and derivatives, 24 | however, cannot be released under any other type of license. The 25 | requirement for fonts to remain under this license does not apply 26 | to any document created using the fonts or their derivatives. 27 | 28 | DEFINITIONS 29 | "Font Software" refers to the set of files released by the Copyright 30 | Holder(s) under this license and clearly marked as such. This may 31 | include source files, build scripts and documentation. 32 | 33 | "Reserved Font Name" refers to any names specified as such after the 34 | copyright statement(s). 35 | 36 | "Original Version" refers to the collection of Font Software components as 37 | distributed by the Copyright Holder(s). 38 | 39 | "Modified Version" refers to any derivative made by adding to, deleting, 40 | or substituting -- in part or in whole -- any of the components of the 41 | Original Version, by changing formats or by porting the Font Software to a 42 | new environment. 43 | 44 | "Author" refers to any designer, engineer, programmer, technical 45 | writer or other person who contributed to the Font Software. 46 | 47 | PERMISSION & CONDITIONS 48 | Permission is hereby granted, free of charge, to any person obtaining 49 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 50 | redistribute, and sell modified and unmodified copies of the Font 51 | Software, subject to the following conditions: 52 | 53 | 1) Neither the Font Software nor any of its individual components, 54 | in Original or Modified Versions, may be sold by itself. 55 | 56 | 2) Original or Modified Versions of the Font Software may be bundled, 57 | redistributed and/or sold with any software, provided that each copy 58 | contains the above copyright notice and this license. These can be 59 | included either as stand-alone text files, human-readable headers or 60 | in the appropriate machine-readable metadata fields within text or 61 | binary files as long as those fields can be easily viewed by the user. 62 | 63 | 3) No Modified Version of the Font Software may use the Reserved Font 64 | Name(s) unless explicit written permission is granted by the corresponding 65 | Copyright Holder. This restriction only applies to the primary font name as 66 | presented to the users. 67 | 68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 69 | Software shall not be used to promote, endorse or advertise any 70 | Modified Version, except to acknowledge the contribution(s) of the 71 | Copyright Holder(s) and the Author(s) or with their explicit written 72 | permission. 73 | 74 | 5) The Font Software, modified or unmodified, in part or in whole, 75 | must be distributed entirely under this license, and must not be 76 | distributed under any other license. The requirement for fonts to 77 | remain under this license does not apply to any document created 78 | using the Font Software. 79 | 80 | TERMINATION 81 | This license becomes null and void if any of the above conditions are 82 | not met. 83 | 84 | DISCLAIMER 85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 93 | OTHER DEALINGS IN THE FONT SOFTWARE. 94 | -------------------------------------------------------------------------------- /bhreact/src/fonts/Oswald-300/Oswald-300.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/bhreact/src/fonts/Oswald-300/Oswald-300.eot -------------------------------------------------------------------------------- /bhreact/src/fonts/Oswald-300/Oswald-300.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/bhreact/src/fonts/Oswald-300/Oswald-300.ttf -------------------------------------------------------------------------------- /bhreact/src/fonts/Oswald-300/Oswald-300.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/bhreact/src/fonts/Oswald-300/Oswald-300.woff -------------------------------------------------------------------------------- /bhreact/src/fonts/Oswald-300/Oswald-300.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/bhreact/src/fonts/Oswald-300/Oswald-300.woff2 -------------------------------------------------------------------------------- /bhreact/src/fonts/Oswald-regular/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2016 The Oswald Project Authors (contact@sansoxygen.com) 2 | 3 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 4 | This license is copied below, and is also available with a FAQ at: 5 | http://scripts.sil.org/OFL 6 | 7 | 8 | ----------------------------------------------------------- 9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 10 | ----------------------------------------------------------- 11 | 12 | PREAMBLE 13 | The goals of the Open Font License (OFL) are to stimulate worldwide 14 | development of collaborative font projects, to support the font creation 15 | efforts of academic and linguistic communities, and to provide a free and 16 | open framework in which fonts may be shared and improved in partnership 17 | with others. 18 | 19 | The OFL allows the licensed fonts to be used, studied, modified and 20 | redistributed freely as long as they are not sold by themselves. The 21 | fonts, including any derivative works, can be bundled, embedded, 22 | redistributed and/or sold with any software provided that any reserved 23 | names are not used by derivative works. The fonts and derivatives, 24 | however, cannot be released under any other type of license. The 25 | requirement for fonts to remain under this license does not apply 26 | to any document created using the fonts or their derivatives. 27 | 28 | DEFINITIONS 29 | "Font Software" refers to the set of files released by the Copyright 30 | Holder(s) under this license and clearly marked as such. This may 31 | include source files, build scripts and documentation. 32 | 33 | "Reserved Font Name" refers to any names specified as such after the 34 | copyright statement(s). 35 | 36 | "Original Version" refers to the collection of Font Software components as 37 | distributed by the Copyright Holder(s). 38 | 39 | "Modified Version" refers to any derivative made by adding to, deleting, 40 | or substituting -- in part or in whole -- any of the components of the 41 | Original Version, by changing formats or by porting the Font Software to a 42 | new environment. 43 | 44 | "Author" refers to any designer, engineer, programmer, technical 45 | writer or other person who contributed to the Font Software. 46 | 47 | PERMISSION & CONDITIONS 48 | Permission is hereby granted, free of charge, to any person obtaining 49 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 50 | redistribute, and sell modified and unmodified copies of the Font 51 | Software, subject to the following conditions: 52 | 53 | 1) Neither the Font Software nor any of its individual components, 54 | in Original or Modified Versions, may be sold by itself. 55 | 56 | 2) Original or Modified Versions of the Font Software may be bundled, 57 | redistributed and/or sold with any software, provided that each copy 58 | contains the above copyright notice and this license. These can be 59 | included either as stand-alone text files, human-readable headers or 60 | in the appropriate machine-readable metadata fields within text or 61 | binary files as long as those fields can be easily viewed by the user. 62 | 63 | 3) No Modified Version of the Font Software may use the Reserved Font 64 | Name(s) unless explicit written permission is granted by the corresponding 65 | Copyright Holder. This restriction only applies to the primary font name as 66 | presented to the users. 67 | 68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 69 | Software shall not be used to promote, endorse or advertise any 70 | Modified Version, except to acknowledge the contribution(s) of the 71 | Copyright Holder(s) and the Author(s) or with their explicit written 72 | permission. 73 | 74 | 5) The Font Software, modified or unmodified, in part or in whole, 75 | must be distributed entirely under this license, and must not be 76 | distributed under any other license. The requirement for fonts to 77 | remain under this license does not apply to any document created 78 | using the Font Software. 79 | 80 | TERMINATION 81 | This license becomes null and void if any of the above conditions are 82 | not met. 83 | 84 | DISCLAIMER 85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 93 | OTHER DEALINGS IN THE FONT SOFTWARE. 94 | -------------------------------------------------------------------------------- /bhreact/src/fonts/Oswald-regular/Oswald-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/bhreact/src/fonts/Oswald-regular/Oswald-regular.eot -------------------------------------------------------------------------------- /bhreact/src/fonts/Oswald-regular/Oswald-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/bhreact/src/fonts/Oswald-regular/Oswald-regular.ttf -------------------------------------------------------------------------------- /bhreact/src/fonts/Oswald-regular/Oswald-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/bhreact/src/fonts/Oswald-regular/Oswald-regular.woff -------------------------------------------------------------------------------- /bhreact/src/fonts/Oswald-regular/Oswald-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/bhreact/src/fonts/Oswald-regular/Oswald-regular.woff2 -------------------------------------------------------------------------------- /bhreact/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: sans-serif; 5 | } 6 | -------------------------------------------------------------------------------- /bhreact/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import { Router, Route, IndexRoute, browserHistory } from 'react-router' 4 | import { Provider } from 'react-redux' 5 | import { syncHistoryWithStore } from 'react-router-redux' 6 | import getWeb3 from './util/web3/getWeb3' 7 | 8 | // Layouts 9 | import App from './App' 10 | import QueryEhrContainer from './ehr/queryehr/QueryEhrContainer'; 11 | import {SignUpContainer} from "./ehr/signup/SignUpContainer"; 12 | import {AuthorizeContainer} from "./ehr/authorize/AuthorizeContainer"; 13 | import {HomePage} from "./ehr/homepage/HomePage"; 14 | 15 | // Redux Store 16 | import store from './store' 17 | 18 | // Initialize react-router-redux. 19 | const history = syncHistoryWithStore(browserHistory, store); 20 | 21 | // Initialize web3 and set in Redux. 22 | getWeb3 23 | .then(results => { 24 | console.log('Web3 initialized!') 25 | }) 26 | .catch(() => { 27 | console.log('Error in web3 initialization.') 28 | }); 29 | 30 | ReactDOM.render(( 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | ), 42 | document.getElementById('root') 43 | ); 44 | -------------------------------------------------------------------------------- /bhreact/src/reducer.js: -------------------------------------------------------------------------------- 1 | import { combineReducers } from 'redux' 2 | import { routerReducer } from 'react-router-redux' 3 | import web3Reducer from './util/web3/web3Reducer' 4 | import queryEhrReducer from './ehr/queryehr/queryEhrReducer' 5 | import authorizeReducer from './ehr/authorize/AuthorizeReducer'; 6 | 7 | const reducer = combineReducers({ 8 | routing: routerReducer, 9 | web3: web3Reducer, 10 | queryEhr: queryEhrReducer, 11 | authorize: authorizeReducer 12 | }); 13 | 14 | export default reducer 15 | -------------------------------------------------------------------------------- /bhreact/src/store.js: -------------------------------------------------------------------------------- 1 | import { browserHistory } from 'react-router' 2 | import { createStore, applyMiddleware, compose } from 'redux' 3 | import thunkMiddleware from 'redux-thunk' 4 | import { routerMiddleware } from 'react-router-redux' 5 | import reducer from './reducer' 6 | 7 | // Redux DevTools 8 | const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; 9 | 10 | const routingMiddleware = routerMiddleware(browserHistory) 11 | 12 | const store = createStore( 13 | reducer, 14 | composeEnhancers( 15 | applyMiddleware( 16 | thunkMiddleware, 17 | routingMiddleware 18 | ) 19 | ) 20 | ) 21 | 22 | export default store 23 | -------------------------------------------------------------------------------- /bhreact/src/util/httpRequest.js: -------------------------------------------------------------------------------- 1 | import $ from 'jquery' 2 | import { message, Modal } from 'antd' 3 | 4 | const SERVER_ERROR = '服务器通讯异常'; 5 | export default function (address, type = 'POST', params = {}, sucFuc, dispatch, loading = true) { 6 | let postfix = ""; 7 | let urlPositfix = ""; 8 | 9 | if (params.searchFields && params.searchFields.undefined) { 10 | params.searchFields = {}; 11 | } 12 | 13 | // let hostname = window.location.hostname; 14 | // if ((hostname.indexOf("localhost") !== -1 || hostname.indexOf("0.0.0.0") !== -1) && window.location.port.charAt(0) === "3") { 15 | // type = 'GET'; 16 | // postfix = ".json"; 17 | // urlPositfix = 'server/'; 18 | // } 19 | 20 | // if (loading) { 21 | // dispatch({ 22 | // type: 'LOADING', 23 | // data: { 24 | // show: true 25 | // } 26 | // }); 27 | // } 28 | 29 | let ajaxParam = { 30 | type: type, 31 | url: urlPositfix + address + postfix, 32 | success: function (data) { 33 | // if (loading) { 34 | // dispatch({ 35 | // type: 'LOADING', 36 | // data: { 37 | // show: false 38 | // } 39 | // }); 40 | // } 41 | if (typeof data === 'string') { 42 | data = data === '' ? {} : JSON.parse(data); 43 | } 44 | 45 | if (data.developerMessage) { 46 | console.debug(data.developerMessage); 47 | } 48 | 49 | sucFuc(data); 50 | }, 51 | error: function (xhr, errorType, error) { 52 | // if (loading) { 53 | // dispatch({ 54 | // type: 'LOADING', 55 | // data: { 56 | // show: false 57 | // } 58 | // }); 59 | // } 60 | if (xhr.status === 200) { 61 | sucFuc && sucFuc(xhr.responseText); 62 | return; 63 | } 64 | if (xhr.status === 302) { 65 | window.location.href = xhr.responseText; 66 | return; 67 | } 68 | 69 | // ** form errors 70 | if (xhr.status === 422) { 71 | Modal.error({ 72 | title: '提示', 73 | content: xhr.responseJSON.message || SERVER_ERROR 74 | }); 75 | 76 | return; 77 | } 78 | 79 | if (xhr.status !== 200) { 80 | message.error(SERVER_ERROR); 81 | } 82 | } 83 | }; 84 | 85 | if (type == "GET") { 86 | ajaxParam['data'] = JSON.stringify(params); 87 | } else { 88 | ajaxParam['data'] = JSON.stringify(params); 89 | ajaxParam["contentType"] = "application/json; charset=utf-8"; 90 | } 91 | 92 | $.ajax(ajaxParam); 93 | } 94 | -------------------------------------------------------------------------------- /bhreact/src/util/web3/getWeb3.js: -------------------------------------------------------------------------------- 1 | import store from '../../store' 2 | import Web3 from 'web3' 3 | 4 | export const WEB3_INITIALIZED = 'WEB3_INITIALIZED' 5 | function web3Initialized(results) { 6 | return { 7 | type: WEB3_INITIALIZED, 8 | payload: results 9 | } 10 | } 11 | 12 | let getWeb3 = new Promise(function(resolve, reject) { 13 | // Wait for loading completion to avoid race conditions with web3 injection timing. 14 | window.addEventListener('load', function(dispatch) { 15 | var results 16 | var web3 = window.web3 17 | 18 | // Checking if Web3 has been injected by the browser (Mist/MetaMask) 19 | if (typeof web3 !== 'undefined') { 20 | // Use Mist/MetaMask's provider. 21 | web3 = new Web3(web3.currentProvider) 22 | 23 | results = { 24 | web3Instance: web3 25 | } 26 | 27 | console.log('Injected web3 detected.'); 28 | 29 | resolve(store.dispatch(web3Initialized(results))) 30 | } else { 31 | 32 | // Fallback to localhost if no web3 injection. We've configured this to 33 | // use the development console's port by default. 34 | var provider = new Web3.providers.HttpProvider('http://127.0.0.1:9545') 35 | 36 | web3 = new Web3(provider) 37 | 38 | results = { 39 | web3Instance: web3 40 | } 41 | 42 | console.log('No web3 instance injected, using Local web3.'); 43 | 44 | resolve(store.dispatch(web3Initialized(results))) 45 | } 46 | }) 47 | }) 48 | 49 | export default getWeb3 50 | -------------------------------------------------------------------------------- /bhreact/src/util/web3/web3Reducer.js: -------------------------------------------------------------------------------- 1 | const initialState = { 2 | web3Instance: null 3 | } 4 | 5 | const web3Reducer = (state = initialState, action) => { 6 | if (action.type === 'WEB3_INITIALIZED') 7 | { 8 | return Object.assign({}, state, { 9 | web3Instance: action.payload.web3Instance 10 | }) 11 | } 12 | 13 | return state 14 | } 15 | 16 | export default web3Reducer 17 | -------------------------------------------------------------------------------- /bhreact/src/util/wrappers.js: -------------------------------------------------------------------------------- 1 | import { UserAuthWrapper } from 'redux-auth-wrapper' 2 | import { routerActions } from 'react-router-redux' 3 | 4 | // Layout Component Wrappers 5 | 6 | export const UserIsAuthenticated = UserAuthWrapper({ 7 | authSelector: state => state.user.data, 8 | redirectAction: routerActions.replace, 9 | failureRedirectPath: '/', // '/login' by default. 10 | wrapperDisplayName: 'UserIsAuthenticated' 11 | }) 12 | 13 | export const UserIsNotAuthenticated = UserAuthWrapper({ 14 | authSelector: state => state.user, 15 | redirectAction: routerActions.replace, 16 | failureRedirectPath: (state, ownProps) => ownProps.location.query.redirect || '/dashboard', 17 | wrapperDisplayName: 'UserIsNotAuthenticated', 18 | predicate: user => user.data === null, 19 | allowRedirectBack: false 20 | }) 21 | 22 | // UI Component Wrappers 23 | 24 | export const VisibleOnlyAuth = UserAuthWrapper({ 25 | authSelector: state => state.user, 26 | wrapperDisplayName: 'VisibleOnlyAuth', 27 | predicate: user => user.data, 28 | FailureComponent: null 29 | }) 30 | 31 | export const HiddenOnlyAuth = UserAuthWrapper({ 32 | authSelector: state => state.user, 33 | wrapperDisplayName: 'HiddenOnlyAuth', 34 | predicate: user => user.data === null, 35 | FailureComponent: null 36 | }) 37 | -------------------------------------------------------------------------------- /bhreact/test/TestAuthentication.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.2; 2 | 3 | import "truffle/Assert.sol"; 4 | import "truffle/DeployedAddresses.sol"; 5 | import "../contracts/Authentication.sol"; 6 | 7 | contract TestAuthentication { 8 | 9 | function testUserCanSignUpAndLogin() { 10 | Authentication authentication = Authentication(DeployedAddresses.Authentication()); 11 | 12 | authentication.signup('testuser'); 13 | 14 | bytes32 expected = 'testuser'; 15 | 16 | Assert.equal(authentication.login(), expected, "It should sign up and log in a user."); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /bhreact/test/authentication.js: -------------------------------------------------------------------------------- 1 | var Authentication = artifacts.require("./Authentication.sol"); 2 | 3 | contract('Authentication', function(accounts) { 4 | 5 | it("...should sign up and log in a user.", function() { 6 | return Authentication.deployed().then(function(instance) { 7 | authenticationInstance = instance; 8 | 9 | return authenticationInstance.signup('testuser', {from: accounts[0]}); 10 | }).then(function() { 11 | return authenticationInstance.login.call(); 12 | }).then(function(userName) { 13 | assert.equal(web3.toUtf8(userName), 'testuser', "The user was not signed up."); 14 | }); 15 | }); 16 | 17 | }); 18 | -------------------------------------------------------------------------------- /bhreact/truffle-config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // See 3 | // to customize your Truffle configuration! 4 | networks: { 5 | development: { 6 | host: '127.0.0.1', 7 | port: 9545, 8 | network_id: '*' // Match any network id 9 | }, 10 | privatenetwork: { 11 | host: 'http://10.0.3.161', 12 | port: 8080, 13 | network_id: 100 14 | } 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /bhreact/truffle.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // See 3 | // to customize your Truffle configuration! 4 | networks: { 5 | development: { 6 | host: '127.0.0.1', 7 | port: 9545, 8 | network_id: '*' // Match any network id 9 | }, 10 | privatenetwork: { 11 | host: '127.0.0.1', 12 | port: 8080, 13 | network_id: 100 14 | } 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /createdata/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ -------------------------------------------------------------------------------- /createdata/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/createdata/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /createdata/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip 2 | -------------------------------------------------------------------------------- /createdata/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" 124 | FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( 125 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 126 | ) 127 | 128 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 129 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 130 | if exist %WRAPPER_JAR% ( 131 | echo Found %WRAPPER_JAR% 132 | ) else ( 133 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 134 | echo Downloading from: %DOWNLOAD_URL% 135 | powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" 136 | echo Finished downloading %WRAPPER_JAR% 137 | ) 138 | @REM End of extension 139 | 140 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 141 | if ERRORLEVEL 1 goto error 142 | goto end 143 | 144 | :error 145 | set ERROR_CODE=1 146 | 147 | :end 148 | @endlocal & set ERROR_CODE=%ERROR_CODE% 149 | 150 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 151 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 152 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 153 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 154 | :skipRcPost 155 | 156 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 157 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 158 | 159 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 160 | 161 | exit /B %ERROR_CODE% 162 | -------------------------------------------------------------------------------- /createdata/mybatisGenerator/generator.properties: -------------------------------------------------------------------------------- 1 | tableName=column 2 | schemaName=innerSSO 3 | -------------------------------------------------------------------------------- /createdata/mybatisGenerator/generator.sh: -------------------------------------------------------------------------------- 1 | java -jar mybatis-generator-core-1.3.2.jar -configfile ./generatorConfig.xml -------------------------------------------------------------------------------- /createdata/mybatisGenerator/generatorConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 73 | 75 | 76 | 84 | 85 | 89 | 90 | 91 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 121 | 122 | 123 |
124 | 125 | 133 | 134 | 135 | 136 | 141 | 142 | 143 | 144 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /createdata/mybatisGenerator/mybatis-generator-core-1.3.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/createdata/mybatisGenerator/mybatis-generator-core-1.3.2.jar -------------------------------------------------------------------------------- /createdata/mybatisGenerator/mysql-connector-java-5.1.37-bin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/createdata/mybatisGenerator/mysql-connector-java-5.1.37-bin.jar -------------------------------------------------------------------------------- /createdata/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.1.1.RELEASE 9 | 10 | 11 | com.example 12 | createdata 13 | 0.0.1-SNAPSHOT 14 | createdata 15 | Demo project for Spring Boot 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-starter-jdbc 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-starter-web 29 | 30 | 31 | org.mybatis.spring.boot 32 | mybatis-spring-boot-starter 33 | 1.3.2 34 | 35 | 36 | 37 | mysql 38 | mysql-connector-java 39 | runtime 40 | 41 | 42 | org.springframework.boot 43 | spring-boot-starter-test 44 | test 45 | 46 | 47 | com.alibaba 48 | druid-spring-boot-starter 49 | 1.1.9 50 | 51 | 52 | 53 | org.apache.hadoop 54 | hadoop-common 55 | 2.5.1 56 | 57 | 58 | org.apache.hadoop 59 | hadoop-hdfs 60 | 2.5.1 61 | 62 | 63 | org.apache.hadoop 64 | hadoop-client 65 | 2.5.1 66 | 67 | 68 | org.apache.hive 69 | hive-jdbc 70 | 2.3.4 71 | 72 | 73 | 74 | 75 | 76 | 77 | org.springframework.boot 78 | spring-boot-maven-plugin 79 | 80 | 81 | org.mybatis.generator 82 | mybatis-generator-maven-plugin 83 | 1.3.2 84 | 85 | ${basedir}/src/main/resources/generator/generatorConfig.xml 86 | true 87 | true 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /createdata/src/main/java/com/example/createdata/CreatedataApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.createdata; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @SpringBootApplication 8 | @MapperScan("com.example.createdata.mapper") 9 | public class CreatedataApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(CreatedataApplication.class, args); 13 | } 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /createdata/src/main/java/com/example/createdata/controller/TestController.java: -------------------------------------------------------------------------------- 1 | package com.example.createdata.controller; 2 | 3 | import com.example.createdata.service.CreateDataService; 4 | import com.example.createdata.service.HadoopService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RequestMethod; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | @RestController 11 | public class TestController { 12 | 13 | @Autowired 14 | private CreateDataService createDataService; 15 | @Autowired 16 | private HadoopService hadoopService; 17 | 18 | @RequestMapping(value = "/create", method = RequestMethod.GET) 19 | public String create() { 20 | createDataService.createData(); 21 | return "SUCCESS"; 22 | } 23 | 24 | @RequestMapping(value = "/importData", method = RequestMethod.GET) 25 | public String importData() throws Exception{ 26 | hadoopService.importDataFromMysql(); 27 | return "SUCCESS"; 28 | } 29 | 30 | @RequestMapping(value = "/queryData", method = RequestMethod.GET) 31 | public long queryData(String sql) throws Exception{ 32 | return hadoopService.queryData(sql); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /createdata/src/main/java/com/example/createdata/mapper/EhrMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.createdata.mapper; 2 | 3 | import com.example.createdata.entity.EhrData; 4 | import org.apache.hadoop.io.LongWritable; 5 | import org.apache.hadoop.io.Text; 6 | import org.apache.hadoop.mapred.MapReduceBase; 7 | import org.apache.hadoop.mapred.Mapper; 8 | import org.apache.hadoop.mapred.OutputCollector; 9 | import org.apache.hadoop.mapred.Reporter; 10 | 11 | import java.io.IOException; 12 | 13 | @SuppressWarnings("deprecation") 14 | public class EhrMapper extends MapReduceBase implements Mapper { 15 | @Override 16 | public void map(LongWritable longWritable, EhrData ehrData, OutputCollector outputCollector, 17 | Reporter reporter) throws IOException { 18 | outputCollector.collect(new LongWritable(ehrData.getId()), new Text(ehrData.toString())); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /createdata/src/main/java/com/example/createdata/service/CreateDataService.java: -------------------------------------------------------------------------------- 1 | package com.example.createdata.service; 2 | 3 | import com.example.createdata.entity.EhrData; 4 | import com.example.createdata.entity.EhrDataExample; 5 | import com.example.createdata.mapper.EhrDataMapper; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | @Service 13 | public class CreateDataService { 14 | 15 | @Autowired 16 | private EhrDataMapper ehrDataMapper; 17 | 18 | 19 | public void createData() { 20 | EhrDataExample ehrDataExample = new EhrDataExample(); 21 | ehrDataExample.setOrderByClause("cid limit 0,10000"); 22 | List ehrDataList = ehrDataMapper.selectByExample(ehrDataExample); 23 | Integer count = 5000000 / ehrDataList.size(); 24 | Integer index = 15000000; 25 | for (int i = 0; i < count; i++) { 26 | List newDataList = new ArrayList<>(); 27 | for (EhrData ehrData : ehrDataList) { 28 | index++; 29 | ehrData.setCid("jpc" + index); 30 | newDataList.add(ehrData); 31 | } 32 | ehrDataMapper.batchInsert(newDataList); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /createdata/src/main/java/com/example/createdata/service/HadoopService.java: -------------------------------------------------------------------------------- 1 | package com.example.createdata.service; 2 | 3 | import com.example.createdata.entity.EhrData; 4 | import com.example.createdata.mapper.EhrMapper; 5 | import org.apache.hadoop.fs.Path; 6 | import org.apache.hadoop.io.LongWritable; 7 | import org.apache.hadoop.io.Text; 8 | import org.apache.hadoop.mapred.FileOutputFormat; 9 | import org.apache.hadoop.mapred.JobClient; 10 | import org.apache.hadoop.mapred.JobConf; 11 | import org.apache.hadoop.mapred.lib.IdentityReducer; 12 | import org.apache.hadoop.mapred.lib.db.DBConfiguration; 13 | import org.apache.hadoop.mapred.lib.db.DBInputFormat; 14 | import org.springframework.stereotype.Service; 15 | 16 | import java.io.IOException; 17 | import java.sql.*; 18 | import java.util.Date; 19 | import java.util.List; 20 | 21 | @Service 22 | public class HadoopService { 23 | 24 | private static final String HDFS_PATH = "hdfs://10.0.3.247:9000/user/hadoop/ehr_data"; 25 | private static final String MYSQL_DRIVER = "com.mysql.jdbc.Driver"; 26 | private static final String MYSQL_PATH = "jdbc:mysql://localhost:3306/ehrdata"; 27 | private static final String MYSQL_NAME = "root"; 28 | private static final String MYSQL_PWD = "123456"; 29 | private static final String MYSQL_TABLE_NAME = "ehr_data"; 30 | 31 | private static final String HIVE_DRIVER = "org.apache.hive.jdbc.HiveDriver"; 32 | private static final String HIVE_PATH = "jdbc:hive2://10.0.3.247:10000/default"; 33 | 34 | public void importDataFromMysql() throws IOException { 35 | JobConf conf = new JobConf(HadoopService.class); 36 | conf.setOutputKeyClass(LongWritable.class); 37 | conf.setOutputValueClass(Text.class); 38 | conf.setInputFormat(DBInputFormat.class); 39 | Path path = new Path(HDFS_PATH); 40 | FileOutputFormat.setOutputPath(conf, path); 41 | DBConfiguration.configureDB(conf, MYSQL_DRIVER, MYSQL_PATH, MYSQL_NAME, MYSQL_PWD); 42 | String [] fields = {"id", "cid", "vid", "name", "gender", "birthday", "examdate", "bz8", "bz10", "bz11", 43 | "bz12", "bz16", "bz17", "bz18", "bz171", "bz172", "bz173", "bz174", "bz175", "bz268", "bz271", 44 | "bz272", "bz84", "bz85", "bz107", "bz108", "bz109", "bz110", "bz104", "bz105", "bz106", "bz113", 45 | "bz111", "bz112", "bz103", "bz120", "bz119", "bz121", "bz81", "bz82", "bz83"}; 46 | DBInputFormat.setInput(conf, EhrData.class, MYSQL_TABLE_NAME, null, "id", fields); 47 | conf.setMapperClass(EhrMapper.class); 48 | conf.setReducerClass(IdentityReducer.class); 49 | JobClient.runJob(conf); 50 | } 51 | 52 | public long queryData(String sql) throws Exception { 53 | Class.forName(HIVE_DRIVER); 54 | Connection connection = DriverManager.getConnection(HIVE_PATH, "hadoop", "1qaz2wsx"); 55 | // Class.forName(MYSQL_DRIVER); 56 | // Connection connection = DriverManager.getConnection(MYSQL_PATH, "root", "123456"); 57 | PreparedStatement statement = connection.prepareStatement(sql); 58 | 59 | Date start = new Date(); 60 | statement.execute(); 61 | ResultSet resultSet = statement.getResultSet(); 62 | 63 | int count = 0; 64 | while (resultSet.next()) { 65 | count++; 66 | } 67 | Date end = new Date(); 68 | System.out.println(count); 69 | System.out.println(end.getTime() - start.getTime()); 70 | 71 | statement.close(); 72 | connection.close(); 73 | return end.getTime() - start.getTime(); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /createdata/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8082 3 | spring: 4 | datasource: 5 | name: mysql_test 6 | type: com.alibaba.druid.pool.DruidDataSource 7 | #druid相关配置 8 | druid: 9 | #监控统计拦截的filters 10 | filters: stat 11 | driver-class-name: com.mysql.jdbc.Driver 12 | #基本属性 13 | url: jdbc:mysql://127.0.0.1:3306/ehrdata?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true 14 | username: root 15 | password: 123456 16 | #配置初始化大小/最小/最大 17 | initial-size: 1 18 | min-idle: 1 19 | max-active: 20 20 | #获取连接等待超时时间 21 | max-wait: 60000 22 | #间隔多久进行一次检测,检测需要关闭的空闲连接 23 | time-between-eviction-runs-millis: 60000 24 | #一个连接在池中最小生存的时间 25 | min-evictable-idle-time-millis: 300000 26 | validation-query: SELECT 'x' 27 | test-while-idle: true 28 | test-on-borrow: false 29 | test-on-return: false 30 | #打开PSCache,并指定每个连接上PSCache的大小。oracle设为true,mysql设为false。分库分表较多推荐设置为false 31 | pool-prepared-statements: false 32 | max-pool-prepared-statement-per-connection-size: 20 33 | 34 | ## 该配置节点为独立的节点,有很多同学容易将这个配置放在spring的节点下,导致配置无法被识别 35 | mybatis: 36 | mapper-locations: classpath:mapper/*.xml #注意:一定要对应mapper映射xml文件的所在路径 37 | type-aliases-package: com.winterchen.model # 注意:对应实体类的路径 38 | 39 | #pagehelper 40 | pagehelper: 41 | helperDialect: mysql 42 | reasonable: true 43 | supportMethodsArguments: true 44 | params: count=countSql 45 | returnPageInfo: check 46 | -------------------------------------------------------------------------------- /createdata/src/test/java/com/example/createdata/CreatedataApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.example.createdata; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class CreatedataApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /doc/BlockHealth软件构架文档.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/BlockHealth软件构架文档.docx -------------------------------------------------------------------------------- /doc/WorkSummary/第七周工作总结.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/WorkSummary/第七周工作总结.docx -------------------------------------------------------------------------------- /doc/WorkSummary/第九周工作总结.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/WorkSummary/第九周工作总结.docx -------------------------------------------------------------------------------- /doc/WorkSummary/第五周工作总结.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/WorkSummary/第五周工作总结.docx -------------------------------------------------------------------------------- /doc/WorkSummary/第八周工作总结.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/WorkSummary/第八周工作总结.docx -------------------------------------------------------------------------------- /doc/WorkSummary/第六周工作总结.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/WorkSummary/第六周工作总结.docx -------------------------------------------------------------------------------- /doc/WorkSummary/第十一周工作总结.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/WorkSummary/第十一周工作总结.docx -------------------------------------------------------------------------------- /doc/WorkSummary/第十三周工作总结.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/WorkSummary/第十三周工作总结.docx -------------------------------------------------------------------------------- /doc/WorkSummary/第十五周工作总结.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/WorkSummary/第十五周工作总结.docx -------------------------------------------------------------------------------- /doc/WorkSummary/第十六到十八周工作总结.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/WorkSummary/第十六到十八周工作总结.docx -------------------------------------------------------------------------------- /doc/WorkSummary/第十周工作总结.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/WorkSummary/第十周工作总结.docx -------------------------------------------------------------------------------- /doc/WorkSummary/第十四周工作总结.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/WorkSummary/第十四周工作总结.docx -------------------------------------------------------------------------------- /doc/第四小组_答辩.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/第四小组_答辩.pptx -------------------------------------------------------------------------------- /doc/第四组_立项建议书.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/第四组_立项建议书.docx -------------------------------------------------------------------------------- /doc/第四组_立项建议书V2.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/第四组_立项建议书V2.doc -------------------------------------------------------------------------------- /doc/第四组_立项建议书V4.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/第四组_立项建议书V4.doc -------------------------------------------------------------------------------- /doc/第四组软件需求规约1.0.2.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/第四组软件需求规约1.0.2.docx -------------------------------------------------------------------------------- /doc/迭代一/.~lock.搭建私有链.docx#: -------------------------------------------------------------------------------- 1 | ,jhb,jhbpc,02.01.2019 20:51,file:///home/jhb/.config/libreoffice/4; -------------------------------------------------------------------------------- /doc/迭代一/搭建私有链.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代一/搭建私有链.docx -------------------------------------------------------------------------------- /doc/迭代一/智能合约部署.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代一/智能合约部署.docx -------------------------------------------------------------------------------- /doc/迭代一/迭代一计划.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代一/迭代一计划.docx -------------------------------------------------------------------------------- /doc/迭代一/迭代一评估报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代一/迭代一评估报告.docx -------------------------------------------------------------------------------- /doc/迭代三/迭代三测试报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代三/迭代三测试报告.docx -------------------------------------------------------------------------------- /doc/迭代三/迭代三测试计划.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代三/迭代三测试计划.docx -------------------------------------------------------------------------------- /doc/迭代三/迭代三计划.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代三/迭代三计划.docx -------------------------------------------------------------------------------- /doc/迭代三/迭代三评估报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代三/迭代三评估报告.docx -------------------------------------------------------------------------------- /doc/迭代二/迭代二测试报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代二/迭代二测试报告.docx -------------------------------------------------------------------------------- /doc/迭代二/迭代二测试计划.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代二/迭代二测试计划.docx -------------------------------------------------------------------------------- /doc/迭代二/迭代二计划.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代二/迭代二计划.docx -------------------------------------------------------------------------------- /doc/迭代二/迭代二评估报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代二/迭代二评估报告.docx -------------------------------------------------------------------------------- /doc/迭代五/迭代五测试报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代五/迭代五测试报告.docx -------------------------------------------------------------------------------- /doc/迭代五/迭代五测试计划.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代五/迭代五测试计划.docx -------------------------------------------------------------------------------- /doc/迭代五/迭代五计划.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代五/迭代五计划.docx -------------------------------------------------------------------------------- /doc/迭代五/迭代五评估报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代五/迭代五评估报告.docx -------------------------------------------------------------------------------- /doc/迭代六/~$Doc2.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代六/~$Doc2.docx -------------------------------------------------------------------------------- /doc/迭代六/对比实验报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代六/对比实验报告.docx -------------------------------------------------------------------------------- /doc/迭代六/性能对比测试数据.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代六/性能对比测试数据.xlsx -------------------------------------------------------------------------------- /doc/迭代六/迭代六测试报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代六/迭代六测试报告.docx -------------------------------------------------------------------------------- /doc/迭代六/迭代六测试计划.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代六/迭代六测试计划.docx -------------------------------------------------------------------------------- /doc/迭代六/迭代六计划.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代六/迭代六计划.docx -------------------------------------------------------------------------------- /doc/迭代六/迭代六评估报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代六/迭代六评估报告.docx -------------------------------------------------------------------------------- /doc/迭代四/迭代四测试报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代四/迭代四测试报告.docx -------------------------------------------------------------------------------- /doc/迭代四/迭代四测试计划.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代四/迭代四测试计划.docx -------------------------------------------------------------------------------- /doc/迭代四/迭代四计划.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代四/迭代四计划.docx -------------------------------------------------------------------------------- /doc/迭代四/迭代四评估报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/迭代四/迭代四评估报告.docx -------------------------------------------------------------------------------- /doc/项目总结报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supperai/blockhealth/0a37bd57832483854f987b7ca4331c9713704f2e/doc/项目总结报告.docx -------------------------------------------------------------------------------- /genesis.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "chainId": 100, 4 | "homesteadBlock": 0, 5 | "eip155Block": 0, 6 | "eip158Block": 0 7 | }, 8 | "alloc" : {}, 9 | "coinbase" : "0x0000000000000000000000000000000000000000", 10 | "difficulty" : "0x1", 11 | "extraData" : "", 12 | "gasLimit" : "0xffffffff", 13 | "nonce" : "0x0000000000000042", 14 | "mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000", 15 | "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", 16 | "timestamp" : "0x00" 17 | } 18 | --------------------------------------------------------------------------------