陈少旭 8 месяцев назад
Родитель
Сommit
77fb69b332
2 измененных файлов: 528 добавлений и 184 удалений
  1. 400 0
      src/xt_pages/outpatientTool/components/allgather.vue
  2. 128 184
      src/xt_pages/outpatientTool/components/gather.vue

+ 400 - 0
src/xt_pages/outpatientTool/components/allgather.vue Просмотреть файл

1
+<template>
2
+  <div>
3
+    <div style="display: flex;justify-content: space-between;margin-bottom:10px;">
4
+      <div>
5
+
6
+
7
+        <el-select size="small" v-model="item_time_type" placeholder="请选择"
8
+                   style="width:150px;margin-left:10px;" @change="changeTimeItem">
9
+
10
+          <el-option
11
+            label="处方时间"
12
+            value="0">
13
+          </el-option>
14
+
15
+          <el-option
16
+            label="结算时间"
17
+            value="1">
18
+          </el-option>
19
+
20
+        </el-select>
21
+        <el-date-picker
22
+          v-model="chargeDate"
23
+          type="daterange"
24
+          value-format="yyyy-MM-dd"
25
+          range-separator="至"
26
+          start-placeholder="开始日期"
27
+          @change="changeDate"
28
+          end-placeholder="结束日期">
29
+        </el-date-picker>
30
+      </div>
31
+      <div>
32
+
33
+        <el-button size="small" type="primary" @click="export_detail">报表下载</el-button>
34
+      </div>
35
+    </div>
36
+    <el-table :data="tableData" border :row-style="{ color: '#303133' }" ref="tables"
37
+              :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
38
+              v-loading="gather_loading"
39
+              max-height="600"
40
+              :span-method="merge"
41
+              highlight-current-row>
42
+
43
+      <el-table-column align="center" prop="item_name" label="项目类别">
44
+        <template slot-scope="scope">{{ scope.row.item_name }}</template>
45
+      </el-table-column>
46
+      <el-table-column align="center" prop="price" label="费用">
47
+        <template slot-scope="scope">{{ scope.row.price.toFixed(2) }}</template>
48
+      </el-table-column>
49
+      <el-table-column align="center" prop="sum" label="费用总额">
50
+        <template slot-scope="scope">
51
+          <div>{{ scope.row.sum.toFixed(2) }}</div>
52
+        </template>
53
+      </el-table-column>
54
+
55
+    </el-table>
56
+  </div>
57
+</template>
58
+
59
+
60
+<script>
61
+import { getDictionaryDataConfig } from '@/utils/data'
62
+import BreadCrumb from '@/xt_pages/components/bread-crumb'
63
+import { GetSummaryDetail } from '@/api/his/his'
64
+// import NewStatementPrint from './newStatementPrint'
65
+const moment = require('moment')
66
+export default {
67
+  components: {
68
+    BreadCrumb
69
+
70
+  },
71
+  data() {
72
+    return {
73
+      gather_loading: false,
74
+      crumbs: [],
75
+      tempArr: [],
76
+      sameRowArr: [],
77
+      keywords: '',
78
+      pos: 0,
79
+      all_table_data: [],
80
+      costClassify: getDictionaryDataConfig('system', 'cost_classify'),
81
+      tableData: [],
82
+      chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
83
+      item_type: '0',
84
+      new_item_type: 0,
85
+      item_time_type: '1',
86
+      items: [
87
+        { id: 1, name: '药品' },
88
+        { id: 4, name: '检验费' },
89
+        { id: 5, name: '治疗费' },
90
+        { id: 6, name: '护理费' },
91
+        { id: 7, name: '其他' },
92
+        { id: 3, name: '耗材' }
93
+
94
+      ]
95
+
96
+    }
97
+  },
98
+  methods: {
99
+
100
+    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
101
+      if (columnIndex === 0) {
102
+        if (rowIndex % 2 === 0) {
103
+          return {
104
+            rowspan: 2,
105
+            colspan: 1
106
+          }
107
+        } else {
108
+          return {
109
+            rowspan: 0,
110
+            colspan: 0
111
+          }
112
+        }
113
+      }
114
+    },
115
+    unique(arr) {
116
+      const res = new Map()
117
+      return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1))
118
+    },
119
+    changeDate() {
120
+      // console.log(this.chargeDate)
121
+      this.getSummaryDetailList()
122
+    }, changeTimeItem() {
123
+      this.getSummaryDetailList()
124
+    },
125
+    changeItem() {
126
+      this.new_item_type = this.item_type
127
+      if (this.item_type == 1) {
128
+        this.new_item_type = -100
129
+      } else if (this.item_type == 5) {
130
+        this.new_item_type = -200
131
+      }
132
+      this.getSummaryDetailList()
133
+    }, uniquepid(arr) {
134
+      const res = new Map()
135
+      return arr.filter((arr) => !res.has(arr.p_id) && res.set(arr.p_id, 1))
136
+    },
137
+    searchAction() {
138
+      this.item_type = '0'
139
+      this.getSummaryDetailList()
140
+    },
141
+    getSummaryDetailList() {
142
+      this.gather_loading = true
143
+      let start_time = this.chargeDate[0]
144
+      let end_time = this.chargeDate[1]
145
+      let params = {
146
+        start_time: start_time,
147
+        end_time: end_time,
148
+        type: 0,
149
+        keyword: this.keywords,
150
+        time_type: this.item_time_type
151
+      }
152
+      GetSummaryDetail(params).then(response => {
153
+        if (response.data.state == 0) {
154
+          this.gather_loading = false
155
+
156
+          this.$message.error(response.data.msg)
157
+          return false
158
+        } else {
159
+          this.gather_loading = false
160
+
161
+          let tempPatients = []
162
+          let tempPatientsTwo = []
163
+          this.tableData = []
164
+          this.all_table_data = []
165
+
166
+          let tempData = response.data
167
+          tempPatientsTwo = tempData
168
+
169
+          let infos = this.unique2(tempPatientsTwo)
170
+          let sum = 0
171
+          for (let e = 0; e < infos.length; e++) {
172
+            let obj = {
173
+              'sum': 0,
174
+              'price': 0,
175
+              'cost_classify': infos[e].cost_classify,
176
+              'item_name': this.getName(infos[e].cost_classify)
177
+            }
178
+            let price = 0
179
+            for (let d = 0; d < tempPatientsTwo.length; d++) {
180
+              if (tempPatientsTwo[d].cost_classify == infos[e].cost_classify) {
181
+                price = parseFloat(price.toString()) + parseFloat((parseFloat(tempPatientsTwo[d].cnt.toString()) * parseFloat(tempPatientsTwo[d].pric.toString()).toFixed(2)).toString())
182
+              }
183
+              obj.price = price
184
+            }
185
+            sum = sum + price
186
+
187
+            this.tableData.push(obj)
188
+          }
189
+          for(let i = 0; i < this.tableData.length;i++){
190
+            this.tableData[i].sum = sum
191
+          }
192
+
193
+          // for (let i = 0; i < tempPatientsThree.length; i++) {
194
+          //   let sum = 0
195
+          //   for (let b = 0; b < tempPatientsThree[i].length; b++) {
196
+          //     let obj = {
197
+          //       cost_classify: tempPatientsThree[i].items[b].cost_classify,
198
+          //       price: tempPatientsThree[i].items[b].price,
199
+          //       item_name: tempPatientsThree[i].items[b].item_name,
200
+          //       sum: 0
201
+          //     }
202
+          //     sum = sum + tempPatientsThree[i].items[b].price
203
+          //     this.tableData.push(obj)
204
+          //     this.all_table_data.push(obj)
205
+          //   }
206
+          //   for (let c = 0; c < this.tableData.length; c++) {
207
+          //     this.tableData[c].sum = sum
208
+          //   }
209
+          // }
210
+
211
+          console.log(this.tableData)
212
+
213
+          this.handleSpanTempArr()
214
+        }
215
+      })
216
+    }, getName(cost_classify) {
217
+      if (cost_classify == -1000) {
218
+        return '药品费'
219
+      } else if (cost_classify == -100) {
220
+        return '耗材费'
221
+      } else {
222
+        var costClassify = getDictionaryDataConfig('system', 'cost_classify')
223
+        var name = ''
224
+        for (let i = 0; i < costClassify.length; i++) {
225
+          if (cost_classify == costClassify[i].id) {
226
+            name = costClassify[i].name
227
+          }
228
+        }
229
+        return name
230
+      }
231
+    }, uniqueProjectAndAdvice(array) {
232
+      // res用来存储结果
233
+      var res = []
234
+      for (var i = 0, arrayLen = array.length; i < arrayLen; i++) {
235
+        for (var j = 0, resLen = res.length; j < resLen; j++) {
236
+          if (array[i].item_id === res[j].item_id && array[i].price === res[j].price) {
237
+            break
238
+          }
239
+        }
240
+        // 如果array[i]是唯一的,那么执行完循环,j等于resLen
241
+        if (j === resLen) {
242
+          res.push(array[i])
243
+        }
244
+      }
245
+      return res
246
+    }, unique2(array) {
247
+
248
+      // res用来存储结果
249
+      var res = []
250
+      for (var i = 0, arrayLen = array.length; i < arrayLen; i++) {
251
+        for (var j = 0, resLen = res.length; j < resLen; j++) {
252
+          if (array[i].cost_classify === res[j].cost_classify) {
253
+            break
254
+          }
255
+        }
256
+        // 如果array[i]是唯一的,那么执行完循环,j等于resLen
257
+        if (j === resLen) {
258
+          res.push(array[i])
259
+        }
260
+      }
261
+      return res
262
+    }, unique3(array) {
263
+      console.log('-----11122222')
264
+
265
+      console.log(array)
266
+      // res用来存储结果
267
+      var res = []
268
+      for (var i = 0, arrayLen = array.length; i < arrayLen; i++) {
269
+        for (var j = 0, resLen = res.length; j < resLen; j++) {
270
+          if (array[i].patient_id === res[j].patient_id) {
271
+            break
272
+          }
273
+        }
274
+        // 如果array[i]是唯一的,那么执行完循环,j等于resLen
275
+        if (j === resLen) {
276
+          res.push(array[i])
277
+        }
278
+      }
279
+      return res
280
+    }, sort(arr) {
281
+      for (var i = 0; i < arr.length - 1; i++) {
282
+        for (var j = 0; j < arr.length - i - 1; j++) {
283
+          if (arr[j].patient_id > arr[j + 1].patient_id) {// 相邻元素两两对比
284
+            var hand = arr[j]
285
+            arr[j] = arr[j + 1]
286
+            arr[j + 1] = hand
287
+
288
+          }
289
+        }
290
+      }
291
+      return arr
292
+    }, handleSpanTempArr() {
293
+      this.tempArr = []
294
+
295
+      for (let i = 0; i < this.tableData.length; i++) {
296
+        if (i === 0) {
297
+          this.tempArr.push(1)
298
+          this.pos = 0
299
+        } else {
300
+          // 判断当前元素与上一个元素是否相同
301
+          if (this.tableData[i].patient_id === this.tableData[i - 1].patient_id) {
302
+            this.tempArr[this.pos] += 1
303
+            this.tempArr.push(0)
304
+          } else {
305
+            this.tempArr.push(1)
306
+            this.pos = i
307
+          }
308
+        }
309
+      }
310
+
311
+      let sameRowArr = [], sIdx = 0
312
+      this.tableData.forEach((item, index) => {
313
+        item.index = index
314
+        if (index === 0) {
315
+          sameRowArr.push([index])
316
+        } else {
317
+          if (item.patient_id === this.tableData[index - 1].patient_id) {
318
+            sameRowArr[sIdx].push(index)
319
+          } else {
320
+            sIdx = sIdx + 1
321
+            sameRowArr.push([index])
322
+          }
323
+        }
324
+      })
325
+      this.sameRowArr = sameRowArr
326
+    }, merge({ row, column, rowIndex, columnIndex }) {
327
+      if ( columnIndex === 2) {
328
+        const _row = this.tempArr[rowIndex]
329
+        const _col = _row > 0 ? 1 : 0
330
+        return {
331
+          rowspan: _row,
332
+          colspan: _col
333
+        }
334
+      }
335
+    }, getTotal(param) {
336
+      const { columns, data } = param
337
+      const sums = []
338
+      columns.forEach((column, index) => {
339
+        if (index === 0) {
340
+          sums[index] = '合计'
341
+          return
342
+        }
343
+        console.log(data)
344
+        const values = data.map(item => Number(item[column.property]))
345
+        if (column.property === 'sum') {
346
+          sums[index] = values.reduce((prev, curr) => {
347
+            const value = Number(curr)
348
+            if (!isNaN(value)) {
349
+              return prev + curr
350
+            } else {
351
+              return prev
352
+            }
353
+          }, 0)
354
+          sums[index] = sums[index].toFixed(2)
355
+        } else {
356
+          sums[index] = ''
357
+        }
358
+      })
359
+
360
+      return sums
361
+    }, export_detail() {
362
+
363
+      let list = []
364
+      for (let i = 0; i < this.tableData.length; i++) {
365
+        let order = this.tableData[i]
366
+        let name = order.name
367
+        let item_name = order.item_name
368
+        let pay_sumamt = order.price.toFixed(2)
369
+        let total = order.sum.toFixed(2)
370
+
371
+        let obj = {
372
+          '患者姓名': name,
373
+          '项目类别': item_name,
374
+          '费用': pay_sumamt,
375
+          '费用总额': total
376
+        }
377
+        list.push(obj)
378
+      }
379
+      import('@/vendor/Export2Excel').then(excel => {
380
+        const tHeader = ['患者姓名', '项目名称', '费用', '费用总额']
381
+        const filterVal = ['患者姓名', '项目名称', '费用', '费用总额']
382
+        const data = this.formatJson(filterVal, list)
383
+        excel.export_json_to_excel1({
384
+          header: tHeader,
385
+          data,
386
+          filename: '汇总',
387
+          ref: this.$refs['tables'].$el
388
+        })
389
+      })
390
+
391
+    }, formatJson(filterVal, jsonData) {
392
+      return jsonData.map(v => filterVal.map(j => v[j]))
393
+    }
394
+  },
395
+  created() {
396
+    this.getSummaryDetailList()
397
+
398
+  }
399
+}
400
+</script>

