Browse Source

Merge branch '20200710_pc_vue_new_branch' of http://git.shengws.com/csx/Vue_New into 20200710_pc_vue_new_branch

csx 4 years ago
parent
commit
764a74ba57

+ 24 - 0
src/api/doctorSchedule.js View File

@@ -148,3 +148,27 @@ export function getScheduleListTotal(params) {
148 148
     params: params
149 149
   })
150 150
 }
151
+
152
+export function toSearchTotal(params) {
153
+  return request({
154
+    url: '/api/schedule/tosearchtotal',
155
+    methods: 'get',
156
+    params: params
157
+  })
158
+}
159
+
160
+export function changeOption(params) {
161
+  return request({
162
+    url: '/api/schedule/changeoption',
163
+    methods: 'get',
164
+    params: params
165
+  })
166
+}
167
+
168
+export function getchartlist(params) {
169
+  return request({
170
+    url: '/api/schedule/getchartlist',
171
+    methods: 'get',
172
+    params: params
173
+  })
174
+}

+ 53 - 0
src/router/modules/dialysis.js View File

@@ -38,6 +38,59 @@ export default {
38 38
         noCache: true
39 39
       }
40 40
     },
41
+    {
42
+      path: '/dialysis/consumableDrugs',
43
+      component: () => import('@/xt_pages/dialysis/consumableDrugs'),
44
+      name: '耗材药品',
45
+      meta: {
46
+        title: '耗材药品',
47
+        noCache: true
48
+      }
49
+    },
50
+    {
51
+      path: '/dialysis/consumableDrugs_print',
52
+      component: () => import('@/xt_pages/dialysis/consumableDrugs_print'),
53
+      hidden: true,
54
+      is_menu: false,
55
+      name: 'consumableDrugs_print',
56
+      meta: {
57
+        title: 'consumableDrugs_print',
58
+        noCache: true
59
+      }
60
+    },
61
+    {
62
+      path: '/dialysis/dialysisDrugs_print',
63
+      component: () => import('@/xt_pages/dialysis/dialysisDrugs_print'),
64
+      hidden: true,
65
+      is_menu: false,
66
+      name: 'dialysisDrugs_print',
67
+      meta: {
68
+        title: 'dialysisDrugs_print',
69
+        noCache: true
70
+      }
71
+    },
72
+    {
73
+      path: '/dialysis/dialysisParameters_print',
74
+      component: () => import('@/xt_pages/dialysis/dialysisParameters_print'),
75
+      hidden: true,
76
+      is_menu: false,
77
+      name: 'dialysisParameters_print',
78
+      meta: {
79
+        title: 'dialysisParameters_print',
80
+        noCache: true
81
+      }
82
+    },
83
+    {
84
+      path: '/dialysis/allSummary_print',
85
+      component: () => import('@/xt_pages/dialysis/allSummary_print'),
86
+      hidden: true,
87
+      is_menu: false,
88
+      name: 'allSummary_print',
89
+      meta: {
90
+        title: 'allSummary_print',
91
+        noCache: true
92
+      }
93
+    },
41 94
     {
42 95
       path: '/dialysis/record/:id',
43 96
       component: () => import('@/xt_pages/dialysis/dialysisPage'),

+ 11 - 0
src/router/modules/medical_scheduling.js View File

@@ -47,5 +47,16 @@ export default {
47 47
       noCache: true
48 48
     }
49 49
   },
50
+  {
51
+    path: '/medicalScheduling/statistics/print',
52
+    component: () => import('@/xt_pages/medicalScheduling/statistics_print'),
53
+    name: 'statistics_print',
54
+    hidden: true,
55
+    is_menu: false,
56
+    meta: {
57
+      title: 'statistics_print',
58
+      noCache: true
59
+    }
60
+  },
50 61
   ]
51 62
 }

+ 541 - 142
src/xt_pages/medicalScheduling/index.vue View File

@@ -3,7 +3,7 @@
3 3
         <div class="position">
4 4
             <bread-crumb :crumbs="crumbs"></bread-crumb>
5 5
             <div style="display:flex;align-items:center">
6
-                <!-- <el-button type="primary" @click="setting">设置</el-button> -->
6
+                <el-button type="primary" @click="setting">设置</el-button>
7 7
                 <el-button type="primary" @click="DeleteStaffSchedule">清除</el-button>
8 8
                 <el-button type="primary" @click="copyStaffSchedule">复制</el-button>
9 9
                 <el-button type="primary" icon="el-icon-printer" @click="toPrint">打印</el-button>
@@ -214,7 +214,7 @@
214 214
                     <el-tabs v-model="activeName">
215 215
                         <el-tab-pane label="护士" name="nurse">
216 216
                             <el-table
217
-                                :data="nurseList"
217
+                                :data="nurseTableData"
218 218
                                 border
219 219
                                 height="250"
220 220
                                 style="width: 100%">
@@ -262,7 +262,7 @@
262 262
 
263 263
                         <el-tab-pane label="医生" name="doctor">
264 264
                             <el-table
265
-                                :data="doctorList"
265
+                                :data="doctorTableData"
266 266
                                 border
267 267
                                 height="250"
268 268
                                 style="width: 100%">
@@ -333,6 +333,7 @@
333 333
 const moment = require('moment')
334 334
 import BreadCrumb from '@/xt_pages/components/bread-crumb'
335 335
 import { getDoctorList,getScheduleList,addSchedule,getStaffScheduleList,getNextWeekList,getScheduleByDoctorId,toSearchScheduleList,DeleteStaffSchedule,copyStaffSchedule,UpdateContinusSchedule,SaveNurseSort,SaveIsSchedule } from '@/api/doctorSchedule'
336
+import { constants } from 'crypto'
336 337
 export default {
337 338
     components:{
338 339
         BreadCrumb
@@ -391,28 +392,11 @@ export default {
391 392
            arrSeven:[],
392 393
 
393 394
            //
394
-           nurseTableData: [{
395
-            date: '2016-05-02',
396
-            name: '王小虎',
397
-            address: '上海市普陀区金沙江路 1518 弄'
398
-            }, {
399
-            date: '2016-05-04',
400
-            name: '王小虎',
401
-            address: '上海市普陀区金沙江路 1517 弄'
402
-            }, {
403
-            date: '2016-05-01',
404
-            name: '王小虎',
405
-            address: '上海市普陀区金沙江路 1519 弄'
406
-            }, {
407
-            date: '2016-05-03',
408
-            name: '王小虎',
409
-            address: '上海市普陀区金沙江路 1516 弄'
410
-            }],
411 395
             nurseVisible:false,
412 396
             activeName:'nurse',
413 397
             radio:'1',
414
-            nurseList:[],
415
-            doctorList:[],
398
+            nurseTableData:[],
399
+            doctorTableData:[],
416 400
         }
417 401
     },
418 402
     methods:{
@@ -427,27 +411,34 @@ export default {
427 411
             getDoctorList().then(response=>{
428 412
                 if(response.data.state == 1){
429 413
                     var list =  response.data.data.list
430
-                    console.log("医护列表",list)
431
-                    this.tableData = list
432
-                    this.doctorlist = list
414
+                    // console.log("医护列表",list)
415
+                    // this.tableData = list
416
+                    // let arr = []
417
+                    // list.map(item => {
418
+                    //     if(item.is_sort == 1){
419
+                    //         arr.push(item)
420
+                    //     }
421
+                    // })
422
+                    // this.doctorlist = arr
433 423
                     //获取班种列表
434 424
                     this.getStaffScheduleList()
435 425
 
436 426
                     var doctorlist =  response.data.data.doctorlist
427
+                    let arr = []
437 428
                     for(let i=0;i<doctorlist.length;i++){
438
-                       if(doctorlist[i].sort == 0){
429
+                        if(doctorlist[i].sort == 0){
439 430
                           doctorlist[i].sort = ""
440
-                       }
431
+                        }
441 432
                     }
442 433
                     console.log('doctorlist',doctorlist)
443
-                    this.doctorList = doctorlist
434
+                    this.doctorTableData = doctorlist
444 435
                     var nurselist = response.data.data.nurselist
445 436
                     for(let i=0;i<nurselist.length;i++){
446
-                       if(nurselist[i].sort == 0){
437
+                        if(nurselist[i].sort == 0){
447 438
                            nurselist[i].sort = ""
448
-                       }
439
+                        }
449 440
                     }
450
-                    this.nurseList = nurselist
441
+                    this.nurseTableData = nurselist
451 442
                 }
452 443
             })
453 444
         },
@@ -852,7 +843,8 @@ export default {
852 843
                                 user_name: staffList[i].user_name,
853 844
                                 admin_user_id:staffList[i].admin_user_id,
854 845
                                 user_type:staffList[i].doctor_type,
855
-                                user_type:staffList[i].doctor_type,
846
+                                is_sort:staffList[i].is_sort,
847
+                                sort:staffList[i].sort,
856 848
                                 list: [{class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week,user_type:staffList[i].doctor_type,class_attributes:staffList[i].class_attributes}]
857 849
                             })
858 850
                             tempArr.push(staffList[i].user_name);
@@ -864,18 +856,66 @@ export default {
864 856
                             }
865 857
                         }
866 858
                     }
859
+
867 860
                     let arr = [...newArr]
868
-                    arr.sort(this.compare('admin_user_id'))
869
-                    this.doctorlist.sort(this.compare('admin_user_id'))
870
-                    this.doctorlist.forEach((item, index) => {
871
-                      if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
861
+                    let newNurse = []
862
+                    let newDoctor = []
863
+                    arr.map(item => {
864
+                        if(item.user_type == 2){
865
+                            newDoctor.push(item)
866
+                        }
867
+                        if(item.user_type == 3){
868
+                            newNurse.push(item)
869
+                        }
870
+                    })
871
+                    //护士
872
+                    newNurse.sort(this.compare('admin_user_id'))
873
+                    let newNurseTableData = []
874
+                    this.nurseTableData.map(item => {
875
+                        if(item.is_sort == 1){
876
+                            newNurseTableData.push(item)
877
+                        }
878
+                    })
879
+                    newNurseTableData.sort(this.compare('admin_user_id'))
880
+                    newNurseTableData.map((item,index) => {
881
+                        if (newNurse[index] && item.admin_user_id == newNurse[index].admin_user_id) {
882
+
883
+                        }else{
884
+                            newNurse.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
885
+                        }
886
+                    })
887
+                    newNurse.sort(this.compare('sort'))
872 888
 
873
-                      }else{
874
-                        arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type})
875
-                      }
889
+                    //医生
890
+                    newDoctor.sort(this.compare('admin_user_id'))
891
+                    let newDoctorTableData = []
892
+                    this.doctorTableData.map(item => {
893
+                        if(item.is_sort == 1){
894
+                            newDoctorTableData.push(item)
895
+                        }
896
+                    })
897
+                    newDoctorTableData.sort(this.compare('admin_user_id'))
898
+                    newDoctorTableData.map((item,index) => {
899
+                        if (newDoctor[index] && item.admin_user_id == newDoctor[index].admin_user_id) {
900
+
901
+                        }else{
902
+                            newDoctor.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
903
+                        }
876 904
                     })
877
-                    arr.sort(this.compare('user_type'))
905
+                    newDoctor.sort(this.compare('sort'))
878 906
 
907
+
908
+                    // arr.sort(this.compare('admin_user_id'))
909
+                    // this.doctorlist.sort(this.compare('admin_user_id'))
910
+                    // this.doctorlist.forEach((item, index) => {
911
+                    //   if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
912
+                    
913
+                    //   }else{
914
+                    //     arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type})
915
+                    //   }
916
+                    // })
917
+                    // arr.sort(this.compare('user_type'))
918
+                    
879 919
                     let arr2 = []
880 920
                     arr2.push({class_name:oneStr,schedule_week:1})
881 921
                     arr2.push({class_name:twoStr,schedule_week:2})
@@ -890,7 +930,12 @@ export default {
890 930
                     obj.user_type = 10
891 931
                     obj.list = arr2
892 932
                     arr.push(obj)
893
-                    this.tableData = arr
933
+
934
+                    let data = []
935
+                    data.push(...newNurse)
936
+                    data.push(...newDoctor)
937
+                    data.push(obj)
938
+                    this.tableData = data
894 939
 
895 940
 
896 941
                 }
