|
@@ -552,11 +552,9 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
552
|
552
|
//}
|
553
|
553
|
|
554
|
554
|
var advice models.DoctorAdvice
|
555
|
|
- var tempAdvices []models.DoctorAdvice
|
556
|
555
|
|
557
|
556
|
if groupno > 0 {
|
558
|
|
- advices, _ := service.FindAllDoctorAdviceByGoroupNoTwo(adminUserInfo.Org.Id, groupno)
|
559
|
|
- tempAdvices = advices
|
|
557
|
+ advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
|
560
|
558
|
for _, item := range advices {
|
561
|
559
|
if item.ExecutionState == 2 {
|
562
|
560
|
advice = item
|
|
@@ -564,9 +562,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
564
|
562
|
}
|
565
|
563
|
}
|
566
|
564
|
} else {
|
567
|
|
- advices, _ := service.FindDoctorAdviceByIdsTwo(adminUserInfo.Org.Id, ids)
|
568
|
|
- tempAdvices = advices
|
569
|
|
-
|
|
565
|
+ advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
|
570
|
566
|
for _, item := range advices {
|
571
|
567
|
if item.ExecutionState == 2 {
|
572
|
568
|
advice = item
|
|
@@ -626,10 +622,10 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
626
|
622
|
|
627
|
623
|
if drugStockConfig.IsOpen == 1 {
|
628
|
624
|
if groupno > 0 {
|
629
|
|
- //advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
|
|
625
|
+ advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
|
630
|
626
|
isHasWay := false //用来判断是否包含来自药品库的医嘱
|
631
|
627
|
record_time := int64(0)
|
632
|
|
- for _, item := range tempAdvices {
|
|
628
|
+ for _, item := range advices {
|
633
|
629
|
if item.Way == 1 {
|
634
|
630
|
isHasWay = true
|
635
|
631
|
record_time = item.RecordDate
|
|
@@ -666,7 +662,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
666
|
662
|
if err != nil {
|
667
|
663
|
utils.TraceLog("创建出库单失败 err = %v", err)
|
668
|
664
|
} else {
|
669
|
|
- for _, item := range tempAdvices {
|
|
665
|
+ for _, item := range advices {
|
670
|
666
|
if item.Way == 1 {
|
671
|
667
|
if item.PrescribingNumber > 0 {
|
672
|
668
|
warehouseOutInfo := &models.DrugWarehouseOutInfo{
|
|
@@ -711,7 +707,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
711
|
707
|
}
|
712
|
708
|
|
713
|
709
|
} else if err == nil {
|
714
|
|
- for _, item := range tempAdvices {
|
|
710
|
+ for _, item := range advices {
|
715
|
711
|
if item.Way == 1 {
|
716
|
712
|
outInfo, err := service.FindDrugStockOutInfoByTypeId(adminUserInfo.Org.Id, item.DrugId, out.ID, out.WarehouseOutOrderNumber)
|
717
|
713
|
if err == gorm.ErrRecordNotFound {
|
|
@@ -785,10 +781,10 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
785
|
781
|
|
786
|
782
|
}
|
787
|
783
|
} else {
|
788
|
|
- //advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
|
|
784
|
+ advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
|
789
|
785
|
isHasWay := false //用来判断是否包含来自药品库的医嘱
|
790
|
786
|
record_time := int64(0)
|
791
|
|
- for _, item := range tempAdvices {
|
|
787
|
+ for _, item := range advices {
|
792
|
788
|
if item.Way == 1 {
|
793
|
789
|
isHasWay = true
|
794
|
790
|
record_time = item.RecordDate
|
|
@@ -825,7 +821,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
825
|
821
|
if err != nil {
|
826
|
822
|
utils.TraceLog("创建出库单失败 err = %v", err)
|
827
|
823
|
} else {
|
828
|
|
- for _, item := range tempAdvices {
|
|
824
|
+ for _, item := range advices {
|
829
|
825
|
if item.Way == 1 {
|
830
|
826
|
if item.PrescribingNumber > 0 {
|
831
|
827
|
warehouseOutInfo := &models.DrugWarehouseOutInfo{
|
|
@@ -870,7 +866,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
870
|
866
|
}
|
871
|
867
|
|
872
|
868
|
} else if err == nil {
|
873
|
|
- for _, item := range tempAdvices {
|
|
869
|
+ for _, item := range advices {
|
874
|
870
|
if item.Way == 1 {
|
875
|
871
|
outInfo, err := service.FindDrugStockOutInfoByTypeId(adminUserInfo.Org.Id, item.DrugId, out.ID, out.WarehouseOutOrderNumber)
|
876
|
872
|
if err == gorm.ErrRecordNotFound {
|
|
@@ -954,8 +950,8 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
954
|
950
|
|
955
|
951
|
if privateDrugConfig != nil && privateDrugConfig.DrugStart == 1 {
|
956
|
952
|
if groupno > 0 {
|
957
|
|
- //advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
|
958
|
|
- for _, item := range tempAdvices {
|
|
953
|
+ advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
|
|
954
|
+ for _, item := range advices {
|
959
|
955
|
|
960
|
956
|
if item.ExecutionState == 1 && item.Way == 2 {
|
961
|
957
|
prescribingNumber := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
|
|
@@ -991,7 +987,9 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
991
|
987
|
}
|
992
|
988
|
} else {
|
993
|
989
|
|
994
|
|
- for _, item := range tempAdvices {
|
|
990
|
+ advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
|
|
991
|
+ for _, item := range advices {
|
|
992
|
+ fmt.Println("item222222222222", item.ExecutionState)
|
995
|
993
|
if item.ExecutionState == 1 && item.Way == 2 {
|
996
|
994
|
|
997
|
995
|
prescribingNumber := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
|