|
@@ -0,0 +1,719 @@
|
|
1
|
+<template>
|
|
2
|
+ <div class="patient-container">
|
|
3
|
+ <patient-sidebar :id="patientID" defaultActive="1-8"></patient-sidebar>
|
|
4
|
+ <div
|
|
5
|
+ class="patient-app-container app-container"
|
|
6
|
+ v-loading="pageLoading"
|
|
7
|
+ element-loading-text="拼命加载中"
|
|
8
|
+ >
|
|
9
|
+ <el-row :gutter="20">
|
|
10
|
+ <el-col :span="17" v-loading="itemLoading">
|
|
11
|
+ <div class="filter-container" style="float:right">
|
|
12
|
+ <el-button
|
|
13
|
+ size="small"
|
|
14
|
+ class="filter-item"
|
|
15
|
+ type="primary"
|
|
16
|
+ @click="openNew()"
|
|
17
|
+ icon="el-icon-circle-plus-outline"
|
|
18
|
+ :disabled="project ? false : true"
|
|
19
|
+ >新增</el-button
|
|
20
|
+ >
|
|
21
|
+ <el-button
|
|
22
|
+ size="small"
|
|
23
|
+ class="filter-item"
|
|
24
|
+ type="primary"
|
|
25
|
+ icon="el-icon-edit-outline"
|
|
26
|
+ @click="openEdit()"
|
|
27
|
+ :disabled="itemDate ? false : true"
|
|
28
|
+ >修改</el-button
|
|
29
|
+ >
|
|
30
|
+ <el-button
|
|
31
|
+ size="small"
|
|
32
|
+ class="filter-item"
|
|
33
|
+ type="danger"
|
|
34
|
+ icon="el-icon-delete"
|
|
35
|
+ @click="deleteInspection()"
|
|
36
|
+ :disabled="itemDate ? false : true"
|
|
37
|
+ >删除</el-button
|
|
38
|
+ >
|
|
39
|
+ </div>
|
|
40
|
+ <div class="filter-container">
|
|
41
|
+ <el-button class="filter-item" type="text" style="color:#000"
|
|
42
|
+ >{{ itemName }}
|
|
43
|
+ <span v-if="itemDate"
|
|
44
|
+ >(检查日期:{{ itemDate }})</span
|
|
45
|
+ ></el-button
|
|
46
|
+ >
|
|
47
|
+ </div>
|
|
48
|
+ <el-table
|
|
49
|
+ :header-cell-style="{
|
|
50
|
+ backgroundColor: 'rgb(245, 247, 250)',
|
|
51
|
+ color: '#606266'
|
|
52
|
+ }"
|
|
53
|
+ :row-style="{ color: '#303133' }"
|
|
54
|
+ :data="items"
|
|
55
|
+ border
|
|
56
|
+ style="width: 100%"
|
|
57
|
+ id="user-inspection-order"
|
|
58
|
+ >
|
|
59
|
+ <el-table-column
|
|
60
|
+ prop="item_name"
|
|
61
|
+ label="检验项目"
|
|
62
|
+ align="center"
|
|
63
|
+ min-width="180"
|
|
64
|
+ >
|
|
65
|
+ <template slot-scope="scope">
|
|
66
|
+ {{ scope.row.item_name }} {{ scope.row.item_name_addition }}
|
|
67
|
+ </template>
|
|
68
|
+ </el-table-column>
|
|
69
|
+ <el-table-column
|
|
70
|
+ prop="name"
|
|
71
|
+ label="结果"
|
|
72
|
+ align="center"
|
|
73
|
+ min-width="80"
|
|
74
|
+ >
|
|
75
|
+ <template slot-scope="scope">
|
|
76
|
+ <span v-if="scope.row.value =='阳性'" style="color:red">{{ scope.row.value }}</span>
|
|
77
|
+ <span v-else>{{ scope.row.value }}</span>
|
|
78
|
+ <span v-if="scope.row.range_type == 1">
|
|
79
|
+ {{scope.row.value_direction}}
|
|
80
|
+ </span>
|
|
81
|
+ </template>
|
|
82
|
+ </el-table-column>
|
|
83
|
+ <el-table-column
|
|
84
|
+ prop="address"
|
|
85
|
+ label="参考值"
|
|
86
|
+ align="center"
|
|
87
|
+ min-width="120"
|
|
88
|
+ >
|
|
89
|
+ <template slot-scope="scope">
|
|
90
|
+ <span v-if="scope.row.range_type == 1"
|
|
91
|
+ >{{ scope.row.range_min }}~{{ scope.row.range_max }}</span
|
|
92
|
+ >
|
|
93
|
+ <span v-else>{{ scope.row.range_value }}</span>
|
|
94
|
+ </template>
|
|
95
|
+ </el-table-column>
|
|
96
|
+ <el-table-column
|
|
97
|
+ prop="unit"
|
|
98
|
+ label="单位"
|
|
99
|
+ align="center"
|
|
100
|
+ min-width="200"
|
|
101
|
+ >
|
|
102
|
+ </el-table-column>
|
|
103
|
+ </el-table>
|
|
104
|
+ <el-pagination
|
|
105
|
+ align="right"
|
|
106
|
+ @current-change="handleCurrentChangePage"
|
|
107
|
+ :current-page="queryParams.page"
|
|
108
|
+ :page-size="1"
|
|
109
|
+ background
|
|
110
|
+ style="margin-top:20px;"
|
|
111
|
+ layout="total, prev, pager, next, jumper"
|
|
112
|
+ :total="total"
|
|
113
|
+ >
|
|
114
|
+ </el-pagination>
|
|
115
|
+ </el-col>
|
|
116
|
+ </el-row>
|
|
117
|
+ </div>
|
|
118
|
+
|
|
119
|
+ <el-dialog
|
|
120
|
+ :title="formTitle"
|
|
121
|
+ :visible.sync="dialogFormVisible"
|
|
122
|
+ width="1000px"
|
|
123
|
+ id="user-inspection-form"
|
|
124
|
+ v-loading="formLoading"
|
|
125
|
+ >
|
|
126
|
+ <el-form :model="form" ref="form" label-position="top">
|
|
127
|
+ <el-row>
|
|
128
|
+ <el-col :span="24" v-if="form.formItem[0].project_id == 14">
|
|
129
|
+ <el-form-item label="传染病周期提醒: ">
|
|
130
|
+ <el-radio-group v-model="form.remind_cycle">
|
|
131
|
+ <el-radio :label="1">一月一次</el-radio>
|
|
132
|
+ <el-radio :label="2">两月一次</el-radio>
|
|
133
|
+ <el-radio :label="3">三月一次</el-radio>
|
|
134
|
+ <el-radio :label="4">半年一次</el-radio>
|
|
135
|
+ <el-radio :label="5">一年一次</el-radio>
|
|
136
|
+ </el-radio-group>
|
|
137
|
+ </el-form-item>
|
|
138
|
+ </el-col>
|
|
139
|
+
|
|
140
|
+ <el-col :span="7">
|
|
141
|
+ <el-form-item
|
|
142
|
+ label="检验日期"
|
|
143
|
+ prop="inspect_date"
|
|
144
|
+ :rules="[
|
|
145
|
+ { required: true, message: '请输入检验日期', trigger: 'blur' }
|
|
146
|
+ ]"
|
|
147
|
+ >
|
|
148
|
+ <el-date-picker
|
|
149
|
+ style="width:95%"
|
|
150
|
+ v-model="form.inspect_date"
|
|
151
|
+ type="datetime"
|
|
152
|
+ value-format="yyyy-MM-dd HH:mm"
|
|
153
|
+ format="yyyy-MM-dd HH:mm"
|
|
154
|
+ placeholder="选择日期"
|
|
155
|
+ >
|
|
156
|
+ </el-date-picker>
|
|
157
|
+ </el-form-item>
|
|
158
|
+ </el-col>
|
|
159
|
+ <el-col :span="1"> </el-col>
|
|
160
|
+
|
|
161
|
+ <template v-for="(item, index) in form.formItem">
|
|
162
|
+ <el-col :span="7" :key="index">
|
|
163
|
+ <el-form-item
|
|
164
|
+ :label="item.item_name"
|
|
165
|
+ v-if="item.range_type == 1"
|
|
166
|
+ :key="item.item_id"
|
|
167
|
+ :prop="'formItem.' + index + '.value'"
|
|
168
|
+ >
|
|
169
|
+ <el-input
|
|
170
|
+ placeholder="请填入"
|
|
171
|
+ v-model="item.value"
|
|
172
|
+ style="width:95%"
|
|
173
|
+ type="number"
|
|
174
|
+ >
|
|
175
|
+ <template slot="append">{{ item.unit }}</template>
|
|
176
|
+ </el-input>
|
|
177
|
+ </el-form-item>
|
|
178
|
+ <el-form-item
|
|
179
|
+ :label="item.item_name"
|
|
180
|
+ v-else
|
|
181
|
+ :key="item.item_id"
|
|
182
|
+ :prop="'formItem.' + index + '.value'"
|
|
183
|
+ >
|
|
184
|
+ <el-select
|
|
185
|
+ v-model="item.value"
|
|
186
|
+ placeholder="请选择"
|
|
187
|
+ style="width:95%"
|
|
188
|
+ >
|
|
189
|
+ <el-option
|
|
190
|
+ v-for="(optionItem, oidex) in item.select_options"
|
|
191
|
+ :key="oidex"
|
|
192
|
+ :label="optionItem"
|
|
193
|
+ :value="optionItem"
|
|
194
|
+ >
|
|
195
|
+ </el-option>
|
|
196
|
+ </el-select>
|
|
197
|
+ </el-form-item>
|
|
198
|
+ </el-col>
|
|
199
|
+ <el-col :span="1" :key="'form-col' + index"> </el-col>
|
|
200
|
+ </template>
|
|
201
|
+ </el-row>
|
|
202
|
+ </el-form>
|
|
203
|
+ <div slot="footer" class="dialog-footer">
|
|
204
|
+ <el-button @click="dialogFormVisible = false">取 消</el-button>
|
|
205
|
+ <el-button
|
|
206
|
+ type="primary"
|
|
207
|
+ v-if="form.method == 'add'"
|
|
208
|
+ @click="submitNew('form')"
|
|
209
|
+ >保 存</el-button
|
|
210
|
+ >
|
|
211
|
+ <el-button type="primary" v-else @click="submitEdit('form')"
|
|
212
|
+ >保 存</el-button
|
|
213
|
+ >
|
|
214
|
+ </div>
|
|
215
|
+ </el-dialog>
|
|
216
|
+ </div>
|
|
217
|
+</template>
|
|
218
|
+
|
|
219
|
+<script>
|
|
220
|
+import PatientSidebar from './components/PatientSidebar'
|
|
221
|
+import {
|
|
222
|
+ fetchInspectionReference,
|
|
223
|
+ CreatePatientInspection,
|
|
224
|
+ fetchPatientInspections,
|
|
225
|
+ EditPatientInspection,
|
|
226
|
+ DeletePatientInspection
|
|
227
|
+} from '@/api/inspection'
|
|
228
|
+import { uParseTime, isPositiveNumber } from '@/utils/tools'
|
|
229
|
+
|
|
230
|
+export default {
|
|
231
|
+ name: 'Inspection',
|
|
232
|
+ components: { PatientSidebar },
|
|
233
|
+ data() {
|
|
234
|
+ return {
|
|
235
|
+ total: 0,
|
|
236
|
+ pageLoading: true,
|
|
237
|
+ itemLoading: false,
|
|
238
|
+ formLoading: false,
|
|
239
|
+ itemDate: '',
|
|
240
|
+ patientID: 0,
|
|
241
|
+ panelClass: 'patient-app-container',
|
|
242
|
+ patientInfo: {
|
|
243
|
+ id: 0
|
|
244
|
+ },
|
|
245
|
+ itemName: '请选择项目',
|
|
246
|
+ formTitle: '',
|
|
247
|
+ dialogFormVisible: false,
|
|
248
|
+ patient_info: null,
|
|
249
|
+ form: {
|
|
250
|
+ remind_cycle: '',
|
|
251
|
+ method: 'add',
|
|
252
|
+ project_id: 0,
|
|
253
|
+ inspect_date: '',
|
|
254
|
+ old_inspect_date: '',
|
|
255
|
+ formItem: [{ id: 0, value: '' }]
|
|
256
|
+ },
|
|
257
|
+ formItem: [],
|
|
258
|
+ items: [],
|
|
259
|
+ inspections: [],
|
|
260
|
+ inspectionsMap: {},
|
|
261
|
+ projects: [],
|
|
262
|
+ project: null,
|
|
263
|
+ queryParams: {
|
|
264
|
+ patient: 0,
|
|
265
|
+ project_id: 0,
|
|
266
|
+ page: 1
|
|
267
|
+ }
|
|
268
|
+ }
|
|
269
|
+ },
|
|
270
|
+ methods: {
|
|
271
|
+ deleteInspection() {
|
|
272
|
+ if (this.project == null || this.itemDate == '') {
|
|
273
|
+ this.$message.error('请先选择删除删除的记录')
|
|
274
|
+ return false
|
|
275
|
+ }
|
|
276
|
+
|
|
277
|
+ this.$confirm('确认删除此记录?', '删除', {
|
|
278
|
+ confirmButtonText: '确定',
|
|
279
|
+ cancelButtonText: '取消',
|
|
280
|
+ type: 'warning'
|
|
281
|
+ })
|
|
282
|
+ .then(() => {
|
|
283
|
+ var params = {
|
|
284
|
+ patient: this.patientID,
|
|
285
|
+ date: this.itemDate,
|
|
286
|
+ project_id: this.project.project_id
|
|
287
|
+ }
|
|
288
|
+ DeletePatientInspection(params).then(response => {
|
|
289
|
+ if (response.data.state == 0) {
|
|
290
|
+ this.$message.error(response.data.msg)
|
|
291
|
+ return false
|
|
292
|
+ } else {
|
|
293
|
+ this.$notify({
|
|
294
|
+ title: '成功',
|
|
295
|
+ message: '删除成功',
|
|
296
|
+ type: 'success',
|
|
297
|
+ duration: 2000
|
|
298
|
+ })
|
|
299
|
+
|
|
300
|
+ for (var index in this.projects) {
|
|
301
|
+ if (this.projects[index].project_id == params.project_id) {
|
|
302
|
+ this.projects[index].count--
|
|
303
|
+ break
|
|
304
|
+ }
|
|
305
|
+ }
|
|
306
|
+ this.total -= 1
|
|
307
|
+ this.itemDate = ''
|
|
308
|
+ this.items = []
|
|
309
|
+ if (this.total > 0) {
|
|
310
|
+ this.queryParams.page = 1
|
|
311
|
+ this.fetchPatientInspections(this.queryParams)
|
|
312
|
+ }
|
|
313
|
+ }
|
|
314
|
+ })
|
|
315
|
+ })
|
|
316
|
+ .catch(() => {})
|
|
317
|
+ },
|
|
318
|
+ openEdit() {
|
|
319
|
+ if (this.project == null) {
|
|
320
|
+ this.$message.error('请先选择项目')
|
|
321
|
+ return false
|
|
322
|
+ }
|
|
323
|
+
|
|
324
|
+ this.form.method = 'edit'
|
|
325
|
+ this.formTitle = '修改' + this.project.project_name
|
|
326
|
+ this.form.project_id = this.project.project_id
|
|
327
|
+ this.form.inspect_date = this.itemDate
|
|
328
|
+ this.form.old_inspect_date = this.itemDate
|
|
329
|
+ this.form.remind_cycle = this.patient_info.remind_cycle
|
|
330
|
+ console.log(this.form.remind_cycle)
|
|
331
|
+
|
|
332
|
+ this.form.formItem = []
|
|
333
|
+ for (var index in this.project.inspection_reference) {
|
|
334
|
+ this.form.formItem.push({
|
|
335
|
+ id: this.project.inspection_reference[index].id in this.inspectionsMap ? this.inspectionsMap[this.project.inspection_reference[index].id].id : 0,
|
|
336
|
+ project_id: this.project.inspection_reference[index].project_id,
|
|
337
|
+ project_name: this.project.inspection_reference[index].project_name,
|
|
338
|
+ item_id: this.project.inspection_reference[index].id,
|
|
339
|
+ item: this.project.inspection_reference[index].item,
|
|
340
|
+ item_name: this.project.inspection_reference[index].item_name,
|
|
341
|
+ range_type: this.project.inspection_reference[index].range_type,
|
|
342
|
+ value: this.project.inspection_reference[index].id in this.inspectionsMap ? this.inspectionsMap[this.project.inspection_reference[index].id].inspect_value : '',
|
|
343
|
+ select_options: this.project.inspection_reference[index].range_options.split(','),
|
|
344
|
+ unit: this.project.inspection_reference[index].unit
|
|
345
|
+ })
|
|
346
|
+ }
|
|
347
|
+ console.log(this.form.formItem)
|
|
348
|
+ this.dialogFormVisible = true
|
|
349
|
+ },
|
|
350
|
+ openNew() {
|
|
351
|
+ if (this.project == null) {
|
|
352
|
+ this.$message.error('请先选择项目')
|
|
353
|
+ return false
|
|
354
|
+ }
|
|
355
|
+ this.form.method = 'add'
|
|
356
|
+ this.formTitle = '新增' + this.project.project_name
|
|
357
|
+ this.form.project_id = this.project.project_id
|
|
358
|
+ this.form.remind_cycle = this.patient_info.remind_cycle
|
|
359
|
+ var today = new Date()
|
|
360
|
+ this.form.inspect_date = uParseTime(today, '{y}-{m}-{d} {h}:{i}')
|
|
361
|
+ this.form.formItem = []
|
|
362
|
+ for (var index in this.project.inspection_reference) {
|
|
363
|
+ // var formItem = this.project.inspection_reference[index];
|
|
364
|
+ // formItem["value"] = '';
|
|
365
|
+ // if (formItem.range_type==2) {
|
|
366
|
+ // formItem["select_options"] = formItem.range_options.split(",");
|
|
367
|
+ // }
|
|
368
|
+ this.form.formItem.push({
|
|
369
|
+ id: 0,
|
|
370
|
+ project_id: this.project.inspection_reference[index].project_id,
|
|
371
|
+ project_name: this.project.inspection_reference[index].project_name,
|
|
372
|
+ item_id: this.project.inspection_reference[index].id,
|
|
373
|
+ item: this.project.inspection_reference[index].item,
|
|
374
|
+ item_name: this.project.inspection_reference[index].item_name,
|
|
375
|
+ range_type: this.project.inspection_reference[index].range_type,
|
|
376
|
+ value: '',
|
|
377
|
+ select_options: this.project.inspection_reference[
|
|
378
|
+ index
|
|
379
|
+ ].range_options.split(','),
|
|
380
|
+ unit: this.project.inspection_reference[index].unit
|
|
381
|
+ })
|
|
382
|
+ }
|
|
383
|
+
|
|
384
|
+ this.dialogFormVisible = true
|
|
385
|
+ },
|
|
386
|
+ submitEdit(formName) {
|
|
387
|
+ this.$refs[formName].validate(valid => {
|
|
388
|
+ if (valid) {
|
|
389
|
+ this.formLoading = true
|
|
390
|
+ if (this.form.formItem.length == 0) {
|
|
391
|
+ this.$message.error('未填写项目')
|
|
392
|
+ return false
|
|
393
|
+ }
|
|
394
|
+ for (var index in this.form.formItem) {
|
|
395
|
+ this.form.formItem[index].value = '' + this.form.formItem[index].value
|
|
396
|
+ }
|
|
397
|
+
|
|
398
|
+ EditPatientInspection(this.patientID, this.form, this.form.remind_cycle, this.form.inspect_date, this.form.project_id).then(response => {
|
|
399
|
+ if (response.data.state == 1) {
|
|
400
|
+ this.$notify({
|
|
401
|
+ title: '成功',
|
|
402
|
+ message: '修改成功',
|
|
403
|
+ type: 'success',
|
|
404
|
+ duration: 2000
|
|
405
|
+ })
|
|
406
|
+ this.patient_info.remind_cycle =
|
|
407
|
+ response.data.data.remind_cycle
|
|
408
|
+ this.itemDate = this.form.inspect_date
|
|
409
|
+ this.items = []
|
|
410
|
+ var inspections = response.data.data.inspections
|
|
411
|
+ this.inspections = response.data.data.inspections
|
|
412
|
+ if (inspections == null) {
|
|
413
|
+ this.inspections = []
|
|
414
|
+ return false
|
|
415
|
+ }
|
|
416
|
+ var inspectionsMap = {}
|
|
417
|
+ this.inspectionsMap = {}
|
|
418
|
+ for (var index in inspections) {
|
|
419
|
+ inspectionsMap[inspections[index].item_id] =
|
|
420
|
+ inspections[index]
|
|
421
|
+ this.inspectionsMap[inspections[index].item_id] =
|
|
422
|
+ inspections[index]
|
|
423
|
+ }
|
|
424
|
+ var items = this.project.inspection_reference
|
|
425
|
+ for (var index in items) {
|
|
426
|
+ if (items[index].id in inspectionsMap) {
|
|
427
|
+ var item = {}
|
|
428
|
+ for (var key in items[index]) {
|
|
429
|
+ item[key] = items[index][key]
|
|
430
|
+ }
|
|
431
|
+ item.value = inspectionsMap[items[index].id].inspect_value
|
|
432
|
+ item.value_direction = ''
|
|
433
|
+ if (item.range_type == 1) {
|
|
434
|
+ var value = parseFloat(item.value)
|
|
435
|
+ var range_min = parseFloat(item.range_min)
|
|
436
|
+ var range_max = parseFloat(item.range_max)
|
|
437
|
+ if (value < range_min) {
|
|
438
|
+ item.value_direction = '↓'
|
|
439
|
+ } else if (value > range_max) {
|
|
440
|
+ item.value_direction = '↑'
|
|
441
|
+ }
|
|
442
|
+ }
|
|
443
|
+ this.items.push(item)
|
|
444
|
+ }
|
|
445
|
+ }
|
|
446
|
+
|
|
447
|
+ this.resetForm(formName)
|
|
448
|
+ this.dialogFormVisible = false
|
|
449
|
+ } else {
|
|
450
|
+ this.$message.error(response.data.msg)
|
|
451
|
+ return false
|
|
452
|
+ }
|
|
453
|
+ })
|
|
454
|
+ .catch(v => {
|
|
455
|
+ this.$message.error(v)
|
|
456
|
+ return false
|
|
457
|
+ })
|
|
458
|
+ this.formLoading = false
|
|
459
|
+ return false
|
|
460
|
+ } else {
|
|
461
|
+ return false
|
|
462
|
+ }
|
|
463
|
+ })
|
|
464
|
+ },
|
|
465
|
+ submitNew(formName) {
|
|
466
|
+ this.$refs[formName].validate(valid => {
|
|
467
|
+ if (valid) {
|
|
468
|
+ this.formLoading = true
|
|
469
|
+ if (this.form.formItem.length == 0) {
|
|
470
|
+ this.$message.error('未填写项目')
|
|
471
|
+ return false
|
|
472
|
+ }
|
|
473
|
+ for (var index in this.form.formItem) {
|
|
474
|
+ this.form.formItem[index].value =
|
|
475
|
+ '' + this.form.formItem[index].value
|
|
476
|
+ }
|
|
477
|
+ CreatePatientInspection(
|
|
478
|
+ this.patientID,
|
|
479
|
+ this.form,
|
|
480
|
+ this.form.remind_cycle
|
|
481
|
+ )
|
|
482
|
+ .then(response => {
|
|
483
|
+ if (response.data.state == 1) {
|
|
484
|
+ this.$notify({
|
|
485
|
+ title: '成功',
|
|
486
|
+ message: '新增成功',
|
|
487
|
+ type: 'success',
|
|
488
|
+ duration: 2000
|
|
489
|
+ })
|
|
490
|
+ // this.form.remind_reycle = response.data.data.remind_reycc
|
|
491
|
+ this.patient_info.remind_cycle =
|
|
492
|
+ response.data.data.remind_cycle
|
|
493
|
+ console.log(this.patient_info.remind_cycle)
|
|
494
|
+
|
|
495
|
+ this.itemDate = this.form.inspect_date
|
|
496
|
+ this.items = []
|
|
497
|
+ for (var index in this.projects) {
|
|
498
|
+ if (this.projects[index].project_id == this.form.project_id) {
|
|
499
|
+ this.projects[index].count++
|
|
500
|
+ break
|
|
501
|
+ }
|
|
502
|
+ }
|
|
503
|
+ this.total += 1
|
|
504
|
+ var inspections = response.data.data.inspections
|
|
505
|
+ this.inspections = response.data.data.inspections
|
|
506
|
+ if (inspections == null) {
|
|
507
|
+ this.inspections = []
|
|
508
|
+ return false
|
|
509
|
+ }
|
|
510
|
+ var inspectionsMap = {}
|
|
511
|
+ this.inspectionsMap = {}
|
|
512
|
+ for (var index in inspections) {
|
|
513
|
+ inspectionsMap[inspections[index].item_id] =
|
|
514
|
+ inspections[index]
|
|
515
|
+ this.inspectionsMap[inspections[index].item_id] =
|
|
516
|
+ inspections[index]
|
|
517
|
+ }
|
|
518
|
+ var items = this.project.inspection_reference
|
|
519
|
+ for (var index in items) {
|
|
520
|
+ if (items[index].id in inspectionsMap) {
|
|
521
|
+ var item = {}
|
|
522
|
+ for (var key in items[index]) {
|
|
523
|
+ item[key] = items[index][key]
|
|
524
|
+ }
|
|
525
|
+ item.value = inspectionsMap[items[index].id].inspect_value
|
|
526
|
+ item.value_direction = ''
|
|
527
|
+ if (item.range_type == 1) {
|
|
528
|
+ var value = parseFloat(item.value)
|
|
529
|
+ var range_min = parseFloat(item.range_min)
|
|
530
|
+ var range_max = parseFloat(item.range_max)
|
|
531
|
+ if (value < range_min) {
|
|
532
|
+ item.value_direction = '↓'
|
|
533
|
+ } else if (value > range_max) {
|
|
534
|
+ item.value_direction = '↑'
|
|
535
|
+ }
|
|
536
|
+ }
|
|
537
|
+ this.items.push(item)
|
|
538
|
+ }
|
|
539
|
+ }
|
|
540
|
+
|
|
541
|
+ this.resetForm(formName)
|
|
542
|
+ this.dialogFormVisible = false
|
|
543
|
+
|
|
544
|
+ this.queryParams.patient = this.patientID
|
|
545
|
+ this.queryParams.project_id = this.project.project_id
|
|
546
|
+ this.queryParams.page = 1
|
|
547
|
+ this.total = 0
|
|
548
|
+ this.fetchPatientInspections(this.queryParams)
|
|
549
|
+ } else {
|
|
550
|
+ this.$message.error(response.data.msg)
|
|
551
|
+ return false
|
|
552
|
+ }
|
|
553
|
+ })
|
|
554
|
+ .catch(v => {
|
|
555
|
+ this.$message.error(v)
|
|
556
|
+ return false
|
|
557
|
+ })
|
|
558
|
+ this.formLoading = false
|
|
559
|
+ return false
|
|
560
|
+ } else {
|
|
561
|
+ return false
|
|
562
|
+ }
|
|
563
|
+ })
|
|
564
|
+ },
|
|
565
|
+ fetchInspectionReference() {
|
|
566
|
+ fetchInspectionReference(this.patientID)
|
|
567
|
+ .then(response => {
|
|
568
|
+ if (response.data.state == 1) {
|
|
569
|
+ var reference = response.data.data.reference
|
|
570
|
+ console.log("reference22222",reference)
|
|
571
|
+
|
|
572
|
+ var patient_info = response.data.data.patient_info
|
|
573
|
+ this.projects = reference
|
|
574
|
+ this.patient_info = patient_info
|
|
575
|
+ var project_id = 0
|
|
576
|
+ for(let i=0;i<reference.length;i++){
|
|
577
|
+ if(reference[i].project_name == "传染病检查"){
|
|
578
|
+ project_id = reference[i].project_id
|
|
579
|
+ this.project = reference[i]
|
|
580
|
+ this.itemLoading = true
|
|
581
|
+ this.items = reference[i].inspection_reference
|
|
582
|
+ this.itemName = reference[i].project_name
|
|
583
|
+ }
|
|
584
|
+ }
|
|
585
|
+ this.queryParams.patient = this.patientID
|
|
586
|
+ this.queryParams.project_id = project_id
|
|
587
|
+ this.queryParams.page = 1
|
|
588
|
+ this.total = 0
|
|
589
|
+ console.log("pras2222222",this.queryParams)
|
|
590
|
+ this.fetchPatientInspections(this.queryParams)
|
|
591
|
+ this.pageLoading = false
|
|
592
|
+ this.form.remind_cycle = this.patient_info.remind_cycle
|
|
593
|
+ } else {
|
|
594
|
+ this.$message.error(response.data.msg)
|
|
595
|
+ return false
|
|
596
|
+ }
|
|
597
|
+ })
|
|
598
|
+ .catch(v => {})
|
|
599
|
+ },
|
|
600
|
+ setCurrent(row) {
|
|
601
|
+ this.$refs.singleTable.setCurrentRow(row)
|
|
602
|
+ },
|
|
603
|
+ resetForm(formName) {
|
|
604
|
+ this.$refs[formName].resetFields()
|
|
605
|
+ },
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+ handleCurrentChangePage(val) {
|
|
609
|
+ this.itemLoading = true
|
|
610
|
+ this.queryParams.page = val
|
|
611
|
+ this.fetchPatientInspections(this.queryParams)
|
|
612
|
+ },
|
|
613
|
+ fetchPatientInspections(params) {
|
|
614
|
+ console.log("重复了吗",params)
|
|
615
|
+ this.items = []
|
|
616
|
+ fetchPatientInspections(params)
|
|
617
|
+ .then(response => {
|
|
618
|
+ if (response.data.state == 1) {
|
|
619
|
+ var inspections = response.data.data.inspections
|
|
620
|
+ console.log("inspectons",inspections)
|
|
621
|
+ this.total = response.data.data.total
|
|
622
|
+ this.itemDate = response.data.data.date
|
|
623
|
+ this.inspections = response.data.data.inspections
|
|
624
|
+ if (inspections == null) {
|
|
625
|
+ this.inspections = []
|
|
626
|
+ return false
|
|
627
|
+ }
|
|
628
|
+ var inspectionsMap = {}
|
|
629
|
+ this.inspectionsMap = {}
|
|
630
|
+ for (var index in inspections) {
|
|
631
|
+ inspectionsMap[inspections[index].item_id] = inspections[index]
|
|
632
|
+ this.inspectionsMap[inspections[index].item_id] = inspections[index]
|
|
633
|
+ }
|
|
634
|
+ var items = this.project.inspection_reference
|
|
635
|
+ console.log("items222222222",items)
|
|
636
|
+ for (var index in items) {
|
|
637
|
+ if (items[index].id in inspectionsMap || items[index].item_id in inspectionsMap) {
|
|
638
|
+ var item = {}
|
|
639
|
+ for (var key in items[index]) {
|
|
640
|
+ item[key] = items[index][key]
|
|
641
|
+ }
|
|
642
|
+ if (item.item_id > 0) {
|
|
643
|
+ if (inspectionsMap[items[index].item_id] == undefined) {
|
|
644
|
+ item.value = inspectionsMap[items[index].id].inspect_value
|
|
645
|
+ } else {
|
|
646
|
+ item.value = inspectionsMap[items[index].item_id].inspect_value
|
|
647
|
+ }
|
|
648
|
+ } else {
|
|
649
|
+ item.value = inspectionsMap[items[index].id].inspect_value
|
|
650
|
+ }
|
|
651
|
+ item.value_direction = ''
|
|
652
|
+ if (item.range_type == 1) {
|
|
653
|
+ var value = parseFloat(item.value)
|
|
654
|
+ var range_min = parseFloat(item.range_min)
|
|
655
|
+ var range_max = parseFloat(item.range_max)
|
|
656
|
+ if (value < range_min) {
|
|
657
|
+ item.value_direction = '↓'
|
|
658
|
+ } else if (value > range_max) {
|
|
659
|
+ item.value_direction = '↑'
|
|
660
|
+ }
|
|
661
|
+ }
|
|
662
|
+ this.items.push(item)
|
|
663
|
+ }
|
|
664
|
+ }
|
|
665
|
+ console.log(this.items)
|
|
666
|
+ }
|
|
667
|
+ })
|
|
668
|
+ .catch(v => {})
|
|
669
|
+ setTimeout(() => {
|
|
670
|
+ this.itemLoading = false
|
|
671
|
+ }, 1000)
|
|
672
|
+ }
|
|
673
|
+ },
|
|
674
|
+ created() {
|
|
675
|
+ const id = this.$route.params && this.$route.params.id
|
|
676
|
+ console.log('id是设么', id)
|
|
677
|
+ this.patientID = parseInt(id)
|
|
678
|
+ if (isNaN(this.patientID) || this.patientID <= 0) {
|
|
679
|
+ this.$notify.error({
|
|
680
|
+ title: '错误',
|
|
681
|
+ message: '无效的id'
|
|
682
|
+ })
|
|
683
|
+ this.$router.push('/patients/patients')
|
|
684
|
+ }
|
|
685
|
+
|
|
686
|
+ this.fetchInspectionReference()
|
|
687
|
+ }
|
|
688
|
+}
|
|
689
|
+</script>
|
|
690
|
+
|
|
691
|
+<style>
|
|
692
|
+#oictable ::-webkit-scrollbar {
|
|
693
|
+ height: 15px;
|
|
694
|
+}
|
|
695
|
+</style>
|
|
696
|
+
|
|
697
|
+<style>
|
|
698
|
+#user-inspection-order td {
|
|
699
|
+ border-bottom: 0px !important;
|
|
700
|
+ border-right: 0px !important;
|
|
701
|
+}
|
|
702
|
+#user-inspection-order th {
|
|
703
|
+ border-right: 0px !important;
|
|
704
|
+}
|
|
705
|
+#user-inspection-form .el-form-item__content {
|
|
706
|
+ line-height: 0 !important;
|
|
707
|
+}
|
|
708
|
+.el-table td,
|
|
709
|
+.el-table th.is-leaf,
|
|
710
|
+.el-table--border,
|
|
711
|
+.el-table--group {
|
|
712
|
+ border-color: #d0d3da;
|
|
713
|
+}
|
|
714
|
+.el-table--border::after,
|
|
715
|
+.el-table--group::after,
|
|
716
|
+.el-table::before {
|
|
717
|
+ background-color: #d0d3da;
|
|
718
|
+}
|
|
719
|
+</style>
|