@@ -1160,33 +1205,83 @@ export default {
1160 1205
                     let tempArr = [], newArr = []
1161 1206
                     for (let i = 0; i < staffList.length; i++) {
1162 1207
                         if (tempArr.indexOf(staffList[i].user_name) === -1) {
1163
-                        newArr.push({
1164
-                            user_name: staffList[i].user_name,
1165
-                            admin_user_id:staffList[i].admin_user_id,
1166
-                            user_type:staffList[i].doctor_type,
1167
-                            list: [{class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week,user_type:staffList[i].doctor_type,class_attributes:staffList[i].class_attributes}]
1168
-                        })
1169
-                        tempArr.push(staffList[i].user_name);
1208
+                            newArr.push({
1209
+                                user_name: staffList[i].user_name,
1210
+                                admin_user_id:staffList[i].admin_user_id,
1211
+                                user_type:staffList[i].doctor_type,
1212
+                                is_sort:staffList[i].is_sort,
1213
+                                sort:staffList[i].sort,
1214
+                                list: [{class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week,user_type:staffList[i].doctor_type,class_attributes:staffList[i].class_attributes}]
1215
+                            })
1216
+                            tempArr.push(staffList[i].user_name);
1170 1217
                         } else {
1171
-                        for (let j = 0; j < newArr.length; j++) {
1172
-                            if (newArr[j].user_name == staffList[i].user_name) {
1173
-                            newArr[j].list.push({class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week,user_type:staffList[i].doctor_type,class_attributes:staffList[i].class_attributes})
1218
+                            for (let j = 0; j < newArr.length; j++) {
1219
+                                if (newArr[j].user_name == staffList[i].user_name) {
1220
+                                    newArr[j].list.push({class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week,user_type:staffList[i].doctor_type,class_attributes:staffList[i].class_attributes})
1221
+                                }
1174 1222
                             }
1175 1223
                         }
1176
-                        }
1177 1224
                     }
1225
+                    
1178 1226
                     let arr = [...newArr]
1179
-                    arr.sort(this.compare('admin_user_id'))
1180
-                    this.doctorlist.sort(this.compare('admin_user_id'))
1181
-                    this.doctorlist.forEach((item, index) => {
1182
-                      if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
1227
+                    let newNurse = []
1228
+                    let newDoctor = []
1229
+                    arr.map(item => {
1230
+                        if(item.user_type == 2){
1231
+                            newDoctor.push(item)
1232
+                        }
1233
+                        if(item.user_type == 3){
1234
+                            newNurse.push(item)
1235
+                        }
1236
+                    })
1237
+                    //护士
1238
+                    newNurse.sort(this.compare('admin_user_id'))
1239
+                    let newNurseTableData = []
1240
+                    this.nurseTableData.map(item => {
1241
+                        if(item.is_sort == 1){
1242
+                            newNurseTableData.push(item)
1243
+                        }
1244
+                    })
1245
+                    newNurseTableData.sort(this.compare('admin_user_id'))
1246
+                    newNurseTableData.map((item,index) => {
1247
+                        if (newNurse[index] && item.admin_user_id == newNurse[index].admin_user_id) {
1183 1248
 
1184
-                      }else{
1185
-                        arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type})
1186
-                        // console.log("arr",arr)
1187
-                      }
1249
+                        }else{
1250
+                            newNurse.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
1251
+                        }
1252
+                    })
1253
+                    newNurse.sort(this.compare('sort'))
1254
+
1255
+                    //医生
1256
+                    newDoctor.sort(this.compare('admin_user_id'))
1257
+                    let newDoctorTableData = []
1258
+                    this.doctorTableData.map(item => {
1259
+                        if(item.is_sort == 1){
1260
+                            newDoctorTableData.push(item)
1261
+                        }
1188 1262
                     })
1189
-                    arr.sort(this.compare('user_type'))
1263
+                    newDoctorTableData.sort(this.compare('admin_user_id'))
1264
+                    newDoctorTableData.map((item,index) => {
1265
+                        if (newDoctor[index] && item.admin_user_id == newDoctor[index].admin_user_id) {
1266
+                    
1267
+                        }else{
1268
+                            newDoctor.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
1269
+                        }
1270
+                    })
1271
+                    newDoctor.sort(this.compare('sort'))
1272
+
1273
+
1274
+                    // arr.sort(this.compare('admin_user_id'))
1275
+                    // this.doctorlist.sort(this.compare('admin_user_id'))
1276
+                    // this.doctorlist.forEach((item, index) => {
1277
+                    //   if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
1278
+                    
1279
+                    //   }else{
1280
+                    //     arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type})
1281
+                    //   }
1282
+                    // })
1283
+                    // arr.sort(this.compare('user_type'))
1284
+                    
1190 1285
                     let arr2 = []
1191 1286
                     arr2.push({class_name:oneStr,schedule_week:1})
1192 1287
                     arr2.push({class_name:twoStr,schedule_week:2})
@@ -1196,12 +1291,17 @@ export default {
1196 1291
                     arr2.push({class_name:sixStr,schedule_week:6})
1197 1292
                     arr2.push({class_name:zeroStr,schedule_week:0})
1198 1293
                     var obj = {}
1199
-                     obj.admin_user_id = "1000000"
1200
-                     obj.user_name = "合计"
1201
-                     obj.user_type = 10
1202
-                     obj.list = arr2
1203
-                     arr.push(obj)
1204
-                    this.tableData = arr
1294
+                    obj.admin_user_id = "1000000"
1295
+                    obj.user_name = "合计"
1296
+                    obj.user_type = 10
1297
+                    obj.list = arr2
1298
+                    arr.push(obj)
1299
+
1300
+                    let data = []
1301
+                    data.push(...newNurse)
1302
+                    data.push(...newDoctor)
1303
+                    data.push(obj)
1304
+                    this.tableData = data
1205 1305
                 }
1206 1306
             })
1207 1307
         },
