50 |
51 |
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 |
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 |
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 |
--------------------------------------------------------------------------------