陈少旭 2 月之前
父節點
當前提交
d25252d8e2
共有 2 個文件被更改,包括 209 次插入198 次删除
  1. 181 156
      controllers/sg/his_api_controller.go
  2. 28 42
      models/models_3501.go

+ 181 - 156
controllers/sg/his_api_controller.go 查看文件

34
 	"syscall"
34
 	"syscall"
35
 	"time"
35
 	"time"
36
 	"unsafe"
36
 	"unsafe"
37
-	"github.com/go-ole/go-ole"
38
 )
37
 )
39
 
38
 
40
 type HisApiController struct {
39
 type HisApiController struct {
585
 	struct3508.Enddate = end_time
584
 	struct3508.Enddate = end_time
586
 	struct3508.Enddate = end_time
585
 	struct3508.Enddate = end_time
587
 
586
 
588
-
589
 	if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") { //广东
587
 	if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") { //广东
590
-		result1, result2 := service.Gdyb3508(struct3508,struct3508.SecretKey)
588
+		result1, result2 := service.Gdyb3508(struct3508, struct3508.SecretKey)
591
 		saveLog(result1, result2, "3508", "3508")
589
 		saveLog(result1, result2, "3508", "3508")
592
 
590
 
593
 		var res models.Result3508
591
 		var res models.Result3508
614
 			})
612
 			})
615
 		}
613
 		}
616
 
614
 
617
-	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "350") { //广东
615
+	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "350") {
618
 		result1, result2, _ := service.FJyb3508(struct3508)
616
 		result1, result2, _ := service.FJyb3508(struct3508)
619
 		saveLog(result1, result2, "3508", "3508")
617
 		saveLog(result1, result2, "3508", "3508")
620
 
618
 
644
 
642
 
645
 	}
643
 	}
646
 
644
 
647
-
648
 }
645
 }
649
 func (c *HisApiController) Get3509() {
646
 func (c *HisApiController) Get3509() {
650
 	admin_user_id, _ := c.GetInt64("admin_user_id")
647
 	admin_user_id, _ := c.GetInt64("admin_user_id")
674
 	struct3508.Begndate = start_time
671
 	struct3508.Begndate = start_time
675
 	struct3508.Enddate = end_time
672
 	struct3508.Enddate = end_time
676
 
673
 
677
-
678
 	if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") { //广东
674
 	if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") { //广东
679
-		result1, result2 := service.Gdyb3509(struct3508,struct3508.SecretKey)
675
+		result1, result2 := service.Gdyb3509(struct3508, struct3508.SecretKey)
680
 		saveLog(result1, result2, "3509", "3509")
676
 		saveLog(result1, result2, "3509", "3509")
681
 
677
 
682
 		var res models.Result3508
678
 		var res models.Result3508
703
 			})
699
 			})
704
 		}
700
 		}
705
 
701
 
706
-	}
707
-
708
-
709
-
710
-
711
-	result1, result2, _ := service.FJyb3509(struct3508)
712
-	saveLog(result1, result2, "3509", "3509")
713
-
714
-	var res models.Result3509
715
-	var respJSON2 map[string]interface{}
716
-	if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
717
-		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
718
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
719
-		return
720
-	}
721
-	userJSONBytes2, _ := json.Marshal(respJSON2)
722
-	if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
723
-		utils.ErrorLog("解析失败:%v", err)
724
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
725
-		return
726
-	}
727
-	if res.Infcode == -1 {
728
-		c.ServeSuccessJSON(map[string]interface{}{
729
-			"failed_code": -10,
730
-			"msg":         res.ErrMsg,
731
-		})
732
 	} else {
702
 	} else {
733
-		c.ServeSuccessJSON(map[string]interface{}{
734
-			"info": res.Output,
735
-		})
703
+		result1, result2, _ := service.FJyb3509(struct3508)
704
+		saveLog(result1, result2, "3509", "3509")
705
+
706
+		var res models.Result3509
707
+		var respJSON2 map[string]interface{}
708
+		if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
709
+			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
710
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
711
+			return
712
+		}
713
+		userJSONBytes2, _ := json.Marshal(respJSON2)
714
+		if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
715
+			utils.ErrorLog("解析失败:%v", err)
716
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
717
+			return
718
+		}
719
+		if res.Infcode == -1 {
720
+			c.ServeSuccessJSON(map[string]interface{}{
721
+				"failed_code": -10,
722
+				"msg":         res.ErrMsg,
723
+			})
724
+		} else {
725
+			c.ServeSuccessJSON(map[string]interface{}{
726
+				"info": res.Output,
727
+			})
728
+		}
736
 	}
729
 	}
737
 }
730
 }
