|
@@ -3764,70 +3764,70 @@ func (c *HisApiController) CreateHisPrescription() {
|
3764
|
3764
|
}
|
3765
|
3765
|
|
3766
|
3766
|
//针对康德
|
3767
|
|
- if s.UserOrgId == 10402 || s.UserOrgId == 10164 {
|
3768
|
|
- //获取该药品的总入库数量
|
3769
|
|
- drugWarehouseinfo, _ := service.GetAllDrugInfoList(s.DrugId, s.UserOrgId)
|
3770
|
|
-
|
3771
|
|
- //获取该药品总共开了多少支医嘱
|
3772
|
|
- hisDocInfoList, _ := service.GetHisDocInfoList(s.DrugId, s.UserOrgId)
|
3773
|
|
- var in_count int64
|
3774
|
|
- var in_prescription_number_total int64
|
3775
|
|
- if len(drugWarehouseinfo) > 0 {
|
3776
|
|
- for _, item := range drugWarehouseinfo {
|
3777
|
|
- if item.MaxUnit == drugMedical.MaxUnit && drugMedical.MaxUnit != drugMedical.MinUnit {
|
3778
|
|
-
|
3779
|
|
- in_count += item.WarehousingCount * drugMedical.MinNumber
|
3780
|
|
- }
|
3781
|
|
-
|
3782
|
|
- if item.MaxUnit == drugMedical.MinUnit && drugMedical.MaxUnit != drugMedical.MinUnit {
|
3783
|
|
-
|
3784
|
|
- in_count += item.WarehousingCount
|
3785
|
|
- }
|
3786
|
|
-
|
3787
|
|
- if item.MaxUnit == drugMedical.MinUnit && drugMedical.MaxUnit == drugMedical.MinUnit {
|
3788
|
|
-
|
3789
|
|
- in_count += item.WarehousingCount
|
3790
|
|
- }
|
3791
|
|
-
|
3792
|
|
- }
|
3793
|
|
- }
|
3794
|
|
-
|
3795
|
|
- if len(hisDocInfoList) > 0 {
|
3796
|
|
-
|
3797
|
|
- for _, item := range hisDocInfoList {
|
3798
|
|
- if item.PrescribingNumberUnit == drugMedical.MaxUnit && drugMedical.MaxUnit != drugMedical.MinUnit {
|
3799
|
|
- prescribingNumberTenty := strconv.FormatFloat(s.PrescribingNumber, 'f', -1, 64)
|
3800
|
|
- prescribingNumberSevenTy, _ := strconv.ParseInt(prescribingNumberTenty, 10, 64)
|
3801
|
|
-
|
3802
|
|
- in_prescription_number_total += prescribingNumberSevenTy * drug.MinNumber
|
3803
|
|
- }
|
3804
|
|
-
|
3805
|
|
- if item.PrescribingNumberUnit == drugMedical.MinUnit && drugMedical.MaxUnit != drugMedical.MinUnit {
|
3806
|
|
- prescribingNumberTenty := strconv.FormatFloat(s.PrescribingNumber, 'f', -1, 64)
|
3807
|
|
- prescribingNumberSevenTy, _ := strconv.ParseInt(prescribingNumberTenty, 10, 64)
|
3808
|
|
- in_prescription_number_total += prescribingNumberSevenTy
|
3809
|
|
- }
|
3810
|
|
-
|
3811
|
|
- if item.PrescribingNumberUnit == drugMedical.MinUnit && drugMedical.MaxUnit == drugMedical.MinUnit {
|
3812
|
|
- prescribingNumberTenty := strconv.FormatFloat(s.PrescribingNumber, 'f', -1, 64)
|
3813
|
|
- prescribingNumberSevenTy, _ := strconv.ParseInt(prescribingNumberTenty, 10, 64)
|
3814
|
|
- in_prescription_number_total += prescribingNumberSevenTy
|
3815
|
|
- }
|
3816
|
|
- }
|
3817
|
|
- }
|
3818
|
|
- //
|
3819
|
|
- //fmt.Println("no_user_total------------------------------", no_user_total)
|
3820
|
|
- //fmt.Println("in_prescription_number_total---------------------------", in_prescription_number_total)
|
3821
|
|
- //fmt.Println("in_count----------------------------------", in_count)
|
3822
|
|
-
|
3823
|
|
- //如果已经开过的医嘱 加上未开的医嘱数量 大于 入库总数量则提示库存不足
|
3824
|
|
- if no_user_total+in_prescription_number_total > in_count {
|
3825
|
|
- tx.Rollback()
|
3826
|
|
- c.ServeDynamicFailJsonSend(drugMedical.DrugName + "库存不足,保存失败!")
|
3827
|
|
- return
|
3828
|
|
- }
|
3829
|
|
-
|
3830
|
|
- }
|
|
3767
|
+ //if s.UserOrgId == 10402 || s.UserOrgId == 10164 {
|
|
3768
|
+ // //获取该药品的总入库数量
|
|
3769
|
+ // drugWarehouseinfo, _ := service.GetAllDrugInfoList(s.DrugId, s.UserOrgId)
|
|
3770
|
+ //
|
|
3771
|
+ // //获取该药品总共开了多少支医嘱
|
|
3772
|
+ // hisDocInfoList, _ := service.GetHisDocInfoList(s.DrugId, s.UserOrgId)
|
|
3773
|
+ // var in_count int64
|
|
3774
|
+ // var in_prescription_number_total int64
|
|
3775
|
+ // if len(drugWarehouseinfo) > 0 {
|
|
3776
|
+ // for _, item := range drugWarehouseinfo {
|
|
3777
|
+ // if item.MaxUnit == drugMedical.MaxUnit && drugMedical.MaxUnit != drugMedical.MinUnit {
|
|
3778
|
+ //
|
|
3779
|
+ // in_count += item.WarehousingCount * drugMedical.MinNumber
|
|
3780
|
+ // }
|
|
3781
|
+ //
|
|
3782
|
+ // if item.MaxUnit == drugMedical.MinUnit && drugMedical.MaxUnit != drugMedical.MinUnit {
|
|
3783
|
+ //
|
|
3784
|
+ // in_count += item.WarehousingCount
|
|
3785
|
+ // }
|
|
3786
|
+ //
|
|
3787
|
+ // if item.MaxUnit == drugMedical.MinUnit && drugMedical.MaxUnit == drugMedical.MinUnit {
|
|
3788
|
+ //
|
|
3789
|
+ // in_count += item.WarehousingCount
|
|
3790
|
+ // }
|
|
3791
|
+ //
|
|
3792
|
+ // }
|
|
3793
|
+ // }
|
|
3794
|
+ //
|
|
3795
|
+ // if len(hisDocInfoList) > 0 {
|
|
3796
|
+ //
|
|
3797
|
+ // for _, item := range hisDocInfoList {
|
|
3798
|
+ // if item.PrescribingNumberUnit == drugMedical.MaxUnit && drugMedical.MaxUnit != drugMedical.MinUnit {
|
|
3799
|
+ // prescribingNumberTenty := strconv.FormatFloat(s.PrescribingNumber, 'f', -1, 64)
|
|
3800
|
+ // prescribingNumberSevenTy, _ := strconv.ParseInt(prescribingNumberTenty, 10, 64)
|
|
3801
|
+ //
|
|
3802
|
+ // in_prescription_number_total += prescribingNumberSevenTy * drug.MinNumber
|
|
3803
|
+ // }
|
|
3804
|
+ //
|
|
3805
|
+ // if item.PrescribingNumberUnit == drugMedical.MinUnit && drugMedical.MaxUnit != drugMedical.MinUnit {
|
|
3806
|
+ // prescribingNumberTenty := strconv.FormatFloat(s.PrescribingNumber, 'f', -1, 64)
|
|
3807
|
+ // prescribingNumberSevenTy, _ := strconv.ParseInt(prescribingNumberTenty, 10, 64)
|
|
3808
|
+ // in_prescription_number_total += prescribingNumberSevenTy
|
|
3809
|
+ // }
|
|
3810
|
+ //
|
|
3811
|
+ // if item.PrescribingNumberUnit == drugMedical.MinUnit && drugMedical.MaxUnit == drugMedical.MinUnit {
|
|
3812
|
+ // prescribingNumberTenty := strconv.FormatFloat(s.PrescribingNumber, 'f', -1, 64)
|
|
3813
|
+ // prescribingNumberSevenTy, _ := strconv.ParseInt(prescribingNumberTenty, 10, 64)
|
|
3814
|
+ // in_prescription_number_total += prescribingNumberSevenTy
|
|
3815
|
+ // }
|
|
3816
|
+ // }
|
|
3817
|
+ // }
|
|
3818
|
+ // //
|
|
3819
|
+ // //fmt.Println("no_user_total------------------------------", no_user_total)
|
|
3820
|
+ // //fmt.Println("in_prescription_number_total---------------------------", in_prescription_number_total)
|
|
3821
|
+ // //fmt.Println("in_count----------------------------------", in_count)
|
|
3822
|
+ //
|
|
3823
|
+ // //如果已经开过的医嘱 加上未开的医嘱数量 大于 入库总数量则提示库存不足
|
|
3824
|
+ // if no_user_total+in_prescription_number_total > in_count {
|
|
3825
|
+ // tx.Rollback()
|
|
3826
|
+ // c.ServeDynamicFailJsonSend(drugMedical.DrugName + "库存不足,保存失败!")
|
|
3827
|
+ // return
|
|
3828
|
+ // }
|
|
3829
|
+ //
|
|
3830
|
+ //}
|
3831
|
3831
|
|
3832
|
3832
|
//查询该药品所有入库数量
|
3833
|
3833
|
|
|
@@ -4396,43 +4396,43 @@ func (c *HisApiController) CreateHisPrescription() {
|
4396
|
4396
|
|
4397
|
4397
|
nowCount, _ := strconv.ParseInt(p.Count, 10, 64)
|
4398
|
4398
|
|
4399
|
|
- //针对康德
|
4400
|
|
- if p.UserOrgId == 10164 || p.UserOrgId == 10402 {
|
4401
|
|
-
|
4402
|
|
- //查询耗材的总入库数量
|
4403
|
|
- warehouseInfo, _ := service.GetAllWarehouseInfo(p.ProjectId, adminInfo.CurrentOrgId)
|
4404
|
|
-
|
4405
|
|
- //查询该耗材的总出库数量
|
4406
|
|
- prescriptionGood, _ := service.GetHisPrescriptionByGoodId(p.ProjectId, adminInfo.CurrentOrgId)
|
4407
|
|
-
|
4408
|
|
- var all_good_count int64
|
4409
|
|
-
|
4410
|
|
- var prescription_count int64
|
4411
|
|
- if len(warehouseInfo) > 0 {
|
4412
|
|
-
|
4413
|
|
- for _, item := range warehouseInfo {
|
4414
|
|
- all_good_count += item.WarehousingCount
|
4415
|
|
- }
|
4416
|
|
- }
|
4417
|
|
- if len(prescriptionGood) > 0 {
|
4418
|
|
- for _, item := range prescriptionGood {
|
4419
|
|
-
|
4420
|
|
- hisCount, _ := strconv.ParseInt(item.Count, 10, 64)
|
4421
|
|
- prescription_count += hisCount
|
4422
|
|
- }
|
4423
|
|
- }
|
4424
|
|
-
|
4425
|
|
- fmt.Println("prescription_count-------------------------", prescription_count)
|
4426
|
|
- fmt.Println("nowCount-------------------------", nowCount)
|
4427
|
|
- fmt.Println("all_good_count-------------------------", all_good_count)
|
4428
|
|
-
|
4429
|
|
- if prescription_count+nowCount > all_good_count {
|
4430
|
|
- goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
|
4431
|
|
- tx.Rollback()
|
4432
|
|
- c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材无库存,保存失败!")
|
4433
|
|
- return
|
4434
|
|
- }
|
4435
|
|
- }
|
|
4399
|
+ ////针对康德
|
|
4400
|
+ //if p.UserOrgId == 10164 || p.UserOrgId == 10402 {
|
|
4401
|
+ //
|
|
4402
|
+ // //查询耗材的总入库数量
|
|
4403
|
+ // warehouseInfo, _ := service.GetAllWarehouseInfo(p.ProjectId, adminInfo.CurrentOrgId)
|
|
4404
|
+ //
|
|
4405
|
+ // //查询该耗材的总出库数量
|
|
4406
|
+ // prescriptionGood, _ := service.GetHisPrescriptionByGoodId(p.ProjectId, adminInfo.CurrentOrgId)
|
|
4407
|
+ //
|
|
4408
|
+ // var all_good_count int64
|
|
4409
|
+ //
|
|
4410
|
+ // var prescription_count int64
|
|
4411
|
+ // if len(warehouseInfo) > 0 {
|
|
4412
|
+ //
|
|
4413
|
+ // for _, item := range warehouseInfo {
|
|
4414
|
+ // all_good_count += item.WarehousingCount
|
|
4415
|
+ // }
|
|
4416
|
+ // }
|
|
4417
|
+ // if len(prescriptionGood) > 0 {
|
|
4418
|
+ // for _, item := range prescriptionGood {
|
|
4419
|
+ //
|
|
4420
|
+ // hisCount, _ := strconv.ParseInt(item.Count, 10, 64)
|
|
4421
|
+ // prescription_count += hisCount
|
|
4422
|
+ // }
|
|
4423
|
+ // }
|
|
4424
|
+ //
|
|
4425
|
+ // //fmt.Println("prescription_count-------------------------", prescription_count)
|
|
4426
|
+ // //fmt.Println("nowCount-------------------------", nowCount)
|
|
4427
|
+ // //fmt.Println("all_good_count-------------------------", all_good_count)
|
|
4428
|
+ //
|
|
4429
|
+ // if prescription_count+nowCount > all_good_count {
|
|
4430
|
+ // goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
|
|
4431
|
+ // tx.Rollback()
|
|
4432
|
+ // c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材无库存,保存失败!")
|
|
4433
|
+ // return
|
|
4434
|
+ // }
|
|
4435
|
+ //}
|
4436
|
4436
|
|
4437
|
4437
|
//如果当前处方数量大于历史数据,则需要出库
|
4438
|
4438
|
if nowCount > historyCount {
|