|
@@ -152,6 +152,80 @@ func Gdyb2201(psnNo string, insutype string, certNo string, org_name string, doc
|
152
|
152
|
return str
|
153
|
153
|
}
|
154
|
154
|
|
|
155
|
+func Gdyb2201ForGzyb(psnNo string, insutype string, certNo string, org_name string, doctor 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, psn_name string) string {
|
|
156
|
+ // 生成签名
|
|
157
|
+ nonce := GetRandomString(32)
|
|
158
|
+ timestamp := time.Now().Unix()
|
|
159
|
+ signature := setSignature(timestamp, nonce, secret_key)
|
|
160
|
+ tempTime := time.Unix(timestamp, 0)
|
|
161
|
+ timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
|
|
162
|
+
|
|
163
|
+ // 生成输入报文
|
|
164
|
+ inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
|
|
165
|
+ input := make(map[string]interface{})
|
|
166
|
+ inputData := make(map[string]interface{})
|
|
167
|
+ inputData2 := make(map[string]interface{})
|
|
168
|
+
|
|
169
|
+ inputMessage["infno"] = "2201" // 交易编码
|
|
170
|
+ inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
|
|
171
|
+ inputData["insutype"] = insutype // 险种类型(来自1101接口返回)
|
|
172
|
+ inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
|
|
173
|
+ inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
|
|
174
|
+ inputData["hcard_basinfo"] = "" // 就诊凭证编号
|
|
175
|
+ inputData["hcard_chkinfo"] = "" // 就诊凭证编号
|
|
176
|
+ inputData["begntime"] = timeFormatOne // 开始时间
|
|
177
|
+ inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
|
|
178
|
+ inputData["dept_code"] = dept_code // 科室编码
|
|
179
|
+ inputData["dept_name"] = dept // 科室名称
|
|
180
|
+ inputData["atddr_no"] = doctor_id // 医师编码
|
|
181
|
+ inputData["dr_name"] = doctor // 医师姓名
|
|
182
|
+ inputData["caty"] = "A03.06" // 科别
|
|
183
|
+ input["mdtrtinfo"] = inputData
|
|
184
|
+ inputData2["agnter_name"] = psn_name
|
|
185
|
+ inputData2["gnter_rlts"] = "01"
|
|
186
|
+ inputData2["agnter_cert_type"] = "01"
|
|
187
|
+ inputData2["agnter_certno"] = certNo
|
|
188
|
+ inputData2["agnter_tel"] = "13535547901"
|
|
189
|
+ inputData2["agnter_addr"] = "xxxxxx"
|
|
190
|
+ inputData2["agnter_photo"] = "xxxxxxx"
|
|
191
|
+ input["agnterinfo"] = inputData2
|
|
192
|
+ inputMessage["input"] = input //交易输入
|
|
193
|
+ bytesData, err := json.Marshal(inputMessage)
|
|
194
|
+ fmt.Println(string(bytesData))
|
|
195
|
+ if err != nil {
|
|
196
|
+ fmt.Println(err.Error())
|
|
197
|
+ return err.Error()
|
|
198
|
+ }
|
|
199
|
+ reader := bytes.NewReader(bytesData)
|
|
200
|
+ url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2201"
|
|
201
|
+ request, err := http.NewRequest("POST", url, reader)
|
|
202
|
+ if err != nil {
|
|
203
|
+ fmt.Println(err.Error())
|
|
204
|
+ return err.Error()
|
|
205
|
+ }
|
|
206
|
+
|
|
207
|
+ request.Header.Set("Content-Type", "application/json;charset=UTF-8")
|
|
208
|
+ request.Header.Set("x-tif-paasid", "sg03_prd")
|
|
209
|
+ request.Header.Set("x-tif-signature", signature)
|
|
210
|
+ request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
|
|
211
|
+ request.Header.Set("x-tif-nonce", nonce)
|
|
212
|
+
|
|
213
|
+ client := http.Client{}
|
|
214
|
+ resp, err := client.Do(request)
|
|
215
|
+ if err != nil {
|
|
216
|
+ fmt.Println(err.Error())
|
|
217
|
+ return err.Error()
|
|
218
|
+ }
|
|
219
|
+ respBytes, err := ioutil.ReadAll(resp.Body)
|
|
220
|
+ if err != nil {
|
|
221
|
+ fmt.Println(err.Error())
|
|
222
|
+ return err.Error()
|
|
223
|
+ }
|
|
224
|
+ str := string(respBytes)
|
|
225
|
+ fmt.Println(str)
|
|
226
|
+ return str
|
|
227
|
+}
|
|
228
|
+
|
155
|
229
|
// 门诊挂号撤销
|
156
|
230
|
func Gdyb2202(psnNo string, mdtrtId string, ipt_otp_no string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
|
157
|
231
|
// 生成签名
|