@@ -1216,80 +1316,382 @@ export default {
1216 1316
                 if(response.data.state == 1){
1217 1317
                     var  staffList =  response.data.data.staffList
1218 1318
                     // console.log("staffList",staffList)
1319
+                    var sevenStr = ""
1320
+                     var oneStr = ""
1321
+                    var twoStr = ""
1322
+                    var threeStr = ""
1323
+                    var fourStr = ""
1324
+                    var fiveStr = ""
1325
+                    var sixStr = ""
1326
+                    this.arrZero = []
1327
+                    this.arrOne = []
1328
+                    this.arrTwo = []
1329
+                    this.arrThree = []
1330
+                    this.arrFour = []
1331
+                    this.arrFive = []
1332
+                    this.arrSix = []
1333
+                  for(let i=0;i<staffList.length;i++){
1334
+                    if(staffList[i].schedule_week == 0){
1335
+                        staffList[i].class_index = 0
1336
+                         var arr = []
1337
+                        this.arrZero.push(staffList[i].class_name)
1338
+                        for(let i=0;i<this.arrZero.length;i++){
1339
+                           if(this.arrZero[i]!=''){
1340
+                              arr.push(this.arrZero[i])
1341
+                           }
1342
+                        }
1343
+                        var countedNames = arr.reduce(function (allNames, name) {
1344
+                            if (name in allNames) {
1345
+                                allNames[name]++;
1346
+                            }
1347
+                            else {
1348
+                                allNames[name] = 1;
1349
+                            }
1350
+                            return allNames;
1351
+                        }, {});
1352
+                        let objKey = Object.keys(countedNames)
1353
+                        let objVal = Object.values(countedNames)
1354
+                        var zeroStr = ''
1355
+                        objKey.map((item,index) => {
1356
+                        let objVal = Object.values(countedNames)
1357
+                            zeroStr += item + objVal[index] + '\n'
1358
+                        })
1359
+                        sevenStr = zeroStr
1360
+                    }
1361
+                    if(staffList[i].schedule_week == 1){
1362
+                        staffList[i].class_index = 1
1363
+                        var arr = []
1364
+                        this.arrOne.push(staffList[i].class_name)
1365
+                        for(let i=0;i<this.arrOne.length;i++){
1366
+                           if(this.arrOne[i]!=''){
1367
+                              arr.push(this.arrOne[i])
1368
+                           }
1369
+                        }
1370
+                        var countedNames = arr.reduce(function (allNames, name) {
1371
+                            if (name in allNames) {
1372
+                                allNames[name]++;
1373
+                            }
1374
+                            else {
1375
+                                allNames[name] = 1;
1376
+                            }
1377
+                            return allNames;
1378
+                        }, {});
1379
+                        let objKey = Object.keys(countedNames)
1380
+                        let objVal = Object.values(countedNames)
1381
+                        let strOne = ''
1382
+                        objKey.map((item,index) => {
1383
+                        let objVal = Object.values(countedNames)
1384
+                            strOne += item + objVal[index] + '\n'
1385
+                        })
1386
+                        oneStr  = strOne
1387
+                    }
1388
+                    if(staffList[i].schedule_week == 2){
1389
+                        staffList[i].class_index = 2
1390
+                         var arr = []
1391
+                        this.arrTwo.push(staffList[i].class_name)
1392
+                        for(let i=0;i<this.arrTwo.length;i++){
1393
+                           if(this.arrTwo[i]!=''){
1394
+                              arr.push(this.arrTwo[i])
1395
+                           }
1396
+                        }
1397
+                        var countedNames = arr.reduce(function (allNames, name) {
1398
+                            if (name in allNames) {
1399
+                                allNames[name]++;
1400
+                            }
1401
+                            else {
1402
+                                allNames[name] = 1;
1403
+                            }
1404
+                            return allNames;
1405
+                        }, {});
1406
+                        let objKey = Object.keys(countedNames)
1407
+                        let objVal = Object.values(countedNames)
1408
+                        let strTwo = ''
1409
+                        objKey.map((item,index) => {
1410
+                        let objVal = Object.values(countedNames)
1411
+                            strTwo += item + objVal[index] + '\n'
1412
+                        })
1413
+                         twoStr = strTwo
1414
+                    }
1415
+                    if(staffList[i].schedule_week == 3){
1416
+                        staffList[i].class_index = 3
1417
+                         var arr = []
1418
+                        this.arrThree.push(staffList[i].class_name)
1419
+                        for(let i=0;i<this.arrThree.length;i++){
1420
+                           if(this.arrThree[i]!=''){
1421
+                              arr.push(this.arrThree[i])
1422
+                           }
1423
+                        }
1424
+                        var countedNames = arr.reduce(function (allNames, name) {
1425
+                            if (name in allNames) {
1426
+                                allNames[name]++;
1427
+                            }
1428
+                            else {
1429
+                                allNames[name] = 1;
1430
+                            }
1431
+                            return allNames;
1432
+                        }, {});
1433
+                        let objKey = Object.keys(countedNames)
1434
+                        let objVal = Object.values(countedNames)
1435
+                        let strThree = ''
1436
+                        objKey.map((item,index) => {
1437
+                        let objVal = Object.values(countedNames)
1438
+                            strThree += item + objVal[index] + '\n'
1439
+                        })
1440
+                        threeStr = strThree
1441
+                    }
1442
+                    if(staffList[i].schedule_week == 4){
1443
+                        staffList[i].class_index = 4
1444
+                        var arr = []
1445
+                        this.arrFour.push(staffList[i].class_name)
1446
+                        for(let i=0;i<this.arrFour.length;i++){
1447
+                           if(this.arrFour[i]!=''){
1448
+                              arr.push(this.arrFour[i])
1449
+                           }
1450
+                        }
1451
+                        var countedNames = arr.reduce(function (allNames, name) {
1452
+                            if (name in allNames) {
1453
+                                allNames[name]++;
1454
+                            }
1455
+                            else {
1456
+                                allNames[name] = 1;
1457
+                            }
1458
+                            return allNames;
1459
+                        }, {});
1460
+                        let objKey = Object.keys(countedNames)
1461
+                        let objVal = Object.values(countedNames)
1462
+                        let strFour = ''
1463
+                        objKey.map((item,index) => {
1464
+                        let objVal = Object.values(countedNames)
1465
+                            strFour += item + objVal[index] + '\n'
1466
+                        })
1467
+                        fourStr = strFour
1468
+                    }
1469
+                    if(staffList[i].schedule_week == 5){
1470
+                        staffList[i].class_index = 5
1219 1471
 
1472
+                         var arr = []
1473
+                        this.arrFive.push(staffList[i].class_name)
1474
+                        for(let i=0;i<this.arrFive.length;i++){
1475
+                           if(this.arrFive[i]!=''){
1476
+                              arr.push(this.arrFive[i])
1477
+                           }
1478
+                        }
1479
+                        var countedNames = arr.reduce(function (allNames, name) {
1480
+                            if (name in allNames) {
1481
+                                allNames[name]++;
1482
+                            }
1483
+                            else {
1484
+                                allNames[name] = 1;
1485
+                            }
1486
+                            return allNames;
1487
+                        }, {});
1488
+                        let objKey = Object.keys(countedNames)
1489
+                        let objVal = Object.values(countedNames)
1490
+                        let strFive = ''
1491
+                        objKey.map((item,index) => {
1492
+                        let objVal = Object.values(countedNames)
1493
+                            strFive += item + objVal[index] + '\n'
1494
+                        })
1495
+                         fiveStr = strFive
1496
+                    }
1497
+                    if(staffList[i].schedule_week == 6){
1498
+                        staffList[i].class_index = 6
1499
+                         var arr = []
1500
+                        this.arrSix.push(staffList[i].class_name)
1501
+                        for(let i=0;i<this.arrSix.length;i++){
1502
+                           if(this.arrSix[i]!=''){
1503
+                              arr.push(this.arrSix[i])
1504
+                           }
1505
+                        }
1506
+                        var countedNames = arr.reduce(function (allNames, name) {
1507
+                            if (name in allNames) {
1508
+                                allNames[name]++;
1509
+                            }
1510
+                            else {
1511
+                                allNames[name] = 1;
1512
+                            }
1513
+                            return allNames;
1514
+                        }, {});
1515
+                        let objKey = Object.keys(countedNames)
1516
+                        let objVal = Object.values(countedNames)
1517
+                        let strSix = ''
1518
+                        objKey.map((item,index) => {
1519
+                        let objVal = Object.values(countedNames)
1520
+                            strSix += item + objVal[index] + '\n'
1521
+                        })
1522
+                        sixStr = strSix
1523
+                     }
1524
+                    }
1220 1525
                     let tempArr = [], newArr = []
1221 1526
                     for (let i = 0; i < staffList.length; i++) {
1222 1527
                         if (tempArr.indexOf(staffList[i].user_name) === -1) {
1223 1528
                             newArr.push({
1224
-                                user_type:staffList[i].doctor_type,
1225 1529
                                 user_name: staffList[i].user_name,
1226 1530
                                 admin_user_id:staffList[i].admin_user_id,
1227
-                                list: [{class_name:staffList[i].class_name,schedule_week:staffList[i].schedule_week}]
1531
+                                user_type:staffList[i].doctor_type,
1532
+                                is_sort:staffList[i].is_sort,
1533
+                                sort:staffList[i].sort,
1534
+                                list: [{class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week,user_type:staffList[i].doctor_type,class_attributes:staffList[i].class_attributes}]
1228 1535
                             })
1229 1536
                             tempArr.push(staffList[i].user_name);
1230 1537
                         } else {
1231 1538
                             for (let j = 0; j < newArr.length; j++) {
1232 1539
                                 if (newArr[j].user_name == staffList[i].user_name) {
1233
-                                    newArr[j].list.push({class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week, user_type:staffList[i].doctor_type})
1540
+                                    newArr[j].list.push({class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week,user_type:staffList[i].doctor_type,class_attributes:staffList[i].class_attributes})
1234 1541
                                 }
1235 1542
                             }
1236 1543
                         }
1237 1544
                     }
1238 1545
 
1546
+                    let arr = [...newArr]
1547
+                    let newNurse = []
1548
+                    let newDoctor = []
1549
+                    arr.map(item => {
1550
+                        if(item.user_type == 2){
1551
+                            newDoctor.push(item)
1552
+                        }
1553
+                        if(item.user_type == 3){
1554
+                            newNurse.push(item)
1555
+                        }
1556
+                    })
1557
+
1239 1558
                     if(id == 0){
1240
-                        let arr = [...newArr]
1241
-                        arr.sort(this.compare('admin_user_id'))
1242
-                        this.doctorlist.sort(this.compare('admin_user_id'))
1243
-                        this.doctorlist.forEach((item, index) => {
1244
-                          if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
1559
+                        //护士
1560
+                        newNurse.sort(this.compare('admin_user_id'))
1561
+                        let newNurseTableData = []
1562
+                        this.nurseTableData.map(item => {
1563
+                            if(item.is_sort == 1){
1564
+                                newNurseTableData.push(item)
1565
+                            }
1566
+                        })
1567
+                        newNurseTableData.sort(this.compare('admin_user_id'))
1568
+                        newNurseTableData.map((item,index) => {
1569
+                            if (newNurse[index] && item.admin_user_id == newNurse[index].admin_user_id) {
1245 1570
 
1246
-                          }else{
1247
-                            arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type})
1248
-                            // console.log("arr",arr)
1249
-                          }
1571
+                            }else{
1572
+                                newNurse.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
1573
+                            }
1250 1574
                         })
1251
-                        arr.sort(this.compare('user_type'))
1252
-                        this.tableData = arr
1575
+                        newNurse.sort(this.compare('sort'))
1576
+
1577
+                        //医生
1578
+                        newDoctor.sort(this.compare('admin_user_id'))
1579
+                        let newDoctorTableData = []
1580
+                        this.doctorTableData.map(item => {
1581
+                            if(item.is_sort == 1){
1582
+                                newDoctorTableData.push(item)
1583
+                            }
1584
+                        })
1585
+                        newDoctorTableData.sort(this.compare('admin_user_id'))
1586
+                        newDoctorTableData.map((item,index) => {
1587
+                            if (newDoctor[index] && item.admin_user_id == newDoctor[index].admin_user_id) {
1588
+                        
1589
+                            }else{
1590
+                                newDoctor.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
1591
+                            }
1592
+                        })
1593
+                        newDoctor.sort(this.compare('sort'))
1594
+                        
1595
+                        // let data = []
1596
+                        // data.push(...newNurse)
1597
+                        // data.push(...newDoctor)
1598
+                        // this.tableData = data
1599
+                        let arr2 = []
1600
+                        arr2.push({class_name:oneStr,schedule_week:1})
1601
+                        arr2.push({class_name:twoStr,schedule_week:2})
1602
+                        arr2.push({class_name:threeStr,schedule_week:3})
1603
+                        arr2.push({class_name:fourStr,schedule_week:4})
1604
+                        arr2.push({class_name:fiveStr,schedule_week:5})
1605
+                        arr2.push({class_name:sixStr,schedule_week:6})
1606
+                        arr2.push({class_name:zeroStr,schedule_week:0})
1607
+                        var obj = {}
1608
+                        obj.admin_user_id = "1000000"
1609
+                        obj.user_name = "合计"
1610
+                        obj.user_type = 10
1611
+                        obj.list = arr2
1612
+                        arr.push(obj)
1613
+
1614
+                        let data = []
1615
+                        data.push(...newNurse)
1616
+                        data.push(...newDoctor)
1617
+                        data.push(obj)
1618
+                        this.tableData = data
1253 1619
                     }
1254 1620
                     if(id == 2){
1255
-                        let arr = [...newArr]
1256
-                        arr.sort(this.compare('admin_user_id'))
1257
-                        this.doctorlist.sort(this.compare('admin_user_id'))
1258
-                        let newDoctor = []
1259
-                        this.doctorlist.map(item => {
1260
-                        if (item.user_type == 2) {
1261
-                            newDoctor.push(item)
1262
-                        }
1621
+                        newDoctor.sort(this.compare('admin_user_id'))
1622
+                        let newDoctorTableData = []
1623
+                        this.doctorTableData.map(item => {
1624
+                            if(item.is_sort == 1){
1625
+                                newDoctorTableData.push(item)
1626
+                            }
1263 1627
                         })
1264
-                        newDoctor.map((item, index) => {
1265
-                        if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
1628
+                        newDoctorTableData.sort(this.compare('admin_user_id'))
1629
+                        newDoctorTableData.map((item,index) => {
1630
+                            if (newDoctor[index] && item.admin_user_id == newDoctor[index].admin_user_id) {
1266 1631
 
1267
-                          }else{
1268
-                            arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: []})
1269
-                            // console.log("arr",arr)
1270
-                          }
1632
+                            }else{
1633
+                                newDoctor.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
1634
+                            }
1271 1635
                         })
1272
-                        this.tableData = arr
1636
+                        newDoctor.sort(this.compare('sort'))
1637
+                        // this.tableData = newDoctor
1638
+                        let arr2 = []
1639
+                        arr2.push({class_name:oneStr,schedule_week:1})
1640
+                        arr2.push({class_name:twoStr,schedule_week:2})
1641
+                        arr2.push({class_name:threeStr,schedule_week:3})
1642
+                        arr2.push({class_name:fourStr,schedule_week:4})
1643
+                        arr2.push({class_name:fiveStr,schedule_week:5})
1644
+                        arr2.push({class_name:sixStr,schedule_week:6})
1645
+                        arr2.push({class_name:zeroStr,schedule_week:0})
1646
+                        var obj = {}
1647
+                        obj.admin_user_id = "1000000"
1648
+                        obj.user_name = "合计"
1649
+                        obj.user_type = 10
1650
+                        obj.list = arr2
1651
+                        arr.push(obj)
1652
+
1653
+                        let data = []
1654
+                        data.push(...newDoctor)
1655
+                        data.push(obj)
1656
+                        this.tableData = data
1273 1657
                     }
1274 1658
                     if(id == 3){
1275
-                        let arr = [...newArr]
1276
-                        arr.sort(this.compare('admin_user_id'))
1277
-                        this.doctorlist.sort(this.compare('admin_user_id'))
1278
-                        let newDoctor = []
1279
-                        this.doctorlist.map(item => {
1280
-                        if (item.user_type == 3) {
1281
-                            newDoctor.push(item)
1282
-                        }
1659
+                        newNurse.sort(this.compare('admin_user_id'))
1660
+                        let newNurseTableData = []
1661
+                        this.nurseTableData.map(item => {
1662
+                            if(item.is_sort == 1){
1663
+                                newNurseTableData.push(item)
1664
+                            }
1283 1665
                         })
1284
-                        newDoctor.map((item, index) => {
1285
-                        if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
1666
+                        newNurseTableData.sort(this.compare('admin_user_id'))
1667
+                        newNurseTableData.map((item,index) => {
1668
+                            if (newNurse[index] && item.admin_user_id == newNurse[index].admin_user_id) {
1286 1669
 
1287
-                          }else{
1288
-                            arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: []})
1289
-                            // console.log("arr",arr)
1290
-                          }
1670
+                            }else{
1671
+                                newNurse.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
1672
+                            }
1291 1673
                         })
1292
-                        this.tableData = arr
1674
+                        newNurse.sort(this.compare('sort'))
1675
+                        // this.tableData = newNurse
1676
+                        let arr2 = []
1677
+                        arr2.push({class_name:oneStr,schedule_week:1})
1678
+                        arr2.push({class_name:twoStr,schedule_week:2})
1679
+                        arr2.push({class_name:threeStr,schedule_week:3})
1680
+                        arr2.push({class_name:fourStr,schedule_week:4})
1681
+                        arr2.push({class_name:fiveStr,schedule_week:5})
1682
+                        arr2.push({class_name:sixStr,schedule_week:6})
1683
+                        arr2.push({class_name:zeroStr,schedule_week:0})
1684
+                        var obj = {}
1685
+                        obj.admin_user_id = "1000000"
1686
+                        obj.user_name = "合计"
1687
+                        obj.user_type = 10
1688
+                        obj.list = arr2
1689
+                        arr.push(obj)
1690
+
1691
+                        let data = []
1692
+                        data.push(...newNurse)
1693
+                        data.push(obj)
1694
+                        this.tableData = data
1293 1695
                     }
1294 1696
 
1295 1697
             }
@@ -1370,19 +1772,19 @@ export default {
1370 1772
 
1371 1773
         copyStaffSchedule(){
1372 1774
             this.newVisible = true
1373
-            // const params = {
1374
-            //     start_time:this.getTimestamp(this.weekDayArr[0]),
1375
-            //     end_time:this.getTimestamp(this.weekDayArr[6])
1376
-            // }
1377
-            // copyStaffSchedule(params).then(response=>{
1378
-            //     if(response.data.state == 1){
1379
-            //     var msg =  response.data.data.msg
1380
-            //     console.log("msg",msg)
1381
-            //     this.$message.success("复制成功")
1382
-            //     }else{
1383
-            //     this.$message.error("排班已存在")
1384
-            //     }
1385
-            // })
1775
+            const params = {
1776
+                start_time:this.getTimestamp(this.weekDayArr[0]),
1777
+                end_time:this.getTimestamp(this.weekDayArr[6])
1778
+            }
1779
+            copyStaffSchedule(params).then(response=>{
1780
+                if(response.data.state == 1){
1781
+                var msg =  response.data.data.msg
1782
+                console.log("msg",msg)
1783
+                this.$message.success("复制成功")
1784
+                }else{
1785
+                this.$message.error("排班已存在")
1786
+                }
1787
+            })
1386 1788
         },
1387 1789
         toContinuous(){
1388 1790
             var is_status = 0
@@ -1461,9 +1863,6 @@ export default {
1461 1863
             if (week.length == 14) {
1462 1864
                 weeks = week[4]+week[5]+week[6]+week[7]+week[8]+week[9]+week[10]+week[11]+week[12]
1463 1865
             }
1464
-
1465
-            //  console.log("week",week)
1466
-            //  console.log("weeks",weeks)
1467 1866
             var weekdate =  this.getTimestamp(weeks)
1468 1867
             if(weekdate  < this.timeNow){
1469 1868
             return 'background-color:#e5e5e5;'
@@ -1482,13 +1881,13 @@ export default {
1482 1881
               id:val.id,
1483 1882
             }
1484 1883
             console.log("params",params)
1485
-          // SaveNurseSort(params).then(response=>{
1486
-          //    if(response.data.state == 1){
1487
-          //      var role = response.data.data.role
1488
-          //      this.$message.success("保存成功")
1489
-          //      this.getDoctorList()
1490
-          //    }
1491
-          // })
1884
+          SaveNurseSort(params).then(response=>{
1885
+             if(response.data.state == 1){
1886
+               var role = response.data.data.role
1887
+               this.$message.success("保存成功")
1888
+               this.getDoctorList()
1889
+             }
1890
+          })
1492 1891
         },
1493 1892
        changeRadio(val){
1494 1893
           console.log("val",val)
@@ -1496,19 +1895,19 @@ export default {
1496 1895
               id:val.id,
1497 1896
               is_sort:val.is_sort,
1498 1897
            }
1499
-         // SaveIsSchedule(params).then(response=>{
1500
-         //    if(response.data.state == 1){
1501
-         //      var role =  response.data.data.role
1502
-         //      this.$message.success("保存成功")
1503
-         //      this.getDoctorList()
1504
-         //    }
1505
-         // })
1898
+         SaveIsSchedule(params).then(response=>{
1899
+            if(response.data.state == 1){
1900
+              var role =  response.data.data.role
1901
+              this.$message.success("保存成功")
1902
+              this.getDoctorList()
1903
+            }
1904
+         })
1506 1905
        }
1507 1906
     },
1508 1907
     created(){
1509 1908
         //获取医护人员
1510 1909
         this.getDoctorList()
1511
-        //获取班种
1910
+        //获取班种班种
1512 1911
         this.getScheduleList()
1513 1912
 
1514 1913
         let year = new Date().getFullYear()

+ 371 - 320
src/xt_pages/medicalScheduling/medical_print.vue View File

@@ -79,6 +79,9 @@ export default {
79 79
           arrSix:[],
80 80
           arrSeven:[],
81 81
           typevalue:0,
82
+          
83
+          doctorTableData:[],
84
+          nurseTableData:[]
82 85
         }
83 86
     },
84 87
     methods:{
@@ -98,352 +101,400 @@ export default {
98 101
           var list =  response.data.data.list
99 102
           this.doctorlist = list
100 103
           this.getScheduleByDoctorId()
104
+
105
+          //
106
+          var doctorlist =  response.data.data.doctorlist
107
+          let arr = []
108
+          for(let i=0;i<doctorlist.length;i++){
109
+              if(doctorlist[i].sort == 0){
110
+                doctorlist[i].sort = ""
111
+              }
112
+          }
113
+          console.log('doctorlist',doctorlist)
114
+          this.doctorTableData = doctorlist
115
+          var nurselist = response.data.data.nurselist
116
+          for(let i=0;i<nurselist.length;i++){
117
+              if(nurselist[i].sort == 0){
118
+                  nurselist[i].sort = ""
119
+              }
120
+          }
121
+          this.nurseTableData = nurselist
101 122
         })
102 123
       },
103 124
       //获取本周的所有排班列表
104 125
       getScheduleByDoctorId(){
105
-          const params = {
106
-            start_time:this.start_time,
107
-            end_time:this.end_time,
108
-            doctor_id:this.typevalue,
109
-         }
110
-         console.log("parasm",params)
111
-         getScheduleByDoctorId(params).then(response=>{
112
-            if(response.data.state == 1){
126
+        const params = {
127
+          start_time:this.start_time,
128
+          end_time:this.end_time,
129
+          doctor_id:this.typevalue,
130
+        }
131
+        console.log("parasm",params)
132
+        getScheduleByDoctorId(params).then(response=>{
133
+          if(response.data.state == 1){
113 134
               var staffList = response.data.data.staffList
114
-               console.log("stafflist",staffList)
135
+              console.log("stafflist",staffList)
115 136
 
116
-                   var sevenStr = ""
117
-                    var oneStr = ""
118
-                    var twoStr = ""
119
-                    var threeStr = ""
120
-                    var fourStr = ""
121
-                    var fiveStr = ""
122
-                    var sixStr = ""
123
-                    for(let i=0;i<staffList.length;i++){
124
-                    if(staffList[i].schedule_week == 0){
125
-                        staffList[i].class_index = 0
126
-                         var arr = []
127
-                        this.arrZero.push(staffList[i].class_name)
128
-                        for(let i=0;i<this.arrZero.length;i++){
129
-                           if(this.arrZero[i]!=''){
130
-                              arr.push(this.arrZero[i])
131
-                           }
132
-                        }
133
-                        var countedNames = arr.reduce(function (allNames, name) { 
134
-                            if (name in allNames) {
135
-                                allNames[name]++;
136
-                            }
137
-                            else {
138
-                                allNames[name] = 1;
139
-                            }
140
-                            return allNames;
141
-                        }, {});
142
-                        let objKey = Object.keys(countedNames)
143
-                        let objVal = Object.values(countedNames)
144
-                        var zeroStr = ''
145
-                        objKey.map((item,index) => {
146
-                        let objVal = Object.values(countedNames)
147
-                            zeroStr += item + objVal[index] + '\n'
148
-                        })
149
-                        sevenStr = zeroStr
150
-                    }
151
-                    if(staffList[i].schedule_week == 1){
152
-                        staffList[i].class_index = 1
153
-                        var arr = []
154
-                        this.arrOne.push(staffList[i].class_name)
155
-                        for(let i=0;i<this.arrOne.length;i++){
156
-                           if(this.arrOne[i]!=''){
157
-                              arr.push(this.arrOne[i])
158
-                           }
159
-                        }
160
-                        var countedNames = arr.reduce(function (allNames, name) { 
161
-                            if (name in allNames) {
162
-                                allNames[name]++;
163
-                            }
164
-                            else {
165
-                                allNames[name] = 1;
166
-                            }
167
-                            return allNames;
168
-                        }, {});
169
-                        let objKey = Object.keys(countedNames)
170
-                        let objVal = Object.values(countedNames)
171
-                        let strOne = ''
172
-                        objKey.map((item,index) => {
173
-                        let objVal = Object.values(countedNames)
174
-                            strOne += item + objVal[index] + '\n'
175
-                        })
176
-                        oneStr  = strOne
177
-                    }
178
-                    if(staffList[i].schedule_week == 2){
179
-                        staffList[i].class_index = 2
180
-                         var arr = []
181
-                        this.arrTwo.push(staffList[i].class_name)
182
-                        for(let i=0;i<this.arrTwo.length;i++){
183
-                           if(this.arrTwo[i]!=''){
184
-                              arr.push(this.arrTwo[i])
185
-                           }
186
-                        }
187
-                        var countedNames = arr.reduce(function (allNames, name) { 
188
-                            if (name in allNames) {
189
-                                allNames[name]++;
190
-                            }
191
-                            else {
192
-                                allNames[name] = 1;
193
-                            }
194
-                            return allNames;
195
-                        }, {});
196
-                        let objKey = Object.keys(countedNames)
197
-                        let objVal = Object.values(countedNames)
198
-                        let strTwo = ''
199
-                        objKey.map((item,index) => {
200
-                        let objVal = Object.values(countedNames)
201
-                            strTwo += item + objVal[index] + '\n'
202
-                        })
203
-                         twoStr = strTwo
204
-                    }
205
-                    if(staffList[i].schedule_week == 3){
206
-                        staffList[i].class_index = 3
207
-                         var arr = []
208
-                        this.arrThree.push(staffList[i].class_name)
209
-                        for(let i=0;i<this.arrThree.length;i++){
210
-                           if(this.arrThree[i]!=''){
211
-                              arr.push(this.arrThree[i])
212
-                           }
213
-                        }
214
-                        var countedNames = arr.reduce(function (allNames, name) { 
215
-                            if (name in allNames) {
216
-                                allNames[name]++;
217
-                            }
218
-                            else {
219
-                                allNames[name] = 1;
220
-                            }
221
-                            return allNames;
222
-                        }, {});
223
-                        let objKey = Object.keys(countedNames)
224
-                        let objVal = Object.values(countedNames)
225
-                        let strThree = ''
226
-                        objKey.map((item,index) => {
227
-                        let objVal = Object.values(countedNames)
228
-                            strThree += item + objVal[index] + '\n'
229
-                        })
230
-                        threeStr = strThree
231
-                    }
232
-                    if(staffList[i].schedule_week == 4){
233
-                        staffList[i].class_index = 4
234
-                        var arr = []
235
-                        this.arrFour.push(staffList[i].class_name)
236
-                        for(let i=0;i<this.arrFour.length;i++){
237
-                           if(this.arrFour[i]!=''){
238
-                              arr.push(this.arrFour[i])
239
-                           }
240
-                        }
241
-                        var countedNames = arr.reduce(function (allNames, name) { 
242
-                            if (name in allNames) {
243
-                                allNames[name]++;
244
-                            }
245
-                            else {
246
-                                allNames[name] = 1;
247
-                            }
248
-                            return allNames;
249
-                        }, {});
250
-                        let objKey = Object.keys(countedNames)
251
-                        let objVal = Object.values(countedNames)
252
-                        let strFour = ''
253
-                        objKey.map((item,index) => {
254
-                        let objVal = Object.values(countedNames)
255
-                            strFour += item + objVal[index] + '\n'
256
-                        })
257
-                        fourStr = strFour
258
-                    }
259
-                    if(staffList[i].schedule_week == 5){
260
-                        staffList[i].class_index = 5
137
+              var sevenStr = ""
138
+              var oneStr = ""
139
+              var twoStr = ""
140
+              var threeStr = ""
141
+              var fourStr = ""
142
+              var fiveStr = ""
143
+              var sixStr = ""
144
+              for(let i=0;i<staffList.length;i++){
145
+              if(staffList[i].schedule_week == 0){
146
+                  staffList[i].class_index = 0
147
+                    var arr = []
148
+                  this.arrZero.push(staffList[i].class_name)
149
+                  for(let i=0;i<this.arrZero.length;i++){
150
+                      if(this.arrZero[i]!=''){
151
+                        arr.push(this.arrZero[i])
152
+                      }
153
+                  }
154
+                  var countedNames = arr.reduce(function (allNames, name) { 
155
+                      if (name in allNames) {
156
+                          allNames[name]++;
157
+                      }
158
+                      else {
159
+                          allNames[name] = 1;
160
+                      }
161
+                      return allNames;
162
+                  }, {});
163
+                  let objKey = Object.keys(countedNames)
164
+                  let objVal = Object.values(countedNames)
165
+                  var zeroStr = ''
166
+                  objKey.map((item,index) => {
167
+                  let objVal = Object.values(countedNames)
168
+                      zeroStr += item + objVal[index] + '\n'
169
+                  })
170
+                  sevenStr = zeroStr
171
+              }
172
+              if(staffList[i].schedule_week == 1){
173
+                  staffList[i].class_index = 1
174
+                  var arr = []
175
+                  this.arrOne.push(staffList[i].class_name)
176
+                  for(let i=0;i<this.arrOne.length;i++){
177
+                      if(this.arrOne[i]!=''){
178
+                        arr.push(this.arrOne[i])
179
+                      }
180
+                  }
181
+                  var countedNames = arr.reduce(function (allNames, name) { 
182
+                      if (name in allNames) {
183
+                          allNames[name]++;
184
+                      }
185
+                      else {
186
+                          allNames[name] = 1;
187
+                      }
188
+                      return allNames;
189
+                  }, {});
190
+                  let objKey = Object.keys(countedNames)
191
+                  let objVal = Object.values(countedNames)
192
+                  let strOne = ''
193
+                  objKey.map((item,index) => {
194
+                  let objVal = Object.values(countedNames)
195
+                      strOne += item + objVal[index] + '\n'
196
+                  })
197
+                  oneStr  = strOne
198
+              }
199
+              if(staffList[i].schedule_week == 2){
200
+                  staffList[i].class_index = 2
201
+                    var arr = []
202
+                  this.arrTwo.push(staffList[i].class_name)
203
+                  for(let i=0;i<this.arrTwo.length;i++){
204
+                      if(this.arrTwo[i]!=''){
205
+                        arr.push(this.arrTwo[i])
206
+                      }
207
+                  }
208
+                  var countedNames = arr.reduce(function (allNames, name) { 
209
+                      if (name in allNames) {
210
+                          allNames[name]++;
211
+                      }
212
+                      else {
213
+                          allNames[name] = 1;
214
+                      }
215
+                      return allNames;
216
+                  }, {});
217
+                  let objKey = Object.keys(countedNames)
218
+                  let objVal = Object.values(countedNames)
219
+                  let strTwo = ''
220
+                  objKey.map((item,index) => {
221
+                  let objVal = Object.values(countedNames)
222
+                      strTwo += item + objVal[index] + '\n'
223
+                  })
224
+                    twoStr = strTwo
225
+              }
226
+              if(staffList[i].schedule_week == 3){
227
+                  staffList[i].class_index = 3
228
+                    var arr = []
229
+                  this.arrThree.push(staffList[i].class_name)
230
+                  for(let i=0;i<this.arrThree.length;i++){
231
+                      if(this.arrThree[i]!=''){
232
+                        arr.push(this.arrThree[i])
233
+                      }
234
+                  }
235
+                  var countedNames = arr.reduce(function (allNames, name) { 
236
+                      if (name in allNames) {
237
+                          allNames[name]++;
238
+                      }
239
+                      else {
240
+                          allNames[name] = 1;
241
+                      }
242
+                      return allNames;
243
+                  }, {});
244
+                  let objKey = Object.keys(countedNames)
245
+                  let objVal = Object.values(countedNames)
246
+                  let strThree = ''
247
+                  objKey.map((item,index) => {
248
+                  let objVal = Object.values(countedNames)
249
+                      strThree += item + objVal[index] + '\n'
250
+                  })
251
+                  threeStr = strThree
252
+              }
253
+              if(staffList[i].schedule_week == 4){
254
+                  staffList[i].class_index = 4
255
+                  var arr = []
256
+                  this.arrFour.push(staffList[i].class_name)
257
+                  for(let i=0;i<this.arrFour.length;i++){
258
+                      if(this.arrFour[i]!=''){
259
+                        arr.push(this.arrFour[i])
260
+                      }
261
+                  }
262
+                  var countedNames = arr.reduce(function (allNames, name) { 
263
+                      if (name in allNames) {
264
+                          allNames[name]++;
265
+                      }
266
+                      else {
267
+                          allNames[name] = 1;
268
+                      }
269
+                      return allNames;
270
+                  }, {});
271
+                  let objKey = Object.keys(countedNames)
272
+                  let objVal = Object.values(countedNames)
273
+                  let strFour = ''
274
+                  objKey.map((item,index) => {
275
+                  let objVal = Object.values(countedNames)
276
+                      strFour += item + objVal[index] + '\n'
277
+                  })
278
+                  fourStr = strFour
279
+              }
280
+              if(staffList[i].schedule_week == 5){
281
+                  staffList[i].class_index = 5
261 282
 
262
-                         var arr = []
263
-                        this.arrFive.push(staffList[i].class_name)
264
-                        for(let i=0;i<this.arrFive.length;i++){
265
-                           if(this.arrFive[i]!=''){
266
-                              arr.push(this.arrFive[i])
267
-                           }
268
-                        }
269
-                        var countedNames = arr.reduce(function (allNames, name) { 
270
-                            if (name in allNames) {
271
-                                allNames[name]++;
272
-                            }
273
-                            else {
274
-                                allNames[name] = 1;
275
-                            }
276
-                            return allNames;
277
-                        }, {});
278
-                        let objKey = Object.keys(countedNames)
279
-                        let objVal = Object.values(countedNames)
280
-                        let strFive = ''
281
-                        objKey.map((item,index) => {
282
-                        let objVal = Object.values(countedNames)
283
-                            strFive += item + objVal[index] + '\n'
284
-                        })
285
-                         fiveStr = strFive
286
-                    }
287
-                    if(staffList[i].schedule_week == 6){
288
-                        staffList[i].class_index = 6
289
-                         var arr = []
290
-                        this.arrSix.push(staffList[i].class_name)
291
-                        for(let i=0;i<this.arrSix.length;i++){
292
-                           if(this.arrSix[i]!=''){
293
-                              arr.push(this.arrSix[i])
294
-                           }
295
-                        }
296
-                        var countedNames = arr.reduce(function (allNames, name) { 
297
-                            if (name in allNames) {
298
-                                allNames[name]++;
299
-                            }
300
-                            else {
301
-                                allNames[name] = 1;
302
-                            }
303
-                            return allNames;
304
-                        }, {});
305
-                        let objKey = Object.keys(countedNames)
306
-                        let objVal = Object.values(countedNames)
307
-                        let strSix = ''
308
-                        objKey.map((item,index) => {
309
-                        let objVal = Object.values(countedNames)
310
-                            strSix += item + objVal[index] + '\n'
311
-                        })
312
-                        sixStr = strSix
313
-                     }
314
-                    }
283
+                    var arr = []
284
+                  this.arrFive.push(staffList[i].class_name)
285
+                  for(let i=0;i<this.arrFive.length;i++){
286
+                      if(this.arrFive[i]!=''){
287
+                        arr.push(this.arrFive[i])
288
+                      }
289
+                  }
290
+                  var countedNames = arr.reduce(function (allNames, name) { 
291
+                      if (name in allNames) {
292
+                          allNames[name]++;
293
+                      }
294
+                      else {
295
+                          allNames[name] = 1;
296
+                      }
297
+                      return allNames;
298
+                  }, {});
299
+                  let objKey = Object.keys(countedNames)
300
+                  let objVal = Object.values(countedNames)
301
+                  let strFive = ''
302
+                  objKey.map((item,index) => {
303
+                  let objVal = Object.values(countedNames)
304
+                      strFive += item + objVal[index] + '\n'
305
+                  })
306
+                    fiveStr = strFive
307
+              }
308
+              if(staffList[i].schedule_week == 6){
309
+                  staffList[i].class_index = 6
310
+                    var arr = []
311
+                  this.arrSix.push(staffList[i].class_name)
312
+                  for(let i=0;i<this.arrSix.length;i++){
313
+                      if(this.arrSix[i]!=''){
314
+                        arr.push(this.arrSix[i])
315
+                      }
316
+                  }
317
+                  var countedNames = arr.reduce(function (allNames, name) { 
318
+                      if (name in allNames) {
319
+                          allNames[name]++;
320
+                      }
321
+                      else {
322
+                          allNames[name] = 1;
323
+                      }
324
+                      return allNames;
325
+                  }, {});
326
+                  let objKey = Object.keys(countedNames)
327
+                  let objVal = Object.values(countedNames)
328
+                  let strSix = ''
329
+                  objKey.map((item,index) => {
330
+                  let objVal = Object.values(countedNames)
331
+                      strSix += item + objVal[index] + '\n'
332
+                  })
333
+                  sixStr = strSix
334
+                }
335
+              }
315 336
               let tempArr = [], newArr = []
316 337
               for (let i = 0; i < staffList.length; i++) {
317
-                if(tempArr.indexOf(staffList[i].user_name) === -1) {
338
+                if (tempArr.indexOf(staffList[i].user_name) === -1) {
318 339
                   newArr.push({
319
-                    user_type:staffList[i].doctor_type,
320 340
                     user_name: staffList[i].user_name,
321 341
                     admin_user_id:staffList[i].admin_user_id,
322
-                    list: [{class_name:staffList[i].class_name,schedule_week:staffList[i].schedule_week}]
342
+                    user_type:staffList[i].doctor_type,
343
+                    is_sort:staffList[i].is_sort,
344
+                    sort:staffList[i].sort,
345
+                    list: [{class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week,user_type:staffList[i].doctor_type,class_attributes:staffList[i].class_attributes}]
323 346
                   })
324 347
                   tempArr.push(staffList[i].user_name);
325 348
                 } else {
326 349
                   for (let j = 0; j < newArr.length; j++) {
327 350
                     if (newArr[j].user_name == staffList[i].user_name) {
328
-                      newArr[j].list.push({class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week,user_type:staffList[i].doctor_type})
351
+                      newArr[j].list.push({class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week,user_type:staffList[i].doctor_type,class_attributes:staffList[i].class_attributes})
329 352
                     }
330 353
                   }
331 354
                 }
332 355
               }
333
-              // let arr = [...newArr]
334
-              // arr.sort(this.compare('admin_user_id'))
335
-              // this.doctorlist.sort(this.compare('admin_user_id'))
336
-              // this.doctorlist.forEach((item, index) => {
337
-              //   if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
338
-              
339
-              //   }else{
340
-              //     arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type})
341
-              //   }
342
-              // })
343
-              // arr.sort(this.compare('user_type'))
344
-              // console.log("arr======",arr)
345 356
 
346
-                if(this.typevalue == 0){
347
-                   let arr = [...newArr]
348
-                    arr.sort(this.compare('admin_user_id'))
349
-                    this.doctorlist.sort(this.compare('admin_user_id'))
350
-                        this.doctorlist.forEach((item, index) => {
351
-                          if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
352
-                        
353
-                          }else{
354
-                            arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type})
355
-                            // console.log("arr",arr)
356
-                          }
357
-                        })
358
-                        arr.sort(this.compare('user_type'))
359
-                        let arr2 = []
360
-                          arr2.push({class_name:oneStr,schedule_week:1})
361
-                          arr2.push({class_name:twoStr,schedule_week:2})
362
-                          arr2.push({class_name:threeStr,schedule_week:3})
363
-                          arr2.push({class_name:fourStr,schedule_week:4})
364
-                          arr2.push({class_name:fiveStr,schedule_week:5})
365
-                          arr2.push({class_name:sixStr,schedule_week:6})
366
-                          arr2.push({class_name:zeroStr,schedule_week:0})
367
-                          var obj = {}
368
-                          obj.admin_user_id = "1000000"
369
-                          obj.user_name = "合计"
370
-                          obj.user_type = 10
371
-                          obj.list = arr2
372
-                          arr.push(obj)
373
-                          this.tableData = arr
357
+              let arr = [...newArr]
358
+              let newNurse = []
359
+              let newDoctor = []
360
+              arr.map(item => {
361
+                if(item.user_type == 2){
362
+                  newDoctor.push(item)
363
+                }
364
+                if(item.user_type == 3){
365
+                  newNurse.push(item)
366
+                }
367
+              })
368
+
369
+              if(this.typevalue == 0){
370
+                //护士
371
+                newNurse.sort(this.compare('admin_user_id'))
372
+                let newNurseTableData = []
373
+                this.nurseTableData.map(item => {
374
+                    if(item.is_sort == 1){
375
+                        newNurseTableData.push(item)
376
+                    }
377
+                })
378
+                newNurseTableData.sort(this.compare('admin_user_id'))
379
+                newNurseTableData.map((item,index) => {
380
+                    if (newNurse[index] && item.admin_user_id == newNurse[index].admin_user_id) {
381
+                
382
+                    }else{
383
+                        newNurse.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
384
+                    }
385
+                })
386
+                newNurse.sort(this.compare('sort'))
387
+
388
+                //医生
389
+                newDoctor.sort(this.compare('admin_user_id'))
390
+                let newDoctorTableData = []
391
+                this.doctorTableData.map(item => {
392
+                    if(item.is_sort == 1){
393
+                        newDoctorTableData.push(item)
374 394
                     }
375
-                    if(this.typevalue == 2){
376
-                        let arr = [...newArr]
377
-                        arr.sort(this.compare('admin_user_id'))
378
-                        this.doctorlist.sort(this.compare('admin_user_id'))
379
-                        let newDoctor = []
380
-                        this.doctorlist.map(item => {
381
-                        if (item.user_type == 2) {
382
-                            newDoctor.push(item)
383
-                        }
384
-                        })
385
-                        newDoctor.map((item, index) => {
386
-                        if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
387
-                        
388
-                          }else{
389
-                            arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: []})
390
-                            // console.log("arr",arr)
391
-                          }
392
-                        })
393
-                        let arr2 = []
394
-                          arr2.push({class_name:oneStr,schedule_week:1})
395
-                          arr2.push({class_name:twoStr,schedule_week:2})
396
-                          arr2.push({class_name:threeStr,schedule_week:3})
397
-                          arr2.push({class_name:fourStr,schedule_week:4})
398
-                          arr2.push({class_name:fiveStr,schedule_week:5})
399
-                          arr2.push({class_name:sixStr,schedule_week:6})
400
-                          arr2.push({class_name:zeroStr,schedule_week:0})
401
-                          var obj = {}
402
-                          obj.admin_user_id = "1000000"
403
-                          obj.user_name = "合计"
404
-                          obj.user_type = 10
405
-                          obj.list = arr2
406
-                          arr.push(obj)
407
-                          this.tableData = arr
395
+                })
396
+                newDoctorTableData.sort(this.compare('admin_user_id'))
397
+                newDoctorTableData.map((item,index) => {
398
+                    if (newDoctor[index] && item.admin_user_id == newDoctor[index].admin_user_id) {
399
+                
400
+                    }else{
401
+                        newDoctor.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
402
+                    }
403
+                })
404
+                newDoctor.sort(this.compare('sort'))
405
+                
406
+                
407
+
408
+                let arr2 = []
409
+                arr2.push({class_name:oneStr,schedule_week:1})
410
+                arr2.push({class_name:twoStr,schedule_week:2})
411
+                arr2.push({class_name:threeStr,schedule_week:3})
412
+                arr2.push({class_name:fourStr,schedule_week:4})
413
+                arr2.push({class_name:fiveStr,schedule_week:5})
414
+                arr2.push({class_name:sixStr,schedule_week:6})
415
+                arr2.push({class_name:zeroStr,schedule_week:0})
416
+                var obj = {}
417
+                obj.admin_user_id = "1000000"
418
+                obj.user_name = "合计"
419
+                obj.user_type = 10
420
+                obj.list = arr2
421
+                arr.push(obj)
422
+
423
+                let data = []
424
+                data.push(...newNurse)
425
+                data.push(...newDoctor)
426
+                data.push(obj)
427
+                this.tableData = data
428
+              }
429
+              if(this.typevalue == 2){
430
+                newDoctor.sort(this.compare('admin_user_id'))
431
+                let newDoctorTableData = []
432
+                this.doctorTableData.map(item => {
433
+                    if(item.is_sort == 1){
434
+                        newDoctorTableData.push(item)
408 435
                     }
409
-                    if(this.typevalue == 3){
410
-                        let arr = [...newArr]
411
-                        arr.sort(this.compare('admin_user_id'))
412
-                        this.doctorlist.sort(this.compare('admin_user_id'))
413
-                        let newDoctor = []
414
-                        this.doctorlist.map(item => {
415
-                        if (item.user_type == 3) {
416
-                            newDoctor.push(item)
417
-                        }
418
-                        })
419
-                        newDoctor.map((item, index) => {
420
-                        if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
421
-                        
422
-                          }else{
423
-                            arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: []})
424
-                            // console.log("arr",arr)
425
-                          }
426
-                        })
427
-                          let arr2 = []
428
-                          arr2.push({class_name:oneStr,schedule_week:1})
429
-                          arr2.push({class_name:twoStr,schedule_week:2})
430
-                          arr2.push({class_name:threeStr,schedule_week:3})
431
-                          arr2.push({class_name:fourStr,schedule_week:4})
432
-                          arr2.push({class_name:fiveStr,schedule_week:5})
433
-                          arr2.push({class_name:sixStr,schedule_week:6})
434
-                          arr2.push({class_name:zeroStr,schedule_week:0})
435
-                          var obj = {}
436
-                          obj.admin_user_id = "1000000"
437
-                          obj.user_name = "合计"
438
-                          obj.user_type = 10
439
-                          obj.list = arr2
440
-                          arr.push(obj)
441
-                          this.tableData = arr
436
+                })
437
+                newDoctorTableData.sort(this.compare('admin_user_id'))
438
+                newDoctorTableData.map((item,index) => {
439
+                    if (newDoctor[index] && item.admin_user_id == newDoctor[index].admin_user_id) {
440
+                
441
+                    }else{
442
+                        newDoctor.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
442 443
                     }
443
-            
444
-              
444
+                })
445
+                newDoctor.sort(this.compare('sort'))
446
+                
447
+                let arr2 = []
448
+                arr2.push({class_name:oneStr,schedule_week:1})
449
+                arr2.push({class_name:twoStr,schedule_week:2})
450
+                arr2.push({class_name:threeStr,schedule_week:3})
451
+                arr2.push({class_name:fourStr,schedule_week:4})
452
+                arr2.push({class_name:fiveStr,schedule_week:5})
453
+                arr2.push({class_name:sixStr,schedule_week:6})
454
+                arr2.push({class_name:zeroStr,schedule_week:0})
455
+                var obj = {}
456
+                obj.admin_user_id = "1000000"
457
+                obj.user_name = "合计"
458
+                obj.user_type = 10
459
+                obj.list = arr2
460
+                newDoctor.push(obj)
461
+                this.tableData = newDoctor
462
+              }
463
+              if(this.typevalue == 3){
464
+                newNurse.sort(this.compare('admin_user_id'))
465
+                let newNurseTableData = []
466
+                this.nurseTableData.map(item => {
467
+                    if(item.is_sort == 1){
468
+                        newNurseTableData.push(item)
469
+                    }
470
+                })
471
+                newNurseTableData.sort(this.compare('admin_user_id'))
472
+                newNurseTableData.map((item,index) => {
473
+                    if (newNurse[index] && item.admin_user_id == newNurse[index].admin_user_id) {
474
+                
475
+                    }else{
476
+                        newNurse.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
477
+                    }
478
+                })
479
+                newNurse.sort(this.compare('sort'))
480
+                let arr2 = []
481
+                arr2.push({class_name:oneStr,schedule_week:1})
482
+                arr2.push({class_name:twoStr,schedule_week:2})
483
+                arr2.push({class_name:threeStr,schedule_week:3})
484
+                arr2.push({class_name:fourStr,schedule_week:4})
485
+                arr2.push({class_name:fiveStr,schedule_week:5})
486
+                arr2.push({class_name:sixStr,schedule_week:6})
487
+                arr2.push({class_name:zeroStr,schedule_week:0})
488
+                var obj = {}
489
+                obj.admin_user_id = "1000000"
490
+                obj.user_name = "合计"
491
+                obj.user_type = 10
492
+                obj.list = arr2
493
+                newNurse.push(obj)
494
+                this.tableData = newNurse
495
+              }
445 496
             }
446
-         })
497
+        })
447 498
       },
