Browse Source

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

csx 3 years ago
parent
commit
86c65cddd6
2 changed files with 14 additions and 18 deletions
  1. 1 1
      controllers/sg/gdyb_controller.go
  2. 13 17
      controllers/sg/his_api_controller.go

+ 1 - 1
controllers/sg/gdyb_controller.go View File

145
 	secret_key := c.GetString("secret_key")
145
 	secret_key := c.GetString("secret_key")
146
 	fixmedins_code := c.GetString("fixmedins_code")
146
 	fixmedins_code := c.GetString("fixmedins_code")
147
 	result, requestLog := service.Gdyb2202(psnNo, mdtrtId, iptOtpNo, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code)
147
 	result, requestLog := service.Gdyb2202(psnNo, mdtrtId, iptOtpNo, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code)
148
-	saveLog(result, requestLog)
148
+	saveLog(result, requestLog, "2202")
149
 	var dat map[string]interface{}
149
 	var dat map[string]interface{}
150
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
150
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
151
 	} else {
151
 	} else {

+ 13 - 17
controllers/sg/his_api_controller.go View File

1260
 	Signtype    interface{} `json:"signtype"`
1260
 	Signtype    interface{} `json:"signtype"`
1261
 	WarnMsg     interface{} `json:"warn_msg"`
1261
 	WarnMsg     interface{} `json:"warn_msg"`
1262
 }
1262
 }
1263
-
1264
 type ResultSeven struct {
1263
 type ResultSeven struct {
1265
 	Cainfo      string `json:"cainfo"`
1264
 	Cainfo      string `json:"cainfo"`
1266
 	ErrMsg      string `json:"err_msg"`
1265
 	ErrMsg      string `json:"err_msg"`
1318
 	Signtype    interface{} `json:"signtype"`
1317
 	Signtype    interface{} `json:"signtype"`
1319
 	WarnMsg     interface{} `json:"warn_msg"`
1318
 	WarnMsg     interface{} `json:"warn_msg"`
1320
 }
1319
 }
1321
-
1322
 type ResultEight struct {
1320
 type ResultEight struct {
1323
 	Cainfo      string `json:"cainfo"`
1321
 	Cainfo      string `json:"cainfo"`
1324
 	ErrMsg      string `json:"err_msg"`
1322
 	ErrMsg      string `json:"err_msg"`
1336
 	Signtype    interface{} `json:"signtype"`
1334
 	Signtype    interface{} `json:"signtype"`
1337
 	WarnMsg     interface{} `json:"warn_msg"`
1335
 	WarnMsg     interface{} `json:"warn_msg"`
1338
 }
1336
 }
1339
-
1340
 type ResultNine struct {
1337
 type ResultNine struct {
1341
 	Cainfo      string `json:"cainfo"`
1338
 	Cainfo      string `json:"cainfo"`
1342
 	ErrMsg      string `json:"err_msg"`
1339
 	ErrMsg      string `json:"err_msg"`
1350
 	Signtype    interface{} `json:"signtype"`
1347
 	Signtype    interface{} `json:"signtype"`
1351
 	WarnMsg     interface{} `json:"warn_msg"`
1348
 	WarnMsg     interface{} `json:"warn_msg"`
1352
 }
1349
 }
1353
-
1354
 type ResultTen struct {
1350
 type ResultTen struct {
1355
 	Cainfo      string `json:"cainfo"`
1351
 	Cainfo      string `json:"cainfo"`
1356
 	ErrMsg      string `json:"err_msg"`
1352
 	ErrMsg      string `json:"err_msg"`
1762
 	if config.IsOpen == 1 {
1758
 	if config.IsOpen == 1 {
1763
 		//service.Gdyb1201("", miConfig.OrgName, "1122", miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 1, "")
1759
 		//service.Gdyb1201("", miConfig.OrgName, "1122", miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 1, "")
1764
 		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))
1760
 		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))
1765
-		saveLog(result, requestLog)
1761
+		saveLog(result, requestLog, "1101")
1766
 		//register_log = requestLog + "\r\n" + "\r\n" + "\r\n" + result
1762
 		//register_log = requestLog + "\r\n" + "\r\n" + "\r\n" + result
1767
 		var res ResultTwo
1763
 		var res ResultTwo
1768
 		if err := json.Unmarshal([]byte(result), &res); err != nil {
1764
 		if err := json.Unmarshal([]byte(result), &res); err != nil {
1866
 			//insutype = "390"
1862
 			//insutype = "390"
1867
 
1863
 
1868
 			result, requestLog := service.Gdyb2201(res.Output.Baseinfo.PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_id, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type)
1864
 			result, requestLog := service.Gdyb2201(res.Output.Baseinfo.PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_id, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type)
1869
-			saveLog(result, requestLog)
1865
+			saveLog(result, requestLog, "2201")
1870
 			//register_log = register_log + requestLog + "\r\n" + "\r\n" + "\r\n" + result + "\r\n" + "\r\n" + "\r\n"
1866
 			//register_log = register_log + requestLog + "\r\n" + "\r\n" + "\r\n" + result + "\r\n" + "\r\n" + "\r\n"
1871
 			//saveRegisterLog(register_log)
1867
 			//saveRegisterLog(register_log)
1872
 
1868
 
2049
 
2045
 
2050
 		}
2046
 		}
