Browse Source

医护排班

XMLWAN 4 years ago
parent
commit
c6b63b49e2

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

@@ -68,3 +68,35 @@ export function addSchedule(params) {
68 68
     params: params
69 69
   })
70 70
 }
71
+
72
+export function getStaffScheduleList(params) {
73
+  return request({
74
+    url: '/api/schedule/getstaffschedulelist',
75
+    methods: 'get',
76
+    params: params
77
+  })
78
+}
79
+
80
+export function getNextWeekList(params) {
81
+  return request({
82
+    url: '/api/schedule/getnextweeklist',
83
+    methods: 'get',
84
+    params: params
85
+  })
86
+}
87
+
88
+export function getScheduleByDoctorId(params) {
89
+  return request({
90
+    url: '/api/schedule/getschedulebydoctorid',
91
+    methods: 'Get',
92
+    params: params
93
+  })
94
+}
95
+
96
+export function toSearchScheduleList(params) {
97
+  return request({
98
+    url: '/api/schedule/tosearchsechedulelist',
99
+    methods: 'Get',
100
+    params: params
101
+  })
102
+}

+ 9 - 9
src/xt_pages/medicalScheduling/class.vue View File

@@ -88,7 +88,7 @@
88 88
                     :picker-options="{
89 89
                     start: '08:00',
90 90
                     step: '00:15',
91
-                    end: '18:00'
91
+                    end: '24:00'
92 92
                     }"
93 93
                     placeholder="选择时间">
94 94
                     </el-time-select>
@@ -107,7 +107,7 @@
107 107
                     :picker-options="{
108 108
                     start: '08:00',
109 109
                     step: '00:15',
110
-                    end: '18:00'
110
+                    end: '24:00'
111 111
                     }"
112 112
                     placeholder="选择时间">
113 113
                     </el-time-select>
@@ -123,7 +123,7 @@
123 123
                     :picker-options="{
124 124
                     start: '08:00',
125 125
                     step: '00:15',
126
-                    end: '18:00'
126
+                    end: '24:00'
127 127
                     }"
128 128
                     placeholder="选择时间">
129 129
                     </el-time-select> ~
@@ -141,7 +141,7 @@
141 141
                     :picker-options="{
142 142
                     start: '08:00',
143 143
                     step: '00:15',
144
-                    end: '18:00'
144
+                    end: '24:00'
145 145
                     }"
146 146
                     placeholder="选择时间">
147 147
                     </el-time-select>
@@ -192,7 +192,7 @@
192 192
                     :picker-options="{
193 193
                     start: '08:00',
194 194
                     step: '00:15',
195
-                    end: '18:00'
195
+                    end: '24:00'
196 196
                     }"
197 197
                     placeholder="选择时间">
198 198
                     </el-time-select>
@@ -211,7 +211,7 @@
211 211
                     :picker-options="{
212 212
                     start: '08:00',
213 213
                     step: '00:15',
214
-                    end: '18:00'
214
+                    end: '24:00'
215 215
                     }"
216 216
                     placeholder="选择时间">
217 217
                     </el-time-select>
@@ -227,7 +227,7 @@
227 227
                     :picker-options="{
228 228
                     start: '08:00',
229 229
                     step: '00:15',
230
-                    end: '18:00'
230
+                    end: '24:00'
231 231
                     }"
232 232
                     placeholder="选择时间">
233 233
                     </el-time-select> ~
@@ -245,7 +245,7 @@
245 245
                     :picker-options="{
246 246
                     start: '08:00',
247 247
                     step: '00:15',
248
-                    end: '18:00'
248
+                    end: '24:00'
249 249
                     }"
250 250
                     placeholder="选择时间">
251 251
                     </el-time-select>
@@ -457,7 +457,7 @@ export default {
457 457
               return false
458 458
            }
