test_user 2 周前
父节点
当前提交
e69475b9d7

+ 95 - 34
controllers/ah/ahyb_controller.go 查看文件

@@ -44,6 +44,23 @@ type Response struct {
44 44
 	State     struct{} `json:"state"`
45 45
 }
46 46
 
47
+
48
+type Body3513 struct {
49
+	ErrMsg      string                 `json:"err_msg"`
50
+	InfRefMsgID string                 `json:"inf_refmsgid"`
51
+	InfCode     int                    `json:"infcode"`
52
+	Output      []map[string]interface{} `json:"output"`
53
+}
54
+
55
+type Response1513 struct {
56
+	Body3513      Body3513     `json:"body"`
57
+	Code      int      `json:"code"`
58
+	CSBCode   int      `json:"csbCode"`
59
+	Message   string   `json:"message"`
60
+	RequestID string   `json:"requestId"`
61
+	State     struct{} `json:"state"`
62
+}
63
+
47 64
 func AHybRegistRouters() {
48 65
 	beego.Router("/ahyb/1101", &AHybController{}, "get:PostOne")
49 66
 	beego.Router("/ahyb/2201", &AHybController{}, "get:PostTwo")
@@ -473,22 +490,34 @@ func (c *AHybController) Get3511() {
473 490
 		utils.ErrorLog("解析失败:%v", err)
474 491
 		return
475 492
 	}
476
-
477
-	result, request_log := service.Jsyb3511(struct3511)
478
-	saveJsLog(result, request_log, "3511", "库存查询", struct3511.OrgName)
479
-	var dat2 map[string]interface{}
480
-	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
481
-	} else {
493
+	result, inputLog := service.AHyb3511(struct3511, struct3511.RequestUrl)
494
+	saveJsLog(result, inputLog, "3511", "3511-查询", struct3511.OrgName)
495
+	var response Response1513
496
+	if err := json.Unmarshal([]byte(result), &response); err != nil {
497
+		fmt.Println("Error decoding JSON:", err)
498
+		return
482 499
 	}
483
-	var dat map[string]interface{}
484
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
500
+
501
+	if response.Code == 200 {
502
+		var dat2 map[string]interface{}
503
+		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
504
+		} else {
505
+
506
+		}
507
+		c.ServeSuccessJSON(map[string]interface{}{
508
+			"pre":    response.Body3513,
509
+			"log":    dat2,
510
+			"status": "1",
511
+			"msg":    "",
512
+		})
513
+
485 514
 	} else {
515
+		c.ServeSuccessJSON(map[string]interface{}{
516
+			"status": "0",
517
+			"msg":    response.Message,
518
+		})
486 519
 
487 520
 	}
488
-	c.ServeSuccessJSON(map[string]interface{}{
489
-		"pre":         dat,
490
-		"request_log": dat2,
491
-	})
492 521
 
493 522
 }
494 523
 func (c *AHybController) Get3512() {
@@ -506,30 +535,47 @@ func (c *AHybController) Get3512() {
506 535
 		return
507 536
 	}
508 537
 
509
-	result, request_log := service.Jsyb3512(struct3512)
510
-	saveJsLog(result, request_log, "3512", "3512查询", struct3512.OrgName)
511
-	var dat2 map[string]interface{}
512
-	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
513
-	} else {
538
+	result, inputLog := service.AHyb3512(struct3512, struct3512.RequestUrl)
539
+	saveJsLog(result, inputLog, "3512", "3512-查询", struct3512.OrgName)
540
+	var response Response1513
541
+	if err := json.Unmarshal([]byte(result), &response); err != nil {
542
+		fmt.Println("Error decoding JSON:", err)
543
+		return
514 544
 	}
515
-	var dat map[string]interface{}
516
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
545
+
546
+	if response.Code == 200 {
547
+		var dat2 map[string]interface{}
548
+		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
549
+		} else {
550
+
551
+		}
552
+		c.ServeSuccessJSON(map[string]interface{}{
553
+			"pre":    response.Body3513,
554
+			"log":    dat2,
555
+			"status": "1",
556
+			"msg":    "",
557
+		})
558
+
517 559
 	} else {
560
+		c.ServeSuccessJSON(map[string]interface{}{
561
+			"status": "0",
562
+			"msg":    response.Message,
563
+		})
518 564
 
519 565
 	}
520
-	c.ServeSuccessJSON(map[string]interface{}{
521
-		"pre":         dat,
522
-		"request_log": dat2,
523
-	})
524 566
 
525 567
 }
526 568
 func (c *AHybController) Get3513() {
527 569
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
570
+	utils.ErrorLog("解析失败:%v", body)
571
+	utils.ErrorLog("解析失败:%v", string(body))
572
+
528 573
 	var respJSON map[string]interface{}
529 574
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
530 575
 		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
531 576
 		return
532 577
 	}
578
+	utils.ErrorLog("解析失败:%v", "3333333")
533 579
 
534 580
 	userJSONBytes, _ := json.Marshal(respJSON["struct_3513s"])
535 581
 	var struct3513 models.Struct3513
@@ -537,22 +583,37 @@ func (c *AHybController) Get3513() {
537 583
 		utils.ErrorLog("解析失败:%v", err)
538 584
 		return
539 585
 	}
586
+	utils.ErrorLog("解析失败:%v", "1111122222")
540 587
 
541
-	result, request_log := service.Jsyb3513(struct3513)
542
-	saveJsLog(result, request_log, "3513", "库存盘点", struct3513.OrgName)
543
-	var dat2 map[string]interface{}
544
-	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
545
-	} else {
588
+	result, inputLog := service.AHyb3513(struct3513, struct3513.RequestUrl)
589
+	saveJsLog(result, inputLog, "3513", "3513-查询", struct3513.OrgName)
590
+	var response Response1513
591
+	if err := json.Unmarshal([]byte(result), &response); err != nil {
592
+		fmt.Println("Error decoding JSON:", err)
593
+		return
546 594
 	}
547
-	var dat map[string]interface{}
548
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
595
+
596
+	if response.Code == 200 {
597
+		var dat2 map[string]interface{}
598
+		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
599
+		} else {
600
+
601
+		}
602
+		c.ServeSuccessJSON(map[string]interface{}{
603
+			"pre":    response.Body3513.Output,
604
+			"log":    dat2,
605
+			"status": "1",
606
+			"msg":    "",
607
+		})
608
+
549 609
 	} else {
610
+		c.ServeSuccessJSON(map[string]interface{}{
611
+			"status": "0",
612
+			"msg":    response.Message,
613
+		})
550 614
 
551 615
 	}
552
-	c.ServeSuccessJSON(map[string]interface{}{
553
-		"pre":         dat,
554
-		"request_log": dat2,
555
-	})
616
+
556 617
 
557 618
 }
558 619
 func (c *AHybController) Readcardcharge() {

+ 318 - 155
controllers/sg/his_api_controller.go 查看文件

@@ -872,21 +872,31 @@ func (c *HisApiController) Get3511() {
872 872
 			})
873 873
 		}
874 874
 
875
-	} else {
876
-
877
-		result1, result2, _ := service.FJyb3511(struct3508)
878
-		saveLog(result1, result2, "3511", "3511")
879
-
875
+	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "340") {
880 876
 		var res models.Result3511
881
-		var respJSON2 map[string]interface{}
882
-		if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
877
+		//安徽
878
+		data := make(map[string]interface{})
879
+		data["struct_3511s"] = struct3508
880
+		client := &http.Client{}
881
+		bytesData, _ := json.Marshal(data)
882
+		var req *http.Request
883
+		req, _ = http.NewRequest("POST", miConfig.SecretKey+"ahyb/3511", bytes.NewReader(bytesData))
884
+		resp, _ := client.Do(req)
885
+		defer resp.Body.Close()
886
+		body, ioErr := ioutil.ReadAll(resp.Body)
887
+		if ioErr != nil {
888
+			utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
889
+		}
890
+		var respJSON map[string]interface{}
891
+		if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
883 892
 			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
884 893
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
885 894
 			return
886 895
 		}
887
-		userJSONBytes2, _ := json.Marshal(respJSON2)
888
-		if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
889
-			utils.ErrorLog("解析失败:%v", err)
896
+		respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
897
+		result, _ := json.Marshal(respJSON)
898
+		if err := json.Unmarshal([]byte(result), &res); err != nil {
899
+			//utils.ErrorLog("解析失败:%v", err)
890 900
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
891 901
 			return
892 902
 		}
@@ -900,44 +910,13 @@ func (c *HisApiController) Get3511() {
900 910
 				"info": res.Output,
901 911
 			})
902 912
 		}
903
-	}
904
-
905
-}
906
-func (c *HisApiController) Get3512() {
907
-	admin_user_id, _ := c.GetInt64("admin_user_id")
908
-	drug_id, _ := c.GetInt64("id")
909
-	start_time := c.GetString("start_time")
910
-	end_time := c.GetString("end_time")
911
-
912
-	adminUser := c.GetAdminUserInfo()
913
-	curRoles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
914
-	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
915
-	drug, _ := service.GetDrugByID(drug_id)
916 913
 
917
-	var struct3508 models.Struct3512
918
-	struct3508.FixmedinsCode = miConfig.Code
914
+	}else {
919 915
 
920
-	struct3508.OrgName = miConfig.OrgName
921
-	struct3508.AccessKey = miConfig.AccessKey
922
-	struct3508.Opter = curRoles.UserName
923
-	struct3508.RequestUrl = miConfig.Url
924
-	struct3508.Url = miConfig.Url
925
-	struct3508.AppId = miConfig.Cainfo
926
-	struct3508.AppSecret = miConfig.AppSecret
927
-	struct3508.Enckey = miConfig.EncKey
928
-	struct3508.SignKey = miConfig.SignKey
929
-	struct3508.SecretKey = miConfig.SecretKey
930
-	struct3508.MedListCodg = drug.MedicalInsuranceNumber
931
-	struct3508.Begndate = start_time
932
-	struct3508.Enddate = end_time
933
-	struct3508.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
934
-	struct3508.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
935
-
936
-	if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") { //广东
937
-		result1, result2 := service.Gdyb3512(struct3508, struct3508.SecretKey)
938
-		saveLog(result1, result2, "3512", "3512")
916
+		result1, result2, _ := service.FJyb3511(struct3508)
917
+		saveLog(result1, result2, "3511", "3511")
939 918
 
940
-		var res models.Result3512
919
+		var res models.Result3511
941 920
 		var respJSON2 map[string]interface{}
942 921
 		if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
943 922
 			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
@@ -960,37 +939,118 @@ func (c *HisApiController) Get3512() {
960 939
 				"info": res.Output,
961 940
 			})