738
 func (c *HisApiController) Get3510() {
731
 func (c *HisApiController) Get3510() {
762
 	struct3508.MedListCodg = drug.MedicalInsuranceNumber
755
 	struct3508.MedListCodg = drug.MedicalInsuranceNumber
763
 	struct3508.Begndate = start_time
756
 	struct3508.Begndate = start_time
764
 	struct3508.Enddate = end_time
757
 	struct3508.Enddate = end_time
765
-	result1, result2, _ := service.FJyb3510(struct3508)
766
-	saveLog(result1, result2, "3510", "3510")
767
 
758
 
768
-	var res models.Result3510
769
-	var respJSON2 map[string]interface{}
770
-	if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
771
-		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
772
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
773
-		return
774
-	}
775
-	userJSONBytes2, _ := json.Marshal(respJSON2)
776
-	if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
777
-		utils.ErrorLog("解析失败:%v", err)
778
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
779
-		return
780
-	}
781
-	if res.Infcode == -1 {
782
-		c.ServeSuccessJSON(map[string]interface{}{
783
-			"failed_code": -10,
784
-			"msg":         res.ErrMsg,
785
-		})
759
+	if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") { //广东
760
+		result1, result2 := service.Gdyb3510(struct3508, struct3508.SecretKey)
761
+		saveLog(result1, result2, "3510", "3510")
762
+
763
+		var res models.Result3510
764
+		var respJSON2 map[string]interface{}
765
+		if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
766
+			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
767
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
768
+			return
769
+		}
770
+		userJSONBytes2, _ := json.Marshal(respJSON2)
771
+		if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
772
+			utils.ErrorLog("解析失败:%v", err)
773
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
774
+			return
775
+		}
776
+		if res.Infcode == -1 {
777
+			c.ServeSuccessJSON(map[string]interface{}{
778
+				"failed_code": -10,
779
+				"msg":         res.ErrMsg,
780
+			})
781
+		} else {
782
+			c.ServeSuccessJSON(map[string]interface{}{
783
+				"info": res.Output,
784
+			})
785
+		}
786
+
786
 	} else {
787
 	} else {
787
-		c.ServeSuccessJSON(map[string]interface{}{
788
-			"info": res.Output,
789
-		})
788
+
789
+		result1, result2, _ := service.FJyb3510(struct3508)
790
+		saveLog(result1, result2, "3510", "3510")
791
+
792
+		var res models.Result3510
793
+		var respJSON2 map[string]interface{}
794
+		if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
795
+			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
796
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
797
+			return
798
+		}
799
+		userJSONBytes2, _ := json.Marshal(respJSON2)
800
+		if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
801
+			utils.ErrorLog("解析失败:%v", err)
802
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
803
+			return
804
+		}
805
+		if res.Infcode == -1 {
806
+			c.ServeSuccessJSON(map[string]interface{}{
807
+				"failed_code": -10,
808
+				"msg":         res.ErrMsg,
809
+			})
810
+		} else {
811
+			c.ServeSuccessJSON(map[string]interface{}{
812
+				"info": res.Output,
813
+			})
814
+		}
790
 	}
815
 	}
816
+
791
 }
817
 }
792
 func (c *HisApiController) Get3511() {
818
 func (c *HisApiController) Get3511() {
793
 	admin_user_id, _ := c.GetInt64("admin_user_id")
819
 	admin_user_id, _ := c.GetInt64("admin_user_id")
816
 	struct3508.MedListCodg = drug.MedicalInsuranceNumber
842
 	struct3508.MedListCodg = drug.MedicalInsuranceNumber
817
 	struct3508.Begndate = start_time
843
 	struct3508.Begndate = start_time
818
 	struct3508.Enddate = end_time
844
 	struct3508.Enddate = end_time
819
-	result1, result2, _ := service.FJyb3511(struct3508)
820
-	saveLog(result1, result2, "3511", "3511")
821
 
845
 
822
-	var res models.Result3511
823
-	var respJSON2 map[string]interface{}
824
-	if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
825
-		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
826
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
827
-		return
828
-	}
829
-	userJSONBytes2, _ := json.Marshal(respJSON2)
830
-	if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
831
-		utils.ErrorLog("解析失败:%v", err)
832
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
833
-		return
834
-	}
835
-	if res.Infcode == -1 {
836
-		c.ServeSuccessJSON(map[string]interface{}{
837
-			"failed_code": -10,
838
-			"msg":         res.ErrMsg,
839
-		})
846
+	if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") { //广东
847
+		result1, result2 := service.Gdyb3511(struct3508, struct3508.SecretKey)
848
+		saveLog(result1, result2, "3511", "3511")
849
+
850
+		var res models.Result3511
851
+		var respJSON2 map[string]interface{}
852
+		if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
853
+			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
854
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
855
+			return
856
+		}
857
+		userJSONBytes2, _ := json.Marshal(respJSON2)
858
+		if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
859
+			utils.ErrorLog("解析失败:%v", err)
860
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
861
+			return
862
+		}
863
+		if res.Infcode == -1 {
864
+			c.ServeSuccessJSON(map[string]interface{}{
865
+				"failed_code": -10,
866
+				"msg":         res.ErrMsg,
867
+			})
868
+		} else {
869
+			c.ServeSuccessJSON(map[string]interface{}{
870
+				"info": res.Output,
871
+			})
872
+		}
873
+
840
 	} else {
874
 	} else {
841
-		c.ServeSuccessJSON(map[string]interface{}{
842
-			"info": res.Output,
843
-		})
875
+
876
+		result1, result2, _ := service.FJyb3511(struct3508)
877
+		saveLog(result1, result2, "3511", "3511")
878
+
879
+		var res models.Result3511
880
+		var respJSON2 map[string]interface{}
881
+		if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
882
+			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
883
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
884
+			return
885
+		}
886
+		userJSONBytes2, _ := json.Marshal(respJSON2)
887
+		if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
888
+			utils.ErrorLog("解析失败:%v", err)
889
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
890
+			return
891
+		}
892
+		if res.Infcode == -1 {
893
+			c.ServeSuccessJSON(map[string]interface{}{
894
+				"failed_code": -10,
895
+				"msg":         res.ErrMsg,
896
+			})
897
+		} else {
898
+			c.ServeSuccessJSON(map[string]interface{}{
899
+				"info": res.Output,
900
+			})
901
+		}
844
 	}