+ 128 - 184
src/xt_pages/outpatientTool/components/gather.vue Просмотреть файл

18
             value="0">
18
             value="0">
19
           </el-option>
19
           </el-option>
20
           <el-option
20
           <el-option
21
-            v-for="item,index in items"
21
+            v-for="item,index in costClassify"
22
             :key="index"
22
             :key="index"
23
             :label="item.name"
23
             :label="item.name"
24
             :value="item.id">
24
             :value="item.id">
97
 
97
 
98
 
98
 
99
 <script>
99
 <script>
100
+import { getDictionaryDataConfig } from "@/utils/data";
100
 import BreadCrumb from '@/xt_pages/components/bread-crumb'
101
 import BreadCrumb from '@/xt_pages/components/bread-crumb'
101
 import { GetSummaryDetail } from '@/api/his/his'
102
 import { GetSummaryDetail } from '@/api/his/his'
102
 import { uParseTime } from '@/utils/tools'
103
 import { uParseTime } from '@/utils/tools'
115
       sameRowArr: [],
116
       sameRowArr: [],
116
       keywords: '',
117
       keywords: '',
117
       pos:0,
118
       pos:0,
118
-
119
+      all_table_data:[],
120
+       costClassify:getDictionaryDataConfig('system','cost_classify'),
119
       tableData: [],
