|
@@ -2356,21 +2356,24 @@ func (c *HisApiController) CreateHisPrescription() {
|
2356
|
2356
|
StorehouseId: houseConfig.StorehouseOutInfo,
|
2357
|
2357
|
ProjectId: item.ID,
|
2358
|
2358
|
}
|
|
2359
|
+ goodinfo, _ := service.GetGoodInformationByGoodIdThirty(item.ProjectId)
|
|
2360
|
+ if goodinfo.IsUser == 2 || goodinfo.IsUser == 0 {
|
|
2361
|
+ service.ConsumablePrescriptionDelivery(adminInfo.CurrentOrgId, item.PatientId, item.RecordDate, &dialyPrepareOne, &lastOut, creater, parseIntCount)
|
2359
|
2362
|
|
2360
|
|
- service.ConsumablePrescriptionDelivery(adminInfo.CurrentOrgId, item.PatientId, item.RecordDate, &dialyPrepareOne, &lastOut, creater, parseIntCount)
|
|
2363
|
+ //查询剩余库存
|
|
2364
|
+ goodList, _ := service.GetAllGoodSumCount(item.ProjectId, adminInfo.CurrentOrgId, houseConfig.StorehouseOutInfo)
|
|
2365
|
+ var sum_count int64
|
|
2366
|
+ for _, item := range goodList {
|
|
2367
|
+ sum_count += item.StockCount
|
|
2368
|
+ }
|
2361
|
2369
|
|
2362
|
|
- //查询剩余库存
|
2363
|
|
- goodList, _ := service.GetAllGoodSumCount(item.ProjectId, adminInfo.CurrentOrgId, houseConfig.StorehouseOutInfo)
|
2364
|
|
- var sum_count int64
|
2365
|
|
- for _, item := range goodList {
|
2366
|
|
- sum_count += item.StockCount
|
2367
|
|
- }
|
|
2370
|
+ //更新剩余库存
|
|
2371
|
+ service.UpdateGoodFlushCount(houseConfig.StorehouseOutInfo, item.ProjectId, adminInfo.CurrentOrgId, sum_count)
|
2368
|
2372
|
|
2369
|
|
- //更新剩余库存
|
2370
|
|
- service.UpdateGoodFlushCount(houseConfig.StorehouseOutInfo, item.ProjectId, adminInfo.CurrentOrgId, sum_count)
|
|
2373
|
+ //耗材
|
|
2374
|
+ service.UpdateGoodSumCountSeven(sum_count, item.ProjectId, adminInfo.CurrentOrgId)
|
|
2375
|
+ }
|
2371
|
2376
|
|
2372
|
|
- //耗材
|
2373
|
|
- service.UpdateGoodSumCountSeven(sum_count, item.ProjectId, adminInfo.CurrentOrgId)
|
2374
|
2377
|
}
|
2375
|
2378
|
}
|
2376
|
2379
|
}
|
|
@@ -2673,10 +2676,11 @@ func (c *HisApiController) DeletePrescription() {
|
2673
|
2676
|
prescription_id, _ := c.GetInt64("id")
|
2674
|
2677
|
projects, _ := service.GetHisPrescriptionProjectsByID(prescription_id)
|
2675
|
2678
|
advices, _ := service.GetHisPrescriptionAdviceByID(prescription_id)
|
2676
|
|
- _, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(c.GetAdminUserInfo().CurrentOrgId)
|
|
2679
|
+ //_, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(c.GetAdminUserInfo().CurrentOrgId)
|
2677
|
2680
|
|
2678
|
2681
|
_, stockConfig := service.FindAutomaticReduceRecordByOrgId(c.GetAdminUserInfo().CurrentOrgId)
|
2679
|
2682
|
|
|
2683
|
+ drugOutConfig, _ := service.FindDrugOutConfigById(c.GetAdminUserInfo().CurrentOrgId)
|
2680
|
2684
|
//耗材保存处方出库
|
2681
|
2685
|
goodOutConfig, _ := service.FindGoodOutConfigById(c.GetAdminUserInfo().CurrentOrgId)
|
2682
|
2686
|
//已收费和已发药限制逻辑
|
|
@@ -3021,7 +3025,6 @@ func (c *HisApiController) DeletePrescription() {
|
3021
|
3025
|
if goodOutConfig.IsOpen == 1 {
|
3022
|
3026
|
|
3023
|
3027
|
if item.Type == 3 {
|
3024
|
|
- fmt.Println("出库数量99999999999999999999999999", item.Count)
|
3025
|
3028
|
good, _ := service.FindGoodInfoByIdTwo(item.ProjectId)
|
3026
|
3029
|
f_count, _ := strconv.ParseFloat(item.Count, 64)
|
3027
|
3030
|
good.Total = good.Total + f_count
|
|
@@ -3275,7 +3278,7 @@ func (c *HisApiController) DeletePrescription() {
|
3275
|
3278
|
}
|
3276
|
3279
|
|
3277
|
3280
|
} else {
|
3278
|
|
- if drugStockConfig.IsOpen == 1 {
|
|
3281
|
+ if drugOutConfig.IsOpen == 1 {
|
3279
|
3282
|
if len(advices) > 0 {
|
3280
|
3283
|
for _, item := range advices {
|
3281
|
3284
|
creater := c.GetAdminUserInfo().AdminUser.Id
|
|
@@ -3296,7 +3299,9 @@ func (c *HisApiController) DeleteDoctorAdvice() {
|
3296
|
3299
|
id, _ := c.GetInt64("id")
|
3297
|
3300
|
advice, _ := service.GetHisDoctorAdvicesById(id)
|
3298
|
3301
|
|
3299
|
|
- _, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(c.GetAdminUserInfo().CurrentOrgId)
|
|
3302
|
+ //_, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(c.GetAdminUserInfo().CurrentOrgId)
|
|
3303
|
+
|
|
3304
|
+ drugOutConfig, _ := service.FindDrugOutConfigById(c.GetAdminUserInfo().CurrentOrgId)
|
3300
|
3305
|
|
3301
|
3306
|
//已收费和已发药的限制逻辑
|
3302
|
3307
|
isCharge := false
|
|
@@ -3378,7 +3383,8 @@ func (c *HisApiController) DeleteDoctorAdvice() {
|
3378
|
3383
|
service.DrugAutoAddCancelInfo(&advice, creater)
|
3379
|
3384
|
}
|
3380
|
3385
|
} else {
|
3381
|
|
- if drugStockConfig.IsOpen == 1 {
|
|
3386
|
+
|
|
3387
|
+ if drugOutConfig.IsOpen == 1 {
|
3382
|
3388
|
|
3383
|
3389
|
//查询是否在处方中出库
|
3384
|
3390
|
openConfig, _ := service.GetDrugOpenConfigOne(c.GetAdminUserInfo().CurrentOrgId)
|
|
@@ -6278,22 +6284,23 @@ func (c *HisApiController) GetUploadInfo() {
|
6278
|
6284
|
|
6279
|
6285
|
for _, item := range infoList {
|
6280
|
6286
|
medical, _ := service.GetBaseDrugMedical(item.DrugId)
|
6281
|
|
- //药品出库
|
6282
|
|
- service.HisSettleDrugsDelivery(item.UserOrgId, adminUser.AdminUser.Id, item, order.ID)
|
6283
|
|
- //查询默认仓库
|
6284
|
|
- storeHouseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
|
6285
|
|
- //查询默认仓库剩余多少库存
|
6286
|
|
- var sum_count int64
|
6287
|
|
- stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
|
6288
|
|
- for _, its := range stockInfo {
|
6289
|
|
- if its.MaxUnit == medical.MaxUnit {
|
6290
|
|
- its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
|
|
6287
|
+ if medical.IsUse == 2 {
|
|
6288
|
+ //药品出库
|
|
6289
|
+ service.HisSettleDrugsDelivery(item.UserOrgId, adminUser.AdminUser.Id, item, order.ID)
|
|
6290
|
+ //查询默认仓库
|
|
6291
|
+ storeHouseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
|
|
6292
|
+ //查询默认仓库剩余多少库存
|
|
6293
|
+ var sum_count int64
|
|
6294
|
+ stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
|
|
6295
|
+ for _, its := range stockInfo {
|
|
6296
|
+ if its.MaxUnit == medical.MaxUnit {
|
|
6297
|
+ its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
|
|
6298
|
+ }
|
|
6299
|
+ sum_count += its.StockMaxNumber + its.StockMinNumber
|
6291
|
6300
|
}
|
6292
|
|
- sum_count += its.StockMaxNumber + its.StockMinNumber
|
|
6301
|
+ service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
|
|
6302
|
+ service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
|
6293
|
6303
|
}
|
6294
|
|
- service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
|
6295
|
|
- service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
|
6296
|
|
-
|
6297
|
6304
|
}
|
6298
|
6305
|
orgId := c.GetAdminUserInfo().CurrentOrgId
|
6299
|
6306
|
|
|
@@ -6351,20 +6358,22 @@ func (c *HisApiController) GetUploadInfo() {
|
6351
|
6358
|
Status: 1,
|
6352
|
6359
|
StorehouseId: houseConfig.StorehouseOutInfo,
|
6353
|
6360
|
}
|
|
6361
|
+ goodInfo, _ := service.GetGoodInformationByGoodIdThirty(item.GoodId)
|
|
6362
|
+ //非零用
|
|
6363
|
+ if goodInfo.IsUser == 2 || goodInfo.IsUser == 0 {
|
|
6364
|
+ service.ConsumableSettleDelivery(adminUser.CurrentOrgId, his.PatientId, his.RecordDate, &dialyPrepareOne, &lastOut, adminUser.AdminUser.Id, order.ID)
|
|
6365
|
+ //查询剩余库存
|
|
6366
|
+ goodList, _ := service.GetAllGoodSumCount(item.GoodId, adminUser.CurrentOrgId, houseConfig.StorehouseOutInfo)
|
|
6367
|
+ var sum_count int64
|
|
6368
|
+ for _, item := range goodList {
|
|
6369
|
+ sum_count += item.StockCount
|
|
6370
|
+ }
|
|
6371
|
+ service.UpdateGoodFlushCount(houseConfig.StorehouseOutInfo, item.GoodId, adminUser.CurrentOrgId, sum_count)
|
6354
|
6372
|
|
6355
|
|
- //err = service.CreateDialysisBeforePrepareOne(&dialyPrepareOne)
|
6356
|
|
-
|
6357
|
|
- service.ConsumableSettleDelivery(adminUser.CurrentOrgId, his.PatientId, his.RecordDate, &dialyPrepareOne, &lastOut, adminUser.AdminUser.Id, order.ID)
|
6358
|
|
- //查询剩余库存
|
6359
|
|
- goodList, _ := service.GetAllGoodSumCount(item.GoodId, adminUser.CurrentOrgId, houseConfig.StorehouseOutInfo)
|
6360
|
|
- var sum_count int64
|
6361
|
|
- for _, item := range goodList {
|
6362
|
|
- sum_count += item.StockCount
|
|
6373
|
+ //耗材
|
|
6374
|
+ service.UpdateGoodSumCountSeven(sum_count, item.GoodId, adminUser.CurrentOrgId)
|
6363
|
6375
|
}
|
6364
|
|
- service.UpdateGoodFlushCount(houseConfig.StorehouseOutInfo, item.GoodId, adminUser.CurrentOrgId, sum_count)
|
6365
|
6376
|
|
6366
|
|
- //耗材
|
6367
|
|
- service.UpdateGoodSumCountSeven(sum_count, item.GoodId, adminUser.CurrentOrgId)
|
6368
|
6377
|
}
|
6369
|
6378
|
}
|
6370
|
6379
|
|