|
@@ -178,11 +178,10 @@
|
178
|
178
|
<el-date-picker
|
179
|
179
|
style="width:95%"
|
180
|
180
|
v-model="form.inspect_date"
|
181
|
|
- type="date"
|
182
|
|
- value-format="yyyy-MM-dd"
|
183
|
|
- format="yyyy-MM-dd"
|
|
181
|
+ type="datetime"
|
|
182
|
+ value-format="yyyy-MM-dd HH:mm"
|
|
183
|
+ format="yyyy-MM-dd HH:mm"
|
184
|
184
|
placeholder="选择日期"
|
185
|
|
- :readonly="form.method == 'add' ? false : true"
|
186
|
185
|
>
|
187
|
186
|
</el-date-picker>
|
188
|
187
|
</el-form-item>
|
|
@@ -248,18 +247,18 @@
|
248
|
247
|
</template>
|
249
|
248
|
|
250
|
249
|
<script>
|
251
|
|
-import PatientSidebar from "./components/PatientSidebar";
|
|
250
|
+import PatientSidebar from './components/PatientSidebar'
|
252
|
251
|
import {
|
253
|
252
|
fetchInspectionReference,
|
254
|
253
|
CreatePatientInspection,
|
255
|
254
|
fetchPatientInspections,
|
256
|
255
|
EditPatientInspection,
|
257
|
256
|
DeletePatientInspection
|
258
|
|
-} from "@/api/inspection";
|
259
|
|
-import { uParseTime, isPositiveNumber } from "@/utils/tools";
|
|
257
|
+} from '@/api/inspection'
|
|
258
|
+import { uParseTime, isPositiveNumber } from '@/utils/tools'
|
260
|
259
|
|
261
|
260
|
export default {
|
262
|
|
- name: "Inspection",
|
|
261
|
+ name: 'Inspection',
|
263
|
262
|
components: { PatientSidebar },
|
264
|
263
|
data() {
|
265
|
264
|
return {
|
|
@@ -267,22 +266,23 @@ export default {
|
267
|
266
|
pageLoading: true,
|
268
|
267
|
itemLoading: false,
|
269
|
268
|
formLoading: false,
|
270
|
|
- itemDate: "",
|
|
269
|
+ itemDate: '',
|
271
|
270
|
patientID: 0,
|
272
|
|
- panelClass: "patient-app-container",
|
|
271
|
+ panelClass: 'patient-app-container',
|
273
|
272
|
patientInfo: {
|
274
|
273
|
id: 0
|
275
|
274
|
},
|
276
|
|
- itemName: "请选择项目",
|
277
|
|
- formTitle: "",
|
|
275
|
+ itemName: '请选择项目',
|
|
276
|
+ formTitle: '',
|
278
|
277
|
dialogFormVisible: false,
|
279
|
278
|
patient_info: null,
|
280
|
279
|
form: {
|
281
|
|
- remind_cycle: "",
|
282
|
|
- method: "add",
|
|
280
|
+ remind_cycle: '',
|
|
281
|
+ method: 'add',
|
283
|
282
|
project_id: 0,
|
284
|
|
- inspect_date: "",
|
285
|
|
- formItem: [{ id: 0, value: "" }]
|
|
283
|
+ inspect_date: '',
|
|
284
|
+ old_inspect_date: '',
|
|
285
|
+ formItem: [{ id: 0, value: '' }]
|
286
|
286
|
},
|
287
|
287
|
formItem: [],
|
288
|
288
|
items: [],
|
|
@@ -295,112 +295,100 @@ export default {
|
295
|
295
|
project_id: 0,
|
296
|
296
|
page: 1
|
297
|
297
|
}
|
298
|
|
- };
|
|
298
|
+ }
|
299
|
299
|
},
|
300
|
300
|
methods: {
|
301
|
301
|
deleteInspection() {
|
302
|
|
- if (this.project == null || this.itemDate == "") {
|
303
|
|
- this.$message.error("请先选择删除删除的记录");
|
304
|
|
- return false;
|
|
302
|
+ if (this.project == null || this.itemDate == '') {
|
|
303
|
+ this.$message.error('请先选择删除删除的记录')
|
|
304
|
+ return false
|
305
|
305
|
}
|
306
|
306
|
|
307
|
|
- this.$confirm("确认删除此记录?", "删除", {
|
308
|
|
- confirmButtonText: "确定",
|
309
|
|
- cancelButtonText: "取消",
|
310
|
|
- type: "warning"
|
|
307
|
+ this.$confirm('确认删除此记录?', '删除', {
|
|
308
|
+ confirmButtonText: '确定',
|
|
309
|
+ cancelButtonText: '取消',
|
|
310
|
+ type: 'warning'
|
311
|
311
|
})
|
312
|
312
|
.then(() => {
|
313
|
313
|
var params = {
|
314
|
314
|
patient: this.patientID,
|
315
|
315
|
date: this.itemDate,
|
316
|
316
|
project_id: this.project.project_id
|
317
|
|
- };
|
|
317
|
+ }
|
318
|
318
|
DeletePatientInspection(params).then(response => {
|
319
|
319
|
if (response.data.state == 0) {
|
320
|
|
- this.$message.error(response.data.msg);
|
321
|
|
- return false;
|
|
320
|
+ this.$message.error(response.data.msg)
|
|
321
|
+ return false
|
322
|
322
|
} else {
|
323
|
323
|
this.$notify({
|
324
|
|
- title: "成功",
|
325
|
|
- message: "删除成功",
|
326
|
|
- type: "success",
|
|
324
|
+ title: '成功',
|
|
325
|
+ message: '删除成功',
|
|
326
|
+ type: 'success',
|
327
|
327
|
duration: 2000
|
328
|
|
- });
|
|
328
|
+ })
|
329
|
329
|
|
330
|
330
|
for (var index in this.projects) {
|
331
|
331
|
if (this.projects[index].project_id == params.project_id) {
|
332
|
|
- this.projects[index].count--;
|
333
|
|
- break;
|
|
332
|
+ this.projects[index].count--
|
|
333
|
+ break
|
334
|
334
|
}
|
335
|
335
|
}
|
336
|
|
- this.total -= 1;
|
337
|
|
- this.itemDate = "";
|
338
|
|
- this.items = [];
|
|
336
|
+ this.total -= 1
|
|
337
|
+ this.itemDate = ''
|
|
338
|
+ this.items = []
|
339
|
339
|
if (this.total > 0) {
|
340
|
|
- this.queryParams.page = 1;
|
341
|
|
- this.fetchPatientInspections(this.queryParams);
|
|
340
|
+ this.queryParams.page = 1
|
|
341
|
+ this.fetchPatientInspections(this.queryParams)
|
342
|
342
|
}
|
343
|
343
|
}
|
344
|
|
- });
|
|
344
|
+ })
|
345
|
345
|
})
|
346
|
|
- .catch(() => {});
|
|
346
|
+ .catch(() => {})
|
347
|
347
|
},
|
348
|
348
|
openEdit() {
|
349
|
349
|
if (this.project == null) {
|
350
|
|
- this.$message.error("请先选择项目");
|
351
|
|
- return false;
|
|
350
|
+ this.$message.error('请先选择项目')
|
|
351
|
+ return false
|
352
|
352
|
}
|
353
|
353
|
|
354
|
|
- this.form.method = "edit";
|
355
|
|
- this.formTitle = "修改" + this.project.project_name;
|
356
|
|
- this.form.project_id = this.project.project_id;
|
357
|
|
- this.form.inspect_date = this.itemDate;
|
358
|
|
- this.form.remind_cycle = this.patient_info.remind_cycle;
|
359
|
|
- console.log(this.form.remind_cycle);
|
|
354
|
+ this.form.method = 'edit'
|
|
355
|
+ this.formTitle = '修改' + this.project.project_name
|
|
356
|
+ this.form.project_id = this.project.project_id
|
|
357
|
+ this.form.inspect_date = this.itemDate
|
|
358
|
+ this.form.old_inspect_date = this.itemDate
|
|
359
|
+ this.form.remind_cycle = this.patient_info.remind_cycle
|
|
360
|
+ console.log(this.form.remind_cycle)
|
360
|
361
|
|
361
|
|
- this.form.formItem = [];
|
|
362
|
+ this.form.formItem = []
|
362
|
363
|
for (var index in this.project.inspection_reference) {
|
363
|
364
|
this.form.formItem.push({
|
364
|
|
- id:
|
365
|
|
- this.project.inspection_reference[index].id in this.inspectionsMap
|
366
|
|
- ? this.inspectionsMap[this.project.inspection_reference[index].id]
|
367
|
|
- .id
|
368
|
|
- : 0,
|
|
365
|
+ id: this.project.inspection_reference[index].id in this.inspectionsMap ? this.inspectionsMap[this.project.inspection_reference[index].id].id : 0,
|
369
|
366
|
project_id: this.project.inspection_reference[index].project_id,
|
370
|
367
|
project_name: this.project.inspection_reference[index].project_name,
|
371
|
368
|
item_id: this.project.inspection_reference[index].id,
|
372
|
369
|
item: this.project.inspection_reference[index].item,
|
373
|
370
|
item_name: this.project.inspection_reference[index].item_name,
|
374
|
371
|
range_type: this.project.inspection_reference[index].range_type,
|
375
|
|
- value:
|
376
|
|
- this.project.inspection_reference[index].id in this.inspectionsMap
|
377
|
|
- ? this.inspectionsMap[this.project.inspection_reference[index].id]
|
378
|
|
- .inspect_value
|
379
|
|
- : "",
|
380
|
|
- select_options: this.project.inspection_reference[
|
381
|
|
- index
|
382
|
|
- ].range_options.split(","),
|
|
372
|
+ value: this.project.inspection_reference[index].id in this.inspectionsMap ? this.inspectionsMap[this.project.inspection_reference[index].id].inspect_value : '',
|
|
373
|
+ select_options: this.project.inspection_reference[index].range_options.split(','),
|
383
|
374
|
unit: this.project.inspection_reference[index].unit
|
384
|
|
- });
|
|
375
|
+ })
|
385
|
376
|
}
|
386
|
|
-
|
387
|
|
- console.log(this.form.formItem);
|
388
|
|
-
|
389
|
|
- this.dialogFormVisible = true;
|
|
377
|
+ console.log(this.form.formItem)
|
|
378
|
+ this.dialogFormVisible = true
|
390
|
379
|
},
|
391
|
380
|
openNew() {
|
392
|
381
|
if (this.project == null) {
|
393
|
|
- this.$message.error("请先选择项目");
|
394
|
|
- return false;
|
|
382
|
+ this.$message.error('请先选择项目')
|
|
383
|
+ return false
|
395
|
384
|
}
|
396
|
|
- this.form.method = "add";
|
397
|
|
- this.formTitle = "新增" + this.project.project_name;
|
398
|
|
- this.form.project_id = this.project.project_id;
|
399
|
|
- this.form.remind_cycle = this.patient_info.remind_cycle;
|
400
|
|
-
|
401
|
|
- var today = new Date();
|
402
|
|
- this.form.inspect_date = uParseTime(today, "{y}-{m}-{d}");
|
403
|
|
- this.form.formItem = [];
|
|
385
|
+ this.form.method = 'add'
|
|
386
|
+ this.formTitle = '新增' + this.project.project_name
|
|
387
|
+ this.form.project_id = this.project.project_id
|
|
388
|
+ this.form.remind_cycle = this.patient_info.remind_cycle
|
|
389
|
+ var today = new Date()
|
|
390
|
+ this.form.inspect_date = uParseTime(today, '{y}-{m}-{d} {h}:{i}')
|
|
391
|
+ this.form.formItem = []
|
404
|
392
|
for (var index in this.project.inspection_reference) {
|
405
|
393
|
// var formItem = this.project.inspection_reference[index];
|
406
|
394
|
// formItem["value"] = '';
|
|
@@ -415,114 +403,106 @@ export default {
|
415
|
403
|
item: this.project.inspection_reference[index].item,
|
416
|
404
|
item_name: this.project.inspection_reference[index].item_name,
|
417
|
405
|
range_type: this.project.inspection_reference[index].range_type,
|
418
|
|
- value: "",
|
|
406
|
+ value: '',
|
419
|
407
|
select_options: this.project.inspection_reference[
|
420
|
408
|
index
|
421
|
|
- ].range_options.split(","),
|
|
409
|
+ ].range_options.split(','),
|
422
|
410
|
unit: this.project.inspection_reference[index].unit
|
423
|
|
- });
|
|
411
|
+ })
|
424
|
412
|
}
|
425
|
413
|
|
426
|
|
- this.dialogFormVisible = true;
|
|
414
|
+ this.dialogFormVisible = true
|
427
|
415
|
},
|
428
|
416
|
submitEdit(formName) {
|
429
|
417
|
this.$refs[formName].validate(valid => {
|
430
|
418
|
if (valid) {
|
431
|
|
- this.formLoading = true;
|
|
419
|
+ this.formLoading = true
|
432
|
420
|
if (this.form.formItem.length == 0) {
|
433
|
|
- this.$message.error("未填写项目");
|
434
|
|
- return false;
|
|
421
|
+ this.$message.error('未填写项目')
|
|
422
|
+ return false
|
435
|
423
|
}
|
436
|
424
|
for (var index in this.form.formItem) {
|
437
|
|
- this.form.formItem[index].value =
|
438
|
|
- "" + this.form.formItem[index].value;
|
|
425
|
+ this.form.formItem[index].value = '' + this.form.formItem[index].value
|
439
|
426
|
}
|
440
|
427
|
|
441
|
|
- EditPatientInspection(
|
442
|
|
- this.patientID,
|
443
|
|
- this.form,
|
444
|
|
- this.form.remind_cycle,
|
445
|
|
- this.form.inspect_date,
|
446
|
|
- this.form.project_id
|
447
|
|
- )
|
448
|
|
- .then(response => {
|
449
|
|
- if (response.data.state == 1) {
|
450
|
|
- this.$notify({
|
451
|
|
- title: "成功",
|
452
|
|
- message: "修改成功",
|
453
|
|
- type: "success",
|
454
|
|
- duration: 2000
|
455
|
|
- });
|
456
|
|
- this.patient_info.remind_cycle =
|
457
|
|
- response.data.data.remind_cycle;
|
458
|
|
- this.itemDate = this.form.inspect_date;
|
459
|
|
- this.items = [];
|
460
|
|
- var inspections = response.data.data.inspections;
|
461
|
|
- this.inspections = response.data.data.inspections;
|
462
|
|
- if (inspections == null) {
|
463
|
|
- this.inspections = [];
|
464
|
|
- return false;
|
465
|
|
- }
|
466
|
|
- var inspectionsMap = {};
|
467
|
|
- this.inspectionsMap = {};
|
468
|
|
- for (var index in inspections) {
|
469
|
|
- inspectionsMap[inspections[index].item_id] =
|
470
|
|
- inspections[index];
|
471
|
|
- this.inspectionsMap[inspections[index].item_id] =
|
472
|
|
- inspections[index];
|
473
|
|
- }
|
474
|
|
- var items = this.project.inspection_reference;
|
475
|
|
- for (var index in items) {
|
476
|
|
- if (items[index].id in inspectionsMap) {
|
477
|
|
- var item = {};
|
478
|
|
- for (var key in items[index]) {
|
479
|
|
- item[key] = items[index][key];
|
480
|
|
- }
|
481
|
|
- item.value = inspectionsMap[items[index].id].inspect_value;
|
482
|
|
- item.value_direction = "";
|
483
|
|
- if (item.range_type == 1) {
|
484
|
|
- var value = parseFloat(item.value);
|
485
|
|
- var range_min = parseFloat(item.range_min);
|
486
|
|
- var range_max = parseFloat(item.range_max);
|
487
|
|
- if (value < range_min) {
|
488
|
|
- item.value_direction = "↓";
|
489
|
|
- } else if (value > range_max) {
|
490
|
|
- item.value_direction = "↑";
|
491
|
|
- }
|
|
428
|
+ EditPatientInspection(this.patientID, this.form, this.form.remind_cycle, this.form.inspect_date, this.form.project_id).then(response => {
|
|
429
|
+ if (response.data.state == 1) {
|
|
430
|
+ this.$notify({
|
|
431
|
+ title: '成功',
|
|
432
|
+ message: '修改成功',
|
|
433
|
+ type: 'success',
|
|
434
|
+ duration: 2000
|
|
435
|
+ })
|
|
436
|
+ this.patient_info.remind_cycle =
|
|
437
|
+ response.data.data.remind_cycle
|
|
438
|
+ this.itemDate = this.form.inspect_date
|
|
439
|
+ this.items = []
|
|
440
|
+ var inspections = response.data.data.inspections
|
|
441
|
+ this.inspections = response.data.data.inspections
|
|
442
|
+ if (inspections == null) {
|
|
443
|
+ this.inspections = []
|
|
444
|
+ return false
|
|
445
|
+ }
|
|
446
|
+ var inspectionsMap = {}
|
|
447
|
+ this.inspectionsMap = {}
|
|
448
|
+ for (var index in inspections) {
|
|
449
|
+ inspectionsMap[inspections[index].item_id] =
|
|
450
|
+ inspections[index]
|
|
451
|
+ this.inspectionsMap[inspections[index].item_id] =
|
|
452
|
+ inspections[index]
|
|
453
|
+ }
|
|
454
|
+ var items = this.project.inspection_reference
|
|
455
|
+ for (var index in items) {
|
|
456
|
+ if (items[index].id in inspectionsMap) {
|
|
457
|
+ var item = {}
|
|
458
|
+ for (var key in items[index]) {
|
|
459
|
+ item[key] = items[index][key]
|
|
460
|
+ }
|
|
461
|
+ item.value = inspectionsMap[items[index].id].inspect_value
|
|
462
|
+ item.value_direction = ''
|
|
463
|
+ if (item.range_type == 1) {
|
|
464
|
+ var value = parseFloat(item.value)
|
|
465
|
+ var range_min = parseFloat(item.range_min)
|
|
466
|
+ var range_max = parseFloat(item.range_max)
|
|
467
|
+ if (value < range_min) {
|
|
468
|
+ item.value_direction = '↓'
|
|
469
|
+ } else if (value > range_max) {
|
|
470
|
+ item.value_direction = '↑'
|
492
|
471
|
}
|
493
|
|
- this.items.push(item);
|
494
|
472
|
}
|
|
473
|
+ this.items.push(item)
|
495
|
474
|
}
|
496
|
|
-
|
497
|
|
- this.resetForm(formName);
|
498
|
|
- this.dialogFormVisible = false;
|
499
|
|
- } else {
|
500
|
|
- this.$message.error(response.data.msg);
|
501
|
|
- return false;
|
502
|
475
|
}
|
503
|
|
- })
|
|
476
|
+
|
|
477
|
+ this.resetForm(formName)
|
|
478
|
+ this.dialogFormVisible = false
|
|
479
|
+ } else {
|
|
480
|
+ this.$message.error(response.data.msg)
|
|
481
|
+ return false
|
|
482
|
+ }
|
|
483
|
+ })
|
504
|
484
|
.catch(v => {
|
505
|
|
- this.$message.error(v);
|
506
|
|
- return false;
|
507
|
|
- });
|
508
|
|
- this.formLoading = false;
|
509
|
|
- return false;
|
|
485
|
+ this.$message.error(v)
|
|
486
|
+ return false
|
|
487
|
+ })
|
|
488
|
+ this.formLoading = false
|
|
489
|
+ return false
|
510
|
490
|
} else {
|
511
|
|
- return false;
|
|
491
|
+ return false
|
512
|
492
|
}
|
513
|
|
- });
|
|
493
|
+ })
|
514
|
494
|
},
|
515
|
495
|
submitNew(formName) {
|
516
|
496
|
this.$refs[formName].validate(valid => {
|
517
|
497
|
if (valid) {
|
518
|
|
- this.formLoading = true;
|
|
498
|
+ this.formLoading = true
|
519
|
499
|
if (this.form.formItem.length == 0) {
|
520
|
|
- this.$message.error("未填写项目");
|
521
|
|
- return false;
|
|
500
|
+ this.$message.error('未填写项目')
|
|
501
|
+ return false
|
522
|
502
|
}
|
523
|
503
|
for (var index in this.form.formItem) {
|
524
|
504
|
this.form.formItem[index].value =
|
525
|
|
- "" + this.form.formItem[index].value;
|
|
505
|
+ '' + this.form.formItem[index].value
|
526
|
506
|
}
|
527
|
507
|
CreatePatientInspection(
|
528
|
508
|
this.patientID,
|
|
@@ -532,239 +512,207 @@ export default {
|
532
|
512
|
.then(response => {
|
533
|
513
|
if (response.data.state == 1) {
|
534
|
514
|
this.$notify({
|
535
|
|
- title: "成功",
|
536
|
|
- message: "新增成功",
|
537
|
|
- type: "success",
|
|
515
|
+ title: '成功',
|
|
516
|
+ message: '新增成功',
|
|
517
|
+ type: 'success',
|
538
|
518
|
duration: 2000
|
539
|
|
- });
|
|
519
|
+ })
|
540
|
520
|
// this.form.remind_reycle = response.data.data.remind_reycc
|
541
|
521
|
this.patient_info.remind_cycle =
|
542
|
|
- response.data.data.remind_cycle;
|
543
|
|
- console.log(this.patient_info.remind_cycle);
|
|
522
|
+ response.data.data.remind_cycle
|
|
523
|
+ console.log(this.patient_info.remind_cycle)
|
544
|
524
|
|
545
|
|
- this.itemDate = this.form.inspect_date;
|
546
|
|
- console.log(this.itemDate);
|
547
|
|
-
|
548
|
|
- this.items = [];
|
|
525
|
+ this.itemDate = this.form.inspect_date
|
|
526
|
+ this.items = []
|
549
|
527
|
for (var index in this.projects) {
|
550
|
528
|
if (this.projects[index].project_id == this.form.project_id) {
|
551
|
|
- this.projects[index].count++;
|
552
|
|
- break;
|
|
529
|
+ this.projects[index].count++
|
|
530
|
+ break
|
553
|
531
|
}
|
554
|
532
|
}
|
555
|
|
- this.total += 1;
|
556
|
|
- var inspections = response.data.data.inspections;
|
557
|
|
- this.inspections = response.data.data.inspections;
|
|
533
|
+ this.total += 1
|
|
534
|
+ var inspections = response.data.data.inspections
|
|
535
|
+ this.inspections = response.data.data.inspections
|
558
|
536
|
if (inspections == null) {
|
559
|
|
- this.inspections = [];
|
560
|
|
- return false;
|
|
537
|
+ this.inspections = []
|
|
538
|
+ return false
|
561
|
539
|
}
|
562
|
|
- var inspectionsMap = {};
|
563
|
|
- this.inspectionsMap = {};
|
|
540
|
+ var inspectionsMap = {}
|
|
541
|
+ this.inspectionsMap = {}
|
564
|
542
|
for (var index in inspections) {
|
565
|
543
|
inspectionsMap[inspections[index].item_id] =
|
566
|
|
- inspections[index];
|
|
544
|
+ inspections[index]
|
567
|
545
|
this.inspectionsMap[inspections[index].item_id] =
|
568
|
|
- inspections[index];
|
|
546
|
+ inspections[index]
|
569
|
547
|
}
|
570
|
|
- var items = this.project.inspection_reference;
|
|
548
|
+ var items = this.project.inspection_reference
|
571
|
549
|
for (var index in items) {
|
572
|
550
|
if (items[index].id in inspectionsMap) {
|
573
|
|
- var item = {};
|
|
551
|
+ var item = {}
|
574
|
552
|
for (var key in items[index]) {
|
575
|
|
- item[key] = items[index][key];
|
|
553
|
+ item[key] = items[index][key]
|
576
|
554
|
}
|
577
|
|
- item.value = inspectionsMap[items[index].id].inspect_value;
|
578
|
|
- item.value_direction = "";
|
|
555
|
+ item.value = inspectionsMap[items[index].id].inspect_value
|
|
556
|
+ item.value_direction = ''
|
579
|
557
|
if (item.range_type == 1) {
|
580
|
|
- var value = parseFloat(item.value);
|
581
|
|
- var range_min = parseFloat(item.range_min);
|
582
|
|
- var range_max = parseFloat(item.range_max);
|
|
558
|
+ var value = parseFloat(item.value)
|
|
559
|
+ var range_min = parseFloat(item.range_min)
|
|
560
|
+ var range_max = parseFloat(item.range_max)
|
583
|
561
|
if (value < range_min) {
|
584
|
|
- item.value_direction = "↓";
|
|
562
|
+ item.value_direction = '↓'
|
585
|
563
|
} else if (value > range_max) {
|
586
|
|
- item.value_direction = "↑";
|
|
564
|
+ item.value_direction = '↑'
|
587
|
565
|
}
|
588
|
566
|
}
|
589
|
|
- this.items.push(item);
|
|
567
|
+ this.items.push(item)
|
590
|
568
|
}
|
591
|
569
|
}
|
592
|
570
|
|
593
|
|
- this.resetForm(formName);
|
594
|
|
- this.dialogFormVisible = false;
|
|
571
|
+ this.resetForm(formName)
|
|
572
|
+ this.dialogFormVisible = false
|
595
|
573
|
|
596
|
|
- this.queryParams.patient = this.patientID;
|
597
|
|
- this.queryParams.project_id = this.project.project_id;
|
598
|
|
- this.queryParams.page = 1;
|
599
|
|
- this.total = 0;
|
600
|
|
- this.fetchPatientInspections(this.queryParams);
|
|
574
|
+ this.queryParams.patient = this.patientID
|
|
575
|
+ this.queryParams.project_id = this.project.project_id
|
|
576
|
+ this.queryParams.page = 1
|
|
577
|
+ this.total = 0
|
|
578
|
+ this.fetchPatientInspections(this.queryParams)
|
601
|
579
|
} else {
|
602
|
|
- this.$message.error(response.data.msg);
|
603
|
|
- return false;
|
|
580
|
+ this.$message.error(response.data.msg)
|
|
581
|
+ return false
|
604
|
582
|
}
|
605
|
583
|
})
|
606
|
584
|
.catch(v => {
|
607
|
|
- this.$message.error(v);
|
608
|
|
- return false;
|
609
|
|
- });
|
610
|
|
- this.formLoading = false;
|
611
|
|
- return false;
|
|
585
|
+ this.$message.error(v)
|
|
586
|
+ return false
|
|
587
|
+ })
|
|
588
|
+ this.formLoading = false
|
|
589
|
+ return false
|
612
|
590
|
} else {
|
613
|
|
- return false;
|
|
591
|
+ return false
|
614
|
592
|
}
|
615
|
|
- });
|
|
593
|
+ })
|
616
|
594
|
},
|
617
|
595
|
fetchInspectionReference() {
|
618
|
596
|
fetchInspectionReference(this.patientID)
|
619
|
597
|
.then(response => {
|
620
|
598
|
if (response.data.state == 1) {
|
621
|
|
- var reference = response.data.data.reference;
|
622
|
|
- console.log("reference",reference)
|
623
|
|
- var patient_info = response.data.data.patient_info;
|
624
|
|
- this.projects = reference;
|
625
|
|
- this.patient_info = patient_info;
|
626
|
|
- this.pageLoading = false;
|
627
|
|
- this.form.remind_cycle = this.patient_info.remind_cycle;
|
|
599
|
+ var reference = response.data.data.reference
|
|
600
|
+ var patient_info = response.data.data.patient_info
|
|
601
|
+ this.projects = reference
|
|
602
|
+ this.patient_info = patient_info
|
|
603
|
+ this.pageLoading = false
|
|
604
|
+ this.form.remind_cycle = this.patient_info.remind_cycle
|
628
|
605
|
} else {
|
629
|
|
- this.$message.error(response.data.msg);
|
630
|
|
- return false;
|
|
606
|
+ this.$message.error(response.data.msg)
|
|
607
|
+ return false
|
631
|
608
|
}
|
632
|
609
|
})
|
633
|
|
- .catch(v => {});
|
|
610
|
+ .catch(v => {})
|
634
|
611
|
},
|
635
|
612
|
setCurrent(row) {
|
636
|
|
- this.$refs.singleTable.setCurrentRow(row);
|
|
613
|
+ this.$refs.singleTable.setCurrentRow(row)
|
637
|
614
|
},
|
638
|
615
|
resetForm(formName) {
|
639
|
|
- this.$refs[formName].resetFields();
|
|
616
|
+ this.$refs[formName].resetFields()
|
640
|
617
|
},
|
641
|
618
|
handleCurrentChange(row) {
|
642
|
|
- this.itemDate = "";
|
643
|
|
- this.form.method = "add";
|
644
|
|
- if (typeof row === "undefined" || row == null) {
|
645
|
|
- this.project = null;
|
646
|
|
- this.items = [];
|
647
|
|
- this.itemName = "请选择项目";
|
|
619
|
+ this.itemDate = ''
|
|
620
|
+ this.form.method = 'add'
|
|
621
|
+ if (typeof row === 'undefined' || row == null) {
|
|
622
|
+ this.project = null
|
|
623
|
+ this.items = []
|
|
624
|
+ this.itemName = '请选择项目'
|
648
|
625
|
} else {
|
649
|
|
- this.itemLoading = true;
|
650
|
|
- this.project = row;
|
651
|
|
- this.items = row.inspection_reference;
|
652
|
|
- this.itemName = row.project_name;
|
653
|
|
-
|
654
|
|
- this.queryParams.patient = this.patientID;
|
655
|
|
- this.queryParams.project_id = this.project.project_id;
|
656
|
|
- this.queryParams.page = 1;
|
657
|
|
- this.total = 0;
|
658
|
|
- this.fetchPatientInspections(this.queryParams);
|
|
626
|
+ this.itemLoading = true
|
|
627
|
+ this.project = row
|
|
628
|
+ this.items = row.inspection_reference
|
|
629
|
+ this.itemName = row.project_name
|
|
630
|
+
|
|
631
|
+ this.queryParams.patient = this.patientID
|
|
632
|
+ this.queryParams.project_id = this.project.project_id
|
|
633
|
+ this.queryParams.page = 1
|
|
634
|
+ this.total = 0
|
|
635
|
+ this.fetchPatientInspections(this.queryParams)
|
659
|
636
|
}
|
660
|
637
|
},
|
661
|
638
|
|
662
|
639
|
handleCurrentChangePage(val) {
|
663
|
|
- this.itemLoading = true;
|
664
|
|
- this.queryParams.page = val;
|
665
|
|
- this.fetchPatientInspections(this.queryParams);
|
|
640
|
+ this.itemLoading = true
|
|
641
|
+ this.queryParams.page = val
|
|
642
|
+ this.fetchPatientInspections(this.queryParams)
|
666
|
643
|
},
|
667
|
644
|
fetchPatientInspections(params) {
|
668
|
|
- this.items = [];
|
|
645
|
+ this.items = []
|
669
|
646
|
fetchPatientInspections(params)
|
670
|
647
|
.then(response => {
|
671
|
648
|
if (response.data.state == 1) {
|
672
|
|
- var inspections = response.data.data.inspections;
|
673
|
|
- console.log("inspections",inspection)
|
674
|
|
- this.total = response.data.data.total;
|
675
|
|
- this.itemDate = response.data.data.date.split(" ")[0];
|
676
|
|
- this.inspections = response.data.data.inspections;
|
|
649
|
+ var inspections = response.data.data.inspections
|
|
650
|
+ this.total = response.data.data.total
|
|
651
|
+ this.itemDate = response.data.data.date
|
|
652
|
+ this.inspections = response.data.data.inspections
|
677
|
653
|
if (inspections == null) {
|
678
|
|
- this.inspections = [];
|
679
|
|
- return false;
|
|
654
|
+ this.inspections = []
|
|
655
|
+ return false
|
680
|
656
|
}
|
681
|
|
- var inspectionsMap = {};
|
682
|
|
- this.inspectionsMap = {};
|
|
657
|
+ var inspectionsMap = {}
|
|
658
|
+ this.inspectionsMap = {}
|
683
|
659
|
for (var index in inspections) {
|
684
|
|
- console.log(inspections[index])
|
685
|
|
- inspectionsMap[inspections[index].item_id] = inspections[index];
|
686
|
|
-
|
687
|
|
- this.inspectionsMap[inspections[index].item_id] =
|
688
|
|
- inspections[index];
|
|
660
|
+ inspectionsMap[inspections[index].item_id] = inspections[index]
|
|
661
|
+ this.inspectionsMap[inspections[index].item_id] = inspections[index]
|
689
|
662
|
}
|
690
|
|
- var items = this.project.inspection_reference;
|
691
|
|
-
|
692
|
|
- console.log(items)
|
693
|
|
- console.log(inspectionsMap)
|
694
|
|
-
|
695
|
|
-
|
696
|
|
-
|
|
663
|
+ var items = this.project.inspection_reference
|
697
|
664
|
for (var index in items) {
|
698
|
|
-
|
699
|
|
- if (
|
700
|
|
- items[index].id in inspectionsMap ||
|
701
|
|
- items[index].item_id in inspectionsMap
|
702
|
|
- ) {
|
703
|
|
-
|
704
|
|
-
|
705
|
|
- var item = {};
|
|
665
|
+ if (items[index].id in inspectionsMap || items[index].item_id in inspectionsMap) {
|
|
666
|
+ var item = {}
|
706
|
667
|
for (var key in items[index]) {
|
707
|
|
- item[key] = items[index][key];
|
|
668
|
+ item[key] = items[index][key]
|
708
|
669
|
}
|
709
|
|
- console.log(item.item_id);
|
710
|
|
-
|
711
|
670
|
if (item.item_id > 0) {
|
712
|
|
- console.log(item)
|
713
|
|
- console.log(items[index].item_id)
|
714
|
|
- console.log(inspectionsMap)
|
715
|
|
-
|
716
|
|
- console.log(inspectionsMap[parseInt(items[index].item_id)].inspect_value)
|
717
|
|
-
|
718
|
|
- item.value =
|
719
|
|
- inspectionsMap[items[index].item_id].inspect_value;
|
720
|
|
-
|
721
|
|
-
|
|
671
|
+ if (inspectionsMap[items[index].item_id] == undefined) {
|
|
672
|
+ item.value = inspectionsMap[items[index].id].inspect_value
|
|
673
|
+ } else {
|
|
674
|
+ item.value = inspectionsMap[items[index].item_id].inspect_value
|
|
675
|
+ }
|
722
|
676
|
} else {
|
723
|
|
-
|
724
|
|
- item.value = inspectionsMap[items[index].id].inspect_value;
|
|
677
|
+ item.value = inspectionsMap[items[index].id].inspect_value
|
725
|
678
|
}
|
726
|
|
-
|
727
|
|
- item.value_direction = "";
|
|
679
|
+ item.value_direction = ''
|
728
|
680
|
if (item.range_type == 1) {
|
729
|
|
-
|
730
|
|
- var value = parseFloat(item.value);
|
731
|
|
- var range_min = parseFloat(item.range_min);
|
732
|
|
- var range_max = parseFloat(item.range_max);
|
|
681
|
+ var value = parseFloat(item.value)
|
|
682
|
+ var range_min = parseFloat(item.range_min)
|
|
683
|
+ var range_max = parseFloat(item.range_max)
|
733
|
684
|
if (value < range_min) {
|
734
|
|
- item.value_direction = "↓";
|
|
685
|
+ item.value_direction = '↓'
|
735
|
686
|
} else if (value > range_max) {
|
736
|
|
- item.value_direction = "↑";
|
|
687
|
+ item.value_direction = '↑'
|
737
|
688
|
}
|
738
|
689
|
}
|
739
|
|
- this.items.push(item);
|
740
|
|
-
|
|
690
|
+ this.items.push(item)
|
741
|
691
|
}
|
742
|
|
-
|
743
|
692
|
}
|
744
|
|
-
|
745
|
|
-
|
|
693
|
+ console.log(this.items)
|
746
|
694
|
}
|
747
|
695
|
})
|
748
|
|
- .catch(v => {});
|
|
696
|
+ .catch(v => {})
|
749
|
697
|
setTimeout(() => {
|
750
|
|
- this.itemLoading = false;
|
751
|
|
- }, 1000);
|
|
698
|
+ this.itemLoading = false
|
|
699
|
+ }, 1000)
|
752
|
700
|
}
|
753
|
701
|
},
|
754
|
702
|
created() {
|
755
|
|
- const id = this.$route.query && this.$route.query.id;
|
756
|
|
- this.patientID = parseInt(id);
|
|
703
|
+ const id = this.$route.query && this.$route.query.id
|
|
704
|
+ this.patientID = parseInt(id)
|
757
|
705
|
if (isNaN(this.patientID) || this.patientID <= 0) {
|
758
|
706
|
this.$notify.error({
|
759
|
|
- title: "错误",
|
760
|
|
- message: "无效的id"
|
761
|
|
- });
|
762
|
|
- this.$router.push("/patients/patients");
|
|
707
|
+ title: '错误',
|
|
708
|
+ message: '无效的id'
|
|
709
|
+ })
|
|
710
|
+ this.$router.push('/patients/patients')
|
763
|
711
|
}
|
764
|
712
|
|
765
|
|
- this.fetchInspectionReference();
|
|
713
|
+ this.fetchInspectionReference()
|
766
|
714
|
}
|
767
|
|
-};
|
|
715
|
+}
|
768
|
716
|
</script>
|
769
|
717
|
|
770
|
718
|
<style>
|