902
 	}
903
+
845
 }
904
 }
846
 func (c *HisApiController) Get3512() {
905
 func (c *HisApiController) Get3512() {
847
 	admin_user_id, _ := c.GetInt64("admin_user_id")
906
 	admin_user_id, _ := c.GetInt64("admin_user_id")
873
 	struct3508.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
932
 	struct3508.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
874
 	struct3508.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
933
 	struct3508.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
875
 
934
 
876
-
877
 	if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") { //广东
935
 	if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") { //广东
878
-		result1, result2 := service.Gdyb3512(struct3508,struct3508.SecretKey)
936
+		result1, result2 := service.Gdyb3512(struct3508, struct3508.SecretKey)
879
 		saveLog(result1, result2, "3512", "3512")
937
 		saveLog(result1, result2, "3512", "3512")
880
 
938
 
881
 		var res models.Result3512
939
 		var res models.Result3512
902
 			})
960
 			})
903
 		}
961
 		}
904
 
962
 
905
-	}else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "350"){
906
-
963
+	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "350") {
907
 
964
 
908
 		result1, result2, _ := service.FJyb3512(struct3508)
965
 		result1, result2, _ := service.FJyb3512(struct3508)
909
 		saveLog(result1, result2, "3512", "3512")
966
 		saveLog(result1, result2, "3512", "3512")
932
 			})
989
 			})
933
 		}
990
 		}
934
 
991
 
935
-
936
 	}
992
 	}
937
 
993
 
938
-
939
 }
994
 }
940
 func (c *HisApiController) Get3513() {
995
 func (c *HisApiController) Get3513() {
941
 	admin_user_id, _ := c.GetInt64("admin_user_id")
996
 	admin_user_id, _ := c.GetInt64("admin_user_id")
967
 	struct3508.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
1022
 	struct3508.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
968
 	struct3508.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
1023
 	struct3508.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
969
 	if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") { //广东
1024
 	if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") { //广东
970
-		result1, result2 := service.Gdyb3513(struct3508,struct3508.SecretKey)
1025
+		result1, result2 := service.Gdyb3513(struct3508, struct3508.SecretKey)
971
 		saveLog(result1, result2, "3513", "3513")
1026
 		saveLog(result1, result2, "3513", "3513")
972
 
1027
 
973
 		var res models.Result3513
1028
 		var res models.Result3513
994
 			})
1049
 			})
995
 		}
1050
 		}
996
 
1051
 
997
-	}else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "350"){
1052
+	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "350") {
998
 
1053
 
999
 		result1, result2, _ := service.FJyb3513(struct3508)
1054
 		result1, result2, _ := service.FJyb3513(struct3508)
1000
 		saveLog(result1, result2, "3513", "3513")
1055
 		saveLog(result1, result2, "3513", "3513")
1023
 			})
1078
 			})
1024
 		}
1079
 		}
1025
 
1080
 
1026
-
1027
 	}
1081
 	}
1028
 
1082
 
1029
-
1030
-
1031
-
1032
-
1033
-
1034
-
1035
-
1036
-
1037
 }
1083
 }