121
       tableData: [],
120
       chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
122
       chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
121
       item_type: '0',
123
       item_type: '0',
124
+      new_item_type:0,
122
       item_time_type:'1',
125
       item_time_type:'1',
123
       items: [
126
       items: [
124
         { id: 1, name: '药品' },
127
         { id: 1, name: '药品' },
125
-        { id: 2, name: '所有项目' },
126
         { id: 4, name: '检验费' },
128
         { id: 4, name: '检验费' },
127
         { id: 5, name: '治疗费' },
129
         { id: 5, name: '治疗费' },
128
         { id: 6, name: '护理费' },
130
         { id: 6, name: '护理费' },
129
         { id: 7, name: '其他' },
131
         { id: 7, name: '其他' },
130
-
131
         { id: 3, name: '耗材' },
132
         { id: 3, name: '耗材' },
132
 
133
 
133
       ]
134
       ]
162
       this.getSummaryDetailList()
163
       this.getSummaryDetailList()
163
     },
164
     },
164
     changeItem() {
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
       this.getSummaryDetailList()
172
       this.getSummaryDetailList()
166
     }, uniquepid(arr) {
173
     }, uniquepid(arr) {
167
       const res = new Map()
174
       const res = new Map()
178
       let params = {
185
       let params = {
179
         start_time: start_time,
186
         start_time: start_time,
180
         end_time: end_time,
187
         end_time: end_time,
181
-        type: this.item_type,
188
+        type: 0,
182
         keyword: this.keywords,
189
         keyword: this.keywords,
183
         time_type:this.item_time_type,
190
         time_type:this.item_time_type,
184
       }
191
       }
194
           let tempPatients = []
201
           let tempPatients = []
195
           let tempPatientsTwo = []
202
           let tempPatientsTwo = []
196
           this.tableData = []
203
           this.tableData = []
204
+          this.all_table_data = []
205
+
197
           let tempData = response.data
206
           let tempData = response.data
198
           let data = response.data
207
           let data = response.data
199
           let orders = this.uniquepid(tempData)
208
           let orders = this.uniquepid(tempData)
212
             }
