1
2
3
4
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<template>
<div class='h-full flex flex-col screening-second'>
<DocNavBar :title="`${id ? '修改' : '新增'}专病高危筛查`" class='shrink-0' :backFunc='onBack'></DocNavBar>
<div class='p-4 overflow-y-auto grow' ref='all'>
<BaseInfo :info='info'
v-show='step ==1'
@getLast='getLastData'
ref='baseInfo'
></BaseInfo>
<form-cont :info='info'
:disease-arrays-info='diseaseArraysInfo'
v-show='step == 2'
ref='formInfo'
></form-cont>
<common-bottom
v-if='step == 3'
ref='commonBottom'
></common-bottom>
<result :residentInfoId='residentInfoId'
:specialScreenResultList='specialScreenResultList'
v-show='step == 4'
></result>
</div>
<div class='bottom-small-line'></div>
<div class='pt-2 pb-2'>
<div class='px-5 grow flex flex-col justify-end' v-if='step == 1'>
<van-button type='primary' block round
@click='toNext(2)'>下一步
</van-button>
</div>
<div class='px-5 flex align-center justify-around' v-if='step == 2'>
<van-button type='primary' round plain style='width: 44%'
@click='toNext(1)'>上一步
</van-button>
<van-button type='primary' round style='width: 44%'
@click='toNext(3)'>下一步
</van-button>
</div>
<div class='px-5 grow flex flex-col justify-end' v-if='step == 3'>
<van-button type='primary' block round
@click='onsubmit'>提交
</van-button>
</div>
</div>
</div>
</template>
<script>
import DocNavBar from '@/doctor/components/docNavBar/DocNavBar.vue'
import ArchiveCommon from '@/doctor/components/archiveCommon/archiveCommon'
import { getChronicResidentsId } from '@/api/doctor/generalFU'
import FormCont from '@/doctor/screening/second/FormCont'
import Result from '@/doctor/screening/second/Result'
import DiseaseSelect from '@/doctor/screening/second/DiseaseSelect'
import BaseInfo from '@/doctor/screening/second/BaseInfo'
import { fetchDataHandle } from '@/utils/common'
import { getLastScreen, saveSecondScreening, secondScreenDetail, updateSecondScreening } from '@/api/doctor/screening'
import { showToast } from 'vant'
import CommonBottom from '@/doctor/screening/second/CommonBottom'
import { useStore } from '@/doctor/store'
export default {
components: {
CommonBottom,
BaseInfo,
DiseaseSelect,
Result,
FormCont,
ArchiveCommon,
DocNavBar
},
data() {
return {
store: useStore(),
step: 1,
info: {},
residentInfo: {},
diseaseArraysInfo: [],
specialScreenResultList: [],
}
},
computed: {
id() {
return this.$route.query.id
},
residentInfoId() {
return this.$route.query.residentInfoId
}
},
created() {
this.init()
},
methods: {
async init() {
this.info = {}
if (this.id) {
const res = await secondScreenDetail({ id: this.id })
let result = res.data || {}
const { residentsRecord = {} } = result
const { id, ...others } = residentsRecord
let obj = this.dataHandle(result)
this.info = {
...others,
personId: id,
...obj
}
this.residentInfo = {
...others,
personId: id,
}
} else {
const res = await getChronicResidentsId(this.residentInfoId)
const {
id,
createDate,
createDoctorId,
createDoctorName,
createOfficeId,
createOfficeName,
createUnitId,
createUnitName,
updated,
...others
} = res.data
this.residentInfo = {
personId: id,
...others
}
this.info = {
personId: id,
...others
}
}
},
//获取上一次筛查数据
getLastData() {
let par = {
residentInfoId: this.residentInfoId
}
getLastScreen(par).then(res => {
let result = res.data || {}
if (Object.keys(result).length === 0) {
showToast('暂无上一次筛查数据')
return
}
let obj = this.dataHandle(result)
this.info = {
...obj,
...this.residentInfo,
flag: 'lastInfo',
id: null
}
})
},
//数据处理
dataHandle(result) {
let obj = fetchDataHandle(result, {
diseaseArrays: 'strToArrNum',
medicalHistory: 'strToArrNum',
familyHistory: 'strToArrNum',
relativeType: 'strToArrNum',
femaleMedicalHistory: 'strToArrNum',
medicineHistory: 'strToArrNum',
touchHarmful: 'strToArrNum',
dietaryHabit: 'strToArrNum',
drinkKind: 'strToArrNum',
specialScreenResult: 'strToArrNum',
highItem: 'strToArrNum',
hypertensionHighItem: 'strToArrNum',
diabetesHighItem: 'strToArrNum',
coronaryHighItem: 'strToArrNum',
strokeHighItem: 'strToArrNum',
pulmonaryHighItem: 'strToArrNum',
nephrosisHighItem: 'strToArrNum',
dyslipemiaHighItem: 'strToArrNum',
})
return obj
},
async toNext(val) {
this.$refs.all.scrollTo(0, 0)
if (val == 2) {
let obj = await this.$refs.baseInfo.onSubmit()
this.diseaseArraysInfo = obj.diseaseArrays || []
}
if (val == 3) {
await this.$refs.formInfo.onSubmit()
}
this.step = val
},
//提交所有表单
async onsubmit() {
let baseInfo = await this.$refs.baseInfo.onSubmit()
let formInfo = await this.$refs.formInfo.onSubmit()
let commonBottom = await this.$refs.commonBottom.onSubmit()
let params = {
...formInfo,
...commonBottom,
...baseInfo,
diseaseArrays: baseInfo.diseaseArrays ? baseInfo.diseaseArrays.join() : '',
source: 2
}
if (formInfo.specialScreenResult) {
let list = formInfo.specialScreenResult.split(",")
list.forEach(item => {
let res = this.store.getDict(`CP00137`).filter(e => e.value == item)
if (res && res.length) {
this.specialScreenResultList.push(res[0].name)
}
})
}
if (!params.id) {
saveSecondScreening(params).then(res => {
this.$message.success('新增成功')
this.store.onRefreshMark()
this.toNext(4)
})
} else {
updateSecondScreening(params).then(res => {
this.$message.success('修改成功')
this.store.onRefreshMark()
this.toNext(4)
})
}
},
onBack() {
if (this.step == 1) {
this.$router.back()
} else {
this.step--
}
}
}
}
</script>
<style lang='less' scoped>
</style>