|
@@ -2,7 +2,7 @@ package sg
|
2
|
2
|
|
3
|
3
|
import (
|
4
|
4
|
"archive/zip"
|
5
|
|
- "bytes"
|
|
5
|
+ //"bytes"
|
6
|
6
|
"encoding/json"
|
7
|
7
|
"fmt"
|
8
|
8
|
"gdyb/controllers"
|
|
@@ -2159,30 +2159,16 @@ func (c *HisApiController) GetUploadInfo() {
|
2159
|
2159
|
}
|
2160
|
2160
|
config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
2161
|
2161
|
if config.IsOpen == 1 { //对接了医保,走医保流程
|
2162
|
|
- bytesData, _ := json.Marshal(data)
|
2163
|
|
- req, _ := http.NewRequest("POST", "http://127.0.0.1:9532/"+"gdyb/five", bytes.NewReader(bytesData))
|
2164
|
|
- resp, _ := client.Do(req)
|
2165
|
|
- defer resp.Body.Close()
|
2166
|
|
- body, ioErr := ioutil.ReadAll(resp.Body)
|
2167
|
|
- if ioErr != nil {
|
2168
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
2169
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2170
|
|
- return
|
2171
|
|
- }
|
2172
|
|
- var respJSON map[string]interface{}
|
2173
|
|
- if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
|
2174
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
2175
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2176
|
|
- return
|
2177
|
|
- }
|
2178
|
|
-
|
2179
|
|
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
2180
|
|
- userJSONBytes, _ := json.Marshal(respJSON)
|
2181
|
|
-
|
2182
|
|
- request_respJSON := respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
|
2183
|
|
- requestJSONBytes, _ := json.Marshal(request_respJSON)
|
2184
|
2162
|
|
2185
|
|
- saveLog(string(userJSONBytes), string(requestJSONBytes), "2204")
|
|
2163
|
+ result, request_log := service.Gdyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, data["dept"].(string), data["fixmedins_code"].(string), data["dept_code"].(string), data["doctor_id"].(string), miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, data["balance_accounts_type"].(string))
|
|
2164
|
+ var dat map[string]interface{}
|
|
2165
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
2166
|
+ fmt.Println(dat)
|
|
2167
|
+ } else {
|
|
2168
|
+ fmt.Println(err)
|
|
2169
|
+ }
|
|
2170
|
+ saveLog(result, request_log, "2204")
|
|
2171
|
+ userJSONBytes, _ := json.Marshal(dat)
|
2186
|
2172
|
|
2187
|
2173
|
var res ResultFour
|
2188
|
2174
|
if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
@@ -3365,31 +3351,16 @@ func (c *HisApiController) GetPreUploadInfo() {
|
3365
|
3351
|
}
|
3366
|
3352
|
config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
3367
|
3353
|
if config.IsOpen == 1 { //对接了医保,走医保流程
|
3368
|
|
- bytesData, _ := json.Marshal(data)
|
3369
|
|
- req, _ := http.NewRequest("POST", "http://127.0.0.1:9532/"+"gdyb/five", bytes.NewReader(bytesData))
|
3370
|
|
- resp, _ := client.Do(req)
|
3371
|
|
- defer resp.Body.Close()
|
3372
|
|
- body, ioErr := ioutil.ReadAll(resp.Body)
|
3373
|
|
- if ioErr != nil {
|
3374
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
3375
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
3376
|
|
- return
|
3377
|
|
- }
|
3378
|
|
- var respJSON map[string]interface{}
|
3379
|
|
- if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
|
3380
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
3381
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
3382
|
|
- return
|
3383
|
|
- }
|
3384
|
|
-
|
3385
|
|
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
3386
|
|
- userJSONBytes, _ := json.Marshal(respJSON)
|
3387
|
|
-
|
3388
|
|
- //request_respJSON := respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
|
3389
|
|
- //requestJSONBytes, _ := json.Marshal(request_respJSON)
|
3390
|
|
-
|
3391
|
|
- //saveLog(string(userJSONBytes), string(requestJSONBytes), "2204")
|
3392
|
3354
|
|
|
3355
|
+ result, request_log := service.Gdyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, data["dept"].(string), data["fixmedins_code"].(string), data["dept_code"].(string), data["doctor_id"].(string), miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, data["balance_accounts_type"].(string))
|
|
3356
|
+ var dat map[string]interface{}
|
|
3357
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
3358
|
+ fmt.Println(dat)
|
|
3359
|
+ } else {
|
|
3360
|
+ fmt.Println(err)
|
|
3361
|
+ }
|
|
3362
|
+ saveLog(result, request_log, "2204")
|
|
3363
|
+ userJSONBytes, _ := json.Marshal(dat)
|
3393
|
3364
|
var res ResultFour
|
3394
|
3365
|
if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
3395
|
3366
|
utils.ErrorLog("解析失败:%v", err)
|