|
@@ -228,7 +228,7 @@
|
228
|
228
|
</el-table-column>
|
229
|
229
|
<el-table-column label="药品追溯码" width="162" align="center">
|
230
|
230
|
<template slot-scope="scope">
|
231
|
|
- <div @click="getDrugCode(scope.row.ID,scope.row.DataSources,scope.row.DrugCode,scope.$index)"><el-input style="width: 100;" v-model="scope.row.DrugCode"></el-input></div>
|
|
231
|
+ <div @click="getDrugCode(scope.row.ID,scope.row.DataSources,scope.row.DrugCode,scope.$index,scope.row.DrugId)"><el-input style="width: 100;" v-model="scope.row.DrugCode"></el-input></div>
|
232
|
232
|
</template>
|
233
|
233
|
</el-table-column>
|
234
|
234
|
<el-table-column label="开立医生" width="150" align="center">
|
|
@@ -354,7 +354,8 @@ import {
|
354
|
354
|
drugwithdrawal,
|
355
|
355
|
getpartitionlist,
|
356
|
356
|
changeDrugCode,
|
357
|
|
- changeZeroFlag
|
|
357
|
+ changeZeroFlag,
|
|
358
|
+ getDrugTocalCount
|
358
|
359
|
|
359
|
360
|
} from "@/api/pharmacy";
|
360
|
361
|
import dataDruguse from "../../router/modules/dataDruguse";
|
|
@@ -415,8 +416,10 @@ export default {
|
415
|
416
|
currentIndex:0,
|
416
|
417
|
is_drug_open:"2",
|
417
|
418
|
textarea:"",
|
418
|
|
- patientList:[]
|
419
|
|
-
|
|
419
|
+ patientList:[],
|
|
420
|
+ drug_id:0,
|
|
421
|
+ total_count:0,
|
|
422
|
+ newArrList:[]
|
420
|
423
|
};
|
421
|
424
|
},
|
422
|
425
|
watch: {},
|
|
@@ -1238,20 +1241,98 @@ export default {
|
1238
|
1241
|
}
|
1239
|
1242
|
return spc
|
1240
|
1243
|
},
|
1241
|
|
- getDrugCode(id,DataSources,DrugCode,index){
|
1242
|
|
- this.id = id
|
1243
|
|
- var is_source =0
|
1244
|
|
- if (DataSources == "his处方"){
|
1245
|
|
- is_source = 1
|
1246
|
|
- }
|
1247
|
|
- if (DataSources == "临时医嘱"){
|
1248
|
|
- is_source = 2
|
1249
|
|
- }
|
1250
|
|
- this.is_source = is_source
|
1251
|
|
- this.textarea = DrugCode
|
1252
|
|
- this.currentIndex = index
|
|
1244
|
+ getDrugCode(id,DataSources,DrugCode,index,DrugId){
|
1253
|
1245
|
|
1254
|
|
- this.dialogVisibleOne = true
|
|
1246
|
+ // 针对百霖
|
|
1247
|
+ if(this.$store.getters.xt_user.org.id == 10138 || this.$store.getters.xt_user.org.id == 0){
|
|
1248
|
+ var params = {
|
|
1249
|
+ drug_id:DrugId,
|
|
1250
|
+ start_time:moment().subtract(15, 'days').format("YYYY-MM-DD")
|
|
1251
|
+ }
|
|
1252
|
+ console.log("params-------------",params)
|
|
1253
|
+ getDrugTocalCount(params).then(response=>{
|
|
1254
|
+ if(response.data.state == 1){
|
|
1255
|
+
|
|
1256
|
+ var adviceList = response.data.data.adviceList
|
|
1257
|
+
|
|
1258
|
+ var str = ""
|
|
1259
|
+ if(adviceList!=null && adviceList.length>0){
|
|
1260
|
+ for(let i=0;i<adviceList.length;i++){
|
|
1261
|
+ if(adviceList[i].drug_code!=""){
|
|
1262
|
+ str+=adviceList[i].drug_code
|
|
1263
|
+ }
|
|
1264
|
+
|
|
1265
|
+ }
|
|
1266
|
+ }
|
|
1267
|
+ var new_arr = str.split(",");
|
|
1268
|
+
|
|
1269
|
+ console.log("adviceList==========",new_arr)
|
|
1270
|
+
|
|
1271
|
+ if(new_arr!=null && new_arr.length>0){
|
|
1272
|
+
|
|
1273
|
+ let dataInfo = {}
|
|
1274
|
+ new_arr.forEach((item, index) => {
|
|
1275
|
+ if (!dataInfo[item]) {
|
|
1276
|
+ dataInfo[item] = {
|
|
1277
|
+ drug_code:item,
|
|
1278
|
+ child: [],
|
|
1279
|
+ }
|
|
1280
|
+ }
|
|
1281
|
+ })
|
|
1282
|
+ let arr = Object.values(dataInfo)
|
|
1283
|
+
|
|
1284
|
+ if(arr!=null && arr.length>0){
|
|
1285
|
+
|
|
1286
|
+ for(let i=0;i<arr.length;i++){
|
|
1287
|
+ for(let j=0;j<new_arr.length;j++){
|
|
1288
|
+ if(arr[i].drug_code == new_arr[j]){
|
|
1289
|
+ arr[i].child.push(new_arr[j])
|
|
1290
|
+ }
|
|
1291
|
+ }
|
|
1292
|
+ }
|
|
1293
|
+ }
|
|
1294
|
+
|
|
1295
|
+ this.newArrList = []
|
|
1296
|
+ this.newArrList = arr
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+ }
|
|
1300
|
+
|
|
1301
|
+ this.drug_id = DrugId
|
|
1302
|
+ this.id = id
|
|
1303
|
+ var is_source =0
|
|
1304
|
+ if (DataSources == "his处方"){
|
|
1305
|
+ is_source = 1
|
|
1306
|
+ }
|
|
1307
|
+ if (DataSources == "临时医嘱"){
|
|
1308
|
+ is_source = 2
|
|
1309
|
+ }
|
|
1310
|
+ this.is_source = is_source
|
|
1311
|
+ this.textarea = DrugCode
|
|
1312
|
+ this.currentIndex = index
|
|
1313
|
+
|
|
1314
|
+ this.dialogVisibleOne = true
|
|
1315
|
+ }
|
|
1316
|
+ })
|
|
1317
|
+ }else{
|
|
1318
|
+
|
|
1319
|
+ this.drug_id = DrugId
|
|
1320
|
+ this.id = id
|
|
1321
|
+ var is_source =0
|
|
1322
|
+ if (DataSources == "his处方"){
|
|
1323
|
+ is_source = 1
|
|
1324
|
+ }
|
|
1325
|
+ if (DataSources == "临时医嘱"){
|
|
1326
|
+ is_source = 2
|
|
1327
|
+ }
|
|
1328
|
+ this.is_source = is_source
|
|
1329
|
+ this.textarea = DrugCode
|
|
1330
|
+ this.currentIndex = index
|
|
1331
|
+
|
|
1332
|
+ this.dialogVisibleOne = true
|
|
1333
|
+ }
|
|
1334
|
+
|
|
1335
|
+
|
1255
|
1336
|
|
1256
|
1337
|
},
|
1257
|
1338
|
saveTextArea(){
|
|
@@ -1274,6 +1355,7 @@ export default {
|
1274
|
1355
|
})
|
1275
|
1356
|
},
|
1276
|
1357
|
changeText(event){
|
|
1358
|
+
|
1277
|
1359
|
|
1278
|
1360
|
// 检查是否为特定的按键,例如回车键,来确认扫码枪输入完成
|
1279
|
1361
|
if (event.key === 'Enter') {
|
|
@@ -1281,30 +1363,118 @@ export default {
|
1281
|
1363
|
var textarea = ""
|
1282
|
1364
|
textarea += this.textarea.replace(/^\s*[\r\n]|\r?\n\s*$/gm, '') + ","
|
1283
|
1365
|
|
1284
|
|
-
|
1285
|
|
-
|
1286
|
1366
|
if(this.$store.getters.xt_user.org.id == 10138 || this.$store.getters.xt_user.org.id==0){
|
|
1367
|
+
|
|
1368
|
+ var drugindentificaitoncode = this.getDrugIdentificationCode(this.drug_id)
|
|
1369
|
+ console.log("drugindentification===================",drugindentificaitoncode)
|
|
1370
|
+
|
|
1371
|
+ var scan_code = this.getDrugScanCode(this.drug_id)
|
|
1372
|
+
|
|
1373
|
+ console.log("scan_code============",scan_code)
|
|
1374
|
+
|
|
1375
|
+ var total_one = 0
|
|
1376
|
+ var total_two = 0
|
|
1377
|
+
|
|
1378
|
+ console.log("newArr-------------",this.newArrList)
|
|
1379
|
+
|
|
1380
|
+
|
|
1381
|
+
|
1287
|
1382
|
var arr= []
|
1288
|
1383
|
arr = textarea.split(",")
|
|
1384
|
+ var arrList = []
|
|
1385
|
+ if(arr!=null && arr.length>0){
|
|
1386
|
+ let dataInfo = {}
|
|
1387
|
+ arr.forEach((item, index) => {
|
|
1388
|
+ if (!dataInfo[item]) {
|
|
1389
|
+ dataInfo[item] = {
|
|
1390
|
+ drug_code:item,
|
|
1391
|
+ child: [],
|
|
1392
|
+ }
|
|
1393
|
+ }
|
|
1394
|
+ })
|
|
1395
|
+ let new_arr = Object.values(dataInfo)
|
|
1396
|
+
|
|
1397
|
+ if(new_arr!=null && new_arr.length>0){
|
|
1398
|
+
|
|
1399
|
+ for(let i=0;i<new_arr.length;i++){
|
|
1400
|
+ for(let j=0;j<arr.length;j++){
|
|
1401
|
+ if(new_arr[i].drug_code == arr[j]){
|
|
1402
|
+ new_arr[i].child.push(arr[j])
|
|
1403
|
+ }
|
|
1404
|
+ }
|
|
1405
|
+ }
|
|
1406
|
+ }
|
|
1407
|
+ arrList = new_arr
|
|
1408
|
+
|
|
1409
|
+ }
|
|
1410
|
+
|
1289
|
1411
|
var is_err_check = false
|
1290
|
1412
|
var i_index = ""
|
|
1413
|
+ var drug_code = ""
|
|
1414
|
+
|
1291
|
1415
|
if(arr!=null && arr.length>0){
|
1292
|
1416
|
for(let i=0;i<arr.length;i++){
|
|
1417
|
+
|
1293
|
1418
|
if(arr[i]!=""){
|
|
1419
|
+ drug_code = arr[i]
|
|
1420
|
+ i_index = i
|
1294
|
1421
|
if(arr[i].length!=20){
|
1295
|
1422
|
this.$message.error("药品追溯码长度没有满足20位!")
|
1296
|
1423
|
is_err_check = true
|
1297
|
|
- i_index = i
|
1298
|
1424
|
}
|
|
1425
|
+ if(drugindentificaitoncode>0){
|
|
1426
|
+ if(arr[i].substring(0,7)!= drugindentificaitoncode){
|
|
1427
|
+ this.$message.error("药品标识码格式不正确,请重新扫码")
|
|
1428
|
+ is_err_check = true
|
|
1429
|
+ }
|
|
1430
|
+ }
|
|
1431
|
+
|
|
1432
|
+
|
1299
|
1433
|
}
|
1300
|
1434
|
|
1301
|
1435
|
}
|
1302
|
1436
|
}
|
1303
|
|
- console.log("is_err_check+++++++++++++",is_err_check)
|
1304
|
1437
|
if(is_err_check == true){
|
1305
|
1438
|
arr.splice(i_index,1)
|
1306
|
1439
|
}
|
1307
|
|
- console.log("arr-------------------------",arr)
|
|
1440
|
+
|
|
1441
|
+ for(let i=0;i<this.newArrList.length;i++){
|
|
1442
|
+ if(drug_code == this.newArrList[i].drug_code){
|
|
1443
|
+ total_one = this.newArrList[i].child.length
|
|
1444
|
+ }
|
|
1445
|
+ }
|
|
1446
|
+
|
|
1447
|
+ for(let i=0;i<arrList.length;i++){
|
|
1448
|
+ if(drug_code == arrList[i].drug_code){
|
|
1449
|
+ total_two = arrList[i].child.length
|
|
1450
|
+ }
|
|
1451
|
+ }
|
|
1452
|
+
|
|
1453
|
+
|
|
1454
|
+ console.log("数量1--------------",total_one)
|
|
1455
|
+ console.log("数量2---------------",total_two)
|
|
1456
|
+
|
|
1457
|
+ console.log("scan_code=====",scan_code)
|
|
1458
|
+
|
|
1459
|
+ if(scan_code>0){
|
|
1460
|
+ if((total_one + total_two)>scan_code){
|
|
1461
|
+ this.$message.error("扫码次数已经超过限制!")
|
|
1462
|
+ arr.splice(i_index,1)
|
|
1463
|
+ }
|
|
1464
|
+ }
|
|
1465
|
+
|
|
1466
|
+
|
|
1467
|
+
|
|
1468
|
+
|
|
1469
|
+ var is_arr = this.hasDuplicates(arr)
|
|
1470
|
+
|
|
1471
|
+ if(is_arr == true){
|
|
1472
|
+ this.$message.error("药品追溯码已经存在,不能重复扫码!")
|
|
1473
|
+ arr.splice(i_index,1)
|
|
1474
|
+ }
|
|
1475
|
+
|
|
1476
|
+ console.log("is_arr-=--------------",is_arr)
|
|
1477
|
+
|
1308
|
1478
|
this.textarea = arr.join(",")
|
1309
|
1479
|
}else{
|
1310
|
1480
|
|
|
@@ -1317,6 +1487,31 @@ export default {
|
1317
|
1487
|
|
1318
|
1488
|
|
1319
|
1489
|
},
|
|
1490
|
+
|
|
1491
|
+ hasDuplicates(arr) {
|
|
1492
|
+ const uniqueNumbers = [...new Set(arr)];
|
|
1493
|
+ return uniqueNumbers.length !== arr.length;
|
|
1494
|
+ },
|
|
1495
|
+ getDrugIdentificationCode(id){
|
|
1496
|
+
|
|
1497
|
+ var drug_identification_code = ""
|
|
1498
|
+ for(let i=0;i<this.baseList.length;i++){
|
|
1499
|
+ if(id == this.baseList[i].id){
|
|
1500
|
+ drug_identification_code = this.baseList[i].drug_identification_code
|
|
1501
|
+ }
|
|
1502
|
+ }
|
|
1503
|
+ return drug_identification_code
|
|
1504
|
+ },
|
|
1505
|
+ getDrugScanCode(drug_id){
|
|
1506
|
+ var scan_code = ""
|
|
1507
|
+ for(let i=0;i<this.baseList.length;i++){
|
|
1508
|
+ if(drug_id == this.baseList[i].id){
|
|
1509
|
+ scan_code = this.baseList[i].scan_code
|
|
1510
|
+ }
|
|
1511
|
+ }
|
|
1512
|
+ return scan_code
|
|
1513
|
+ }
|
|
1514
|
+
|
1320
|
1515
|
|
1321
|
1516
|
|
1322
|
1517
|
},
|