|
@@ -3657,23 +3657,49 @@ func (c *HisApiController) CreateHisPrescription() {
|
3657
|
3657
|
timeFormat := tempTime.Format("20060102150405")
|
3658
|
3658
|
s.FeedetlSn = timeFormat + strconv.FormatInt(int64(randNum), 10) + "-" + "1" + "-" + strconv.FormatInt(s.ID, 10)
|
3659
|
3659
|
|
3660
|
|
- //查询改药品是否已经停用
|
3661
|
|
- base, _ := service.GetBasedrugById(s.DrugId, s.UserOrgId)
|
|
3660
|
+ if s.ID == 0 {
|
|
3661
|
+ //查询改药品是否已经停用
|
|
3662
|
+ base, _ := service.GetBasedrugById(s.DrugId, s.UserOrgId)
|
3662
|
3663
|
|
3663
|
|
- if base.ID > 0 {
|
3664
|
|
- tx.Rollback()
|
3665
|
|
- c.ServeDynamicFailJsonSend(base.DrugName + "已停用!请更换其他药品")
|
3666
|
|
- return
|
|
3664
|
+ if base.ID > 0 {
|
|
3665
|
+ tx.Rollback()
|
|
3666
|
+ c.ServeDynamicFailJsonSend(base.DrugName + "已停用!请更换其他药品")
|
|
3667
|
+ return
|
|
3668
|
+
|
|
3669
|
+ }
|
|
3670
|
+
|
|
3671
|
+ drugMedical, _ := service.GetBaseDrugMedical(s.DrugId)
|
3667
|
3672
|
|
|
3673
|
+ if drugMedical.SumCount == 0 {
|
|
3674
|
+ tx.Rollback()
|
|
3675
|
+ c.ServeDynamicFailJsonSend(drugMedical.DrugName + "库存不足,保存失败!")
|
|
3676
|
+ return
|
|
3677
|
+
|
|
3678
|
+ }
|
3668
|
3679
|
}
|
3669
|
3680
|
|
3670
|
|
- drugMedical, _ := service.GetBaseDrugMedical(s.DrugId)
|
|
3681
|
+ //赤峰
|
|
3682
|
+ if adminInfo.CurrentOrgId == 10265 {
|
3671
|
3683
|
|
3672
|
|
- if drugMedical.SumCount == 0 {
|
3673
|
|
- tx.Rollback()
|
3674
|
|
- c.ServeDynamicFailJsonSend(drugMedical.DrugName + "库存不足,保存失败!")
|
3675
|
|
- return
|
|
3684
|
+ drug, _ := service.FindNewBaseDrugLibRecord(adminInfo.CurrentOrgId, s.DrugId, tx)
|
|
3685
|
+
|
|
3686
|
+ info, _ := service.FindNewLastDrugWarehousingInfoByID(s.DrugId, storeConfig.DrugStorehouseOut, tx)
|
3676
|
3687
|
|
|
3688
|
+ if info.RetailPrice > 0 {
|
|
3689
|
+ if s.DeliveryWay == "口服" {
|
|
3690
|
+ if s.PrescribingNumberUnit == drug.MaxUnit && drug.MaxUnit != drug.MinUnit {
|
|
3691
|
+ s.Price = drug.RetailPrice
|
|
3692
|
+ }
|
|
3693
|
+ if s.PrescribingNumberUnit == drug.MinUnit && drug.MaxUnit != drug.MinUnit {
|
|
3694
|
+ s.Price = info.RetailPrice
|
|
3695
|
+ }
|
|
3696
|
+
|
|
3697
|
+ if s.PrescribingNumberUnit == drug.MaxUnit && drug.MaxUnit == drug.MinUnit {
|
|
3698
|
+ s.Price = info.RetailPrice
|
|
3699
|
+ }
|
|
3700
|
+ }
|
|
3701
|
+
|
|
3702
|
+ }
|
3677
|
3703
|
}
|
3678
|
3704
|
|
3679
|
3705
|
service.CreateHisDoctorAdviceOne(&s, tx)
|
|
@@ -3749,19 +3775,22 @@ func (c *HisApiController) CreateHisPrescription() {
|
3749
|
3775
|
}
|
3750
|
3776
|
|
3751
|
3777
|
if p.Type == 3 {
|
3752
|
|
- //查询该耗材是否停用
|
3753
|
|
- goodInfoSeven, _ := service.GetGoodByIdIsStop(p.ProjectId, adminInfo.CurrentOrgId)
|
3754
|
|
- //表示该耗材已经停用,不能保存
|
3755
|
|
- if goodInfoSeven.ID == 0 {
|
3756
|
|
- goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
|
3757
|
|
- c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材已经停用,保存失败!")
|
3758
|
|
- return
|
3759
|
|
- }
|
3760
|
3778
|
|
3761
|
|
- goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
|
3762
|
|
- if goodInfoOne.SumCount == 0 {
|
3763
|
|
- c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材无库存,保存失败!")
|
3764
|
|
- return
|
|
3779
|
+ if p.ID == 0 {
|
|
3780
|
+ //查询该耗材是否停用
|
|
3781
|
+ goodInfoSeven, _ := service.GetGoodByIdIsStop(p.ProjectId, adminInfo.CurrentOrgId)
|
|
3782
|
+ //表示该耗材已经停用,不能保存
|
|
3783
|
+ if goodInfoSeven.ID == 0 {
|
|
3784
|
+ goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
|
|
3785
|
+ c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材已经停用,保存失败!")
|
|
3786
|
+ return
|
|
3787
|
+ }
|
|
3788
|
+
|
|
3789
|
+ goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
|
|
3790
|
+ if goodInfoOne.SumCount == 0 {
|
|
3791
|
+ c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材无库存,保存失败!")
|
|
3792
|
+ return
|
|
3793
|
+ }
|
3765
|
3794
|
}
|
3766
|
3795
|
|
3767
|
3796
|
}
|
|
@@ -4463,21 +4492,43 @@ func (c *HisApiController) CreateHisPrescription() {
|
4463
|
4492
|
}
|
4464
|
4493
|
}
|
4465
|
4494
|
|
4466
|
|
- //查询改药品是否已经停用
|
4467
|
|
- base, _ := service.GetBasedrugById(s.DrugId, s.UserOrgId)
|
|
4495
|
+ if s.ID == 0 {
|
|
4496
|
+ //查询改药品是否已经停用
|
|
4497
|
+ base, _ := service.GetBasedrugById(s.DrugId, s.UserOrgId)
|
4468
|
4498
|
|
4469
|
|
- if base.ID > 0 {
|
4470
|
|
- c.ServeDynamicFailJsonSend(base.DrugName + "已停用!请更换其他药品")
|
4471
|
|
- return
|
|
4499
|
+ if base.ID > 0 {
|
|
4500
|
+ c.ServeDynamicFailJsonSend(base.DrugName + "已停用!请更换其他药品")
|
|
4501
|
+ return
|
4472
|
4502
|
|
4473
|
|
- }
|
|
4503
|
+ }
|
4474
|
4504
|
|
4475
|
|
- drugMedical, _ := service.GetBaseDrugMedical(s.DrugId)
|
|
4505
|
+ drugMedical, _ := service.GetBaseDrugMedical(s.DrugId)
|
4476
|
4506
|
|
4477
|
|
- if drugMedical.SumCount == 0 {
|
4478
|
|
- c.ServeDynamicFailJsonSend(drugMedical.DrugName + "库存不足,保存失败!")
|
4479
|
|
- return
|
|
4507
|
+ if drugMedical.SumCount == 0 {
|
|
4508
|
+ c.ServeDynamicFailJsonSend(drugMedical.DrugName + "库存不足,保存失败!")
|
|
4509
|
+ return
|
|
4510
|
+
|
|
4511
|
+ }
|
|
4512
|
+ }
|
|
4513
|
+
|
|
4514
|
+ //赤峰
|
|
4515
|
+ if s.UserOrgId == 10265 {
|
|
4516
|
+ drug, _ := service.GetDrugByGoodId(s.DrugId)
|
|
4517
|
+ info, _ := service.GetWarehoseInfoByDrugId(s.DrugId, s.UserOrgId)
|
|
4518
|
+ if info.RetailPrice > 0 {
|
|
4519
|
+ if s.DeliveryWay == "口服" {
|
|
4520
|
+ if s.PrescribingNumberUnit == drug.MaxUnit && drug.MaxUnit != drug.MinUnit {
|
|
4521
|
+ s.Price = drug.RetailPrice
|
|
4522
|
+ }
|
|
4523
|
+ if s.PrescribingNumberUnit == drug.MinUnit && drug.MaxUnit != drug.MinUnit {
|
|
4524
|
+ s.Price = info.RetailPrice
|
|
4525
|
+ }
|
4480
|
4526
|
|
|
4527
|
+ if s.PrescribingNumberUnit == drug.MaxUnit && drug.MaxUnit == drug.MinUnit {
|
|
4528
|
+ s.Price = info.RetailPrice
|
|
4529
|
+ }
|
|
4530
|
+ }
|
|
4531
|
+ }
|
4481
|
4532
|
}
|
4482
|
4533
|
|
4483
|
4534
|
service.CreateHisDoctorAdvice(&s)
|
|
@@ -4577,20 +4628,23 @@ func (c *HisApiController) CreateHisPrescription() {
|
4577
|
4628
|
}
|
4578
|
4629
|
|
4579
|
4630
|
if p.Type == 3 {
|
4580
|
|
- //查询该耗材是否停用
|
4581
|
|
- goodInfoSeven, _ := service.GetGoodByIdIsStop(p.ProjectId, adminInfo.CurrentOrgId)
|
4582
|
|
- //表示该耗材已经停用,不能保存
|
4583
|
|
- if goodInfoSeven.ID == 0 {
|
|
4631
|
+ if p.ID == 0 {
|
|
4632
|
+ //查询该耗材是否停用
|
|
4633
|
+ goodInfoSeven, _ := service.GetGoodByIdIsStop(p.ProjectId, adminInfo.CurrentOrgId)
|
|
4634
|
+ //表示该耗材已经停用,不能保存
|
|
4635
|
+ if goodInfoSeven.ID == 0 {
|
|
4636
|
+ goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
|
|
4637
|
+ c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材已经停用,保存失败!")
|
|
4638
|
+ return
|
|
4639
|
+ }
|
|
4640
|
+
|
4584
|
4641
|
goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
|
4585
|
|
- c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材已经停用,保存失败!")
|
4586
|
|
- return
|
|
4642
|
+ if goodInfoOne.SumCount == 0 {
|
|
4643
|
+ c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材无库存,保存失败!")
|
|
4644
|
+ return
|
|
4645
|
+ }
|
4587
|
4646
|
}
|
4588
|
4647
|
|
4589
|
|
- goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
|
4590
|
|
- if goodInfoOne.SumCount == 0 {
|
4591
|
|
- c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材无库存,保存失败!")
|
4592
|
|
- return
|
4593
|
|
- }
|
4594
|
4648
|
}
|
4595
|
4649
|
|
4596
|
4650
|
service.CreateHisProjectTwo(&p)
|