1038
 func (c *HisApiController) Get35081() {
1084
 func (c *HisApiController) Get35081() {
1039
 	admin_user_id, _ := c.GetInt64("admin_user_id")
1085
 	admin_user_id, _ := c.GetInt64("admin_user_id")
1159
 	var errs []string
1205
 	var errs []string
1160
 	for _, drug := range drugs {
1206
 	for _, drug := range drugs {
1161
 		if drug.IsPc == 0 {
1207
 		if drug.IsPc == 0 {
1162
-			if len(drug.DrugCode) > 0{
1208
+			if len(drug.DrugCode) > 0 {
1163
 				codes := strings.Split(drug.DrugCode, ",")
1209
 				codes := strings.Split(drug.DrugCode, ",")
1164
-				for _, code := range codes{
1210
+				for _, code := range codes {
1165
 					if len(code) > 0 {
1211
 					if len(code) > 0 {
1166
 						if len(code) != 20 {
1212
 						if len(code) != 20 {
1167
 							errs = append(errs, drug.BaseDrugLib.DrugName+" 溯源码"+code+"位数不是20位")
1213
 							errs = append(errs, drug.BaseDrugLib.DrugName+" 溯源码"+code+"位数不是20位")
1171
 						}
1217
 						}
1172
 					}
1218
 					}
1173
 				}
1219
 				}
1174
-				}
1175
 			}
1220
 			}
1176
 		}
1221
 		}
1177
-
1222
+	}
1178
 
1223
 
1179
 	if len(errs) > 0 {
1224
 	if len(errs) > 0 {
1180
 		c.ServeSuccessJSON(map[string]interface{}{
1225
 		c.ServeSuccessJSON(map[string]interface{}{
1184
 		return
1229
 		return
1185
 	}
1230
 	}
1186
 
1231
 
1187
-
1188
 	//库盘
1232
 	//库盘
1189
 
1233
 
1190
 	for _, drug := range drugs {
1234
 	for _, drug := range drugs {
1381
 				drug.IsPc = 1
1425
 				drug.IsPc = 1
1382
 				drug.Bchno = number
1426
 				drug.Bchno = number
1383
 				drug.PcDate = time.Now().Unix()
1427
 				drug.PcDate = time.Now().Unix()
1384
-			   service.SaveW(drug)
1428
+				service.SaveW(drug)
1385
 				//if err == nil {
1429
 				//if err == nil {
1386
 				//	bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(drug.ID, 10) + "-" + "3502"
1430
 				//	bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(drug.ID, 10) + "-" + "3502"
1387
 				//	var struct3502 models.Struct3502
1431
 				//	var struct3502 models.Struct3502
1574
 				//		service.SaveW(drug)
1618
 				//		service.SaveW(drug)
1575
 				//	}
1619
 				//	}
1576
 				//}
1620
 				//}
1577
-			//} else {
1621
+				//} else {
1578
 
1622
 
1579
-			}else{
1623
+			} else {
1580
 				errs = append(errs, "盘存"+drug.BaseDrugLib.DrugName+",出错:"+res2.ErrMsg)
1624
 				errs = append(errs, "盘存"+drug.BaseDrugLib.DrugName+",出错:"+res2.ErrMsg)
1581
 			}
1625
 			}
1582
 		}
1626
 		}
1643
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1687
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1644
 					return
1688
 					return
1645
 				}
1689
 				}
1646
-			}else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") {
1690
+			} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") {
1647
 				result1, result2 := service.Gdyb3507(struct3507, struct3507.SecretKey)
1691
 				result1, result2 := service.Gdyb3507(struct3507, struct3507.SecretKey)
1648
 				saveLog(result2, result1, "3507", "3507")
1692
 				saveLog(result2, result1, "3507", "3507")
1649
 				var respJSON2 map[string]interface{}
1693
 				var respJSON2 map[string]interface{}
1710
 
1754
 
1711
 		}
1755
 		}
1712
 
1756
 
1713
-
1714
 	}
1757
 	}
