Browse Source

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

csx 3 years ago
parent
commit
11fc105de7
3 changed files with 130 additions and 6 deletions
  1. 5 5
      conf/app.conf
  2. 7 1
      controllers/sg/his_api_controller.go
  3. 118 0
      service/gdyb_service.go

+ 5 - 5
conf/app.conf View File

@@ -45,7 +45,7 @@ appsecret="61ee2e6268497d5aa9de0b0187c39aea"
45 45
 
46 46
 
47 47
 [prod]
48
-org_id = 10215
48
+org_id = 10138
49 49
 mobile_token_expiration_second = 86400
50 50
 httpdomain = https://api.xt.kuyicloud.com
51 51
 sso_domain = https://sso.kuyicloud.com
@@ -53,15 +53,15 @@ call_domain = https://hf.sgjyun.com
53 53
 front_end_domain = "https://xt.kuyicloud.com/#"
54 54
 #url  = "http://192.168.1.228:17001/szsi-portal/transData"
55 55
 #url = "http://192.168.1.88:6666/szsi-portal/transData"
56
-gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
57
-# gdyb_url="http://igb.hsa.gdgov.cn/ebus/sz_prd/hsa/hgs/"
56
+# gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
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 60
 # gdyb_paasid = "sg03_prd"
61 61
 # gdyb_paasid = "jm_sc_yjyy"
62 62
 # gdyb_paasid="zh_prd_yrojyy"
63
-# gdyb_paasid = "sz_prd_yjyy"
64
-gdyb_paasid = "zq_prd_yjyy"
63
+gdyb_paasid = "sz_prd_yjyy"
64
+# gdyb_paasid = "zq_prd_yjyy"
65 65
 
66 66
 
67 67
 

+ 7 - 1
controllers/sg/his_api_controller.go View File

