Browse Source

518合并代码

XMLWAN 2 years ago
parent
commit
55698bc71e

+ 1 - 0
src/xt_pages/outpatientCharges/summaryDetail.vue View File

@@ -473,6 +473,7 @@ export default {
473 473
 
474 474
 
475 475
           var prescription = response.data.data.prescription
476
+          console.log("prescir233232322323232323",prescription)
476 477
           this.prescriptions = prescription
477 478
           this.setMonthPrescription(prescription)
478 479
 

+ 3 - 2
src/xt_pages/outpatientTool/components/detailStatistics.vue View File

@@ -160,6 +160,7 @@ export default {
160 160
 
161 161
       ],
162 162
       list:[],
163
+      
163 164
 
164 165
     }
165 166
   },
@@ -217,7 +218,7 @@ export default {
217 218
           }
218 219
           obj.total_price = (obj.total_price).toFixed(2)
219 220
           this.tableData.push(obj)
220
-          console.log("tabl2332322332323232323232323",this.tableData)
221
+         
221 222
           var new_arr = []
222 223
        
223 224
           if(this.keywords!=""){
@@ -260,7 +261,7 @@ export default {
260 261
       return total_price
261 262
     },
262 263
     getActPay(){
263
-      // console.log("hh23h323223323",this.list)
264
+      
264 265
       var act_pay = 0
265 266
       for(let i=0;i<this.list.length;i++){
266 267
         for(let j=0;j<this.list[i].orders.length;j++){

+ 556 - 81
src/xt_pages/outpatientTool/components/gatherStatistics.vue View File

@@ -46,7 +46,7 @@
46 46
       <div>
47 47
       </div>
48 48
     </div>
49
-    <el-table :data="list" border :row-style="{ color: '#303133' }" ref="table"
49
+    <el-table :data="tableList" border :row-style="{ color: '#303133' }" ref="table"
50 50
               :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
51 51
               max-height="600"
52 52
               v-loading="detail_loading"
@@ -61,7 +61,15 @@
61 61
       </el-table-column>
62 62
       <el-table-column align="center" prop="name" label="费用分类">
63 63
         <template slot-scope="scope">
64
-          {{ scope.row.med_chrgitm_type }}
64
+           <span v-if="scope.row.type == 1">
65
+              {{getAdviceMedChrgintmType(scope.row.advice_id)}}
66
+           </span>
67
+           <span v-if="scope.row.type == 2">
68
+             {{getProjectMedChrgintmType(scope.row.project_id)}}
69
+           </span>
70
+          <span v-if="scope.row.type == 3">
71
+              {{getProjectMedChrgintmType(scope.row.project_id)}}
72
+           </span>
65 73
         </template>
66 74
       </el-table-column>
67 75
       <el-table-column align="center" prop="name" label="项目名称">
@@ -76,7 +84,8 @@
76 84
       </el-table-column>
77 85
       <el-table-column align="center" prop="name" label="数量">
78 86
         <template slot-scope="scope">
79
-          {{ scope.row.count }}{{ scope.row.unit }}
87
+          {{ scope.row.count }}
88
+          {{ scope.row.unit }}
80 89
         </template>
81 90
       </el-table-column>
82 91
       <el-table-column align="center" prop="name" label="单价">
@@ -92,38 +101,49 @@
92 101
       </el-table-column>
93 102
       <el-table-column align="center" prop="name" label="医保类别">
94 103
         <template slot-scope="scope">
95
-         <span v-if="scope.row.chrgitm_lv== '01'">甲类</span>
96
-         <span v-if="scope.row.chrgitm_lv== '02'">乙类</span>
97
-         <span v-if="scope.row.chrgitm_lv== '03'">自费</span>
104
+         <span v-if="balanceAccountsType == 2">{{getChrgitmLv(scope.row.chrgitm_lv)}}</span>
105
+
106
+         <span v-if="balanceAccountsType != 2">
107
+           <span v-if="scope.row.type == 1">
108
+              {{getAdviceMedChrgintmLv(scope.row.advice_id)}}
109
+           </span>
110
+           <span v-if="scope.row.type == 2">
111
+             {{getProjectMedChrgintmLv(scope.row.project_id)}}
112
+           </span>
113
+          <span v-if="scope.row.type == 3">
114
+              {{getProjectMedChrgintmLv(scope.row.project_id)}}
115
+           </span>
116
+         </span>
98 117
         </template>
99 118
       </el-table-column>
100 119
 
101 120
     </el-table>
102 121
      <div>
103 122
       <div class="listInfo">
104
-            <div>西药:</div>
105
-            <div>中成药:{{chineseTraditionalMedicineCostTotal}}</div>
106
-            <div>中草药:</div>
123
+            <!-- <div>西药:{{westernMedicineCostTotal}}</div> -->
124
+            <div>西药:{{getWesternMedicineCostTotal()}}</div>
125
+            <div>中成药:{{getChineseTraditionalMedicineCostTotal()}}</div>
126
+            <div>中草药:{{getChineseTotal()}}</div>
107 127
         </div>
108 128
         <div class="listInfo">
109
-            <div>检查费:{{checkCostTotal}}</div>
110
-            <div>输氧费:</div>
111
-            <div>手术费:</div>
129
+            <div>检查费:{{getCheckCostTotal()}}</div>
130
+            <div>输氧费:{{getOxygen()}}</div>
131
+            <div>手术费:{{getOperation()}}</div>
112 132
         </div>
113 133
         <div class="listInfo">
114
-            <div>化验费:{{laboratoryCostTotal}}</div>
115
-            <div>输血费:</div>
116
-            <div>诊断费:{{zhenChaCostTotal}}</div>
134
+            <div>化验费:{{getLaboratoryCostTotal()}}</div>
135
+            <div>输血费:{{getBlood()}}</div>
136
+            <div>诊断费:{{getZhenChaCostTotal()}}</div>
117 137
         </div>
118 138
          <div class="listInfo">
119
-            <div>治疗费:</div>
120
-            <div>护理费:</div>
121
-            <div>床位费:{{bedCostTotal}}</div>
139
+            <div>治疗费:{{getTreatement()}}</div>
140
+            <div>护理费:{{getNursing()}}</div>
141
+            <div>床位费:{{getBedCostTotal()}}</div>
122 142
         </div>
123 143
         <div class="listInfo" style="margin-bottom: 20px;">
124
-            <div>麻醉费:</div>
125
-            <div>材料费:{{materialCostTotal}}</div>
126
-            <div>其他:{{otherCostTotal}}</div>
144
+            <div>麻醉费:{{getAnesthesia()}}</div>
145
+            <div>材料费:{{getMaterialCostTotal()}}</div>
146
+            <div>其他:{{getOtherCostTotal()}}</div>
127 147
         </div>
128 148
     </div>
129 149
   </div>
@@ -170,6 +190,7 @@ export default {
170 190
       list:[],
171 191
       his_patient:{},
172 192
       hisDepatment:[],
193
+      westernMedicineCostTotal:0,
173 194
       chineseTraditionalMedicineCostTotal:0,
174 195
       checkCostTotal:0,
175 196
       laboratoryCostTotal:0,
@@ -177,17 +198,85 @@ export default {
177 198
       bedCostTotal:0,
178 199
       materialCostTotal:0,
179 200
       otherCostTotal:0,
201
+      tableList:[],
202
+      order_info_list:[],
203
+      balanceAccountsType:0,
204
+      medicalInsuranceLevelList:[],
180 205
     }
181 206
   },
182 207
   methods: {
183 208
     searchAction(){
184
-     this.getGatherDetailList()
209
+     var new_arr = []
210
+     if(this.keywords!=""){
211
+        for(let i=0;i<this.tableList.length;i++){
212
+          if(this.tableList[i].is_total!=1){
213
+            if(this.tableList[i].name.indexOf(this.keywords) >-1){
214
+                new_arr.push(this.tableList[i])
215
+              }
216
+            }
217
+        }
218
+        var obj ={index:"合计",is_total:1,total:0}
219
+        obj.total = this.getPrice(new_arr)
220
+        new_arr.push(obj)
221
+        this.tableList = []
222
+        this.tableList = new_arr
223
+      }else{
224
+        this.tableList = []
225
+        this.getGatherDetailList()
226
+      }
227
+    },
228
+    getPrice(val){
229
+      var total_price = 0
230
+      for(let i=0;i<val.length;i++){
231
+        total_price +=val[i].count * val[i].price
232
+      }
233
+      return total_price.toFixed(2)
185 234
     },
186 235
     changeDate() {
187 236
       this.getGatherDetailList()
188 237
     },
189
-    changeItem() {
190
-      this.getGatherDetailList()
238
+    changeItem(id) {
239
+      if(id == 0){
240
+        this.tableList = []
241
+        this.getGatherDetailList()
242
+      }
243
+      if(id == 1){
244
+       var new_arr = []
245
+       for(let i=0;i<this.tableList.length;i++){
246
+        if(this.tableList[i].is_total != 1){
247
+          if(this.tableList[i].type == 1){
248
+            new_arr.push(this.tableList[i])
249
+          }  
250
+        }
251
+       }
252
+       this.tableList = []
253
+       this.tableList = new_arr
254
+      }
255
+      if(id == 2){
256
+       var new_arr = []
257
+     
258
+       for(let i=0;i<this.tableList.length;i++){
259
+        if(this.tableList[i].is_total != 1){
260
+          if(this.tableList[i].type == 2){
261
+            new_arr.push(this.tableList[i])
262
+          }  
263
+        }
264
+       }
265
+       this.tableList = []
266
+       this.tableList = new_arr
267
+      }
268
+      if(id == 3){
269
+       var new_arr = []
270
+       for(let i=0;i<this.tableList.length;i++){
271
+        if(this.tableList[i].is_total != 1){
272
+          if(this.tableList[i].type == 3){
273
+            new_arr.push(this.tableList[i])
274
+          }  
275
+        }
276
+       }
277
+       this.tableList = []
278
+       this.tableList = new_arr
279
+      }
191 280
     },
192 281
     getGatherDetailList() {
193 282
       let start_time = this.chargeDate[0]
@@ -208,8 +297,21 @@ export default {
208 297
             this.patient = response.data.data.patient
209 298
             this.admin = response.data.data.admin_info
210 299
             this.his_hospital = response.data.data.his_hospital
300
+
211 301
             var order_info = response.data.data.order_info
212
-            console.log(" 汇总order_info2332322323232323",order_info)
302
+           
303
+            for(let i=0;i<order_info.length;i++){
304
+              order_info[i].med_chrgitm_type = this.getType(order_info[i].med_chrgitm_type)
305
+              order_info[i].chrgitm_lv  = this.getMedicineInsuranceType(order_info[i].chrgitm_lv)
306
+            }
307
+           
308
+            this.order_info_list = order_info
309
+            var prescription = response.data.data.prescription
310
+          
311
+            this.setMonthPrescription(prescription)
312
+            this.balanceAccountsType = response.data.data.balanceAccountsType
313
+
314
+            this.medicalInsuranceLevelList = response.data.data.medicalInsuranceLevelList
213 315
             if(order_info!=undefined&&order_info ==null){
214 316
                this.list = []
215 317
                return
@@ -217,6 +319,14 @@ export default {
217 319
             this.his_patient = response.data.data.his_patient
218 320
             this.hisDepatment = response.data.data.hisDepatment
219 321
             this.list = []
322
+            this.westernMedicineCostTotal = response.data.data.westernMedicineCostTotal
323
+            this.chineseTraditionalMedicineCostTotal = response.data.data.chineseTraditionalMedicineCostTotal
324
+            this.checkCostTotal = response.data.data.checkCostTotal
325
+            this.laboratoryCostTotal = response.data.data.laboratoryCostTotal
326
+            this.zhenChaCostTotal = response.data.data.zhenChaCostTotal
327
+            this.bedCostTotal = response.data.data.bedCostTotal
328
+            this.otherCostTotal = response.data.data.otherCostTotal
329
+            this.materialCostTotal = response.data.data.materialCostTotal
220 330
             if(this.$store.getters.xt_user.org_id == 10215 || this.$store.getters.xt_user.org_id == 0){
221 331
               //获取所有项目类型进行去重
222 332
               let med_chrgitm_types = []
@@ -230,7 +340,7 @@ export default {
230 340
               }, []) // 设置cur默认类型为数组,并且初始值为空的数组
231 341
 
232 342
               let tempOrderInfo = []
233
-              console.log("med_chrgitm_types3323232323232233",med_chrgitm_types)
343
+            
234 344
               for (let i = 0; i < med_chrgitm_types.length; i++) {
235 345
                 let obj = {
236 346
                   total: 0,
@@ -324,6 +434,7 @@ export default {
324 434
               }, []) // 设置cur默认类型为数组,并且初始值为空的数组
325 435
               let tempOrderInfo = []
326 436
               console.log("med_chrgitm_type323223322323233223",med_chrgitm_types)
437
+              console.log("order_info232322332323232322323",order_info)
327 438
               for (let i = 0; i < med_chrgitm_types.length; i++) {
328 439
                 let obj = {
329 440
                   total: 0,
@@ -335,9 +446,10 @@ export default {
335 446
                     tempDetails.push(order_info[b])
336 447
                   }
337 448
                 }
338
-                console.log("tempDetails2332323232",tempDetails)
449
+                console.log("tempDetails2332323232322323",tempDetails)
450
+              
339 451
                 obj.details = this.setNewData(tempDetails)
340
-                console.log("2332233232322323",obj.details)
452
+               
341 453
                 obj.total = this.getTotal(obj.details)
342 454
 
343 455
                 obj.details.push({
@@ -354,57 +466,7 @@ export default {
354 466
                   }
355 467
                  
356 468
                 }
357
-                console.log("list2323223232323",this.list)
358
-                var new_arr = []
359
-                if(this.keywords!=""){
360
-       
361
-                   for(let i=0;i<this.list.length;i++){
362
-                     if(this.list[i].is_total == 2){
363
-                        if(this.list[i].name.indexOf(this.keywords)>-1){
364
-                           new_arr.push(this.list[i])
365
-                       }
366
-                     }
367
-                   
368
-                  }
369
-                  var new_arr_two = []
370
-                  for(let i=0;i<tempDetails.length;i++){
371
-                    if(tempDetails[i].advice_id >0){
372
-                       tempDetails[i].name = tempDetails[i].advice.advice_name
373
-                    }
374
-                    if(tempDetails[i].project_id > 0){
375
-                       if(tempDetails[i].type == 2 ){
376
-                         tempDetails[i].name = tempDetails[i].project.project_name
377
-                       }
378
-                       if(tempDetails[i].type == 3){
379
-                         tempDetails[i].name = tempDetails[i].good_info.good_name
380
-                       }
381
-                    }
382
-                    if(tempDetails[i].name.indexOf(this.keywords) > -1){
383
-                       new_arr_two.push(tempDetails[i])
384
-                    }
385
-                  }
386
-                   this.list = []
387
-                
388
-                   
389
-                   this.list = new_arr
390
-                    obj.details = []
391
-                    obj.details = this.setNewData(new_arr_two)
392
-
393
-                    obj.total = this.getTotal(obj.details)
394
-                    obj.details.push({
395
-                      total: obj.total,
396
-                      is_total: 1,
397
-                    })
398
-                    for(let i=0;i<obj.details.length;i++){
399
-                       if(obj.details[i].is_total == 1){
400
-                          obj.details[i].index = "合计"
401
-                       }else{
402
-                         obj.details[i].index = i+1
403
-                       }
404
-                    }
405
-                    console.log("obj23323232323232323232",obj.details)
406
-                    this.list = obj.details
407
-                }
469
+               
408 470
              }
409 471
           }
410 472
         }
@@ -429,7 +491,7 @@ export default {
429 491
      return project_name
430 492
     },
431 493
     setNewData(details) {
432
-      // console.log("detail23332323232322332332322323232332",details)
494
+     
433 495
         let drug_ids = []
434 496
         let project_ids = []
435 497
 
@@ -683,7 +745,420 @@ export default {
683 745
      },
684 746
      toPrintInvoice(){
685 747
        this.$router.push({path:"/hisTool/gatherPrintInvoice?patient_id="+this.patient_id+"&start_time="+this.chargeDate[0]+"&end_time="+this.chargeDate[1]+"&type="+this.item_type +"&keyword="+this.keywords})
686
-     }
748
+     },
749
+     setMonthPrescription(month_prescriptions) {
750
+      let drug_month_prescriptions = {
751
+        advices: []
752
+      }
753
+      let drug_ids = []
754
+      let project_month_prescriptions = {
755
+        project: []
756
+
757
+      }
758
+      let project_ids = []
759
+
760
+      for (let i = 0; i < month_prescriptions.length; i++) {
761
+        if (month_prescriptions[i].type == 1) { //药品
762
+          for (let a = 0; a < month_prescriptions[i].advices.length; a++) {
763
+            let obj = {
764
+              id: month_prescriptions[i].advices[a].drug_id,
765
+              price: month_prescriptions[i].advices[a].price
766
+
767
+            }
768
+            drug_ids.push(obj)
769
+            drug_month_prescriptions.advices.push(month_prescriptions[i].advices[a])
770
+          }
771
+
772
+        } else if (month_prescriptions[i].type == 2) { //项目
773
+          for (let a = 0; a < month_prescriptions[i].project.length; a++) {
774
+            let obj = {
775
+              id: month_prescriptions[i].project[a].project_id,
776
+              price: month_prescriptions[i].project[a].price
777
+
778
+            }
779
+            project_ids.push(obj)
780
+            project_month_prescriptions.project.push(month_prescriptions[i].project[a])
781
+          }
782
+        }
783
+      }
784
+
785
+      drug_ids = this.unique(drug_ids)
786
+      project_ids= this.unique(project_ids)
787
+  
788
+      for (let i = 0; i < drug_ids.length; i++) {
789
+        let obj = {}
790
+        let count = 0
791
+        for (let a = 0; a < drug_month_prescriptions.advices.length; a++) {
792
+          if (drug_ids[i].price == drug_month_prescriptions.advices[a].price && drug_ids[i].id ==  drug_month_prescriptions.advices[a].drug_id) {
793
+            obj['advice_id'] = drug_month_prescriptions.advices[a].id
794
+            obj['name'] = drug_month_prescriptions.advices[a].advice_name
795
+            obj['statistical_classification'] = ''
796
+            obj['type'] = 1
797
+            obj['single_dose'] = drug_month_prescriptions.advices[a].single_dose
798
+            obj['delivery_way'] = drug_month_prescriptions.advices[a].delivery_way
799
+            obj['execution_frequency'] = drug_month_prescriptions.advices[a].execution_frequency
800
+            obj['day'] = drug_month_prescriptions.advices[a].day
801
+            obj['prescribing_number_unit'] = drug_month_prescriptions.advices[a].prescribing_number_unit
802
+            obj['remark'] = drug_month_prescriptions.advices[a].remark
803
+            obj['price'] = parseFloat(drug_month_prescriptions.advices[a].price)
804
+            obj['record_date'] = drug_month_prescriptions.advices[a].advice_date
805
+            obj['spec'] = drug_month_prescriptions.advices[a].drug.dose  + drug_month_prescriptions.advices[a].drug.dose_unit +"*" + drug_month_prescriptions.advices[a].drug.min_number + drug_month_prescriptions.advices[a].drug.min_unit + "/" + drug_month_prescriptions.advices[a].drug.max_unit
806
+            obj['is_total'] = 2
807
+            obj['chrgitm_lv'] =  drug_month_prescriptions.advices[a].drug.medical_insurance_level 
808
+            obj['unit'] = drug_month_prescriptions.advices[a].prescribing_number_unit
809
+            count = count + drug_month_prescriptions.advices[a].prescribing_number
810
+
811
+          }
812
+        }
813
+        obj['count'] = count
814
+        this.tableList.push(obj)
815
+      }
816
+
817
+      for (let i = 0; i < project_ids.length; i++) {
818
+        let obj = {}
819
+        let count = 0
820
+        for (let a = 0; a < project_month_prescriptions.project.length; a++) {
821
+          if (project_ids[i].price == project_month_prescriptions.project[a].price &&project_ids[i].id == project_month_prescriptions.project[a].project_id ) {
822
+
823
+            if(project_month_prescriptions.project[a].type == 2){
824
+              obj['project_id'] = project_month_prescriptions.project[a].id
825
+              obj['name'] = project_month_prescriptions.project[a].project.project_name
826
+              obj['statistical_classification'] = ''
827
+              obj['project_type'] = 2
828
+              obj['spec'] =  project_month_prescriptions.project[a].project.project_name
829
+              obj['unit'] = project_month_prescriptions.project[a].unit
830
+              obj['chrgitm_lv'] =  project_month_prescriptions.project[a].project.medical_coverage
831
+            }else if (project_month_prescriptions.project[a].type == 3){
832
+              obj['project_id'] = project_month_prescriptions.project[a].id
833
+              obj['name'] = project_month_prescriptions.project[a].good_info.good_name
834
+              obj['statistical_classification'] = ''
835
+              obj['project_type'] = 3
836
+              obj['spec'] = project_month_prescriptions.project[a].good_info.specification_name
837
+              obj['unit'] = project_month_prescriptions.project[a].good_info.packing_unit
838
+              obj['chrgitm_lv'] =  project_month_prescriptions.project[a].good_info.medical_insurance_level
839
+            }
840
+            obj['single_dose'] = project_month_prescriptions.project[a].single_dose
841
+            obj['delivery_way'] = project_month_prescriptions.project[a].delivery_way
842
+            obj['execution_frequency'] = project_month_prescriptions.project[a].execution_frequency
843
+            obj['day'] = project_month_prescriptions.project[a].day
844
+            obj['single_dose_unit'] = project_month_prescriptions.project[a].unit
845
+            obj['prescribing_number_unit'] = project_month_prescriptions.project[a].unit
846
+           
847
+            count = count + parseFloat(project_month_prescriptions.project[a].count)
848
+            obj['price'] = parseFloat(project_month_prescriptions.project[a].price)
849
+            obj['remark'] = project_month_prescriptions.project[a].remark
850
+            obj['type'] = 2
851
+            obj['record_date'] = project_month_prescriptions.project[a].record_date
852
+            obj['is_total'] = 2
853
+          }
854
+        }
855
+        obj['count'] = count
856
+        this.tableList.push(obj)
857
+
858
+      }
859
+      var objOne = {index:"合计",is_total:1,total:0}
860
+      objOne.total = this.getTotalPrice(this.tableList)
861
+      for(let i=0;i<this.tableList.length;i++){
862
+        this.tableList[i].index = i + 1
863
+      }
864
+       this.tableList.push(objOne)
865
+    },
866
+
867
+    getTotalPrice(val){
868
+      var total_price = 0
869
+      for(let i=0;i<val.length;i++){
870
+         total_price +=val[i].count * val[i].price
871
+      }
872
+      return total_price.toFixed(2)
873
+    },
874
+    getAdviceMedChrgintmType(advice_id){
875
+      var med_chrgitm_type = ""
876
+      for(let i=0;i<this.order_info_list.length;i++){
877
+        if(advice_id == this.order_info_list[i].advice_id){
878
+          med_chrgitm_type = this.order_info_list[i].med_chrgitm_type
879
+        }
880
+      }
881
+      return med_chrgitm_type
882
+    },
883
+    getProjectMedChrgintmType(project_id){
884
+      var med_chrgitm_type = ""
885
+      for(let i=0;i<this.order_info_list.length;i++){
886
+        if(project_id == this.order_info_list[i].project_id){
887
+          med_chrgitm_type = this.order_info_list[i].med_chrgitm_type
888
+        }
889
+      }
890
+      return med_chrgitm_type
891
+    },
892
+    getChrgitmLv(value){
893
+      var name = ""
894
+      for(let i=0;i<this.medicalInsuranceLevelList.length;i++){
895
+        if(value == this.medicalInsuranceLevelList[i].value){
896
+           name = this.medicalInsuranceLevelList[i].name
897
+        }
898
+      }
899
+      return name
900
+    },
901
+    getAdviceMedChrgintmLv(advice_id){
902
+     var chrgitm_lv = ""
903
+      for(let i=0;i<this.order_info_list.length;i++){
904
+        if(advice_id == this.order_info_list[i].advice_id){
905
+          chrgitm_lv = this.order_info_list[i].chrgitm_lv
906
+        }
907
+      }
908
+      return chrgitm_lv
909
+    },
910
+    getProjectMedChrgintmLv(advice_id){
911
+     var chrgitm_lv = ""
912
+      for(let i=0;i<this.order_info_list.length;i++){
913
+        if(advice_id == this.order_info_list[i].advice_id){
914
+          chrgitm_lv = this.order_info_list[i].chrgitm_lv
915
+        }
916
+      }
917
+      return chrgitm_lv
918
+    },
919
+    getWesternMedicineCostTotal(){
920
+      var total_price = 0
921
+      for(let i=0;i<this.tableList.length;i++){
922
+         if(this.tableList[i].advice_id > 0){
923
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
924
+         }
925
+         if(this.tableList[i].project_id > 0){
926
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
927
+         }
928
+         if(this.tableList[i].drug_type == "西药费"){
929
+            total_price += this.tableList[i].count * this.tableList[i].price
930
+         }
931
+      }
932
+      
933
+      return total_price.toFixed(2)
934
+    },
935
+    getChineseTraditionalMedicineCostTotal(){
936
+      var total_price = 0
937
+      for(let i=0;i<this.tableList.length;i++){
938
+         if(this.tableList[i].advice_id > 0){
939
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
940
+         }
941
+        if(this.tableList[i].project_id > 0){
942
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
943
+         }
944
+         if(this.tableList[i].drug_type == "中成药费"){
945
+            total_price += this.tableList[i].count * this.tableList[i].price
946
+         }
947
+      }
948
+      
949
+      return total_price.toFixed(2)
950
+    },
951
+    getChineseTotal(){
952
+      var total_price = 0
953
+      for(let i=0;i<this.tableList.length;i++){
954
+         if(this.tableList[i].advice_id > 0){
955
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
956
+         }
957
+        if(this.tableList[i].project_id > 0){
958
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
959
+         }
960
+         if(this.tableList[i].drug_type == "中草药"){
961
+            total_price += this.tableList[i].count * this.tableList[i].price
962
+         }
963
+      }
964
+      
965
+      return total_price.toFixed(2)
966
+    },
967
+    getCheckCostTotal(){
968
+      var total_price = 0
969
+      for(let i=0;i<this.tableList.length;i++){
970
+         if(this.tableList[i].advice_id > 0){
971
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
972
+         }
973
+        if(this.tableList.project_id > 0){
974
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
975
+         }
976
+         if(this.tableList[i].drug_type == "检查费"){
977
+            total_price += this.tableList[i].count * this.tableList[i].price
978
+         }
979
+      }
980
+      
981
+      return total_price.toFixed(2)
982
+    },
983
+    getOxygen(){
984
+      var total_price = 0
985
+      for(let i=0;i<this.tableList.length;i++){
986
+         if(this.tableList[i].advice_id > 0){
987
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
988
+         }
989
+        if(this.tableList[i].project_id > 0){
990
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
991
+         }
992
+         if(this.tableList[i].drug_type == "输氧费"){
993
+            total_price += this.tableList[i].count * this.tableList[i].price
994
+         }
995
+      }
996
+      
997
+      return total_price.toFixed(2)
998
+    },
999
+    getOperation(){
1000
+      var total_price = 0
1001
+      for(let i=0;i<this.tableList.length;i++){
1002
+         if(this.tableList[i].advice_id > 0){
1003
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
1004
+         }
1005
+        if(this.tableList.project_id > 0){
1006
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
1007
+         }
1008
+         if(this.tableList[i].drug_type == "手术费"){
1009
+            total_price += this.tableList[i].count * this.tableList[i].price
1010
+         }
1011
+      }
1012
+      
1013
+      return total_price.toFixed(2)
1014
+    },
1015
+    getLaboratoryCostTotal(){
1016
+       var total_price = 0
1017
+      for(let i=0;i<this.tableList.length;i++){
1018
+         if(this.tableList[i].advice_id > 0){
1019
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
1020
+         }
1021
+        if(this.tableList[i].project_id > 0){
1022
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
1023
+         }
1024
+         console.log("化验23233223322323",this.tableList[i].drug_type)
1025
+         if(this.tableList[i].drug_type == "化验费"){
1026
+            total_price += this.tableList[i].count * this.tableList[i].price
1027
+         }
1028
+      }
1029
+      
1030
+      return total_price.toFixed(2)
1031
+    },
1032
+    getBlood(){
1033
+      var total_price = 0
1034
+      for(let i=0;i<this.tableList.length;i++){
1035
+         if(this.tableList[i].advice_id > 0){
1036
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
1037
+         }
1038
+        if(this.tableList[i].project_id > 0){
1039
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
1040
+         }
1041
+         if(this.tableList[i].drug_type == "输血费"){
1042
+            total_price += this.tableList[i].count * this.tableList[i].price
1043
+         }
1044
+      }
1045
+      
1046
+      return total_price.toFixed(2)
1047
+    },
1048
+    getZhenChaCostTotal(){
1049
+      var total_price = 0
1050
+      for(let i=0;i<this.tableList.length;i++){
1051
+         if(this.tableList[i].advice_id > 0){
1052
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
1053
+         }
1054
+        if(this.tableList[i].project_id > 0){
1055
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
1056
+         }
1057
+         if(this.tableList[i].drug_type == "诊察费"){
1058
+            total_price += this.tableList[i].count * this.tableList[i].price
1059
+         }
1060
+      }
1061
+      
1062
+      return total_price.toFixed(2) 
1063
+    },
1064
+    getTreatement(){
1065
+      var total_price = 0
1066
+      for(let i=0;i<this.tableList.length;i++){
1067
+         if(this.tableList[i].advice_id > 0){
1068
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
1069
+         }
1070
+        if(this.tableList[i].project_id > 0){
1071
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
1072
+         }
1073
+         
1074
+         if(this.tableList[i].drug_type == "治疗费"){
1075
+            total_price += this.tableList[i].count * this.tableList[i].price
1076
+         }
1077
+      }
1078
+      
1079
+      return total_price.toFixed(2) 
1080
+    },
1081
+    getNursing(){
1082
+      var total_price = 0
1083
+      for(let i=0;i<this.tableList.length;i++){
1084
+         if(this.tableList[i].advice_id > 0){
1085
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
1086
+         }
1087
+        if(this.tableList[i].project_id > 0){
1088
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
1089
+         }
1090
+         if(this.tableList[i].drug_type == "护理费"){
1091
+            total_price += this.tableList[i].count * this.tableList[i].price
1092
+         }
1093
+      }
1094
+      
1095
+      return total_price.toFixed(2) 
1096
+    },
1097
+    getBedCostTotal(){
1098
+      var total_price = 0
1099
+      for(let i=0;i<this.tableList.length;i++){
1100
+         if(this.tableList[i].advice_id > 0){
1101
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
1102
+         }
1103
+        if(this.tableList[i].project_id > 0){
1104
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
1105
+         }
1106
+         if(this.tableList[i].drug_type == "床位费"){
1107
+            total_price += this.tableList[i].count * this.tableList[i].price
1108
+         }
1109
+      }
1110
+      
1111
+      return total_price.toFixed(2)  
1112
+    },
1113
+    getAnesthesia(){
1114
+      var total_price = 0
1115
+      for(let i=0;i<this.tableList.length;i++){
1116
+         if(this.tableList[i].advice_id > 0){
1117
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
1118
+         }
1119
+        if(this.tableList[i].project_id > 0){
1120
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
1121
+         }
1122
+         if(this.tableList[i].drug_type == "麻醉费"){
1123
+            total_price += this.tableList[i].count * this.tableList[i].price
1124
+         }
1125
+      }
1126
+      
1127
+      return total_price.toFixed(2)  
1128
+    },
1129
+    getMaterialCostTotal(){
1130
+      var total_price = 0
1131
+      for(let i=0;i<this.tableList.length;i++){
1132
+         if(this.tableList[i].advice_id > 0){
1133
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
1134
+         }
1135
+        if(this.tableList[i].project_id > 0){
1136
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
1137
+         }
1138
+         if(this.tableList[i].drug_type == "材料费"){
1139
+            total_price += this.tableList[i].count * this.tableList[i].price
1140
+         }
1141
+      }
1142
+      
1143
+      return total_price.toFixed(2)  
1144
+    },
1145
+    getOtherCostTotal(){
1146
+      var total_price = 0
1147
+      for(let i=0;i<this.tableList.length;i++){
1148
+         if(this.tableList[i].advice_id > 0){
1149
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
1150
+         }
1151
+        if(this.tableList[i].project_id > 0){
1152
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
1153
+         }
1154
+         if(this.tableList[i].drug_type == "其他费"){
1155
+            total_price += this.tableList[i].count * this.tableList[i].price
1156
+         }
1157
+      }
1158
+      
1159
+      return total_price.toFixed(2)  
1160
+    }
1161
+
687 1162
   },
688 1163
   created() {
689 1164
     this.getGatherDetailList()

+ 516 - 165
src/xt_pages/outpatientTool/gatherPrint.vue View File

@@ -17,32 +17,32 @@
17 17
          <div class="listInfo" style="border-bottom: 2px solid;margin-bottom: 20px;padding-bottom: 20px;">
18 18
             <div>预交款:</div>
19 19
             <div>总费用:{{getAllPice()}}</div>
20
-            <div>门诊日期:</div>
20
+            <div>门诊日期:{{this.$route.query.end_time}}</div>
21 21
         </div>
22 22
         <div class="listInfo">
23
-            <div>西药:</div>
24
-            <div>中成药:{{chineseTraditionalMedicineCostTotal}}</div>
25
-            <div>中草药:</div>
23
+            <div>西药:{{getWesternMedicineCostTotal()}}</div>
24
+            <div>中成药:{{getChineseTraditionalMedicineCostTotal()}}</div>
25
+            <div>中草药:{{getChineseTotal()}}</div>
26 26
         </div>
27 27
         <div class="listInfo">
28
-            <div>检查费:{{checkCostTotal}}</div>
29
-            <div>输氧费:</div>
30
-            <div>手术费:</div>
28
+            <div>检查费:{{getCheckCostTotal()}}</div>
29
+            <div>输氧费:{{getOxygen()}}</div>
30
+            <div>手术费:{{getOperation()}}</div>
31 31
         </div>
32 32
         <div class="listInfo">
33
-            <div>化验费:{{laboratoryCostTotal}}</div>
34
-            <div>输血费:</div>
35
-            <div>诊断费:{{zhenChaCostTotal}}</div>
33
+            <div>化验费:{{getLaboratoryCostTotal()}}</div>
34
+            <div>输血费:{{getBlood()}}</div>
35
+            <div>诊断费:{{getZhenChaCostTotal()}}</div>
36 36
         </div>
37 37
          <div class="listInfo">
38
-            <div>治疗费:</div>
39
-            <div>护理费:</div>
40
-            <div>床位费:{{bedCostTotal}}</div>
38
+            <div>治疗费:{{getTreatement()}}</div>
39
+            <div>护理费:{{getNursing()}}</div>
40
+            <div>床位费:{{getBedCostTotal()}}</div>
41 41
         </div>
42 42
         <div class="listInfo" style="margin-bottom: 20px;">
43
-            <div>麻醉费:</div>
44
-            <div>材料费:{{materialCostTotal}}</div>
45
-            <div>其他:{{otherCostTotal}}</div>
43
+            <div>麻醉费:{{getAnesthesia()}}</div>
44
+            <div>材料费:{{getMaterialCostTotal()}}</div>
45
+            <div>其他:{{getOtherCostTotal()}}</div>
46 46
         </div>
47 47
         <table class="listTable" border="1">
48 48
             <tr>
@@ -52,11 +52,19 @@
52 52
                 <td style="width:9%;text-align:center">单价</td>
53 53
                 <td style="width:10%;text-align:center" >数量</td>
54 54
                 <td style="width:10%;text-align:center">金额</td>
55
-                <td style="width:10%;text-align:center" >医保类型</td>
55
+                <td style="width:20%;text-align:center" >医保类型</td>
56 56
             </tr>
57
-            <tr v-for="(item, index) in list" :key="index">
57
+            <tr v-for="(item, index) in tableList" :key="index">
58 58
                 <td style="width:19%;text-align:center" >
59
-                 {{ item.med_chrgitm_type }}
59
+                  <span v-if="item.type == 1">
60
+                    {{getAdviceMedChrgintmType(item.advice_id)}}
61
+                  </span>
62
+                   <span v-if="item.type == 2">
63
+                    {{getProjectMedChrgintmType(item.project_id)}}
64
+                   </span>
65
+                    <span v-if="item.type == 3">
66
+                        {{getProjectMedChrgintmType(item.project_id)}}
67
+                    </span>
60 68
                 </td>
61 69
                 <td style="width:10%;text-align:center" >
62 70
                   <span>{{item.name}}</span>  
@@ -71,13 +79,22 @@
71 79
                    {{item.count }}{{item.unit }}
72 80
                 </td>
73 81
                 <td style="width:6%;text-align:center" >
74
-                    <span v-if="item.is_total == 1">{{item.total}}</span>  
75
-                    <span v-if="item.is_total == 2">{{(item.price * item.count).toFixed(2) }}</span>  
82
+                   <span v-if="item.is_total == 1">{{ item.total }}</span>  
83
+                   <span v-if="item.is_total == 2">{{ (item.price * item.count).toFixed(2) }}</span> 
76 84
                 </td>
77
-                <td style="width:10%;text-align:center" >
78
-                  <span v-if="item.chrgitm_lv== '01'">甲类</span>
79
-                  <span v-if="item.chrgitm_lv== '02'">乙类</span>
80
-                  <span v-if="item.chrgitm_lv== '03'">自费</span>
85
+                <td style="width:20%;text-align:center" >
86
+                     <span v-if="balanceAccountsType == 2">{{getChrgitmLv(item.chrgitm_lv)}}</span>
87
+                      <span v-if="balanceAccountsType != 2">
88
+                        <span v-if="item.type == 1">
89
+                            {{getAdviceMedChrgintmLv(item.advice_id)}}
90
+                        </span>
91
+                        <span v-if="item.type == 2">
92
+                          {{getProjectMedChrgintmLv(item.project_id)}}
93
+                        </span>
94
+                        <span v-if="item.type == 3">
95
+                            {{getProjectMedChrgintmLv(item.project_id)}}
96
+                        </span>
97
+                      </span>
81 98
                 </td>
82 99
             </tr>
83 100
         </table>
@@ -106,6 +123,10 @@
106 123
           operationCostTotal:"",//材料费
107 124
           zhenChaCostTotal:"",//诊查费
108 125
           otherCostTotal:"",//其他费用
126
+          tableList:[],
127
+          order_info_list:[],
128
+          balanceAccountsType:0,
129
+          medicalInsuranceLevelList:[],
109 130
         }
110 131
     },
111 132
     methods:{
@@ -138,15 +159,14 @@
138 159
       getTimes(time) {
139 160
         return uParseTime(time, '{y}-{m}-{d}')
140 161
       },
141
-    getGatherDetailList() {
142
-      let start_time = this.$route.query.start_time
143
-      let end_time = this.$route.query.end_time
162
+     getGatherDetailList() {
163
+      
144 164
       let params = {
145 165
         patient_id:this.$route.query.patient_id,
146
-        start_time: start_time,
147
-        end_time: end_time,
148
-        type: this.$route.query.type,
149
-        keyword: this.$route.query.keyword,
166
+        start_time: this.$route.query.start_time,
167
+        end_time: this.$route.query.end_time,
168
+        type:this.$route.query.type,
169
+        keyword: this.$route.query.keyword
150 170
       }
151 171
      getGatherDetailList(params).then(response=>{
152 172
           if (response.data.state == 0) {
@@ -154,14 +174,39 @@
154 174
             return false
155 175
           } else {
156 176
             this.order = response.data.data.order
157
-          
158 177
             this.patient = response.data.data.patient
159 178
             this.admin = response.data.data.admin_info
160 179
             this.his_hospital = response.data.data.his_hospital
180
+
161 181
             var order_info = response.data.data.order_info
182
+           
183
+            for(let i=0;i<order_info.length;i++){
184
+              order_info[i].med_chrgitm_type = this.getType(order_info[i].med_chrgitm_type)
185
+              order_info[i].chrgitm_lv  = this.getMedicineInsuranceType(order_info[i].chrgitm_lv)
186
+            }
187
+           
188
+            this.order_info_list = order_info
189
+            var prescription = response.data.data.prescription
190
+            console.log("prescription23323232323233232323232233233223",prescription)
191
+            this.setMonthPrescription(prescription)
192
+            this.balanceAccountsType = response.data.data.balanceAccountsType
193
+
194
+            this.medicalInsuranceLevelList = response.data.data.medicalInsuranceLevelList
195
+            if(order_info!=undefined&&order_info ==null){
196
+               this.list = []
197
+               return
198
+            }
162 199
             this.his_patient = response.data.data.his_patient
163 200
             this.hisDepatment = response.data.data.hisDepatment
164
-            console.log("order_info2332332232332232323",order_info)
201
+            this.list = []
202
+            this.westernMedicineCostTotal = response.data.data.westernMedicineCostTotal
203
+            this.chineseTraditionalMedicineCostTotal = response.data.data.chineseTraditionalMedicineCostTotal
204
+            this.checkCostTotal = response.data.data.checkCostTotal
205
+            this.laboratoryCostTotal = response.data.data.laboratoryCostTotal
206
+            this.zhenChaCostTotal = response.data.data.zhenChaCostTotal
207
+            this.bedCostTotal = response.data.data.bedCostTotal
208
+            this.otherCostTotal = response.data.data.otherCostTotal
209
+            this.materialCostTotal = response.data.data.materialCostTotal
165 210
             if(this.$store.getters.xt_user.org_id == 10215 || this.$store.getters.xt_user.org_id == 0){
166 211
               //获取所有项目类型进行去重
167 212
               let med_chrgitm_types = []
@@ -175,7 +220,7 @@
175 220
               }, []) // 设置cur默认类型为数组,并且初始值为空的数组
176 221
 
177 222
               let tempOrderInfo = []
178
-
223
+            
179 224
               for (let i = 0; i < med_chrgitm_types.length; i++) {
180 225
                 let obj = {
181 226
                   total: 0,
@@ -189,82 +234,29 @@
189 234
                   }
190 235
                 }
191 236
                 obj.details = this.setNewData(tempDetails)
192
-               
237
+                this.list = []
193 238
                 this.list =  this.list.concat(obj.details)
194 239
                 for(let i=0;i<this.list.length;i++){
195
-                  this.list[i].index = i
240
+                  if(this.list[i].is_total == 1){
241
+                     this.list[i].index = "合计"
242
+                  }else{
243
+                    this.list[i].index = i+1
244
+                  }
245
+                 
196 246
                 }
197 247
               }
198 248
               let newobj = {}
199 249
               newobj['total'] = this.order.medfee_sumamt
200 250
               newobj['is_total'] = 1
201
-              
251
+              this.list = []
202 252
               this.list.push(newobj)
203
-
204
-              var new_arr = []
205
-              if(this.$route.query.keyword!=""){
206
-       
207
-                   for(let i=0;i<this.list.length;i++){
208
-                     if(this.list[i].is_total == 2){
209
-                        if(this.list[i].name.indexOf(this.$route.query.keyword)>-1){
210
-                           new_arr.push(this.list[i])
211
-                       }
212
-                     }
213
-                   
214
-                  }
215
-                  var new_arr_two = []
216
-                  for(let i=0;i<tempDetails.length;i++){
217
-                    if(tempDetails[i].advice_id >0){
218
-                       tempDetails[i].name = tempDetails[i].advice.advice_name
219
-                    }
220
-                    if(tempDetails[i].project_id > 0){
221
-                       if(tempDetails[i].type == 2 ){
222
-                         tempDetails[i].name = tempDetails[i].project.project_name
223
-                       }
224
-                       if(tempDetails[i].type == 3){
225
-                         tempDetails[i].name = tempDetails[i].good_info.good_name
226
-                       }
227
-                    }
228
-                    if(tempDetails[i].name.indexOf(this.$route.query.keyword) > -1){
229
-                       new_arr_two.push(tempDetails[i])
230
-                    }
231
-                  }
232
-                   this.list = []
233
-                
234
-                   
235
-                   this.list = new_arr
236
-                    obj.details = []
237
-                    obj.details = this.setNewData(new_arr_two)
238
-
239
-                    obj.total = this.getTotal(obj.details)
240
-                    obj.details.push({
241
-                      total: obj.total,
242
-                      is_total: 1,
243
-                    })
244
-                    for(let i=0;i<obj.details.length;i++){
245
-                       if(obj.details[i].is_total == 1){
246
-                          obj.details[i].index = "合计"
247
-                       }else{
248
-                         obj.details[i].index = i+1
249
-                       }
250
-                    }
251
-                 
252
-                    this.list = obj.details
253
-                    this.chineseTraditionalMedicineCostTotal = response.data.data.chineseTraditionalMedicineCostTotal
254
-                    this.checkCostTotal = response.data.data.checkCostTotal
255
-                    this.materialCostTotal = response.data.data.materialCostTotal
256
-                    this.laboratoryCostTotal = response.data.data.laboratoryCostTotal
257
-                    this.bedCostTotal = response.data.data.bedCostTotal
258
-                    this.operationCostTotal = response.data.data.operationCostTotal
259
-                    this.zhenChaCostTotal = response.data.data.zhenChaCostTotal
260
-                    this.otherCostTotal = response.data.data.otherCostTotal
261
-
262
-                }
263 253
             }else{
264 254
               //获取所有项目类型进行去重
265 255
               let med_chrgitm_types = []
266
-              for (let i = 0; i < order_info.length; i++) {
267
-                med_chrgitm_types.push(order_info[i].med_chrgitm_type)
256
+              if(order_info!=undefined && order_info.length > 0){
257
+                for (let i = 0; i < order_info.length; i++) {
258
+                 med_chrgitm_types.push(order_info[i].med_chrgitm_type)
259
+               }
268 260
               }
269 261
              
270 262
               const obj = {}
@@ -273,6 +265,7 @@
273 265
                 return cur
274 266
               }, []) // 设置cur默认类型为数组,并且初始值为空的数组
275 267
               let tempOrderInfo = []
268
+             
276 269
               for (let i = 0; i < med_chrgitm_types.length; i++) {
277 270
                 let obj = {
278 271
                   total: 0,
@@ -286,78 +279,24 @@
286 279
                 }
287 280
                 
288 281
                 obj.details = this.setNewData(tempDetails)
289
-
282
+               
290 283
                 obj.total = this.getTotal(obj.details)
284
+
291 285
                 obj.details.push({
292 286
                   total: obj.total,
293 287
                   is_total: 1,
294 288
                 })
295
-               
289
+                this.list = []
296 290
                 this.list =  this.list.concat(obj.details)
297
-              
298
-                for(let i=0;i<this.list.length;i++){
299
-                  this.list[i].index = i+1
300
-                }
301
-              var new_arr = []
302
-              if(this.$route.query.keyword!=""){
303
-                console.log("锦鲤3332232332233223322332",this.list)
304 291
                 for(let i=0;i<this.list.length;i++){
305
-                     if(this.list[i].is_total == 2){
306
-                        if(this.list[i].name.indexOf(this.$route.query.keyword)>-1){
307
-                           new_arr.push(this.list[i])
308
-                       }
309
-                     }
310
-                   
292
+                  if(this.list[i].is_total == 1){
293
+                     this.list[i].index = "合计"
294
+                  }else{
295
+                    this.list[i].index = i+1
311 296
                   }
312
-                  var new_arr_two = []
313
-                  for(let i=0;i<tempDetails.length;i++){
314
-                    if(tempDetails[i].advice_id >0){
315
-                       tempDetails[i].name = tempDetails[i].advice.advice_name
316
-                    }
317
-                    if(tempDetails[i].project_id > 0){
318
-                       if(tempDetails[i].type == 2 ){
319
-                         tempDetails[i].name = tempDetails[i].project.project_name
320
-                       }
321
-                       if(tempDetails[i].type == 3){
322
-                         tempDetails[i].name = tempDetails[i].good_info.good_name
323
-                       }
324
-                    }
325
-                    if(tempDetails[i].name.indexOf(this.$route.query.keyword) > -1){
326
-                       new_arr_two.push(tempDetails[i])
327
-                    }
328
-                  }
329
-                  this.list = []
330
-                  console.log("new_arr2323232333333232",new_arr)
331
-                   
332
-                   this.list = new_arr
333
-                    obj.details = []
334
-                    obj.details = this.setNewData(new_arr_two)
335
-
336
-                    obj.total = this.getTotal(obj.details)
337
-                    obj.details.push({
338
-                      total: obj.total,
339
-                      is_total: 1,
340
-                    })
341
-                    for(let i=0;i<obj.details.length;i++){
342
-                       if(obj.details[i].is_total == 1){
343
-                          obj.details[i].index = "合计"
344
-                       }else{
345
-                         obj.details[i].index = i+1
346
-                       }
347
-                    }
348
-                    console.log("obj23323232323232323232",obj.details)
349
-                    this.list = obj.details
350
-              }
351
-                this.chineseTraditionalMedicineCostTotal = response.data.data.chineseTraditionalMedicineCostTotal
352
-                this.checkCostTotal = response.data.data.checkCostTotal
353
-                this.materialCostTotal = response.data.data.materialCostTotal
354
-                this.laboratoryCostTotal = response.data.data.laboratoryCostTotal
355
-                this.bedCostTotal = response.data.data.bedCostTotal
356
-                this.operationCostTotal = response.data.data.operationCostTotal
357
-                this.zhenChaCostTotal = response.data.data.zhenChaCostTotal
358
-                this.otherCostTotal = response.data.data.otherCostTotal
359
-
360
-              
297
+                 
298
+                }
299
+               
361 300
              }
362 301
           }
363 302
         }
@@ -638,7 +577,7 @@
638 577
       return name
639 578
     },
640 579
     getAllPice(){
641
-      console.log("liust23322332323223",this.list)
580
+
642 581
       var total_price = 0
643 582
       for(let i=0;i<this.list.length;i++){
644 583
         if(this.list[i].is_total ==2){
@@ -651,6 +590,418 @@
651 590
         return total_price
652 591
       }
653 592
      
593
+    },
594
+    setMonthPrescription(month_prescriptions) {
595
+      let drug_month_prescriptions = {
596
+        advices: []
597
+      }
598
+      let drug_ids = []
599
+      let project_month_prescriptions = {
600
+        project: []
601
+
602
+      }
603
+      let project_ids = []
604
+
605
+      for (let i = 0; i < month_prescriptions.length; i++) {
606
+        if (month_prescriptions[i].type == 1) { //药品
607
+          for (let a = 0; a < month_prescriptions[i].advices.length; a++) {
608
+            let obj = {
609
+              id: month_prescriptions[i].advices[a].drug_id,
610
+              price: month_prescriptions[i].advices[a].price
611
+
612
+            }
613
+            drug_ids.push(obj)
614
+            drug_month_prescriptions.advices.push(month_prescriptions[i].advices[a])
615
+          }
616
+
617
+        } else if (month_prescriptions[i].type == 2) { //项目
618
+          for (let a = 0; a < month_prescriptions[i].project.length; a++) {
619
+            let obj = {
620
+              id: month_prescriptions[i].project[a].project_id,
621
+              price: month_prescriptions[i].project[a].price
622
+
623
+            }
624
+            project_ids.push(obj)
625
+            project_month_prescriptions.project.push(month_prescriptions[i].project[a])
626
+          }
627
+        }
628
+      }
629
+
630
+      drug_ids = this.unique(drug_ids)
631
+      project_ids= this.unique(project_ids)
632
+  
633
+      for (let i = 0; i < drug_ids.length; i++) {
634
+        let obj = {}
635
+        let count = 0
636
+        for (let a = 0; a < drug_month_prescriptions.advices.length; a++) {
637
+          if (drug_ids[i].price == drug_month_prescriptions.advices[a].price && drug_ids[i].id ==  drug_month_prescriptions.advices[a].drug_id) {
638
+            obj['advice_id'] = drug_month_prescriptions.advices[a].id
639
+            obj['name'] = drug_month_prescriptions.advices[a].advice_name
640
+            obj['statistical_classification'] = ''
641
+            obj['type'] = 1
642
+            obj['single_dose'] = drug_month_prescriptions.advices[a].single_dose
643
+            obj['delivery_way'] = drug_month_prescriptions.advices[a].delivery_way
644
+            obj['execution_frequency'] = drug_month_prescriptions.advices[a].execution_frequency
645
+            obj['day'] = drug_month_prescriptions.advices[a].day
646
+            obj['prescribing_number_unit'] = drug_month_prescriptions.advices[a].prescribing_number_unit
647
+            obj['remark'] = drug_month_prescriptions.advices[a].remark
648
+            obj['price'] = parseFloat(drug_month_prescriptions.advices[a].price)
649
+            obj['record_date'] = drug_month_prescriptions.advices[a].advice_date
650
+            obj['spec'] = drug_month_prescriptions.advices[a].drug.dose  + drug_month_prescriptions.advices[a].drug.dose_unit +"*" + drug_month_prescriptions.advices[a].drug.min_number + drug_month_prescriptions.advices[a].drug.min_unit + "/" + drug_month_prescriptions.advices[a].drug.max_unit
651
+            obj['is_total'] = 2
652
+            obj['chrgitm_lv'] =  drug_month_prescriptions.advices[a].drug.medical_insurance_level 
653
+            obj['unit'] = drug_month_prescriptions.advices[a].prescribing_number_unit
654
+            count = count + drug_month_prescriptions.advices[a].prescribing_number
655
+
656
+          }
657
+        }
658
+        obj['count'] = count
659
+        this.tableList.push(obj)
660
+      }
661
+
662
+      for (let i = 0; i < project_ids.length; i++) {
663
+        let obj = {}
664
+        let count = 0
665
+        for (let a = 0; a < project_month_prescriptions.project.length; a++) {
666
+          if (project_ids[i].price == project_month_prescriptions.project[a].price &&project_ids[i].id == project_month_prescriptions.project[a].project_id ) {
667
+
668
+            if(project_month_prescriptions.project[a].type == 2){
669
+              obj['project_id'] = project_month_prescriptions.project[a].id
670
+              obj['name'] = project_month_prescriptions.project[a].project.project_name
671
+              obj['statistical_classification'] = ''
672
+              obj['project_type'] = 2
673
+              obj['spec'] =  project_month_prescriptions.project[a].project.project_name
674
+              obj['unit'] = project_month_prescriptions.project[a].unit
675
+              obj['chrgitm_lv'] =  project_month_prescriptions.project[a].project.medical_coverage
676
+            }else if (project_month_prescriptions.project[a].type == 3){
677
+              obj['project_id'] = project_month_prescriptions.project[a].id
678
+              obj['name'] = project_month_prescriptions.project[a].good_info.good_name
679
+              obj['statistical_classification'] = ''
680
+              obj['project_type'] = 3
681
+              obj['spec'] = project_month_prescriptions.project[a].good_info.specification_name
682
+              obj['unit'] = project_month_prescriptions.project[a].good_info.packing_unit
683
+              obj['chrgitm_lv'] =  project_month_prescriptions.project[a].good_info.medical_insurance_level
684
+            }
685
+            obj['single_dose'] = project_month_prescriptions.project[a].single_dose
686
+            obj['delivery_way'] = project_month_prescriptions.project[a].delivery_way
687
+            obj['execution_frequency'] = project_month_prescriptions.project[a].execution_frequency
688
+            obj['day'] = project_month_prescriptions.project[a].day
689
+            obj['single_dose_unit'] = project_month_prescriptions.project[a].unit
690
+            obj['prescribing_number_unit'] = project_month_prescriptions.project[a].unit
691
+           
692
+            count = count + parseFloat(project_month_prescriptions.project[a].count)
693
+            obj['price'] = parseFloat(project_month_prescriptions.project[a].price)
694
+            obj['remark'] = project_month_prescriptions.project[a].remark
695
+            obj['type'] = 2
696
+            obj['record_date'] = project_month_prescriptions.project[a].record_date
697
+            obj['is_total'] = 2
698
+          }
699
+        }
700
+        obj['count'] = count
701
+        this.tableList.push(obj)
702
+
703
+      }
704
+      var objOne = {index:"合计",is_total:1,total:0}
705
+      objOne.total = this.getTotalPrice(this.tableList)
706
+      for(let i=0;i<this.tableList.length;i++){
707
+        this.tableList[i].index = i + 1
708
+      }
709
+       this.tableList.push(objOne)
710
+    },
711
+
712
+    getTotalPrice(val){
713
+      var total_price = 0
714
+      for(let i=0;i<val.length;i++){
715
+         total_price +=val[i].count * val[i].price
716
+      }
717
+      return total_price.toFixed(2)
718
+    },
719
+    getAdviceMedChrgintmType(advice_id){
720
+      var med_chrgitm_type = ""
721
+      for(let i=0;i<this.order_info_list.length;i++){
722
+        if(advice_id == this.order_info_list[i].advice_id){
723
+          med_chrgitm_type = this.order_info_list[i].med_chrgitm_type
724
+        }
725
+      }
726
+      return med_chrgitm_type
727
+    },
728
+    getProjectMedChrgintmType(project_id){
729
+      var med_chrgitm_type = ""
730
+      for(let i=0;i<this.order_info_list.length;i++){
731
+        if(project_id == this.order_info_list[i].project_id){
732
+          med_chrgitm_type = this.order_info_list[i].med_chrgitm_type
733
+        }
734
+      }
735
+      return med_chrgitm_type
736
+    },
737
+    getChrgitmLv(value){
738
+      var name = ""
739
+      for(let i=0;i<this.medicalInsuranceLevelList.length;i++){
740
+        if(value == this.medicalInsuranceLevelList[i].value){
741
+           name = this.medicalInsuranceLevelList[i].name
742
+        }
743
+      }
744
+      return name
745
+    },
746
+    getAdviceMedChrgintmLv(advice_id){
747
+     var chrgitm_lv = ""
748
+      for(let i=0;i<this.order_info_list.length;i++){
749
+        if(advice_id == this.order_info_list[i].advice_id){
750
+          chrgitm_lv = this.order_info_list[i].chrgitm_lv
751
+        }
752
+      }
753
+      return chrgitm_lv
754
+    },
755
+    getProjectMedChrgintmLv(advice_id){
756
+     var chrgitm_lv = ""
757
+      for(let i=0;i<this.order_info_list.length;i++){
758
+        if(advice_id == this.order_info_list[i].advice_id){
759
+          chrgitm_lv = this.order_info_list[i].chrgitm_lv
760
+        }
761
+      }
762
+      return chrgitm_lv
763
+    },
764
+    getWesternMedicineCostTotal(){
765
+      var total_price = 0
766
+      for(let i=0;i<this.tableList.length;i++){
767
+         if(this.tableList[i].advice_id > 0){
768
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
769
+         }
770
+         if(this.tableList[i].project_id > 0){
771
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
772
+         }
773
+         if(this.tableList[i].drug_type == "西药费"){
774
+            total_price += this.tableList[i].count * this.tableList[i].price
775
+         }
776
+      }
777
+      
778
+      return total_price.toFixed(2)
779
+    },
780
+    getChineseTraditionalMedicineCostTotal(){
781
+      var total_price = 0
782
+      for(let i=0;i<this.tableList.length;i++){
783
+         if(this.tableList[i].advice_id > 0){
784
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
785
+         }
786
+        if(this.tableList[i].project_id > 0){
787
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
788
+         }
789
+         if(this.tableList[i].drug_type == "中成药费"){
790
+            total_price += this.tableList[i].count * this.tableList[i].price
791
+         }
792
+      }
793
+      
794
+      return total_price.toFixed(2)
795
+    },
796
+    getChineseTotal(){
797
+      var total_price = 0
798
+      for(let i=0;i<this.tableList.length;i++){
799
+         if(this.tableList[i].advice_id > 0){
800
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
801
+         }
802
+        if(this.tableList[i].project_id > 0){
803
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
804
+         }
805
+         if(this.tableList[i].drug_type == "中草药"){
806
+            total_price += this.tableList[i].count * this.tableList[i].price
807
+         }
808
+      }
809
+      
810
+      return total_price.toFixed(2)
811
+    },
812
+    getCheckCostTotal(){
813
+      var total_price = 0
814
+      for(let i=0;i<this.tableList.length;i++){
815
+         if(this.tableList[i].advice_id > 0){
816
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
817
+         }
818
+        if(this.tableList.project_id > 0){
819
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
820
+         }
821
+         if(this.tableList[i].drug_type == "检查费"){
822
+            total_price += this.tableList[i].count * this.tableList[i].price
823
+         }
824
+      }
825
+      
826
+      return total_price.toFixed(2)
827
+    },
828
+    getOxygen(){
829
+      var total_price = 0
830
+      for(let i=0;i<this.tableList.length;i++){
831
+         if(this.tableList[i].advice_id > 0){
832
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
833
+         }
834
+        if(this.tableList[i].project_id > 0){
835
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
836
+         }
837
+         if(this.tableList[i].drug_type == "输氧费"){
838
+            total_price += this.tableList[i].count * this.tableList[i].price
839
+         }
840
+      }
841
+      
842
+      return total_price.toFixed(2)
843
+    },
844
+    getOperation(){
845
+      var total_price = 0
846
+      for(let i=0;i<this.tableList.length;i++){
847
+         if(this.tableList[i].advice_id > 0){
848
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
849
+         }
850
+        if(this.tableList.project_id > 0){
851
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
852
+         }
853
+         if(this.tableList[i].drug_type == "手术费"){
854
+            total_price += this.tableList[i].count * this.tableList[i].price
855
+         }
856
+      }
857
+      
858
+      return total_price.toFixed(2)
859
+    },
860
+    getLaboratoryCostTotal(){
861
+       var total_price = 0
862
+      for(let i=0;i<this.tableList.length;i++){
863
+         if(this.tableList[i].advice_id > 0){
864
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
865
+         }
866
+        if(this.tableList[i].project_id > 0){
867
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
868
+         }
869
+         console.log("化验23233223322323",this.tableList[i].drug_type)
870
+         if(this.tableList[i].drug_type == "化验费"){
871
+            total_price += this.tableList[i].count * this.tableList[i].price
872
+         }
873
+      }
874
+      
875
+      return total_price.toFixed(2)
876
+    },
877
+    getBlood(){
878
+      var total_price = 0
879
+      for(let i=0;i<this.tableList.length;i++){
880
+         if(this.tableList[i].advice_id > 0){
881
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
882
+         }
883
+        if(this.tableList[i].project_id > 0){
884
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
885
+         }
886
+         if(this.tableList[i].drug_type == "输血费"){
887
+            total_price += this.tableList[i].count * this.tableList[i].price
888
+         }
889
+      }
890
+      
891
+      return total_price.toFixed(2)
892
+    },
893
+    getZhenChaCostTotal(){
894
+      var total_price = 0
895
+      for(let i=0;i<this.tableList.length;i++){
896
+         if(this.tableList[i].advice_id > 0){
897
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
898
+         }
899
+        if(this.tableList[i].project_id > 0){
900
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
901
+         }
902
+         if(this.tableList[i].drug_type == "诊察费"){
903
+            total_price += this.tableList[i].count * this.tableList[i].price
904
+         }
905
+      }
906
+      
907
+      return total_price.toFixed(2) 
908
+    },
909
+    getTreatement(){
910
+      var total_price = 0
911
+      for(let i=0;i<this.tableList.length;i++){
912
+         if(this.tableList[i].advice_id > 0){
913
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
914
+         }
915
+        if(this.tableList[i].project_id > 0){
916
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
917
+         }
918
+         
919
+         if(this.tableList[i].drug_type == "治疗费"){
920
+            total_price += this.tableList[i].count * this.tableList[i].price
921
+         }
922
+      }
923
+      
924
+      return total_price.toFixed(2) 
925
+    },
926
+    getNursing(){
927
+      var total_price = 0
928
+      for(let i=0;i<this.tableList.length;i++){
929
+         if(this.tableList[i].advice_id > 0){
930
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
931
+         }
932
+        if(this.tableList[i].project_id > 0){
933
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
934
+         }
935
+         if(this.tableList[i].drug_type == "护理费"){
936
+            total_price += this.tableList[i].count * this.tableList[i].price
937
+         }
938
+      }
939
+      
940
+      return total_price.toFixed(2) 
941
+    },
942
+    getBedCostTotal(){
943
+      var total_price = 0
944
+      for(let i=0;i<this.tableList.length;i++){
945
+         if(this.tableList[i].advice_id > 0){
946
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
947
+         }
948
+        if(this.tableList[i].project_id > 0){
949
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
950
+         }
951
+         if(this.tableList[i].drug_type == "床位费"){
952
+            total_price += this.tableList[i].count * this.tableList[i].price
953
+         }
954
+      }
955
+      
956
+      return total_price.toFixed(2)  
957
+    },
958
+    getAnesthesia(){
959
+      var total_price = 0
960
+      for(let i=0;i<this.tableList.length;i++){
961
+         if(this.tableList[i].advice_id > 0){
962
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
963
+         }
964
+        if(this.tableList[i].project_id > 0){
965
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
966
+         }
967
+         if(this.tableList[i].drug_type == "麻醉费"){
968
+            total_price += this.tableList[i].count * this.tableList[i].price
969
+         }
970
+      }
971
+      
972
+      return total_price.toFixed(2)  
973
+    },
974
+    getMaterialCostTotal(){
975
+      var total_price = 0
976
+      for(let i=0;i<this.tableList.length;i++){
977
+         if(this.tableList[i].advice_id > 0){
978
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
979
+         }
980
+        if(this.tableList[i].project_id > 0){
981
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
982
+         }
983
+         if(this.tableList[i].drug_type == "材料费"){
984
+            total_price += this.tableList[i].count * this.tableList[i].price
985
+         }
986
+      }
987
+      
988
+      return total_price.toFixed(2)  
989
+    },
990
+    getOtherCostTotal(){
991
+      var total_price = 0
992
+      for(let i=0;i<this.tableList.length;i++){
993
+         if(this.tableList[i].advice_id > 0){
994
+           this.tableList[i].drug_type = this.getAdviceMedChrgintmType(this.tableList[i].advice_id)
995
+         }
996
+        if(this.tableList[i].project_id > 0){
997
+           this.tableList[i].drug_type = this.getProjectMedChrgintmType(this.tableList[i].project_id)
998
+         }
999
+         if(this.tableList[i].drug_type == "其他费"){
1000
+            total_price += this.tableList[i].count * this.tableList[i].price
1001
+         }
1002
+      }
1003
+      
1004
+      return total_price.toFixed(2)  
654 1005
     }
655 1006
     },
656 1007
     created(){

File diff suppressed because it is too large
+ 753 - 163
src/xt_pages/outpatientTool/gatherPrintInvoice.vue