1715
 	if len(err) == 0 {
1758
 	if len(err) == 0 {
1716
 		c.ServeSuccessJSON(map[string]interface{}{
1759
 		c.ServeSuccessJSON(map[string]interface{}{
3541
 		//roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
3584
 		//roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
3542
 		//miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
3585
 		//miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
3543
 		for _, item := range flows {
3586
 		for _, item := range flows {
3544
-				prescription := service.GetHisPrescriptionByID(item.HisDoctorAdviceInfo.PrescriptionId)
3545
-				if prescription.OrderStatus != 2 {
3546
-					// 将时间戳转换为time.Time类型
3547
-					t := time.Unix(item.HisDoctorAdviceInfo.RecordDate, 0) // 注意第二个参数是纳秒,这里是0
3548
-					patient, _ := service.GetPatientByID(c.GetAdminUserInfo().CurrentOrgId, item.HisDoctorAdviceInfo.PatientId)
3587
+			prescription := service.GetHisPrescriptionByID(item.HisDoctorAdviceInfo.PrescriptionId)
3588
+			if prescription.OrderStatus != 2 {
3589
+				// 将时间戳转换为time.Time类型
3590
+				t := time.Unix(item.HisDoctorAdviceInfo.RecordDate, 0) // 注意第二个参数是纳秒,这里是0
3591
+				patient, _ := service.GetPatientByID(c.GetAdminUserInfo().CurrentOrgId, item.HisDoctorAdviceInfo.PatientId)
3549
 
3592
 
3550
-					errs = append(errs, patient.Name + "的" + t.Format("2006-01-02") +" 的"+item.HisDoctorAdviceInfo.BaseDrugLib.DrugName+"医嘱没结算无法上传")
3593
+				errs = append(errs, patient.Name+"的"+t.Format("2006-01-02")+" 的"+item.HisDoctorAdviceInfo.BaseDrugLib.DrugName+"医嘱没结算无法上传")
3551
 
3594
 
3552
-				}
3553
-				if len(item.HisDoctorAdviceInfo.DrugCode) > 0{
3554
-					t := time.Unix(item.HisDoctorAdviceInfo.RecordDate, 0) // 注意第二个参数是纳秒,这里是0
3555
-					patient, _ := service.GetPatientByID(c.GetAdminUserInfo().CurrentOrgId, item.HisDoctorAdviceInfo.PatientId)
3595
+			}
3596
+			if len(item.HisDoctorAdviceInfo.DrugCode) > 0 {
3597
+				t := time.Unix(item.HisDoctorAdviceInfo.RecordDate, 0) // 注意第二个参数是纳秒,这里是0
3598
+				patient, _ := service.GetPatientByID(c.GetAdminUserInfo().CurrentOrgId, item.HisDoctorAdviceInfo.PatientId)
3556
 
3599
 
3557
-					codes := strings.Split(item.HisDoctorAdviceInfo.DrugCode, ",")
3558
-					for _, code := range codes{
3559
-						if len(code) > 0 {
3560
-							if len(code) != 20 {
3600
+				codes := strings.Split(item.HisDoctorAdviceInfo.DrugCode, ",")
3601
+				for _, code := range codes {
3602
+					if len(code) > 0 {
3603
+						if len(code) != 20 {
3561
 
3604
 
3562
-								errs = append(errs,patient.Name + "的" + t.Format("2006-01-02") +" 的" + item.HisDoctorAdviceInfo.BaseDrugLib.DrugName+" 溯源码"+code+"位数不是20位")
3563
-							}
3564
-							if IsDigit(code) == false {
3565
-								errs = append(errs,patient.Name + "的" + t.Format("2006-01-02") +" 的" + item.HisDoctorAdviceInfo.BaseDrugLib.DrugName+" 溯源码"+code+"不是纯数字")
3566
-							}
3605
+							errs = append(errs, patient.Name+"的"+t.Format("2006-01-02")+" 的"+item.HisDoctorAdviceInfo.BaseDrugLib.DrugName+" 溯源码"+code+"位数不是20位")
3606
+						}
3607
+						if IsDigit(code) == false {
3608
+							errs = append(errs, patient.Name+"的"+t.Format("2006-01-02")+" 的"+item.HisDoctorAdviceInfo.BaseDrugLib.DrugName+" 溯源码"+code+"不是纯数字")
3567
 						}
3609
 						}
3568
 					}
3610
 					}
3569
 				}
3611
 				}
3570
-
3612
+			}
3571
 
3613
 
3572
 		}
3614
 		}
3573
 	}
3615
 	}
3574
 
3616
 
3575
-		utils.ErrorLog("接口返回数据解析JSON失败: %v", errs)
3617
+	utils.ErrorLog("接口返回数据解析JSON失败: %v", errs)
3576
 	if len(errs) > 0 {
3618
 	if len(errs) > 0 {
3577
 		c.ServeSuccessJSON(map[string]interface{}{
3619
 		c.ServeSuccessJSON(map[string]interface{}{
3578
 			"failed_code": -10,
3620
 			"failed_code": -10,
3581
 		return
3623
 		return
3582
 	}
3624
 	}
3583
 
3625
 
3584
-
3585
 	for _, value := range ids {
3626
 	for _, value := range ids {
3586
 		intValue, _ := strconv.ParseInt(value, 10, 64)
3627
 		intValue, _ := strconv.ParseInt(value, 10, 64)
3587
 		//file := strconv.FormatInt(int64(num), 10)
3628
 		//file := strconv.FormatInt(int64(num), 10)
25390
 	Infcode     string `json:"infcode"`
25431
 	Infcode     string `json:"infcode"`
25391
 	Output      struct {
25432
 	Output      struct {
25392
 		Setlinfo struct {
25433
 		Setlinfo struct {
25393
-			AcctMulaidPay   float64  `json:"acct_mulaid_pay"`
25434
+			AcctMulaidPay   float64 `json:"acct_mulaid_pay"`
25394
 			AcctPay         float64 `json:"acct_pay"`
25435
 			AcctPay         float64 `json:"acct_pay"`
25395
 			ActPayDedc      float64 `json:"act_pay_dedc"`
25436
 			ActPayDedc      float64 `json:"act_pay_dedc"`
25396
 			Age             float64 `json:"age"`
25437
 			Age             float64 `json:"age"`
25407
 			HifesPay        float64 `json:"hifes_pay"`
25448
 			HifesPay        float64 `json:"hifes_pay"`
25408
 			HifmiPay        float64 `json:"hifmi_pay"`
25449
 			HifmiPay        float64 `json:"hifmi_pay"`
25409
 			HifpPay         float64 `json:"hifp_pay"`
25450
 			HifpPay         float64 `json:"hifp_pay"`
25410
-			HospPartAmt     float64  `json:"hosp_part_amt"`
25451
+			HospPartAmt     float64 `json:"hosp_part_amt"`
25411
 			InscpScpAmt     float64 `json:"inscp_scp_amt"`
25452
 			InscpScpAmt     float64 `json:"inscp_scp_amt"`
25412
 			Insutype        string  `json:"insutype"`
25453
 			Insutype        string  `json:"insutype"`
25413
 			MafPay          float64 `json:"maf_pay"`
25454
 			MafPay          float64 `json:"maf_pay"`
25421
 			Naty            string  `json:"naty"`
25462
 			Naty            string  `json:"naty"`
25422
 			OthPay          float64 `json:"oth_pay"`
25463
 			OthPay          float64 `json:"oth_pay"`
25423
 			OverlmtSelfpay  float64 `json:"overlmt_selfpay"`
25464
 			OverlmtSelfpay  float64 `json:"overlmt_selfpay"`
25424
-			PoolPropSelfpay float64  `json:"pool_prop_selfpay"`
25465
+			PoolPropSelfpay float64 `json:"pool_prop_selfpay"`
25425
 			PreselfpayAmt   float64 `json:"preselfpay_amt"`
25466
 			PreselfpayAmt   float64 `json:"preselfpay_amt"`
25426
 			PsnCashPay      float64 `json:"psn_cash_pay"`
25467
 			PsnCashPay      float64 `json:"psn_cash_pay"`
25427
 			PsnCertType     string  `json:"psn_cert_type"`
25468
 			PsnCertType     string  `json:"psn_cert_type"`
25440
 	WarnMsg     interface{} `json:"warn_msg"`
25481
 	WarnMsg     interface{} `json:"warn_msg"`
25441
 }
25482
 }
25442
 
25483
 
25443
-
25444
-
25445
 type ResultSeven10633Three struct {
25484
 type ResultSeven10633Three struct {
25446
 	Cainfo      string `json:"cainfo"`
25485
 	Cainfo      string `json:"cainfo"`
25447
 	ErrMsg      string `json:"err_msg"`
25486
 	ErrMsg      string `json:"err_msg"`
25499
 	WarnMsg     interface{} `json:"warn_msg"`
25538
 	WarnMsg     interface{} `json:"warn_msg"`
25500
 }
25539
 }
25501
 
25540
 
25502
-
25503
 type GZResultSeven10265Two struct {
25541
 type GZResultSeven10265Two struct {
25504
 	Cainfo      string `json:"cainfo"`
25542
 	Cainfo      string `json:"cainfo"`
25505
 	ErrMsg      string `json:"err_msg"`
25543
 	ErrMsg      string `json:"err_msg"`
32884
 		data["config"] = config
32922
 		data["config"] = config
32885
 		bytesData, _ := json.Marshal(data)
32923
 		bytesData, _ := json.Marshal(data)
32886
 
32924
 
32887
-
32888
 		var req *http.Request
32925
 		var req *http.Request
32889
 		if miConfig.MdtrtareaAdmvs == "320830" {
32926
 		if miConfig.MdtrtareaAdmvs == "320830" {
32890
 			req, _ = http.NewRequest("POST", miConfig.AppSecret+"jsyb/2203", bytes.NewReader(bytesData))
32927
 			req, _ = http.NewRequest("POST", miConfig.AppSecret+"jsyb/2203", bytes.NewReader(bytesData))
34463
 
34500
 
34464
 					var resSeven10633Three ResultSeven10633Three
34501
 					var resSeven10633Three ResultSeven10633Three
34465
 
34502
 
34466
-
34467
 					var gzresSeven10265Two GZResultSeven10265Two
34503
 					var gzresSeven10265Two GZResultSeven10265Two
34468
 
34504
 
34469
 					if miConfig.MdtrtareaAdmvs == "421300" {
34505
 					if miConfig.MdtrtareaAdmvs == "421300" {
34752
 
34788
 
34753
 								} else {
34789
 								} else {
34754
 
34790
 
34755
-									if miConfig.MdtrtareaAdmvs == "320830"{
34791
+									if miConfig.MdtrtareaAdmvs == "320830" {
34756
 
34792
 
34757
-										if strings.HasPrefix(his.InsuplcAdmdvs[0:3], "320") && !strings.HasPrefix(his.InsuplcAdmdvs[0:4], "3208"){
34793
+										if strings.HasPrefix(his.InsuplcAdmdvs[0:3], "320") && !strings.HasPrefix(his.InsuplcAdmdvs[0:4], "3208") {
34758
 
34794
 
34759
 											if err := json.Unmarshal([]byte(result), &resSeven10633Three); err != nil {
34795
 											if err := json.Unmarshal([]byte(result), &resSeven10633Three); err != nil {
34760
 												utils.ErrorLog("解析失败:%v", err)
34796
 												utils.ErrorLog("解析失败:%v", err)
34823
 											infocode, _ := strconv.ParseInt(resSeven10633Three.Infcode, 10, 64)
34859
 											infocode, _ := strconv.ParseInt(resSeven10633Three.Infcode, 10, 64)
34824
 											res.Infcode = infocode
34860
 											res.Infcode = infocode
34825
 
34861
 
34826
-
34827
-										}else {
34862
+										} else {
34828
 
34863
 
34829
 											if err := json.Unmarshal([]byte(result), &resSeven10265Two); err != nil {
34864
 											if err := json.Unmarshal([]byte(result), &resSeven10265Two); err != nil {
34830
 												utils.ErrorLog("解析失败:%v", err)
34865
 												utils.ErrorLog("解析失败:%v", err)
34856
 											res.Output.Setlinfo.HifmiPay = resSeven10265Two.Output.Setlinfo.HifmiPay
34891
 											res.Output.Setlinfo.HifmiPay = resSeven10265Two.Output.Setlinfo.HifmiPay
34857
 											res.Output.Setlinfo.HifpPay = resSeven10265Two.Output.Setlinfo.HifpPay
34892
 											res.Output.Setlinfo.HifpPay = resSeven10265Two.Output.Setlinfo.HifpPay
34858
 
34893
 
34859
-
34860
 											res.Output.Setlinfo.InscpScpAmt = resSeven10265Two.Output.Setlinfo.InscpScpAmt
34894
 											res.Output.Setlinfo.InscpScpAmt = resSeven10265Two.Output.Setlinfo.InscpScpAmt
34861
 											res.Output.Setlinfo.Insutype = resSeven10265Two.Output.Setlinfo.Insutype
34895
 											res.Output.Setlinfo.Insutype = resSeven10265Two.Output.Setlinfo.Insutype
34862
 											res.Output.Setlinfo.MafPay = resSeven10265Two.Output.Setlinfo.MafPay
34896
 											res.Output.Setlinfo.MafPay = resSeven10265Two.Output.Setlinfo.MafPay
34892
 										}
34926
 										}
34893
 									} else {
34927
 									} else {
34894
 
34928
 
34895
-
34896
-										if strings.HasPrefix(his.InsuplcAdmdvs[0:3], "320") && !strings.HasPrefix(his.InsuplcAdmdvs[0:4], "3209"){
34929
+										if strings.HasPrefix(his.InsuplcAdmdvs[0:3], "320") && !strings.HasPrefix(his.InsuplcAdmdvs[0:4], "3209") {
34897
 
34930
 
34898
 											if err := json.Unmarshal([]byte(result), &resSeven10633Three); err != nil {
34931
 											if err := json.Unmarshal([]byte(result), &resSeven10633Three); err != nil {
34899
 												utils.ErrorLog("解析失败:%v", err)
34932
 												utils.ErrorLog("解析失败:%v", err)
34962
 											infocode, _ := strconv.ParseInt(resSeven10633Three.Infcode, 10, 64)
34995
 											infocode, _ := strconv.ParseInt(resSeven10633Three.Infcode, 10, 64)
34963
 											res.Infcode = infocode
34996
 											res.Infcode = infocode
34964
 
34997
 
34965
-
34966
-										}else {
34998
+										} else {
34967
 
34999
 
34968
 											if err := json.Unmarshal([]byte(result), &resSeven10265Two); err != nil {
35000
 											if err := json.Unmarshal([]byte(result), &resSeven10265Two); err != nil {
34969
 												utils.ErrorLog("解析失败:%v", err)
35001
 												utils.ErrorLog("解析失败:%v", err)
34995
 											res.Output.Setlinfo.HifmiPay = resSeven10265Two.Output.Setlinfo.HifmiPay
35027
 											res.Output.Setlinfo.HifmiPay = resSeven10265Two.Output.Setlinfo.HifmiPay
34996
 											res.Output.Setlinfo.HifpPay = resSeven10265Two.Output.Setlinfo.HifpPay
35028
 											res.Output.Setlinfo.HifpPay = resSeven10265Two.Output.Setlinfo.HifpPay
34997
 
35029
 
34998
-
34999
 											res.Output.Setlinfo.InscpScpAmt = resSeven10265Two.Output.Setlinfo.InscpScpAmt
35030
 											res.Output.Setlinfo.InscpScpAmt = resSeven10265Two.Output.Setlinfo.InscpScpAmt
35000
 											res.Output.Setlinfo.Insutype = resSeven10265Two.Output.Setlinfo.Insutype
35031
 											res.Output.Setlinfo.Insutype = resSeven10265Two.Output.Setlinfo.Insutype
35001
 											res.Output.Setlinfo.MafPay = resSeven10265Two.Output.Setlinfo.MafPay
35032
 											res.Output.Setlinfo.MafPay = resSeven10265Two.Output.Setlinfo.MafPay
35028
 											infocode, _ := strconv.ParseInt(resSeven10265Two.Infcode, 10, 64)
35059
 											infocode, _ := strconv.ParseInt(resSeven10265Two.Infcode, 10, 64)
35029
 											res.Infcode = infocode
35060
 											res.Infcode = infocode
35030
 
35061
 
35031
-
35032
-
35033
 										}
35062
 										}
35034
 
35063
 
35035
-
35036
-
35037
 									}
35064
 									}
35038
 
35065
 
35039
-
35040
-
35041
 								}
35066
 								}
35042
 
35067
 
35043
 							}
35068
 							}
38329
 			var api3 string
38354
 			var api3 string
38330
 			if miConfig.MdtrtareaAdmvs == "320830" {
38355
 			if miConfig.MdtrtareaAdmvs == "320830" {
38331
 				api3 = miConfig.AppSecret + "jsyb/2205?psn_no=" + order.PsnNo +
38356
 				api3 = miConfig.AppSecret + "jsyb/2205?psn_no=" + order.PsnNo +
38332
-					"&mdtrt_id=" + order.MdtrtId + "&chrg_bchno=" +"0000" + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
38357
+					"&mdtrt_id=" + order.MdtrtId + "&chrg_bchno=" + "0000" + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
38333
 					"&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
38358
 					"&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
38334
 
38359
 
38335
 				//req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
38360
 				//req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/2204", bytes.NewReader(bytesData))

+ 28 - 42
models/models_3501.go 查看文件

32
 	AppSecret           string
32
 	AppSecret           string
33
 	SignKey             string
33
 	SignKey             string
34
 	Enckey              string
34
 	Enckey              string
35
-	DrugTracCodg		string
36
-	Code		string
37
-
35
+	DrugTracCodg        string
36
+	Code                string
38
 }
37
 }
39
 type Struct3502 struct {
38
 type Struct3502 struct {
40
 	MedListCodg         string
39
 	MedListCodg         string
66
 	AppSecret           string
65
 	AppSecret           string
67
 	SignKey             string
66
 	SignKey             string
68
 	Enckey              string
67
 	Enckey              string
69
-	DrugTracCodg		string
70
-	Code		string
71
-
72
-
68
+	DrugTracCodg        string
69
+	Code                string
73
 }
70
 }
74
 type Struct3503 struct {
71
 type Struct3503 struct {
75
 	MedListCodg         string
72
 	MedListCodg         string
107
 	AppSecret           string
104
 	AppSecret           string
108
 	SignKey             string
105
 	SignKey             string
109
 	Enckey              string
106
 	Enckey              string
110
-	DrugTracCodg		string
111
-	Code		string
112
-
113
-
107
+	DrugTracCodg        string
108
+	Code                string
114
 }
109
 }
115
 type Struct3504 struct {
110
 type Struct3504 struct {
116
 	MedListCodg         string
111
 	MedListCodg         string
144
 	AppSecret           string
139
 	AppSecret           string
145
 	SignKey             string
140
 	SignKey             string
146
 	Enckey              string
141
 	Enckey              string
147
-	DrugTracCodg		string
148
-	Code		string
149
-
150
-
142
+	DrugTracCodg        string
143
+	Code                string
151
 }
144
 }
152
 type Struct3505 struct {
145
 type Struct3505 struct {
153
 	MedListCodg         string
146
 	MedListCodg         string
201
 	AppSecret           string
194
 	AppSecret           string
202
 	SignKey             string
195
 	SignKey             string
203
 	Enckey              string
196
 	Enckey              string
204
-	Code		string
205
-
206
-
197
+	Code                string
207
 }
198
 }
208
 type Struct3506 struct {
199
 type Struct3506 struct {
209
 	MedListCodg         string
200
 	MedListCodg         string
242
 	AppSecret           string
233
 	AppSecret           string
243
 	SignKey             string
234
 	SignKey             string
244
 	Enckey              string
235
 	Enckey              string
245
-	DrugTracCodg		string
246
-	Code		string
247
-
248
-
236
+	DrugTracCodg        string
237
+	Code                string
249
 }
238
 }
250
 type Struct3507 struct {
239
 type Struct3507 struct {
251
 	FixmedinsBchno string
240
 	FixmedinsBchno string
264
 	AppSecret      string
253
 	AppSecret      string
265
 	SignKey        string
254
 	SignKey        string
266
 	Enckey         string
255
 	Enckey         string
267
-	DrugTracCodg		string
268
-	Code		string
269
-
270
-
256
+	DrugTracCodg   string
257
+	Code           string
271
 }
258
 }
272
 
259
 
273
 type XtDrugInventory struct {
260
 type XtDrugInventory struct {
744
 }
731
 }
745
 
732
 
746
 type Struct3512 struct {
733
 type Struct3512 struct {
747
-	FixmedinsCode  string `json:"fixmedins_code" validate:"required"` // 定点医药机构编号
748
-	MedinsListCodg string `json:"medins_list_codg,omitempty"`         // 医药机构目录编码
749
-	FixmedinsBchno string `json:"fixmedins_bchno,omitempty"`          // 定点医药机构批次流水号
750
-	Begndate       string `json:"begndate" validate:"required"`       // 开始日期
751
-	Enddate        string `json:"enddate" validate:"required"`        // 结束日期
752
-	MedListCodg    string `json:"med_list_codg,omitempty"`            // 医疗目录编码
753
-	DrugTracCodg   string `json:"drug_trac_codg,omitempty"`           // 药品追溯码
734
+	FixmedinsCode  string // 定点医药机构编号
735
+	MedinsListCodg string // 医药机构目录编码
736
+	FixmedinsBchno string // 定点医药机构批次流水号
737
+	Begndate       string // 开始日期
738
+	Enddate        string // 结束日期
739
+	MedListCodg    string // 医疗目录编码
740
+	DrugTracCodg   string // 药品追溯码
754
 	InsuplcAdmdvs  string
741
 	InsuplcAdmdvs  string
755
 	MdtrtareaAdmvs string
742
 	MdtrtareaAdmvs string
756
 	OrgName        string
743
 	OrgName        string
757
 	Opter          string
744
 	Opter          string
758
 	SecretKey      string
745
 	SecretKey      string
759
 
746
 
760
-	RequestUrl     string
761
-	AccessKey      string
762
-	Cainfo         string
763
-	Url            string
764
-	AppId          string
765
-	AppSecret      string
766
-	SignKey        string
767
-	Enckey         string
747
+	RequestUrl string
748
+	AccessKey  string
749
+	Cainfo     string
750
+	Url        string
751
+	AppId      string
752
+	AppSecret  string
753
+	SignKey    string
754
+	Enckey     string
768
 }
755
 }
769
 
756
 
770
 type Result3512 struct {
757
 type Result3512 struct {
784
 		CrterName      string
771
 		CrterName      string
785
 		CrterId        string
772
 		CrterId        string
786
 		OptinsNo       string
773
 		OptinsNo       string
787
-
788
 	} `json:"output"`
774
 	} `json:"output"`
789
 	RefmsgTime  string      `json:"refmsg_time"`
775
 	RefmsgTime  string      `json:"refmsg_time"`
790
 	RespondTime string      `json:"respond_time"`
776
 	RespondTime string      `json:"respond_time"`