Procházet zdrojové kódy

Merge branch '20201014_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20201014_xt_api_new_branch

csx před 4 roky
rodič
revize
c39c30ac63

+ 30 - 24
controllers/mobile_api_controllers/patient_api_controller.go Zobrazit soubor

@@ -167,7 +167,7 @@ func (c *PatientApiController) EditDialysisSolution() {
167 167
 }
168 168
 
169 169
 func (c *PatientApiController) CreateDoctorAdvice() {
170
-	fmt.Println("进来了吗-----------------------------")
170
+
171 171
 	patient, _ := c.GetInt64("id", 0)
172 172
 	if patient <= 0 {
173 173
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -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,10 +950,10 @@ func (c *PatientApiController) ExecDoctorAdvice() {
954 950
 
955 951
 	if privateDrugConfig != nil && privateDrugConfig.DrugStart == 1 {
956 952
 		if groupno > 0 {
957
-			//advices, _ := service.FindAllDoct/**/orAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
958
-			for _, item := range tempAdvices {
959
-				fmt.Println("------------进来没有22222222", item.ExecutionState)
960
-				if item.ExecutionState == 1 {
953
+			advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
954
+			for _, item := range advices {
955
+
956
+				if item.ExecutionState == 1 && item.Way == 2 {
961 957
 					prescribingNumber := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
962 958
 					count, _ := strconv.ParseInt(prescribingNumber, 10, 64)
963 959
 
@@ -991,9 +987,9 @@ func (c *PatientApiController) ExecDoctorAdvice() {
991 987
 			}
992 988
 		} else {
993 989
 
994
-			//advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
995
-			for _, item := range tempAdvices {
996
-				if item.ExecutionState == 1 {
990
+			advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
991
+			for _, item := range advices {
992
+				if item.ExecutionState == 1 && item.Way == 2 {
997 993
 
998 994
 					prescribingNumber := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
999 995
 					count, _ := strconv.ParseInt(prescribingNumber, 10, 64)
@@ -2076,9 +2072,14 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
2076 2072
 		internal_fistula_skin := dataBody["internal_fistula_skin"].(string)
2077 2073
 		evaluation.InternalFistulaSkin = internal_fistula_skin
2078 2074
 	}
2075
+	if dataBody["is_hemorrhage"] != nil && reflect.TypeOf(dataBody["is_hemorrhage"]).String() == "string" {
2076
+		ishemorrhage, _ := dataBody["is_hemorrhage"].(string)
2077
+		is_hemorrhage, _ := strconv.ParseInt(ishemorrhage, 10, 64)
2078
+		evaluation.IsHemorrhage = is_hemorrhage
2079 2079
 
2080
-	if dataBody["is_hemorrhage"] != nil && reflect.TypeOf(dataBody["is_hemorrhage"]).String() == "float64" {
2081
-		is_hemorrhage := int64(dataBody["is_hemorrhage"].(float64))
2080
+		//if dataBody["is_hemorrhage"] != nil && reflect.TypeOf(dataBody["is_hemorrhage"]).String() == "float64" {
2081
+		//	is_hemorrhage := int64(dataBody["is_hemorrhage"].(float64))
2082
+		//	fmt.Println("is_hemorrhage2222222222222222",is_hemorrhage)
2082 2083
 		if is_hemorrhage != 1 && is_hemorrhage != 2 {
2083 2084
 			is_hemorrhage = 0
2084 2085
 		}
@@ -2220,6 +2221,11 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
2220 2221
 		evaluation.Edema = edema
2221 2222
 	}
2222 2223
 
2224
+	if dataBody["special_treatment"] != nil && reflect.TypeOf(dataBody["special_treatment"]).String() == "string" {
2225
+		specialTreatment := dataBody["special_treatment"].(string)
2226
+		evaluation.SpecialTreatment = specialTreatment
2227
+	}
2228
+
2223 2229
 	return
2224 2230
 }
2225 2231