|
@@ -667,12 +667,15 @@
|
667
|
667
|
}
|
668
|
668
|
},
|
669
|
669
|
setMonthPrescription(month_prescriptions) {
|
|
670
|
+ console.log("~~~~~~~~")
|
670
|
671
|
this.month_prescriptions = []
|
671
|
672
|
|
672
|
673
|
let drug_month_prescriptions = {
|
673
|
674
|
advices: []
|
674
|
675
|
}
|
675
|
676
|
let drug_ids = []
|
|
677
|
+ let drug_ids2 = []
|
|
678
|
+
|
676
|
679
|
let project_month_prescriptions = {
|
677
|
680
|
project: []
|
678
|
681
|
|
|
@@ -693,6 +696,9 @@
|
693
|
696
|
price: month_prescriptions[i].advices[a].price
|
694
|
697
|
|
695
|
698
|
}
|
|
699
|
+ if(month_prescriptions[i].advices[a].drug_id == 1280){
|
|
700
|
+ drug_ids2.push(obj)
|
|
701
|
+ }
|
696
|
702
|
drug_ids.push(obj)
|
697
|
703
|
drug_month_prescriptions.advices.push(month_prescriptions[i].advices[a])
|
698
|
704
|
}
|
|
@@ -726,18 +732,10 @@
|
726
|
732
|
const obj1 = {}
|
727
|
733
|
const obj2 = {}
|
728
|
734
|
|
729
|
|
- drug_ids = drug_ids.reduce((cur, next) => {
|
730
|
|
- obj[next.price] ? '' : obj[next.price] = true && cur.push(next)
|
731
|
|
- return cur
|
732
|
|
- }, []) // 设置cur默认类型为数组,并且初始值为空的数组
|
733
|
|
- project_ids = project_ids.reduce((cur, next) => {
|
734
|
|
- obj1[next.price] ? '' : obj1[next.price] = true && cur.push(next)
|
735
|
|
- return cur
|
736
|
|
- }, []) // 设置cur默认类型为数组,并且初始值为空的数组
|
737
|
|
- additions_ids = additions_ids.reduce((cur, next) => {
|
738
|
|
- obj2[next.price] ? '' : obj2[next.price] = true && cur.push(next)
|
739
|
|
- return cur
|
740
|
|
- }, []) // 设置cur默认类型为数组,并且初始值为空的数组
|
|
735
|
+ drug_ids = this.unique(drug_ids)
|
|
736
|
+ project_ids = this.unique(project_ids)
|
|
737
|
+ additions_ids = this.unique(additions_ids)
|
|
738
|
+
|
741
|
739
|
|
742
|
740
|
let drugs = []
|
743
|
741
|
let projects = []
|
|
@@ -747,7 +745,7 @@
|
747
|
745
|
let obj = {}
|
748
|
746
|
let count = 0
|
749
|
747
|
for (let a = 0; a < drug_month_prescriptions.advices.length; a++) {
|
750
|
|
- if (drug_ids[i].price == drug_month_prescriptions.advices[a].price) {
|
|
748
|
+ if (drug_ids[i].price == drug_month_prescriptions.advices[a].price && drug_ids[i].id == drug_month_prescriptions.advices[a].drug_id) {
|
751
|
749
|
obj['drug_name'] = drug_month_prescriptions.advices[a].advice_name
|
752
|
750
|
obj['single_dose'] = drug_month_prescriptions.advices[a].single_dose
|
753
|
751
|
obj['delivery_way'] = drug_month_prescriptions.advices[a].delivery_way
|
|
@@ -775,7 +773,7 @@
|
775
|
773
|
let obj = {}
|
776
|
774
|
let count = 0
|
777
|
775
|
for (let a = 0; a < project_month_prescriptions.project.length; a++) {
|
778
|
|
- if (project_ids[i].price == project_month_prescriptions.project[a].price) {
|
|
776
|
+ if (project_ids[i].price == project_month_prescriptions.project[a].price && project_ids[i].id == project_month_prescriptions.project[a].project_id) {
|
779
|
777
|
|
780
|
778
|
if (project_month_prescriptions.project[a].type == 2) {
|
781
|
779
|
obj['statistical_classification'] = project_month_prescriptions.project[a].project.statistical_classification
|
|
@@ -3212,7 +3210,22 @@
|
3212
|
3210
|
},
|
3213
|
3211
|
clearSelection() {
|
3214
|
3212
|
this.$refs.tabProjectTeam.clearSelection()
|
3215
|
|
- }
|
|
3213
|
+ },unique(array) {
|
|
3214
|
+ // res用来存储结果
|
|
3215
|
+ var res = []
|
|
3216
|
+ for (var i = 0, arrayLen = array.length; i < arrayLen; i++) {
|
|
3217
|
+ for (var j = 0, resLen = res.length; j < resLen; j++) {
|
|
3218
|
+ if (array[i].id === res[j].id && array[i].price === res[j].price) {
|
|
3219
|
+ break
|
|
3220
|
+ }
|
|
3221
|
+ }
|
|
3222
|
+ // 如果array[i]是唯一的,那么执行完循环,j等于resLen
|
|
3223
|
+ if (j === resLen) {
|
|
3224
|
+ res.push(array[i])
|
|
3225
|
+ }
|
|
3226
|
+ }
|
|
3227
|
+ return res
|
|
3228
|
+ },
|
3216
|
3229
|
},
|
3217
|
3230
|
mounted() {
|
3218
|
3231
|
|