|
@@ -2167,159 +2167,163 @@
|
2167
|
2167
|
}
|
2168
|
2168
|
},
|
2169
|
2169
|
open(index, isLoading) {
|
2170
|
|
- if (this.dayorMonth == 'day') {
|
2171
|
|
- if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length == 0) {
|
2172
|
|
- this.$message.error('请先开处方')
|
2173
|
|
- return
|
2174
|
|
- }
|
2175
|
|
-
|
2176
|
|
- }
|
|
2170
|
+ if(!isLoading){
|
|
2171
|
+ if (this.dayorMonth == 'day') {
|
|
2172
|
+ if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length == 0) {
|
|
2173
|
+ this.$message.error('请先开处方')
|
|
2174
|
+ return
|
|
2175
|
+ }
|
2177
|
2176
|
|
2178
|
|
- if (this.dayorMonth == 'day') {
|
2179
|
|
- if (this.curPrescriptions.order_status == 2) {
|
2180
|
|
- this.$message.error('当前处方已经结算,无法保存')
|
2181
|
|
- return
|
2182
|
|
- }
|
2183
|
|
- if (this.doctorValue.length <= 0) {
|
2184
|
|
- this.$message.error('医生不能为空')
|
2185
|
|
- return
|
2186
|
2177
|
}
|
2187
|
2178
|
|
2188
|
|
- if (this.departmentValue.length <= 0) {
|
2189
|
|
- this.$message.error('科室不能为空')
|
2190
|
|
- return
|
2191
|
|
- }
|
2192
|
|
- if (this.state1 <= 0) {
|
2193
|
|
- this.$message.error('疾病类型不能为空')
|
2194
|
|
- return
|
2195
|
|
- }
|
2196
|
|
- for (let i = 0; i < this.prescriptions.length; i++) {
|
2197
|
|
- for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
|
2198
|
|
- if (this.prescriptions[i].advices[b].prescribing_number == 0 || this.prescriptions[i].advices[b].prescribing_number == '') {
|
2199
|
|
- this.$message.error('药品处方总量不能为0')
|
2200
|
|
- return
|
2201
|
|
- }
|
2202
|
|
- }
|
2203
|
|
- }
|
2204
|
|
- for (let i = 0; i < this.prescriptions.length; i++) {
|
2205
|
|
- for (let b = 0; b < this.prescriptions[i].project.length; b++) {
|
2206
|
|
- if (this.prescriptions[i].project[b].total == 0 || this.prescriptions[i].project[b].total == '') {
|
2207
|
|
- this.$message.error('项目处方总量不能为0')
|
2208
|
|
- return
|
2209
|
|
- }
|
|
2179
|
+ if (this.dayorMonth == 'day') {
|
|
2180
|
+ if (this.curPrescriptions.order_status == 2) {
|
|
2181
|
+ this.$message.error('当前处方已经结算,无法保存')
|
|
2182
|
+ return
|
2210
|
2183
|
}
|
2211
|
|
- }
|
2212
|
|
- for (let i = 0; i < this.prescriptions.length; i++) {
|
2213
|
|
- if (this.prescriptions[i].med_type == 0 || this.prescriptions[i].med_type == '') {
|
2214
|
|
- this.$message.error('处方医疗类型不能为空')
|
|
2184
|
+ if (this.doctorValue.length <= 0) {
|
|
2185
|
+ this.$message.error('医生不能为空')
|
2215
|
2186
|
return
|
2216
|
2187
|
}
|
2217
|
|
- }
|
2218
|
|
- if (index == 1) {
|
2219
|
|
- console.log(this.prescriptions)
|
2220
|
2188
|
|
|
2189
|
+ if (this.departmentValue.length <= 0) {
|
|
2190
|
+ this.$message.error('科室不能为空')
|
|
2191
|
+ return
|
|
2192
|
+ }
|
|
2193
|
+ if (this.state1 <= 0) {
|
|
2194
|
+ this.$message.error('疾病类型不能为空')
|
|
2195
|
+ return
|
|
2196
|
+ }
|
2221
|
2197
|
for (let i = 0; i < this.prescriptions.length; i++) {
|
2222
|
|
- for(let b = 0; b < this.prescriptions[i].advices.length; b++){
|
2223
|
|
- if (this.prescriptions[i].med_type == 14 && this.prescriptions[i].advices[b].drug.is_special_diseases != 1) {
|
2224
|
|
- this.$message.error(this.prescriptions[i].name.toString() +"属于特病类型处方,不能开非特病类型的药")
|
|
2198
|
+ for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
|
|
2199
|
+ if (this.prescriptions[i].advices[b].prescribing_number == 0 || this.prescriptions[i].advices[b].prescribing_number == '') {
|
|
2200
|
+ this.$message.error('药品处方总量不能为0')
|
2225
|
2201
|
return
|
2226
|
2202
|
}
|
2227
|
2203
|
}
|
2228
|
|
- for(let c = 0; c < this.prescriptions[i].project.length; c++){
|
2229
|
|
- if (this.prescriptions[i].med_type == 14 && this.prescriptions[i].project[c].type == 2 && this.prescriptions[i].project[c].project.disease_directory != 1) {
|
2230
|
|
- this.$message.error(this.prescriptions[i].name.toString() +"属于特病类型处方,请开特病类型的项目")
|
2231
|
|
- return
|
2232
|
|
- }
|
2233
|
|
-
|
2234
|
|
- if (this.prescriptions[i].med_type == 14 && this.prescriptions[i].project[c].type == 3 && this.prescriptions[i].project[c].good_info.is_special_diseases != 1) {
|
2235
|
|
- this.$message.error(this.prescriptions[i].name.toString() +"属于特病类型处方,请开特病类型的耗材")
|
|
2204
|
+ }
|
|
2205
|
+ for (let i = 0; i < this.prescriptions.length; i++) {
|
|
2206
|
+ for (let b = 0; b < this.prescriptions[i].project.length; b++) {
|
|
2207
|
+ if (this.prescriptions[i].project[b].total == 0 || this.prescriptions[i].project[b].total == '') {
|
|
2208
|
+ this.$message.error('项目处方总量不能为0')
|
2236
|
2209
|
return
|
2237
|
2210
|
}
|
2238
|
2211
|
}
|
2239
|
2212
|
}
|
2240
|
|
-
|
2241
|
|
-
|
2242
|
2213
|
for (let i = 0; i < this.prescriptions.length; i++) {
|
2243
|
|
- if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length == 0) {
|
2244
|
|
- this.$message.error('处方内容不能为空')
|
|
2214
|
+ if (this.prescriptions[i].med_type == 0 || this.prescriptions[i].med_type == '') {
|
|
2215
|
+ this.$message.error('处方医疗类型不能为空')
|
2245
|
2216
|
return
|
2246
|
2217
|
}
|
2247
|
2218
|
}
|
|
2219
|
+ if (index == 1) {
|
|
2220
|
+ console.log(this.prescriptions)
|
2248
|
2221
|
|
2249
|
|
- let params = {
|
2250
|
|
- p_type: 2,
|
2251
|
|
- patient_id: this.patientInfo.id,
|
2252
|
|
- diagnose: this.diagnose.join(','),
|
2253
|
|
- sick_type: this.state1,
|
2254
|
|
- sick_history: this.state2,
|
2255
|
|
- doctor: this.doctorValue,
|
2256
|
|
- department: this.departmentValue,
|
2257
|
|
- record_date: this.record_date,
|
2258
|
|
- his_patient_id: this.hisPatientInfo.id,
|
2259
|
|
- reg_type: this.register_type
|
2260
|
|
- }
|
|
2222
|
+ for (let i = 0; i < this.prescriptions.length; i++) {
|
|
2223
|
+ for(let b = 0; b < this.prescriptions[i].advices.length; b++){
|
|
2224
|
+ if (this.prescriptions[i].med_type == 14 && this.prescriptions[i].advices[b].drug.is_special_diseases != 1) {
|
|
2225
|
+ this.$message.error(this.prescriptions[i].name.toString() +"属于特病类型处方,不能开非特病类型的药")
|
|
2226
|
+ return
|
|
2227
|
+ }
|
|
2228
|
+ }
|
|
2229
|
+ for(let c = 0; c < this.prescriptions[i].project.length; c++){
|
|
2230
|
+ if (this.prescriptions[i].med_type == 14 && this.prescriptions[i].project[c].type == 2 && this.prescriptions[i].project[c].project.disease_directory != 1) {
|
|
2231
|
+ this.$message.error(this.prescriptions[i].name.toString() +"属于特病类型处方,请开特病类型的项目")
|
|
2232
|
+ return
|
|
2233
|
+ }
|
2261
|
2234
|
|
2262
|
|
- for (let i = 0; i < this.prescriptions.length; i++) {
|
2263
|
|
- if (this.prescriptions[i].advices.length > 0 && this.prescriptions[i].project.length == 0) {
|
2264
|
|
- this.prescriptions[i]['type'] = 1
|
2265
|
|
- }
|
2266
|
|
- if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length > 0) {
|
2267
|
|
- this.prescriptions[i]['type'] = 2
|
|
2235
|
+ if (this.prescriptions[i].med_type == 14 && this.prescriptions[i].project[c].type == 3 && this.prescriptions[i].project[c].good_info.is_special_diseases != 1) {
|
|
2236
|
+ this.$message.error(this.prescriptions[i].name.toString() +"属于特病类型处方,请开特病类型的耗材")
|
|
2237
|
+ return
|
|
2238
|
+ }
|
|
2239
|
+ }
|
2268
|
2240
|
}
|
2269
|
2241
|
|
2270
|
|
- for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
|
2271
|
|
- this.prescriptions[i].advices[b].single_dose = this.prescriptions[i].advices[b].single_dose.toString()
|
2272
|
|
- this.prescriptions[i].advices[b].prescribing_number = this.prescriptions[i].advices[b].prescribing_number.toString()
|
2273
|
|
- this.prescriptions[i].advices[b].retail_price = this.prescriptions[i].advices[b].retail_price.toString()
|
2274
|
|
- this.prescriptions[i].advices[b].day = parseInt(this.prescriptions[i].advices[b].day)
|
2275
|
|
- this.prescriptions[i].advices[b].groupno = parseInt(this.prescriptions[i].advices[b].groupno)
|
2276
|
2242
|
|
|
2243
|
+ for (let i = 0; i < this.prescriptions.length; i++) {
|
|
2244
|
+ if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length == 0) {
|
|
2245
|
+ this.$message.error('处方内容不能为空')
|
|
2246
|
+ return
|
|
2247
|
+ }
|
|
2248
|
+ }
|
|
2249
|
+ this.$emit('editKeepLoad', true)
|
|
2250
|
+ let params = {
|
|
2251
|
+ p_type: 2,
|
|
2252
|
+ patient_id: this.patientInfo.id,
|
|
2253
|
+ diagnose: this.diagnose.join(','),
|
|
2254
|
+ sick_type: this.state1,
|
|
2255
|
+ sick_history: this.state2,
|
|
2256
|
+ doctor: this.doctorValue,
|
|
2257
|
+ department: this.departmentValue,
|
|
2258
|
+ record_date: this.record_date,
|
|
2259
|
+ his_patient_id: this.hisPatientInfo.id,
|
|
2260
|
+ reg_type: this.register_type
|
2277
|
2261
|
}
|
2278
|
2262
|
|
2279
|
|
- for (let b = 0; b < this.prescriptions[i].project.length; b++) {
|
2280
|
|
- this.prescriptions[i].project[b].price = this.prescriptions[i].project[b].price.toString()
|
2281
|
|
- this.prescriptions[i].project[b].total = this.prescriptions[i].project[b].total.toString()
|
2282
|
|
- this.prescriptions[i].project[b].delivery_way = this.prescriptions[i].project[b].delivery_way.toString()
|
2283
|
|
- this.prescriptions[i].project[b].single_dose = this.prescriptions[i].project[b].single_dose.toString()
|
|
2263
|
+ for (let i = 0; i < this.prescriptions.length; i++) {
|
|
2264
|
+ if (this.prescriptions[i].advices.length > 0 && this.prescriptions[i].project.length == 0) {
|
|
2265
|
+ this.prescriptions[i]['type'] = 1
|
|
2266
|
+ }
|
|
2267
|
+ if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length > 0) {
|
|
2268
|
+ this.prescriptions[i]['type'] = 2
|
|
2269
|
+ }
|
2284
|
2270
|
|
2285
|
|
- }
|
|
2271
|
+ for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
|
|
2272
|
+ this.prescriptions[i].advices[b].single_dose = this.prescriptions[i].advices[b].single_dose.toString()
|
|
2273
|
+ this.prescriptions[i].advices[b].prescribing_number = this.prescriptions[i].advices[b].prescribing_number.toString()
|
|
2274
|
+ this.prescriptions[i].advices[b].retail_price = this.prescriptions[i].advices[b].retail_price.toString()
|
|
2275
|
+ this.prescriptions[i].advices[b].day = parseInt(this.prescriptions[i].advices[b].day)
|
|
2276
|
+ this.prescriptions[i].advices[b].groupno = parseInt(this.prescriptions[i].advices[b].groupno)
|
2286
|
2277
|
|
2287
|
|
- for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
|
2288
|
|
- this.prescriptions[i].addition[b].id = prarseInt(this.prescriptions[i].addition[b].id)
|
2289
|
|
- this.prescriptions[i].addition[b].item_id = parseInt(this.prescriptions[i].addition[b].item_id)
|
2290
|
|
- this.prescriptions[i].addition[b].price = this.prescriptions[i].addition[b].price.toString()
|
2291
|
|
- this.prescriptions[i].addition[b].count = this.prescriptions[i].addition[b].count.toString()
|
2292
|
|
- }
|
2293
|
|
- }
|
2294
|
|
- let data = {
|
2295
|
|
- 'prescriptions': this.prescriptions
|
2296
|
|
- }
|
2297
|
|
- isLoading = true
|
2298
|
|
- console.log('this.prescriptionsthis.prescriptions', this.prescriptions)
|
2299
|
|
- let num = 0
|
2300
|
|
- // this.prescriptions.map(item => {
|
2301
|
|
- // if (item.advices.length > 0) {
|
2302
|
|
- // item.advices.map(it => {
|
2303
|
|
- // if (it.drug.total <= 0) {
|
2304
|
|
- // num++
|
2305
|
|
- // setTimeout(() => {
|
2306
|
|
- // this.$message.error(it.drug.drug_name + '库存不足')
|
2307
|
|
- // }, 100)
|
2308
|
|
- // }
|
2309
|
|
- // })
|
2310
|
|
- // }
|
2311
|
|
- // })
|
2312
|
|
- if (num == 0) {
|
2313
|
|
-
|
2314
|
|
- createHisPrescription(data, params).then(response => {
|
2315
|
|
- if (response.data.state == 1) {
|
2316
|
|
- this.$emit('change', this.patientInfo.id)
|
2317
|
|
- this.$message.success('保存成功')
|
2318
|
|
- } else {
|
2319
|
|
- this.$message.error(response.data.msg)
|
2320
|
2278
|
}
|
2321
|
|
- })
|
2322
|
|
- }
|
|
2279
|
+
|
|
2280
|
+ for (let b = 0; b < this.prescriptions[i].project.length; b++) {
|
|
2281
|
+ this.prescriptions[i].project[b].price = this.prescriptions[i].project[b].price.toString()
|
|
2282
|
+ this.prescriptions[i].project[b].total = this.prescriptions[i].project[b].total.toString()
|
|
2283
|
+ this.prescriptions[i].project[b].delivery_way = this.prescriptions[i].project[b].delivery_way.toString()
|
|
2284
|
+ this.prescriptions[i].project[b].single_dose = this.prescriptions[i].project[b].single_dose.toString()
|
|
2285
|
+
|
|
2286
|
+ }
|
|
2287
|
+
|
|
2288
|
+ for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
|
|
2289
|
+ this.prescriptions[i].addition[b].id = prarseInt(this.prescriptions[i].addition[b].id)
|
|
2290
|
+ this.prescriptions[i].addition[b].item_id = parseInt(this.prescriptions[i].addition[b].item_id)
|
|
2291
|
+ this.prescriptions[i].addition[b].price = this.prescriptions[i].addition[b].price.toString()
|
|
2292
|
+ this.prescriptions[i].addition[b].count = this.prescriptions[i].addition[b].count.toString()
|
|
2293
|
+ }
|
|
2294
|
+ }
|
|
2295
|
+ let data = {
|
|
2296
|
+ 'prescriptions': this.prescriptions
|
|
2297
|
+ }
|
|
2298
|
+ isLoading = true
|
|
2299
|
+ console.log('this.prescriptionsthis.prescriptions', this.prescriptions)
|
|
2300
|
+ let num = 0
|
|
2301
|
+ // this.prescriptions.map(item => {
|
|
2302
|
+ // if (item.advices.length > 0) {
|
|
2303
|
+ // item.advices.map(it => {
|
|
2304
|
+ // if (it.drug.total <= 0) {
|
|
2305
|
+ // num++
|
|
2306
|
+ // setTimeout(() => {
|
|
2307
|
+ // this.$message.error(it.drug.drug_name + '库存不足')
|
|
2308
|
+ // }, 100)
|
|
2309
|
+ // }
|
|
2310
|
+ // })
|
|
2311
|
+ // }
|
|
2312
|
+ // })
|
|
2313
|
+ if (num == 0) {
|
|
2314
|
+
|
|
2315
|
+ createHisPrescription(data, params).then(response => {
|
|
2316
|
+ if (response.data.state == 1) {
|
|
2317
|
+ this.$emit('change', this.patientInfo.id)
|
|
2318
|
+ this.$message.success('保存成功')
|
|
2319
|
+ this.$emit('editKeepLoad', false)
|
|
2320
|
+ } else {
|
|
2321
|
+ this.$message.error(response.data.msg)
|
|
2322
|
+ this.$emit('editKeepLoad', false)
|
|
2323
|
+ }
|
|
2324
|
+ })
|
|
2325
|
+ }
|
|
2326
|
+ }
|
2323
|
2327
|
|
2324
|
2328
|
} else if (index == 2) {
|
2325
|
2329
|
this.$router.push('/outpatientDoctorStation/print')
|