|
@@ -1520,65 +1520,67 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
|
1520
|
1520
|
sum_count += its.StockMaxNumber + its.StockMinNumber
|
1521
|
1521
|
}
|
1522
|
1522
|
|
1523
|
|
- warehouseOutInfo := &models.DrugWarehouseOutInfo{
|
1524
|
|
- WarehouseOutOrderNumber: warehouseout.WarehouseOutOrderNumber,
|
1525
|
|
- WarehouseOutId: warehouseout.ID,
|
1526
|
|
- Status: 1,
|
1527
|
|
- Ctime: advice.RecordDate,
|
1528
|
|
- Mtime: time.Now().Unix(),
|
1529
|
|
- Remark: warehouse.Remark,
|
1530
|
|
- OrgId: orgID,
|
1531
|
|
- Type: 1,
|
1532
|
|
- Manufacturer: warehouse.Manufacturer,
|
1533
|
|
- Dealer: warehouse.Dealer,
|
1534
|
|
- IsSys: 1,
|
1535
|
|
- SysRecordTime: advice.RecordDate,
|
1536
|
|
- DrugId: advice.DrugId,
|
1537
|
|
- Number: warehouse.Number,
|
1538
|
|
- BatchNumber: warehouse.BatchNumber,
|
1539
|
|
- Price: warehouse.RetailPrice,
|
1540
|
|
- CountUnit: drup.MinUnit,
|
1541
|
|
- RetailPrice: warehouse.RetailPrice,
|
1542
|
|
- ProductDate: warehouse.ProductDate,
|
1543
|
|
- ExpiryDate: warehouse.ExpiryDate,
|
1544
|
|
- PatientId: advice.PatientId,
|
1545
|
|
- Count: deliver_number, //出最小单位
|
1546
|
|
- WarehouseInfoId: warehouse.ID,
|
1547
|
|
- SupplyWarehouseId: warehouse.SupplyWarehouseId,
|
1548
|
|
- StorehouseId: storeConfig.DrugStorehouseOut,
|
1549
|
|
- IsCheck: 1,
|
1550
|
|
- OverCount: sum_count,
|
1551
|
|
- AdviceId: advice.ID,
|
1552
|
|
- }
|
|
1523
|
+ if orgID != 10188 && orgID != 10217 && orgID != 3877 && orgID != 9671 {
|
|
1524
|
+ warehouseOutInfo := &models.DrugWarehouseOutInfo{
|
|
1525
|
+ WarehouseOutOrderNumber: warehouseout.WarehouseOutOrderNumber,
|
|
1526
|
+ WarehouseOutId: warehouseout.ID,
|
|
1527
|
+ Status: 1,
|
|
1528
|
+ Ctime: advice.RecordDate,
|
|
1529
|
+ Mtime: time.Now().Unix(),
|
|
1530
|
+ Remark: warehouse.Remark,
|
|
1531
|
+ OrgId: orgID,
|
|
1532
|
+ Type: 1,
|
|
1533
|
+ Manufacturer: warehouse.Manufacturer,
|
|
1534
|
+ Dealer: warehouse.Dealer,
|
|
1535
|
+ IsSys: 1,
|
|
1536
|
+ SysRecordTime: advice.RecordDate,
|
|
1537
|
+ DrugId: advice.DrugId,
|
|
1538
|
+ Number: warehouse.Number,
|
|
1539
|
+ BatchNumber: warehouse.BatchNumber,
|
|
1540
|
+ Price: warehouse.RetailPrice,
|
|
1541
|
+ CountUnit: drup.MinUnit,
|
|
1542
|
+ RetailPrice: warehouse.RetailPrice,
|
|
1543
|
+ ProductDate: warehouse.ProductDate,
|
|
1544
|
+ ExpiryDate: warehouse.ExpiryDate,
|
|
1545
|
+ PatientId: advice.PatientId,
|
|
1546
|
+ Count: deliver_number, //出最小单位
|
|
1547
|
+ WarehouseInfoId: warehouse.ID,
|
|
1548
|
+ SupplyWarehouseId: warehouse.SupplyWarehouseId,
|
|
1549
|
+ StorehouseId: storeConfig.DrugStorehouseOut,
|
|
1550
|
+ IsCheck: 1,
|
|
1551
|
+ OverCount: sum_count,
|
|
1552
|
+ AdviceId: advice.ID,
|
|
1553
|
+ }
|
1553
|
1554
|
|
1554
|
|
- //查询今日该药品该患者是否有出库数据
|
1555
|
|
- lastDrugOutInfo, _ := GetNewDrugWarehouseOutInfoSix(advice.DrugId, advice.PatientId, advice.RecordDate, advice.UserOrgId, advice.ID, warehouse.ID)
|
1556
|
|
- if lastDrugOutInfo.ID == 0 {
|
1557
|
|
- errOne := AddSigleDrugWarehouseOutInfo(warehouseOutInfo)
|
1558
|
|
- if errOne != nil {
|
1559
|
|
- drugError := models.XtDrugError{
|
1560
|
|
- UserOrgId: orgID,
|
1561
|
|
- DrugId: advice.DrugId,
|
1562
|
|
- RecordDate: advice.AdviceDate,
|
1563
|
|
- PatientId: advice.PatientId,
|
1564
|
|
- Remark: "创建出库单失败",
|
1565
|
|
- Status: 1,
|
1566
|
|
- Ctime: time.Now().Unix(),
|
1567
|
|
- Mtime: 0,
|
1568
|
|
- SumCount: 0,
|
1569
|
|
- Prescribingnumber: advice.PrescribingNumber,
|
1570
|
|
- PrescribingNumberUnit: advice.PrescribingNumberUnit,
|
|
1555
|
+ //查询今日该药品该患者是否有出库数据
|
|
1556
|
+ lastDrugOutInfo, _ := GetNewDrugWarehouseOutInfoSix(advice.DrugId, advice.PatientId, advice.RecordDate, advice.UserOrgId, advice.ID, warehouse.ID)
|
|
1557
|
+ if lastDrugOutInfo.ID == 0 {
|
|
1558
|
+ errOne := AddSigleDrugWarehouseOutInfo(warehouseOutInfo)
|
|
1559
|
+ if errOne != nil {
|
|
1560
|
+ drugError := models.XtDrugError{
|
|
1561
|
+ UserOrgId: orgID,
|
|
1562
|
+ DrugId: advice.DrugId,
|
|
1563
|
+ RecordDate: advice.AdviceDate,
|
|
1564
|
+ PatientId: advice.PatientId,
|
|
1565
|
+ Remark: "创建出库单失败",
|
|
1566
|
+ Status: 1,
|
|
1567
|
+ Ctime: time.Now().Unix(),
|
|
1568
|
+ Mtime: 0,
|
|
1569
|
+ SumCount: 0,
|
|
1570
|
+ Prescribingnumber: advice.PrescribingNumber,
|
|
1571
|
+ PrescribingNumberUnit: advice.PrescribingNumberUnit,
|
|
1572
|
+ }
|
|
1573
|
+ CreateDrugError(drugError)
|
1571
|
1574
|
}
|
1572
|
|
- CreateDrugError(drugError)
|
1573
|
1575
|
}
|
1574
|
|
- }
|
1575
|
|
- if lastDrugOutInfo.ID > 0 {
|
|
1576
|
+ if lastDrugOutInfo.ID > 0 {
|
1576
|
1577
|
|
1577
|
|
- //删除在新增
|
1578
|
|
- UpdateDrugWarehouseOutInfoTen(lastDrugOutInfo.PatientId, lastDrugOutInfo.SysRecordTime, advice.ID)
|
|
1578
|
+ //删除在新增
|
|
1579
|
+ UpdateDrugWarehouseOutInfoTen(lastDrugOutInfo.PatientId, lastDrugOutInfo.SysRecordTime, advice.ID)
|
1579
|
1580
|
|
1580
|
|
- AddSigleDrugWarehouseOutInfo(warehouseOutInfo)
|
|
1581
|
+ AddSigleDrugWarehouseOutInfo(warehouseOutInfo)
|
1581
|
1582
|
|
|
1583
|
+ }
|
1582
|
1584
|
}
|
1583
|
1585
|
|
1584
|
1586
|
var out_count int64
|
|
@@ -1602,6 +1604,44 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
|
1602
|
1604
|
fmt.Println("查收嗖嗖嗖哦", deliver_number_one-(out_count-cancel_count))
|
1603
|
1605
|
if deliver_number_one-(out_count-cancel_count) >= 0 {
|
1604
|
1606
|
if (deliver_number_one - out_count - cancel_count) != 0 {
|
|
1607
|
+
|
|
1608
|
+ if orgID == 10217 || orgID == 10188 || orgID == 3877 || orgID == 9671 {
|
|
1609
|
+ warehouseOutInfo := &models.DrugWarehouseOutInfo{
|
|
1610
|
+ WarehouseOutOrderNumber: warehouseout.WarehouseOutOrderNumber,
|
|
1611
|
+ WarehouseOutId: warehouseout.ID,
|
|
1612
|
+ Status: 1,
|
|
1613
|
+ Ctime: advice.RecordDate,
|
|
1614
|
+ Mtime: time.Now().Unix(),
|
|
1615
|
+ Remark: warehouse.Remark,
|
|
1616
|
+ OrgId: orgID,
|
|
1617
|
+ Type: 1,
|
|
1618
|
+ Manufacturer: warehouse.Manufacturer,
|
|
1619
|
+ Dealer: warehouse.Dealer,
|
|
1620
|
+ IsSys: 1,
|
|
1621
|
+ SysRecordTime: advice.RecordDate,
|
|
1622
|
+ DrugId: advice.DrugId,
|
|
1623
|
+ Number: warehouse.Number,
|
|
1624
|
+ BatchNumber: warehouse.BatchNumber,
|
|
1625
|
+ Price: warehouse.RetailPrice,
|
|
1626
|
+ CountUnit: drup.MinUnit,
|
|
1627
|
+ RetailPrice: warehouse.RetailPrice,
|
|
1628
|
+ ProductDate: warehouse.ProductDate,
|
|
1629
|
+ ExpiryDate: warehouse.ExpiryDate,
|
|
1630
|
+ PatientId: advice.PatientId,
|
|
1631
|
+ Count: deliver_number_one - (out_count - cancel_count), //出最小单位
|
|
1632
|
+ WarehouseInfoId: warehouse.ID,
|
|
1633
|
+ SupplyWarehouseId: warehouse.SupplyWarehouseId,
|
|
1634
|
+ StorehouseId: storeConfig.DrugStorehouseOut,
|
|
1635
|
+ IsCheck: 1,
|
|
1636
|
+ OverCount: sum_count,
|
|
1637
|
+ AdviceId: advice.ID,
|
|
1638
|
+ }
|
|
1639
|
+
|
|
1640
|
+ AddSigleDrugWarehouseOutInfo(warehouseOutInfo)
|
|
1641
|
+
|
|
1642
|
+ }
|
|
1643
|
+ lastDrugOutInfo, _ := GetNewDrugWarehouseOutInfoSix(advice.DrugId, advice.PatientId, advice.RecordDate, advice.UserOrgId, advice.ID, warehouse.ID)
|
|
1644
|
+
|
1605
|
1645
|
drugflow := models.DrugFlow{
|
1606
|
1646
|
WarehouseOutOrderNumber: warehouseout.WarehouseOutOrderNumber,
|
1607
|
1647
|
WarehouseOutId: warehouseout.ID,
|