962 941
 		}
942
+	}
963 943
 
964
-	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "350") {
944
+}
945
+func (c *HisApiController) Get3512() {
946
+	admin_user_id, _ := c.GetInt64("admin_user_id")
947
+	drug_id, _ := c.GetInt64("id")
948
+	start_time := c.GetString("start_time")
949
+	end_time := c.GetString("end_time")
965 950
 
966
-		result1, result2, _ := service.FJyb3512(struct3508)
967
-		saveLog(result1, result2, "3512", "3512")
951
+	adminUser := c.GetAdminUserInfo()
952
+	curRoles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
953
+	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
954
+	drug, _ := service.GetDrugByIDTwo(drug_id,adminUser.CurrentOrgId)
955
+
956
+	var infos models.Output2
957
+	for _, item := range drug{
958
+		var struct3508 models.Struct3512
959
+		struct3508.FixmedinsCode = miConfig.Code
960
+
961
+		struct3508.OrgName = miConfig.OrgName
962
+		struct3508.AccessKey = miConfig.AccessKey
963
+		struct3508.Opter = curRoles.UserName
964
+		struct3508.RequestUrl = miConfig.Url
965
+		struct3508.Url = miConfig.Url
966
+		struct3508.AppId = miConfig.Cainfo
967
+		struct3508.AppSecret = miConfig.AppSecret
968
+		struct3508.Enckey = miConfig.EncKey
969
+		struct3508.SignKey = miConfig.SignKey
970
+		struct3508.SecretKey = miConfig.SecretKey
971
+		struct3508.MedListCodg = item.MedicalInsuranceNumber
972
+		struct3508.Begndate = start_time
973
+		struct3508.Enddate = end_time
974
+		struct3508.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
975
+		struct3508.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
976
+
977
+		if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") { //广东
978
+			result1, result2 := service.Gdyb3512(struct3508, struct3508.SecretKey)
979
+			saveLog(result1, result2, "3512", "3512")
980
+
981
+			var res models.Result3512
982
+			var respJSON2 map[string]interface{}
983
+			if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
984
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
985
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
986
+				return
987
+			}
988
+			userJSONBytes2, _ := json.Marshal(respJSON2)
989
+			if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
990
+				utils.ErrorLog("解析失败:%v", err)
991
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
992
+				return
993
+			}
968 994
 
969
-		var res models.Result3512
970
-		var respJSON2 map[string]interface{}
971
-		if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
972
-			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
973
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
974
-			return
975
-		}
976
-		userJSONBytes2, _ := json.Marshal(respJSON2)
977
-		if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
978
-			utils.ErrorLog("解析失败:%v", err)
979
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
980
-			return
981
-		}
982
-		if res.Infcode == -1 {
983
-			c.ServeSuccessJSON(map[string]interface{}{
984
-				"failed_code": -10,
985
-				"msg":         res.ErrMsg,
986
-			})
987
-		} else {
988
-			c.ServeSuccessJSON(map[string]interface{}{
989
-				"info": res.Output,
990
-			})
991
-		}
995
+			infos = append(infos, res.Output...)
996
+
997
+
998
+		} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "350") {
992 999
 
1000
+			result1, result2, _ := service.FJyb3512(struct3508)
1001
+			saveLog(result1, result2, "3512", "3512")
1002
+
1003
+			var res models.Result3512
1004
+			var respJSON2 map[string]interface{}
1005
+			if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
1006
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1007
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1008
+				return
1009
+			}
1010
+			userJSONBytes2, _ := json.Marshal(respJSON2)
1011
+			if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
1012
+				utils.ErrorLog("解析失败:%v", err)
1013
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1014
+				return
1015
+			}
1016
+			infos = append(infos, res.Output...)
1017
+
1018
+		}else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "340") {
1019
+			var res models.Result3512
1020
+			//安徽
1021
+			data := make(map[string]interface{})
1022
+			data["struct_3512s"] = struct3508
1023
+			client := &http.Client{}
1024
+			bytesData, _ := json.Marshal(data)
1025
+			var req *http.Request
1026
+			req, _ = http.NewRequest("POST", miConfig.SecretKey+"ahyb/3512", bytes.NewReader(bytesData))
1027
+			resp, _ := client.Do(req)
1028
+			defer resp.Body.Close()
1029
+			body, ioErr := ioutil.ReadAll(resp.Body)
1030
+			if ioErr != nil {
1031
+				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
1032
+			}
1033
+			var respJSON map[string]interface{}
1034
+			if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
1035
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1036
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1037
+				return
1038
+			}
1039
+			respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
1040
+			result, _ := json.Marshal(respJSON)
1041
+			if err := json.Unmarshal([]byte(result), &res); err != nil {
1042
+				//utils.ErrorLog("解析失败:%v", err)
1043
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1044
+				return
1045
+			}
1046
+			infos = append(infos, res.Output...)
1047
+		}
993 1048
 	}
1049
+	c.ServeSuccessJSON(map[string]interface{}{
1050
+			"info": infos,
1051
+	})
1052
+
1053
+
994 1054
 
995 1055
 }
996 1056
 func (c *HisApiController) Get3513() {
@@ -1002,85 +1062,171 @@ func (c *HisApiController) Get3513() {
1002 1062
 	adminUser := c.GetAdminUserInfo()
1003 1063
 	curRoles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
1004 1064
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
1005
-	drug, _ := service.GetDrugByID(drug_id)
1065
+	//drug, _ := service.GetDrugByID(drug_id)
1066
+	drug, _ := service.GetDrugByIDTwo(drug_id,adminUser.CurrentOrgId)
1067
+
1068
+	var infos models.Output3
1069
+	for _, item := range drug {
1070
+
1071
+		var struct3508 models.Struct3513
1072
+		struct3508.FixmedinsCode = miConfig.Code
1073
+
1074
+		struct3508.OrgName = miConfig.OrgName
1075
+		struct3508.AccessKey = miConfig.AccessKey
1076
+		struct3508.Opter = curRoles.UserName
1077
+		struct3508.RequestUrl = miConfig.Url
1078
+		struct3508.Url = miConfig.Url
1079
+		struct3508.AppId = miConfig.Cainfo
1080
+		struct3508.AppSecret = miConfig.AppSecret
1081
+		struct3508.Enckey = miConfig.EncKey
1082
+		struct3508.SignKey = miConfig.SignKey
1083
+		struct3508.SecretKey = miConfig.SecretKey
1084
+		struct3508.MedListCodg = item.MedicalInsuranceNumber
1085
+		struct3508.Begndate = start_time
1086
+		struct3508.Enddate = end_time
1087
+		struct3508.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
1088
+		struct3508.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
1089
+		if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") { //广东
1090
+			result1, result2 := service.Gdyb3513(struct3508, struct3508.SecretKey)
1091
+			saveLog(result1, result2, "3513", "3513")
1092
+
1093
+			var res models.Result3513
1094
+			var respJSON2 map[string]interface{}
1095
+			if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
1096
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1097
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1098
+				return
1099
+			}
1100
+			userJSONBytes2, _ := json.Marshal(respJSON2)
1101
+			if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
1102
+				utils.ErrorLog("解析失败:%v", err)
1103
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1104
+				return
1105
+			}
1106
+			infos = append(infos, res.Output...)
1006 1107
 
1007
-	var struct3508 models.Struct3513
1008
-	struct3508.FixmedinsCode = miConfig.Code
1108
+		} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "350") {
1009 1109
 
1010
-	struct3508.OrgName = miConfig.OrgName
1011
-	struct3508.AccessKey = miConfig.AccessKey
1012
-	struct3508.Opter = curRoles.UserName
1013
-	struct3508.RequestUrl = miConfig.Url
1014
-	struct3508.Url = miConfig.Url
1015
-	struct3508.AppId = miConfig.Cainfo
1016
-	struct3508.AppSecret = miConfig.AppSecret
1017
-	struct3508.Enckey = miConfig.EncKey
1018
-	struct3508.SignKey = miConfig.SignKey
1019
-	struct3508.SecretKey = miConfig.SecretKey
1020
-	struct3508.MedListCodg = drug.MedicalInsuranceNumber
1021
-	struct3508.Begndate = start_time
1022
-	struct3508.Enddate = end_time
1023
-	struct3508.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
1024
-	struct3508.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
1025
-	if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") { //广东
1026
-		result1, result2 := service.Gdyb3513(struct3508, struct3508.SecretKey)
1027
-		saveLog(result1, result2, "3513", "3513")
1110
+			result1, result2, _ := service.FJyb3513(struct3508)
1111
+			saveLog(result1, result2, "3513", "3513")
1028 1112
 
1029
-		var res models.Result3513
1030
-		var respJSON2 map[string]interface{}
1031
-		if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
1032
-			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1033
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1034
-			return
1035
-		}
1036
-		userJSONBytes2, _ := json.Marshal(respJSON2)
1037
-		if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
1038
-			utils.ErrorLog("解析失败:%v", err)
1039
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1040
-			return
1041
-		}
1042
-		if res.Infcode == -1 {
1043
-			c.ServeSuccessJSON(map[string]interface{}{
1044
-				"failed_code": -10,
1045
-				"msg":         res.ErrMsg,
1046
-			})
1047
-		} else {
1048
-			c.ServeSuccessJSON(map[string]interface{}{
1049
-				"info": res.Output,
1050
-			})
1051
-		}
1113
+			var res models.Result3513
1114
+			var respJSON2 map[string]interface{}
1115
+			if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
1116
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1117
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1118
+				return
1119
+			}
1120
+			userJSONBytes2, _ := json.Marshal(respJSON2)
1121
+			if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
1122
+				utils.ErrorLog("解析失败:%v", err)
1123
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1124
+				return
1125
+			}
1126
+			infos = append(infos, res.Output...)
1127
+		} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "340") {
1128
+			var res models.Result3513
1129
+			//安徽
1130
+			data := make(map[string]interface{})
1131
+			data["struct_3513s"] = struct3508
1132
+			client := &http.Client{}
1133
+			bytesData, _ := json.Marshal(data)
1134
+			var req *http.Request
1135
+			req, _ = http.NewRequest("POST", miConfig.SecretKey+"ahyb/3513", bytes.NewReader(bytesData))
1136
+			resp, _ := client.Do(req)
1137
+			defer resp.Body.Close()
1138
+			body, ioErr := ioutil.ReadAll(resp.Body)
1139
+			if ioErr != nil {
1140
+				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
1141
+			}
1142
+			var respJSON map[string]interface{}
1143
+			if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
1144
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1145
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1146
+				return
1147
+			}
1148
+			respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
1149
+			result, _ := json.Marshal(respJSON)
1150
+			if err := json.Unmarshal([]byte(result), &res); err != nil {
1151
+				//utils.ErrorLog("解析失败:%v", err)
1152
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1153
+				return
1154
+			}
1155
+			infos = append(infos, res.Output...)
1052 1156
 
