Selaa lähdekoodia

Merge branch 'master' of http://git.shengws.com/csx/gdyb

csx 3 vuotta sitten
vanhempi
commit
503cc00831
3 muutettua tiedostoa jossa 45 lisäystä ja 42 poistoa
  1. 3 3
      conf/app.conf
  2. 1 1
      controllers/sg/his_api_controller.go
  3. 41 38
      service/jsyb_service.go

+ 3 - 3
conf/app.conf Näytä tiedosto

@@ -45,7 +45,7 @@ appsecret="61ee2e6268497d5aa9de0b0187c39aea"
45 45
 
46 46
 
47 47
 [prod]
48
-org_id = 10215
48
+org_id = 10188
49 49
 mobile_token_expiration_second = 86400
50 50
 httpdomain = https://api.xt.kuyicloud.com
51 51
 sso_domain = https://sso.kuyicloud.com
@@ -57,11 +57,11 @@ gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
57 57
 # gdyb_url="http://igb.hsa.gdgov.cn/ebus/sz_prd/hsa/hgs/"
58 58
 #内蒙古
59 59
 # gdyb_url = "http://10.38.23.105:8090/uif-hsaf-med-api/api/medical/service/"
60
-# gdyb_paasid = "sg03_prd"
60
+gdyb_paasid = "sg03_prd"
61 61
 # gdyb_paasid = "jm_sc_yjyy"
62 62
 #gdyb_paasid="zh_prd_yrojyy"
63 63
 #gdyb_paasid = "sz_prd_yjyy"
64
-gdyb_paasid = "zq_prd_yjyy"
64
+# gdyb_paasid = "zq_prd_yjyy"
65 65
 
66 66
 
67 67
 

+ 1 - 1
controllers/sg/his_api_controller.go Näytä tiedosto

@@ -2941,7 +2941,7 @@ func (c *HisApiController) GetRegisterInfo() {
2941 2941
 			var res ResultTwo
2942 2942
 			api := "http://192.168.3.130:9532/" + "jsyb/1101?cert_no=" + "" +
2943 2943
 				"&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
2944
-				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&card_sn=" + "" + "&certificates=" + strconv.FormatInt(certificates, 10) + "&url=" + miConfig.Url + "&ak=" + "fb4f41a047934d588a89cdac7a102410"
2944
+				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&card_sn=" + "" + "&certificates=" + strconv.FormatInt(certificates, 10) + "&url=" + miConfig.Url + "&ak=" + "1781ce9fb73a478289326c16ba8bf2c4"
2945 2945
 			resp, requestErr := http.Get(api)
2946 2946
 			if requestErr != nil {
2947 2947
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)

+ 41 - 38
service/jsyb_service.go Näytä tiedosto

@@ -1,12 +1,15 @@
1 1
 package service
2 2
 
3 3
 import (
4
+	"bytes"
4 5
 	"crypto/hmac"
5 6
 	"crypto/sha1"
6 7
 	"encoding/base64"
7 8
 	"encoding/json"
8 9
 	"fmt"
9 10
 	"gdyb/utils/csbhttp"
11
+	"io/ioutil"
12
+	"net/http"
10 13
 	"strconv"
11 14
 	"time"
12 15
 )
@@ -50,45 +53,45 @@ func Jsyb1101(certNo string, org_name string, doctor string, fixmedins_code stri
50 53
 	input["data"] = inputData
51 54
 	inputMessage["input"] = input //交易输入
52 55
 
53
-	//var inputLog string
56
+	var inputLog string
54 57
 	bytesData, _ := json.Marshal(inputMessage)
55
-	//inputLog = string(bytesData)
56
-	//fmt.Println(string(bytesData))
57
-	//if err != nil {
58
-	//	fmt.Println(err.Error())
59
-	//	return err.Error(), ""
60
-	//}
61
-	//reader := bytes.NewReader(bytesData)
62
-	//
63
-	//request, err := http.NewRequest("POST", "http://10.72.3.87:8086/CSB/1101", reader)
64
-	//if err != nil {
65
-	//	fmt.Println(err.Error())
66
-	//	return err.Error(), ""
67
-	//}
68
-	//key := "_api_access_key=" + access_key + "&_api_name=" + "hssServives" + "&_api_timestamp=" + strconv.FormatInt(timestamp, 10) + "&_api_version=" + "1.0.0"
69
-	//
70
-	//request.Header.Set("Content-Type", "application/json;charset=UTF-8")
71
-	//request.Header.Set("_api_timestamp", strconv.FormatInt(timestamp, 10))
72
-	//request.Header.Set("_api_name", "hssServives")
73
-	//request.Header.Set("_api_version", "1.0.0")
74
-	//request.Header.Set("_api_access_key", access_key)
75
-	//request.Header.Set("_api_signature", hmacsha1(key, secret_key))
76
-	//
77
-	//client := http.Client{}
78
-	//resp, err := client.Do(request)
79
-	//if err != nil {
80
-	//	fmt.Println(err.Error())
81
-	//	return err.Error(), ""
82
-	//}
83
-	//respBytes, err := ioutil.ReadAll(resp.Body)
84
-	//if err != nil {
85
-	//	fmt.Println(err.Error())
86
-	//	return err.Error(), ""
87
-	//}
88
-	//fmt.Println(string(respBytes))
89
-	//str := string(respBytes)
90
-	//return str, ""
91
-	return HttpRequest(request_url, access_key, secret_key, timestamp, bytesData, string(bytesData)), ""
58
+	inputLog = string(bytesData)
59
+	fmt.Println(string(bytesData))
60
+	if err != nil {
61
+		fmt.Println(err.Error())
62
+		return err.Error(), ""
63
+	}
64
+	reader := bytes.NewReader(bytesData)
65
+
66
+	request, err := http.NewRequest("POST", "http://10.72.3.87:8086/CSB/1101", reader)
67
+	if err != nil {
68
+		fmt.Println(err.Error())
69
+		return err.Error(), ""
70
+	}
71
+	key := "_api_access_key=" + access_key + "&_api_name=" + "hssServives" + "&_api_timestamp=" + strconv.FormatInt(timestamp, 10) + "&_api_version=" + "1.0.0"
72
+
73
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
74
+	request.Header.Set("_api_timestamp", strconv.FormatInt(timestamp, 10))
75
+	request.Header.Set("_api_name", "hssServives")
76
+	request.Header.Set("_api_version", "1.0.0")
77
+	request.Header.Set("_api_access_key", access_key)
78
+	request.Header.Set("_api_signature", hmacsha1(key, secret_key))
79
+
80
+	client := http.Client{}
81
+	resp, err := client.Do(request)
82
+	if err != nil {
83
+		fmt.Println(err.Error())
84
+		return err.Error(), ""
85
+	}
86
+	respBytes, err := ioutil.ReadAll(resp.Body)
87
+	if err != nil {
88
+		fmt.Println(err.Error())
89
+		return err.Error(), ""
90
+	}
91
+	fmt.Println(string(respBytes))
92
+	str := string(respBytes)
93
+	return str, inputLog
94
+	//return HttpRequest(request_url, access_key, secret_key, timestamp, bytesData, string(bytesData)), ""
92 95
 }
93 96
 func HttpRequest(url string, ak string, sk string, timestamp int64, requestByte []byte, json string) string {
94 97
 	fmt.Println(url)