@@ -3109,7 +3109,13 @@ func (c *HisApiController) GetRegisterInfo() {
3109 3109
 			verify_number = psn_info.VerifyNumber
3110 3110
 
3111 3111
 		} else {
3112
-			result, requestLog := service.Gdyb1101(patient.IdCardNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", strconv.FormatInt(certificates, 10), name)
3112
+			var result string
3113
+			var requestLog string
3114
+			if miConfig.UserOrgId == 10138 {
3115
+				result, requestLog = service.Gdyb1101D(patient.IdCardNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", strconv.FormatInt(certificates, 10), name)
3116
+			} else {
3117
+				result, requestLog = service.Gdyb1101(patient.IdCardNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", strconv.FormatInt(certificates, 10), name)
3118
+			}
3113 3119
 			saveLog(result, requestLog, "1101", "人员基本信息获取")
3114 3120
 			if miConfig.Code == "H15049901371" {
3115 3121
 

+ 118 - 0
service/gdyb_service.go View File

@@ -177,6 +177,7 @@ func Gdyb1101(certNo string, org_name string, doctor string, fixmedins_code stri
177 177
 		inputData["psn_cert_type"] = "99"   // 人员证件类型
178 178
 
179 179
 	} else {
180
+
180 181
 		if id_card_type == 1 {
181 182
 			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
182 183
 			inputData["card_sn"] = card_sn      // 卡识别码
@@ -4233,3 +4234,120 @@ func GetMac() string {
4233 4234
 	}
4234 4235
 	return ""
4235 4236
 }
4237
+
4238
+// 人员基本信息
4239
+func Gdyb1101D(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, psn_name string) (string, string) {
4240
+	//生成签名
4241
+	nonce := GetRandomString(32)
4242
+	timestamp := time.Now().Unix()
4243
+	signature := setSignature(timestamp, nonce, secret_key)
4244
+	//生成输入报文
4245
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
4246
+	input := make(map[string]interface{})
4247
+	inputData := make(map[string]interface{})
4248
+	inputMessage["infno"] = "1101" // 交易编码
4249
+
4250
+	if certificates == "3" {
4251
+		inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
4252
+		inputData["certno"] = certNo        // 证件号码
4253
+		inputData["psn_cert_type"] = "99"   // 人员证件类型
4254
+
4255
+	} else {
4256
+		if certificates == "3" {
4257
+			if id_card_type == 1 {
4258
+				inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
4259
+				inputData["card_sn"] = ""           // 卡识别码
4260
+				inputData["certno"] = certNo        // 证件号码
4261
+				inputData["psn_cert_type"] = "01"   // 人员证件类型
4262
+
4263
+			} else {
4264
+				inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
4265
+				inputData["card_sn"] = ""           // 卡识别码
4266
+				inputData["certno"] = certNo        // 证件号码
4267
+				inputData["psn_cert_type"] = "01"   // 人员证件类型
4268
+			}
4269
+		} else if certificates == "6" {
4270
+			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
4271
+			inputData["card_sn"] = ""           // 卡识别码
4272
+			inputData["certno"] = certNo        // 证件号码
4273
+			inputData["psn_cert_type"] = "17"   // 人员证件类型
4274
+
4275
+		}
4276
+
4277
+	}
4278
+
4279
+	inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
4280
+	inputData["begntime"] = ""          // 开始时间
4281
+	inputData["psn_name"] = psn_name    // 人员姓名
4282
+	input["data"] = inputData
4283
+	inputMessage["input"] = input //交易输入
4284
+
4285
+	var inputLog string
4286
+	bytesData, err := json.Marshal(inputMessage)
4287
+	inputLog = string(bytesData)
4288
+	fmt.Println(string(bytesData))
4289
+	if err != nil {
4290
+		fmt.Println(err.Error())
4291
+		return err.Error(), ""
4292
+	}
4293
+	reader := bytes.NewReader(bytesData)
4294
+	gdyb_url := beego.AppConfig.String("gdyb_url")
4295
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
4296
+
4297
+	//DllDef := syscall.MustLoadDLL("yh_hb_sctrl.dll")
4298
+	//Iinit := DllDef.MustFindProc("yh_hb_call")
4299
+	//var str3 string
4300
+	//ret, _, _ := Iinit.Call(StrPtr("1101"), StrPtr(string(bytesData)), StrPtr(str3))
4301
+	//fmt.Println(ret)
4302
+	//fmt.Println(str3)
4303
+	//
4304
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
4305
+	var url string
4306
+	if fixmedins_code == "H15049901371" {
4307
+		url = gdyb_url
4308
+	} else {
4309
+		url = gdyb_url + "1101"
4310
+	}
4311
+
4312
+	if insuplc_admdvs == "421300" {
4313
+		var json2 string
4314
+		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
4315
+		out, err := cmd.Output()
4316
+		if err != nil {
4317
+			fmt.Println("error:", err.Error())
4318
+		}
4319
+		fmt.Println(string(out))
4320
+		return hex.EncodeToString(out), inputLog
4321
+	} else {
4322
+
4323
+		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
4324
+		request, err := http.NewRequest("POST", url, reader)
4325
+		if err != nil {
4326
+			fmt.Println(err.Error())
4327
+			return err.Error(), ""
4328
+		}
4329
+
4330
+		request.Header.Set("Content-Type", "application/json;charset=UTF-8")
4331
+		request.Header.Set("x-tif-paasid", gdyb_paasid)
4332
+		request.Header.Set("x-tif-signature", signature)
4333
+		request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
4334
+		request.Header.Set("x-tif-nonce", nonce)
4335
+
4336
+		client := http.Client{}
4337
+		resp, err := client.Do(request)
4338
+		if err != nil {
4339
+			fmt.Println(err.Error())
4340
+			return err.Error(), ""
4341
+		}
4342
+		respBytes, err := ioutil.ReadAll(resp.Body)
4343
+		if err != nil {
4344
+			fmt.Println(err.Error())
4345
+			return err.Error(), ""
4346
+		}
4347
+		fmt.Println(string(respBytes))
4348
+		str := string(respBytes)
4349
+		return str, inputLog
4350
+
4351
+	}
4352
+
4353
+}