Browse Source

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

csx 2 years ago
parent
commit
cab4e775a8
2 changed files with 79 additions and 4 deletions
  1. 38 0
      controllers/nm/nm_controller.go
  2. 41 4
      controllers/sg/his_api_controller.go

+ 38 - 0
controllers/nm/nm_controller.go View File

@@ -36,6 +36,8 @@ func NmybRegistRouters() {
36 36
 	beego.Router("/nmyb/2304", &NmController{}, "get:Post2304")
37 37
 	beego.Router("/nmyb/2305", &NmController{}, "get:Post2305")
38 38
 
39
+	beego.Router("/nmyb/5203", &NmController{}, "get:Post5203")
40
+
39 41
 	beego.Router("/nmyb/readcard", &NmController{}, "get:ReadCard")
40 42
 }
41 43
 
@@ -134,6 +136,42 @@ type ResultTwo10265 struct {
134 136
 	WarnInfo    interface{} `json:"warn_info"`
135 137
 }
136 138
 
139
+func (c *NmController) Post5203() {
140
+	org_name := c.GetString("org_name")
141
+	doctor := c.GetString("doctor")
142
+	fixmedins_code := c.GetString("fixmedins_code")
143
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
144
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
145
+	secret_key := c.GetString("secret_key")
146
+	psn_no := c.GetString("psn_no")
147
+	mdtrt_id := c.GetString("mdtrt_id")
148
+	setl_id := c.GetString("setl_id")
149
+	bp := models.BaseParams{
150
+		SecretKey:      secret_key,
151
+		FixmedinsCode:  fixmedins_code,
152
+		InsuplcAdmdvs:  insuplc_admdvs,
153
+		MdtrtareaAdmvs: mdtrtarea_admvs,
154
+		OrgName:        org_name,
155
+		Doctor:         doctor,
156
+	}
157
+	bps := models.BusinessParams{
158
+		PsnNo:   psn_no,
159
+		MdtrtId: mdtrt_id,
160
+		SetlId:  setl_id,
161
+	}
162
+	result := service.Gdyb5203(bp, bps)
163
+	saveJsLog(result, "", "5203", "结算单", org_name)
164
+	var dat map[string]interface{}
165
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
166
+
167
+	} else {
168
+
169
+	}
170
+	c.ServeSuccessJSON(map[string]interface{}{
171
+		"pre": dat,
172
+	})
173
+}
174
+
137 175
 func (c *NmController) Post1101() {
138 176
 	certNo := c.GetString("cert_no")
139 177
 	org_name := c.GetString("org_name")

+ 41 - 4
controllers/sg/his_api_controller.go View File

@@ -9695,11 +9695,48 @@ func (c *HisApiController) GetSettleAccounts() {
9695 9695
 			infocode, _ := strconv.ParseInt(resEleven10265.Infcode, 10, 64)
9696 9696
 			res.Infcode = infocode
9697 9697
 
9698
-		} else {
9699
-			//result2 := service.Gdyb1101()
9698
+		} else if miConfig.MdtrtareaAdmvs == "150499" {
9699
+			api := "http://172.16.13.254:9532/" + "nmyb/5203?psn_no=" + businessParams.PsnNo + "&mdtrt_id=" + businessParams.MdtrtId + "&setl_id=" + businessParams.SetlId +
9700
+				"&org_name=" + miConfig.OrgName + "&doctor=" + baseParams.Doctor + "&fixmedins_code=" + miConfig.Code +
9701
+				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url
9702
+
9703
+			resp, requestErr := http.Get(api)
9704
+			if requestErr != nil {
9705
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9706
+				return
9707
+			}
9708
+			body, ioErr := ioutil.ReadAll(resp.Body)
9709
+			if ioErr != nil {
9710
+				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
9711
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9712
+				return
9713
+			}
9714
+			var respJSON map[string]interface{}
9715
+			if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
9716
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
9717
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9718
+				return
9719
+			}
9700 9720
 
9701
-			//result2 := service.Gdyb5204(baseParams, businessParams)
9702
-			//saveLog(result2, "", "5204", "查询")
9721
+			respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
9722
+			result, _ := json.Marshal(respJSON)
9723
+			fmt.Println("log")
9724
+			fmt.Println(string(result))
9725
+			if err := json.Unmarshal([]byte(result), &resEleven10265); err != nil {
9726
+				utils.ErrorLog("解析失败:%v", err)
9727
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9728
+				return
9729
+			}
9730
+
9731
+			res.InfRefmsgid = resEleven10265.InfRefmsgid
9732
+			res.Output = resEleven10265.Output
9733
+			res.ErrMsg = resEleven10265.ErrMsg
9734
+			res.Cainfo = resEleven10265.Cainfo
9735
+			res.WarnMsg = resEleven10265.WarnMsg
9736
+			infocode, _ := strconv.ParseInt(resEleven10265.Infcode, 10, 64)
9737
+			res.Infcode = infocode
9738
+
9739
+		} else {
9703 9740
 			result := service.Gdyb5203(baseParams, businessParams)
9704 9741
 			var dat map[string]interface{}
9705 9742
 			if err := json.Unmarshal([]byte(result), &dat); err == nil {