|
@@ -5211,9 +5211,52 @@ func (c *HisApiController) GetUploadInfo() {
|
5211
|
5211
|
}
|
5212
|
5212
|
}
|
5213
|
5213
|
if err == nil {
|
|
5214
|
+ houseConfig, _ := service.GetAllStoreHouseConfig(adminUser.CurrentOrgId)
|
|
5215
|
+ var goods []*models.DialysisBeforePrepareGoods
|
|
5216
|
+ var newGoods []*models.NewDialysisBeforePrepareGoods
|
|
5217
|
+ var infos []*models.HisDoctorAdviceInfo
|
|
5218
|
+
|
|
5219
|
+ for _, info := range prescriptions {
|
|
5220
|
+ if info.Type == 1 {
|
|
5221
|
+ infos = append(infos, info.HisDoctorAdviceInfo...)
|
|
5222
|
+ }
|
|
5223
|
+ if info.Type == 2 {
|
|
5224
|
+ for _, sumItem := range info.HisPrescriptionProject {
|
|
5225
|
+ if sumItem.Type == 3 {
|
|
5226
|
+ var good models.DialysisBeforePrepareGoods
|
|
5227
|
+ var newGood models.NewDialysisBeforePrepareGoods
|
|
5228
|
+ good.GoodId = sumItem.GoodInfo.ID
|
|
5229
|
+ good.GoodTypeId = sumItem.GoodInfo.GoodTypeId
|
|
5230
|
+ count, _ := strconv.Atoi(sumItem.Count)
|
|
5231
|
+ good.Count = int64(count)
|
|
5232
|
+ good.StorehouseId = houseConfig.StorehouseOutInfo
|
|
5233
|
+ good.ProjectId = sumItem.ID
|
|
5234
|
+ goods = append(goods, &good)
|
|
5235
|
+
|
|
5236
|
+ newGood.GoodId = sumItem.GoodInfo.ID
|
|
5237
|
+ newGood.GoodTypeId = sumItem.GoodInfo.GoodTypeId
|
|
5238
|
+ count2, _ := strconv.Atoi(sumItem.Count)
|
|
5239
|
+ newGood.Count = int64(count2)
|
|
5240
|
+ newGood.StorehouseId = houseConfig.StorehouseOutInfo
|
|
5241
|
+ newGood.ProjectId = sumItem.ID
|
|
5242
|
+ newGoods = append(newGoods, &newGood)
|
|
5243
|
+ }
|
|
5244
|
+
|
|
5245
|
+ }
|
|
5246
|
+
|
|
5247
|
+ }
|
|
5248
|
+ }
|
|
5249
|
+ for _, item := range infos {
|
|
5250
|
+ service.HisDrugsDelivery(item.UserOrgId, adminUser.AdminUser.Id, item)
|
|
5251
|
+ //service.DrugAutoAddCancelInfo(item, adminUser.AdminUser.Id)
|
|
5252
|
+
|
|
5253
|
+ }
|
|
5254
|
+ service.ConsumablesDeliveryTotal(adminUser.CurrentOrgId, his.PatientId, his.RecordDate, goods, newGoods, adminUser.AdminUser.Id)
|
|
5255
|
+
|
5214
|
5256
|
c.ServeSuccessJSON(map[string]interface{}{
|
5215
|
5257
|
"msg": "结算成功",
|
5216
|
5258
|
})
|
|
5259
|
+
|
5217
|
5260
|
}
|
5218
|
5261
|
} else {
|
5219
|
5262
|
if tempOrder.IsPre > 0 {
|
|
@@ -5241,6 +5284,48 @@ func (c *HisApiController) GetUploadInfo() {
|
5241
|
5284
|
return
|
5242
|
5285
|
}
|
5243
|
5286
|
if err == nil {
|
|
5287
|
+
|
|
5288
|
+ houseConfig, _ := service.GetAllStoreHouseConfig(adminUser.CurrentOrgId)
|
|
5289
|
+ var goods []*models.DialysisBeforePrepareGoods
|
|
5290
|
+ var newGoods []*models.NewDialysisBeforePrepareGoods
|
|
5291
|
+ var infos []*models.HisDoctorAdviceInfo
|
|
5292
|
+
|
|
5293
|
+ for _, info := range prescriptions {
|
|
5294
|
+ if info.Type == 1 {
|
|
5295
|
+ infos = append(infos, info.HisDoctorAdviceInfo...)
|
|
5296
|
+ }
|
|
5297
|
+ if info.Type == 2 {
|
|
5298
|
+ for _, sumItem := range info.HisPrescriptionProject {
|
|
5299
|
+ if sumItem.Type == 3 {
|
|
5300
|
+ var good models.DialysisBeforePrepareGoods
|
|
5301
|
+ var newGood models.NewDialysisBeforePrepareGoods
|
|
5302
|
+ good.GoodId = sumItem.GoodInfo.ID
|
|
5303
|
+ good.GoodTypeId = sumItem.GoodInfo.GoodTypeId
|
|
5304
|
+ count, _ := strconv.Atoi(sumItem.Count)
|
|
5305
|
+ good.Count = int64(count)
|
|
5306
|
+ good.StorehouseId = houseConfig.StorehouseOutInfo
|
|
5307
|
+ good.ProjectId = sumItem.ID
|
|
5308
|
+ goods = append(goods, &good)
|
|
5309
|
+
|
|
5310
|
+ newGood.GoodId = sumItem.GoodInfo.ID
|
|
5311
|
+ newGood.GoodTypeId = sumItem.GoodInfo.GoodTypeId
|
|
5312
|
+ count2, _ := strconv.Atoi(sumItem.Count)
|
|
5313
|
+ newGood.Count = int64(count2)
|
|
5314
|
+ newGood.StorehouseId = houseConfig.StorehouseOutInfo
|
|
5315
|
+ newGood.ProjectId = sumItem.ID
|
|
5316
|
+ newGoods = append(newGoods, &newGood)
|
|
5317
|
+ }
|
|
5318
|
+
|
|
5319
|
+ }
|
|
5320
|
+
|
|
5321
|
+ }
|
|
5322
|
+ }
|
|
5323
|
+ for _, item := range infos {
|
|
5324
|
+ service.HisDrugsDelivery(item.UserOrgId, adminUser.AdminUser.Id, item)
|
|
5325
|
+
|
|
5326
|
+ }
|
|
5327
|
+ service.ConsumablesDeliveryTotal(adminUser.CurrentOrgId, his.PatientId, his.RecordDate, goods, newGoods, adminUser.AdminUser.Id)
|
|
5328
|
+
|
5244
|
5329
|
c.ServeSuccessJSON(map[string]interface{}{
|
5245
|
5330
|
"msg": "结算成功",
|
5246
|
5331
|
})
|
|
@@ -5269,6 +5354,47 @@ func (c *HisApiController) Refund() {
|
5269
|
5354
|
return
|
5270
|
5355
|
}
|
5271
|
5356
|
}
|
|
5357
|
+
|
|
5358
|
+ if order.ID == 0 {
|
|
5359
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
5360
|
+ return
|
|
5361
|
+ }
|
|
5362
|
+ orders, _ := service.GetHisOrderDetailByNumberThree(order.Number, order.UserOrgId)
|
|
5363
|
+ houseConfig, _ := service.GetAllStoreHouseConfig(order.UserOrgId)
|
|
5364
|
+ var goods []*models.DialysisBeforePrepareGoods
|
|
5365
|
+ var newGoods []*models.NewDialysisBeforePrepareGoods
|
|
5366
|
+ var infos []*models.HisDoctorAdviceInfo
|
|
5367
|
+
|
|
5368
|
+ for _, info := range orders {
|
|
5369
|
+ if info.AdviceId > 0 && info.ProjectId == 0 {
|
|
5370
|
+ infos = append(infos, &info.HisDoctorAdviceInfo)
|
|
5371
|
+ }
|
|
5372
|
+ if info.ProjectId > 0 && info.AdviceId == 0 {
|
|
5373
|
+ if info.HisPrescriptionProject.Type == 3 {
|
|
5374
|
+ var good models.DialysisBeforePrepareGoods
|
|
5375
|
+ var newGood models.NewDialysisBeforePrepareGoods
|
|
5376
|
+ good.GoodId = info.HisPrescriptionProject.VMGoodInfo.ID
|
|
5377
|
+ good.GoodTypeId = info.HisPrescriptionProject.VMGoodInfo.GoodTypeId
|
|
5378
|
+ count, _ := strconv.Atoi(info.HisPrescriptionProject.Count)
|
|
5379
|
+ good.Count = int64(count)
|
|
5380
|
+ good.StorehouseId = houseConfig.StorehouseOutInfo
|
|
5381
|
+ good.ProjectId = info.HisPrescriptionProject.ID
|
|
5382
|
+ goods = append(goods, &good)
|
|
5383
|
+
|
|
5384
|
+ newGood.GoodId = info.HisPrescriptionProject.VMGoodInfo.ID
|
|
5385
|
+ newGood.GoodTypeId = info.HisPrescriptionProject.VMGoodInfo.GoodTypeId
|
|
5386
|
+ count2, _ := strconv.Atoi(info.HisPrescriptionProject.Count)
|
|
5387
|
+ newGood.Count = int64(count2)
|
|
5388
|
+ newGood.StorehouseId = houseConfig.StorehouseOutInfo
|
|
5389
|
+ newGood.ProjectId = info.HisPrescriptionProject.ID
|
|
5390
|
+ newGoods = append(newGoods, &newGood)
|
|
5391
|
+ }
|
|
5392
|
+ }
|
|
5393
|
+ }
|
|
5394
|
+ for _, item := range infos {
|
|
5395
|
+ service.DrugAutoAddCancelInfo(item, order.Creator)
|
|
5396
|
+ }
|
|
5397
|
+
|
5272
|
5398
|
c.ServeSuccessJSON(map[string]interface{}{
|
5273
|
5399
|
"msg": "退费成功",
|
5274
|
5400
|
})
|