Browse Source

增加我的病人功能

张保健 5 years ago
parent
commit
a86ff9e996
1 changed files with 54 additions and 15 deletions
  1. 54 15
      src/pages/main/DialysisArea.vue

+ 54 - 15
src/pages/main/DialysisArea.vue View File

@@ -59,6 +59,10 @@
59 59
             {{ selected_date_str }}
60 60
             <span class="iconfont">&#xe74a;</span>
61 61
           </li>
62
+          <li @click="mypatient()">
63
+            我的病人
64
+            <span class="iconfont">&#xe74a;</span>
65
+          </li>
62 66
         </ul>
63 67
       </div>
64 68
       <div class="stateBox">
@@ -128,9 +132,10 @@ export default {
128 132
   data() {
129 133
     return {
130 134
       loading: false,
131
-
135
+      user_id: 0,
132 136
       networkStates: true,
133 137
       timer: null,
138
+      ismypatient: false,
134 139
       selected_date: this.$store.getters.app.dialysis_area.schedule_date, //new Date(),
135 140
       schedual_types: [
136 141
         { value: 0, text: "全部班", select: true },
@@ -195,12 +200,35 @@ export default {
195 200
         return schedules;
196 201
       }
197 202
 
203
+       if (this.ismypatient) {
204
+        var schedules = [];
205
+        for (let o_i = 0; o_i < this.dialysis_scheduals.length; o_i++) {
206
+          const scheduleInfo = this.dialysis_scheduals[o_i];
207
+          var originSchedules = scheduleInfo.scheduals;
208
+          if (originSchedules.length == 0) {
209
+            continue;
210
+          }
211
+          var filtedSchedules = [];
212
+          for (let s_i = 0; s_i < originSchedules.length; s_i++) {
213
+            const schedule = originSchedules[s_i];
214
+            if (schedule.dialysis_order.start_nurse == this.user_id ) {
215
+              filtedSchedules.push(schedule);
216
+              // break;
217
+            }
218
+          }
219
+          if (filtedSchedules.length > 0) {
220
+            schedules.push({
221
+              zone_name: scheduleInfo.zone_name,
222
+              scheduals: filtedSchedules
223
+            });
224
+          }
225
+        }
226
+        return schedules;
227
+      }
228
+
198 229
       var zone_selected = this.zone_selected;
199 230
       var timetype_selected = this.schedual_type_selected;
200
-      if (
201
-        (zone_selected == 0 && timetype_selected == 0) ||
202
-        this.zones.length <= 1
203
-      ) {
231
+      if ( (zone_selected == 0 && timetype_selected == 0) || this.zones.length <= 1 ) {
204 232
         return this.dialysis_scheduals;
205 233
       }
206 234
 
@@ -212,16 +240,16 @@ export default {
212 240
         var filtedSchedules = [];
213 241
         for (let s_i = 0; s_i < originSchedules.length; s_i++) {
214 242
           const schedule = originSchedules[s_i];
215
-          if (
216
-            zone_name.length == 0 ||
217
-            (zone_name.length > 0 &&
218
-              zone_name == schedule.device_number.zone.name)
219
-          ) {
220
-            if (
221
-              timetype_selected == 0 ||
222
-              schedule.schedule_type == timetype_selected
223
-            ) {
224
-              filtedSchedules.push(schedule);
243
+           if(this.ismypatient){
244
+             if ( schedule.dialysis_order.creator == this.user_id){
245
+               filtedSchedules.push(schedule);
246
+             }
247
+           }
248
+          else {
249
+            if  ( zone_name.length == 0 || (zone_name.length > 0 && zone_name == schedule.device_number.zone.name) ) {
250
+              if ( timetype_selected == 0 || schedule.schedule_type == timetype_selected ) {
251
+                filtedSchedules.push(schedule);
252
+              }
225 253
             }
226 254
           }
227 255
         }
@@ -232,10 +260,12 @@ export default {
232 260
           });
233 261
         }
234 262
       }
263
+      this.ismypatient = false
235 264
       return schedules;
236 265
     }
237 266
   },
238 267
   created() {
268
+    this.user_id = this.$store.getters.user.user.id;
239 269
     this.requestDialysisScheduals();
240 270
   },
241 271
   mounted() {
@@ -248,10 +278,17 @@ export default {
248 278
     this.timer = null;
249 279
   },
250 280
   methods: {
281
+    mypatient(){
282
+      this.search_keyword = '';
283
+      this.zone_selected = 0;
284
+      this.schedual_type_selected = 0;
285
+      this.ismypatient = true;
286
+    },
251 287
     reloads: function() {
252 288
       this.reload();
253 289
     },
254 290
     handletimeType: function(index) {
291
+      this.ismypatient = false
255 292
       this.sch_type_options_visible = false;
256 293
       this.schedual_type_selected = index;
257 294
       this.$emit("clear_search_keyword");
@@ -262,6 +299,7 @@ export default {
262 299
       });
263 300
     },
264 301
     handleZoneChange: function(index) {
302
+      this.ismypatient = false
265 303
       this.zone_options_visible = false;
266 304
       this.zone_selected = index;
267 305
       this.$emit("clear_search_keyword");
@@ -272,6 +310,7 @@ export default {
272 310
       });
273 311
     },
274 312
     handleScheduleDateChange: function(date) {
313
+      this.ismypatient = false
275 314
       this.zone_selected = 0;
276 315
       this.schedual_type_selected = 0;
277 316