Browse Source

统计配置开发

XMLWAN 4 years ago
parent
commit
e333e4f0ae

File diff suppressed because it is too large
+ 1190 - 1255
src/xt_pages/dialysis/details/dialog/dialysisPrescriptionDialog.vue


+ 216 - 3
src/xt_pages/qcd/officesControlAnalysis/project.vue View File

@@ -214,8 +214,13 @@ export default {
214 214
      
215 215
     },
216 216
     changeOptions(val){
217
+     if(this.type == 2){
218
+        this.getMonthList()
219
+        return false
220
+      }
217 221
       this.lapseto = val
218 222
       this.getlist()
223
+       
219 224
     },
220 225
     getNormData(){
221 226
         getNormData().then(response=>{
@@ -226,12 +231,18 @@ export default {
226 231
             }
227 232
             this.normdata = normdata
228 233
             this.getlist()
229
-            this.getMonthList()
234
+           // this.getMonthList()
230 235
         })
231 236
     },
232 237
     handleModeType(val){
238
+       console.log("触发了额",this.type)
239
+       if(this.type == 2){
240
+        this.getMonthList()
241
+        return false
242
+      }
233 243
       this.mode_type = val
234 244
       this.getlist()
245
+     
235 246
     },
236 247
 
237 248
     //季度
@@ -421,6 +432,56 @@ export default {
421 432
         }
422 433
       //  console.log("resultTwo",result)
423 434
         return result;
435
+    },
436
+     arrayDateThree(array1,array2){
437
+        // console.log("array1",array1)
438
+        // console.log("array2",array2)
439
+        var array1 = array1;
440
+        var array2 = array2;
441
+        var result = [];
442
+        for(var i = 0; i < array2.length; i++){
443
+            var obj = array2[i];
444
+            var num = obj.Total;   //staff_id   就是要对比的key
445
+            var isExist = false;
446
+            for(var j = 0; j < array1.length; j++){
447
+                var aj = array1[j];
448
+                var n = aj.Total;
449
+                if(n == num){
450
+                    isExist = true;
451
+                    break;
452
+             }
453
+            }
454
+            if(!isExist){
455
+                result.push(obj);
456
+            }
457
+        }
458
+       console.log("resultThree",result)
459
+        return result;
460
+    },
461
+    arrayDateFour(array1,array2){
462
+      //   console.log("array1",array1)
463
+      //   console.log("array2",array2)
464
+        var array1 = array1;
465
+        var array2 = array2;
466
+        var result = [];
467
+        for(var i = 0; i < array2.length; i++){
468
+            var obj = array2[i];
469
+            var num = obj.Total;   //staff_id   就是要对比的key
470
+            var isExist = false;
471
+            for(var j = 0; j < array1.length; j++){
472
+                var aj = array1[j];
473
+                var n = aj.Total;
474
+                if(n == num){
475
+                    isExist = true;
476
+                    break;
477
+             }
478
+            }
479
+            if(!isExist){
480
+                result.push(obj);
481
+            }
482
+        }
483
+      //  console.log("resultTwo",result)
484
+        return result;
424 485
     },