221
             }
213
             tempPatients.push(obj)
222
             tempPatients.push(obj)
214
           }
223
           }
215
-          console.log(tempPatients)
216
 
224
 
217
           for (let i = 0; i < tempPatients.length; i++) {
225
           for (let i = 0; i < tempPatients.length; i++) {
218
             let obj = {
226
             let obj = {
230
                   newObj['type'] = 1
238
                   newObj['type'] = 1
231
                   newObj['item_name'] = orders[c].item_name
239
                   newObj['item_name'] = orders[c].item_name
232
                   newObj['item_id'] = orders[c].item_id
240
                   newObj['item_id'] = orders[c].item_id
233
-
241
+                  newObj['cost_classify'] = -100 //药品
234
                 }
242
                 }
235
                 if (orders[c].advice_id == 0 && orders[c].project_id > 0) {
243
                 if (orders[c].advice_id == 0 && orders[c].project_id > 0) {
236
                   newObj['item_id'] = orders[c].item_id
244
                   newObj['item_id'] = orders[c].item_id
237
                   if (orders[c].p_type == 2) {
245
                   if (orders[c].p_type == 2) {
238
                     newObj['type'] = 2
246
                     newObj['type'] = 2
239
                     newObj['item_name'] = orders[c].item_name
247
                     newObj['item_name'] = orders[c].item_name
248
+                    newObj['cost_classify'] = orders[c].cost_classify //项目
249
+
240
                   } else if (orders[c].p_type == 3) {
250
                   } else if (orders[c].p_type == 3) {
241
                     newObj['type'] = 3
251
                     newObj['type'] = 3
242
                     newObj['item_name'] = orders[c].item_name
252
                     newObj['item_name'] = orders[c].item_name
253
+                    newObj['cost_classify'] = -200 //耗材
254
+
243
                   }
255
                   }
244
                 }
256
                 }
245
                 obj.order_info.push(newObj)
257
                 obj.order_info.push(newObj)
246
               }
258
               }
247
             tempPatientsTwo.push(obj)
259
             tempPatientsTwo.push(obj)
248
           }
260
           }
249
-          console.log(tempPatientsTwo)
250
 
261
 
262
+
263
+
264
+          var tempPatientsThree = []
251
           for (let d = 0; d < tempPatientsTwo.length; d++) {
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
           this.handleSpanTempArr()
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
     }, uniqueProjectAndAdvice(array) {
353
     }, uniqueProjectAndAdvice(array) {
444
       // res用来存储结果
354
       // res用来存储结果
445
       var res = []
355
       var res = []
455
         }
365
         }
456
       }
366
       }
457
       return res
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
     }, sort(arr) {
402
     }, sort(arr) {
459
       for (var i = 0; i < arr.length - 1; i++) {
403
       for (var i = 0; i < arr.length - 1; i++) {
460
         for (var j = 0; j < arr.length - i - 1; j++) {
404
         for (var j = 0; j < arr.length - i - 1; j++) {