Browse Source

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

csx 3 years ago
parent
commit
93d43f27ca
2 changed files with 49 additions and 14 deletions
  1. 5 5
      conf/app.conf
  2. 44 9
      controllers/sg/his_api_controller.go

+ 5 - 5
conf/app.conf View File

45
 
45
 
46
 
46
 
47
 [prod]
47
 [prod]
48
-org_id = 10028
48
+org_id = 10265
49
 mobile_token_expiration_second = 86400
49
 mobile_token_expiration_second = 86400
50
 httpdomain = https://api.xt.kuyicloud.com
50
 httpdomain = https://api.xt.kuyicloud.com
51
 sso_domain = https://sso.kuyicloud.com
51
 sso_domain = https://sso.kuyicloud.com
54
 #url  = "http://192.168.1.228:17001/szsi-portal/transData"
54
 #url  = "http://192.168.1.228:17001/szsi-portal/transData"
55
 #url = "http://192.168.1.88:6666/szsi-portal/transData"
55
 #url = "http://192.168.1.88:6666/szsi-portal/transData"
56
 #gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
56
 #gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
57
-gdyb_url="http://igb.hsa.gdgov.cn/ebus/sz_prd/hsa/hgs/"
57
+#gdyb_url="http://igb.hsa.gdgov.cn/ebus/sz_prd/hsa/hgs/"
58
 #内蒙古
58
 #内蒙古
59
-#gdyb_url = "http://10.38.23.105:8090/uif-hsaf-med-api/api/medical/service/"
60
-#gdyb_paasid = "sg03_prd"
59
+gdyb_url = "http://10.38.23.105:8090/uif-hsaf-med-api/api/medical/service/"
60
+gdyb_paasid = "sg03_prd"
61
 #gdyb_paasid = "jm_sc_yjyy"
61
 #gdyb_paasid = "jm_sc_yjyy"
62
 #gdyb_paasid="zh_prd_yjyy"
62
 #gdyb_paasid="zh_prd_yjyy"
63
-gdyb_paasid = "sz_prd_yjyy"
63
+#gdyb_paasid = "sz_prd_yjyy"
64
 #gdyb_paasid = "zq_prd_yjyy"
64
 #gdyb_paasid = "zq_prd_yjyy"
65
 
65
 
66
 
66
 

+ 44 - 9
controllers/sg/his_api_controller.go View File

2640
 	WarnInfo    interface{} `json:"warn_info"`
2640
 	WarnInfo    interface{} `json:"warn_info"`
2641
 }
2641
 }
2642
 
2642
 
2643
+type ResultFourteen10265 struct {
2644
+	ErrMsg      string `json:"err_msg"`
2645
+	InfRefmsgid string `json:"inf_refmsgid"`
2646
+	Infcode     string `json:"infcode"`
2647
+	Output      struct {
2648
+	} `json:"output"`
2649
+	RefmsgTime  string      `json:"refmsg_time"`
2650
+	RespondTime string      `json:"respond_time"`
2651
+	Signtype    interface{} `json:"signtype"`
2652
+	WarnInfo    interface{} `json:"warn_info"`
2653
+}
2654
+
2643
 type ResultSixteen struct {
2655
 type ResultSixteen struct {
2644
 	Cainfo      string `json:"cainfo"`
2656
 	Cainfo      string `json:"cainfo"`
2645
 	ErrMsg      string `json:"err_msg"`
2657
 	ErrMsg      string `json:"err_msg"`
7900
 	//} else {
7912
 	//} else {
7901
 	//	user_name = role.UserName
7913
 	//	user_name = role.UserName
7902
 	//}
7914
 	//}
7915
+	psn_record, _ := service.GetPsnNCDSRecordById(id)
7916
+	if psn_record.ID == 0 {
7917
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorPsnRecordNoExistWrong)
7918
+		return
7919
+	}
7903
 	result, _ := service.Gdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", "0", patient.Name)
7920
 	result, _ := service.Gdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", "0", patient.Name)
7904
 	var res ResultTwo
7921
 	var res ResultTwo
7905
 	var res10265 ResultTwo10265
7922
 	var res10265 ResultTwo10265
7965
 	if len(insutypes) == 0 {
7982
 	if len(insutypes) == 0 {
7966
 		insutype = "310"
7983
 		insutype = "310"
7967
 	}
7984
 	}
7985
+	insutype = psn_record.Insutype
7968
 
7986
 
7969
 	for _, item := range rf {
7987
 	for _, item := range rf {
7970
 		if item.Insutype == insutype {
7988
 		if item.Insutype == insutype {
7972
 		}
7990
 		}
7973
 	}
7991
 	}
7974
 
7992
 
7975
-	psn_record, _ := service.GetPsnNCDSRecordById(id)
7976
-	if psn_record.ID == 0 {
7977
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorPsnRecordNoExistWrong)
7978
-		return
7979
-	}
7980
 	if config.IsOpen == 1 {
7993
 	if config.IsOpen == 1 {
7981
 		result := service.Gdyb2504(psn_record.PsnNo, miConfig.OrgName, role.UserName, miConfig.Code, insuplc_admdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, psn_record.TrtDclaDetlSn)
7994
 		result := service.Gdyb2504(psn_record.PsnNo, miConfig.OrgName, role.UserName, miConfig.Code, insuplc_admdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, psn_record.TrtDclaDetlSn)
7982
 		var dat map[string]interface{}
7995
 		var dat map[string]interface{}
7988
 
8001
 
7989
 		userJSONBytes, _ := json.Marshal(dat)
8002
 		userJSONBytes, _ := json.Marshal(dat)
7990
 		var res ResultFourteen
8003
 		var res ResultFourteen
7991
-		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
7992
-			utils.ErrorLog("解析失败:%v", err)
7993
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
7994
-			return
8004
+		var res10265 ResultFourteen10265
8005
+
8006
+		if miConfig.Code == "H15049901371" {
8007
+			if err := json.Unmarshal(userJSONBytes, &res10265); err != nil {
8008
+				utils.ErrorLog("解析失败:%v", err)
8009
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8010
+				return
8011
+			}
8012
+			res.ErrMsg = res10265.ErrMsg
8013
+			infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
8014
+			res.Infcode = infocode
8015
+			res.Output = res10265.Output
8016
+			res.InfRefmsgid = res10265.InfRefmsgid
8017
+
8018
+		} else {
8019
+			if err := json.Unmarshal([]byte(result), &res); err != nil {
8020
+				utils.ErrorLog("解析失败:%v", err)
8021
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8022
+				return
8023
+			}
7995
 		}
8024
 		}
8025
+
8026
+		//if err := json.Unmarshal(userJSONBytes, &res); err != nil {
8027
+		//	utils.ErrorLog("解析失败:%v", err)
8028
+		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8029
+		//	return
8030
+		//}
7996
 		if res.Infcode == 0 {
8031
 		if res.Infcode == 0 {
7997
 			psn_record.IsCancel = 2
8032
 			psn_record.IsCancel = 2
7998
 			service.CreatePsnNCDSRecord(&psn_record)
8033
 			service.CreatePsnNCDSRecord(&psn_record)