425 486
      compare(property){
426 487
        return function(a,b){
@@ -432,6 +493,8 @@ export default {
432 493
     
433 494
     //按月份统计
434 495
     getMonthList(){
496
+         this.modesData.series = []
497
+         this.modesData.xAxis = []
435 498
         const januaryStart = moment().month(0).startOf('month').format("YYYY-MM-DD")
436 499
         console.log("一月始",januaryStart)
437 500
         const januaryEnd = moment().month(0).endOf('month').format("YYYY-MM-DD")
@@ -521,11 +584,161 @@ export default {
521 584
           decStart:decStart,
522 585
           decEnd:decEnd,    
523 586
         }
524
-       console.log("params",params)
587
+       console.log("params222222",params)
525 588
        getMonthProjectList(params).then(response=>{
526 589
         if(response.data.state === 1){
527 590
             var monthlist = response.data.data.monthlist
528
-            console.log("monthlist",monthlist)
591
+            console.log("monthlist++++++",monthlist)
592
+            var newArr = [
593
+              {Total:"一月",Count:1,NoCount: 0},
594
+              {Total:"二月",Count:1,NoCount: 0},
595
+              {Total:"三月",Count:1,NoCount: 0},
596
+              {Total:"四月",Count:1,NoCount: 0},
597
+              {Total:"五月",Count:1,NoCount: 0},
598
+              {Total:"六月",Count:1,NoCount: 0},
599
+              {Total:"七月",Count:1,NoCount: 0},
600
+              {Total:"八月",Count:1,NoCount: 0},
601
+              {Total:"九月",Count:1,NoCount: 0},
602
+              {Total:"十月",Count:1,NoCount: 0},
603
+              {Total:"十一月",Count:1,NoCount: 0},
604
+              {Total:"十二月",Count:1,NoCount: 0},
605
+            ]
606
+
607
+            var newArrTwo = [
608
+              {Total:"一月",Count:0},
609
+              {Total:"二月",Count:0},
610
+              {Total:"三月",Count:0},
611
+              {Total:"四月",Count:0},
612
+              {Total:"五月",Count:0},
613
+              {Total:"六月",Count:0},
614
+              {Total:"七月",Count:0},
615
+              {Total:"八月",Count:0},
616
+              {Total:"九月",Count:0},
617
+              {Total:"十月",Count:0},
618
+              {Total:"十一月",Count:0},
619
+              {Total:"十二月",Count:0},
620
+            ]
621
+           
622
+             //获取2个数组不同的部分
623
+            var standArr = this.arrayDateThree(monthlist,newArr)  
624
+            console.log("standArr",standArr)
625
+            standArr.map(item=>{
626
+                monthlist.push(item)
627
+              }) 
628
+            
629
+
630
+             //排序
631
+             for(let i=0;i<monthlist.length;i++){
632
+                if(monthlist[i].Total == "一月"){
633
+                   monthlist[i].Total = 1
634
+                }
635
+                if(monthlist[i].Total == "二月"){
636
+                   monthlist[i].Total = 2
637
+                }
638
+                if(monthlist[i].Total == "三月"){
639
+                   monthlist[i].Total = 3
640
+                }
641
+                if(monthlist[i].Total == "四月"){
642
+                   monthlist[i].Total = 4
643
+                }
644
+                if(monthlist[i].Total == "五月"){
645
+                   monthlist[i].Total = 5
646
+                }
647
+                if(monthlist[i].Total == "六月"){
648
+                   monthlist[i].Total = 6
649
+                }
650
+                if(monthlist[i].Total == "七月"){
651
+                   monthlist[i].Total = 7
652
+                }
653
+                if(monthlist[i].Total == "八月"){
654
+                   monthlist[i].Total = 8
655
+                }
656
+                if(monthlist[i].Total == "九月"){
657
+                   monthlist[i].Total = 9
658
+                }
659
+                if(monthlist[i].Total == "十月"){
660
+                   monthlist[i].Total = 10
661
+                }
662
+                if(monthlist[i].Total == "十一月"){
663
+                   monthlist[i].Total = 11
664
+                }
665
+                 if(monthlist[i].Total == "十二月"){
666
+                   monthlist[i].Total = 12
667
+                }
668
+             }
669
+            
670
+              //排序
671
+             monthlist.sort(this.compare('Total'))
672
+             for(let i=0;i<monthlist.length;i++){
673
+                if(monthlist[i].Total == 1){
674
+                  monthlist[i].Total = "一月"
675
+                }
676
+                if(monthlist[i].Total == 2){
677
+                  monthlist[i].Total = "二月"
678
+                }
679
+                 if(monthlist[i].Total == 3){
680
+                  monthlist[i].Total = "三月"
681
+                }
682
+                 if(monthlist[i].Total == 4){
683
+                  monthlist[i].Total = "四月"
684
+                }
685
+                 if(monthlist[i].Total == 5){
686
+                  monthlist[i].Total = "五月"
687
+                }
688
+                 if(monthlist[i].Total == 6){
689
+                  monthlist[i].Total = "六月"
690
+                }
691
+                 if(monthlist[i].Total == 7){
692
+                  monthlist[i].Total = "七月"
693
+                }
694
+                 if(monthlist[i].Total == 8){
695
+                  monthlist[i].Total = "八月"
696
+                }
697
+                 if(monthlist[i].Total == 9){
698
+                  monthlist[i].Total = "九月"
699
+                }
700
+                 if(monthlist[i].Total == 10){
701
+                  monthlist[i].Total = "十月"
702
+                }
703
+                 if(monthlist[i].Total == 11){
704
+                  monthlist[i].Total = "十一月"
705
+                }
706
+                 if(monthlist[i].Total == 12){
707
+                  monthlist[i].Total = "十二月"
708
+                }
709
+             }
710
+              console.log("monthlist-------------------------",monthlist)
711
+             var monthNolist = response.data.data.monthNolist
712
+             console.log("monthNolist",monthNolist)
713
+             
714
+            var standArrTwo = this.arrayDateThree(monthNolist,newArrTwo)  
715
+             console.log("standArrTwo",standArrTwo)
716
+
717
+             standArrTwo.map(item=>{
718
+                monthNolist.push(item)
719
+              }) 
720
+
721
+
722
+
723
+             var arrOne = []
724
+             for(let i=0;i<monthlist.length;i++){
725
+               for(let j=0;j<monthNolist.length;j++){
726
+                 if(monthlist[i].Total == monthNolist[j].Total){
727
+                     monthlist[i].NoCount = monthNolist[j].Count
728
+                     arrOne.push(monthlist[i])
729
+                 }
730
+               }
731
+             }
732
+             console.log("arrOne",arrOne)
733
+              
734
+            for(const key in arrOne){
735
+              this.modesData.xAxis.push(arrOne[key].Total);
736
+              this.modesData.series.push(((arrOne[key].NoCount/arrOne[key].Count)*100).toFixed(1));
737
+            }
738
+          
739
+
740
+            this.chart.series[0].data = this.modesData.series
741
+            this.chart.xAxis.data = this.modesData.xAxis
529 742
            }
530 743
        })
531 744
     }

+ 252 - 304
src/xt_pages/user/inspection.vue View File

@@ -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>