459 459
           const params = {
460
-              id:this.form.id,
460
+             id:this.form.id,
461 461
              class_name:this.form.class_name,
462 462
              class_attributes:this.form.class_attributes,
463 463
              timeone_start:this.form.timeone_start,

+ 221 - 17
src/xt_pages/medicalScheduling/index.vue View File

@@ -15,17 +15,17 @@
15 15
                 style="width: 150px;"
16 16
                 class="filter-item"
17 17
                 v-model.trim="keywords"
18
-                placeholder="病人名称/透析号"
18
+                placeholder="请输入医护人员姓名"
19 19
                 />
20 20
                 <el-button
21 21
                 size="small"
22 22
                 class="filter-item"
23 23
                 type="primary"
24 24
                 icon="el-icon-search"
25
-                @click="search"
25
+                @click="toSearch"
26 26
                 >搜索</el-button
27 27
                 >
28
-                <el-select style="margin-left:10px;width:150px;" v-model="typeValue" placeholder="请选择">
28
+                <el-select style="margin-left:10px;width:150px;" v-model="typeValue" placeholder="请选择" @change="changeOption">
29 29
                     <el-option
30 30
                         v-for="item in options"
31 31
                         :key="item.value"
@@ -39,7 +39,7 @@
39 39
             </div>
40 40
             <div style="display:flex;justify-content: space-between;">
41 41
                 <div style="width: 70%">
42
-                    <el-table :data="tableData" border :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)', color: '#606266'}" :row-style="{ color: '#303133' }">
42
+                    <el-table :data="tableData" border :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)', color: '#606266'}" :row-style="{ color: '#303133' }"  @cell-click="clickThis">
43 43
                         <el-table-column prop="name" label="医护姓名" style="width:16%" align="center">
44 44
                             <template slot-scope="scope">
45 45
                                  {{scope.row.user_name}}
@@ -50,7 +50,91 @@
50 50
                                 <div @click="hangdleClick(scope.row,scope.$index)">
51 51
                                     <el-dropdown trigger="click" @command="changeSchedule">
52 52
                                         <span class="el-dropdown-link">
