|
@@ -988,8 +988,6 @@ func (c *HisApiController) CreateHisPrescription() {
|
988
|
988
|
isCharge := false
|
989
|
989
|
if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
|
990
|
990
|
|
991
|
|
-
|
992
|
|
-
|
993
|
991
|
prescriptions, _ := dataBody["prescriptions"].([]interface{})
|
994
|
992
|
if len(prescriptions) > 0 {
|
995
|
993
|
for _, item := range prescriptions {
|
|
@@ -1099,14 +1097,14 @@ func (c *HisApiController) CreateHisPrescription() {
|
1099
|
1097
|
advicelist, _ := service.GetHisAdviceListByDrugIdEight(drug_id, patient_id, recordDateTime, adviceId)
|
1100
|
1098
|
|
1101
|
1099
|
//查询最新批次库存
|
1102
|
|
- info, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
|
1103
|
|
- var batch_number_count int64
|
1104
|
|
- batch_number_count = info.StockMaxNumber*drug.MinNumber + info.StockMinNumber
|
1105
|
|
- batch_number_counts := strconv.FormatInt(batch_number_count, 10)
|
|
1100
|
+ //info, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
|
|
1101
|
+ //var batch_number_count int64
|
|
1102
|
+ //batch_number_count = info.StockMaxNumber*drug.MinNumber + info.StockMinNumber
|
|
1103
|
+ //batch_number_counts := strconv.FormatInt(batch_number_count, 10)
|
1106
|
1104
|
//新增处方
|
1107
|
1105
|
if advicelist.ID == 0 {
|
1108
|
1106
|
all_count, _ := strconv.ParseFloat(totals, 64)
|
1109
|
|
- batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
|
|
1107
|
+ //batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
|
1110
|
1108
|
if prescribingNumberUnit == drug.MinUnit {
|
1111
|
1109
|
|
1112
|
1110
|
if drug.IsUse != 1 {
|
|
@@ -1115,10 +1113,10 @@ func (c *HisApiController) CreateHisPrescription() {
|
1115
|
1113
|
return
|
1116
|
1114
|
}
|
1117
|
1115
|
|
1118
|
|
- if prescribing_number > batch_number_all_count {
|
1119
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1120
|
|
- return
|
1121
|
|
- }
|
|
1116
|
+ //if prescribing_number > batch_number_all_count {
|
|
1117
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
|
1118
|
+ // return
|
|
1119
|
+ //}
|
1122
|
1120
|
|
1123
|
1121
|
}
|
1124
|
1122
|
|
|
@@ -1131,10 +1129,10 @@ func (c *HisApiController) CreateHisPrescription() {
|
1131
|
1129
|
return
|
1132
|
1130
|
}
|
1133
|
1131
|
|
1134
|
|
- if num > batch_number_all_count {
|
1135
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1136
|
|
- return
|
1137
|
|
- }
|
|
1132
|
+ //if num > batch_number_all_count {
|
|
1133
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
|
1134
|
+ // return
|
|
1135
|
+ //}
|
1138
|
1136
|
}
|
1139
|
1137
|
}
|
1140
|
1138
|
}
|
|
@@ -1196,10 +1194,12 @@ func (c *HisApiController) CreateHisPrescription() {
|
1196
|
1194
|
c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
1197
|
1195
|
return
|
1198
|
1196
|
}
|
1199
|
|
- if prescribing_number > batch_number_all_count {
|
1200
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1201
|
|
- return
|
1202
|
|
- }
|
|
1197
|
+ fmt.Println("prescribing_number2332323323323", prescribing_number)
|
|
1198
|
+ fmt.Println("batch_number_all_count", batch_number_all_count)
|
|
1199
|
+ //if prescribing_number > batch_number_all_count {
|
|
1200
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
|
1201
|
+ // return
|
|
1202
|
+ //}
|
1203
|
1203
|
}
|
1204
|
1204
|
|
1205
|
1205
|
} else {
|
|
@@ -1211,11 +1211,12 @@ func (c *HisApiController) CreateHisPrescription() {
|
1211
|
1211
|
c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
1212
|
1212
|
return
|
1213
|
1213
|
}
|
1214
|
|
-
|
1215
|
|
- if prescribing_number > batch_number_all_count {
|
1216
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1217
|
|
- return
|
1218
|
|
- }
|
|
1214
|
+ fmt.Println("prescribing_number2332323323323", prescribing_number)
|
|
1215
|
+ fmt.Println("batch_number_all_count", batch_number_all_count)
|
|
1216
|
+ //if prescribing_number > batch_number_all_count {
|
|
1217
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
|
1218
|
+ // return
|
|
1219
|
+ //}
|
1219
|
1220
|
}
|
1220
|
1221
|
|
1221
|
1222
|
}
|
|
@@ -1260,37 +1261,44 @@ func (c *HisApiController) CreateHisPrescription() {
|
1260
|
1261
|
c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
1261
|
1262
|
return
|
1262
|
1263
|
}
|
|
1264
|
+ fmt.Println("number_count", number_count)
|
|
1265
|
+ fmt.Println("device_number", device_number)
|
|
1266
|
+ fmt.Println("batch_number_count", batch_number_count)
|
1263
|
1267
|
|
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
|
|
- }
|
|
1268
|
+ //if (number_count - device_number) > batch_number_count {
|
|
1269
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
|
1270
|
+ // return
|
|
1271
|
+ //}
|
1268
|
1272
|
|
1269
|
1273
|
// 查询该药品最后一次出库记录
|
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
|
|
- stock_max_number = warehouseInfoList.StockMaxNumber
|
1282
|
|
- stock_min_number = warehouseInfoList.StockMinNumber
|
1283
|
|
- if warehouseInfoList.MaxUnit == drug.MaxUnit {
|
1284
|
|
- in_count = warehouseInfoList.WarehousingCount * drug.MinNumber
|
1285
|
|
- }
|
1286
|
|
- if warehouseInfoList.MaxUnit == drug.MinUnit {
|
1287
|
|
- in_count = warehouseInfoList.WarehousingCount
|
1288
|
|
- }
|
1289
|
|
- }
|
1290
|
|
- if (out_count + (number_count - device_number)) > in_count {
|
1291
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(stock_max_number, 10) + drug.MaxUnit + strconv.FormatInt(stock_min_number, 10) + drug.MinUnit)
|
1292
|
|
- return
|
1293
|
|
- }
|
|
1274
|
+ //outInfo, _ := service.GetLastDrugWarehouseOutByDrugIdTwenty(drug_id, patient_id, recordDateTime, adviceId)
|
|
1275
|
+ //var out_count int64
|
|
1276
|
+ //var in_count int64
|
|
1277
|
+ //var stock_max_number int64
|
|
1278
|
+ //var stock_min_number int64
|
|
1279
|
+ //for _, it := range outInfo {
|
|
1280
|
+ // if it.CountUnit == drug.MaxUnit {
|
|
1281
|
+ // it.Count = it.Count * drug.MinNumber
|
|
1282
|
+ // }
|
|
1283
|
+ // out_count += it.Count
|
|
1284
|
+ // warehouseInfoList, _ := service.GetDrugWarehouseInfoById(it.WarehouseInfoId)
|
|
1285
|
+ // fmt.Println("warehouseInfoList233323232332323232",warehouseInfoList)
|
|
1286
|
+ // stock_max_number = warehouseInfoList.StockMaxNumber
|
|
1287
|
+ // stock_min_number = warehouseInfoList.StockMinNumber
|
|
1288
|
+ // if warehouseInfoList.MaxUnit == drug.MaxUnit {
|
|
1289
|
+ // in_count = warehouseInfoList.WarehousingCount * drug.MinNumber
|
|
1290
|
+ // }
|
|
1291
|
+ // if warehouseInfoList.MaxUnit == drug.MinUnit {
|
|
1292
|
+ // in_count = warehouseInfoList.WarehousingCount
|
|
1293
|
+ // }
|
|
1294
|
+ //}
|
|
1295
|
+ //fmt.Println("out_count",out_count)
|
|
1296
|
+ //fmt.Println("number_count - device_number",number_count - device_number)
|
|
1297
|
+ //fmt.Println("in_countwowowowowowow",in_count)
|
|
1298
|
+ //if (out_count + (number_count - device_number)) > in_count {
|
|
1299
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(stock_max_number, 10) + drug.MaxUnit + strconv.FormatInt(stock_min_number, 10) + drug.MinUnit)
|
|
1300
|
+ // return
|
|
1301
|
+ //}
|
1294
|
1302
|
|
1295
|
1303
|
}
|
1296
|
1304
|
|
|
@@ -1390,27 +1398,27 @@ func (c *HisApiController) CreateHisPrescription() {
|
1390
|
1398
|
//新增处方
|
1391
|
1399
|
if advicelist.ID == 0 {
|
1392
|
1400
|
//查询最新批次库存
|
1393
|
|
- info, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
|
1394
|
|
- var batch_number_count int64
|
1395
|
|
- batch_number_count = info.StockMaxNumber*drug.MinNumber + info.StockMinNumber
|
1396
|
|
- batch_number_counts := strconv.FormatInt(batch_number_count, 10)
|
|
1401
|
+ //info, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
|
|
1402
|
+ //var batch_number_count int64
|
|
1403
|
+ //batch_number_count = info.StockMaxNumber*drug.MinNumber + info.StockMinNumber
|
|
1404
|
+ //batch_number_counts := strconv.FormatInt(batch_number_count, 10)
|
1397
|
1405
|
all_count, _ := strconv.ParseFloat(totals, 64)
|
1398
|
1406
|
if prescribingNumberUnit == drug.MinUnit {
|
1399
|
|
- batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
|
|
1407
|
+ //batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
|
1400
|
1408
|
if drug.IsUse != 1 {
|
1401
|
1409
|
if prescribing_number > all_count {
|
1402
|
1410
|
c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
1403
|
1411
|
return
|
1404
|
1412
|
}
|
1405
|
|
- if prescribing_number > batch_number_all_count {
|
1406
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1407
|
|
- return
|
1408
|
|
- }
|
|
1413
|
+ //if prescribing_number > batch_number_all_count {
|
|
1414
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
|
1415
|
+ // return
|
|
1416
|
+ //}
|
1409
|
1417
|
}
|
1410
|
1418
|
|
1411
|
1419
|
} else {
|
1412
|
1420
|
if prescribingNumberUnit == drug.MaxUnit {
|
1413
|
|
- batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
|
|
1421
|
+ //batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
|
1414
|
1422
|
num := prescribing_number * float64(drug.MinNumber)
|
1415
|
1423
|
if drug.IsUse != 1 {
|
1416
|
1424
|
if num > all_count {
|
|
@@ -1418,10 +1426,10 @@ func (c *HisApiController) CreateHisPrescription() {
|
1418
|
1426
|
return
|
1419
|
1427
|
}
|
1420
|
1428
|
|
1421
|
|
- if prescribing_number > batch_number_all_count {
|
1422
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1423
|
|
- return
|
1424
|
|
- }
|
|
1429
|
+ //if prescribing_number > batch_number_all_count {
|
|
1430
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
|
1431
|
+ // return
|
|
1432
|
+ //}
|
1425
|
1433
|
}
|
1426
|
1434
|
|
1427
|
1435
|
}
|
|
@@ -1464,38 +1472,43 @@ func (c *HisApiController) CreateHisPrescription() {
|
1464
|
1472
|
c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
1465
|
1473
|
return
|
1466
|
1474
|
}
|
1467
|
|
- if (number_count - device_number) > batch_number_count {
|
1468
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1469
|
|
- return
|
1470
|
|
- }
|
|
1475
|
+ fmt.Println("number_count", number_count)
|
|
1476
|
+ fmt.Println("device_number", device_number)
|
|
1477
|
+ fmt.Println("batch_number_count", batch_number_count)
|
|
1478
|
+ //if (number_count - device_number) > batch_number_count {
|
|
1479
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
|
1480
|
+ // return
|
|
1481
|
+ //}
|
1471
|
1482
|
|
1472
|
1483
|
//查询历史出库数据总批次
|
1473
|
1484
|
// 查询该药品最后一次出库记录
|
1474
|
|
- outInfo, _ := service.GetLastDrugWarehouseOutByDrugIdTwenty(drug_id, patient_id, recordDateTime, adviceId)
|
1475
|
|
- var out_count int64
|
1476
|
|
- var in_count int64
|
1477
|
|
- var stock_max_number int64
|
1478
|
|
- var stock_min_number int64
|
1479
|
|
- for _, it := range outInfo {
|
1480
|
|
- if it.CountUnit == drug.MaxUnit {
|
1481
|
|
- it.Count = it.Count * drug.MinNumber
|
1482
|
|
- }
|
1483
|
|
- out_count += it.Count
|
1484
|
|
- warehouseInfoList, _ := service.GetDrugWarehouseInfoById(it.WarehouseInfoId)
|
1485
|
|
- stock_max_number = warehouseInfoList.StockMaxNumber
|
1486
|
|
- stock_min_number = warehouseInfoList.StockMinNumber
|
1487
|
|
- if warehouseInfoList.MaxUnit == drug.MaxUnit {
|
1488
|
|
- in_count = warehouseInfoList.WarehousingCount * drug.MinNumber
|
1489
|
|
- }
|
1490
|
|
- if warehouseInfoList.MaxUnit == drug.MinUnit {
|
1491
|
|
- in_count = warehouseInfoList.WarehousingCount
|
1492
|
|
- }
|
1493
|
|
- }
|
1494
|
|
-
|
1495
|
|
- if (out_count + (number_count - device_number)) > in_count {
|
1496
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(stock_max_number, 10) + drug.MaxUnit + strconv.FormatInt(stock_min_number, 10) + drug.MinUnit)
|
1497
|
|
- return
|
1498
|
|
- }
|
|
1485
|
+ //outInfo, _ := service.GetLastDrugWarehouseOutByDrugIdTwenty(drug_id, patient_id, recordDateTime, adviceId)
|
|
1486
|
+ //var out_count int64
|
|
1487
|
+ //var in_count int64
|
|
1488
|
+ //var stock_max_number int64
|
|
1489
|
+ //var stock_min_number int64
|
|
1490
|
+ //for _, it := range outInfo {
|
|
1491
|
+ // if it.CountUnit == drug.MaxUnit {
|
|
1492
|
+ // it.Count = it.Count * drug.MinNumber
|
|
1493
|
+ // }
|
|
1494
|
+ // out_count += it.Count
|
|
1495
|
+ // warehouseInfoList, _ := service.GetDrugWarehouseInfoById(it.WarehouseInfoId)
|
|
1496
|
+ // stock_max_number = warehouseInfoList.StockMaxNumber
|
|
1497
|
+ // stock_min_number = warehouseInfoList.StockMinNumber
|
|
1498
|
+ // if warehouseInfoList.MaxUnit == drug.MaxUnit {
|
|
1499
|
+ // in_count = warehouseInfoList.WarehousingCount * drug.MinNumber
|
|
1500
|
+ // }
|
|
1501
|
+ // if warehouseInfoList.MaxUnit == drug.MinUnit {
|
|
1502
|
+ // in_count = warehouseInfoList.WarehousingCount
|
|
1503
|
+ // }
|
|
1504
|
+ //}
|
|
1505
|
+ //fmt.Println("out_count",out_count)
|
|
1506
|
+ //fmt.Println("number_count - device_number",number_count - device_number)
|
|
1507
|
+ //fmt.Println("in_count",in_count)
|
|
1508
|
+ //if (out_count + (number_count - device_number)) > in_count {
|
|
1509
|
+ // c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(stock_max_number, 10) + drug.MaxUnit + strconv.FormatInt(stock_min_number, 10) + drug.MinUnit)
|
|
1510
|
+ // return
|
|
1511
|
+ //}
|
1499
|
1512
|
|
1500
|
1513
|
}
|
1501
|
1514
|
}
|