|
@@ -0,0 +1,648 @@
|
|
1
|
+package service
|
|
2
|
+
|
|
3
|
+import (
|
|
4
|
+ "bytes"
|
|
5
|
+ "encoding/json"
|
|
6
|
+ "fmt"
|
|
7
|
+ "gdyb/models"
|
|
8
|
+ "io/ioutil"
|
|
9
|
+ "net/http"
|
|
10
|
+ "strconv"
|
|
11
|
+ "time"
|
|
12
|
+)
|
|
13
|
+
|
|
14
|
+func GetCFYLJG001(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG001 models.CFYLJG001) (string, string) {
|
|
15
|
+ //生成签名
|
|
16
|
+ nonce := GetRandomString(32)
|
|
17
|
+ timestamp := time.Now().Unix()
|
|
18
|
+ signature := setSignature(timestamp, nonce, secret_key)
|
|
19
|
+ //生成输入报文
|
|
20
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
|
|
21
|
+ //input := make(map[string]interface{})
|
|
22
|
+ inputData := make(map[string]interface{}, 0)
|
|
23
|
+
|
|
24
|
+ inputMessage["infno"] = "CFYLJG001"
|
|
25
|
+
|
|
26
|
+ inputData["mdtrt_cert_type"] = cFYLJG001.MdtrtCertType
|
|
27
|
+ inputData["mdtrt_cert_no"] = cFYLJG001.MdtrtCertNo
|
|
28
|
+ inputData["card_sn"] = cFYLJG001.CardSn
|
|
29
|
+ inputData["ec_token"] = cFYLJG001.EcToken
|
|
30
|
+ inputData["auth_no"] = cFYLJG001.AuthNo
|
|
31
|
+ inputData["biz_type_code"] = cFYLJG001.BizTypeCode
|
|
32
|
+ inputData["insu_admdvs"] = cFYLJG001.InsuAdmdvs
|
|
33
|
+ inputData["hosp_rxno"] = cFYLJG001.HospRxno
|
|
34
|
+ inputData["init_rxno"] = cFYLJG001.InitRxno
|
|
35
|
+ inputData["rx_type_code"] = cFYLJG001.RxTypeCode
|
|
36
|
+ inputData["prsc_time"] = cFYLJG001.PrscTime
|
|
37
|
+ inputData["rx_drug_cnt"] = cFYLJG001.RxDrugCnt
|
|
38
|
+ inputData["rx_used_way_codg"] = cFYLJG001.RxUsedWayCodg
|
|
39
|
+ inputData["rx_used_way_name"] = cFYLJG001.RxUsedWayName
|
|
40
|
+ inputData["rx_frqu_codg"] = cFYLJG001.RxFrquCodg
|
|
41
|
+ inputData["rx_frqu_name"] = cFYLJG001.RxFrquName
|
|
42
|
+ inputData["rx_dosunt"] = cFYLJG001.RxDosunt
|
|
43
|
+ inputData["rx_doscnt"] = cFYLJG001.RxDoscnt
|
|
44
|
+ inputData["rx_drord_dscr"] = cFYLJG001.RxDrordDscr
|
|
45
|
+ inputData["vali_days"] = cFYLJG001.ValiDays
|
|
46
|
+ inputData["vali_end_time"] = cFYLJG001.ValiEndTime
|
|
47
|
+ inputData["rept_flag"] = cFYLJG001.ReptFlag
|
|
48
|
+ inputData["max_rept_cnt"] = cFYLJG001.MaxReptCnt
|
|
49
|
+ inputData["reptd_cnt"] = cFYLJG001.ReptdCnt
|
|
50
|
+ inputData["min_inrv_days"] = cFYLJG001.MinInrvDays
|
|
51
|
+ inputData["rx_cotn_flag"] = cFYLJG001.RxCotnFlag
|
|
52
|
+ inputData["long_rx_flag"] = cFYLJG001.LongRxFlag
|
|
53
|
+ inputData["mdtrtareaNo"] = cFYLJG001.MdtrtareaNo
|
|
54
|
+
|
|
55
|
+ rxdrugdetail := make([]map[string]interface{}, 0)
|
|
56
|
+
|
|
57
|
+ rxdrug := make(map[string]interface{})
|
|
58
|
+ for _, item := range cFYLJG001.List {
|
|
59
|
+ rxdrug["med_list_codg"] = item.MedListCodg
|
|
60
|
+ rxdrug["medins_list_codg"] = item.MedinsListCodg
|
|
61
|
+ rxdrug["hosp_prep_flag"] = item.HospPrepFlag
|
|
62
|
+ rxdrug["rx_item_type_code"] = item.RxItemTypeCode
|
|
63
|
+ rxdrug["rx_item_type_name"] = item.RxItemTypeName
|
|
64
|
+ rxdrug["tcmdrug_type_name"] = item.TcmdrugTypeName
|
|
65
|
+ rxdrug["tcmdrug_type_code"] = item.TcmdrugTypeCode
|
|
66
|
+ rxdrug["tcmherb_foote"] = item.TcmherbFoote
|
|
67
|
+ rxdrug["medn_type_code"] = item.MednTypeCode
|
|
68
|
+ rxdrug["medn_type_name"] = item.MednTypeName
|
|
69
|
+ rxdrug["main_medc_flag"] = item.MainMedcFlag
|
|
70
|
+ rxdrug["urgt_flag"] = item.UrgtFlag
|
|
71
|
+ rxdrug["bas_medn_flag"] = item.BasMednFlag
|
|
72
|
+ rxdrug["imp_drug_flag"] = item.ImpDrugFlag
|
|
73
|
+ rxdrug["drug_prodname"] = item.DrugProdname
|
|
74
|
+ rxdrug["genname_codg"] = item.GennameCodg
|
|
75
|
+ rxdrug["drug_genname"] = item.DrugGenname
|
|
76
|
+ rxdrug["drug_dosform"] = item.DrugDosform
|
|
77
|
+ rxdrug["drug_spec"] = item.DrugSpec
|
|
78
|
+ rxdrug["prdr_name"] = item.PrdrName
|
|
79
|
+ rxdrug["medc_way_codg"] = item.MedcWayCodg
|
|
80
|
+ rxdrug["medc_way_dscr"] = item.MedcWayDscr
|
|
81
|
+ rxdrug["medc_begntime"] = item.MedcBegntime
|
|
82
|
+ rxdrug["medc_endtime"] = item.MedcEndtime
|
|
83
|
+ rxdrug["medc_days"] = item.MedcDays
|
|
84
|
+ rxdrug["drug_pric"] = item.DrugPric
|
|
85
|
+ rxdrug["drug_sumamt"] = item.DrugSumamt
|
|
86
|
+ rxdrug["drug_cnt"] = item.DrugCnt
|
|
87
|
+ rxdrug["drug_dosunt"] = item.DrugDosunt
|
|
88
|
+ rxdrug["sin_doscnt"] = item.SinDoscnt
|
|
89
|
+ rxdrug["sin_dosunt"] = item.SinDosunt
|
|
90
|
+ rxdrug["used_frqu_codg"] = item.UsedFrquCodg
|
|
91
|
+ rxdrug["used_frqu_name"] = item.UsedFrquName
|
|
92
|
+ rxdrug["drug_totlcnt_emp"] = item.DrugTotlcntEmp
|
|
93
|
+ rxdrug["hosp_appr_flag"] = item.HospApprFlag
|
|
94
|
+ rxdrug["extras"] = item.Extras
|
|
95
|
+ rxdrugdetail = append(rxdrugdetail, rxdrug)
|
|
96
|
+ }
|
|
97
|
+ inputData["list"] = rxdrugdetail
|
|
98
|
+
|
|
99
|
+ mdtrtinfo := make(map[string]interface{})
|
|
100
|
+ mdtrtinfo["fixmedins_code"] = cFYLJG001.Mdtrtinfo.FixmedinsCode
|
|
101
|
+ mdtrtinfo["fixmedins_name"] = cFYLJG001.Mdtrtinfo.FixmedinsName
|
|
102
|
+ mdtrtinfo["mdtrt_id"] = cFYLJG001.Mdtrtinfo.MdtrtID
|
|
103
|
+ mdtrtinfo["med_type"] = cFYLJG001.Mdtrtinfo.MedType
|
|
104
|
+ mdtrtinfo["ipt_otp_no"] = cFYLJG001.Mdtrtinfo.IptOtpNo
|
|
105
|
+ mdtrtinfo["otp_ipt_flag"] = cFYLJG001.Mdtrtinfo.OtpIptFlag
|
|
106
|
+ mdtrtinfo["psn_no"] = cFYLJG001.Mdtrtinfo.PsnNo
|
|
107
|
+ mdtrtinfo["patn_name"] = cFYLJG001.Mdtrtinfo.PatnName
|
|
108
|
+ mdtrtinfo["psn_cert_type"] = cFYLJG001.Mdtrtinfo.PsnCertType
|
|
109
|
+ mdtrtinfo["certno"] = cFYLJG001.Mdtrtinfo.Certno
|
|
110
|
+ mdtrtinfo["patn_age"] = cFYLJG001.Mdtrtinfo.PatnAge
|
|
111
|
+ mdtrtinfo["patn_hgt"] = cFYLJG001.Mdtrtinfo.PatnHgt
|
|
112
|
+ mdtrtinfo["patn_wt"] = cFYLJG001.Mdtrtinfo.PatnWt
|
|
113
|
+ mdtrtinfo["gend"] = cFYLJG001.Mdtrtinfo.Gend
|
|
114
|
+ mdtrtinfo["birctrlType"] = cFYLJG001.Mdtrtinfo.BirctrlType
|
|
115
|
+ mdtrtinfo["birctrlMatnDate"] = cFYLJG001.Mdtrtinfo.BirctrlMatnDate
|
|
116
|
+ mdtrtinfo["matnType"] = cFYLJG001.Mdtrtinfo.MatnType
|
|
117
|
+ mdtrtinfo["geso_val"] = cFYLJG001.Mdtrtinfo.GesoVal
|
|
118
|
+ mdtrtinfo["nwb_flag"] = cFYLJG001.Mdtrtinfo.NwbFlag
|
|
119
|
+ mdtrtinfo["nwb_age"] = cFYLJG001.Mdtrtinfo.NwbAge
|
|
120
|
+ mdtrtinfo["suck_prd_flag"] = cFYLJG001.Mdtrtinfo.SuckPrdFlag
|
|
121
|
+ mdtrtinfo["algs_his"] = cFYLJG001.Mdtrtinfo.AlgsHis
|
|
122
|
+ mdtrtinfo["prsc_dept_name"] = cFYLJG001.Mdtrtinfo.PrscDeptName
|
|
123
|
+ mdtrtinfo["prsc_dept_code"] = cFYLJG001.Mdtrtinfo.PrscDeptCode
|
|
124
|
+ mdtrtinfo["dr_code"] = cFYLJG001.Mdtrtinfo.DrCode
|
|
125
|
+ mdtrtinfo["prsc_dr_name"] = cFYLJG001.Mdtrtinfo.PrscDrName
|
|
126
|
+ mdtrtinfo["prsc_dr_cert_type"] = cFYLJG001.Mdtrtinfo.PrscDrCertType
|
|
127
|
+ mdtrtinfo["prsc_dr_certno"] = cFYLJG001.Mdtrtinfo.PrscDrCertno
|
|
128
|
+ mdtrtinfo["dr_profttl_codg"] = cFYLJG001.Mdtrtinfo.DrProfttlCodg
|
|
129
|
+ mdtrtinfo["dr_profttl_name"] = cFYLJG001.Mdtrtinfo.DrProfttlName
|
|
130
|
+ mdtrtinfo["dr_dept_code"] = cFYLJG001.Mdtrtinfo.DrDeptCode
|
|
131
|
+ mdtrtinfo["dr_dept_name"] = cFYLJG001.Mdtrtinfo.DrDeptName
|
|
132
|
+ mdtrtinfo["caty"] = cFYLJG001.Mdtrtinfo.Caty
|
|
133
|
+ mdtrtinfo["mdtrt_time"] = cFYLJG001.Mdtrtinfo.MdtrtTime
|
|
134
|
+ mdtrtinfo["dise_codg"] = cFYLJG001.Mdtrtinfo.DiseCodg
|
|
135
|
+ mdtrtinfo["dise_name"] = cFYLJG001.Mdtrtinfo.DiseName
|
|
136
|
+ mdtrtinfo["sp_dise_flag"] = cFYLJG001.Mdtrtinfo.SpDiseFlag
|
|
137
|
+ mdtrtinfo["maindiag_code"] = cFYLJG001.Mdtrtinfo.MaindiagCode
|
|
138
|
+ mdtrtinfo["maindiag_name"] = cFYLJG001.Mdtrtinfo.MaindiagName
|
|
139
|
+ mdtrtinfo["dise_cond_dscr"] = cFYLJG001.Mdtrtinfo.DiseCondDscr
|
|
140
|
+ mdtrtinfo["hi_feesetl_flag"] = cFYLJG001.Mdtrtinfo.HiFeesetlFlag
|
|
141
|
+ mdtrtinfo["hi_feesetl_name"] = cFYLJG001.Mdtrtinfo.HiFeesetlName
|
|
142
|
+ mdtrtinfo["rgst_fee"] = cFYLJG001.Mdtrtinfo.RgstFee
|
|
143
|
+ mdtrtinfo["medfee_sumamt"] = cFYLJG001.Mdtrtinfo.MedfeeSumamt
|
|
144
|
+ mdtrtinfo["fstdiag_flag"] = cFYLJG001.Mdtrtinfo.FstdiagFlag
|
|
145
|
+ mdtrtinfo["extras"] = cFYLJG001.Mdtrtinfo.Extras
|
|
146
|
+ inputData["mdtrtinfo"] = mdtrtinfo
|
|
147
|
+
|
|
148
|
+ diseinfos := make([]map[string]interface{}, 0)
|
|
149
|
+
|
|
150
|
+ for _, item := range cFYLJG001.Diseinfo {
|
|
151
|
+ diseinfo := make(map[string]interface{})
|
|
152
|
+ diseinfo["diag_type"] = item.DiagType
|
|
153
|
+ diseinfo["maindiag_flag"] = item.MaindiagFlag
|
|
154
|
+ diseinfo["diag_srt_no"] = item.DiagSrtNo
|
|
155
|
+ diseinfo["diag_code"] = item.DiagCode
|
|
156
|
+ diseinfo["diag_name"] = item.DiagName
|
|
157
|
+ diseinfo["diag_dept"] = item.DiagDept
|
|
158
|
+ diseinfo["diag_dr_no"] = item.DiagDrNo
|
|
159
|
+ diseinfo["diag_dr_name"] = item.DiagDrName
|
|
160
|
+ diseinfo["diag_time"] = item.DiagTime
|
|
161
|
+ diseinfo["tcm_dise_code"] = item.TcmDiseCode
|
|
162
|
+ diseinfo["tcm_dise_name"] = item.TcmDiseName
|
|
163
|
+ diseinfo["tcmsymp_code"] = item.TcmsympCode
|
|
164
|
+ diseinfo["tcmsymp"] = item.Tcmsymp
|
|
165
|
+ diseinfos = append(diseinfos, diseinfo)
|
|
166
|
+ }
|
|
167
|
+ inputData["diseinfo"] = diseinfos
|
|
168
|
+
|
|
169
|
+ inputMessage["input"] = inputData
|
|
170
|
+
|
|
171
|
+ var inputLog string
|
|
172
|
+ bytesData, err := json.Marshal(inputMessage)
|
|
173
|
+ inputLog = string(bytesData)
|
|
174
|
+ fmt.Println(string(bytesData))
|
|
175
|
+ if err != nil {
|
|
176
|
+ fmt.Println(err.Error())
|
|
177
|
+ return err.Error(), ""
|
|
178
|
+ }
|
|
179
|
+ reader := bytes.NewReader(bytesData)
|
|
180
|
+ gdyb_url := beego.AppConfig.String("gdyb_url")
|
|
181
|
+ gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
|
|
182
|
+
|
|
183
|
+ var url string
|
|
184
|
+ if fixmedins_code == "H15049901371" {
|
|
185
|
+ url = gdyb_url
|
|
186
|
+ } else {
|
|
187
|
+ url = gdyb_url + "CFYLJG001"
|
|
188
|
+ }
|
|
189
|
+
|
|
190
|
+ //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
|
|
191
|
+ request, err := http.NewRequest("POST", url, reader)
|
|
192
|
+ if err != nil {
|
|
193
|
+ fmt.Println(err.Error())
|
|
194
|
+ return err.Error(), ""
|
|
195
|
+ }
|
|
196
|
+
|
|
197
|
+ request.Header.Set("Content-Type", "application/json;charset=UTF-8")
|
|
198
|
+ request.Header.Set("x-tif-paasid", gdyb_paasid)
|
|
199
|
+ request.Header.Set("x-tif-signature", signature)
|
|
200
|
+ request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
|
|
201
|
+ request.Header.Set("x-tif-nonce", nonce)
|
|
202
|
+
|
|
203
|
+ client := http.Client{}
|
|
204
|
+ resp, err := client.Do(request)
|
|
205
|
+ if err != nil {
|
|
206
|
+ fmt.Println(err.Error())
|
|
207
|
+ return err.Error(), ""
|
|
208
|
+ }
|
|
209
|
+ respBytes, err := ioutil.ReadAll(resp.Body)
|
|
210
|
+ if err != nil {
|
|
211
|
+ fmt.Println(err.Error())
|
|
212
|
+ return err.Error(), ""
|
|
213
|
+ }
|
|
214
|
+ fmt.Println(string(respBytes))
|
|
215
|
+ str := string(respBytes)
|
|
216
|
+ return str, inputLog
|
|
217
|
+
|
|
218
|
+}
|
|
219
|
+
|
|
220
|
+func GetCFYLJG002(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, original_value string, original_rx_file string, extras string) (string, string) {
|
|
221
|
+ //生成签名
|
|
222
|
+ nonce := GetRandomString(32)
|
|
223
|
+ timestamp := time.Now().Unix()
|
|
224
|
+ signature := setSignature(timestamp, nonce, secret_key)
|
|
225
|
+ //生成输入报文
|
|
226
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
|
|
227
|
+ inputData := make(map[string]interface{})
|
|
228
|
+ //inputData := makemap[string]interface{})
|
|
229
|
+
|
|
230
|
+ inputMessage["infno"] = "CFYLJG002"
|
|
231
|
+ inputData["fixmedins_code"] = fixmedins_code
|
|
232
|
+ inputData["original_value"] = original_value
|
|
233
|
+ inputData["original_rx_file"] = original_rx_file
|
|
234
|
+ inputData["extras"] = extras
|
|
235
|
+ inputMessage["rx_sign_info"] = inputData
|
|
236
|
+
|
|
237
|
+ var inputLog string
|
|
238
|
+ bytesData, err := json.Marshal(inputMessage)
|
|
239
|
+ inputLog = string(bytesData)
|
|
240
|
+ fmt.Println(string(bytesData))
|
|
241
|
+ if err != nil {
|
|
242
|
+ fmt.Println(err.Error())
|
|
243
|
+ return err.Error(), ""
|
|
244
|
+ }
|
|
245
|
+ reader := bytes.NewReader(bytesData)
|
|
246
|
+ gdyb_url := beego.AppConfig.String("gdyb_url")
|
|
247
|
+ gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
|
|
248
|
+
|
|
249
|
+ var url string
|
|
250
|
+ if fixmedins_code == "H15049901371" {
|
|
251
|
+ url = gdyb_url
|
|
252
|
+ } else {
|
|
253
|
+ url = gdyb_url + "CFYLJG002"
|
|
254
|
+ }
|
|
255
|
+
|
|
256
|
+ //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
|
|
257
|
+ request, err := http.NewRequest("POST", url, reader)
|
|
258
|
+ if err != nil {
|
|
259
|
+ fmt.Println(err.Error())
|
|
260
|
+ return err.Error(), ""
|
|
261
|
+ }
|
|
262
|
+
|
|
263
|
+ request.Header.Set("Content-Type", "application/json;charset=UTF-8")
|
|
264
|
+ request.Header.Set("x-tif-paasid", gdyb_paasid)
|
|
265
|
+ request.Header.Set("x-tif-signature", signature)
|
|
266
|
+ request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
|
|
267
|
+ request.Header.Set("x-tif-nonce", nonce)
|
|
268
|
+
|
|
269
|
+ client := http.Client{}
|
|
270
|
+ resp, err := client.Do(request)
|
|
271
|
+ if err != nil {
|
|
272
|
+ fmt.Println(err.Error())
|
|
273
|
+ return err.Error(), ""
|
|
274
|
+ }
|
|
275
|
+ respBytes, err := ioutil.ReadAll(resp.Body)
|
|
276
|
+ if err != nil {
|
|
277
|
+ fmt.Println(err.Error())
|
|
278
|
+ return err.Error(), ""
|
|
279
|
+ }
|
|
280
|
+ fmt.Println(string(respBytes))
|
|
281
|
+ str := string(respBytes)
|
|
282
|
+ return str, inputLog
|
|
283
|
+
|
|
284
|
+}
|
|
285
|
+
|
|
286
|
+func GetCFYLJG003(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG003 models.CFYLJG003) (string, string) {
|
|
287
|
+ //生成签名
|
|
288
|
+ nonce := GetRandomString(32)
|
|
289
|
+ timestamp := time.Now().Unix()
|
|
290
|
+ signature := setSignature(timestamp, nonce, secret_key)
|
|
291
|
+ //生成输入报文
|
|
292
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
|
|
293
|
+ input := make(map[string]interface{})
|
|
294
|
+ inputDatas := make([]map[string]interface{}, 0)
|
|
295
|
+
|
|
296
|
+ inputMessage["infno"] = "CFYLJG003"
|
|
297
|
+
|
|
298
|
+ inputData["rx_trace_code"] = cFYLJG003.RxTraceCode
|
|
299
|
+ inputData["hi_rxno"] = cFYLJG003.HiRxno
|
|
300
|
+ inputData["mdtrt_id"] = cFYLJG003.MdtrtID
|
|
301
|
+ inputData["patn_name"] = cFYLJG003.PatnName
|
|
302
|
+ inputData["psn_cert_type"] = cFYLJG003.PsnCertType
|
|
303
|
+ inputData["certno"] = cFYLJG003.Certno
|
|
304
|
+ inputData["fixmedins_name"] = cFYLJG003.FixmedinsName
|
|
305
|
+ inputData["fixmedins_code"] = cFYLJG003.FixmedinsCode
|
|
306
|
+ inputData["dr_code"] = cFYLJG003.DrCode
|
|
307
|
+ inputData["prsc_dr_name"] = cFYLJG003.PrscDrName
|
|
308
|
+ inputData["phar_dept_name"] = cFYLJG003.PharDeptName
|
|
309
|
+ inputData["phar_dept_code"] = cFYLJG003.PharDeptCode
|
|
310
|
+ inputData["phar_profttl_codg"] = cFYLJG003.PharProfttlCodg
|
|
311
|
+ inputData["phar_profttl_name"] = cFYLJG003.PharProfttlName
|
|
312
|
+ inputData["phar_code"] = cFYLJG003.PharCode
|
|
313
|
+ inputData["rx_frqu_name"] = cFYLJG003.RxFrquName
|
|
314
|
+ inputData["phar_cert_type"] = cFYLJG003.PsnCertType
|
|
315
|
+ inputData["phar_certno"] = cFYLJG003.PharCertno
|
|
316
|
+ inputData["phar_name"] = cFYLJG003.PharName
|
|
317
|
+ inputData["phar_prac_cert_no"] = cFYLJG003.PharPracCertNo
|
|
318
|
+ inputData["phar_chk_time"] = cFYLJG003.PharChkTime
|
|
319
|
+ inputData["rx_file"] = cFYLJG003.RxFile
|
|
320
|
+ inputData["sign_digest"] = cFYLJG003.SignDigest
|
|
321
|
+ inputMessage["rx_upload_info"] = inputData
|
|
322
|
+ var inputLog string
|
|
323
|
+ bytesData, err := json.Marshal(inputMessage)
|
|
324
|
+ inputLog = string(bytesData)
|
|
325
|
+ fmt.Println(string(bytesData))
|
|
326
|
+ if err != nil {
|
|
327
|
+ fmt.Println(err.Error())
|
|
328
|
+ return err.Error(), ""
|
|
329
|
+ }
|
|
330
|
+ reader := bytes.NewReader(bytesData)
|
|
331
|
+ gdyb_url := beego.AppConfig.String("gdyb_url")
|
|
332
|
+ gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
|
|
333
|
+
|
|
334
|
+ var url string
|
|
335
|
+ if fixmedins_code == "H15049901371" {
|
|
336
|
+ url = gdyb_url
|
|
337
|
+ } else {
|
|
338
|
+ url = gdyb_url + "CFYLJG003"
|
|
339
|
+ }
|
|
340
|
+
|
|
341
|
+ //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
|
|
342
|
+ request, err := http.NewRequest("POST", url, reader)
|
|
343
|
+ if err != nil {
|
|
344
|
+ fmt.Println(err.Error())
|
|
345
|
+ return err.Error(), ""
|
|
346
|
+ }
|
|
347
|
+
|
|
348
|
+ request.Header.Set("Content-Type", "application/json;charset=UTF-8")
|
|
349
|
+ request.Header.Set("x-tif-paasid", gdyb_paasid)
|
|
350
|
+ request.Header.Set("x-tif-signature", signature)
|
|
351
|
+ request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
|
|
352
|
+ request.Header.Set("x-tif-nonce", nonce)
|
|
353
|
+
|
|
354
|
+ client := http.Client{}
|
|
355
|
+ resp, err := client.Do(request)
|
|
356
|
+ if err != nil {
|
|
357
|
+ fmt.Println(err.Error())
|
|
358
|
+ return err.Error(), ""
|
|
359
|
+ }
|
|
360
|
+ respBytes, err := ioutil.ReadAll(resp.Body)
|
|
361
|
+ if err != nil {
|
|
362
|
+ fmt.Println(err.Error())
|
|
363
|
+ return err.Error(), ""
|
|
364
|
+ }
|
|
365
|
+ fmt.Println(string(respBytes))
|
|
366
|
+ str := string(respBytes)
|
|
367
|
+ return str, inputLog
|
|
368
|
+
|
|
369
|
+}
|
|
370
|
+
|
|
371
|
+func GetCFYLJG004(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG004 models.CFYLJG004) (string, string) {
|
|
372
|
+ //生成签名
|
|
373
|
+ nonce := GetRandomString(32)
|
|
374
|
+ timestamp := time.Now().Unix()
|
|
375
|
+ signature := setSignature(timestamp, nonce, secret_key)
|
|
376
|
+ //生成输入报文
|
|
377
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
|
|
378
|
+ input := make(map[string]interface{})
|
|
379
|
+ inputDatas := make([]map[string]interface{}, 0)
|
|
380
|
+
|
|
381
|
+ inputMessage["infno"] = "CFYLJG004"
|
|
382
|
+
|
|
383
|
+ inputData["hi_rxno"] = cFYLJG004.HiRxno
|
|
384
|
+ inputData["undo_dr_code"] = cFYLJG004.UndoDrCode
|
|
385
|
+ inputData["undo_dr_name"] = cFYLJG004.UndoDrName
|
|
386
|
+ inputData["undo_dr_cert_type"] = cFYLJG004.UndoDrCertType
|
|
387
|
+ inputData["undo_dr_certno"] = cFYLJG004.UndoDrCertno
|
|
388
|
+ inputData["undo_rea"] = cFYLJG004.UndoRea
|
|
389
|
+ inputData["undo_time"] = cFYLJG004.UndoTime
|
|
390
|
+ inputData["fixmedins_code"] = cFYLJG004.FixmedinsCode
|
|
391
|
+
|
|
392
|
+ inputMessage["rx_cancel_info"] = inputData
|
|
393
|
+ var inputLog string
|
|
394
|
+ bytesData, err := json.Marshal(inputMessage)
|
|
395
|
+ inputLog = string(bytesData)
|
|
396
|
+ fmt.Println(string(bytesData))
|
|
397
|
+ if err != nil {
|
|
398
|
+ fmt.Println(err.Error())
|
|
399
|
+ return err.Error(), ""
|
|
400
|
+ }
|
|
401
|
+ reader := bytes.NewReader(bytesData)
|
|
402
|
+ gdyb_url := beego.AppConfig.String("gdyb_url")
|
|
403
|
+ gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
|
|
404
|
+
|
|
405
|
+ var url string
|
|
406
|
+ if fixmedins_code == "H15049901371" {
|
|
407
|
+ url = gdyb_url
|
|
408
|
+ } else {
|
|
409
|
+ url = gdyb_url + "CFYLJG004"
|
|
410
|
+ }
|
|
411
|
+
|
|
412
|
+ //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
|
|
413
|
+ request, err := http.NewRequest("POST", url, reader)
|
|
414
|
+ if err != nil {
|
|
415
|
+ fmt.Println(err.Error())
|
|
416
|
+ return err.Error(), ""
|
|
417
|
+ }
|
|
418
|
+
|
|
419
|
+ request.Header.Set("Content-Type", "application/json;charset=UTF-8")
|
|
420
|
+ request.Header.Set("x-tif-paasid", gdyb_paasid)
|
|
421
|
+ request.Header.Set("x-tif-signature", signature)
|
|
422
|
+ request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
|
|
423
|
+ request.Header.Set("x-tif-nonce", nonce)
|
|
424
|
+
|
|
425
|
+ client := http.Client{}
|
|
426
|
+ resp, err := client.Do(request)
|
|
427
|
+ if err != nil {
|
|
428
|
+ fmt.Println(err.Error())
|
|
429
|
+ return err.Error(), ""
|
|
430
|
+ }
|
|
431
|
+ respBytes, err := ioutil.ReadAll(resp.Body)
|
|
432
|
+ if err != nil {
|
|
433
|
+ fmt.Println(err.Error())
|
|
434
|
+ return err.Error(), ""
|
|
435
|
+ }
|
|
436
|
+ fmt.Println(string(respBytes))
|
|
437
|
+ str := string(respBytes)
|
|
438
|
+ return str, inputLog
|
|
439
|
+
|
|
440
|
+}
|
|
441
|
+
|
|
442
|
+func GetCFYLJG005(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG005 models.CFYLJG005) (string, string) {
|
|
443
|
+ //生成签名
|
|
444
|
+ nonce := GetRandomString(32)
|
|
445
|
+ timestamp := time.Now().Unix()
|
|
446
|
+ signature := setSignature(timestamp, nonce, secret_key)
|
|
447
|
+ //生成输入报文
|
|
448
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
|
|
449
|
+ input := make(map[string]interface{})
|
|
450
|
+ inputDatas := make([]map[string]interface{}, 0)
|
|
451
|
+
|
|
452
|
+ inputMessage["infno"] = "CFYLJG005"
|
|
453
|
+
|
|
454
|
+ inputData["fixmedins_code"] = cFYLJG005.FixmedinsCode
|
|
455
|
+
|
|
456
|
+ inputData["hi_rxno"] = cFYLJG005.HiRxno
|
|
457
|
+ inputData["mdtrt_id"] = cFYLJG005.MdtrtID
|
|
458
|
+ inputData["ec_token"] = cFYLJG005.EcToken
|
|
459
|
+ inputData["psn_name"] = cFYLJG005.PsnName
|
|
460
|
+ inputData["psn_cert_type"] = cFYLJG005.PsnCertType
|
|
461
|
+ inputData["certno"] = cFYLJG005.Certno
|
|
462
|
+
|
|
463
|
+ inputMessage["rx_detl_query"] = inputData
|
|
464
|
+ var inputLog string
|
|
465
|
+ bytesData, err := json.Marshal(inputMessage)
|
|
466
|
+ inputLog = string(bytesData)
|
|
467
|
+ fmt.Println(string(bytesData))
|
|
468
|
+ if err != nil {
|
|
469
|
+ fmt.Println(err.Error())
|
|
470
|
+ return err.Error(), ""
|
|
471
|
+ }
|
|
472
|
+ reader := bytes.NewReader(bytesData)
|
|
473
|
+ gdyb_url := beego.AppConfig.String("gdyb_url")
|
|
474
|
+ gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
|
|
475
|
+
|
|
476
|
+ var url string
|
|
477
|
+ if fixmedins_code == "H15049901371" {
|
|
478
|
+ url = gdyb_url
|
|
479
|
+ } else {
|
|
480
|
+ url = gdyb_url + "CFYLJG005"
|
|
481
|
+ }
|
|
482
|
+
|
|
483
|
+ //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
|
|
484
|
+ request, err := http.NewRequest("POST", url, reader)
|
|
485
|
+ if err != nil {
|
|
486
|
+ fmt.Println(err.Error())
|
|
487
|
+ return err.Error(), ""
|
|
488
|
+ }
|
|
489
|
+
|
|
490
|
+ request.Header.Set("Content-Type", "application/json;charset=UTF-8")
|
|
491
|
+ request.Header.Set("x-tif-paasid", gdyb_paasid)
|
|
492
|
+ request.Header.Set("x-tif-signature", signature)
|
|
493
|
+ request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
|
|
494
|
+ request.Header.Set("x-tif-nonce", nonce)
|
|
495
|
+
|
|
496
|
+ client := http.Client{}
|
|
497
|
+ resp, err := client.Do(request)
|
|
498
|
+ if err != nil {
|
|
499
|
+ fmt.Println(err.Error())
|
|
500
|
+ return err.Error(), ""
|
|
501
|
+ }
|
|
502
|
+ respBytes, err := ioutil.ReadAll(resp.Body)
|
|
503
|
+ if err != nil {
|
|
504
|
+ fmt.Println(err.Error())
|
|
505
|
+ return err.Error(), ""
|
|
506
|
+ }
|
|
507
|
+ fmt.Println(string(respBytes))
|
|
508
|
+ str := string(respBytes)
|
|
509
|
+ return str, inputLog
|
|
510
|
+
|
|
511
|
+}
|
|
512
|
+
|
|
513
|
+func GetCFYLJG006(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG006 models.CFYLJG006) (string, string) {
|
|
514
|
+ //生成签名
|
|
515
|
+ nonce := GetRandomString(32)
|
|
516
|
+ timestamp := time.Now().Unix()
|
|
517
|
+ signature := setSignature(timestamp, nonce, secret_key)
|
|
518
|
+ //生成输入报文
|
|
519
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
|
|
520
|
+ input := make(map[string]interface{})
|
|
521
|
+ inputDatas := make([]map[string]interface{}, 0)
|
|
522
|
+
|
|
523
|
+ inputMessage["infno"] = "CFYLJG006"
|
|
524
|
+
|
|
525
|
+ inputData["fixmedins_code"] = cFYLJG006.FixmedinsCode
|
|
526
|
+ inputData["hi_rxno"] = cFYLJG006.HiRxno
|
|
527
|
+ inputData["mdtrt_id"] = cFYLJG006.MdtrtID
|
|
528
|
+ inputData["psn_cert_type"] = cFYLJG006.PsnCertType
|
|
529
|
+ inputData["certno"] = cFYLJG006.Certno
|
|
530
|
+ inputData["psn_name"] = cFYLJG006.PsnName
|
|
531
|
+
|
|
532
|
+ inputMessage["rx_chk_info"] = inputData
|
|
533
|
+ var inputLog string
|
|
534
|
+ bytesData, err := json.Marshal(inputMessage)
|
|
535
|
+ inputLog = string(bytesData)
|
|
536
|
+ fmt.Println(string(bytesData))
|
|
537
|
+ if err != nil {
|
|
538
|
+ fmt.Println(err.Error())
|
|
539
|
+ return err.Error(), ""
|
|
540
|
+ }
|
|
541
|
+ reader := bytes.NewReader(bytesData)
|
|
542
|
+ gdyb_url := beego.AppConfig.String("gdyb_url")
|
|
543
|
+ gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
|
|
544
|
+
|
|
545
|
+ var url string
|
|
546
|
+ if fixmedins_code == "H15049901371" {
|
|
547
|
+ url = gdyb_url
|
|
548
|
+ } else {
|
|
549
|
+ url = gdyb_url + "CFYLJG006"
|
|
550
|
+ }
|
|
551
|
+
|
|
552
|
+ //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
|
|
553
|
+ request, err := http.NewRequest("POST", url, reader)
|
|
554
|
+ if err != nil {
|
|
555
|
+ fmt.Println(err.Error())
|
|
556
|
+ return err.Error(), ""
|
|
557
|
+ }
|
|
558
|
+
|
|
559
|
+ request.Header.Set("Content-Type", "application/json;charset=UTF-8")
|
|
560
|
+ request.Header.Set("x-tif-paasid", gdyb_paasid)
|
|
561
|
+ request.Header.Set("x-tif-signature", signature)
|
|
562
|
+ request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
|
|
563
|
+ request.Header.Set("x-tif-nonce", nonce)
|
|
564
|
+
|
|
565
|
+ client := http.Client{}
|
|
566
|
+ resp, err := client.Do(request)
|
|
567
|
+ if err != nil {
|
|
568
|
+ fmt.Println(err.Error())
|
|
569
|
+ return err.Error(), ""
|
|
570
|
+ }
|
|
571
|
+ respBytes, err := ioutil.ReadAll(resp.Body)
|
|
572
|
+ if err != nil {
|
|
573
|
+ fmt.Println(err.Error())
|
|
574
|
+ return err.Error(), ""
|
|
575
|
+ }
|
|
576
|
+ fmt.Println(string(respBytes))
|
|
577
|
+ str := string(respBytes)
|
|
578
|
+ return str, inputLog
|
|
579
|
+
|
|
580
|
+}
|
|
581
|
+func GetCFYLJG007(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG007 models.CFYLJG007) (string, string) {
|
|
582
|
+ //生成签名
|
|
583
|
+ nonce := GetRandomString(32)
|
|
584
|
+ timestamp := time.Now().Unix()
|
|
585
|
+ signature := setSignature(timestamp, nonce, secret_key)
|
|
586
|
+ //生成输入报文
|
|
587
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
|
|
588
|
+ input := make(map[string]interface{})
|
|
589
|
+ inputDatas := make([]map[string]interface{}, 0)
|
|
590
|
+
|
|
591
|
+ inputMessage["infno"] = "CFYLJG007"
|
|
592
|
+
|
|
593
|
+ inputData["fixmedins_code"] = cFYLJG007.FixmedinsCode
|
|
594
|
+ inputData["hi_rxno"] = cFYLJG007.HiRxno
|
|
595
|
+ inputData["mdtrt_id"] = cFYLJG007.MdtrtID
|
|
596
|
+ inputData["psn_no"] = cFYLJG007.PsnNo
|
|
597
|
+ inputData["psn_cert_type"] = cFYLJG007.PsnCertType
|
|
598
|
+ inputData["certno"] = cFYLJG007.Certno
|
|
599
|
+
|
|
600
|
+ inputMessage["rx_setl_query"] = inputData
|
|
601
|
+ var inputLog string
|
|
602
|
+ bytesData, err := json.Marshal(inputMessage)
|
|
603
|
+ inputLog = string(bytesData)
|
|
604
|
+ fmt.Println(string(bytesData))
|
|
605
|
+ if err != nil {
|
|
606
|
+ fmt.Println(err.Error())
|
|
607
|
+ return err.Error(), ""
|
|
608
|
+ }
|
|
609
|
+ reader := bytes.NewReader(bytesData)
|
|
610
|
+ gdyb_url := beego.AppConfig.String("gdyb_url")
|
|
611
|
+ gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
|
|
612
|
+
|
|
613
|
+ var url string
|
|
614
|
+ if fixmedins_code == "H15049901371" {
|
|
615
|
+ url = gdyb_url
|
|
616
|
+ } else {
|
|
617
|
+ url = gdyb_url + "CFYLJG007"
|
|
618
|
+ }
|
|
619
|
+
|
|
620
|
+ //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
|
|
621
|
+ request, err := http.NewRequest("POST", url, reader)
|
|
622
|
+ if err != nil {
|
|
623
|
+ fmt.Println(err.Error())
|
|
624
|
+ return err.Error(), ""
|
|
625
|
+ }
|
|
626
|
+
|
|
627
|
+ request.Header.Set("Content-Type", "application/json;charset=UTF-8")
|
|
628
|
+ request.Header.Set("x-tif-paasid", gdyb_paasid)
|
|
629
|
+ request.Header.Set("x-tif-signature", signature)
|
|
630
|
+ request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
|
|
631
|
+ request.Header.Set("x-tif-nonce", nonce)
|
|
632
|
+
|
|
633
|
+ client := http.Client{}
|
|
634
|
+ resp, err := client.Do(request)
|
|
635
|
+ if err != nil {
|
|
636
|
+ fmt.Println(err.Error())
|
|
637
|
+ return err.Error(), ""
|
|
638
|
+ }
|
|
639
|
+ respBytes, err := ioutil.ReadAll(resp.Body)
|
|
640
|
+ if err != nil {
|
|
641
|
+ fmt.Println(err.Error())
|
|
642
|
+ return err.Error(), ""
|
|
643
|
+ }
|
|
644
|
+ fmt.Println(string(respBytes))
|
|
645
|
+ str := string(respBytes)
|
|
646
|
+ return str, inputLog
|
|
647
|
+
|
|
648
|
+}
|