|
@@ -18,7 +18,7 @@
|
18
|
18
|
value="0">
|
19
|
19
|
</el-option>
|
20
|
20
|
<el-option
|
21
|
|
- v-for="item,index in items"
|
|
21
|
+ v-for="item,index in costClassify"
|
22
|
22
|
:key="index"
|
23
|
23
|
:label="item.name"
|
24
|
24
|
:value="item.id">
|
|
@@ -97,6 +97,7 @@
|
97
|
97
|
|
98
|
98
|
|
99
|
99
|
<script>
|
|
100
|
+import { getDictionaryDataConfig } from "@/utils/data";
|
100
|
101
|
import BreadCrumb from '@/xt_pages/components/bread-crumb'
|
101
|
102
|
import { GetSummaryDetail } from '@/api/his/his'
|
102
|
103
|
import { uParseTime } from '@/utils/tools'
|
|
@@ -115,19 +116,19 @@ export default {
|
115
|
116
|
sameRowArr: [],
|
116
|
117
|
keywords: '',
|
117
|
118
|
pos:0,
|
118
|
|
-
|
|
119
|
+ all_table_data:[],
|
|
120
|
+ costClassify:getDictionaryDataConfig('system','cost_classify'),
|
119
|
121
|
tableData: [],
|
120
|
122
|
chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
|
121
|
123
|
item_type: '0',
|
|
124
|
+ new_item_type:0,
|
122
|
125
|
item_time_type:'1',
|
123
|
126
|
items: [
|
124
|
127
|
{ id: 1, name: '药品' },
|
125
|
|
- { id: 2, name: '所有项目' },
|
126
|
128
|
{ id: 4, name: '检验费' },
|
127
|
129
|
{ id: 5, name: '治疗费' },
|
128
|
130
|
{ id: 6, name: '护理费' },
|
129
|
131
|
{ id: 7, name: '其他' },
|
130
|
|
-
|
131
|
132
|
{ id: 3, name: '耗材' },
|
132
|
133
|
|
133
|
134
|
]
|
|
@@ -162,6 +163,12 @@ export default {
|
162
|
163
|
this.getSummaryDetailList()
|
163
|
164
|
},
|
164
|
165
|
changeItem() {
|
|
166
|
+ this.new_item_type = this.item_type
|
|
167
|
+ if(this.item_type == 1){
|
|
168
|
+ this.new_item_type = -100
|
|
169
|
+ }else if(this.item_type == 5){
|
|
170
|
+ this.new_item_type = -200
|
|
171
|
+ }
|
165
|
172
|
this.getSummaryDetailList()
|
166
|
173
|
}, uniquepid(arr) {
|
167
|
174
|
const res = new Map()
|
|
@@ -178,7 +185,7 @@ export default {
|
178
|
185
|
let params = {
|
179
|
186
|
start_time: start_time,
|
180
|
187
|
end_time: end_time,
|
181
|
|
- type: this.item_type,
|
|
188
|
+ type: 0,
|
182
|
189
|
keyword: this.keywords,
|
183
|
190
|
time_type:this.item_time_type,
|
184
|
191
|
}
|
|
@@ -194,6 +201,8 @@ export default {
|
194
|
201
|
let tempPatients = []
|
195
|
202
|
let tempPatientsTwo = []
|
196
|
203
|
this.tableData = []
|
|
204
|
+ this.all_table_data = []
|
|
205
|
+
|
197
|
206
|
let tempData = response.data
|
198
|
207
|
let data = response.data
|
199
|
208
|
let orders = this.uniquepid(tempData)
|
|
@@ -212,7 +221,6 @@ export default {
|
212
|
221
|
}
|
213
|
222
|
tempPatients.push(obj)
|
214
|
223
|
}
|
215
|
|
- console.log(tempPatients)
|
216
|
224
|
|
217
|
225
|
for (let i = 0; i < tempPatients.length; i++) {
|
218
|
226
|
let obj = {
|
|
@@ -230,216 +238,118 @@ export default {
|
230
|
238
|
newObj['type'] = 1
|
231
|
239
|
newObj['item_name'] = orders[c].item_name
|
232
|
240
|
newObj['item_id'] = orders[c].item_id
|
233
|
|
-
|
|
241
|
+ newObj['cost_classify'] = -100 //药品
|
234
|
242
|
}
|
235
|
243
|
if (orders[c].advice_id == 0 && orders[c].project_id > 0) {
|
236
|
244
|
newObj['item_id'] = orders[c].item_id
|
237
|
245
|
if (orders[c].p_type == 2) {
|
238
|
246
|
newObj['type'] = 2
|
239
|
247
|
newObj['item_name'] = orders[c].item_name
|
|
248
|
+ newObj['cost_classify'] = orders[c].cost_classify //项目
|
|
249
|
+
|
240
|
250
|
} else if (orders[c].p_type == 3) {
|
241
|
251
|
newObj['type'] = 3
|
242
|
252
|
newObj['item_name'] = orders[c].item_name
|
|
253
|
+ newObj['cost_classify'] = -200 //耗材
|
|
254
|
+
|
243
|
255
|
}
|
244
|
256
|
}
|
245
|
257
|
obj.order_info.push(newObj)
|
246
|
258
|
}
|
247
|
259
|
tempPatientsTwo.push(obj)
|
248
|
260
|
}
|
249
|
|
- console.log(tempPatientsTwo)
|
250
|
261
|
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+ var tempPatientsThree = []
|
251
|
265
|
for (let d = 0; d < tempPatientsTwo.length; d++) {
|
252
|
|
- tempPatientsTwo[d]['new_order_info'] = []
|
253
|
|
- let project = []
|
254
|
|
- let advice = []
|
255
|
|
- for (let b = 0; b < tempPatientsTwo[d].order_info.length; b++) {
|
256
|
|
- if (tempPatientsTwo[d].order_info[b].type == 1) {
|
257
|
|
- advice.push(tempPatientsTwo[d].order_info[b])
|
258
|
|
- } else {
|
259
|
|
- project.push(tempPatientsTwo[d].order_info[b])
|
|
266
|
+ let new_obj={
|
|
267
|
+ patient_id:tempPatientsTwo[d].patient_id,
|
|
268
|
+ items:[],
|
|
269
|
+ }
|
|
270
|
+
|
|
271
|
+ let infos = this.unique2(tempPatientsTwo[d].order_info)
|
|
272
|
+ for(let e = 0; e < infos.length; e++){
|
|
273
|
+ let price = 0
|
|
274
|
+ for(let f = 0; f < tempPatientsTwo[d].order_info.length; f++){
|
|
275
|
+ if (tempPatientsTwo[d].order_info[f].cost_classify == infos[e].cost_classify){
|
|
276
|
+ price = parseFloat(price.toString()) + parseFloat((parseFloat(tempPatientsTwo[d].order_info[f].count.toString()) * parseFloat(tempPatientsTwo[d].order_info[f].price.toString()).toFixed(2)).toString())
|
|
277
|
+ }
|
260
|
278
|
}
|
|
279
|
+ let obj = {
|
|
280
|
+ "sum":0,
|
|
281
|
+ "price": price,
|
|
282
|
+ "cost_classify":infos[e].cost_classify,
|
|
283
|
+ "item_name":this.getName(infos[e].cost_classify),
|
|
284
|
+ "patient_id":tempPatientsTwo[d].patient_id,
|
|
285
|
+ "name":tempPatientsTwo[d].name,
|
|
286
|
+ }
|
|
287
|
+ new_obj.items.push(obj)
|
261
|
288
|
}
|
262
|
|
- // project = this.uniqueProjectAndAdvice(project)
|
263
|
|
- // advice = this.uniqueProjectAndAdvice(advice)
|
264
|
289
|
|
265
|
|
- let obj = {}
|
266
|
|
- let price = 0
|
|
290
|
+ tempPatientsThree.push(new_obj)
|
|
291
|
+ }
|
267
|
292
|
|
268
|
|
- let obj2 = {}
|
269
|
|
- let price2 = 0
|
|
293
|
+ console.log("tempPatientsThree")
|
270
|
294
|
|
271
|
|
- let obj3 = {}
|
272
|
|
- let price3 = 0
|
|
295
|
+ console.log(tempPatientsThree)
|
273
|
296
|
|
274
|
|
- for (let i = 0; i < project.length; i++) {
|
275
|
|
- if (project[i].type == 2) {
|
276
|
|
- price = parseFloat(price.toString()) + parseFloat((parseFloat(project[i].count.toString()) * parseFloat(project[i].price.toString()).toFixed(2)).toString())
|
277
|
|
- } else if (project[i].type == 3) {
|
278
|
|
- price3 = parseFloat(price3.toString()) + parseFloat((parseFloat(project[i].count.toString()) * parseFloat(project[i].price.toString()).toFixed(2)).toString())
|
|
297
|
+ for(let i = 0; i < tempPatientsThree.length;i++){
|
|
298
|
+ let sum = 0
|
|
299
|
+ for(let b = 0; b < tempPatientsThree[i].items.length;b++){
|
|
300
|
+ let obj = {
|
|
301
|
+ name:tempPatientsThree[i].items[b].name,
|
|
302
|
+ cost_classify:tempPatientsThree[i].items[b].cost_classify,
|
|
303
|
+ price:tempPatientsThree[i].items[b].price,
|
|
304
|
+ patient_id:tempPatientsThree[i].items[b].patient_id,
|
|
305
|
+ item_name:tempPatientsThree[i].items[b].item_name,
|
|
306
|
+ sum:0,
|
279
|
307
|
}
|
|
308
|
+ sum = sum + tempPatientsThree[i].items[b].price
|
|
309
|
+ this.tableData.push(obj)
|
|
310
|
+ this.all_table_data.push(obj)
|
280
|
311
|
}
|
281
|
|
-
|
282
|
|
-
|
283
|
|
- for (let i = 0; i < advice.length; i++) {
|
284
|
|
- price2 = parseFloat(price2.toString()) + parseFloat((parseFloat(advice[i].count.toString()) * parseFloat(advice[i].price.toString()).toFixed(2)).toString())
|
|
312
|
+ for(let c = 0; c < this.tableData.length;c++){
|
|
313
|
+ if(tempPatientsThree[i].patient_id == this.tableData[c].patient_id){
|
|
314
|
+ this.tableData[c].sum = sum
|
|
315
|
+ }
|
285
|
316
|
}
|
286
|
|
-
|
287
|
|
-
|
288
|
|
- switch (parseInt(this.item_type)) {
|
289
|
|
- case 0:
|
290
|
|
-
|
291
|
|
- obj['sum'] = price + price2 + price3
|
292
|
|
- obj['price'] = price
|
293
|
|
- obj['item_name'] = '项目'
|
294
|
|
- obj['name'] = tempPatientsTwo[d].name
|
295
|
|
- obj['patient_id'] = tempPatientsTwo[d].patient_id
|
296
|
|
- this.tableData.push(obj)
|
297
|
|
-
|
298
|
|
- obj2['sum'] = 0
|
299
|
|
- obj2['price'] = price2
|
300
|
|
- obj2['item_name'] = '药品'
|
301
|
|
- obj2['name'] = tempPatientsTwo[d].name
|
302
|
|
- obj2['patient_id'] = tempPatientsTwo[d].patient_id
|
303
|
|
- this.tableData.push(obj2)
|
304
|
|
-
|
305
|
|
- obj3['sum'] = 0
|
306
|
|
- obj3['price'] = price3
|
307
|
|
- obj3['item_name'] = '耗材'
|
308
|
|
- obj3['name'] = tempPatientsTwo[d].name
|
309
|
|
- obj3['patient_id'] = tempPatientsTwo[d].patient_id
|
310
|
|
- this.tableData.push(obj3)
|
311
|
|
- break
|
312
|
|
- case 1:
|
313
|
|
- obj2['sum'] = price2
|
314
|
|
- obj2['price'] = price2
|
315
|
|
- obj2['item_name'] = '药品'
|
316
|
|
- obj2['name'] = tempPatientsTwo[d].name
|
317
|
|
- obj2['patient_id'] = tempPatientsTwo[d].patient_id
|
318
|
|
- this.tableData.push(obj2)
|
319
|
|
- break
|
320
|
|
- case 2:
|
321
|
|
-
|
322
|
|
- obj['sum'] = price
|
323
|
|
- obj['price'] = price
|
324
|
|
- obj['item_name'] = '项目'
|
325
|
|
- obj['name'] = tempPatientsTwo[d].name
|
326
|
|
- obj['patient_id'] = tempPatientsTwo[d].patient_id
|
327
|
|
- this.tableData.push(obj)
|
328
|
|
- break
|
329
|
|
- case 3:
|
330
|
|
- obj3['sum'] = price3
|
331
|
|
- obj3['price'] = price3
|
332
|
|
- obj3['item_name'] = '耗材'
|
333
|
|
- obj3['name'] = tempPatientsTwo[d].name
|
334
|
|
- obj3['patient_id'] = tempPatientsTwo[d].patient_id
|
335
|
|
- this.tableData.push(obj3)
|
336
|
|
- break
|
337
|
|
- case 4:
|
338
|
|
-
|
339
|
|
- obj['sum'] = price
|
340
|
|
- obj['price'] = price
|
341
|
|
- obj['item_name'] = '检验'
|
342
|
|
- obj['name'] = tempPatientsTwo[d].name
|
343
|
|
- obj['patient_id'] = tempPatientsTwo[d].patient_id
|
344
|
|
- this.tableData.push(obj)
|
345
|
|
- break
|
346
|
|
- case 5:
|
347
|
|
-
|
348
|
|
- obj['sum'] = price
|
349
|
|
- obj['price'] = price
|
350
|
|
- obj['item_name'] = '治疗'
|
351
|
|
- obj['name'] = tempPatientsTwo[d].name
|
352
|
|
- obj['patient_id'] = tempPatientsTwo[d].patient_id
|
353
|
|
- this.tableData.push(obj)
|
354
|
|
- break
|
355
|
|
- case 6:
|
356
|
|
-
|
357
|
|
- obj['sum'] = price
|
358
|
|
- obj['price'] = price
|
359
|
|
- obj['item_name'] = '护理'
|
360
|
|
- obj['name'] = tempPatientsTwo[d].name
|
361
|
|
- obj['patient_id'] = tempPatientsTwo[d].patient_id
|
362
|
|
- this.tableData.push(obj)
|
363
|
|
- break
|
364
|
|
- case 7:
|
365
|
|
-
|
366
|
|
- obj['sum'] = price
|
367
|
|
- obj['price'] = price
|
368
|
|
- obj['item_name'] = '其他'
|
369
|
|
- obj['name'] = tempPatientsTwo[d].name
|
370
|
|
- obj['patient_id'] = tempPatientsTwo[d].patient_id
|
371
|
|
- this.tableData.push(obj)
|
372
|
|
- break
|
373
|
|
-
|
|
317
|
+ for(let c = 0; c < this.all_table_data.length;c++){
|
|
318
|
+ if(tempPatientsThree[i].patient_id == this.all_table_data[c].patient_id){
|
|
319
|
+ this.all_table_data[c].sum = sum
|
|
320
|
+ }
|
374
|
321
|
}
|
375
|
|
-
|
376
|
|
-
|
377
|
|
-
|
378
|
322
|
}
|
379
|
323
|
|
|
324
|
+ if(this.new_item_type == 0){
|
|
325
|
+ this.tableData = this.all_table_data
|
|
326
|
+ }else{
|
|
327
|
+ let new_table_data = []
|
|
328
|
+ for(let aa = 0; aa < this.all_table_data.length; aa++){
|
|
329
|
+ if(this.new_item_type == this.all_table_data[aa].cost_classify){
|
|
330
|
+ new_table_data.push(this.all_table_data[aa])
|
|
331
|
+ }
|
|
332
|
+ }
|
|
333
|
+ this.tableData = new_table_data
|
|
334
|
+ }
|
380
|
335
|
this.handleSpanTempArr()
|
381
|
|
- // this.tableData = tempPatientsTwo
|
382
|
|
-
|
383
|
|
- // console.log(tempPatientsTwo.length)
|
384
|
|
- //
|
385
|
|
-
|
386
|
336
|
}
|
387
|
|
- //
|
388
|
|
- // console.log('去重前')
|
389
|
|
- // console.log(advice)
|
390
|
|
- // console.log(project)
|
391
|
|
- // //
|
392
|
|
- // //
|
393
|
|
-
|
394
|
|
- // //
|
395
|
|
- // console.log('去重后')
|
396
|
|
- //
|
397
|
|
- // console.log(advice.length)
|
398
|
|
- // console.log(project.length)
|
399
|
|
- //
|
400
|
|
- // for (let i = 0; i < project.length; i++) {
|
401
|
|
- // let obj = {}
|
402
|
|
- // let count = 0
|
403
|
|
- // for (let a = 0; a < tempPatientsTwo.length; a++) {
|
404
|
|
- // if (project[i].patient_id == tempPatientsTwo[a].patient_id && project[i].item_id == tempPatientsTwo[a].item_id && project[i].price == tempPatientsTwo[a].price) {
|
405
|
|
- // count = count + tempPatientsTwo[a].count
|
406
|
|
- // obj['count'] = count
|
407
|
|
- //
|
408
|
|
- // }
|
409
|
|
- // obj['price'] = project[i].price
|
410
|
|
- // obj['type'] = project[i].type
|
411
|
|
- // obj['item_name'] = project[i].item_name
|
412
|
|
- // obj['item_id'] = project[i].item_id
|
413
|
|
- // obj['name'] = project[i].name
|
414
|
|
- // obj['patient_id'] = project[i].patient_id
|
415
|
|
- // obj['count'] = count
|
416
|
|
- // this.tableData.push(obj)
|
417
|
|
- // }
|
418
|
|
- // }
|
419
|
|
- //
|
420
|
|
- //
|
421
|
|
- // for (let i = 0; i < advice.length; i++) {
|
422
|
|
- // let obj = {}
|
423
|
|
- // let count = 0
|
424
|
|
- // for (let a = 0; a < tempPatientsTwo.length; a++) {
|
425
|
|
- // if (advice[i].patient_id == tempPatientsTwo[a].patient_id && advice[i].item_id == tempPatientsTwo[a].item_id && advice[i].price == tempPatientsTwo[a].price) {
|
426
|
|
- // count = count + tempPatientsTwo[a].count
|
427
|
|
- // obj['count'] = count
|
428
|
|
- //
|
429
|
|
- // }
|
430
|
|
- // obj['price'] = advice[i].price
|
431
|
|
- // obj['type'] = advice[i].type
|
432
|
|
- // obj['item_name'] = advice[i].item_name
|
433
|
|
- // obj['item_id'] = advice[i].item_id
|
434
|
|
- // obj['name'] = advice[i].name
|
435
|
|
- // obj['patient_id'] = advice[i].patient_id
|
436
|
|
- // this.tableData.push(obj)
|
437
|
|
- // }
|
438
|
|
- // }
|
439
|
|
- // console.log(this.tableData.length)
|
440
|
|
- // this.tableData = this.sort(this.tableData)
|
441
|
|
-
|
442
|
337
|
})
|
|
338
|
+ },getName(cost_classify){
|
|
339
|
+ if (cost_classify == -100){
|
|
340
|
+ return "药品费"
|
|
341
|
+ }else if(cost_classify == -200){
|
|
342
|
+ return "耗材费"
|
|
343
|
+ }else{
|
|
344
|
+ var costClassify = getDictionaryDataConfig('system','cost_classify');
|
|
345
|
+ var name = "";
|
|
346
|
+ for(let i=0;i<costClassify.length;i++){
|
|
347
|
+ if(cost_classify == costClassify[i].id){
|
|
348
|
+ name = costClassify[i].name
|
|
349
|
+ }
|
|
350
|
+ }
|
|
351
|
+ return name
|
|
352
|
+ }
|
443
|
353
|
}, uniqueProjectAndAdvice(array) {
|
444
|
354
|
// res用来存储结果
|
445
|
355
|
var res = []
|
|
@@ -455,6 +365,40 @@ export default {
|
455
|
365
|
}
|
456
|
366
|
}
|
457
|
367
|
return res
|
|
368
|
+ },unique2(array) {
|
|
369
|
+
|
|
370
|
+ // res用来存储结果
|
|
371
|
+ var res = []
|
|
372
|
+ for (var i = 0, arrayLen = array.length; i < arrayLen; i++) {
|
|
373
|
+ for (var j = 0, resLen = res.length; j < resLen; j++) {
|
|
374
|
+ if (array[i].cost_classify === res[j].cost_classify) {
|
|
375
|
+ break
|
|
376
|
+ }
|
|
377
|
+ }
|
|
378
|
+ // 如果array[i]是唯一的,那么执行完循环,j等于resLen
|
|
379
|
+ if (j === resLen) {
|
|
380
|
+ res.push(array[i])
|
|
381
|
+ }
|
|
382
|
+ }
|
|
383
|
+ return res
|
|
384
|
+ },unique3(array) {
|
|
385
|
+ console.log("-----11122222")
|
|
386
|
+
|
|
387
|
+ console.log(array)
|
|
388
|
+ // res用来存储结果
|
|
389
|
+ var res = []
|
|
390
|
+ for (var i = 0, arrayLen = array.length; i < arrayLen; i++) {
|
|
391
|
+ for (var j = 0, resLen = res.length; j < resLen; j++) {
|
|
392
|
+ if (array[i].patient_id === res[j].patient_id) {
|
|
393
|
+ break
|
|
394
|
+ }
|
|
395
|
+ }
|
|
396
|
+ // 如果array[i]是唯一的,那么执行完循环,j等于resLen
|
|
397
|
+ if (j === resLen) {
|
|
398
|
+ res.push(array[i])
|
|
399
|
+ }
|
|
400
|
+ }
|
|
401
|
+ return res
|
458
|
402
|
}, sort(arr) {
|
459
|
403
|
for (var i = 0; i < arr.length - 1; i++) {
|
460
|
404
|
for (var j = 0; j < arr.length - i - 1; j++) {
|