|
@@ -5,14 +5,16 @@ import (
|
5
|
5
|
"encoding/json"
|
6
|
6
|
"fmt"
|
7
|
7
|
"gdyb/models"
|
|
8
|
+ "github.com/astaxie/beego"
|
8
|
9
|
"io/ioutil"
|
9
|
10
|
"net/http"
|
10
|
11
|
"strconv"
|
|
12
|
+ "strings"
|
11
|
13
|
"time"
|
12
|
14
|
)
|
13
|
15
|
|
14
|
16
|
// 门诊挂号
|
15
|
|
-func Nmyb2201(psnNo string, insutype string, certNo string, org_name string, opera string, ipt_otp_no string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, doctor_name string, request_url string, verify_number string, cainfo string) (string, string) {
|
|
17
|
+func Nmyb2201(psnNo string, insutype string, certNo string, org_name string, opera string, ipt_otp_no string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, doctor_name string, verify_number string, cainfo string) (string, string) {
|
16
|
18
|
// 生成签名
|
17
|
19
|
// 生成签名
|
18
|
20
|
nonce := GetRandomString(32)
|
|
@@ -20,9 +22,9 @@ func Nmyb2201(psnNo string, insutype string, certNo string, org_name string, ope
|
20
|
22
|
signature := setSignature(timestamp, nonce, secret_key)
|
21
|
23
|
tempTime := time.Unix(timestamp, 0)
|
22
|
24
|
timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
|
23
|
|
-
|
|
25
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
|
24
|
26
|
// 生成输入报文
|
25
|
|
- inputMessage := SetJSInputMessage(timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
|
|
27
|
+ //inputMessage := SetInputMessage(timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
|
26
|
28
|
input := make(map[string]interface{})
|
27
|
29
|
inputData := make(map[string]interface{})
|
28
|
30
|
inputMessage["infno"] = "2201" // 交易编码
|
|
@@ -31,8 +33,8 @@ func Nmyb2201(psnNo string, insutype string, certNo string, org_name string, ope
|
31
|
33
|
inputData["begntime"] = timeFormatOne // 开始时间
|
32
|
34
|
|
33
|
35
|
if id_card_type == 1 {
|
34
|
|
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
|
35
|
|
- inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
|
|
36
|
+ inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
|
|
37
|
+ inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
|
36
|
38
|
} else if id_card_type == 3 {
|
37
|
39
|
inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
|
38
|
40
|
inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
|
|
@@ -40,8 +42,8 @@ func Nmyb2201(psnNo string, insutype string, certNo string, org_name string, ope
|
40
|
42
|
inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
|
41
|
43
|
inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
|
42
|
44
|
} else {
|
43
|
|
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
|
44
|
|
- inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
|
|
45
|
+ inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
|
|
46
|
+ inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
|
45
|
47
|
|
46
|
48
|
}
|
47
|
49
|
|
|
@@ -68,9 +70,8 @@ func Nmyb2201(psnNo string, insutype string, certNo string, org_name string, ope
|
68
|
70
|
|
69
|
71
|
gdyb_url := beego.AppConfig.String("gdyb_url")
|
70
|
72
|
gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
|
71
|
|
- request_url = gdyb_url
|
72
|
73
|
|
73
|
|
- request, err := http.NewRequest("POST", request_url, reader)
|
|
74
|
+ request, err := http.NewRequest("POST", gdyb_url, reader)
|
74
|
75
|
if err != nil {
|
75
|
76
|
fmt.Println(err.Error())
|
76
|
77
|
return err.Error(), ""
|
|
@@ -108,7 +109,9 @@ func Nmyb2202(psnNo string, mdtrtId string, ipt_otp_no string, org_name string,
|
108
|
109
|
signature := setSignature(timestamp, nonce, secret_key)
|
109
|
110
|
|
110
|
111
|
// 生成输入报文
|
111
|
|
- inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
|
|
112
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
|
|
113
|
+
|
|
114
|
+ //inputMessage := SetInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
|
112
|
115
|
input := make(map[string]interface{})
|
113
|
116
|
inputData := make(map[string]interface{})
|
114
|
117
|
inputMessage["infno"] = "2202" // 交易编码
|
|
@@ -255,10 +258,104 @@ func Nmyb2203(psnNo string, mdtrtId string, doctor string, department string, or
|
255
|
258
|
fmt.Println(str)
|
256
|
259
|
return str, requestLog
|
257
|
260
|
|
|
261
|
+}
|
|
262
|
+func Nmyb2203C(psnNo string, mdtrtId string, doctor string, department string, org_name string, med_type string, doctor_id string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string, dept string, config []*models.HisXtDiagnoseConfig, begin_time string, cainfo string) (string, string) {
|
|
263
|
+ // 生成签名
|
|
264
|
+ // 生成签名
|
|
265
|
+ nonce := GetRandomString(32)
|
|
266
|
+ timestamp := time.Now().Unix()
|
|
267
|
+ signature := setSignature(timestamp, nonce, secret_key)
|
|
268
|
+ //tempTime := time.Unix(timestamp, 0)
|
|
269
|
+ //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
|
|
270
|
+ // 生成输入报文
|
|
271
|
+
|
|
272
|
+ tempTime := time.Unix(timestamp, 0)
|
|
273
|
+ timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
|
|
274
|
+ // 生成输入报文
|
|
275
|
+ inputMessage := SetJSInputMessage(timestamp, org_name, dept, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
|
|
276
|
+ input := make(map[string]interface{})
|
|
277
|
+ inputData := make(map[string]interface{})
|
|
278
|
+ diseinfo := make([]map[string]interface{}, 0)
|
|
279
|
+
|
|
280
|
+ if med_type == "1111" || med_type == "1112" {
|
|
281
|
+ med_type = "11"
|
|
282
|
+ }
|
|
283
|
+
|
|
284
|
+ inputMessage["infno"] = "2203A" // 交易编码
|
|
285
|
+ inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
|
|
286
|
+ inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
|
|
287
|
+ inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
|
|
288
|
+ inputData["begntime"] = begin_time // 开始时间
|
|
289
|
+ inputData["main_cond_dscr"] = "" // 主要病情描述
|
|
290
|
+ inputData["dise_codg"] = sick_code // 病种编码
|
|
291
|
+ inputData["dise_name"] = sick_name // 病种名称
|
|
292
|
+ inputData["birctrl_type"] = "" // 计划生育手术类别
|
|
293
|
+ inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
|
|
294
|
+
|
|
295
|
+ for index, item := range config {
|
|
296
|
+ diseinfo_sun := make(map[string]interface{})
|
|
297
|
+ diseinfo_sun["diag_type"] = "1" // 诊断类别
|
|
298
|
+ diseinfo_sun["diag_srt_no"] = index // 诊断排序号
|
|
299
|
+ diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码
|
|
300
|
+ diseinfo_sun["diag_name"] = item.ClassName // 诊断名称
|
|
301
|
+ diseinfo_sun["diag_dept"] = department // 诊断科室
|
|
302
|
+ diseinfo_sun["dise_dor_no"] = doctor_id // 诊断医生编码
|
|
303
|
+ diseinfo_sun["dise_dor_name"] = doctor // 诊断医生姓名
|
|
304
|
+ diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
|
|
305
|
+ diseinfo_sun["vali_flag"] = "0" // 有效标志
|
|
306
|
+ diseinfo = append(diseinfo, diseinfo_sun)
|
|
307
|
+ }
|
|
308
|
+ //inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
|
|
309
|
+ inputData["exp_content"] = "" //
|
|
310
|
+
|
|
311
|
+ input["diseinfo"] = diseinfo
|
|
312
|
+ input["mdtrtinfo"] = inputData
|
|
313
|
+ inputMessage["input"] = input //交易输入
|
|
314
|
+ var requestLog string
|
|
315
|
+ bytesData, err := json.Marshal(inputMessage)
|
|
316
|
+ fmt.Println(string(bytesData))
|
|
317
|
+ requestLog = string(bytesData)
|
|
318
|
+ if err != nil {
|
|
319
|
+ fmt.Println(err.Error())
|
|
320
|
+ return err.Error(), ""
|
|
321
|
+ }
|
|
322
|
+ reader := bytes.NewReader(bytesData)
|
|
323
|
+
|
|
324
|
+ gdyb_url := beego.AppConfig.String("gdyb_url")
|
|
325
|
+ gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
|
|
326
|
+
|
|
327
|
+ request, err := http.NewRequest("POST", gdyb_url, reader)
|
|
328
|
+ if err != nil {
|
|
329
|
+ fmt.Println(err.Error())
|
|
330
|
+ return err.Error(), ""
|
|
331
|
+ }
|
|
332
|
+
|
|
333
|
+ request.Header.Set("Content-Type", "application/json;charset=UTF-8")
|
|
334
|
+ request.Header.Set("x-tif-paasid", gdyb_paasid)
|
|
335
|
+ request.Header.Set("x-tif-signature", signature)
|
|
336
|
+ request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
|
|
337
|
+ request.Header.Set("x-tif-nonce", nonce)
|
|
338
|
+
|
|
339
|
+ client := http.Client{}
|
|
340
|
+ resp, err := client.Do(request)
|
|
341
|
+ if err != nil {
|
|
342
|
+ fmt.Println(err.Error())
|
|
343
|
+ return err.Error(), ""
|
|
344
|
+ }
|
|
345
|
+ respBytes, err := ioutil.ReadAll(resp.Body)
|
|
346
|
+ if err != nil {
|
|
347
|
+ fmt.Println(err.Error())
|
|
348
|
+ return err.Error(), ""
|
|
349
|
+ }
|
|
350
|
+ str := string(respBytes)
|
|
351
|
+ fmt.Println(str)
|
|
352
|
+ return str, requestLog
|
|
353
|
+
|
258
|
354
|
}
|
259
|
355
|
|
260
|
356
|
// 门诊费用明细信息上传
|
261
|
357
|
func Nmyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescription, chrg_bchno string, org_name string, doctor string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, balance_accounts_type string, diag_code string, request_url string, access_key string, new_doctor_name string, time_stamp_2203 string, cainfo string) (string, string) {
|
|
358
|
+
|
262
|
359
|
// 生成签名
|
263
|
360
|
timestamp := time.Now().Unix()
|
264
|
361
|
// 生成签名
|
|
@@ -394,23 +491,12 @@ func Nmyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
|
394
|
491
|
feedetailInfo["bilg_dept_codg"] = dept_code // 开单科室编码
|
395
|
492
|
feedetailInfo["bilg_dept_name"] = dept // 开单科室名称
|
396
|
493
|
|
397
|
|
- if fixmedins_code == "H32092103007" {
|
398
|
|
- feedetailInfo["bilg_dr_codg"] = "D320923012139" // 开单医生编码
|
399
|
|
- feedetailInfo["bilg_dr_name"] = "王曙光" // 开单医师姓名
|
400
|
|
- feedetailInfo["acord_dept_codg"] = "" // 受单科室编码
|
401
|
|
- feedetailInfo["acord_dept_name"] = "" // 受单科室名称
|
402
|
|
- feedetailInfo["orders_dr_code"] = "D320923012139" // 受单医生编码
|
403
|
|
- feedetailInfo["orders_dr_name"] = "王曙光" // 受单医生姓名
|
404
|
|
-
|
405
|
|
- } else {
|
406
|
|
- feedetailInfo["bilg_dr_codg"] = "D371621008686" // 开单医生编码
|
407
|
|
- feedetailInfo["bilg_dr_name"] = "王云刚" // 开单医师姓名
|
408
|
|
- feedetailInfo["acord_dept_codg"] = "" // 受单科室编码
|
409
|
|
- feedetailInfo["acord_dept_name"] = "" // 受单科室名称
|
410
|
|
- feedetailInfo["orders_dr_code"] = "D371621008686" // 受单医生编码
|
411
|
|
- feedetailInfo["orders_dr_name"] = "王云刚" // 受单医生姓名
|
412
|
|
-
|
413
|
|
- }
|
|
494
|
+ feedetailInfo["bilg_dr_codg"] = doctor_id // 开单医生编码
|
|
495
|
+ feedetailInfo["bilg_dr_name"] = new_doctor_name // 开单医师姓名
|
|
496
|
+ feedetailInfo["acord_dept_codg"] = dept_code // 受单科室编码
|
|
497
|
+ feedetailInfo["acord_dept_name"] = dept // 受单科室名称
|
|
498
|
+ feedetailInfo["orders_dr_code"] = doctor_id // 受单医生编码
|
|
499
|
+ feedetailInfo["orders_dr_name"] = new_doctor_name // 受单医生姓名
|
414
|
500
|
|
415
|
501
|
if balance_accounts_type == "8" {
|
416
|
502
|
feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
|
|
@@ -553,7 +639,10 @@ func Nmyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, d
|
553
|
639
|
|
554
|
640
|
// 门诊预结算
|
555
|
641
|
func Nmyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, request_url string, access_key string, verify_number string, cainfo string, mdtrt_grp_type string) (string, string) {
|
|
642
|
+ if !strings.Contains(insuplc_admdvs, "150") {
|
556
|
643
|
|
|
644
|
+ chrgBchno = "0000"
|
|
645
|
+ }
|
557
|
646
|
// 生成签名
|
558
|
647
|
nonce := GetRandomString(32)
|
559
|
648
|
timestamp := time.Now().Unix()
|
|
@@ -571,8 +660,8 @@ func Nmyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
|
571
|
660
|
inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
|
572
|
661
|
} else {
|
573
|
662
|
if id_card_type == 1 {
|
574
|
|
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
|
575
|
|
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
|
|
663
|
+ inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
|
|
664
|
+ inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
|
576
|
665
|
} else if id_card_type == 3 {
|
577
|
666
|
inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
|
578
|
667
|
inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
|
|
@@ -580,8 +669,8 @@ func Nmyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
|
580
|
669
|
inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
|
581
|
670
|
inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
|
582
|
671
|
} else {
|
583
|
|
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
|
584
|
|
- inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
|
|
672
|
+ inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
|
|
673
|
+ inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
|
585
|
674
|
}
|
586
|
675
|
}
|
587
|
676
|
if insuplc_admdvs == "421300" {
|
|
@@ -654,6 +743,10 @@ func Nmyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
|
654
|
743
|
|
655
|
744
|
// 门诊结算
|
656
|
745
|
func Nmyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, acct_used_flag string, request_url string, access_key string, verify_number string, cainfo string, mdtrt_grp_type string) (string, string) {
|
|
746
|
+ if !strings.Contains(insuplc_admdvs, "150") {
|
|
747
|
+
|
|
748
|
+ chrgBchno = "0000"
|
|
749
|
+ }
|
657
|
750
|
// 生成签名
|
658
|
751
|
nonce := GetRandomString(32)
|
659
|
752
|
timestamp := time.Now().Unix()
|
|
@@ -665,12 +758,12 @@ func Nmyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
|
665
|
758
|
inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
|
666
|
759
|
|
667
|
760
|
if certificates == 3 {
|
668
|
|
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
|
669
|
|
- inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
|
|
761
|
+ inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
|
|
762
|
+ inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
|
670
|
763
|
} else {
|
671
|
764
|
if id_card_type == 1 {
|
672
|
|
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
|
673
|
|
- inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
|
|
765
|
+ inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
|
|
766
|
+ inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
|
674
|
767
|
} else if id_card_type == 3 {
|
675
|
768
|
inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
|
676
|
769
|
inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
|
|
@@ -678,7 +771,8 @@ func Nmyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
|
678
|
771
|
inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
|
679
|
772
|
inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
|
680
|
773
|
} else {
|
681
|
|
-
|
|
774
|
+ inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
|
|
775
|
+ inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
|
682
|
776
|
}
|
683
|
777
|
}
|
684
|
778
|
if med_type == "1111" || med_type == "1112" {
|
|
@@ -699,7 +793,7 @@ func Nmyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
|
699
|
793
|
inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
|
700
|
794
|
inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
|
701
|
795
|
inputData["insutype"] = insutype // 险种类型
|
702
|
|
- inputData["invono"] = "" // 发票号
|
|
796
|
+ inputData["invono"] = "12345" // 发票号
|
703
|
797
|
|
704
|
798
|
inputData["fulamt_ownpay_amt"] = fulamt_ownpay_amt //
|
705
|
799
|
inputData["overlmt_selfpay"] = overlmt_selfpay //
|
|
@@ -816,3 +910,88 @@ func Nmyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doct
|
816
|
910
|
str2 := string(mjson)
|
817
|
911
|
return str, str2
|
818
|
912
|
}
|
|
913
|
+
|
|
914
|
+func Nmyb2503(psnNo string, insutype string, org_name string, op string, doctor string, fixmedins_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_name string, sick_code string, start_time string, end_time string, check_time string, hospital_code string, hospital_name string) string {
|
|
915
|
+ // 生成签名
|
|
916
|
+ nonce := GetRandomString(32)
|
|
917
|
+ timestamp := time.Now().Unix()
|
|
918
|
+ signature := setSignature(timestamp, nonce, secret_key)
|
|
919
|
+ //tempTime := time.Unix(timestamp, 0)
|
|
920
|
+ //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
|
|
921
|
+
|
|
922
|
+ //timeFormatTwo := tempTime.Format("2006-01-02")
|
|
923
|
+
|
|
924
|
+ //t := time.Now()
|
|
925
|
+ //last := time.Date(t.Year(), time.December, 31, 0, 0, 0, 0, time.UTC)
|
|
926
|
+ //tm := time.Unix(last.Unix(), 0)
|
|
927
|
+
|
|
928
|
+ // 生成输入报文
|
|
929
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, op, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
|
|
930
|
+ input := make(map[string]interface{})
|
|
931
|
+ inputData := make(map[string]interface{})
|
|
932
|
+ inputMessage["infno"] = "2503" // 交易编码
|
|
933
|
+ inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
|
|
934
|
+ inputData["insutype"] = insutype // 险种类型(来自1101接口返回)
|
|
935
|
+ inputData["opsp_dise_code"] = sick_code // 险种类型(来自1101接口返回)
|
|
936
|
+ inputData["opsp_dise_name"] = sick_name // 险种类型(来自1101接口返回)
|
|
937
|
+ inputData["insu_optins"] = insuplc_admdvs // 险种类型(来自1101接口返回)
|
|
938
|
+ inputData["ide_fixmedins_no"] = hospital_code // 险种类型(来自1101接口返回)
|
|
939
|
+ inputData["ide_fixmedins_name"] = hospital_name // 险种类型(来自1101接口返回)
|
|
940
|
+ inputData["hosp_ide_date"] = check_time // 险种类型(来自1101接口返回)
|
|
941
|
+ inputData["diag_dr_codg"] = doctor_id // 开始时间
|
|
942
|
+ inputData["diag_dr_name"] = doctor // 开始时间
|
|
943
|
+ inputData["begndate"] = start_time // 医师编码
|
|
944
|
+ inputData["tel"] = "" // 医师编码
|
|
945
|
+ inputData["addr"] = "" // 医师编码
|
|
946
|
+ inputData["enddate"] = end_time // 医师编码
|
|
947
|
+
|
|
948
|
+ input["data"] = inputData
|
|
949
|
+ inputMessage["input"] = input //交易输入
|
|
950
|
+ bytesData, err := json.Marshal(inputMessage)
|
|
951
|
+ fmt.Println(string(bytesData))
|
|
952
|
+ if err != nil {
|
|
953
|
+ fmt.Println(err.Error())
|
|
954
|
+ return err.Error()
|
|
955
|
+ }
|
|
956
|
+ reader := bytes.NewReader(bytesData)
|
|
957
|
+ //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2503"
|
|
958
|
+ //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2503"
|
|
959
|
+ gdyb_url := beego.AppConfig.String("gdyb_url")
|
|
960
|
+ gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
|
|
961
|
+ //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
|
|
962
|
+ //url := gdyb_url + "2503"
|
|
963
|
+
|
|
964
|
+ var url string
|
|
965
|
+ if fixmedins_code == "H15049901371" {
|
|
966
|
+ url = gdyb_url
|
|
967
|
+ } else {
|
|
968
|
+ url = gdyb_url + "2503"
|
|
969
|
+ }
|
|
970
|
+
|
|
971
|
+ request, err := http.NewRequest("POST", url, reader)
|
|
972
|
+ if err != nil {
|
|
973
|
+ fmt.Println(err.Error())
|
|
974
|
+ return err.Error()
|
|
975
|
+ }
|
|
976
|
+
|
|
977
|
+ request.Header.Set("Content-Type", "application/json;charset=UTF-8")
|
|
978
|
+ request.Header.Set("x-tif-paasid", gdyb_paasid)
|
|
979
|
+ request.Header.Set("x-tif-signature", signature)
|
|
980
|
+ request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
|
|
981
|
+ request.Header.Set("x-tif-nonce", nonce)
|
|
982
|
+
|
|
983
|
+ client := http.Client{}
|
|
984
|
+ resp, err := client.Do(request)
|
|
985
|
+ if err != nil {
|
|
986
|
+ fmt.Println(err.Error())
|
|
987
|
+ return err.Error()
|
|
988
|
+ }
|
|
989
|
+ respBytes, err := ioutil.ReadAll(resp.Body)
|
|
990
|
+ if err != nil {
|
|
991
|
+ fmt.Println(err.Error())
|
|
992
|
+ return err.Error()
|
|
993
|
+ }
|
|
994
|
+ str := string(respBytes)
|
|
995
|
+ fmt.Println(str)
|
|
996
|
+ return str
|
|
997
|
+}
|