|
@@ -122,8 +122,8 @@ export default {
|
122
|
122
|
costClassify:getDictionaryDataConfig('system','cost_classify'),
|
123
|
123
|
tableData: [],
|
124
|
124
|
chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
|
125
|
|
- item_type: '0',
|
126
|
|
- new_item_type:0,
|
|
125
|
+ item_type: "",
|
|
126
|
+ new_item_type:"",
|
127
|
127
|
item_time_type:'1',
|
128
|
128
|
items: [
|
129
|
129
|
{ id: 1, name: '药品' },
|
|
@@ -165,12 +165,26 @@ export default {
|
165
|
165
|
// this.getSummaryDetailList()
|
166
|
166
|
},
|
167
|
167
|
changeItem() {
|
|
168
|
+ // console.log("-----")
|
|
169
|
+ // this.tableData = []
|
168
|
170
|
this.new_item_type = this.item_type
|
169
|
171
|
if(this.item_type == 1){
|
170
|
172
|
this.new_item_type = -100
|
171
|
173
|
}else if(this.item_type == 5){
|
172
|
174
|
this.new_item_type = -200
|
173
|
175
|
}
|
|
176
|
+ //
|
|
177
|
+ // if(this.new_item_type == 0){
|
|
178
|
+ // this.tableData = this.all_table_data
|
|
179
|
+ // }else{
|
|
180
|
+ // let new_table_data = []
|
|
181
|
+ // for(let aa = 0; aa < this.all_table_data.length; aa++){
|
|
182
|
+ // if(this.new_item_type == this.all_table_data[aa].cost_classify){
|
|
183
|
+ // new_table_data.push(this.all_table_data[aa])
|
|
184
|
+ // }
|
|
185
|
+ // }
|
|
186
|
+ // this.tableData = new_table_data
|
|
187
|
+ // }
|
174
|
188
|
// this.getSummaryDetailList()
|
175
|
189
|
}, uniquepid(arr) {
|
176
|
190
|
const res = new Map()
|
|
@@ -288,7 +302,6 @@ export default {
|
288
|
302
|
}
|
289
|
303
|
new_obj.items.push(obj)
|
290
|
304
|
}
|
291
|
|
-
|
292
|
305
|
tempPatientsThree.push(new_obj)
|
293
|
306
|
}
|
294
|
307
|
|
|
@@ -299,18 +312,20 @@ export default {
|
299
|
312
|
for(let i = 0; i < tempPatientsThree.length;i++){
|
300
|
313
|
let sum = 0
|
301
|
314
|
for(let b = 0; b < tempPatientsThree[i].items.length;b++){
|
302
|
|
- let obj = {
|
|
315
|
+ let obj2 = {
|
303
|
316
|
name:tempPatientsThree[i].items[b].name,
|
304
|
317
|
cost_classify:tempPatientsThree[i].items[b].cost_classify,
|
305
|
318
|
price:tempPatientsThree[i].items[b].price,
|
306
|
|
- patient_id:tempPatientsThree[i].items[b].patient_id,
|
|
319
|
+ patient_id:tempPatientsThree[i].patient_id,
|
307
|
320
|
item_name:tempPatientsThree[i].items[b].item_name,
|
308
|
321
|
sum:0,
|
309
|
322
|
}
|
310
|
323
|
sum = sum + tempPatientsThree[i].items[b].price
|
311
|
|
- this.tableData.push(obj)
|
312
|
|
- this.all_table_data.push(obj)
|
|
324
|
+ console.log(obj2)
|
|
325
|
+ this.tableData.push(obj2)
|
|
326
|
+ this.all_table_data.push(obj2)
|
313
|
327
|
}
|
|
328
|
+
|
314
|
329
|
for(let c = 0; c < this.tableData.length;c++){
|
315
|
330
|
if(tempPatientsThree[i].patient_id == this.tableData[c].patient_id){
|
316
|
331
|
this.tableData[c].sum = sum
|
|
@@ -335,6 +350,7 @@ export default {
|
335
|
350
|
this.tableData = new_table_data
|
336
|
351
|
}
|
337
|
352
|
this.handleSpanTempArr()
|
|
353
|
+ // this.getTotal()
|
338
|
354
|
}
|
339
|
355
|
})
|
340
|
356
|
},getName(cost_classify){
|
|
@@ -384,10 +400,7 @@ export default {
|
384
|
400
|
}
|
385
|
401
|
return res
|
386
|
402
|
},unique3(array) {
|
387
|
|
- console.log("-----11122222")
|
388
|
403
|
|
389
|
|
- console.log(array)
|
390
|
|
- // res用来存储结果
|
391
|
404
|
var res = []
|
392
|
405
|
for (var i = 0, arrayLen = array.length; i < arrayLen; i++) {
|
393
|
406
|
for (var j = 0, resLen = res.length; j < resLen; j++) {
|
|
@@ -401,18 +414,6 @@ export default {
|
401
|
414
|
}
|
402
|
415
|
}
|
403
|
416
|
return res
|
404
|
|
- }, sort(arr) {
|
405
|
|
- for (var i = 0; i < arr.length - 1; i++) {
|
406
|
|
- for (var j = 0; j < arr.length - i - 1; j++) {
|
407
|
|
- if (arr[j].patient_id > arr[j + 1].patient_id) {// 相邻元素两两对比
|
408
|
|
- var hand = arr[j]
|
409
|
|
- arr[j] = arr[j + 1]
|
410
|
|
- arr[j + 1] = hand
|
411
|
|
-
|
412
|
|
- }
|
413
|
|
- }
|
414
|
|
- }
|
415
|
|
- return arr
|
416
|
417
|
}, handleSpanTempArr() {
|
417
|
418
|
this.tempArr = []
|
418
|
419
|
|
|
@@ -431,8 +432,8 @@ export default {
|
431
|
432
|
}
|
432
|
433
|
}
|
433
|
434
|
}
|
434
|
|
- console.log('this.tableData',this.tableData);
|
435
|
|
-
|
|
435
|
+ // console.log('this.tableData',this.tableData);
|
|
436
|
+
|
436
|
437
|
let sameRowArr = [], sIdx = 0
|
437
|
438
|
this.tableData.forEach((item, index) => {
|
438
|
439
|
item.index = index
|
|
@@ -448,8 +449,8 @@ export default {
|
448
|
449
|
}
|
449
|
450
|
})
|
450
|
451
|
this.sameRowArr = sameRowArr
|
451
|
|
- console.log('this.sameRowArr',this.sameRowArr);
|
452
|
|
-
|
|
452
|
+ // console.log('this.sameRowArr',this.sameRowArr);
|
|
453
|
+
|
453
|
454
|
}, merge({ row, column, rowIndex, columnIndex }) {
|
454
|
455
|
if (columnIndex === 0 || columnIndex === 3) {
|
455
|
456
|
const _row = this.tempArr[rowIndex]
|
|
@@ -459,26 +460,51 @@ export default {
|
459
|
460
|
colspan: _col
|
460
|
461
|
}
|
461
|
462
|
}
|
462
|
|
- }, getTotal(param) {
|
|
463
|
+ }, deepCopy(obj) {
|
|
464
|
+ if ((obj === null) || (typeof obj !== 'object')) {
|
|
465
|
+ return obj;
|
|
466
|
+ }
|
|
467
|
+
|
|
468
|
+ if (obj instanceof Date) {
|
|
469
|
+ return new Date(obj.getTime());
|
|
470
|
+ }
|
|
471
|
+
|
|
472
|
+ if (obj instanceof Array) {
|
|
473
|
+ return obj.reduce((arr, item, i) => {
|
|
474
|
+ arr[i] = this.deepCopy(item);
|
|
475
|
+ return arr;
|
|
476
|
+ }, []);
|
|
477
|
+ }
|
|
478
|
+
|
|
479
|
+ if (obj instanceof Object) {
|
|
480
|
+ return Object.keys(obj).reduce((newObj, key) => {
|
|
481
|
+ newObj[key] = this.deepCopy(obj[key]);
|
|
482
|
+ return newObj;
|
|
483
|
+ }, {});
|
|
484
|
+ }
|
|
485
|
+ },getTotal(param) {
|
463
|
486
|
const { columns, data } = param
|
464
|
487
|
const sums = []
|
|
488
|
+ console.log(data)
|
465
|
489
|
columns.forEach((column, index) => {
|
466
|
490
|
if (index === 0) {
|
467
|
491
|
sums[index] = '合计'
|
468
|
492
|
return
|
469
|
493
|
}
|
470
|
|
- console.log('data',data)
|
471
|
|
- for(let i=0;i<data.length;i++){
|
472
|
|
- for(let j=i+1;j<data.length;j++){
|
473
|
|
- if(data[i].patient_id == data[j].patient_id){
|
474
|
|
- data.splice(j,1)
|
|
494
|
+ var data2 = this.deepCopy(data)
|
|
495
|
+ // var data2 = data
|
|
496
|
+ // console.log('data',data)
|
|
497
|
+ for(let i=0;i<data2.length;i++){
|
|
498
|
+ for(let j=i+1;j<data2.length;j++){
|
|
499
|
+ if(data2[i].patient_id == data2[j].patient_id){
|
|
500
|
+ data2.splice(j,1)
|
475
|
501
|
j--
|
476
|
502
|
}
|
477
|
503
|
}
|
478
|
504
|
}
|
479
|
|
- console.log('data111',data);
|
480
|
|
-
|
481
|
|
- const values = data.map(item => Number(item[column.property]))
|
|
505
|
+ // console.log('data111',data);
|
|
506
|
+
|
|
507
|
+ const values = data2.map(item => Number(item[column.property]))
|
482
|
508
|
if (column.property === 'sum') {
|
483
|
509
|
sums[index] = values.reduce((prev, curr) => {
|
484
|
510
|
const value = Number(curr)
|