1053
-	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "350") {
1157
+		}else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "361") { //
1158
+			result1, result2 := service.JXyb3513(struct3508, struct3508.SecretKey, struct3508.AccessKey, struct3508.RequestUrl)
1159
+			saveLog(result1, result2, "3513", "3513")
1054 1160
 
1055
-		result1, result2, _ := service.FJyb3513(struct3508)
1056
-		saveLog(result1, result2, "3513", "3513")
1161
+			var res models.Result3513
1162
+			var respJSON2 map[string]interface{}
1163
+			if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
1164
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1165
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1166
+				return
1167
+			}
1168
+			userJSONBytes2, _ := json.Marshal(respJSON2)
1169
+			if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
1170
+				utils.ErrorLog("解析失败:%v", err)
1171
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1172
+				return
1173
+			}
1174
+			infos = append(infos, res.Output...)
1057 1175
 
1058
-		var res models.Result3513
1059
-		var respJSON2 map[string]interface{}
1060
-		if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
1061
-			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1062
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1063
-			return
1064
-		}
1065
-		userJSONBytes2, _ := json.Marshal(respJSON2)
1066
-		if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
1067
-			utils.ErrorLog("解析失败:%v", err)
1068
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1069
-			return
1070
-		}
1071
-		if res.Infcode == -1 {
1072
-			c.ServeSuccessJSON(map[string]interface{}{
1073
-				"failed_code": -10,
1074
-				"msg":         res.ErrMsg,
1075
-			})
1076
-		} else {
1077
-			c.ServeSuccessJSON(map[string]interface{}{
1078
-				"info": res.Output,
1079
-			})
1080 1176
 		}
1177
+	}
1178
+	type Newinfo struct {
1179
+		FixmedinsCode  string
1180
+		MedListCodg    string
1181
+		MedinsListCodg string
1182
+		MedinsListName string
1183
+		FixmedinsBchno string
1184
+		MdtrtId        string
1185
+		MdtrtSetlType  string
1186
+		BkkpSn         string
1187
+		DrugTracCodg   string
1188
+		PsnNo          string
1189
+		PsnCertType    string
1190
+		Certno         string
1191
+		PsnName        string
1192
+		Memo           string
1193
+		TrdnFlag       string
1194
+		UpdtTime       string
1195
+		OpterName      string
1196
+		Rid            string
1197
+		CrteTime       string
1198
+		OptTime        string
1199
+		OpterId        string
1200
+		CrterName      string
1201
+		CrterId        string
1202
+		OptinsNo       string
1203
+	}
1204
+	var Newinfos []Newinfo
1205
+
1206
+	for _, item := range infos {
1207
+		var ni Newinfo
1208
+		patient, _ := service.GetPatientByIDCard(item.Certno, c.GetAdminUserInfo().CurrentOrgId)
1209
+
1210
+		//patient, _ := service.GetPatientByIDCard(item.Certno, c.GetAdminUserInfo().CurrentOrgId)
1081 1211
 
1212
+		numbers := strings.Split(item.FixmedinsBchno,"-")
1213
+
1214
+		flow := service.GetSaleDate(numbers[1])
1215
+		ni.MdtrtId = item.MdtrtId
1216
+		ni.UpdtTime = flow.SaleDate
1217
+		ni.PsnName = patient.Name
1218
+		ni.Certno = item.Certno
1219
+		ni.MedinsListName = item.MedinsListName
1220
+		ni.FixmedinsBchno = item.FixmedinsBchno
1221
+		ni.DrugTracCodg = item.DrugTracCodg
1222
+		ni.MedListCodg = patient.Name
1223
+		Newinfos = append(Newinfos, ni)
1082 1224
 	}
1083 1225
 
1226
+	c.ServeSuccessJSON(map[string]interface{}{
1227
+			"info": Newinfos,
1228
+	})
1229
+
1084 1230
 }
