|
@@ -15,7 +15,6 @@ import (
|
15
|
15
|
"reflect"
|
16
|
16
|
"strconv"
|
17
|
17
|
"strings"
|
18
|
|
- "sync"
|
19
|
18
|
"syscall"
|
20
|
19
|
"time"
|
21
|
20
|
"unsafe"
|
|
@@ -620,6 +619,7 @@ func (c *HisApiController) GetHisPrescriptionConfig() {
|
620
|
619
|
advices, _ := service.FindAllHisAdviceTemplate(adminInfo.CurrentOrgId)
|
621
|
620
|
//获取所有基础药
|
622
|
621
|
drugs, _ := service.GetAllDrugLibList(adminInfo.CurrentOrgId)
|
|
622
|
+
|
623
|
623
|
_, config := service.FindHisStockPriceRecordByOrgId(adminInfo.CurrentOrgId)
|
624
|
624
|
if config.ID > 0 && config.IsOpen == 1 {
|
625
|
625
|
for _, item := range drugs {
|
|
@@ -665,8 +665,6 @@ func (c *HisApiController) GetHisPrescriptionConfig() {
|
665
|
665
|
})
|
666
|
666
|
}
|
667
|
667
|
|
668
|
|
-var waitGroup sync.WaitGroup
|
669
|
|
-
|
670
|
668
|
func (c *HisApiController) CreateHisPrescription() {
|
671
|
669
|
record_date := c.GetString("record_date")
|
672
|
670
|
patient_id, _ := c.GetInt64("patient_id")
|
|
@@ -713,19 +711,10 @@ func (c *HisApiController) CreateHisPrescription() {
|
713
|
711
|
|
714
|
712
|
_, stockConfig := service.FindAutomaticReduceRecordByOrgId(c.GetAdminUserInfo().CurrentOrgId)
|
715
|
713
|
|
716
|
|
- redisClient := service.RedisClient()
|
717
|
|
- redisClient.LPush("111", patient)
|
718
|
|
- str, _ := redisClient.LPop("111").Result()
|
719
|
|
- fmt.Println("~~~~~" + str)
|
720
|
|
- defer redisClient.Close()
|
721
|
|
-
|
722
|
714
|
if drugStockConfig.IsOpen == 1 {
|
723
|
|
-
|
724
|
715
|
//校验库存总量
|
725
|
716
|
if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
|
726
|
717
|
prescriptions, _ := dataBody["prescriptions"].([]interface{})
|
727
|
|
-
|
728
|
|
- //GetPrescriptionById(prescriptions)
|
729
|
718
|
if len(prescriptions) > 0 {
|
730
|
719
|
for _, item := range prescriptions {
|
731
|
720
|
items := item.(map[string]interface{})
|
|
@@ -736,6 +725,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
736
|
725
|
var drug_id int64
|
737
|
726
|
var prescribing_number float64
|
738
|
727
|
var prescribingNumberUnit string
|
|
728
|
+ var prescribingNumber string
|
739
|
729
|
|
740
|
730
|
var adviceId int64
|
741
|
731
|
if advice.(map[string]interface{})["id"] != nil || reflect.TypeOf(advice.(map[string]interface{})["id"]).String() == "float64" {
|
|
@@ -744,7 +734,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
744
|
734
|
if advice.(map[string]interface{})["prescribing_number"] != nil || reflect.TypeOf(advice.(map[string]interface{})["prescribing_number"]).String() == "string" {
|
745
|
735
|
prescribing_number_str := advice.(map[string]interface{})["prescribing_number"].(string)
|
746
|
736
|
prescribing_number, _ = strconv.ParseFloat(prescribing_number_str, 64)
|
747
|
|
-
|
|
737
|
+ prescribingNumber = advice.(map[string]interface{})["prescribing_number"].(string)
|
748
|
738
|
}
|
749
|
739
|
|
750
|
740
|
if advice.(map[string]interface{})["prescribing_number_unit"] != nil && reflect.TypeOf(advice.(map[string]interface{})["prescribing_number_unit"]).String() == "string" {
|
|
@@ -770,31 +760,51 @@ func (c *HisApiController) CreateHisPrescription() {
|
770
|
760
|
//查询该药品是否存在开药记录
|
771
|
761
|
advicelist, _ := service.GetHisAdviceListByDrugIdEight(drug_id, patient_id, recordDateTime, adviceId)
|
772
|
762
|
|
|
763
|
+ //新增处方
|
|
764
|
+ if advicelist.ID == 0 {
|
|
765
|
+ all_count, _ := strconv.ParseFloat(totals, 64)
|
|
766
|
+ if prescribingNumberUnit == drug.MinUnit {
|
|
767
|
+ if prescribing_number > all_count {
|
|
768
|
+ c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
|
769
|
+ return
|
|
770
|
+ }
|
|
771
|
+ } else {
|
|
772
|
+ if prescribingNumberUnit == drug.MaxUnit {
|
|
773
|
+ num := prescribing_number * float64(drug.MinNumber)
|
|
774
|
+ if num > all_count {
|
|
775
|
+ c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
|
776
|
+ return
|
|
777
|
+ }
|
|
778
|
+ }
|
|
779
|
+ }
|
|
780
|
+ }
|
773
|
781
|
//修改处方
|
774
|
782
|
if advicelist.ID > 0 {
|
775
|
783
|
var device_number int64
|
|
784
|
+
|
776
|
785
|
if advicelist.PrescribingNumberUnit == drug.MaxUnit {
|
777
|
|
- prescribingNumber := strconv.FormatFloat(advicelist.PrescribingNumber, 'f', -1, 64)
|
778
|
|
- prescribingNumberInt, _ := strconv.ParseInt(prescribingNumber, 10, 64)
|
|
786
|
+ prescribingNumberOne := strconv.FormatFloat(advicelist.PrescribingNumber, 'f', -1, 64)
|
|
787
|
+ prescribingNumberInt, _ := strconv.ParseInt(prescribingNumberOne, 10, 64)
|
779
|
788
|
device_number = prescribingNumberInt * drug.MinNumber
|
780
|
789
|
}
|
781
|
790
|
if advicelist.PrescribingNumberUnit == drug.MinUnit {
|
782
|
|
- prescribingNumber := strconv.FormatFloat(advicelist.PrescribingNumber, 'f', -1, 64)
|
783
|
|
- prescribingNumberInt, _ := strconv.ParseInt(prescribingNumber, 10, 64)
|
|
791
|
+ prescribingNumberOne := strconv.FormatFloat(advicelist.PrescribingNumber, 'f', -1, 64)
|
|
792
|
+ prescribingNumberInt, _ := strconv.ParseInt(prescribingNumberOne, 10, 64)
|
784
|
793
|
device_number = prescribingNumberInt
|
785
|
794
|
}
|
786
|
795
|
|
787
|
796
|
var number_count int64
|
788
|
797
|
if prescribingNumberUnit == drug.MaxUnit {
|
789
|
|
- prescribingNumber := strconv.FormatFloat(advicelist.PrescribingNumber, 'f', -1, 64)
|
790
|
798
|
prescribingNumberInt, _ := strconv.ParseInt(prescribingNumber, 10, 64)
|
791
|
799
|
number_count = prescribingNumberInt * drug.MinNumber
|
792
|
800
|
}
|
793
|
801
|
if prescribingNumberUnit == drug.MinUnit {
|
794
|
|
- prescribingNumber := strconv.FormatFloat(advicelist.PrescribingNumber, 'f', -1, 64)
|
795
|
802
|
prescribingNumberInt, _ := strconv.ParseInt(prescribingNumber, 10, 64)
|
796
|
803
|
number_count = prescribingNumberInt
|
797
|
804
|
}
|
|
805
|
+
|
|
806
|
+ fmt.Println("以前出库数量23323232322332323223233223232332", device_number)
|
|
807
|
+ fmt.Println("现在出库数量", number_count)
|
798
|
808
|
//如果修改的数量大于之前修改的数量
|
799
|
809
|
if (number_count - device_number) > 0 {
|
800
|
810
|
//如果修改的差数量 大于库存数量
|
|
@@ -803,27 +813,42 @@ func (c *HisApiController) CreateHisPrescription() {
|
803
|
813
|
return
|
804
|
814
|
}
|
805
|
815
|
}
|
806
|
|
- }
|
807
|
816
|
|
808
|
|
- //新增处方
|
809
|
|
- if advicelist.ID == 0 {
|
810
|
|
- all_count, _ := strconv.ParseFloat(totals, 64)
|
811
|
|
- if prescribingNumberUnit == drug.MinUnit {
|
812
|
|
- if prescribing_number > all_count {
|
813
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
814
|
|
- return
|
|
817
|
+ if device_number != number_count {
|
|
818
|
+
|
|
819
|
+ // 查询该药品最后一次出库记录
|
|
820
|
+ druginfo, _ := service.GetLastDrugWarehouseOutByDrugId(drug_id, patient_id, recordDateTime, adviceId)
|
|
821
|
+ fmt.Println("以前出库数量23323232322332323223233223232332", device_number)
|
|
822
|
+ fmt.Println("现在出库数量", number_count)
|
|
823
|
+ //回退库存
|
|
824
|
+ if druginfo.CountUnit == drug.MaxUnit && drug.MaxUnit != drug.MinUnit {
|
|
825
|
+
|
|
826
|
+ service.ModefyDrugByWarehouseInfo(druginfo.WarehouseInfoId, number_count)
|
815
|
827
|
}
|
816
|
|
- } else {
|
817
|
|
- if prescribingNumberUnit == drug.MaxUnit {
|
818
|
|
- num := prescribing_number * float64(drug.MinNumber)
|
819
|
|
- if num > all_count {
|
820
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
821
|
|
- return
|
|
828
|
+ if druginfo.CountUnit == drug.MinUnit && drug.MaxUnit != drug.MinUnit {
|
|
829
|
+ var stock_max_number int64
|
|
830
|
+ var stock_min_number int64
|
|
831
|
+
|
|
832
|
+ if number_count >= drug.MinNumber {
|
|
833
|
+ fmt.Println("尽力啊了吗332323322332233232332233223232323")
|
|
834
|
+ stock_max_number = device_number / drug.MinNumber
|
|
835
|
+ service.ModefyDrugByWarehouseInfo(druginfo.WarehouseInfoId, stock_max_number)
|
|
836
|
+ stock_min_number = device_number % drug.MinNumber
|
|
837
|
+ service.ModefyDrugByWarehouseInfoOne(druginfo.WarehouseInfoId, stock_min_number)
|
|
838
|
+
|
|
839
|
+ } else {
|
|
840
|
+ fmt.Println("99999999999999999999")
|
|
841
|
+ service.ModefyDrugByWarehouseInfoOne(druginfo.WarehouseInfoId, device_number)
|
822
|
842
|
}
|
823
|
843
|
}
|
|
844
|
+
|
|
845
|
+ if druginfo.CountUnit == drug.MaxUnit && druginfo.CountUnit == drug.MinUnit && drug.MaxUnit == drug.MinUnit {
|
|
846
|
+ service.ModefyDrugByWarehouseInfo(druginfo.WarehouseInfoId, device_number)
|
|
847
|
+ }
|
|
848
|
+ //删除记录
|
|
849
|
+ service.DeleteDrugAutoWarehouseSeven(drug_id, patient_id, recordDateTime, adviceId)
|
824
|
850
|
}
|
825
|
851
|
}
|
826
|
|
-
|
827
|
852
|
}
|
828
|
853
|
}
|
829
|
854
|
}
|
|
@@ -835,16 +860,27 @@ func (c *HisApiController) CreateHisPrescription() {
|
835
|
860
|
if stockConfig.IsOpen == 1 {
|
836
|
861
|
if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
|
837
|
862
|
prescriptions, _ := dataBody["prescriptions"].([]interface{})
|
|
863
|
+
|
838
|
864
|
if len(prescriptions) > 0 {
|
839
|
865
|
for _, item := range prescriptions {
|
|
866
|
+
|
840
|
867
|
items := item.(map[string]interface{})
|
841
|
868
|
if items["project"] != nil && reflect.TypeOf(items["project"]).String() == "[]interface {}" {
|
842
|
869
|
projects := items["project"].([]interface{})
|
843
|
870
|
if len(projects) > 0 {
|
|
871
|
+
|
844
|
872
|
for _, project := range projects {
|
|
873
|
+
|
845
|
874
|
var project_id int64
|
846
|
875
|
var project_type int64
|
847
|
876
|
var totals float64
|
|
877
|
+ var project_name string
|
|
878
|
+ var parsetotal int64
|
|
879
|
+ var id int64
|
|
880
|
+
|
|
881
|
+ if project.(map[string]interface{})["id"] != nil || reflect.TypeOf(project.(map[string]interface{})["id"]).String() == "float64" {
|
|
882
|
+ id = int64(project.(map[string]interface{})["id"].(float64))
|
|
883
|
+ }
|
848
|
884
|
if project.(map[string]interface{})["project_id"] != nil || reflect.TypeOf(project.(map[string]interface{})["project_id"]).String() == "float64" {
|
849
|
885
|
project_id = int64(project.(map[string]interface{})["project_id"].(float64))
|
850
|
886
|
}
|
|
@@ -853,20 +889,23 @@ func (c *HisApiController) CreateHisPrescription() {
|
853
|
889
|
}
|
854
|
890
|
if project.(map[string]interface{})["total"] != nil || reflect.TypeOf(project.(map[string]interface{})["total"]).String() == "string" {
|
855
|
891
|
total, _ := project.(map[string]interface{})["total"].(string)
|
856
|
|
-
|
857
|
892
|
totals, _ = strconv.ParseFloat(total, 64)
|
|
893
|
+ parsetotal, _ = strconv.ParseInt(total, 10, 64)
|
|
894
|
+ }
|
|
895
|
+
|
|
896
|
+ if project.(map[string]interface{})["project_name"] != nil || reflect.TypeOf(project.(map[string]interface{})["project_name"]).String() == "string" {
|
|
897
|
+ project_name = project.(map[string]interface{})["project_name"].(string)
|
|
898
|
+
|
858
|
899
|
}
|
859
|
900
|
if project_type == 3 {
|
860
|
901
|
|
861
|
902
|
//查找该耗材的出库记录
|
862
|
|
- goodWarehouseInfo, _ := service.GetAutoRecordByGoodIdSeven(project_id, patient_id, recordDateTime)
|
863
|
|
-
|
864
|
|
- if goodWarehouseInfo.ID == 0 {
|
865
|
|
- good, _ := service.FindGoodInfoByIdSeven(project_id)
|
866
|
|
- if good.ID == 0 {
|
867
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
868
|
|
- return
|
869
|
|
- }
|
|
903
|
+ goodWarehouseInfo, _ := service.GetAutoRecordByGoodIdSevenEight(project_id, patient_id, recordDateTime)
|
|
904
|
+ //var total_count int64
|
|
905
|
+ //for _, it := range goodWarehouseInfo {
|
|
906
|
+ // total_count += it.Count
|
|
907
|
+ //}
|
|
908
|
+ if len(goodWarehouseInfo) == 0 {
|
870
|
909
|
//查询耗材库存
|
871
|
910
|
list, _ := service.GetGoodWarehouseInfoSeven(project_id)
|
872
|
911
|
var stock_count int64
|
|
@@ -876,199 +915,29 @@ func (c *HisApiController) CreateHisPrescription() {
|
876
|
915
|
stock_counts := strconv.FormatInt(stock_count, 10)
|
877
|
916
|
stock_total_count, _ := strconv.ParseFloat(stock_counts, 64)
|
878
|
917
|
if totals > stock_total_count {
|
879
|
|
- c.ServeDynamicFailJsonSend(good.GoodName + "库存不足")
|
|
918
|
+ c.ServeDynamicFailJsonSend(project_name + "库存不足")
|
880
|
919
|
return
|
881
|
920
|
}
|
882
|
921
|
}
|
883
|
|
- }
|
884
|
|
-
|
885
|
|
- }
|
886
|
|
- }
|
887
|
|
- }
|
888
|
|
- }
|
889
|
|
- }
|
890
|
|
- }
|
891
|
|
- }
|
892
|
|
-
|
893
|
|
- //ch := make(chan struct{})
|
894
|
|
- //count := 2 // count 表示活动的协程个数
|
895
|
|
-
|
896
|
|
- go func() {
|
897
|
|
- if drugStockConfig.IsOpen == 1 {
|
898
|
|
- //校验库存总量
|
899
|
|
- if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
|
900
|
|
- prescriptions, _ := dataBody["prescriptions"].([]interface{})
|
901
|
|
- if len(prescriptions) > 0 {
|
902
|
|
-
|
903
|
|
- for _, item := range prescriptions {
|
904
|
|
- items := item.(map[string]interface{})
|
905
|
|
- if items["advices"] != nil && reflect.TypeOf(items["advices"]).String() == "[]interface {}" {
|
906
|
|
- advices := items["advices"].([]interface{})
|
907
|
|
- if len(advices) > 0 {
|
908
|
|
- for _, advice := range advices {
|
909
|
|
- var drug_id int64
|
910
|
|
- var prescribingNumberUnit string
|
911
|
|
- var prescribingNumber string
|
912
|
|
- var adviceId int64
|
913
|
|
- if advice.(map[string]interface{})["id"] != nil || reflect.TypeOf(advice.(map[string]interface{})["id"]).String() == "float64" {
|
914
|
|
- drug_id = int64(advice.(map[string]interface{})["id"].(float64))
|
915
|
|
- }
|
916
|
|
- if advice.(map[string]interface{})["prescribing_number"] != nil || reflect.TypeOf(advice.(map[string]interface{})["prescribing_number"]).String() == "string" {
|
917
|
|
-
|
918
|
|
- prescribingNumber = advice.(map[string]interface{})["prescribing_number"].(string)
|
919
|
|
-
|
920
|
|
- }
|
921
|
|
-
|
922
|
|
- if advice.(map[string]interface{})["prescribing_number_unit"] != nil && reflect.TypeOf(advice.(map[string]interface{})["prescribing_number_unit"]).String() == "string" {
|
923
|
|
- prescribingNumberUnit, _ = advice.(map[string]interface{})["prescribing_number_unit"].(string)
|
924
|
|
- }
|
925
|
|
-
|
926
|
|
- if advice.(map[string]interface{})["advice_id"] != nil || reflect.TypeOf(advice.(map[string]interface{})["advice_id"]).String() == "float64" {
|
927
|
|
- adviceId = int64(advice.(map[string]interface{})["advice_id"].(float64))
|
928
|
|
- }
|
929
|
|
-
|
930
|
|
- drug, _ := service.FindBaseDrugLibRecordSeven(adminInfo.CurrentOrgId, drug_id)
|
931
|
|
- if drug.ID == 0 {
|
932
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
933
|
|
- return
|
934
|
|
- }
|
935
|
|
-
|
936
|
|
- //查询药品的所有库存
|
937
|
|
- list, _ := service.GetDrugWarehouseInfoPrescriptionSeven(drug_id, adminInfo.CurrentOrgId)
|
938
|
|
- var total_count int64
|
939
|
|
- for _, it := range list {
|
940
|
|
- total_count += it.StockMaxNumber*drug.MinNumber + it.StockMinNumber
|
941
|
|
- }
|
942
|
|
-
|
943
|
|
- //查询该药品是否存在开药记录
|
944
|
|
- advicelist, _ := service.GetHisAdviceListByDrugIdEight(drug_id, patient_id, recordDateTime, adviceId)
|
945
|
|
-
|
946
|
|
- //修改处方
|
947
|
|
- if advicelist.ID > 0 {
|
948
|
|
- var device_number int64
|
949
|
|
- if advicelist.PrescribingNumberUnit == drug.MaxUnit {
|
950
|
|
- prescribingNumber := strconv.FormatFloat(advicelist.PrescribingNumber, 'f', -1, 64)
|
951
|
|
- prescribingNumberInt, _ := strconv.ParseInt(prescribingNumber, 10, 64)
|
952
|
|
- device_number = prescribingNumberInt * drug.MinNumber
|
953
|
|
- }
|
954
|
|
- if advicelist.PrescribingNumberUnit == drug.MinUnit {
|
955
|
|
- prescribingNumber := strconv.FormatFloat(advicelist.PrescribingNumber, 'f', -1, 64)
|
956
|
|
- prescribingNumberInt, _ := strconv.ParseInt(prescribingNumber, 10, 64)
|
957
|
|
- device_number = prescribingNumberInt
|
958
|
|
- }
|
959
|
|
-
|
960
|
|
- var sum_count int64
|
961
|
|
- //判断是否做过修改
|
962
|
|
- if prescribingNumberUnit == drug.MaxUnit {
|
963
|
|
-
|
964
|
|
- prescribingNumberInt, _ := strconv.ParseInt(prescribingNumber, 10, 64)
|
965
|
|
-
|
966
|
|
- sum_count = prescribingNumberInt * drug.MinNumber
|
967
|
|
- }
|
968
|
|
- if prescribingNumberUnit == drug.MinUnit {
|
969
|
|
- prescribingNumberInt, _ := strconv.ParseInt(prescribingNumber, 10, 64)
|
970
|
|
- sum_count = prescribingNumberInt
|
971
|
|
- }
|
972
|
|
- fmt.Println("sum_count23322332323232323232323223322323", sum_count)
|
973
|
|
- fmt.Println("devcie_number23333223333332232332233232323223", device_number)
|
974
|
|
-
|
975
|
|
- if device_number != sum_count {
|
976
|
|
-
|
977
|
|
- // 查询该药品最后一次出库记录
|
978
|
|
- druginfo, _ := service.GetLastDrugWarehouseOutByDrugId(drug_id, patient_id, recordDateTime, adviceId)
|
979
|
|
- fmt.Println("单位12332232322332322323233223", druginfo.CountUnit)
|
980
|
|
- fmt.Println("单位2332233223323223322332332233223", drug.MaxUnit)
|
981
|
|
- //回退库存
|
982
|
|
- if druginfo.CountUnit == drug.MaxUnit && drug.MaxUnit != drug.MinUnit {
|
983
|
|
-
|
984
|
|
- service.ModefyDrugByWarehouseInfo(druginfo.WarehouseInfoId, device_number)
|
985
|
|
- }
|
986
|
|
- if druginfo.CountUnit == drug.MinUnit && drug.MaxUnit != drug.MinUnit {
|
987
|
|
- var stock_max_number int64
|
988
|
|
- var stock_min_number int64
|
989
|
|
- if device_number >= drug.MinNumber {
|
990
|
|
- stock_max_number = device_number / drug.MinNumber
|
991
|
|
- fmt.Println("大的值2323233232232323", stock_max_number)
|
992
|
|
- service.ModefyDrugByWarehouseInfo(druginfo.WarehouseInfoId, stock_max_number)
|
993
|
|
- stock_min_number = device_number % drug.MinNumber
|
994
|
|
- fmt.Println("小的值322332332323233223", stock_min_number)
|
995
|
|
- if stock_min_number == drug.MinNumber {
|
996
|
|
-
|
997
|
|
- }
|
998
|
|
- service.ModefyDrugByWarehouseInfoOne(druginfo.WarehouseInfoId, stock_min_number)
|
999
|
|
-
|
1000
|
|
- } else {
|
1001
|
|
-
|
1002
|
|
- service.ModefyDrugByWarehouseInfoOne(druginfo.WarehouseInfoId, device_number)
|
1003
|
|
- }
|
1004
|
|
-
|
1005
|
|
- }
|
1006
|
|
-
|
1007
|
|
- if druginfo.CountUnit == drug.MaxUnit && druginfo.CountUnit == drug.MinUnit && drug.MaxUnit == drug.MinUnit {
|
1008
|
|
- service.ModefyDrugByWarehouseInfo(druginfo.WarehouseInfoId, device_number)
|
|
922
|
+ if len(goodWarehouseInfo) > 0 {
|
|
923
|
+ //查询该患者耗材的历史数据
|
|
924
|
+ ordProject, _ := service.GetHisProjectPrescriptionByPatientIdOne(id)
|
|
925
|
+ count, _ := strconv.ParseInt(ordProject.Count, 10, 64)
|
|
926
|
+ fmt.Println("parsetotal33223232323232323", parsetotal)
|
|
927
|
+ fmt.Println("count2332322332232332", count)
|
|
928
|
+ //数量发生改变
|
|
929
|
+ if parsetotal != count {
|
|
930
|
+ //查找今日该患者已经出库的所有耗材
|
|
931
|
+ goodList, _ := service.GetAllAutoRecordByPatient(patient_id, recordDateTime)
|
|
932
|
+ fmt.Println("goodList3323223232323232323", goodList)
|
|
933
|
+ for _, item := range goodList {
|
|
934
|
+ //回退库存
|
|
935
|
+ service.ModefyWarehouseInfo(item.Count, item.WarehouseInfotId)
|
1009
|
936
|
}
|
1010
|
|
-
|
1011
|
937
|
//删除记录
|
1012
|
|
- service.DeleteDrugAutoWarehouseSeven(drug_id, patient_id, recordDateTime, adviceId)
|
|
938
|
+ service.DeleteAutoWarehouse(patient_id, recordDateTime)
|
1013
|
939
|
}
|
1014
|
|
- }
|
1015
|
|
- }
|
1016
|
|
- }
|
1017
|
|
- }
|
1018
|
|
- }
|
1019
|
|
- }
|
1020
|
|
- }
|
1021
|
|
- }
|
1022
|
|
- //ch <- struct{}{}
|
1023
|
|
- }()
|
1024
|
|
-
|
1025
|
|
- go func() {
|
1026
|
|
- if stockConfig.IsOpen == 1 {
|
1027
|
|
- if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
|
1028
|
|
- prescriptions, _ := dataBody["prescriptions"].([]interface{})
|
1029
|
|
- if len(prescriptions) > 0 {
|
1030
|
|
- for _, item := range prescriptions {
|
1031
|
|
- items := item.(map[string]interface{})
|
1032
|
|
- if items["project"] != nil && reflect.TypeOf(items["project"]).String() == "[]interface {}" {
|
1033
|
|
- projects := items["project"].([]interface{})
|
1034
|
|
- if len(projects) > 0 {
|
1035
|
|
- for _, project := range projects {
|
1036
|
|
- var project_id int64
|
1037
|
|
- var project_type int64
|
1038
|
|
- var parsetotal int64
|
1039
|
|
- if project.(map[string]interface{})["project_id"] != nil || reflect.TypeOf(project.(map[string]interface{})["project_id"]).String() == "float64" {
|
1040
|
|
- project_id = int64(project.(map[string]interface{})["project_id"].(float64))
|
1041
|
|
- }
|
1042
|
|
- if project.(map[string]interface{})["type"] != nil || reflect.TypeOf(project.(map[string]interface{})["type"]).String() == "float64" {
|
1043
|
|
- project_type = int64(project.(map[string]interface{})["type"].(float64))
|
1044
|
|
- }
|
1045
|
|
- if project.(map[string]interface{})["total"] != nil || reflect.TypeOf(project.(map[string]interface{})["total"]).String() == "string" {
|
1046
|
|
- total, _ := project.(map[string]interface{})["total"].(string)
|
1047
|
|
- parsetotal, _ = strconv.ParseInt(total, 10, 64)
|
1048
|
|
- }
|
1049
|
940
|
|
1050
|
|
- if project_type == 3 {
|
1051
|
|
- //查找该耗材的出库记录
|
1052
|
|
- goodWarehouseInfo, _ := service.GetAutoRecordByGoodIdSevenEight(project_id, patient_id, recordDateTime)
|
1053
|
|
- var total_count int64
|
1054
|
|
- for _, it := range goodWarehouseInfo {
|
1055
|
|
- total_count += it.Count
|
1056
|
|
- }
|
1057
|
|
- //查询该患者耗材的历史数据
|
1058
|
|
- ordProject, _ := service.GetHisProjectPrescriptionByPatientId(patient_id, recordDateTime)
|
1059
|
|
- if total_count > 0 {
|
1060
|
|
- //数量发生改变
|
1061
|
|
- if parsetotal != total_count || len(ordProject) != len(projects) {
|
1062
|
|
- //查找今日该患者已经出库的所有耗材
|
1063
|
|
- goodList, _ := service.GetAllAutoRecordByPatient(patient_id, recordDateTime)
|
1064
|
|
- for _, item := range goodList {
|
1065
|
|
- //回退库存
|
1066
|
|
- service.ModefyWarehouseInfo(item.Count, item.WarehouseInfotId)
|
1067
|
|
- //删除记录
|
1068
|
|
- service.DeleteAutoWarehouse(item.PatientId, item.SysRecordTime)
|
1069
|
|
- }
|
1070
|
|
- }
|
1071
|
|
- }
|
1072
|
941
|
}
|
1073
|
942
|
}
|
1074
|
943
|
}
|
|
@@ -1077,17 +946,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
1077
|
946
|
}
|
1078
|
947
|
}
|
1079
|
948
|
}
|
1080
|
|
- //ch <- struct{}{}
|
1081
|
|
- }()
|
1082
|
|
-
|
1083
|
|
- //for range ch {
|
1084
|
|
- // // 每次从ch中接收数据,表明一个活动的协程结束
|
1085
|
|
- // count--
|
1086
|
|
- // // 当所有活动的协程都结束时,关闭管道
|
1087
|
|
- // if count == 0 {
|
1088
|
|
- // close(ch)
|
1089
|
|
- // }
|
1090
|
|
- //}
|
|
949
|
+ }
|
1091
|
950
|
|
1092
|
951
|
info, _ := service.FindHisPatientPrescriptionInfo(adminInfo.CurrentOrgId, patient_id, recordDateTime, p_type, his_patient_id)
|
1093
|
952
|
var hpInfo models.HisPrescriptionInfo
|
|
@@ -1164,10 +1023,18 @@ func (c *HisApiController) CreateHisPrescription() {
|
1164
|
1023
|
defer redis.Close()
|
1165
|
1024
|
}
|
1166
|
1025
|
|
|
1026
|
+ //定义切片
|
|
1027
|
+
|
|
1028
|
+ var adviceList []models.HisDoctorAdviceInfo
|
|
1029
|
+ var projectList []models.HisPrescriptionProject
|
|
1030
|
+
|
|
1031
|
+ //var hisLis []models.HisList
|
|
1032
|
+
|
1167
|
1033
|
if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
|
1168
|
1034
|
prescriptions, _ := dataBody["prescriptions"].([]interface{})
|
1169
|
1035
|
|
1170
|
1036
|
var tempPrescription *models.HisPrescription
|
|
1037
|
+
|
1171
|
1038
|
if len(prescriptions) > 0 {
|
1172
|
1039
|
for _, item := range prescriptions {
|
1173
|
1040
|
items := item.(map[string]interface{})
|
|
@@ -1308,6 +1175,10 @@ func (c *HisApiController) CreateHisPrescription() {
|
1308
|
1175
|
|
1309
|
1176
|
s.StartTime = pTime
|
1310
|
1177
|
service.CreateHisDoctorAdvice(&s)
|
|
1178
|
+
|
|
1179
|
+ //存储切片中
|
|
1180
|
+ adviceList = append(adviceList, s)
|
|
1181
|
+
|
1311
|
1182
|
redis := service.RedisClient()
|
1312
|
1183
|
key := strconv.FormatInt(adminInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(theTime.Unix(), 10) + ":his_advices_list_all"
|
1313
|
1184
|
redis.Set(key, "", time.Second)
|
|
@@ -1355,6 +1226,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
1355
|
1226
|
}
|
1356
|
1227
|
|
1357
|
1228
|
service.CreateHisProjectTwo(&p)
|
|
1229
|
+ projectList = append(projectList, p)
|
1358
|
1230
|
var randNum int
|
1359
|
1231
|
randNum = rand.Intn(10000) + 1000
|
1360
|
1232
|
timestamp := time.Now().Unix()
|
|
@@ -1414,14 +1286,14 @@ func (c *HisApiController) CreateHisPrescription() {
|
1414
|
1286
|
|
1415
|
1287
|
service.SaveHisProjectTwo(&p)
|
1416
|
1288
|
|
1417
|
|
- if p.Type == 3 { //处理透前准备耗材数量数据
|
1418
|
|
- consumables, _ := service.FindHisConsumablesByID(adminInfo.CurrentOrgId, patient_id, recordDateTime, p.ProjectId)
|
1419
|
|
- if consumables.ID > 0 {
|
1420
|
|
- cnt, _ := strconv.ParseInt(p.Count, 10, 64)
|
1421
|
|
- consumables.Count = cnt
|
1422
|
|
- service.UpdateConsumables(&consumables)
|
1423
|
|
- }
|
1424
|
|
- }
|
|
1289
|
+ //if p.Type == 3 { //处理透前准备耗材数量数据
|
|
1290
|
+ // consumables, _ := service.FindHisConsumablesByID(adminInfo.CurrentOrgId, patient_id, recordDateTime, p.ProjectId)
|
|
1291
|
+ // if consumables.ID > 0 {
|
|
1292
|
+ // cnt, _ := strconv.ParseInt(p.Count, 10, 64)
|
|
1293
|
+ // consumables.Count = cnt
|
|
1294
|
+ // service.UpdateConsumables(&consumables)
|
|
1295
|
+ // }
|
|
1296
|
+ //}
|
1425
|
1297
|
|
1426
|
1298
|
}
|
1427
|
1299
|
}
|
|
@@ -1464,6 +1336,33 @@ func (c *HisApiController) CreateHisPrescription() {
|
1464
|
1336
|
}
|
1465
|
1337
|
}
|
1466
|
1338
|
|
|
1339
|
+ //redisClient := service.RedisClient()
|
|
1340
|
+ //defer redisClient.Close()
|
|
1341
|
+ //
|
|
1342
|
+ //list := models.HisList{
|
|
1343
|
+ // Patient_id: patient_id,
|
|
1344
|
+ // Advice_id:0,
|
|
1345
|
+ // Record_date: 0,
|
|
1346
|
+ // Advice: adviceList,
|
|
1347
|
+ // Project: nil,
|
|
1348
|
+ //}
|
|
1349
|
+ //hisLis = append(hisLis, list)
|
|
1350
|
+ //
|
|
1351
|
+ //advice_json, _ := json.Marshal(&hisLis)
|
|
1352
|
+ //redisClient.RPush("111", advice_json).Result()
|
|
1353
|
+ //result, _ := redisClient.RPop("111").Result()
|
|
1354
|
+ //fmt.Println("resuilt2332323323232323232323232322323233232",redisClient.LLen("111"))
|
|
1355
|
+ //
|
|
1356
|
+ //var dat []map[string]interface{}
|
|
1357
|
+ //json.Unmarshal([]byte(result), &dat)
|
|
1358
|
+ //fmt.Println("hhhh2332323232233223322332322323232323",dat)
|
|
1359
|
+ //
|
|
1360
|
+ //for k,v:=range dat{
|
|
1361
|
+ // fmt.Println("第",k,"个数的值是:",v,v["Advice"],v["Patient_id"])
|
|
1362
|
+ //}
|
|
1363
|
+ //project_json, _ := json.Marshal(&projectList)
|
|
1364
|
+ //redisClient.LPush("222", project_json).Result()
|
|
1365
|
+
|
1467
|
1366
|
if err == nil {
|
1468
|
1367
|
c.ServeSuccessJSON(map[string]interface{}{
|
1469
|
1368
|
"msg": "保存成功",
|
|
@@ -3344,82 +3243,82 @@ func (c *HisApiController) setAdviceWithJSON(advice *models.HisDoctorAdviceInfo,
|
3344
|
3243
|
}
|
3345
|
3244
|
}
|
3346
|
3245
|
|
3347
|
|
- _, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(advice.UserOrgId)
|
3348
|
|
-
|
3349
|
|
- if drugStockConfig.IsOpen == 1 {
|
3350
|
|
-
|
3351
|
|
- drug, _ := service.FindBaseDrugLibRecord(advice.UserOrgId, advice.DrugId)
|
3352
|
|
- if advice.ID == 0 { //医嘱不存在
|
3353
|
|
- if advice.PrescribingNumberUnit == drug.MinUnit { //当前数据单位与基础库一致为最小单位,直接计算
|
3354
|
|
- drug.Total = drug.Total - advice.PrescribingNumber
|
3355
|
|
- service.UpdateBaseDrugLib(&drug)
|
3356
|
|
-
|
3357
|
|
- } else if advice.PrescribingNumberUnit == drug.MaxUnit { //当前数据单位为最大单位,需要将最大单位转为最小单位
|
3358
|
|
- num := advice.PrescribingNumber * float64(drug.MinNumber)
|
3359
|
|
- drug.Total = drug.Total - num
|
3360
|
|
- service.UpdateBaseDrugLib(&drug)
|
3361
|
|
- }
|
3362
|
|
-
|
3363
|
|
- } else if advice.ID > 0 { //医嘱存在
|
3364
|
|
- hisAdvice, _ := service.GetHisDoctorAdvicesById(advice.ID)
|
3365
|
|
- var num float64
|
3366
|
|
-
|
3367
|
|
- if advice.PrescribingNumberUnit == drug.MinUnit { //当前数据为最小单位
|
3368
|
|
- if hisAdvice.PrescribingNumberUnit == advice.PrescribingNumberUnit { //原数据为最小单位,三个单位一致为最小单位直接计算
|
3369
|
|
- if hisAdvice.PrescribingNumber > advice.PrescribingNumber {
|
3370
|
|
- num = hisAdvice.PrescribingNumber - advice.PrescribingNumber
|
3371
|
|
- drug.Total = drug.Total + num
|
3372
|
|
- service.UpdateBaseDrugLib(&drug)
|
3373
|
|
- } else if hisAdvice.PrescribingNumber < advice.PrescribingNumber {
|
3374
|
|
- num = advice.PrescribingNumber - hisAdvice.PrescribingNumber
|
3375
|
|
- drug.Total = drug.Total - num
|
3376
|
|
- service.UpdateBaseDrugLib(&drug)
|
3377
|
|
- }
|
3378
|
|
- } else { //原数据为最大单位,需要将最大单位数量转为最小单位数量
|
3379
|
|
- num2 := hisAdvice.PrescribingNumber * float64(drug.MinNumber)
|
3380
|
|
- if num2 > advice.PrescribingNumber {
|
3381
|
|
- num = num2 - advice.PrescribingNumber
|
3382
|
|
- drug.Total = drug.Total + num
|
3383
|
|
- service.UpdateBaseDrugLib(&drug)
|
3384
|
|
- } else if num2 < advice.PrescribingNumber {
|
3385
|
|
- num = advice.PrescribingNumber - num2
|
3386
|
|
- drug.Total = drug.Total - num
|
3387
|
|
- service.UpdateBaseDrugLib(&drug)
|
3388
|
|
- }
|
3389
|
|
-
|
3390
|
|
- }
|
3391
|
|
-
|
3392
|
|
- } else if advice.PrescribingNumberUnit == drug.MaxUnit { //当前数据为最大单位
|
3393
|
|
- if advice.PrescribingNumberUnit == hisAdvice.PrescribingNumberUnit { //原数据为最大单位, 当前数据单位和原数据单位都为最大单位,需要将两个数据转成最小单位
|
3394
|
|
- num1 := hisAdvice.PrescribingNumber * float64(drug.MinNumber)
|
3395
|
|
- num2 := advice.PrescribingNumber * float64(drug.MinNumber)
|
3396
|
|
- if num1 > num2 {
|
3397
|
|
- num = num1 - num2
|
3398
|
|
- drug.Total = drug.Total + num
|
3399
|
|
- service.UpdateBaseDrugLib(&drug)
|
3400
|
|
- } else if num1 < num2 {
|
3401
|
|
- num = num2 - num1
|
3402
|
|
- drug.Total = drug.Total - num
|
3403
|
|
- service.UpdateBaseDrugLib(&drug)
|
3404
|
|
- }
|
3405
|
|
-
|
3406
|
|
- } else { //原数据为最小单位,当前数据为最大单位,需要将当前数据数量转为最小单位数量
|
3407
|
|
- num2 := advice.PrescribingNumber * float64(drug.MinNumber)
|
3408
|
|
- //num2 := hisAdvice.PrescribingNumber * (drug.Dose / float64(drug.MinNumber))
|
3409
|
|
- if hisAdvice.PrescribingNumber > num2 {
|
3410
|
|
- num = hisAdvice.PrescribingNumber - num2
|
3411
|
|
- drug.Total = drug.Total + num
|
3412
|
|
- service.UpdateBaseDrugLib(&drug)
|
3413
|
|
- } else if num2 < advice.PrescribingNumber {
|
3414
|
|
- num = num2 - hisAdvice.PrescribingNumber
|
3415
|
|
- drug.Total = drug.Total - num
|
3416
|
|
- service.UpdateBaseDrugLib(&drug)
|
3417
|
|
- }
|
3418
|
|
-
|
3419
|
|
- }
|
3420
|
|
- }
|
3421
|
|
- }
|
3422
|
|
- }
|
|
3246
|
+ //_, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(advice.UserOrgId)
|
|
3247
|
+ //
|
|
3248
|
+ //if drugStockConfig.IsOpen == 1 {
|
|
3249
|
+ //
|
|
3250
|
+ // drug, _ := service.FindBaseDrugLibRecord(advice.UserOrgId, advice.DrugId)
|
|
3251
|
+ // if advice.ID == 0 { //医嘱不存在
|
|
3252
|
+ // if advice.PrescribingNumberUnit == drug.MinUnit { //当前数据单位与基础库一致为最小单位,直接计算
|
|
3253
|
+ // drug.Total = drug.Total - advice.PrescribingNumber
|
|
3254
|
+ // service.UpdateBaseDrugLib(&drug)
|
|
3255
|
+ //
|
|
3256
|
+ // } else if advice.PrescribingNumberUnit == drug.MaxUnit { //当前数据单位为最大单位,需要将最大单位转为最小单位
|
|
3257
|
+ // num := advice.PrescribingNumber * float64(drug.MinNumber)
|
|
3258
|
+ // drug.Total = drug.Total - num
|
|
3259
|
+ // service.UpdateBaseDrugLib(&drug)
|
|
3260
|
+ // }
|
|
3261
|
+ //
|
|
3262
|
+ // } else if advice.ID > 0 { //医嘱存在
|
|
3263
|
+ // hisAdvice, _ := service.GetHisDoctorAdvicesById(advice.ID)
|
|
3264
|
+ // var num float64
|
|
3265
|
+ //
|
|
3266
|
+ // if advice.PrescribingNumberUnit == drug.MinUnit { //当前数据为最小单位
|
|
3267
|
+ // if hisAdvice.PrescribingNumberUnit == advice.PrescribingNumberUnit { //原数据为最小单位,三个单位一致为最小单位直接计算
|
|
3268
|
+ // if hisAdvice.PrescribingNumber > advice.PrescribingNumber {
|
|
3269
|
+ // num = hisAdvice.PrescribingNumber - advice.PrescribingNumber
|
|
3270
|
+ // drug.Total = drug.Total + num
|
|
3271
|
+ // service.UpdateBaseDrugLib(&drug)
|
|
3272
|
+ // } else if hisAdvice.PrescribingNumber < advice.PrescribingNumber {
|
|
3273
|
+ // num = advice.PrescribingNumber - hisAdvice.PrescribingNumber
|
|
3274
|
+ // drug.Total = drug.Total - num
|
|
3275
|
+ // service.UpdateBaseDrugLib(&drug)
|
|
3276
|
+ // }
|
|
3277
|
+ // } else { //原数据为最大单位,需要将最大单位数量转为最小单位数量
|
|
3278
|
+ // num2 := hisAdvice.PrescribingNumber * float64(drug.MinNumber)
|
|
3279
|
+ // if num2 > advice.PrescribingNumber {
|
|
3280
|
+ // num = num2 - advice.PrescribingNumber
|
|
3281
|
+ // drug.Total = drug.Total + num
|
|
3282
|
+ // service.UpdateBaseDrugLib(&drug)
|
|
3283
|
+ // } else if num2 < advice.PrescribingNumber {
|
|
3284
|
+ // num = advice.PrescribingNumber - num2
|
|
3285
|
+ // drug.Total = drug.Total - num
|
|
3286
|
+ // service.UpdateBaseDrugLib(&drug)
|
|
3287
|
+ // }
|
|
3288
|
+ //
|
|
3289
|
+ // }
|
|
3290
|
+ //
|
|
3291
|
+ // } else if advice.PrescribingNumberUnit == drug.MaxUnit { //当前数据为最大单位
|
|
3292
|
+ // if advice.PrescribingNumberUnit == hisAdvice.PrescribingNumberUnit { //原数据为最大单位, 当前数据单位和原数据单位都为最大单位,需要将两个数据转成最小单位
|
|
3293
|
+ // num1 := hisAdvice.PrescribingNumber * float64(drug.MinNumber)
|
|
3294
|
+ // num2 := advice.PrescribingNumber * float64(drug.MinNumber)
|
|
3295
|
+ // if num1 > num2 {
|
|
3296
|
+ // num = num1 - num2
|
|
3297
|
+ // drug.Total = drug.Total + num
|
|
3298
|
+ // service.UpdateBaseDrugLib(&drug)
|
|
3299
|
+ // } else if num1 < num2 {
|
|
3300
|
+ // num = num2 - num1
|
|
3301
|
+ // drug.Total = drug.Total - num
|
|
3302
|
+ // service.UpdateBaseDrugLib(&drug)
|
|
3303
|
+ // }
|
|
3304
|
+ //
|
|
3305
|
+ // } else { //原数据为最小单位,当前数据为最大单位,需要将当前数据数量转为最小单位数量
|
|
3306
|
+ // num2 := advice.PrescribingNumber * float64(drug.MinNumber)
|
|
3307
|
+ // //num2 := hisAdvice.PrescribingNumber * (drug.Dose / float64(drug.MinNumber))
|
|
3308
|
+ // if hisAdvice.PrescribingNumber > num2 {
|
|
3309
|
+ // num = hisAdvice.PrescribingNumber - num2
|
|
3310
|
+ // drug.Total = drug.Total + num
|
|
3311
|
+ // service.UpdateBaseDrugLib(&drug)
|
|
3312
|
+ // } else if num2 < advice.PrescribingNumber {
|
|
3313
|
+ // num = num2 - hisAdvice.PrescribingNumber
|
|
3314
|
+ // drug.Total = drug.Total - num
|
|
3315
|
+ // service.UpdateBaseDrugLib(&drug)
|
|
3316
|
+ // }
|
|
3317
|
+ //
|
|
3318
|
+ // }
|
|
3319
|
+ // }
|
|
3320
|
+ // }
|
|
3321
|
+ //}
|
3423
|
3322
|
|
3424
|
3323
|
//
|
3425
|
3324
|
//if json["execution_time"] != nil && reflect.TypeOf(json["execution_time"]).String() == "string" {
|
|
@@ -3561,46 +3460,46 @@ func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionPro
|
3561
|
3460
|
// project.WeekDay = week_day
|
3562
|
3461
|
//}
|
3563
|
3462
|
|
3564
|
|
- _, stockConfig := service.FindAutomaticReduceRecordByOrgId(project.UserOrgId)
|
3565
|
|
-
|
3566
|
|
- if project.ID == 0 {
|
3567
|
|
- if stockConfig.IsOpen == 1 {
|
3568
|
|
- if project.Type == 3 {
|
3569
|
|
- good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
|
3570
|
|
- f_count, _ := strconv.ParseFloat(project.Count, 64)
|
3571
|
|
- good.Total = good.Total - f_count
|
3572
|
|
- service.UpdateGoodInfo(&good)
|
3573
|
|
- }
|
3574
|
|
- }
|
3575
|
|
-
|
3576
|
|
- } else {
|
3577
|
|
- temp_project, _ := service.GetHisPrescriptionProjectByID(project.ID)
|
3578
|
|
-
|
3579
|
|
- if stockConfig.IsOpen == 1 {
|
3580
|
|
- if project.Type == 3 {
|
3581
|
|
- good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
|
3582
|
|
- if project.Count < temp_project.Count {
|
3583
|
|
- f_count_one, _ := strconv.ParseFloat(project.Count, 64)
|
3584
|
|
- f_count_two, _ := strconv.ParseFloat(temp_project.Count, 64)
|
3585
|
|
-
|
3586
|
|
- other_count := f_count_two - f_count_one
|
3587
|
|
- other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(int64(other_count), 10), 64)
|
3588
|
|
- good.Total = good.Total + other_count_two
|
3589
|
|
- service.UpdateGoodInfo(&good)
|
3590
|
|
- } else if project.Count > temp_project.Count {
|
3591
|
|
- f_count_one, _ := strconv.ParseFloat(project.Count, 64)
|
3592
|
|
- f_count_two, _ := strconv.ParseFloat(temp_project.Count, 64)
|
3593
|
|
-
|
3594
|
|
- other_count := f_count_one - f_count_two
|
3595
|
|
- other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(int64(other_count), 10), 64)
|
3596
|
|
- good.Total = good.Total - other_count_two
|
3597
|
|
- service.UpdateGoodInfo(&good)
|
3598
|
|
- }
|
3599
|
|
-
|
3600
|
|
- }
|
3601
|
|
- }
|
3602
|
|
-
|
3603
|
|
- }
|
|
3463
|
+ //_, stockConfig := service.FindAutomaticReduceRecordByOrgId(project.UserOrgId)
|
|
3464
|
+ //
|
|
3465
|
+ //if project.ID == 0 {
|
|
3466
|
+ // if stockConfig.IsOpen == 1 {
|
|
3467
|
+ // if project.Type == 3 {
|
|
3468
|
+ // good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
|
|
3469
|
+ // f_count, _ := strconv.ParseFloat(project.Count, 64)
|
|
3470
|
+ // good.Total = good.Total - f_count
|
|
3471
|
+ // service.UpdateGoodInfo(&good)
|
|
3472
|
+ // }
|
|
3473
|
+ // }
|
|
3474
|
+ //
|
|
3475
|
+ //} else {
|
|
3476
|
+ // temp_project, _ := service.GetHisPrescriptionProjectByID(project.ID)
|
|
3477
|
+ //
|
|
3478
|
+ // if stockConfig.IsOpen == 1 {
|
|
3479
|
+ // if project.Type == 3 {
|
|
3480
|
+ // good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
|
|
3481
|
+ // if project.Count < temp_project.Count {
|
|
3482
|
+ // f_count_one, _ := strconv.ParseFloat(project.Count, 64)
|
|
3483
|
+ // f_count_two, _ := strconv.ParseFloat(temp_project.Count, 64)
|
|
3484
|
+ //
|
|
3485
|
+ // other_count := f_count_two - f_count_one
|
|
3486
|
+ // other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(int64(other_count), 10), 64)
|
|
3487
|
+ // good.Total = good.Total + other_count_two
|
|
3488
|
+ // service.UpdateGoodInfo(&good)
|
|
3489
|
+ // } else if project.Count > temp_project.Count {
|
|
3490
|
+ // f_count_one, _ := strconv.ParseFloat(project.Count, 64)
|
|
3491
|
+ // f_count_two, _ := strconv.ParseFloat(temp_project.Count, 64)
|
|
3492
|
+ //
|
|
3493
|
+ // other_count := f_count_one - f_count_two
|
|
3494
|
+ // other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(int64(other_count), 10), 64)
|
|
3495
|
+ // good.Total = good.Total - other_count_two
|
|
3496
|
+ // service.UpdateGoodInfo(&good)
|
|
3497
|
+ // }
|
|
3498
|
+ //
|
|
3499
|
+ // }
|
|
3500
|
+ // }
|
|
3501
|
+ //
|
|
3502
|
+ //}
|
3604
|
3503
|
|
3605
|
3504
|
return 0
|
3606
|
3505
|
}
|
|
@@ -5435,17 +5334,17 @@ func (c *HisApiController) GetFaPiaoData() {
|
5435
|
5334
|
admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, adminUser.AdminUser.Id)
|
5436
|
5335
|
|
5437
|
5336
|
c.ServeSuccessJSON(map[string]interface{}{
|
5438
|
|
- "order_number": order.Number, //业务流水号
|
5439
|
|
- "id_card_no": his.IdCardNo, //社会保障号
|
5440
|
|
- "department_name": department.Name, //科室
|
5441
|
|
- "number": his.Number, //门诊号
|
5442
|
|
- "date": order.SettleAccountsDate, //结算日期
|
5443
|
|
- "name": order.PsnName, //姓名
|
5444
|
|
- "gender": order.Gend, //性别
|
5445
|
|
- "psn_cash_money": order.PsnCashPay, //个人支付
|
5446
|
|
- "pay_way": "门诊", //结算方式
|
5447
|
|
- "medfee_sumamt": order.MedfeeSumamt, //总费用
|
5448
|
|
- "admin_user_name": admin.UserName, //收款员
|
|
5337
|
+ "order_number": order.Number, //业务流水号
|
|
5338
|
+ "id_card_no": his.IdCardNo, //社会保障号
|
|
5339
|
+ "department_name": department.Name, //科室
|
|
5340
|
+ "number": his.Number, //门诊号
|
|
5341
|
+ "date": order.SettleEndTime, //结算日期
|
|
5342
|
+ "name": order.PsnName, //姓名
|
|
5343
|
+ "gender": order.Gend, //性别
|
|
5344
|
+ "psn_cash_money": order.PsnCashPay, //个人支付
|
|
5345
|
+ "pay_way": "门诊", //结算方式
|
|
5346
|
+ "medfee_sumamt": order.MedfeeSumamt, //总费用
|
|
5347
|
+ "admin_user_name": admin.UserName, //收款员
|
5449
|
5348
|
|
5450
|
5349
|
"bedCostTotal": bedCostTotal,
|
5451
|
5350
|
"bedCostSelfTotal": bedCostSelfTotal,
|
|
@@ -6938,8 +6837,3 @@ func (c *HisApiController) GetHisDoctorAdviceInfo() {
|
6938
|
6837
|
})
|
6939
|
6838
|
return
|
6940
|
6839
|
}
|
6941
|
|
-
|
6942
|
|
-func GetPrescriptionById(prescription []interface{}) {
|
6943
|
|
-
|
6944
|
|
- fmt.Println("prescription222222222222225555532323332323233223323323322332323232323232332322323323232", prescription)
|
6945
|
|
-}
|