53
-                                        {{scope.row.class_name}}<i class="el-icon-arrow-down el-icon--right"></i>
53
+                                       <span v-if="scope.row.class_index == 1">{{scope.row.class_name}}</span><i class="el-icon-arrow-down el-icon--right"></i>
54
+                                        </span>
55
+                                        <el-dropdown-menu slot="dropdown" >
56
+                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
57
+                                        </el-dropdown-menu>
58
+                                    </el-dropdown>
59
+                                </div>
60
+                            </template>
61
+                        </el-table-column>
62
+                        <el-table-column prop="name" label="周二" style="width:14%" align="center">
63
+                             <template slot-scope="scope">
64
+                                <div @click="hangdleClick(scope.row,scope.$index)">
65
+                                    <el-dropdown trigger="click" @command="changeSchedule">
66
+                                        <span class="el-dropdown-link">
67
+                                       <span v-if="scope.row.class_index == 2">{{scope.row.class_name}}</span><i class="el-icon-arrow-down el-icon--right"></i>
68
+                                        </span>
69
+                                        <el-dropdown-menu slot="dropdown" >
70
+                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
71
+                                        </el-dropdown-menu>
72
+                                    </el-dropdown>
73
+                                </div>
74
+                            </template>
75
+                        </el-table-column>
76
+                        <el-table-column prop="name" label="周三" style="width:14%" align="center">
77
+                             <template slot-scope="scope">
78
+                                <div @click="hangdleClick(scope.row,scope.$index)">
79
+                                    <el-dropdown trigger="click" @command="changeSchedule">
80
+                                        <span class="el-dropdown-link">
81
+                                        <span v-if="scope.row.class_index == 3">{{scope.row.class_name}}</span><i class="el-icon-arrow-down el-icon--right"></i>
82
+                                        </span>
83
+                                        <el-dropdown-menu slot="dropdown" >
84
+                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
85
+                                        </el-dropdown-menu>
86
+                                    </el-dropdown>
87
+                                </div>
88
+                            </template>
89
+                        </el-table-column>
90
+                        <el-table-column prop="name" label="周四" style="width:14%" align="center">
91
+                             <template slot-scope="scope">
92
+                                <div @click="hangdleClick(scope.row,scope.$index)">
93
+                                    <el-dropdown trigger="click" @command="changeSchedule">
94
+                                        <span class="el-dropdown-link">
95
+                                        <span v-if="scope.row.class_index ==4">{{scope.row.class_name}}</span><i class="el-icon-arrow-down el-icon--right"></i>
96
+                                        </span>
97
+                                        <el-dropdown-menu slot="dropdown" >
98
+                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
99
+                                        </el-dropdown-menu>
100
+                                    </el-dropdown>
101
+                                </div>
102
+                            </template>
103
+                        </el-table-column>
104
+                        <el-table-column prop="name" label="周五" style="width:14%" align="center">
105
+                             <template slot-scope="scope">
106
+                                <div @click="hangdleClick(scope.row,scope.$index)">
107
+                                    <el-dropdown trigger="click" @command="changeSchedule">
108
+                                        <span class="el-dropdown-link">
109
+                                        <span v-if="scope.row.class_index == 5">{{scope.row.class_name}}</span><i class="el-icon-arrow-down el-icon--right"></i>
110
+                                        </span>
111
+                                        <el-dropdown-menu slot="dropdown" >
112
+                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
113
+                                        </el-dropdown-menu>
114
+                                    </el-dropdown>
115
+                                </div>
116
+                            </template>
117
+                        </el-table-column>
118
+                        <el-table-column prop="name" label="周六" style="width:14%" align="center">
119
+                             <template slot-scope="scope">
120
+                                <div @click="hangdleClick(scope.row,scope.$index)">
121
+                                    <el-dropdown trigger="click" @command="changeSchedule">
122
+                                        <span class="el-dropdown-link">
123
+                                        <span v-if="scope.row.class_index==6">{{scope.row.class_name}}</span><i class="el-icon-arrow-down el-icon--right"></i>
124
+                                        </span>
125
+                                        <el-dropdown-menu slot="dropdown" >
126
+                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
127
+                                        </el-dropdown-menu>
128
+                                    </el-dropdown>
129
+                                </div>
130
+                            </template>
131
+                        </el-table-column>
132
+                        <el-table-column prop="name" label="周日" style="width:14%" align="center">
133
+                             <template slot-scope="scope">
134
+                                <div @click="hangdleClick(scope.row,scope.$index)">
135
+                                    <el-dropdown trigger="click" @command="changeSchedule">
136
+                                        <span class="el-dropdown-link">
137
+                                         <span v-if="scope.row.class_index == 0">{{scope.row.class_name}}</span><i class="el-icon-arrow-down el-icon--right"></i>
54 138
                                         </span>
55 139
                                         <el-dropdown-menu slot="dropdown" >
56 140
                                             <el-dropdown-item  :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
@@ -59,12 +143,6 @@
59 143
                                 </div>
60 144
                             </template>
61 145
                         </el-table-column>
62
-                        <el-table-column prop="name" label="周二" style="width:14%" align="center"></el-table-column>
63
-                        <el-table-column prop="name" label="周三" style="width:14%" align="center"></el-table-column>
64
-                        <el-table-column prop="name" label="周四" style="width:14%" align="center"></el-table-column>
65
-                        <el-table-column prop="name" label="周五" style="width:14%" align="center"></el-table-column>
66
-                        <el-table-column prop="name" label="周六" style="width:14%" align="center"></el-table-column>
67
-                        <el-table-column prop="name" label="周日" style="width:14%" align="center"></el-table-column>
68 146
                     </el-table>
69 147
                 </div>
70 148
                 <div class="classBox">
@@ -86,7 +164,7 @@
86 164
 
87 165
 <script>
88 166
 import BreadCrumb from '@/xt_pages/components/bread-crumb'