2051
 
2047
 
2052
-		saveLog(result, requestLog)
2048
+		saveLog(result, requestLog, "2203")
2053
 
2049
 
2054
 		var respJSON2 map[string]interface{}
2050
 		var respJSON2 map[string]interface{}
2055
 		if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
2051
 		if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
2186
 				request_respJSON := respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
2182
 				request_respJSON := respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
2187
 				requestJSONBytes, _ := json.Marshal(request_respJSON)
2183
 				requestJSONBytes, _ := json.Marshal(request_respJSON)
2188
 
2184
 
2189
-				saveLog(string(userJSONBytes), string(requestJSONBytes))
2185
+				saveLog(string(userJSONBytes), string(requestJSONBytes), "2204")
2190
 
2186
 
2191
 				var res ResultFour
2187
 				var res ResultFour
2192
 				if err := json.Unmarshal(userJSONBytes, &res); err != nil {
2188
 				if err := json.Unmarshal(userJSONBytes, &res); err != nil {
2377
 							fmt.Println(err)
2373
 							fmt.Println(err)
2378
 						}
2374
 						}
2379
 
2375
 
2380
-						saveLog(result, src_resquest)
2376
+						saveLog(result, src_resquest, "2207")
2381
 
2377
 
2382
 						userJSONBytes, _ := json.Marshal(dat)
2378
 						userJSONBytes, _ := json.Marshal(dat)
2383
 
2379
 
2573
 				fmt.Println(err)
2569
 				fmt.Println(err)
2574
 			}
2570
 			}
2575
 
2571
 
2576
-			saveLog(result, src_resquest)
2572
+			saveLog(result, src_resquest, "2207")
2577
 
2573
 
2578
 			userJSONBytes, _ := json.Marshal(dat)
2574
 			userJSONBytes, _ := json.Marshal(dat)
2579
 
2575
 
3266
 
3262
 
3267
 	}
3263
 	}
3268
 
3264
 
3269
-	saveLog(result, requestLog)
3265
+	saveLog(result, requestLog, "2203")
3270
 
3266
 
3271
 	var respJSON2 map[string]interface{}
3267
 	var respJSON2 map[string]interface{}
3272
 	if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
3268
 	if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
3392
 			request_respJSON := respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
3388
 			request_respJSON := respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
3393
 			requestJSONBytes, _ := json.Marshal(request_respJSON)
3389
 			requestJSONBytes, _ := json.Marshal(request_respJSON)
3394
 
3390
 
3395
-			saveLog(string(userJSONBytes), string(requestJSONBytes))
3391
+			saveLog(string(userJSONBytes), string(requestJSONBytes), "2204")
3396
 
3392
 
3397
 			var res ResultFour
3393
 			var res ResultFour
3398
 			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
3394
 			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
3572
 						fmt.Println(err)
3568
 						fmt.Println(err)
3573
 					}
3569
 					}
3574
 
3570
 
3575
-					saveLog(result, request_log)
3571
+					saveLog(result, request_log, "2206")
3576
 
3572
 
3577
 					userJSONBytes, _ := json.Marshal(dat)
3573
 					userJSONBytes, _ := json.Marshal(dat)
3578
 
3574
 
3943
 		} else {
3939
 		} else {
3944
 			fmt.Println(err)
3940
 			fmt.Println(err)
3945
 		}
3941
 		}
3946
-		saveLog(result, src_resquest)
3942
+		saveLog(result, src_resquest, "2208")
3947
 
3943
 
3948
 		userJSONBytes, _ := json.Marshal(dat)
3944
 		userJSONBytes, _ := json.Marshal(dat)
3949
 
3945
 
3962
 				fmt.Println(err)
3958
 				fmt.Println(err)
3963
 			}
3959
 			}
3964
 
3960
 
3965
-			saveLog(result, src_request)
3961
+			saveLog(result, src_request, "2205")
3966
 
3962
 
3967
 			userJSONBytes, _ := json.Marshal(dat)
3963
 			userJSONBytes, _ := json.Marshal(dat)
3968
 
3964
 
6122
 
6118
 
6123
 }
6119
 }
6124
 
6120
 
6125
-func saveLog(result string, request string) {
6121
+func saveLog(result string, request string, infno string) {
6126
 
6122
 
6127
 	org_id, _ := beego.AppConfig.Int64("org_id")
6123
 	org_id, _ := beego.AppConfig.Int64("org_id")
6128
 	miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
6124
 	miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
6142
 		if err != nil {
6138
 		if err != nil {
6143
 			fmt.Println("read fail")
6139
 			fmt.Println("read fail")
6144
 		}
6140
 		}
6145
-		content := "\r\n" + "\r\n" + "\r\n" + "\r\n" + request + "\r\n" + "\r\n" + "\r\n" + "\r\n" + result
6141
+		content := infno + "\r\n" + "\r\n" + "\r\n" + "\r\n" + request + "\r\n" + "\r\n" + "\r\n" + "\r\n" + result
6146
 		n, _ := f.Seek(0, 2)
6142
 		n, _ := f.Seek(0, 2)
6147
 		_, err = f.WriteAt([]byte(content), n)
6143
 		_, err = f.WriteAt([]byte(content), n)
6148
 
6144