1085 1231
 func (c *HisApiController) Get35081() {
1086 1232
 	admin_user_id, _ := c.GetInt64("admin_user_id")
@@ -1230,6 +1376,15 @@ func (c *HisApiController) FJ3501AND3502() {
1230 1376
 		return
1231 1377
 	}
1232 1378
 
1379
+
1380
+
1381
+
1382
+
1383
+
1384
+
1385
+
1386
+
1387
+
1233 1388
 	//库盘
1234 1389
 
1235 1390
 	for _, drug := range drugs {
@@ -5216,7 +5371,7 @@ func (c *HisApiController) ChangeDrugTen() {
5216 5371
 						return
5217 5372
 					}
5218 5373
 					userJSONBytes3, _ := json.Marshal(respJSON3)
5219
-					if c.GetAdminUserInfo().CurrentOrgId == 10265 || c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
5374
+					if c.GetAdminUserInfo().CurrentOrgId == 10265 || c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 || c.GetAdminUserInfo().CurrentOrgId == 10633 {
5220 5375
 						if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
5221 5376
 							utils.ErrorLog("解析失败:%v", err)
5222 5377
 							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -5873,6 +6028,11 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
5873 6028
 		struct3505.PharName = "易圣"
5874 6029
 		struct3505.PharPracCertNo = "D430726002209"
5875 6030
 	}
6031
+
6032
+	if org_id == 10633 {
6033
+		struct3505.PharName = "王敏"
6034
+		struct3505.PharPracCertNo = "342222199107214042"
6035
+	}
5876 6036
 	order := service.GetHisOrderByNumber(pre.BatchNumber)
5877 6037
 	struct3505.SetlId = order.SetlId
5878 6038
 	struct3505.MdtrtSn = order.MdtrtId
@@ -13463,7 +13623,7 @@ func Checkgd3101(c *HisApiController, patient_id int64, his_patient_id int64, ad
13463 13623
 		for _, item := range prescriptions {
13464 13624
 			for _, subItem := range item.HisDoctorAdviceInfo {
13465 13625
 				if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 {
13466
-					spec := (subItem.BaseDrugLib.Dose + subItem.BaseDrugLib.DoseUnit) + "*" + strconv.FormatInt(subItem.BaseDrugLib.MinNumber, 10) + subItem.BaseDrugLib.MinUnit + "/" + subItem.BaseDrugLib.MaxUnit
13626
+					spec := (subItem.BaseDrugLib.Dose + subItem.BaseDrugLib.DoseUnit) + "/" + strconv.FormatInt(subItem.BaseDrugLib.MinNumber, 10) + subItem.BaseDrugLib.MinUnit
13467 13627
 
13468 13628
 					var order models.FsiOrderDtos
13469 13629
 					order.RxID = strconv.FormatInt(item.ID, 10)
@@ -13499,8 +13659,8 @@ func Checkgd3101(c *HisApiController, patient_id int64, his_patient_id int64, ad
13499 13659
 			for _, subItem := range item.HisPrescriptionProject {
13500 13660
 				if subItem.Type == 2 && len(subItem.HisProject.MedicalCode) > 0 {
13501 13661
 					var order models.FsiOrderDtos
13502
-					order.RxID = strconv.FormatInt(item.ID, 10)
13503
-					order.Rxno = strconv.FormatInt(item.ID, 10)
13662
+					order.RxID = strconv.FormatInt(subItem.ID, 10)
13663
+					order.Rxno = strconv.FormatInt(subItem.ID, 10)
13504 13664
 					order.LongDrordFlag = "0"
13505 13665
 					order.HilistType = "201"
13506 13666
 					order.ChrgType = "1"
@@ -21481,8 +21641,12 @@ type CustomFundPay struct {
21481 21641
 func (c *HisApiController) GetbatchSettleList() {
21482 21642
 	//order_id, _ := c.GetInt64("order_id")
21483 21643
 	admin_user_id, _ := c.GetInt64("admin_user_id")
21644
+	start_date := c.GetString("start_date")
21645
+	end_date := c.GetString("end_date")
21484 21646
 
21485
-	orders, _ := service.GetAllHisOrderTwo10485()
21647
+
21648
+
21649
+	orders, _ := service.GetAllHisOrderTwo10485(start_date,end_date)
21486 21650
 
21487 21651
 	for _, item := range orders {
21488 21652
 
@@ -34422,7 +34586,8 @@ func (c *HisApiController) GetPreUploadInfo() {
34422 34586
 				for _, item := range prescriptions {
34423 34587
 					if item.Type == 1 { //药品
34424 34588
 						for _, subItem := range item.HisDoctorAdviceInfo {
34425
-							price, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price), 64)
34589
+							price, _ := strconv.ParseFloat(fmt.Sprintf("%.4f", subItem.Price), 64)
34590
+
34426 34591
 							total_one := price * subItem.PrescribingNumber
34427 34592
 							fmt.Println("subItem")
34428 34593
 							fmt.Println(subItem.Price)
@@ -34439,7 +34604,7 @@ func (c *HisApiController) GetPreUploadInfo() {
34439 34604
 
34440 34605
 						for _, subItem := range item.HisPrescriptionProject {
34441 34606
 							cnt, _ := strconv.ParseFloat(subItem.Count, 64)
34442
-							price, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price), 64)
34607
+							price, _ := strconv.ParseFloat(fmt.Sprintf("%.4f", subItem.Price), 64)
34443 34608
 							total_one := price * cnt
34444 34609
 							total = total + total_one
34445 34610
 						}
@@ -38998,7 +39163,7 @@ func (c *HisApiController) GetCheckAccount() {
38998 39163
 	var res10188 ResultEightFor10188
38999 39164
 	if config.IsOpen == 1 {
39000 39165
 		if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" || miConfig.MdtrtareaAdmvs == "320830" {
39001
-			api := "http://192.168.2.3:9532/" + "jsyb/3201?" +
39166
+			api :=  miConfig.AppSecret + "jsyb/3201?" +
39002 39167
 				"insutype=" + insutype +
39003 39168
 				"&clr_type=" + clr_type +
39004 39169
 				"&setl_optins=" + clr_org +
@@ -39287,7 +39452,7 @@ func (c *HisApiController) GetCheckAccount() {
39287 39452
 				return
39288 39453
 			}
39289 39454
 
39290
-		} else if miConfig.MdtrtareaAdmvs == "360302" {
39455
+		} else if miConfig.MdtrtareaAdmvs == "360100" {
39291 39456
 
39292 39457
 			//orders_two, _ := service.GetOrderByTimeFive(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, "", clr_type, miConfig.MdtrtareaAdmvs)
39293 39458
 			//fixmedins_setl_cnt := int64(len(orders_two))
@@ -39313,14 +39478,12 @@ func (c *HisApiController) GetCheckAccount() {
39313 39478
 			baseParams.Doctor = role.UserName
39314 39479
 			baseParams.RequestUrl = miConfig.Url
39315 39480
 
39316
-			if clr_type == "9903" {
39317
-				clr_type = "9901"
39318
-			}
39481
+
39319 39482
 
39320 39483
 			businessParams := models.BusinessParams{
39321 39484
 				Insutype:         insutype,
39322 39485
 				ClrType:          clr_type,
39323
-				SetlOptins:       "360302",
39486
+				SetlOptins:       "360102",
39324 39487
 				StmtBegndate:     start_time,
39325 39488
 				StmtEnddate:      end_time,
39326 39489
 				MedfeeSumamt:     0,
@@ -39401,7 +39564,7 @@ func (c *HisApiController) GetCheckAccount() {
39401 39564
 				return
39402 39565
 			}
39403 39566
 
39404
-		} else if miConfig.MdtrtareaAdmvs == "360100" {
39567
+		} else if miConfig.MdtrtareaAdmvs == "360106" {
39405 39568
 
39406 39569
 			//orders_two, _ := service.GetOrderByTimeFive(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, "", clr_type, miConfig.MdtrtareaAdmvs)
39407 39570
 			//fixmedins_setl_cnt := int64(len(orders_two))
@@ -39434,7 +39597,7 @@ func (c *HisApiController) GetCheckAccount() {
39434 39597
 			businessParams := models.BusinessParams{
39435 39598
 				Insutype:         insutype,
39436 39599
 				ClrType:          clr_type,
39437
-				SetlOptins:       "360100",
39600
+				SetlOptins:       "360102",
39438 39601
 				StmtBegndate:     start_time,
39439 39602
 				StmtEnddate:      end_time,
39440 39603
 				MedfeeSumamt:     0,

+ 106 - 98
models/models_3501.go 查看文件

@@ -673,57 +673,61 @@ type Struct3511 struct {
673 673
 	Enckey         string
674 674
 }
675 675
 
676
+
677
+type Output     []struct {
678
+	ExpyEnd          string  `json:"expy_end,omitempty"`                    // 有效期止
679
+	PharCertType     string  `json:"phar_cert_type" validate:"required"`    // 药师证件类型
680
+	SelRetnOpterName string  `json:"sel_retn_opter_name,omitempty"`         // 销售/退货经办人姓名
681
+	MedListCodg      string  `json:"med_list_codg,omitempty"`               // 医疗目录编码
682
+	PoolareaNo       string  `json:"poolarea_no,omitempty"`                 // 统筹区编号
683
+	SetlId           string  `json:"setl_id,omitempty"`                     // 结算ID
684
+	CrteOptinsNo     string  `json:"crte_optins_no,omitempty"`              // 创建机构编号
685
+	MedinsListCodg   string  `json:"medins_list_codg,omitempty"`            // 医药机构目录编码
686
+	Memo             string  `json:"memo,omitempty"`                        // 备注
687
+	UpdtTime         string  `json:"updt_time,omitempty"`                   // 数据更新时间
688
+	HiFeesetlType    string  `json:"hi_feesetl_type" validate:"required"`   // 医保费用结算类型
689
+	ManuDate         string  `json:"manu_date,omitempty"`                   // 生产日期
690
+	OpterName        string  `json:"opter_name,omitempty"`                  // 经办人姓名
691
+	PsnNo            string  `json:"psn_no,omitempty"`                      // 人员编号
692
+	Rid              string  `json:"rid,omitempty"`                         // 数据唯一记录号
693
+	CrteTime         string  `json:"crte_time,omitempty"`                   // 数据创建时间
694
+	PharCertno       string  `json:"phar_certno,omitempty"`                 // 药师证件号码
695
+	ValiFlag         string  `json:"vali_flag" validate:"required"`         // 有效标志
696
+	Certno           string  `json:"certno,omitempty"`                      // 证件号码
697
+	FixmedinsCode    string  `json:"fixmedins_code" validate:"required"`    // 定点医药机构编号
698
+	RxFlag           string  `json:"rx_flag" validate:"required"`           // 处方药标志
699
+	PharPracCertNo   string  `json:"phar_prac_cert_no,omitempty"`           // 药师执业资格证号
700
+	ListSpItemFlag   string  `json:"list_sp_item_flag" validate:"required"` // 目录特项标志
701
+	FixmedinsBchno   string  `json:"fixmedins_bchno,omitempty"`             // 定点医药机构批次流水号
702
+	OptTime          string  `json:"opt_time,omitempty"`                    // 经办时间
703
+	PsnName          string  `json:"psn_name,omitempty"`                    // 人员姓名
704
+	ElecSupnCodg     string  `json:"elec_supn_codg,omitempty"`              // 电子监管编码
705
+	BilgDrName       string  `json:"bilg_dr_name,omitempty"`                // 开单医师姓名
706
+	OpterId          string  `json:"opter_id,omitempty"`                    // 经办人ID
707
+	ManuLotnum       string  `json:"manu_lotnum,omitempty"`                 // 生产批号
708
+	MedinsListName   string  `json:"medins_list_name,omitempty"`            // 医药机构目录名称
709
+	PsnCertType      string  `json:"psn_cert_type" validate:"required"`     // 人员证件类型
710
+	SelRetnTime      string  `json:"sel_retn_time,omitempty"`               // 销售/退货时间
711
+	SelRetnCnt       float64 `json:"sel_retn_cnt,omitempty"`                // 销售/退货数量
712
+	CrterName        string  `json:"crter_name,omitempty"`                  // 创建人姓名
713
+	PharName         string  `json:"phar_name,omitempty"`                   // 药师姓名
714
+	PrscDrCertType   string  `json:"prsc_dr_cert_type" validate:"required"` // 开单医师证件类型
715
+	CrterId          string  `json:"crter_id,omitempty"`                    // 创建人ID
716
+	PrscDrCertno     string  `json:"prsc_dr_certno,omitempty"`              // 开单医师证件号码
717
+	OptinsNo         string  `json:"optins_no,omitempty"`                   // 经办机构编号
718
+	TrdnFlag         string  `json:"trdn_flag" validate:"required"`         // 拆零标志
719
+	FinlTrnsPric     float64 `json:"finl_trns_pric,omitempty"`              // 最终成交单价
720
+	MedinsProdSelNo  string  `json:"medins_prod_sel_no,omitempty"`          // 定点医药机构商品销售流水号
721
+
722
+}
723
+
724
+
676 725
 type Result3511 struct {
677 726
 	Cainfo      interface{} `json:"cainfo"`
678 727
 	ErrMsg      string      `json:"err_msg"`
679 728
 	InfRefmsgid string      `json:"inf_refmsgid"`
680 729
 	Infcode     int64       `json:"infcode"`
681
-	Output      []struct {
682
-		ExpyEnd          string  `json:"expy_end,omitempty"`                    // 有效期止
683
-		PharCertType     string  `json:"phar_cert_type" validate:"required"`    // 药师证件类型
684
-		SelRetnOpterName string  `json:"sel_retn_opter_name,omitempty"`         // 销售/退货经办人姓名
685
-		MedListCodg      string  `json:"med_list_codg,omitempty"`               // 医疗目录编码
686
-		PoolareaNo       string  `json:"poolarea_no,omitempty"`                 // 统筹区编号
687
-		SetlId           string  `json:"setl_id,omitempty"`                     // 结算ID
688
-		CrteOptinsNo     string  `json:"crte_optins_no,omitempty"`              // 创建机构编号
689
-		MedinsListCodg   string  `json:"medins_list_codg,omitempty"`            // 医药机构目录编码
690
-		Memo             string  `json:"memo,omitempty"`                        // 备注
691
-		UpdtTime         string  `json:"updt_time,omitempty"`                   // 数据更新时间
692
-		HiFeesetlType    string  `json:"hi_feesetl_type" validate:"required"`   // 医保费用结算类型
693
-		ManuDate         string  `json:"manu_date,omitempty"`                   // 生产日期
694
-		OpterName        string  `json:"opter_name,omitempty"`                  // 经办人姓名
695
-		PsnNo            string  `json:"psn_no,omitempty"`                      // 人员编号
696
-		Rid              string  `json:"rid,omitempty"`                         // 数据唯一记录号
697
-		CrteTime         string  `json:"crte_time,omitempty"`                   // 数据创建时间
698
-		PharCertno       string  `json:"phar_certno,omitempty"`                 // 药师证件号码
699
-		ValiFlag         string  `json:"vali_flag" validate:"required"`         // 有效标志
700
-		Certno           string  `json:"certno,omitempty"`                      // 证件号码
701
-		FixmedinsCode    string  `json:"fixmedins_code" validate:"required"`    // 定点医药机构编号
702
-		RxFlag           string  `json:"rx_flag" validate:"required"`           // 处方药标志
703
-		PharPracCertNo   string  `json:"phar_prac_cert_no,omitempty"`           // 药师执业资格证号
704
-		ListSpItemFlag   string  `json:"list_sp_item_flag" validate:"required"` // 目录特项标志
705
-		FixmedinsBchno   string  `json:"fixmedins_bchno,omitempty"`             // 定点医药机构批次流水号
706
-		OptTime          string  `json:"opt_time,omitempty"`                    // 经办时间
707
-		PsnName          string  `json:"psn_name,omitempty"`                    // 人员姓名
708
-		ElecSupnCodg     string  `json:"elec_supn_codg,omitempty"`              // 电子监管编码
709
-		BilgDrName       string  `json:"bilg_dr_name,omitempty"`                // 开单医师姓名
710
-		OpterId          string  `json:"opter_id,omitempty"`                    // 经办人ID
711
-		ManuLotnum       string  `json:"manu_lotnum,omitempty"`                 // 生产批号
712
-		MedinsListName   string  `json:"medins_list_name,omitempty"`            // 医药机构目录名称
713
-		PsnCertType      string  `json:"psn_cert_type" validate:"required"`     // 人员证件类型
714
-		SelRetnTime      string  `json:"sel_retn_time,omitempty"`               // 销售/退货时间
715
-		SelRetnCnt       float64 `json:"sel_retn_cnt,omitempty"`                // 销售/退货数量
716
-		CrterName        string  `json:"crter_name,omitempty"`                  // 创建人姓名
717
-		PharName         string  `json:"phar_name,omitempty"`                   // 药师姓名
718
-		PrscDrCertType   string  `json:"prsc_dr_cert_type" validate:"required"` // 开单医师证件类型
719
-		CrterId          string  `json:"crter_id,omitempty"`                    // 创建人ID
720
-		PrscDrCertno     string  `json:"prsc_dr_certno,omitempty"`              // 开单医师证件号码
721
-		OptinsNo         string  `json:"optins_no,omitempty"`                   // 经办机构编号
722
-		TrdnFlag         string  `json:"trdn_flag" validate:"required"`         // 拆零标志
723
-		FinlTrnsPric     float64 `json:"finl_trns_pric,omitempty"`              // 最终成交单价
724
-		MedinsProdSelNo  string  `json:"medins_prod_sel_no,omitempty"`          // 定点医药机构商品销售流水号
725
-
726
-	} `json:"output"`
730
+	Output     Output	`json:"output"`
727 731
 	RefmsgTime  string      `json:"refmsg_time"`
728 732
 	RespondTime string      `json:"respond_time"`
729 733
 	Signtype    interface{} `json:"signtype"`
@@ -754,24 +758,27 @@ type Struct3512 struct {
754 758
 	Enckey     string
755 759
 }
756 760
 
761
+type Output2      []struct {
762
+	FixmedinsCode  string
763
+	MedinsListCodg string
764
+	FixmedinsBchno string
765
+	MedListCodg    string
766
+	MedinsListName string
767
+	DrugTracCodg   string
768
+	ValiFlag       string
769
+	OpterId        string
770
+	CrterName      string
771
+	CrterId        string
772
+	OptinsNo       string
773
+}
774
+
775
+
757 776
 type Result3512 struct {
758 777
 	Cainfo      interface{} `json:"cainfo"`
759 778
 	ErrMsg      string      `json:"err_msg"`
760 779
 	InfRefmsgid string      `json:"inf_refmsgid"`
761 780
 	Infcode     int64       `json:"infcode"`
762
-	Output      []struct {
763
-		FixmedinsCode  string
764
-		MedinsListCodg string
765
-		FixmedinsBchno string
766
-		MedListCodg    string
767
-		MedinsListName string
768
-		DrugTracCodg   string
769
-		ValiFlag       string
770
-		OpterId        string
771
-		CrterName      string
772
-		CrterId        string
773
-		OptinsNo       string
774
-	} `json:"output"`
781
+	Output    Output2 `json:"output"`
775 782
 	RefmsgTime  string      `json:"refmsg_time"`
776 783
 	RespondTime string      `json:"respond_time"`
777 784
 	Signtype    interface{} `json:"signtype"`
@@ -779,19 +786,18 @@ type Result3512 struct {
779 786
 }
780 787
 
781 788
 type Struct3513 struct {
782
-	FixmedinsCode  string `json:"fixmedins_code" validate:"required"` // 定点医药机构编号
783
-	MedinsListCodg string `json:"medins_list_codg,omitempty"`         // 医药机构目录编码
784
-	FixmedinsBchno string `json:"fixmedins_bchno,omitempty"`          // 定点医药机构批次流水号
785
-	Begndate       string `json:"begndate,omitempty"`                 // 开始日期
786
-	Enddate        string `json:"enddate,omitempty"`                  // 结束日期
787
-	MedListCodg    string `json:"med_list_codg,omitempty"`            // 医疗目录编码
788
-	MdtrtID        string `json:"mdtrt_id,omitempty"`                 // 就诊ID
789
-	PsnNo          string `json:"psn_no,omitempty"`                   // 人员编号
790
-	PsnCertType    string `json:"psn_cert_type" validate:"required"`  // 人员证件类型
791
-	Certno         string `json:"certno,omitempty"`                   // 证件号码
792
-	PsnName        string `json:"psn_name,omitempty"`                 // 人员姓名
793
-	DrugTracCodg   string `json:"drug_trac_codg,omitempty"`           // 药品追溯码
794
-
789
+	FixmedinsCode  string
790
+	MedinsListCodg string
791
+	FixmedinsBchno string
792
+	Begndate       string
793
+	Enddate        string
794
+	MedListCodg    string
795
+	MdtrtID        string
796
+	PsnNo          string
797
+	PsnCertType    string
798
+	Certno         string
799
+	PsnName        string
800
+	DrugTracCodg   string
795 801
 	OrgName        string
796 802
 	Opter          string
797 803
 	SecretKey      string
@@ -806,37 +812,39 @@ type Struct3513 struct {
806 812
 	SignKey        string
807 813
 	Enckey         string
808 814
 }
815
+type Output3     []struct {
816
+FixmedinsCode  string
817
+MedListCodg    string
818
+MedinsListCodg string
819
+MedinsListName string
820
+FixmedinsBchno string
821
+MdtrtId        string
822
+MdtrtSetlType  string
823
+BkkpSn         string
824
+DrugTracCodg   string
825
+PsnNo          string
826
+PsnCertType    string
827
+Certno         string
828
+PsnName        string
829
+Memo           string
830
+TrdnFlag       string
831
+UpdtTime       string
832
+OpterName      string
833
+Rid            string
834
+CrteTime       string
835
+OptTime        string
836
+OpterId        string
837
+CrterName      string
838
+CrterId        string
839
+OptinsNo       string
840
+}
841
+
809 842
 type Result3513 struct {
810 843
 	Cainfo      interface{} `json:"cainfo"`
811 844
 	ErrMsg      string      `json:"err_msg"`
812 845
 	InfRefmsgid string      `json:"inf_refmsgid"`
813 846
 	Infcode     int64       `json:"infcode"`
814
-	Output      []struct {
815
-		FixmedinsCode  string `json:"fixmedins_code,omitempty"`            // 定点医药机构编号
816
-		MedListCodg    string `json:"med_list_codg,omitempty"`             // 医疗目录编码
817
-		MedinsListCodg string `json:"medins_list_codg,omitempty"`          // 医药机构目录编码
818
-		MedinsListName string `json:"medins_list_name,omitempty"`          // 医药机构目录名称
819
-		FixmedinsBchno string `json:"fixmedins_bchno,omitempty"`           // 定点医药机构批次流水号
820
-		MdtrtId        string `json:"mdtrt_id,omitempty"`                  // 就诊ID
821
-		MdtrtSetlType  string `json:"mdtrt_setl_type" validate:"required"` // 就诊结算类型
822
-		BkkpSn         string `json:"bkkp_sn,omitempty"`                   // 记账流水号
823
-		DrugTracCodg   string `json:"drug_trac_codg,omitempty"`            // 药品追溯码
824
-		PsnNo          string `json:"psn_no,omitempty"`                    // 人员编号
825
-		PsnCertType    string `json:"psn_cert_type" validate:"required"`   // 人员证件类型
826
-		Certno         string `json:"certno,omitempty"`                    // 证件号码
827
-		PsnName        string `json:"psn_name,omitempty"`                  // 人员姓名
828
-		Memo           string `json:"memo,omitempty"`                      // 备注
829
-		TrdnFlag       string `json:"trdn_flag,omitempty"`                 // 拆零标志
830
-		UpdtTime       string `json:"updt_time,omitempty"`                 // 数据更新时间
831
-		OpterName      string `json:"opter_name,omitempty"`                // 经办人姓名
832
-		Rid            string `json:"rid,omitempty"`                       // 数据唯一记录号
833
-		CrteTime       string `json:"crte_time,omitempty"`                 // 数据创建时间
834
-		OptTime        string `json:"opt_time,omitempty"`                  // 经办时间
835
-		OpterId        string `json:"opter_id,omitempty"`                  // 经办人ID
836
-		CrterName      string `json:"crter_name,omitempty"`                // 创建人姓名
837
-		CrterId        string `json:"crter_id,omitempty"`                  // 创建人ID
838
-		OptinsNo       string `json:"optins_no,omitempty"`                 // 经办机构编号
839
-	} `json:"output"`
847
+	Output     Output3 `json:"output"`
840 848
 	RefmsgTime  string      `json:"refmsg_time"`
841 849
 	RespondTime string      `json:"respond_time"`
842 850
 	Signtype    interface{} `json:"signtype"`

+ 248 - 1
service/ahyb_service.go 查看文件

@@ -3377,7 +3377,7 @@ func AHyb3507(struct3507 models.Struct3507) (string, string) {
3377 3377
 	input := make(map[string]interface{})
3378 3378
 	inputData := make(map[string]interface{})
3379 3379
 	inputMessage["infno"] = "3507"                          // 交易编码
3380
-	inputData["fixmedins_bchno"] = struct3507.FixmedinsCode // 人员编号 (来自1101接口返回)
3380
+	inputData["fixmedins_bchno"] = struct3507.FixmedinsBchno // 人员编号 (来自1101接口返回)
3381 3381
 	inputData["inv_data_type"] = struct3507.InvDataType     // 人员编号 (来自1101接口返回)
3382 3382
 
3383 3383
 	input["data"] = inputData
@@ -3535,6 +3535,253 @@ func AHyb3505(struct3505 models.Struct3505, secret_key string, request_url strin
3535 3535
 	return str, string(bytesData)
3536 3536
 }
3537 3537
 
3538
+
3539
+func AHyb3511(struct3511 models.Struct3511, request_url string) (string, string) {
3540
+	// 生成签名
3541
+	timestamp := time.Now().Unix()
3542
+	inputMessage := SetAHInputMessage(timestamp, struct3511.OrgName, struct3511.Opter, struct3511.FixmedinsCode, struct3511.InsuplcAdmdvs, struct3511.MdtrtareaAdmvs, struct3511.Cainfo)
3543
+	// 生成输入报文
3544
+	input := make(map[string]interface{})
3545
+	inputData := make(map[string]interface{})
3546
+	inputMessage["infno"] = "3511"
3547
+	inputData["fixmedins_code"] = struct3511.FixmedinsCode
3548
+	inputData["medins_list_codg"] = struct3511.MedListCodg
3549
+	inputData["fixmedins_bchno"] = ""
3550
+	inputData["begndate"] = struct3511.Begndate
3551
+	inputData["enddate"] = struct3511.Enddate
3552
+	inputData["medins_prod_inv_no"] = ""
3553
+	inputData["medins_list_name"] = ""
3554
+	inputData["rx_flag"] = ""
3555
+	inputData["list_sp_item_flag"] = ""
3556
+	inputData["trdn_flag"] = ""
3557
+	inputData["invdate"] = ""
3558
+	inputData["manu_lotnum"] = ""
3559
+	inputData["manu_date"] = ""
3560
+	inputData["expy_end"] = ""
3561
+	inputData["memo"] = ""
3562
+	inputData["vali_flag"] = ""
3563
+	inputData["rid"] = ""
3564
+
3565
+	inputData["crter_id"] = ""
3566
+	inputData["crter_name"] = ""
3567
+	inputData["crte_optins_no"] = ""
3568
+	inputData["opter_id"] = ""
3569
+	inputData["opter_name"] = ""
3570
+	inputData["optins_no"] = ""
3571
+	inputData["poolarea_no"] = ""
3572
+
3573
+	inputData["fixmedins_bchno"] = ""
3574
+	inputData["inv_data_type"] = ""
3575
+
3576
+	input["data"] = inputData
3577
+	inputMessage["input"] = input //交易输入
3578
+	argInputMessage := make(map[string]interface{})
3579
+	argInputMessage["arg0"] = inputMessage
3580
+
3581
+	bytesData, err := json.Marshal(inputMessage)
3582
+	fmt.Println(string(bytesData))
3583
+	if err != nil {
3584
+		fmt.Println(err.Error())
3585
+		return err.Error(), ""
3586
+	}
3587
+	reader := bytes.NewReader(bytesData)
3588
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
3589
+	request_url = request_url + "3511"
3590
+
3591
+	request, err := http.NewRequest("POST", request_url, reader)
3592
+	if err != nil {
3593
+		fmt.Println(err.Error())
3594
+		return err.Error(), ""
3595
+	}
3596
+
3597
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
3598
+
3599
+	client := http.Client{}
3600
+	resp, err := client.Do(request)
3601
+	if err != nil {
3602
+		fmt.Println(err.Error())
3603
+		return err.Error(), ""
3604
+	}
3605
+	respBytes, err := ioutil.ReadAll(resp.Body)
3606
+	if err != nil {
3607
+		fmt.Println(err.Error())
3608
+		return err.Error(), ""
3609
+	}
3610
+	str := string(respBytes)
3611
+	fmt.Println(str)
3612
+	return str, string(bytesData)
3613
+}
3614
+func AHyb3512(struct3512 models.Struct3512, request_url string) (string, string) {
3615
+	// 生成签名
3616
+	//nonce := GetRandomString(32)
3617
+	timestamp := time.Now().Unix()
3618
+	//signature := setSignature(timestamp, nonce, secret_key)
3619
+	inputMessage := SetAHInputMessage(timestamp, struct3512.OrgName, struct3512.Opter, struct3512.FixmedinsCode, struct3512.InsuplcAdmdvs, struct3512.MdtrtareaAdmvs, struct3512.Cainfo)
3620
+
3621
+	// 生成输入报文
3622
+	//inputMessage := SetGdInputMessage(timestamp, struct3512.OrgName, struct3512.Opter, struct3512.FixmedinsCode, struct3512.InsuplcAdmdvs, struct3512.MdtrtareaAdmvs, struct3512.Cainfo)
3623
+	input := make(map[string]interface{})
3624
+	inputData := make(map[string]interface{})
3625
+	inputMessage["infno"] = "3512"
3626
+	inputData["fixmedins_code"] = struct3512.FixmedinsCode
3627
+	//inputData["medins_list_codg"] = struct3512.MedinsListCodg
3628
+	inputData["medins_list_codg"] = struct3512.MedListCodg
3629
+	inputData["fixmedins_bchno"] = ""
3630
+	inputData["begndate"] = struct3512.Begndate
3631
+	inputData["enddate"] = struct3512.Enddate
3632
+	inputData["medins_prod_inv_no"] = ""
3633
+	inputData["medins_list_name"] = ""
3634
+	inputData["rx_flag"] = ""
3635
+	inputData["list_sp_item_flag"] = ""
3636
+	inputData["trdn_flag"] = ""
3637
+	inputData["invdate"] = ""
3638
+	inputData["manu_lotnum"] = ""
3639
+	inputData["manu_date"] = ""
3640
+	inputData["expy_end"] = ""
3641
+	inputData["memo"] = ""
3642
+	inputData["vali_flag"] = ""
3643
+	inputData["rid"] = ""
3644
+
3645
+	inputData["crter_id"] = ""
3646
+	inputData["crter_name"] = ""
3647
+	inputData["crte_optins_no"] = ""
3648
+	inputData["opter_id"] = ""
3649
+	inputData["opter_name"] = ""
3650
+	inputData["optins_no"] = ""
3651
+	inputData["poolarea_no"] = ""
3652
+
3653
+	inputData["fixmedins_bchno"] = ""
3654
+	inputData["inv_data_type"] = ""
3655
+
3656
+	input["data"] = inputData
3657
+	inputMessage["input"] = input //交易输入
3658
+	argInputMessage := make(map[string]interface{})
3659
+	argInputMessage["arg0"] = inputMessage
3660
+
3661
+	bytesData, err := json.Marshal(argInputMessage)
3662
+	fmt.Println(string(bytesData))
3663
+	if err != nil {
3664
+		fmt.Println(err.Error())
3665
+		return err.Error(), ""
3666
+	}
3667
+	reader := bytes.NewReader(bytesData)
3668
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
3669
+	//gdyb_url := beego.AppConfig.String("gdyb_url")
3670
+	//gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
3671
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
3672
+	//url := gdyb_url + "3505"
3673
+	request_url = request_url + "3512"
3674
+
3675
+	request, err := http.NewRequest("POST", request_url, reader)
3676
+	if err != nil {
3677
+		fmt.Println(err.Error())
3678
+		return err.Error(), ""
3679
+	}
3680
+
3681
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
3682
+
3683
+	client := http.Client{}
3684
+	resp, err := client.Do(request)
3685
+	if err != nil {
3686
+		fmt.Println(err.Error())
3687
+		return err.Error(), ""
3688
+	}
3689
+	respBytes, err := ioutil.ReadAll(resp.Body)
3690
+	if err != nil {
3691
+		fmt.Println(err.Error())
3692
+		return err.Error(), ""
3693
+	}
3694
+	str := string(respBytes)
3695
+	fmt.Println(str)
3696
+	return str, string(bytesData)
3697
+}
3698
+
3699
+func AHyb3513(struct3513 models.Struct3513, request_url string) (string, string) {
3700
+	// 生成签名
3701
+	//nonce := GetRandomString(32)
3702
+	timestamp := time.Now().Unix()
3703
+	//signature := setSignature(timestamp, nonce, secret_key)
3704
+	inputMessage := SetAHInputMessage(timestamp, struct3513.OrgName, struct3513.Opter, struct3513.FixmedinsCode, struct3513.InsuplcAdmdvs, struct3513.MdtrtareaAdmvs, struct3513.Cainfo)
3705
+
3706
+	// 生成输入报文
3707
+	//inputMessage := SetGdInputMessage(timestamp, struct3512.OrgName, struct3512.Opter, struct3512.FixmedinsCode, struct3512.InsuplcAdmdvs, struct3512.MdtrtareaAdmvs, struct3512.Cainfo)
3708
+	input := make(map[string]interface{})
3709
+	inputData := make(map[string]interface{})
3710
+	inputMessage["infno"] = "3513"
3711
+	inputData["fixmedins_code"] = struct3513.FixmedinsCode
3712
+	//inputData["medins_list_codg"] = struct3512.MedinsListCodg
3713
+	inputData["medins_list_codg"] = struct3513.MedListCodg
3714
+	inputData["fixmedins_bchno"] = ""
3715
+	inputData["begndate"] = struct3513.Begndate
3716
+	inputData["enddate"] = struct3513.Enddate
3717
+	inputData["medins_prod_inv_no"] = ""
3718
+	inputData["medins_list_name"] = ""
3719
+	inputData["rx_flag"] = ""
3720
+	inputData["list_sp_item_flag"] = ""
3721
+	inputData["trdn_flag"] = ""
3722
+	inputData["invdate"] = ""
3723
+	inputData["manu_lotnum"] = ""
3724
+	inputData["manu_date"] = ""
3725
+	inputData["expy_end"] = ""
3726
+	inputData["memo"] = ""
3727
+	inputData["vali_flag"] = ""
3728
+	inputData["rid"] = ""
3729
+
3730
+	inputData["crter_id"] = ""
3731
+	inputData["crter_name"] = ""
3732
+	inputData["crte_optins_no"] = ""
3733
+	inputData["opter_id"] = ""
3734
+	inputData["opter_name"] = ""
3735
+	inputData["optins_no"] = ""
3736
+	inputData["poolarea_no"] = ""
3737
+
3738
+	inputData["fixmedins_bchno"] = ""
3739
+	inputData["inv_data_type"] = ""
3740
+
3741
+	input["data"] = inputData
3742
+	inputMessage["input"] = input //交易输入
3743
+	argInputMessage := make(map[string]interface{})
3744
+	argInputMessage["arg0"] = inputMessage
3745
+
3746
+	bytesData, err := json.Marshal(argInputMessage)
3747
+	fmt.Println(string(bytesData))
3748
+	if err != nil {
3749
+		fmt.Println(err.Error())
3750
+		return err.Error(), ""
3751
+	}
3752
+	reader := bytes.NewReader(bytesData)
3753
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
3754
+	//gdyb_url := beego.AppConfig.String("gdyb_url")
3755
+	//gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
3756
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
3757
+	//url := gdyb_url + "3505"
3758
+	request_url = request_url + "3513"
3759
+
3760
+	request, err := http.NewRequest("POST", request_url, reader)
3761
+	if err != nil {
3762
+		fmt.Println(err.Error())
3763
+		return err.Error(), ""
3764
+	}
3765
+
3766
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
3767
+
3768
+	client := http.Client{}
3769
+	resp, err := client.Do(request)
3770
+	if err != nil {
3771
+		fmt.Println(err.Error())
3772
+		return err.Error(), ""
3773
+	}
3774
+	respBytes, err := ioutil.ReadAll(resp.Body)
3775
+	if err != nil {
3776
+		fmt.Println(err.Error())
3777
+		return err.Error(), ""
3778
+	}
3779
+	str := string(respBytes)
3780
+	fmt.Println(str)
3781
+	return str, string(bytesData)
3782
+}
3783
+
3784
+
3538 3785
 func AHyb5101(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string,  request_url string, cainfo string) (string, string) {
3539 3786
 	fmt.Println(request_url)
3540 3787
 

+ 26 - 16
service/fj_service.go 查看文件

@@ -3019,27 +3019,37 @@ func FJyb3501(struct3501 models.Struct3501) (string, string, string) {
3019 3019
 
3020 3020
 	// 生成输入报文
3021 3021
 	//SetFjInputMessage
3022
-	inputMessage := SetFjInputMessage(nonce, timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsHilistId, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Url, struct3501.AppId, struct3501.AppSecret, struct3501.SignKey, struct3501.Enckey)
3022
+	inputMessage := SetFjInputMessage(nonce, timestamp, struct3501.OrgName, struct3501.Opter, struct3501.Code, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Url, struct3501.AppId, struct3501.AppSecret, struct3501.SignKey, struct3501.Enckey)
3023 3023
 	input := make(map[string]interface{})
3024 3024
 	inputData := make(map[string]interface{})
3025
-	druginputData := make(map[string]interface{})
3025
+	//druginputData := make(map[string]interface{})
3026 3026
 	//druginputData2 := make(map[string]interface{})
3027 3027
 
3028 3028
 	inputMessage["infno"] = "3501"                                  // 交易编码
3029
-	inputData["med_list_codg"] = struct3501.MedListCodg             // 定点医药机构目录编号
3030
-	inputData["fixmedins_hilist_id"] = struct3501.FixmedinsHilistId // 定点医药机构目录编号
3031
-	inputData["fixmedins_hilist_name"] = struct3501.OrgName         // 定点医药机构目录名称
3032
-	inputData["rx_flag"] = struct3501.RxFlag                        //
3033
-	inputData["invdate"] = struct3501.Invdate                       // 人员编号 (来自1101接口返回)
3034
-	inputData["inv_cnt"] = struct3501.InvCnt                        // 人员编号 (来自1101接口返回)
3035
-	inputData["manu_lotnum"] = struct3501.ManuLotnum                // 人员编号 (来自1101接口返回)
3036
-	inputData["fixmedins_bchno"] = struct3501.FixmedinsBchno        // 人员编号 (来自1101接口返回)
3037
-	inputData["manu_date"] = struct3501.ManuDate                    // 人员编号 (来自1101接口返回)
3038
-	inputData["expy_end"] = struct3501.ExpyEnd                      // 人员编号 (来自1101接口返回)
3039
-	inputData["memo"] = struct3501.Memo                             // 人员编号 (来自1101接口返回)
3040
-	druginputData["drug_trac_codg"] = struct3501.DrugTracCodg
3041
-	//druginputData2["drugtracinfo"] = druginputData
3042
-	inputData["drug_trac_info"] = druginputData
3029
+	inputData["med_list_codg"] = struct3501.MedListCodg                 // 定点医药机构目录编号
3030
+	inputData["fixmedins_hilist_id"] = struct3501.FixmedinsHilistId     // 定点医药机构目录编号
3031
+	inputData["fixmedins_hilist_name"] = struct3501.FixmedinsHilistName // 定点医药机构目录名称
3032
+	inputData["rx_flag"] = struct3501.RxFlag                            //
3033
+	inputData["invdate"] = struct3501.Invdate                           // 人员编号 (来自1101接口返回)
3034
+	inputData["inv_cnt"] = struct3501.InvCnt                            // 人员编号 (来自1101接口返回)
3035
+	inputData["manu_lotnum"] = struct3501.ManuLotnum                    // 人员编号 (来自1101接口返回)
3036
+	inputData["fixmedins_bchno"] = struct3501.FixmedinsBchno            // 人员编号 (来自1101接口返回)
3037
+	inputData["manu_date"] = struct3501.ManuDate                        // 人员编号 (来自1101接口返回)
3038
+	inputData["expy_end"] = struct3501.ExpyEnd                          // 人员编号 (来自1101接口返回)
3039
+	inputData["memo"] = ""                              // 人员编号 (来自1101接口返回)
3040
+
3041
+	feedetail := make([]map[string]interface{}, 0)
3042
+
3043
+	codes := strings.Split(struct3501.DrugTracCodg, ",")
3044
+	for _, item := range codes {
3045
+		if len(item) > 0 {
3046
+
3047
+			druginputData := make(map[string]interface{})
3048
+			druginputData["drug_trac_codg"] =  removeNonDigits(item)
3049
+			feedetail = append(feedetail, druginputData)
3050
+		}
3051
+	}
3052
+	inputData["drugtracinfo"] = feedetail
3043 3053
 	input["invinfo"] = inputData
3044 3054
 	inputMessage["input"] = input //交易输入
3045 3055
 	bytesData, err := json.Marshal(inputMessage)

+ 1 - 1
service/gdyb_zifei_service.go 查看文件

@@ -502,7 +502,7 @@ func Gdyb4205(org_name string, doctor string, fixmedins_code string, insuplc_adm
502 502
 		inputData["prd_days"] = ""
503 503
 		inputData["medc_way_dscr"] = ""
504 504
 		inputData["memo"] = item.Memo
505
-		inputData["fulamt_ownpay_amt"] = ""
505
+		inputData["fulamt_ownpay_amt"] =  item.DetItemFeeSumamt
506 506
 		inputData["overlmt_selfpay"] = ""
507 507
 		inputData["preselfpay_amt"] = ""
508 508
 		inputData["inscp_amt"] = ""

+ 25 - 3
service/his_service.go 查看文件

@@ -1740,8 +1740,11 @@ func UpDatePrescriptionNumber222(user_org_id int64, id int64, number string, pat
1740 1740
 	return
1741 1741
 }
1742 1742
 
1743
-func GetAllHisOrderTwo10485() (his []*models.HisOrder, err error) {
1744
-	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10485  AND status = 1  AND  order_status = 2 AND setl_id <> '' AND  setl_time >= '2024-01-01 00:00:00' ").Order("setl_time asc").Find(&his).Error
1743
+func GetAllHisOrderTwo10485(start, end string) (his []*models.HisOrder, err error) {
1744
+	start = start + " 00:00:00"
1745
+	end = end + " 23:00:00"
1746
+
1747
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10633  AND status = 1  AND  order_status = 2 AND setl_id <> '' AND  setl_time >= ? and setl_time <= ? ",start,end).Order("setl_time asc").Find(&his).Error
1745 1748
 	fmt.Println(err)
1746 1749
 	return
1747 1750
 }
@@ -1848,7 +1851,26 @@ func SaveDF2(df *models.DrugFlow) (err error) {
1848 1851
 	return
1849 1852
 }
1850 1853
 func GetDrugByID(drug_id int64) (drug models.BaseDrugLib, err error) {
1851
-	err = readDb.Model(&models.BaseDrugLib{}).Where("id = ?", drug_id).First(&drug).Error
1854
+
1855
+		err = readDb.Model(&models.BaseDrugLib{}).Where("id = ?", drug_id).Find(&drug).Error
1856
+
1857
+
1858
+	return
1859
+}
1860
+
1861
+func GetDrugByIDTwo(drug_id int64,org_id int64) (drug []models.BaseDrugLib, err error) {
1862
+	if drug_id == 0{
1863
+		err = readDb.Model(&models.BaseDrugLib{}).Where("org_id = ?", org_id).Find(&drug).Error
1864
+
1865
+	}else{
1866
+		err = readDb.Model(&models.BaseDrugLib{}).Where("id = ?", drug_id).Find(&drug).Error
1867
+
1868
+
1869
+	}
1870
+	return
1871
+}
1872
+func GetSaleDate(id string) (flow models.DrugFlow) {
1873
+	 readDb.Model(&models.DrugFlow{}).Where("id = ?",id).First(&flow)
1852 1874
 	return
1853 1875
 }
1854 1876
 

+ 1 - 1
service/jsyb_service.go 查看文件

@@ -1710,7 +1710,7 @@ func Jsyb4101(struct4101 Struct4101, params models.PublicParams) (string, string
1710 1710
 	// 生成输入报文
1711 1711
 	input := make(map[string]interface{})
1712 1712
 	inputData := make(map[string]interface{})
1713
-	inputMessage["infno"] = "4101A" // 交易编码
1713
+	inputMessage["infno"] = "4101" // 交易编码
1714 1714
 	year := time.Now().Format("2006")
1715 1715
 	month := time.Now().Format("01")
1716 1716
 	day := time.Now().Format("02")

+ 58 - 63
service/jx_service.go 查看文件

@@ -1962,6 +1962,62 @@ func JXyb3505(struct3505 models.Struct3505, secret_key string, ak string,request
1962 1962
 }
1963 1963
 
1964 1964
 
1965
+func JXyb3513(struct3513 models.Struct3513, secret_key string, ak string,request_url string) (string, string) {
1966
+	// 生成签名
1967
+	timestamp := time.Now().Unix()
1968
+
1969
+	// 生成输入报文
1970
+	inputMessage := SetGdInputMessage(timestamp, struct3513.OrgName, struct3513.Opter, struct3513.FixmedinsCode, struct3513.InsuplcAdmdvs, struct3513.MdtrtareaAdmvs, struct3513.Cainfo)
1971
+	input := make(map[string]interface{})
1972
+	inputData := make(map[string]interface{})
1973
+	inputMessage["infno"] = "3513"
1974
+	inputData["fixmedins_code"] = struct3513.FixmedinsCode
1975
+	//inputData["medins_list_codg"] = struct3513.MedinsListCodg
1976
+	inputData["medins_list_codg"] = struct3513.MedListCodg
1977
+
1978
+	inputData["fixmedins_bchno"] = ""
1979
+	inputData["begndate"] = struct3513.Begndate
1980
+	inputData["enddate"] = struct3513.Enddate
1981
+	inputData["medins_prod_inv_no"] = ""
1982
+	inputData["med_list_codg"] = ""
1983
+	inputData["medins_list_name"] = ""
1984
+	inputData["rx_flag"] = ""
1985
+	inputData["list_sp_item_flag"] = ""
1986
+	inputData["trdn_flag"] = ""
1987
+	inputData["invdate"] = ""
1988
+	inputData["manu_lotnum"] = ""
1989
+	inputData["manu_date"] = ""
1990
+	inputData["expy_end"] = ""
1991
+	inputData["memo"] = ""
1992
+	inputData["vali_flag"] = ""
1993
+	inputData["rid"] = ""
1994
+
1995
+	inputData["crter_id"] = ""
1996
+	inputData["crter_name"] = ""
1997
+	inputData["crte_optins_no"] = ""
1998
+	inputData["opter_id"] = ""
1999
+	inputData["opter_name"] = ""
2000
+	inputData["optins_no"] = ""
2001
+	inputData["poolarea_no"] = ""
2002
+
2003
+	inputData["fixmedins_bchno"] = ""
2004
+	inputData["inv_data_type"] = ""
2005
+
2006
+	input["data"] = inputData
2007
+	inputMessage["input"] = input //交易输入
2008
+
2009
+	bytesData, err := json.Marshal(inputMessage)
2010
+	requestLog := string(bytesData)
2011
+	if err != nil {
2012
+		fmt.Println(err.Error())
2013
+		return err.Error(), ""
2014
+	}
2015
+	request_url = request_url + "3513"
2016
+	return JXHttpRequest(request_url, ak, secret_key, timestamp, string(bytesData), "3513"), requestLog
2017
+
2018
+}
2019
+
2020
+
1965 2021
 //CBS总线
1966 2022
 func JXHttpRequest(url string, ak string, sk string, timestamp int64, json string, infno string) string {
1967 2023
 	fmt.Println(url)
@@ -2124,7 +2180,7 @@ func Jxyb3201(fixmedins_setl_cnt int64,  stmt_begndate string, stmt_enddate stri
2124 2180
 	inputMessage["infno"] = "3201"                       // 交易编码
2125 2181
 	inputData["insutype"] = insutype                     // 险种
2126 2182
 	inputData["clr_type"] = clr_type                     // 就诊 ID(来自2201接口返回)
2127
-	inputData["setl_optins"] = "360302"               // 结算经办机构
2183
+	inputData["setl_optins"] = "360102"               // 结算经办机构
2128 2184
 	inputData["stmt_begndate"] = stmt_begndate           // 对帐开始时间
2129 2185
 	inputData["stmt_enddate"] = stmt_enddate             //对帐结束时间
2130 2186
 	inputData["medfee_sumamt"] = medfee_sumamt           //医疗费总额
@@ -2932,68 +2988,7 @@ func Jxyb3504(struct3504 models.Struct3504) (string, string) {
2932 2988
 
2933 2989
 }
2934 2990
 
2935
-func Jxyb3505(struct3505 models.Struct3505) (string, string) {
2936
-	timestamp := time.Now().Unix()
2937
-	// 生成输入报文
2938
-	inputMessage := SetJXInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsCode, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
2939
-	input := make(map[string]interface{})
2940
-	inputData := make(map[string]interface{})
2941
-	inputMessage["infno"] = "3505"                              // 交易编码
2942
-	inputData["med_list_codg"] = struct3505.MedListCodg         // 定点医药机构目录编号
2943
-	inputData["fixmedins_hilist_id"] = struct3505.FixmedinsCode // 定点医药机构目录编号
2944
-	inputData["fixmedins_hilist_name"] = struct3505.OrgName     // 定点医药机构目录名称
2945
-	inputData["fixmedins_bchno"] = struct3505.FixmedinsCode     // 人员编号 (来自1101接口返回)
2946
-
2947
-	inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
2948
-	inputData["prsc_dr_certno"] = struct3505.PrscDrCertno      // 人员编号 (来自1101接口返回)
2949
-	inputData["prsc_dr_name"] = struct3505.PrscDrName          // 人员编号 (来自1101接口返回)
2950
-	inputData["phar_cert_type"] = struct3505.PharCertType      // 人员编号 (来自1101接口返回)
2951
-	inputData["phar_certno"] = struct3505.PharCertno           // 人员编号 (来自1101接口返回)
2952
-
2953
-	inputData["phar_name"] = struct3505.PharName               // 人员编号 (来自1101接口返回)
2954
-	inputData["phar_prac_cert_no"] = struct3505.PharPracCertNo // 人员编号 (来自1101接口返回)
2955
-	inputData["hi_feesetl_type"] = struct3505.HiFeesetlType    // 人员编号 (来自1101接口返回)
2956
-	inputData["setl_id"] = struct3505.SetlId                   // 人员编号 (来自1101接口返回)
2957
-	inputData["mdtrt_sn"] = struct3505.MdtrtSn                 // 人员编号 (来自1101接口返回)
2958
-	inputData["psn_no"] = struct3505.PsnNo                     // 人员编号 (来自1101接口返回)
2959
-	inputData["psn_cert_type"] = struct3505.PsnCertType        // 人员编号 (来自1101接口返回)
2960
-	inputData["certno"] = struct3505.CertNo                    // 人员编号 (来自1101接口返回)
2961
-	inputData["psn_name"] = struct3505.PsnName                 // 人员编号 (来自1101接口返回)
2962
-	inputData["manu_lotnum"] = struct3505.ManuLotnum           // 人员编号 (来自1101接口返回)
2963
-	inputData["manu_date"] = struct3505.ManuDate               // 人员编号 (来自1101接口返回)
2964
-	inputData["expy_end"] = struct3505.ExpyEnd                 // 人员编号 (来自1101接口返回)
2965
-
2966
-	inputData["rx_flag"] = struct3505.RxFlag     // 人员编号 (来自1101接口返回)
2967
-	inputData["trdn_flag"] = struct3505.TrdnFlag // 人员编号 (来自1101接口返回)
2968
-
2969
-	inputData["finl_trns_pric"] = struct3505.FinlTrnsPric // 人员编号 (来自1101接口返回)
2970
-	inputData["rxno"] = struct3505.Rxno                   // 人员编号 (来自1101接口返回)
2971
-	inputData["rx_circ_flag"] = struct3505.RxCircFlag     // 人员编号 (来自1101接口返回)
2972
-
2973
-	inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
2974
-	inputData["stoout_no"] = struct3505.StooutNo   // 人员编号 (来自1101接口返回)
2975 2991
 
2976
-	inputData["bchno"] = struct3505.Bchno                          // 人员编号 (来自1101接口返回)
2977
-	inputData["drug_trac_codg"] = struct3505.DrugTracCodg          // 人员编号 (来自1101接口返回)
2978
-	inputData["drug_prod_barc"] = struct3505.DrugProdBarc          // 人员编号 (来自1101接口返回)
2979
-	inputData["shelf_posi"] = struct3505.ShelfPosi                 // 人员编号 (来自1101接口返回)
2980
-	inputData["sel_retn_cnt"] = struct3505.SelRetnCnt              // 人员编号 (来自1101接口返回)
2981
-	inputData["sel_retn_time"] = struct3505.SelRetnTime            // 人员编号 (来自1101接口返回)
2982
-	inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
2983
-	inputData["memo"] = struct3505.Memo                            // 人员编号 (来自1101接口返回)
2984
-	input["selinfo"] = inputData
2985
-	inputMessage["input"] = input //交易输入
2986
-
2987
-	bytesData, err := json.Marshal(inputMessage)
2988
-	fmt.Println(string(bytesData))
2989
-	if err != nil {
2990
-		fmt.Println(err.Error())
2991
-		return err.Error(), ""
2992
-	}
2993
-	struct3505.RequestUrl = struct3505.RequestUrl + "3505"
2994
-	return JXHttpRequest(struct3505.RequestUrl, struct3505.AccessKey, struct3505.SecretKey, timestamp, string(bytesData), "3505"), string(bytesData)
2995
-
2996
-}
2997 2992
 func Jxyb3506(struct3506 models.Struct3506) (string, string) {
2998 2993
 	timestamp := time.Now().Unix()
2999 2994
 	// 生成输入报文
@@ -3044,7 +3039,7 @@ func Jxyb3507(struct3507 models.Struct3507) (string, string) {
3044 3039
 	input := make(map[string]interface{})
3045 3040
 	inputData := make(map[string]interface{})
3046 3041
 	inputMessage["infno"] = "3507"                          // 交易编码
3047
-	inputData["fixmedins_bchno"] = struct3507.FixmedinsCode // 人员编号 (来自1101接口返回)
3042
+	inputData["fixmedins_bchno"] = struct3507.FixmedinsBchno // 人员编号 (来自1101接口返回)
3048 3043
 	inputData["inv_data_type"] = struct3507.InvDataType     // 人员编号 (来自1101接口返回)
3049 3044
 
3050 3045
 	input["data"] = inputData