8000 complete fetching data from sy · supercoderhawk/emr-processor@02ebf5c · GitHub
[go: up one dir, main page]

Skip to content

Commit 02ebf5c

Browse files
complete fetching data from sy
1 parent 095e283 commit 02ebf5c

File tree

4 files changed

+67
-22
lines changed

4 files changed

+67
-22
lines changed

app/src/renderer/components/Converter/Panel.vue

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
<div class="row">
44
<div class="col-sm-12 col-xs-12 col-lg-12">
55
<v-select v-model="input.value" :options="input.options" options-value="val"
6-
name="records" justified required close-on-select></v-select>
6+
name="records" @change="recordChange" @selected="recordSelected" justified required close-on-select></v-select>
77
<button @click="getData" class="btn btn-default">获取数据</button>
8+
<button @click="test" class="btn btn-default">测试</button>
89
</div>
910
</div>
1011
<div class="row">
@@ -20,12 +21,7 @@
2021

2122
<script>
2223
import {select} from 'vue-strap'
23-
// import rp from 'request-promise-native'
24-
// import request from 'request'
2524
import {CONVERTER} from '../../utils/constant'
26-
// import crypto from 'crypto'
27-
// var request = require('request/request')
28-
// const https = require('https')
2925
import {syGet} from '../../utils/network'
3026
3127
export default {
@@ -34,21 +30,60 @@
3430
},
3531
data () {
3632
return {
37-
input: {
38-
options: CONVERTER.INPUT_TYPES,
39-
value: 0
40-
},
4133
output: {
4234
options: CONVERTER.OUTPUT_TYPES,
4335
value: 0
4436
}
4537
}
4638
},
39+
computed: {
40+
input () {
41+
let options = this.$store.state.converter.records.map((item) => {
42+
return {val: item.id, label: item.name}
43+
})
44+
45+
return {value: 0, options}
46+
}
47+
},
4748
methods: {
49+
recordChange (value) {
50+
console.log('change:' + value)
51+
// 根据选中的病历ID设置内容
52+
},
53+
recordSelected (label) {
54+
// console.log('selected' + label)
55+
},
56+
// 获取森亿智库病历列表
4857
getData () {
49-
syGet('/api/v1/db/129/note/14fe5761c6c540093e44bc4b').then(function (res) {
50-
console.log(res)
51-
})
58+
let $this = this
59+
syGet(CONVERTER.BASE_PATH, {start: 0, count: 27})
60+
.then(function (res) {
61+
$this.getDetailData(res.data[0])
62+
})
63+
.catch(function (error) {
64+
console.log(error)
65+
})
66+
},
67+
// 获取森亿智库每份病历详细信息
68+
getDetailData (item) {
69+
let $this = this
70+
syGet(CONVERTER.BASE_PATH + item.id)
71+
.then(function (resItem) {
72+
syGet(CONVERTER.BASE_PATH + resItem.id + '/concept', undefined, false)
73+
.then(function (resConcept) {
74+
$this.$store.dispatch('addRecord',
75+
{id: resItem.id, name: resItem.name, plainText: resItem.content, jsonText: resConcept})
76+
})
77+
.catch(function (err) {
78+
console.log(err)
79+
})
80+
})
81+
.catch(function (error) {
82+
console.log(error)
83+
})
84+
},
85+
test () {
86+
this.$store.dispatch('addRecord', {id: '234', name: '测试', plainText: '内容', jsonText: null})
5287
}
5388
}
5489
}

app/src/renderer/store/actions.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@ export const addItem = ({ commit, state }, item) => {
77
}
88
}
99

10-
export const addRecord = ({ commit, state }, hash, name, plainText, jsonText) => {
10+
export const addRecord = ({ commit, state }, recItem) => {
1111
let record = {
1212
id: state.converter.amount,
13-
hash,
14-
name,
15-
plainText,
16-
jsonText
13+
hash: recItem.hash,
14+
name: recItem.name,
15+
plainText: recItem.plainText,
16+
jsonText: recItem.jsonText
1717
}
1818

1919
commit(types.ADD_RECORD, record)
2020
commit(types.ADD_AMOUNT)
2121
}
22+
23+
export const removeAllRecords = ({commit}) => {
24+
commit(types.REMOVE_ALL_RECORDS)
25+
}

app/src/renderer/store/modules/converter.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as type from '../mutation-types'
1+
import * as types from '../mutation-types'
22

33
const state = {
44
records: [
@@ -10,16 +10,21 @@ const state = {
1010
'name': '病历'
1111
}
1212
],
13-
amount: 0
13+
amount: 1
1414
}
1515

1616
const mutations = {
17-
[type.ADD_RECORD] (state, record) {
17+
[types.ADD_RECORD] (state, record) {
1818
state.records.push(record)
1919
},
2020

21-
[type.ADD_AMOUNT] (state) {
21+
[types.ADD_AMOUNT] (state) {
2222
state.amount ++
23+
},
24+
25+
[types.REMOVE_ALL_RECORDS] (state) {
26+
let records = state.records
27+
records.splice(0, records.length)
2328
}
2429
}
2530

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export const ADD_ITEM = 'ADD_ITEM'
2+
export const REMOVE_ALL_RECORDS = 'REMOVE_ALL_RECORDS'
23
export const ADD_RECORD = 'ADD_RECORD'
34
export const ADD_AMOUNT = 'ADD_AMOUNT'

0 commit comments

Comments
 (0)
0