|
@@ -1093,14 +1093,14 @@ func (c *HisApiController) CreateHisPrescription() {
|
1093
|
1093
|
advicelist, _ := service.GetHisAdviceListByDrugIdEight(drug_id, patient_id, recordDateTime, adviceId)
|
1094
|
1094
|
|
1095
|
1095
|
//查询最新批次库存
|
1096
|
|
- info, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
|
1097
|
|
- var batch_number_count int64
|
1098
|
|
- batch_number_count = info.StockMaxNumber*drug.MinNumber + info.StockMinNumber
|
1099
|
|
- batch_number_counts := strconv.FormatInt(batch_number_count, 10)
|
|
1096
|
+ //info, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
|
|
1097
|
+ //var batch_number_count int64
|
|
1098
|
+ //batch_number_count = info.StockMaxNumber*drug.MinNumber + info.StockMinNumber
|
|
1099
|
+ //batch_number_counts := strconv.FormatInt(batch_number_count, 10)
|
1100
|
1100
|
//新增处方
|
1101
|
1101
|
if advicelist.ID == 0 {
|
1102
|
1102
|
all_count, _ := strconv.ParseFloat(totals, 64)
|
1103
|
|
- batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
|
|
1103
|
+ //batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
|
1104
|
1104
|
if prescribingNumberUnit == drug.MinUnit {
|
1105
|
1105
|
|
1106
|
1106
|
if drug.IsUse != 1 {
|
|
@@ -1109,10 +1109,10 @@ func (c *HisApiController) CreateHisPrescription() {
|
1109
|
1109
|
return
|
1110
|
1110
|
}
|
1111
|
1111
|
|
1112
|
|
- if prescribing_number > batch_number_all_count {
|
1113
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1114
|
|
- return
|
1115
|
|
- }
|
|
1112
|
+ //if prescribing_number > batch_number_all_count {
|
|
1113
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
|
1114
|
+ // return
|
|
1115
|
+ //}
|
1116
|
1116
|
|
1117
|
1117
|
}
|
1118
|
1118
|
|
|
@@ -1125,10 +1125,10 @@ func (c *HisApiController) CreateHisPrescription() {
|
1125
|
1125
|
return
|
1126
|
1126
|
}
|
1127
|
1127
|
|
1128
|
|
- if num > batch_number_all_count {
|
1129
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1130
|
|
- return
|
1131
|
|
- }
|
|
1128
|
+ //if num > batch_number_all_count {
|
|
1129
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
|
1130
|
+ // return
|
|
1131
|
+ //}
|
1132
|
1132
|
}
|
1133
|
1133
|
}
|
1134
|
1134
|
}
|
|
@@ -1190,10 +1190,12 @@ func (c *HisApiController) CreateHisPrescription() {
|
1190
|
1190
|
c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
1191
|
1191
|
return
|
1192
|
1192
|
}
|
1193
|
|
- if prescribing_number > batch_number_all_count {
|
1194
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1195
|
|
- return
|
1196
|
|
- }
|
|
1193
|
+ fmt.Println("prescribing_number2332323323323", prescribing_number)
|
|
1194
|
+ fmt.Println("batch_number_all_count", batch_number_all_count)
|
|
1195
|
+ //if prescribing_number > batch_number_all_count {
|
|
1196
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
|
1197
|
+ // return
|
|
1198
|
+ //}
|
1197
|
1199
|
}
|
1198
|
1200
|
|
1199
|
1201
|
} else {
|
|
@@ -1205,11 +1207,12 @@ func (c *HisApiController) CreateHisPrescription() {
|
1205
|
1207
|
c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
1206
|
1208
|
return
|
1207
|
1209
|
}
|
1208
|
|
-
|
1209
|
|
- if prescribing_number > batch_number_all_count {
|
1210
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1211
|
|
- return
|
1212
|
|
- }
|
|
1210
|
+ fmt.Println("prescribing_number2332323323323", prescribing_number)
|
|
1211
|
+ fmt.Println("batch_number_all_count", batch_number_all_count)
|
|
1212
|
+ //if prescribing_number > batch_number_all_count {
|
|
1213
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
|
1214
|
+ // return
|
|
1215
|
+ //}
|
1213
|
1216
|
}
|
1214
|
1217
|
|
1215
|
1218
|
}
|
|
@@ -1254,37 +1257,44 @@ func (c *HisApiController) CreateHisPrescription() {
|
1254
|
1257
|
c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
1255
|
1258
|
return
|
1256
|
1259
|
}
|
|
1260
|
+ fmt.Println("number_count", number_count)
|
|
1261
|
+ fmt.Println("device_number", device_number)
|
|
1262
|
+ fmt.Println("batch_number_count", batch_number_count)
|
1257
|
1263
|
|
1258
|
|
- if (number_count - device_number) > batch_number_count {
|
1259
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1260
|
|
- return
|
1261
|
|
- }
|
|
1264
|
+ //if (number_count - device_number) > batch_number_count {
|
|
1265
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
|
1266
|
+ // return
|
|
1267
|
+ //}
|
1262
|
1268
|
|
1263
|
1269
|
// 查询该药品最后一次出库记录
|
1264
|
|
- outInfo, _ := service.GetLastDrugWarehouseOutByDrugIdTwenty(drug_id, patient_id, recordDateTime, adviceId)
|
1265
|
|
- var out_count int64
|
1266
|
|
- var in_count int64
|
1267
|
|
- var stock_max_number int64
|
1268
|
|
- var stock_min_number int64
|
1269
|
|
- for _, it := range outInfo {
|
1270
|
|
- if it.CountUnit == drug.MaxUnit {
|
1271
|
|
- it.Count = it.Count * drug.MinNumber
|
1272
|
|
- }
|
1273
|
|
- out_count += it.Count
|
1274
|
|
- warehouseInfoList, _ := service.GetDrugWarehouseInfoById(it.WarehouseInfoId)
|
1275
|
|
- stock_max_number = warehouseInfoList.StockMaxNumber
|
1276
|
|
- stock_min_number = warehouseInfoList.StockMinNumber
|
1277
|
|
- if warehouseInfoList.MaxUnit == drug.MaxUnit {
|
1278
|
|
- in_count = warehouseInfoList.WarehousingCount * drug.MinNumber
|
1279
|
|
- }
|
1280
|
|
- if warehouseInfoList.MaxUnit == drug.MinUnit {
|
1281
|
|
- in_count = warehouseInfoList.WarehousingCount
|
1282
|
|
- }
|
1283
|
|
- }
|
1284
|
|
- if (out_count + (number_count - device_number)) > in_count {
|
1285
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(stock_max_number, 10) + drug.MaxUnit + strconv.FormatInt(stock_min_number, 10) + drug.MinUnit)
|
1286
|
|
- return
|
1287
|
|
- }
|
|
1270
|
+ //outInfo, _ := service.GetLastDrugWarehouseOutByDrugIdTwenty(drug_id, patient_id, recordDateTime, adviceId)
|
|
1271
|
+ //var out_count int64
|
|
1272
|
+ //var in_count int64
|
|
1273
|
+ //var stock_max_number int64
|
|
1274
|
+ //var stock_min_number int64
|
|
1275
|
+ //for _, it := range outInfo {
|
|
1276
|
+ // if it.CountUnit == drug.MaxUnit {
|
|
1277
|
+ // it.Count = it.Count * drug.MinNumber
|
|
1278
|
+ // }
|
|
1279
|
+ // out_count += it.Count
|
|
1280
|
+ // warehouseInfoList, _ := service.GetDrugWarehouseInfoById(it.WarehouseInfoId)
|
|
1281
|
+ // fmt.Println("warehouseInfoList233323232332323232",warehouseInfoList)
|
|
1282
|
+ // stock_max_number = warehouseInfoList.StockMaxNumber
|
|
1283
|
+ // stock_min_number = warehouseInfoList.StockMinNumber
|
|
1284
|
+ // if warehouseInfoList.MaxUnit == drug.MaxUnit {
|
|
1285
|
+ // in_count = warehouseInfoList.WarehousingCount * drug.MinNumber
|
|
1286
|
+ // }
|
|
1287
|
+ // if warehouseInfoList.MaxUnit == drug.MinUnit {
|
|
1288
|
+ // in_count = warehouseInfoList.WarehousingCount
|
|
1289
|
+ // }
|
|
1290
|
+ //}
|
|
1291
|
+ //fmt.Println("out_count",out_count)
|
|
1292
|
+ //fmt.Println("number_count - device_number",number_count - device_number)
|
|
1293
|
+ //fmt.Println("in_countwowowowowowow",in_count)
|
|
1294
|
+ //if (out_count + (number_count - device_number)) > in_count {
|
|
1295
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(stock_max_number, 10) + drug.MaxUnit + strconv.FormatInt(stock_min_number, 10) + drug.MinUnit)
|
|
1296
|
+ // return
|
|
1297
|
+ //}
|
1288
|
1298
|
|
1289
|
1299
|
}
|
1290
|
1300
|
|
|
@@ -1384,27 +1394,27 @@ func (c *HisApiController) CreateHisPrescription() {
|
1384
|
1394
|
//新增处方
|
1385
|
1395
|
if advicelist.ID == 0 {
|
1386
|
1396
|
//查询最新批次库存
|
1387
|
|
- info, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
|
1388
|
|
- var batch_number_count int64
|
1389
|
|
- batch_number_count = info.StockMaxNumber*drug.MinNumber + info.StockMinNumber
|
1390
|
|
- batch_number_counts := strconv.FormatInt(batch_number_count, 10)
|
|
1397
|
+ //info, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
|
|
1398
|
+ //var batch_number_count int64
|
|
1399
|
+ //batch_number_count = info.StockMaxNumber*drug.MinNumber + info.StockMinNumber
|
|
1400
|
+ //batch_number_counts := strconv.FormatInt(batch_number_count, 10)
|
1391
|
1401
|
all_count, _ := strconv.ParseFloat(totals, 64)
|
1392
|
1402
|
if prescribingNumberUnit == drug.MinUnit {
|
1393
|
|
- batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
|
|
1403
|
+ //batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
|
1394
|
1404
|
if drug.IsUse != 1 {
|
1395
|
1405
|
if prescribing_number > all_count {
|
1396
|
1406
|
c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
1397
|
1407
|
return
|
1398
|
1408
|
}
|
1399
|
|
- if prescribing_number > batch_number_all_count {
|
1400
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1401
|
|
- return
|
1402
|
|
- }
|
|
1409
|
+ //if prescribing_number > batch_number_all_count {
|
|
1410
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
|
1411
|
+ // return
|
|
1412
|
+ //}
|
1403
|
1413
|
}
|
1404
|
1414
|
|
1405
|
1415
|
} else {
|
1406
|
1416
|
if prescribingNumberUnit == drug.MaxUnit {
|
1407
|
|
- batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
|
|
1417
|
+ //batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
|
1408
|
1418
|
num := prescribing_number * float64(drug.MinNumber)
|
1409
|
1419
|
if drug.IsUse != 1 {
|
1410
|
1420
|
if num > all_count {
|
|
@@ -1412,10 +1422,10 @@ func (c *HisApiController) CreateHisPrescription() {
|
1412
|
1422
|
return
|
1413
|
1423
|
}
|
1414
|
1424
|
|
1415
|
|
- if prescribing_number > batch_number_all_count {
|
1416
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1417
|
|
- return
|
1418
|
|
- }
|
|
1425
|
+ //if prescribing_number > batch_number_all_count {
|
|
1426
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
|
1427
|
+ // return
|
|
1428
|
+ //}
|
1419
|
1429
|
}
|
1420
|
1430
|
|
1421
|
1431
|
}
|
|
@@ -1458,38 +1468,43 @@ func (c *HisApiController) CreateHisPrescription() {
|
1458
|
1468
|
c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
1459
|
1469
|
return
|
1460
|
1470
|
}
|
1461
|
|
- if (number_count - device_number) > batch_number_count {
|
1462
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1463
|
|
- return
|
1464
|
|
- }
|
|
1471
|
+ fmt.Println("number_count", number_count)
|
|
1472
|
+ fmt.Println("device_number", device_number)
|
|
1473
|
+ fmt.Println("batch_number_count", batch_number_count)
|
|
1474
|
+ //if (number_count - device_number) > batch_number_count {
|
|
1475
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
|
1476
|
+ // return
|
|
1477
|
+ //}
|
1465
|
1478
|
|
1466
|
1479
|
//查询历史出库数据总批次
|
1467
|
1480
|
// 查询该药品最后一次出库记录
|
1468
|
|
- outInfo, _ := service.GetLastDrugWarehouseOutByDrugIdTwenty(drug_id, patient_id, recordDateTime, adviceId)
|
1469
|
|
- var out_count int64
|
1470
|
|
- var in_count int64
|
1471
|
|
- var stock_max_number int64
|
1472
|
|
- var stock_min_number int64
|
1473
|
|
- for _, it := range outInfo {
|
1474
|
|
- if it.CountUnit == drug.MaxUnit {
|
1475
|
|
- it.Count = it.Count * drug.MinNumber
|
1476
|
|
- }
|
1477
|
|
- out_count += it.Count
|
1478
|
|
- warehouseInfoList, _ := service.GetDrugWarehouseInfoById(it.WarehouseInfoId)
|
1479
|
|
- stock_max_number = warehouseInfoList.StockMaxNumber
|
1480
|
|
- stock_min_number = warehouseInfoList.StockMinNumber
|
1481
|
|
- if warehouseInfoList.MaxUnit == drug.MaxUnit {
|
1482
|
|
- in_count = warehouseInfoList.WarehousingCount * drug.MinNumber
|
1483
|
|
- }
|
1484
|
|
- if warehouseInfoList.MaxUnit == drug.MinUnit {
|
1485
|
|
- in_count = warehouseInfoList.WarehousingCount
|
1486
|
|
- }
|
1487
|
|
- }
|
1488
|
|
-
|
1489
|
|
- if (out_count + (number_count - device_number)) > in_count {
|
1490
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(stock_max_number, 10) + drug.MaxUnit + strconv.FormatInt(stock_min_number, 10) + drug.MinUnit)
|
1491
|
|
- return
|
1492
|
|
- }
|
|
1481
|
+ //outInfo, _ := service.GetLastDrugWarehouseOutByDrugIdTwenty(drug_id, patient_id, recordDateTime, adviceId)
|
|
1482
|
+ //var out_count int64
|
|
1483
|
+ //var in_count int64
|
|
1484
|
+ //var stock_max_number int64
|
|
1485
|
+ //var stock_min_number int64
|
|
1486
|
+ //for _, it := range outInfo {
|
|
1487
|
+ // if it.CountUnit == drug.MaxUnit {
|
|
1488
|
+ // it.Count = it.Count * drug.MinNumber
|
|
1489
|
+ // }
|
|
1490
|
+ // out_count += it.Count
|
|
1491
|
+ // warehouseInfoList, _ := service.GetDrugWarehouseInfoById(it.WarehouseInfoId)
|
|
1492
|
+ // stock_max_number = warehouseInfoList.StockMaxNumber
|
|
1493
|
+ // stock_min_number = warehouseInfoList.StockMinNumber
|
|
1494
|
+ // if warehouseInfoList.MaxUnit == drug.MaxUnit {
|
|
1495
|
+ // in_count = warehouseInfoList.WarehousingCount * drug.MinNumber
|
|
1496
|
+ // }
|
|
1497
|
+ // if warehouseInfoList.MaxUnit == drug.MinUnit {
|
|
1498
|
+ // in_count = warehouseInfoList.WarehousingCount
|
|
1499
|
+ // }
|
|
1500
|
+ //}
|
|
1501
|
+ //fmt.Println("out_count",out_count)
|
|
1502
|
+ //fmt.Println("number_count - device_number",number_count - device_number)
|
|
1503
|
+ //fmt.Println("in_count",in_count)
|
|
1504
|
+ //if (out_count + (number_count - device_number)) > in_count {
|
|
1505
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(stock_max_number, 10) + drug.MaxUnit + strconv.FormatInt(stock_min_number, 10) + drug.MinUnit)
|
|
1506
|
+ // return
|
|
1507
|
+ //}
|
1493
|
1508
|
|
1494
|
1509
|
}
|
1495
|
1510
|
}
|