448 499
       getClass(name,index){
449 500
         if(name != undefined){

+ 549 - 77
src/xt_pages/medicalScheduling/schedulingStatistics.vue View File

@@ -2,9 +2,9 @@
2 2
     <div class="main-contain">
3 3
         <div class="position">
4 4
             <bread-crumb :crumbs="crumbs"></bread-crumb>
5
-            <div style="display:flex;align-items:center">
6
-                <el-button type="primary" icon="el-icon-printer">打印</el-button>
7
-            </div>
5
+            <!-- <div style="display:flex;align-items:center">
6
+                <el-button type="primary" icon="el-icon-printer" @click='toPrint'>打印</el-button>
7
+            </div> -->
8 8
         </div>
9 9
         <div class="app-container">
10 10
             <div class="cell clearfix">
@@ -32,9 +32,18 @@
32 32
                         :value="item.value">
33 33
                     </el-option>
34 34
                 </el-select>
35
-                <el-radio v-model="timeSlot" label="1">周</el-radio>
35
+                <!-- <el-radio v-model="timeSlot" label="1">周</el-radio>
36 36
                 <el-radio v-model="timeSlot" label="2">月</el-radio>
37
-                <el-radio v-model="timeSlot" label="3">自定义</el-radio>
37
+                <el-radio v-model="timeSlot" label="3">自定义</el-radio> -->
38
+                <el-radio-group v-model="timeSlot" @change="changeRadio">
39
+                <el-radio
40
+                  :label="gender.id"
41
+                  :value="gender.id"
42
+                  v-for="(gender, index) in faultPhase"
43
+                  :key="index"
44
+                  >{{ gender.name }}</el-radio
45
+                >
46
+               </el-radio-group>
38 47
                 <div style="display:flex;" v-if="timeSlot == '1'">
39 48
                     <el-button @click="lastclick" type="text" style="margin:0 10px;">&lt;上一周({{ weekNum - 1 }})</el-button>
40 49
                     <div class="dateBox">{{ weekDayArr[0] }}-{{ weekDayArr[6] }}({{ weekNum }})</div>
@@ -57,14 +66,16 @@
57 66
                     v-model="customTime1"
58 67
                     type="date"
59 68
                     placeholder="选择日期"
60
-                    :picker-options="pickerOptions">
69
+                    :picker-options="pickerOptions"
70
+                    @change="changeTime">
61 71
                     </el-date-picker>-
62 72
                     <el-date-picker
63 73
                     style="width:140px;"
64 74
                     v-model="customTime2"
65 75
                     type="date"
66 76
                     placeholder="选择日期"
67
-                    :picker-options="pickerOptions">
77
+                    :picker-options="pickerOptions"
78
+                    @change="changeTimeTwo">
68 79
                     </el-date-picker>
69 80
                 </div>
70 81
 
@@ -78,40 +89,27 @@
78 89
                 <line-chart :options="chart"></line-chart>
79 90
             </div>
80 91
             <div class="tableTitle">统计表</div>
81
-            <el-table
82
-                :data="tableData"
83
-                height="250"
84
-                border
85
-                style="width: 100">
86
-                <el-table-column
87
-                align="center"
88
-                prop="date"
89
-                label="医护姓名"
90
-                width="180">
92
+            <el-table class='statisticsTable' :data="tableData" height="250" border ref="tab">
93
+                <el-table-column fixed align="center" prop="date" label="医护姓名" width="100">
94
+                    <template slot-scope="scope">
95
+                        <span>{{scope.row.user_name}}</span>
96
+                    </template>
91 97
                 </el-table-column>
92
-                <el-table-column
93
-                 :label="modeItem.class_name"
94
-                 property="number"
95
-                 align="center"
96
-                 min-width="100"
97
-                 v-for="(modeItem, index) in scheduleList"
98
-                 :key="index"
99
-                >
98
+                <el-table-column :label="modeItem.class_name" property="number" align="center" min-width="100" v-for="(modeItem, index) in scheduleList" :key="index">
99
+                    <template slot-scope="scope">
100
+                        <span>{{ getCount(scope.row.doctor_id,modeItem.class_name) }}</span>
101
+                    </template>
100 102
                 </el-table-column>
101
-                <el-table-column
102
-                 align="center"
103
-                 prop="address"
104
-                 label="总工时/小时">
103
+                <el-table-column align="center" prop="address" label="总工时/小时">
104
+                   <template slot-scope="scope">
105
+                        <span v-if="scope.row.totalminute">{{ scope.row.totalminute / 60 }}</span>
106
+                    </template> 
105 107
                 </el-table-column>
106
-                <el-table-column
107
-                 align="center"
108
-                 prop="address"
109
-                 label="出勤/天">
108
+                <el-table-column align="center" prop="attendance" label="出勤/天">
109
+                    <!-- <span v-if='scope.row.attendance'>{{ scope.row.attendance ? scope.row.attendance : '' }}</span> -->
110 110
                 </el-table-column>
111
-                 <el-table-column
112
-                 align="center"
113
-                 prop="address"
114
-                 label="缺勤/天">
111
+                <el-table-column align="center" prop="absence" label="缺勤/天">
112
+                    <!-- <span v-if="scope.row.absence">{{ scope.row.absence ? scope.row.absence : '' }}</span> -->
115 113
                 </el-table-column>
116 114
             </el-table>
117 115
         </div>
@@ -123,7 +121,7 @@
123 121
 import echarts from "echarts";
124 122
 import BreadCrumb from '@/xt_pages/components/bread-crumb'
125 123
 import LineChart from "../qcd/components/LineChart";
126
-import { getScheduleList,getScheduleListTotal }  from '@/api/doctorSchedule'
124
+import {getDoctorList,getScheduleList,getScheduleListTotal,toSearchTotal,changeOption,getchartlist }  from '@/api/doctorSchedule'
127 125
 export default {
128 126
     components:{
129 127
         BreadCrumb,
@@ -131,6 +129,11 @@ export default {
131 129
     },
132 130
     data(){
133 131
         return{
132
+          faultPhase: [
133
+              { id: "1", name: "周" },
134
+              { id: "2", name: "月" },
135
+              { id: "3", name: "自定义" },
136
+             ],
134 137
             pickerOptions: {
135 138
                 disabledDate(time) {
136 139
                     let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear()-1)).getTime() - 24 * 3600 * 1000;
@@ -189,21 +192,10 @@ export default {
189 192
                         data: [],
190 193
                         barWidth: 30,
191 194
                         label: {
192
-                        normal: {
193
-                            show: true,
194
-                            position: "top",
195
-                            formatter: (params) => {
196
-                            if(this.percent.length > 0){
197
-                                let str = ''
198
-                                str = params.data + '('+ this.percent[params.dataIndex] +'%)'
199
-                                return str
200
-                            }else{
201
-                                let str = ''
202
-                                str = params.data
203
-                                return str
204
-                            }
195
+                            normal: {
196
+                                show: true,
197
+                                position: "top",
205 198
                             }
206
-                        }
207 199
                         },
208 200
                         //配置样式
209 201
                         itemStyle: {
@@ -263,6 +255,13 @@ export default {
263 255
             },
264 256
             tableData: [],
265 257
             scheduleList:[],
258
+            start_time:0,
259
+            end_time:0,
260
+
261
+            doctorlist:[],
262
+            doctorArr:[],
263
+            nurseArr:[],
264
+            downloadLoading: false,
266 265
 
267 266
         }
268 267
     },
@@ -274,15 +273,148 @@ export default {
274 273
         this.todayDate=this.formatDate(new Date())
275 274
         this.setDate(new Date())
276 275
 
276
+        //获取所以医护人员
277
+        this.getDoctorList()
277 278
 
278
-      //获取所有排班种
279
-      this.getScheduleList()
280 279
 
281
-      // 获取统计表的数据
282
-      // this.getlist()
280
+        //获取所有排班种
281
+        this.getScheduleList()
282
+    
283
+        // 获取统计表的数据
284
+        this.getlist()
285
+        
286
+        
287
+      
283 288
     },
284 289
     methods:{
285
-        toSearch(){},
290
+        getDoctorList(){
291
+            getDoctorList().then(response=>{
292
+             if(response.data.state == 1){
293
+                var list =  response.data.data.list
294
+                var doctorlist =  response.data.data.doctorlist
295
+                var nurselist =  response.data.data.nurselist
296
+                this.doctorArr = doctorlist
297
+                this.nurseArr = nurselist
298
+
299
+                this.doctorlist.push(...nurselist)
300
+                this.doctorlist.push(...doctorlist)
301
+                
302
+                //获取统计图数据
303
+                this.getchartlist()
304
+             }
305
+               
306
+           })
307
+        },
308
+        //搜索
309
+        toSearch(){
310
+            if(this.timeSlot == 1){
311
+               this.start_time = this.getTimestamp(this.weekDayArr[0]),
312
+               this.end_time = this.getTimestamp(this.weekDayArr[6])
313
+            }
314
+            const params = {
315
+              keyword:this.keywords, 
316
+              start_time:this.start_time,
317
+              end_time:this.end_time
318
+            }
319
+            // console.log("params",params)
320
+            toSearchTotal(params).then(response=>{
321
+             if(response.data.state == 1){
322
+                var scheudleTotal = response.data.data.scheduletotal 
323
+                // console.log("scheduletotal",scheudleTotal) 
324
+                var list = response.data.data.list
325
+                // console.log("list",list)
326
+                var workday = response.data.data.workDay
327
+                // console.log("workday",workday)
328
+                var noWorkDay = response.data.data.noWorkDay
329
+                // console.log("noworkday",noWorkDay)
330
+                  
331
+            //     var workdaylist = response.data.data.chartWorkDayMinute
332
+
333
+            //    let arrtwo = [...workdaylist]
334
+            //     arrtwo.sort(this.compare('doctor_id'))
335
+            //     this.doctorlist.sort(this.compare('admin_user_id'))
336
+            //     this.doctorlist.forEach((item, index) => {
337
+            //      if (arrtwo[index] && item.admin_user_id ==arrtwo[index].doctor_id) {
338
+                        
339
+            //         }else{
340
+            //         arrtwo.splice(index, 0, {user_name: item.user_name, doctor_id: item.admin_user_id,workminute: 0})
341
+            //         }
342
+            //      })
343
+                   
344
+            //      let chartX = []
345
+            //      let chartY = []
346
+            //      arrtwo.map(item => {
347
+            //        chartX.push(item.user_name)
348
+            //        chartY.push(item.workminute / 60)
349
+            //      })
350
+            //      this.chart.xAxis.data = chartX
351
+            //      this.chart.series[0].data = chartY
352
+
353
+            //      this.getArrLength(this.chart.xAxis.data)                
354
+
355
+                let tempArr = [], newArr = []
356
+                for (let i = 0; i < scheudleTotal.length; i++) {
357
+                    if (tempArr.indexOf(scheudleTotal[i].user_name) === -1) {
358
+                        newArr.push({
359
+                            user_name: scheudleTotal[i].user_name,
360
+                            doctor_id:scheudleTotal[i].doctor_id,
361
+                            list: [{class_name:scheudleTotal[i].class_name,doctor_id:scheudleTotal[i].doctor_id,Count:scheudleTotal[i].Count}]
362
+                        })
363
+                        tempArr.push(scheudleTotal[i].user_name);
364
+                    } else {
365
+                        for (let j = 0; j < newArr.length; j++) {
366
+                            if (newArr[j].user_name == scheudleTotal[i].user_name) {
367
+                                newArr[j].list.push({class_name:scheudleTotal[i].class_name,doctor_id:scheudleTotal[i].doctor_id,Count:scheudleTotal[i].Count})
368
+                            }
369
+                        }
370
+                    }
371
+                }
372
+
373
+                newArr.map(item => {
374
+                    list.map(it => {
375
+                        if(item.doctor_id == it.doctor_id){
376
+                            item.totalminute = it.totalminute
377
+                        }
378
+                    })
379
+                })
380
+                newArr.map(item => {
381
+                    workday.map(it => {
382
+                        if(item.doctor_id == it.doctor_id){
383
+                            item.attendance = it.Count
384
+                        }
385
+                    })
386
+                })
387
+                newArr.map(item => {
388
+                    noWorkDay.map(it => {
389
+                        if(item.doctor_id == it.doctor_id){
390
+                            item.absence = it.Count
391
+                        }
392
+                    })
393
+                })
394
+                
395
+                let arr = [...newArr]
396
+                
397
+                if(this.keywords != ''){
398
+                    this.tableData = arr
399
+                }else {
400
+                    arr.sort(this.compare('doctor_id'))
401
+                    this.doctorlist.sort(this.compare('admin_user_id'))
402
+                    this.doctorlist.forEach((item, index) => {
403
+                      if (arr[index] && item.admin_user_id == arr[index].doctor_id) {
404
+                    
405
+                      }else{
406
+                        arr.splice(index, 0, {user_name: item.user_name, doctor_id: item.admin_user_id, list: []})
407
+                      }
408
+                    })
409
+                   
410
+                    this.tableData = arr
411
+                    this.$nextTick(() => {
412
+                      this.$refs.tab.doLayout()
413
+                    }) 
414
+                }
415
+              }
416
+          })  
417
+        },
286 418
         formatDate(date){
287 419
             var year = date.getFullYear()+'.'
288 420
             var month = (date.getMonth()+1)+'.';
@@ -314,6 +446,8 @@ export default {
314 446
                 this.nowYear = this.nowYear - 1
315 447
             }
316 448
             this.weekNum = this.weekNum - 1
449
+            this.getlist()
450
+            this.getchartlist()
317 451
         },
318 452
         //下一周
319 453
         nextclick(){
@@ -327,6 +461,8 @@ export default {
327 461
                 this.weekNum = this.getYearWeek(year, month, date)
328 462
                 this.nowYear = this.nowYear + 1
329 463
             }
464
+            this.getlist()
465
+            this.getchartlist()
330 466
         },
331 467
         getYearWeek(year,month,date){
332 468
             /*
@@ -345,8 +481,8 @@ export default {
345 481
         },
346 482
 
347 483
         changeMonth(value){
348
-            console.log(value)
349
-            console.log('monthStartTime',value.getTime() / 1000)
484
+            // console.log(value)
485
+            // console.log('monthStartTime',value.getTime() / 1000)
350 486
             let monthStartTime = value.getTime() / 1000
351 487
             var nowDate = new Date(value);
352 488
             var cloneNowDate = new Date(value);
@@ -354,10 +490,11 @@ export default {
354 490
             var month = nowDate.getMonth() + 1; // getMonth 方法返回 0-11,代表1-12月
355 491
             var endOfMonth = new Date(fullYear, month, 0).getDate(); // 获取本月最后一天
356 492
             let monthEndTime = this.getFullDate(cloneNowDate.setDate(endOfMonth))
357
-
358
-
359
-            console.log('monthEndTime',this.getTimestamp(monthEndTime))
360
-
493
+            this.start_time = monthStartTime
494
+            this.end_time = this.getTimestamp(monthEndTime)
495
+            // console.log('monthEndTime',this.getTimestamp(monthEndTime))
496
+            this.getlist()
497
+            this.getchartlist()
361 498
         },
362 499
         getFullDate(targetDate) {
363 500
             var D, y, m, d;
@@ -384,7 +521,7 @@ export default {
384 521
           getScheduleList().then(response=>{
385 522
              if(response.data.state == 1){
386 523
                 var schedulelist = response.data.data.scheduleList
387
-                console.log("schedulelist",schedulelist)
524
+                // console.log("schedulelist",schedulelist)
388 525
                 this.scheduleList = schedulelist
389 526
              }
390 527
           })
@@ -392,21 +529,350 @@ export default {
392 529
 
393 530
         //获取统计表数据
394 531
         getlist(){
395
-          const params = {
396
-             start_time:this.getTimestamp(this.weekDayArr[0]),
397
-             end_time:this.getTimestamp(this.weekDayArr[6])
398
-           }
399
-          getScheduleListTotal(params).then(response=>{
400
-             if(response.data.state == 1){
401
-                //获取每个班次对应的次数
402
-               var scheudleTotal =  response.data.data.scheudletotal
403
-               console.log("scheudletotal",scheudleTotal)
404
-               //获取总分钟数
405
-               var list = response.data.data.list
406
-               console.log("list",list)
532
+            if(this.timeSlot == 1){
533
+               this.start_time = this.getTimestamp(this.weekDayArr[0]),
534
+               this.end_time = this.getTimestamp(this.weekDayArr[6])
535
+            }
536
+            const params = {
537
+                start_time:this.start_time,
538
+                end_time:this.end_time,
539
+            }
540
+            // console.log("params",params)
541
+            getScheduleListTotal(params).then(response=>{
542
+                if(response.data.state == 1){
543
+                    //获取每个班次对应的次数
544
+                    var scheudleTotal =  response.data.data.scheudletotal
545
+                    // console.log("scheudletotal",scheudleTotal)
546
+                    //获取总分钟数
547
+                    var list = response.data.data.list
548
+                    // console.log("list",list)
549
+                    var workday = response.data.data.workDay
550
+                    // console.log("workday",workday)
551
+                    var noWorkDay = response.data.data.noWorkDay
552
+                    // console.log("noWorkDay",noWorkDay)
553
+
554
+                    let tempArr = [], newArr = []
555
+                    for (let i = 0; i < scheudleTotal.length; i++) {
556
+                        if (tempArr.indexOf(scheudleTotal[i].user_name) === -1) {
557
+                            newArr.push({
558
+                                user_name: scheudleTotal[i].user_name,
559
+                                doctor_id:scheudleTotal[i].doctor_id,
560
+                                list: [{class_name:scheudleTotal[i].class_name,doctor_id:scheudleTotal[i].doctor_id,Count:scheudleTotal[i].Count}]
561
+                            })
562
+                            tempArr.push(scheudleTotal[i].user_name);
563
+                        } else {
564
+                            for (let j = 0; j < newArr.length; j++) {
565
+                                if (newArr[j].user_name == scheudleTotal[i].user_name) {
566
+                                    newArr[j].list.push({class_name:scheudleTotal[i].class_name,doctor_id:scheudleTotal[i].doctor_id,Count:scheudleTotal[i].Count})
567
+                                }
568
+                            }
569
+                        }
570
+                    }
571
+
572
+                    newArr.map(item => {
573
+                        list.map(it => {
574
+                            if(item.doctor_id == it.doctor_id){
575
+                                item.totalminute = it.totalminute
576
+                            }
577
+                        })
578
+                    })
579
+                    newArr.map(item => {
580
+                        workday.map(it => {
581
+                            if(item.doctor_id == it.doctor_id){
582
+                                item.attendance = it.Count
583
+                            }
584
+                        })
585
+                    })
586
+                    newArr.map(item => {
587
+                        noWorkDay.map(it => {
588
+                            if(item.doctor_id == it.doctor_id){
589
+                                item.absence = it.Count
590
+                            }
591
+                        })
592
+                    })
593
+                    
594
+                    let arr = [...newArr]
407 595
 
596
+                    arr.sort(this.compare('doctor_id'))
597
+                    this.doctorlist.sort(this.compare('admin_user_id'))
598
+                    this.doctorlist.forEach((item, index) => {
599
+                      if (arr[index] && item.admin_user_id == arr[index].doctor_id) {
600
+                    
601
+                      }else{
602
+                        arr.splice(index, 0, {user_name: item.user_name, doctor_id: item.admin_user_id, list: []})
603
+                      }
604
+                    })
605
+                    
606
+
607
+                    // console.log('newArr',arr)
608
+                    this.tableData = arr
609
+                    this.$nextTick(() => {
610
+                      this.$refs.tab.doLayout()
611
+                    }) 
612
+                }
613
+            })
614
+        },
615
+        changeOption(val){
616
+            if(this.timeSlot == 1){
617
+               this.start_time = this.getTimestamp(this.weekDayArr[0]),
618
+               this.end_time = this.getTimestamp(this.weekDayArr[6])
619
+            }
620
+            const params = {
621
+              doctor_type: parseInt(val),
622
+            }
623
+            // console.log("params",params)
624
+            changeOption(params).then(response=>{
625
+              if(response.data.state == 1){
626
+                var scheudleTotal =  response.data.data.scheduletotal
627
+                // console.log("scheduletotal",scheudleTotal)
628
+                var list = response.data.data.list
629
+                // console.log("list",list)
630
+                var workday = response.data.data.workday
631
+                // console.log("workday",workday)
632
+                var noWorkDay = response.data.data.workday
633
+                // console.log("worknoday",noWorkDay)
634
+
635
+            //    var workdaylist = response.data.data.chartworkdayminute
636
+
637
+            //    let arrtwo = [...workdaylist]
638
+            //     arrtwo.sort(this.compare('doctor_id'))
639
+            //     this.doctorlist.sort(this.compare('admin_user_id'))
640
+            //     this.doctorlist.forEach((item, index) => {
641
+            //      if (arrtwo[index] && item.admin_user_id ==arrtwo[index].doctor_id) {
642
+                        
643
+            //         }else{
644
+            //         arrtwo.splice(index, 0, {user_name: item.user_name, doctor_id: item.admin_user_id,workminute: 0})
645
+            //         }
646
+            //      })
647
+                   
648
+            //      let chartX = []
649
+            //      let chartY = []
650
+            //      arrtwo.map(item => {
651
+            //        chartX.push(item.user_name)
652
+            //        chartY.push(item.workminute / 60)
653
+            //      })
654
+            //      this.chart.xAxis.data = chartX
655
+            //      this.chart.series[0].data = chartY
656
+
657
+            //      this.getArrLength(this.chart.xAxis.data)    
658
+                let tempArr = [], newArr = []
659
+                    for (let i = 0; i < scheudleTotal.length; i++) {
660
+                        if (tempArr.indexOf(scheudleTotal[i].user_name) === -1) {
661
+                            newArr.push({
662
+                                user_name: scheudleTotal[i].user_name,
663
+                                doctor_id:scheudleTotal[i].doctor_id,
664
+                                list: [{class_name:scheudleTotal[i].class_name,doctor_id:scheudleTotal[i].doctor_id,Count:scheudleTotal[i].Count}]
665
+                            })
666
+                            tempArr.push(scheudleTotal[i].user_name);
667
+                        } else {
668
+                            for (let j = 0; j < newArr.length; j++) {
669
+                                if (newArr[j].user_name == scheudleTotal[i].user_name) {
670
+                                    newArr[j].list.push({class_name:scheudleTotal[i].class_name,doctor_id:scheudleTotal[i].doctor_id,Count:scheudleTotal[i].Count})
671
+                                }
672
+                            }
673
+                        }
674
+                    }
675
+
676
+                    newArr.map(item => {
677
+                        list.map(it => {
678
+                            if(item.doctor_id == it.doctor_id){
679
+                                item.totalminute = it.totalminute
680
+                            }
681
+                        })
682
+                    })
683
+                    newArr.map(item => {
684
+                        workday.map(it => {
685
+                            if(item.doctor_id == it.doctor_id){
686
+                                item.attendance = it.Count
687
+                            }
688
+                        })
689
+                    })
690
+                    newArr.map(item => {
691
+                        noWorkDay.map(it => {
692
+                            if(item.doctor_id == it.doctor_id){
693
+                                item.absence = it.Count
694
+                            }
695
+                        })
696
+                    })
697
+                    
698
+                    let arr = [...newArr]
699
+                    if(val == 0){
700
+                        arr.sort(this.compare('doctor_id'))
701
+                        this.doctorlist.sort(this.compare('admin_user_id'))
702
+                        this.doctorlist.forEach((item, index) => {
703
+                          if (arr[index] && item.admin_user_id == arr[index].doctor_id) {
704
+                        
705
+                          }else{
706
+                            arr.splice(index, 0, {user_name: item.user_name, doctor_id: item.admin_user_id, list: []})
707
+                          }
708
+                        })
709
+                        
710
+                        this.tableData = arr
711
+                    }else if(val == 2){
712
+                        arr.sort(this.compare('doctor_id'))
713
+                        this.doctorArr.sort(this.compare('admin_user_id'))
714
+                        this.doctorArr.forEach((item, index) => {
715
+                          if (arr[index] && item.admin_user_id == arr[index].doctor_id) {
716
+                        
717
+                          }else{
718
+                            arr.splice(index, 0, {user_name: item.user_name, doctor_id: item.admin_user_id, list: []})
719
+                          }
720
+                        })
721
+                       this.tableData = arr
722
+                    }else if(val == 3){
723
+                        arr.sort(this.compare('doctor_id'))
724
+                        this.nurseArr.sort(this.compare('admin_user_id'))
725
+                        this.nurseArr.forEach((item, index) => {
726
+                          if (arr[index] && item.admin_user_id == arr[index].doctor_id) {
727
+                        
728
+                          }else{
729
+                            arr.splice(index, 0, {user_name: item.user_name, doctor_id: item.admin_user_id, list: []})
730
+                          }
731
+                        })
732
+                        this.tableData = arr
733
+                        this.$nextTick(() => {
734
+                          this.$refs.tab.doLayout()
735
+                        }) 
736
+                    }   
737
+              }
738
+            })
739
+        },
740
+        changeTime(val){
741
+            this.start_time = val.getTime()/1000
742
+            this.getlist()
743
+        },
744
+        changeTimeTwo(val){
745
+            this.end_time = val.getTime()/1000
746
+            this.getlist()
747
+        },
748
+        compare(property){
749
+            return function(a,b){
750
+                var value1 = a[property];
751
+                var value2 = b[property];
752
+                return value2 - value1;
753
+            }
754
+        },
755
+        getCount(id,name){
756
+            if(id != undefined){
757
+                let Count = '';
758
+                this.tableData.map(item => {
759
+                    if(item.doctor_id == id){
760
+                        if(item.list){
761
+                            item.list.map(it => {
762
+                                if(it.class_name == name){
763
+                                    Count = it.Count
764
+                                }
765
+                            })
766
+                        }
767
+                        
768
+                    }
769
+                })
770
+                return Count
771
+            }   
772
+        },
773
+        // toPrint(){
774
+        //     this.$router.push({
775
+        //         path: '/medicalScheduling/statistics/print',
776
+        //         // query: { date: date }
777
+        //     }) 
778
+        // },
779
+        toPrint: function() {
780
+            this.downloadLoading = true
781
+            import('@/vendor/Export2Excel').then(excel => {
782
+            const filterVal = ['医护姓名','早班','中班','晚班','夜班','全班']
783
+            const multiHeader = []
784
+            const header = []
785
+            const merges = []
786
+            let obj = {"name":"李四"}
787
+            let obj2 = {"name":"李四"}
788
+            let obj3 = {"name":"李四"}
789
+            var list = []
790
+            list.push(obj)
791
+            list.push(obj2)
792
+            list.push(obj3)
793
+            let i = 0
794
+            console.log("list",list)
795
+            const data = this.formatJson(filterVal, list)
796
+            console.log("data",data)
797
+            const filename = '排班模版'
798
+            return false
799
+            excel.export_json_to_excel({
800
+                multiHeader,
801
+                header,
802
+                merges,
803
+                data,
804
+                filename
805
+            })
806
+            this.downloadLoading = false
807
+            })
808
+
809
+        },
810
+        formatJson(filterVal, jsonData) {
811
+            return jsonData.map(v =>
812
+            filterVal.map(j => {
813
+                console.log(v)
814
+                console.log(j)
815
+                console.log(v[j])
816
+
817
+                if (j === 'timestamp') {
818
+                return parseTime(v[j])
819
+                } else {
820
+                return v[j]
821
+                }
822
+            })
823
+            )
824
+        },
825
+
826
+        //获取统计图数据
827
+        getchartlist(){
828
+             if(this.timeSlot == 1){
829
+               this.start_time = this.getTimestamp(this.weekDayArr[0]),
830
+               this.end_time = this.getTimestamp(this.weekDayArr[6])
831
+            }
832
+             const params = {
833
+                start_time:this.start_time,
834
+                end_time:this.end_time
408 835
              }
409
-          })
836
+            //  console.log("params",params)
837
+           getchartlist(params).then(response=>{
838
+                if(response.data.state == 1){
839
+                    var workdaylist =  response.data.data.workDaylist
840
+                    let arr = [...workdaylist]
841
+                    arr.sort(this.compare('doctor_id'))
842
+                    this.doctorlist.sort(this.compare('admin_user_id'))
843
+                    this.doctorlist.forEach((item, index) => {
844
+                        if (arr[index] && item.admin_user_id == arr[index].doctor_id) {
845
+                        
846
+                        }else{
847
+                          arr.splice(index, 0, {user_name: item.user_name, doctor_id: item.admin_user_id,workminute: 0})
848
+                        }
849
+                    })
850
+                   
851
+                    let chartX = []
852
+                    let chartY = []
853
+                    arr.map(item => {
854
+                        chartX.push(item.user_name)
855
+                        chartY.push(item.workminute / 60)
856
+                    })
857
+                    this.chart.xAxis.data = chartX
858
+                    this.chart.series[0].data = chartY
859
+
860
+                    this.getArrLength(this.chart.xAxis.data)
861
+                }
862
+           })
863
+        },
864
+        getArrLength(result){
865
+            if(result.length > 10){
866
+                var dataZoom_end = (10/result.length)*100;
867
+                this.chart.dataZoom[0].end = dataZoom_end
868
+            }else{
869
+                var dataZoom_end = 100;
870
+                this.chart.dataZoom[0].end = dataZoom_end
871
+            }
872
+        },
873
+        changeRadio(){
874
+          this.getlist()
875
+          this.getchartlist()
410 876
         }
411 877
     }
412 878
 }
@@ -442,4 +908,10 @@ export default {
442 908
 .pointTitle {
443 909
   font-size: 13px;
444 910
 }
911
+.statisticsTable{
912
+    ::-webkit-scrollbar{
913
+        height:15px !important;
914
+    }
915
+}
916
+
445 917
 </style>

+ 142 - 0
src/xt_pages/medicalScheduling/statistics_print.vue View File

@@ -0,0 +1,142 @@
1
+<template>
2
+    <div class="main-contain">
3
+        <div class="position">
4
+        <bread-crumb :crumbs="crumbs"></bread-crumb>
5
+        <el-row style="float:right;">
6
+            <el-col :span="24">
7
+            <el-button size="small" icon="el-icon-printer" type="primary" @click="printAction">打印</el-button>
8
+            </el-col>
9
+        </el-row>
10
+        </div>
11
+        <div class="app-container" style="background-color: white;">
12
+            <div id="print_content">
13
+                <div class="print_main_content">
14
+                    <div class="order_title_panl">
15
+                        <span class="main_title">{{ $store.getters.xt_user.org.org_name }}医护排班统计表</span>
16
+                    </div>
17
+                    <div style="text-align:right;margin-bottom:20px;font-size: 18px;">
18
+                      打印时间:
19
+                    </div>
20
+                    <div class="table_panel">
21
+                        <table class="table">
22
+                            <thead>
23
+                                <tr>
24
+                                    <td width="120">医护姓名</td>
25
+                                    <td width="120">医护姓名</td>
26
+                                    <td width="120">医护姓名</td>
27
+                                    <td width="120">医护姓名</td>
28
+                                    <td width="120">医护姓名</td>
29
+                                    <td width="120">医护姓名</td>
30
+                                </tr>
31
+                            </thead>
32
+                            <tbody>
33
+                                <tr>
34
+                                    <td width="120">医护姓名</td>
35
+                                    <td width="120">医护姓名</td>
36
+                                    <td width="120">医护姓名</td>
37
+                                    <td width="120">医护姓名</td>
38
+                                    <td width="120">医护姓名</td>
39
+                                    <td width="120">医护姓名</td>
40
+                                </tr>
41
+                            </tbody>
42
+                        </table>
43
+                    </div>
44
+                </div>
45
+            </div>
46
+        </div>
47
+    </div>
48
+</template>
49
+
50
+<script>
51
+import BreadCrumb from '@/xt_pages/components/bread-crumb'
52
+import print from 'print-js'
53
+export default {
54
+    components:{
55
+        BreadCrumb
56
+    },
57
+    data(){
58
+        return{
59
+            crumbs: [
60
+                { path: false, name: '医护排班' },
61
+                { path: false, name: '排班统计打印' }
62
+            ],
63
+        }
64
+    },
65
+    created(){
66
+
67
+    },
68
+    methods:{
69
+
70
+    }
71
+}
72
+</script>
73
+
74
+
75
+<style rel="stylesheet/scss" lang="scss" scoped>
76
+.print_main_content {
77
+  background-color: white;
78
+  max-width: 1500px;
79
+  margin: 0 auto;
80
+  padding: 0 0 20px 0;
81
+
82
+  .order_title_panl {
83
+    text-align: center;
84
+
85
+    .main_title {
86
+      font-size: 18px;
87
+      line-height: 40px;
88
+      font-weight: 500;
89
+    }
90
+  }
91
+  .table_panel {
92
+    .table {
93
+      width: 100%;
94
+      border: 1px solid;
95
+      border-collapse: collapse;
96
+      padding: 2px;
97
+      
98
+
99
+      thead {
100
+        tr {
101
+          td {
102
+            border: 1px solid;
103
+            text-align: center;
104
+            font-size: 18px;
105
+            padding: 15px 5px;
106
+          }
107
+        }
108
+      }
109
+      tbody {
110
+        tr {
111
+          td {
112
+            border: 1px solid;
113
+            text-align: center;
114
+            font-size: 18px;
115
+            padding: 10px 5px;
116
+            white-space: pre-line;
117
+            .proj {
118
+              padding: 5px 0;
119
+              text-align: left;
120
+
121
+              .proj_title {
122
+                font-size: 16px;
123
+                font-weight: 500;
124
+                line-height: 25px;
125
+              }
126
+
127
+              .proj_item {
128
+                font-size: 15px;
129
+                line-height: 20px;
130
+
131
+                .zone_name {
132
+                  font-weight: 500;
133
+                }
134
+              }
135
+            }
136
+          }
137
+        }
138
+      }
139
+    }
140
+  }
141
+}
142
+</style>