89
-import { getDoctorList,getScheduleList,addSchedule } from '@/api/doctorSchedule'
167
+import { getDoctorList,getScheduleList,addSchedule,getStaffScheduleList,getNextWeekList,getScheduleByDoctorId,toSearchScheduleList } from '@/api/doctorSchedule'
90 168
 export default {
91 169
     components:{
92 170
         BreadCrumb
@@ -119,7 +197,8 @@ export default {
119 197
             nowYear: new Date().getFullYear(),
120 198
             schedule_week:0,
121 199
             docobj:{},
122
-            class_name:""
200
+            class_name:"",
201
+            doctorlist:[],
123 202
         }
124 203
     },
125 204
     methods:{
@@ -134,7 +213,11 @@ export default {
134 213
         getDoctorList().then(response=>{
135 214
             if(response.data.state == 1){
136 215
                 var list =  response.data.data.list
216
+                console.log("医护列表",list)
137 217
                 this.tableData = list
218
+                this.doctorlist = list
219
+                //获取班种列表
220
+                this.getStaffScheduleList()
138 221
             }
139 222
         })
140 223
      },
@@ -142,6 +225,7 @@ export default {
142 225
        getScheduleList().then(response=>{
143 226
           if(response.data.state == 1){
144 227
              var schedulelist = response.data.data.scheduleList
228
+             console.log("schedulelist",schedulelist)
145 229
              for(let i=0;i<schedulelist.length;i++){
146 230
                 if(schedulelist[i].timeone_type == 1){
147 231
                     schedulelist[i].timeone_type = "当日"
@@ -161,9 +245,32 @@ export default {
161 245
        }) 
162 246
      },
163 247
      hangdleClick(val,index){
164
-      this.schedule_week = index
248
+      console.log("val=====",val)
165 249
       this.docobj = val
166 250
      },
251
+     clickThis(row, column, cell, event){
252
+        if(column.label == "周日"){
253
+           this.schedule_week = 0
254
+        }
255
+        if(column.label == "周一"){
256
+           this.schedule_week = 1
257
+        }
258
+        if(column.label=="周二"){
259
+           this.schedule_week = 2
260
+        }
261
+        if(column.label=="周三"){
262
+          this.schedule_week = 3
263
+        }
264
+        if(column.label=="周四"){
265
+          this.schedule_week = 4
266
+        }
267
+        if(column.label == "周五"){
268
+           this.schedule_week = 5
269
+        }
270
+        if(column.label == "周六"){
271
+           this.schedule_week = 6
272
+        }
273
+     },
167 274
      changeSchedule(id){
168 275
          var class_name = ""
169 276
         for(let i=0;i<this.schedulelist.length;i++){
@@ -175,8 +282,10 @@ export default {
175 282
         for(let i=0;i<arr.length;i++){
176 283
            if(this.docobj.id == arr[i].id){
177 284
               arr[i].class_name = class_name
285
+              arr[i].class_index = this.schedule_week
178 286
            }
179 287
         }
288
+        console.log("arr",arr)
180 289
         this.tableData = arr
181 290
         const params = {
182 291
           doctor_id:this.docobj.admin_user_id,
@@ -187,15 +296,15 @@ export default {
187 296
           end_time:this.getTimestamp(this.weekDayArr[6])
188 297
         }
189 298
         console.log("params",params)
190
-        
299
+    //    return false
191 300
        addSchedule(params).then(response=>{
192 301
          if(response.data.state == 1){
193 302
              var schedule = response.data.data.schedule
194 303
              console.log("schedule",schedule)
304
+             this.getStaffScheduleList()
195 305
            }
196 306
        })
197 307
      },
198
- 
199 308
      formatDate(date){      
200 309
           var year = date.getFullYear()+'.'       
201 310
           var month = (date.getMonth()+1)+'.';
@@ -234,6 +343,7 @@ export default {
234 343
          this.weekNum = this.getYearWeek(year,month,date)
235 344
          this.nowYear = this.nowYear - 1
236 345
         }
346
+        this.getNextWeekList()
237 347
       },
238 348
         //下一周
239 349
      nextclick(){ 
@@ -247,6 +357,7 @@ export default {
247 357
          this.weekNum = this.getYearWeek(year,month,date)
248 358
          this.nowYear = this.nowYear + 1
249 359
        }
360
+       this.getNextWeekList()
250 361
      },
251 362
 
252 363
     getYearWeek(year,month,date){
@@ -269,7 +380,100 @@ export default {
269 380
             'command': item,
270 381
             'row': row
271 382
         }
272
-    }  
383
+    },
384
+
385
+    //获取所有排班数据
386
+    getStaffScheduleList(){
387
+        const params = {
388
+          start_time:this.getTimestamp(this.weekDayArr[0]),
389
+          end_time:this.getTimestamp(this.weekDayArr[6])
390
+        }
391
+      getStaffScheduleList(params).then(response=>{
392
+         if(response.data.state == 1){
393
+           var staffList =  response.data.data.staffList
394
+           for(let i=0;i<staffList.length;i++){
395
+            if(staffList[i].schedule_week == 0){
396
+               staffList[i].class_index = 0
397
+            }
398
+            if(staffList[i].schedule_week == 1){
399
+               staffList[i].class_index = 1
400
+            }
401
+           if(staffList[i].schedule_week == 2){
402
+               staffList[i].class_index = 2
403
+            }
404
+           if(staffList[i].schedule_week == 3){
405
+               staffList[i].class_index = 3
406
+            }
407
+           if(staffList[i].schedule_week == 4){
408
+               staffList[i].class_index = 4
409
+            }
410
+           if(staffList[i].schedule_week == 5){
411
+               staffList[i].class_index = 5
412
+            }
413
+           if(staffList[i].schedule_week == 6){
414
+               staffList[i].class_index = 6
415
+            }
416
+           }
417
+           console.log("staffList--------",staffList)
418
+           if(staffList.length == 0){
419
+             this.tableData = this.doctorlist
420
+           }else{
421
+             this.tableData = []
422
+             this.tableData = staffList
423
+           }
424
+           
425
+         }
426
+      })
427
+    },
428
+    
429
+    //获取上一周下一周的排班数据
430
+    getNextWeekList(){
431
+      const params = {
432
+         start_time:this.getTimestamp(this.weekDayArr[0]),
433
+         end_time:this.getTimestamp(this.weekDayArr[6])
434
+       }
435
+      getNextWeekList(params).then(response=>{
436
+        if(response.data.state == 1){
437
+            var staffList = response.data.data.staffList
438
+            console.log("上下周数据",staffList)
439
+          }
440
+      })
441
+    },
442
+
443
+    changeOption(id){
444
+        const params = {
445
+           start_time:this.getTimestamp(this.weekDayArr[0]),
446
+           end_time:this.getTimestamp(this.weekDayArr[6]),
447
+           doctor_id:id 
448
+        }
449
+       getScheduleByDoctorId(params).then(response=>{
450
+           if(response.data.state == 1){
451
+              var  staffList =  response.data.data.staffList
452
+              console.log("staffList",staffList)
453
+
454
+           }
455
+       })
456
+    },
457
+    toSearch(){
458
+      console.log("医护人员姓名",this.keywords)
459
+      var id = 0
460
+      for(let i = 0 ;i<this.doctorlist.length;i++){
461
+         if(this.keywords == this.doctorlist[i].user_name){
462
+            id = this.doctorlist[i].admin_user_id
463
+         }
464
+      }
465
+      const params = {
466
+        doctor_id:id,
467
+        start_time:this.getTimestamp(this.weekDayArr[0]),
468
+        end_time:this.getTimestamp(this.weekDayArr[6])
469
+      }
470
+      toSearchScheduleList(params).then(response=>{
471
+          if(response.data.state == 1){
472
+            var staffList =  response.data.data.staffList
473
+            console.log("stafflist",staffList)
474
+          }
475
+      })
476
+    }
273 477
    },
274 478
    created(){
275 479
     //获取医护人员