|
@@ -1869,16 +1869,17 @@ func (c *HisApiController) DeletePrescription() {
|
1869
|
1869
|
total, _ := service.FindAllCancelStockTotal(c.GetAdminUserInfo().CurrentOrgId)
|
1870
|
1870
|
total = total + 1
|
1871
|
1871
|
orderNumber := "CKTKD" + strconv.FormatInt(c.GetAdminUserInfo().CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
|
1872
|
|
-
|
|
1872
|
+ houseConfig, _ := service.GetAllStoreHouseConfig(c.GetAdminUserInfo().CurrentOrgId)
|
1873
|
1873
|
cancelStock := models.CancelStock{
|
1874
|
|
- OrderNumber: orderNumber,
|
1875
|
|
- OperaTime: operation_time,
|
1876
|
|
- OrgId: c.GetAdminUserInfo().CurrentOrgId,
|
1877
|
|
- Creater: creater,
|
1878
|
|
- Ctime: time.Now().Unix(),
|
1879
|
|
- Status: 1,
|
1880
|
|
- ReturnTime: item.RecordDate,
|
1881
|
|
- Type: 1,
|
|
1874
|
+ OrderNumber: orderNumber,
|
|
1875
|
+ OperaTime: operation_time,
|
|
1876
|
+ OrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
1877
|
+ Creater: creater,
|
|
1878
|
+ Ctime: time.Now().Unix(),
|
|
1879
|
+ Status: 1,
|
|
1880
|
+ ReturnTime: item.RecordDate,
|
|
1881
|
+ Type: 1,
|
|
1882
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
1882
|
1883
|
}
|
1883
|
1884
|
_, msgerrkonde := service.GetCancelStockDetailByOrderNumberOne(item.RecordDate, c.GetAdminUserInfo().CurrentOrgId)
|
1884
|
1885
|
if msgerrkonde == gorm.ErrRecordNotFound {
|
|
@@ -1914,6 +1915,7 @@ func (c *HisApiController) DeletePrescription() {
|
1914
|
1915
|
WarehouseInfoId: info.WarehouseInfotId,
|
1915
|
1916
|
PatientId: info.PatientId,
|
1916
|
1917
|
RecordDate: info.SysRecordTime,
|
|
1918
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
1917
|
1919
|
}
|
1918
|
1920
|
|
1919
|
1921
|
service.CreateCancelStockInfoOne(&cancelStockInfo)
|
|
@@ -1950,6 +1952,7 @@ func (c *HisApiController) DeletePrescription() {
|
1950
|
1952
|
CancelOutDetailId: cancelInfo.ID,
|
1951
|
1953
|
ProductDate: info.ProductDate,
|
1952
|
1954
|
ExpireDate: info.ExpiryDate,
|
|
1955
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
1953
|
1956
|
}
|
1954
|
1957
|
service.CreateStockFlowOne(flow)
|
1955
|
1958
|
|
|
@@ -2002,6 +2005,7 @@ func (c *HisApiController) DeletePrescription() {
|
2002
|
2005
|
Manufacturer: 0,
|
2003
|
2006
|
Type: 1,
|
2004
|
2007
|
IsSys: 1,
|
|
2008
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
2005
|
2009
|
}
|
2006
|
2010
|
err := service.AddSigleWarehouseOut(&warehouseOut)
|
2007
|
2011
|
if err != nil {
|
|
@@ -2009,24 +2013,26 @@ func (c *HisApiController) DeletePrescription() {
|
2009
|
2013
|
return
|
2010
|
2014
|
}
|
2011
|
2015
|
prepare := &models.DialysisBeforePrepare{
|
2012
|
|
- UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
2013
|
|
- PatientId: info.PatientId,
|
2014
|
|
- RecordDate: info.SysRecordTime,
|
2015
|
|
- GoodId: item.ProjectId,
|
2016
|
|
- GoodTypeId: info.GoodTypeId,
|
2017
|
|
- Count: cha_count,
|
|
2016
|
+ UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
2017
|
+ PatientId: info.PatientId,
|
|
2018
|
+ RecordDate: info.SysRecordTime,
|
|
2019
|
+ GoodId: item.ProjectId,
|
|
2020
|
+ GoodTypeId: info.GoodTypeId,
|
|
2021
|
+ Count: cha_count,
|
|
2022
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
2018
|
2023
|
}
|
2019
|
2024
|
//出库
|
2020
|
2025
|
service.ConsumablesDelivery(c.GetAdminUserInfo().CurrentOrgId, info.PatientId, info.SysRecordTime, prepare, &warehouseOut, cha_count)
|
2021
|
2026
|
} else if err == nil {
|
2022
|
2027
|
|
2023
|
2028
|
prepare := &models.DialysisBeforePrepare{
|
2024
|
|
- UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
2025
|
|
- PatientId: info.PatientId,
|
2026
|
|
- RecordDate: info.SysRecordTime,
|
2027
|
|
- GoodId: item.ProjectId,
|
2028
|
|
- GoodTypeId: info.GoodTypeId,
|
2029
|
|
- Count: cha_count,
|
|
2029
|
+ UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
2030
|
+ PatientId: info.PatientId,
|
|
2031
|
+ RecordDate: info.SysRecordTime,
|
|
2032
|
+ GoodId: item.ProjectId,
|
|
2033
|
+ GoodTypeId: info.GoodTypeId,
|
|
2034
|
+ Count: cha_count,
|
|
2035
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
2030
|
2036
|
}
|
2031
|
2037
|
//出库
|
2032
|
2038
|
service.ConsumablesDelivery(c.GetAdminUserInfo().CurrentOrgId, info.PatientId, info.SysRecordTime, prepare, &out, cha_count)
|
|
@@ -2087,7 +2093,7 @@ func (c *HisApiController) DeletePrescription() {
|
2087
|
2093
|
total, _ := service.FindAllDrugCancelStockTotal(adminUserInfo.CurrentOrgId)
|
2088
|
2094
|
total = total + 1
|
2089
|
2095
|
orderNumber := "CKTKD" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
|
2090
|
|
-
|
|
2096
|
+ houseConfig, _ := service.GetAllStoreHouseConfig(c.GetAdminUserInfo().CurrentOrgId)
|
2091
|
2097
|
cancelStock := models.DrugCancelStock{
|
2092
|
2098
|
OrderNumber: orderNumber,
|
2093
|
2099
|
OperaTime: operation_time,
|
|
@@ -2099,6 +2105,7 @@ func (c *HisApiController) DeletePrescription() {
|
2099
|
2105
|
Dealer: info.Dealer,
|
2100
|
2106
|
Manufacturer: info.Manufacturer,
|
2101
|
2107
|
Type: 1,
|
|
2108
|
+ StorehouseId: houseConfig.DrugStorehouseOut,
|
2102
|
2109
|
}
|
2103
|
2110
|
service.AddSigleDrugCancelStock(&cancelStock)
|
2104
|
2111
|
|
|
@@ -2127,6 +2134,7 @@ func (c *HisApiController) DeletePrescription() {
|
2127
|
2134
|
ProductDate: info.ProductDate,
|
2128
|
2135
|
ExpiryDate: info.ExpiryDate,
|
2129
|
2136
|
BatchNumberId: info.WarehouseInfoId,
|
|
2137
|
+ StorehouseId: houseConfig.DrugStorehouseOut,
|
2130
|
2138
|
}
|
2131
|
2139
|
|
2132
|
2140
|
flow := models.DrugFlow{
|
|
@@ -2162,6 +2170,7 @@ func (c *HisApiController) DeletePrescription() {
|
2162
|
2170
|
MaxUnit: info.CountUnit,
|
2163
|
2171
|
MinUnit: "",
|
2164
|
2172
|
AdviceId: info.AdviceId,
|
|
2173
|
+ StorehouseId: houseConfig.DrugStorehouseOut,
|
2165
|
2174
|
}
|
2166
|
2175
|
service.CreatedCancelStock(cancelStockInfo)
|
2167
|
2176
|
service.CreateDrugFlowOne(flow)
|
|
@@ -2171,6 +2180,7 @@ func (c *HisApiController) DeletePrescription() {
|
2171
|
2180
|
//删除流水
|
2172
|
2181
|
service.UpdateDrugFlowTens(info.PatientId, info.WarehouseOutOrderNumber, info.DrugId, item.ID)
|
2173
|
2182
|
} else {
|
|
2183
|
+ houseConfig, _ := service.GetAllStoreHouseConfig(c.GetAdminUserInfo().CurrentOrgId)
|
2174
|
2184
|
floatPrescrip := strconv.FormatFloat(item.PrescribingNumber, 'f', -1, 32)
|
2175
|
2185
|
|
2176
|
2186
|
prescribingNumber, _ := strconv.ParseInt(floatPrescrip, 10, 64)
|
|
@@ -2205,6 +2215,7 @@ func (c *HisApiController) DeletePrescription() {
|
2205
|
2215
|
Dealer: info.Dealer,
|
2206
|
2216
|
Manufacturer: info.Manufacturer,
|
2207
|
2217
|
Type: 1,
|
|
2218
|
+ StorehouseId: houseConfig.DrugStorehouseOut,
|
2208
|
2219
|
}
|
2209
|
2220
|
service.AddSigleDrugCancelStock(&cancelStock)
|
2210
|
2221
|
|
|
@@ -2234,6 +2245,7 @@ func (c *HisApiController) DeletePrescription() {
|
2234
|
2245
|
ProductDate: info.ProductDate,
|
2235
|
2246
|
ExpiryDate: info.ExpiryDate,
|
2236
|
2247
|
BatchNumberId: info.WarehouseInfoId,
|
|
2248
|
+ StorehouseId: houseConfig.DrugStorehouseOut,
|
2237
|
2249
|
}
|
2238
|
2250
|
|
2239
|
2251
|
flow := models.DrugFlow{
|
|
@@ -2270,6 +2282,7 @@ func (c *HisApiController) DeletePrescription() {
|
2270
|
2282
|
MaxUnit: info.CountUnit,
|
2271
|
2283
|
MinUnit: "",
|
2272
|
2284
|
AdviceId: info.AdviceId,
|
|
2285
|
+ StorehouseId: houseConfig.DrugStorehouseOut,
|
2273
|
2286
|
}
|
2274
|
2287
|
service.CreatedCancelStock(cancelStockInfo)
|
2275
|
2288
|
service.CreateDrugFlowOne(flow)
|
|
@@ -2350,7 +2363,7 @@ func (c *HisApiController) DeleteDoctorAdvice() {
|
2350
|
2363
|
total, _ := service.FindAllDrugCancelStockTotal(adminUserInfo.CurrentOrgId)
|
2351
|
2364
|
total = total + 1
|
2352
|
2365
|
orderNumber := "CKTKD" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
|
2353
|
|
-
|
|
2366
|
+ houseConfig, _ := service.GetAllStoreHouseConfig(adminUserInfo.CurrentOrgId)
|
2354
|
2367
|
cancelStock := models.DrugCancelStock{
|
2355
|
2368
|
OrderNumber: orderNumber,
|
2356
|
2369
|
OperaTime: operation_time,
|
|
@@ -2362,6 +2375,7 @@ func (c *HisApiController) DeleteDoctorAdvice() {
|
2362
|
2375
|
Dealer: info.Dealer,
|
2363
|
2376
|
Manufacturer: info.Manufacturer,
|
2364
|
2377
|
Type: 1,
|
|
2378
|
+ StorehouseId: houseConfig.DrugStorehouseOut,
|
2365
|
2379
|
}
|
2366
|
2380
|
service.AddSigleDrugCancelStock(&cancelStock)
|
2367
|
2381
|
|
|
@@ -2390,6 +2404,7 @@ func (c *HisApiController) DeleteDoctorAdvice() {
|
2390
|
2404
|
ProductDate: info.ProductDate,
|
2391
|
2405
|
ExpiryDate: info.ExpiryDate,
|
2392
|
2406
|
BatchNumberId: info.WarehouseInfoId,
|
|
2407
|
+ StorehouseId: houseConfig.DrugStorehouseOut,
|
2393
|
2408
|
}
|
2394
|
2409
|
|
2395
|
2410
|
flow := models.DrugFlow{
|
|
@@ -2425,6 +2440,7 @@ func (c *HisApiController) DeleteDoctorAdvice() {
|
2425
|
2440
|
MaxUnit: info.CountUnit,
|
2426
|
2441
|
MinUnit: "",
|
2427
|
2442
|
AdviceId: info.AdviceId,
|
|
2443
|
+ StorehouseId: houseConfig.DrugStorehouseOut,
|
2428
|
2444
|
}
|
2429
|
2445
|
service.CreatedCancelStock(cancelStockInfo)
|
2430
|
2446
|
service.CreateDrugFlowOne(flow)
|
|
@@ -2434,7 +2450,8 @@ func (c *HisApiController) DeleteDoctorAdvice() {
|
2434
|
2450
|
//删除流水
|
2435
|
2451
|
service.UpdateDrugFlowTens(info.PatientId, info.WarehouseOutOrderNumber, info.DrugId, advice.ID)
|
2436
|
2452
|
} else {
|
2437
|
|
-
|
|
2453
|
+ adminUserInfo := c.GetAdminUserInfo()
|
|
2454
|
+ houseConfig, _ := service.GetAllStoreHouseConfig(adminUserInfo.CurrentOrgId)
|
2438
|
2455
|
floatPrescrip := strconv.FormatFloat(advice.PrescribingNumber, 'f', -1, 32)
|
2439
|
2456
|
|
2440
|
2457
|
prescribingNumber, _ := strconv.ParseInt(floatPrescrip, 10, 64)
|
|
@@ -2447,7 +2464,6 @@ func (c *HisApiController) DeleteDoctorAdvice() {
|
2447
|
2464
|
|
2448
|
2465
|
}
|
2449
|
2466
|
|
2450
|
|
- adminUserInfo := c.GetAdminUserInfo()
|
2451
|
2467
|
operation_time := time.Now().Unix()
|
2452
|
2468
|
creater := adminUserInfo.AdminUser.Id
|
2453
|
2469
|
|
|
@@ -2469,6 +2485,7 @@ func (c *HisApiController) DeleteDoctorAdvice() {
|
2469
|
2485
|
Dealer: info.Dealer,
|
2470
|
2486
|
Manufacturer: info.Manufacturer,
|
2471
|
2487
|
Type: 1,
|
|
2488
|
+ StorehouseId: houseConfig.DrugStorehouseOut,
|
2472
|
2489
|
}
|
2473
|
2490
|
service.AddSigleDrugCancelStock(&cancelStock)
|
2474
|
2491
|
|
|
@@ -2497,6 +2514,7 @@ func (c *HisApiController) DeleteDoctorAdvice() {
|
2497
|
2514
|
ProductDate: info.ProductDate,
|
2498
|
2515
|
ExpiryDate: info.ExpiryDate,
|
2499
|
2516
|
BatchNumberId: info.WarehouseInfoId,
|
|
2517
|
+ StorehouseId: houseConfig.DrugStorehouseOut,
|
2500
|
2518
|
}
|
2501
|
2519
|
|
2502
|
2520
|
flow := models.DrugFlow{
|
|
@@ -2532,6 +2550,7 @@ func (c *HisApiController) DeleteDoctorAdvice() {
|
2532
|
2550
|
MaxUnit: info.CountUnit,
|
2533
|
2551
|
MinUnit: "",
|
2534
|
2552
|
AdviceId: info.AdviceId,
|
|
2553
|
+ StorehouseId: houseConfig.DrugStorehouseOut,
|
2535
|
2554
|
}
|
2536
|
2555
|
service.CreatedCancelStock(cancelStockInfo)
|
2537
|
2556
|
service.CreateDrugFlowOne(flow)
|
|
@@ -2574,6 +2593,7 @@ func (c *HisApiController) DeleteProject() {
|
2574
|
2593
|
fmt.Println(err)
|
2575
|
2594
|
}
|
2576
|
2595
|
if project.Type == 3 {
|
|
2596
|
+ houseConfig, _ := service.GetAllStoreHouseConfig(c.GetAdminUserInfo().CurrentOrgId)
|
2577
|
2597
|
good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
|
2578
|
2598
|
f_count, _ := strconv.ParseFloat(project.Count, 64)
|
2579
|
2599
|
good.Total = good.Total + f_count
|
|
@@ -2589,14 +2609,15 @@ func (c *HisApiController) DeleteProject() {
|
2589
|
2609
|
orderNumber := "CKTKD" + strconv.FormatInt(adminInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
|
2590
|
2610
|
|
2591
|
2611
|
cancelStock := models.CancelStock{
|
2592
|
|
- OrderNumber: orderNumber,
|
2593
|
|
- OperaTime: operation_time,
|
2594
|
|
- OrgId: adminInfo.CurrentOrgId,
|
2595
|
|
- Creater: creater,
|
2596
|
|
- Ctime: time.Now().Unix(),
|
2597
|
|
- Status: 1,
|
2598
|
|
- ReturnTime: project.RecordDate,
|
2599
|
|
- Type: 1,
|
|
2612
|
+ OrderNumber: orderNumber,
|
|
2613
|
+ OperaTime: operation_time,
|
|
2614
|
+ OrgId: adminInfo.CurrentOrgId,
|
|
2615
|
+ Creater: creater,
|
|
2616
|
+ Ctime: time.Now().Unix(),
|
|
2617
|
+ Status: 1,
|
|
2618
|
+ ReturnTime: project.RecordDate,
|
|
2619
|
+ Type: 1,
|
|
2620
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
2600
|
2621
|
}
|
2601
|
2622
|
_, msgerrkonde := service.GetCancelStockDetailByOrderNumberOne(project.RecordDate, adminInfo.CurrentOrgId)
|
2602
|
2623
|
if msgerrkonde == gorm.ErrRecordNotFound {
|
|
@@ -2633,6 +2654,7 @@ func (c *HisApiController) DeleteProject() {
|
2633
|
2654
|
WarehouseInfoId: info.WarehouseInfotId,
|
2634
|
2655
|
PatientId: info.PatientId,
|
2635
|
2656
|
RecordDate: info.SysRecordTime,
|
|
2657
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
2636
|
2658
|
}
|
2637
|
2659
|
|
2638
|
2660
|
service.CreateCancelStockInfoOne(&cancelStockInfo)
|
|
@@ -2669,6 +2691,7 @@ func (c *HisApiController) DeleteProject() {
|
2669
|
2691
|
CancelOutDetailId: cancelInfo.ID,
|
2670
|
2692
|
ProductDate: info.ProductDate,
|
2671
|
2693
|
ExpireDate: info.ExpiryDate,
|
|
2694
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
2672
|
2695
|
}
|
2673
|
2696
|
service.CreateStockFlowOne(flow)
|
2674
|
2697
|
|
|
@@ -2721,6 +2744,7 @@ func (c *HisApiController) DeleteProject() {
|
2721
|
2744
|
Manufacturer: 0,
|
2722
|
2745
|
Type: 1,
|
2723
|
2746
|
IsSys: 1,
|
|
2747
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
2724
|
2748
|
}
|
2725
|
2749
|
err := service.AddSigleWarehouseOut(&warehouseOut)
|
2726
|
2750
|
if err != nil {
|
|
@@ -2728,23 +2752,25 @@ func (c *HisApiController) DeleteProject() {
|
2728
|
2752
|
return
|
2729
|
2753
|
}
|
2730
|
2754
|
prepare := &models.DialysisBeforePrepare{
|
2731
|
|
- UserOrgId: adminInfo.CurrentOrgId,
|
2732
|
|
- PatientId: info.PatientId,
|
2733
|
|
- RecordDate: info.SysRecordTime,
|
2734
|
|
- GoodId: project.ProjectId,
|
2735
|
|
- GoodTypeId: info.GoodTypeId,
|
2736
|
|
- Count: cha_count,
|
|
2755
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
2756
|
+ PatientId: info.PatientId,
|
|
2757
|
+ RecordDate: info.SysRecordTime,
|
|
2758
|
+ GoodId: project.ProjectId,
|
|
2759
|
+ GoodTypeId: info.GoodTypeId,
|
|
2760
|
+ Count: cha_count,
|
|
2761
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
2737
|
2762
|
}
|
2738
|
2763
|
//出库
|
2739
|
2764
|
service.ConsumablesDelivery(adminInfo.CurrentOrgId, info.PatientId, info.SysRecordTime, prepare, &warehouseOut, cha_count)
|
2740
|
2765
|
} else if err == nil {
|
2741
|
2766
|
prepare := &models.DialysisBeforePrepare{
|
2742
|
|
- UserOrgId: adminInfo.CurrentOrgId,
|
2743
|
|
- PatientId: info.PatientId,
|
2744
|
|
- RecordDate: info.SysRecordTime,
|
2745
|
|
- GoodId: project.ProjectId,
|
2746
|
|
- GoodTypeId: info.GoodTypeId,
|
2747
|
|
- Count: cha_count,
|
|
2767
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
2768
|
+ PatientId: info.PatientId,
|
|
2769
|
+ RecordDate: info.SysRecordTime,
|
|
2770
|
+ GoodId: project.ProjectId,
|
|
2771
|
+ GoodTypeId: info.GoodTypeId,
|
|
2772
|
+ Count: cha_count,
|
|
2773
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
2748
|
2774
|
}
|
2749
|
2775
|
//出库
|
2750
|
2776
|
service.ConsumablesDelivery(adminInfo.CurrentOrgId, info.PatientId, info.SysRecordTime, prepare, &out, cha_count)
|