Browse Source

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

csx 3 years ago
parent
commit
c553298d00
1 changed files with 18 additions and 49 deletions
  1. 18 49
      controllers/sg/his_api_controller.go

+ 18 - 49
controllers/sg/his_api_controller.go View File

@@ -3025,55 +3025,21 @@ func (c *HisApiController) GetRegisterInfo() {
3025 3025
 			Age = psn_info.Age
3026 3026
 			infoStr = psn_info.Insuinfo
3027 3027
 			idetinfoStr = psn_info.Idetinfo
3028
+			infocode = 0
3028 3029
 
3029 3030
 		} else if miConfig.MdtrtareaAdmvs == "320921" {
3030
-			var res ResultTwo
3031
-			api := "http://192.168.3.111:9532/" + "jsyb/1101?cert_no=" + "" +
3032
-				"&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
3033
-				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&card_sn=" + "" + "&certificates=" + strconv.FormatInt(certificates, 10) + "&url=" + miConfig.Url + "&ak=" + miConfig.ChannelNumber
3034
-			fmt.Println(api)
3035
-			resp, requestErr := http.Get(api)
3036
-			if requestErr != nil {
3037
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3038
-				return
3039
-			}
3040
-
3041
-			body, ioErr := ioutil.ReadAll(resp.Body)
3042
-			if ioErr != nil {
3043
-				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
3044
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3045
-				return
3046
-			}
3047
-			var respJSON map[string]interface{}
3048
-			if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
3049
-				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3050
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3051
-				return
3052
-			}
3053
-
3054
-			respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
3055
-			result, _ := json.Marshal(respJSON)
3056
-			fmt.Println("log")
3057
-			fmt.Println(string(result))
3058
-
3059
-			if err := json.Unmarshal([]byte(result), &res); err != nil {
3060
-				utils.ErrorLog("解析失败:%v", err)
3061
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3062
-				return
3063
-			}
3064
-			PsnNo = res.Output.Baseinfo.PsnNo
3065
-			PsnCertType = res.Output.Baseinfo.PsnCertType
3066
-			Certno = res.Output.Baseinfo.Certno
3067
-			PsnName = res.Output.Baseinfo.PsnName
3068
-			Gend = res.Output.Baseinfo.Gend
3069
-			Naty = res.Output.Baseinfo.Naty
3070
-			Brdy = res.Output.Baseinfo.Brdy
3071
-			Age = res.Output.Baseinfo.Age
3072
-			Iinfos, _ := json.Marshal(res.Output.Iinfo)
3073
-			Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
3074
-			infoStr = string(Iinfos)
3075
-			idetinfoStr = string(Idetinfos)
3076
-			infocode = res.Infcode
3031
+			psn_info, _ := service.GetPsnByPatientId(id)
3032
+			PsnNo = psn_info.PsnNo
3033
+			PsnCertType = psn_info.PsnCertType
3034
+			Certno = psn_info.Certno
3035
+			PsnName = psn_info.PsnName
3036
+			Gend = psn_info.Gend
3037
+			Naty = psn_info.Naty
3038
+			Brdy = psn_info.Brdy
3039
+			Age = psn_info.Age
3040
+			infoStr = psn_info.Insuinfo
3041
+			idetinfoStr = psn_info.Idetinfo
3042
+			infocode = 0
3077 3043
 
3078 3044
 		} else {
3079 3045
 			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), name)
@@ -3286,12 +3252,15 @@ func (c *HisApiController) GetRegisterInfo() {
3286 3252
 				respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
3287 3253
 				result, _ := json.Marshal(respJSON)
3288 3254
 
3289
-				if err := json.Unmarshal([]byte(result), &resThree); err != nil {
3255
+				if err := json.Unmarshal([]byte(result), &resThree10265); err != nil {
3290 3256
 					utils.ErrorLog("解析失败:%v", err)
3291 3257
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3292 3258
 					return
3293 3259
 				}
3294
-				infocode = resThree.Infcode
3260
+				resThree.ErrMsg = resThree10265.ErrMsg
3261
+				resThree.Output = resThree10265.Output
3262
+				resThree.InfRefmsgid = resThree10265.InfRefmsgid
3263
+				infocode, _ = strconv.ParseInt(resThree10265.Infcode, 10, 64)
3295 3264
 
3296 3265
 			} else {
3297 3266