Преглед на файлове

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

csx преди 1 година
родител
ревизия
429b2cd320
променени са 3 файла, в които са добавени 93 реда и са изтрити 18 реда
  1. 29 0
      controllers/nm/nm_controller.go
  2. 64 17
      controllers/sg/his_api_controller.go
  3. 0 1
      service/gdyb_service.go

+ 29 - 0
controllers/nm/nm_controller.go Целия файл

@@ -143,7 +143,36 @@ type ResultTwo10265 struct {
143 143
 }
144 144
 
145 145
 func (c *NmController) Post4101() {
146
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
147
+	var respJSON map[string]interface{}
148
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
149
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
150
+		return
151
+	}
152
+	struct4101UserJSONBytes, _ := json.Marshal(respJSON["struct4101"])
153
+	var struct4101 service.Struct4101
154
+	if err := json.Unmarshal(struct4101UserJSONBytes, &struct4101); err != nil {
155
+		utils.ErrorLog("解析失败:%v", err)
156
+		return
157
+	}
158
+	ppUserJSONBytes, _ := json.Marshal(respJSON["pp"])
159
+	var pp models.PublicParams
160
+	if err := json.Unmarshal(ppUserJSONBytes, &pp); err != nil {
161
+		utils.ErrorLog("解析失败:%v", err)
162
+		return
163
+	}
164
+	result := service.Gdyb4101(struct4101, pp.SecretKey, pp.FixmedinsName, pp.OpterName, pp.FixmedinsCode, pp.InsuplcAdmdvs, pp.MdtrtareaAdmvs, 0)
165
+	var dat map[string]interface{}
166
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
167
+		fmt.Println(dat)
168
+	} else {
169
+		fmt.Println(err)
170
+	}
146 171
 
172
+	saveJsLog(result, "", "4101", "上传明细清单", pp.FixmedinsName)
173
+	c.ServeSuccessJSON(map[string]interface{}{
174
+		"pre": dat,
175
+	})
147 176
 }
148 177
 
149 178
 func (c *NmController) Post2202() {

+ 64 - 17
controllers/sg/his_api_controller.go Целия файл

@@ -3534,33 +3534,80 @@ func (c *HisApiController) GetSettleListHospital() {
3534 3534
 	struct4101.IteminfoStruct = iteminfoStructs
3535 3535
 	struct4101.Ntly = "中国"
3536 3536
 	struct4101.AdmCaty = "A03.06"
3537
-	result := service.Gdyb4101(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.UserOrgId)
3538
-	fmt.Println(result)
3537
+	var resOther ResultSeventeenOther
3538
+	var res ResultSeventeen
3539
+	if miConfig.MdtrtareaAdmvs == "150499" {
3540
+		var pp models.PublicParams
3541
+		pp.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
3542
+		pp.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
3543
+		pp.FixmedinsName = miConfig.OrgName
3544
+		pp.FixmedinsCode = miConfig.Code
3545
+		pp.RequestUrl = miConfig.Url
3546
+		pp.Cainfo = miConfig.Cainfo
3547
+		pp.SecretKey = miConfig.SecretKey
3548
+		pp.AccessKey = miConfig.AccessKey
3549
+		pp.OpterName = curRoles.UserName
3550
+		client := &http.Client{}
3551
+		var req *http.Request
3552
+		data := make(map[string]interface{})
3553
+		data["struct4101"] = struct4101
3554
+		data["pp"] = pp
3555
+		bytesData, _ := json.Marshal(data)
3556
+		req, _ = http.NewRequest("POST", "http://172.16.13.254:9532/"+"nmyb/4101", bytes.NewReader(bytesData))
3557
+		resp, _ := client.Do(req)
3558
+		defer resp.Body.Close()
3559
+		body, ioErr := ioutil.ReadAll(resp.Body)
3560
+		if ioErr != nil {
3561
+			utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
3562
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3563
+			return
3564
+		}
3565
+		var respJSON map[string]interface{}
3566
+		if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
3567
+			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3568
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3569
+			return
3570
+		}
3539 3571
 
3540
-	var dat map[string]interface{}
3541
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
3542
-		fmt.Println(dat)
3572
+		respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
3573
+		userJSONBytes, _ := json.Marshal(respJSON)
3574
+		if err := json.Unmarshal(userJSONBytes, &resOther); err != nil {
3575
+			utils.ErrorLog("解析失败:%v", err)
3576
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3577
+			return
3578
+		}
3579
+		res.InfRefmsgid = resOther.InfRefmsgid
3580
+		res.Output = resOther.Output
3581
+		res.ErrMsg = resOther.ErrMsg
3582
+		infocode, _ := strconv.ParseInt(resOther.Infcode, 10, 64)
3583
+		res.Infcode = infocode
3543 3584
 	} else {
3544
-		fmt.Println(err)
3545
-	}
3546
-	userJSONBytes, _ := json.Marshal(dat)
3547
-	var res ResultSeventeen
3548
-	if err := json.Unmarshal(userJSONBytes, &res); err != nil {
3549
-		utils.ErrorLog("解析失败:%v", err)
3550
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3551
-		return
3585
+		result := service.Gdyb4101(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.UserOrgId)
3586
+		var dat map[string]interface{}
3587
+		if err := json.Unmarshal([]byte(result), &dat); err == nil {
3588
+			fmt.Println(dat)
3589
+		} else {
3590
+			fmt.Println(err)
3591
+		}
3592
+		userJSONBytes, _ := json.Marshal(dat)
3593
+		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
3594
+			utils.ErrorLog("解析失败:%v", err)
3595
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3596
+			return
3597
+		}
3552 3598
 	}
3553 3599
 	if res.Infcode != 0 {
3554
-
3555 3600
 		c.ServeSuccessJSON(map[string]interface{}{
3556 3601
 			"failed_code": -10,
3557 3602
 			"msg":         res.ErrMsg,
3558 3603
 		})
3559 3604
 		return
3560 3605
 	} else {
3561
-		order.FaPiaoNumber = zero
3562
-		order.FaPiaoCode = last_order.FaPiaoCode
3563
-		service.UpdateOrder(order)
3606
+		if miConfig.MdtrtareaAdmvs != "150499" {
3607
+			order.FaPiaoNumber = zero
3608
+			order.FaPiaoCode = last_order.FaPiaoCode
3609
+			service.UpdateOrder(order)
3610
+		}
3564 3611
 		hisFundSettleListResult := &models.HisFundSettleListResult{
3565 3612
 			Number:    res.Output.SetlListId,
3566 3613
 			Status:    1,

+ 0 - 1
service/gdyb_service.go Целия файл

@@ -2884,7 +2884,6 @@ func Gdyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor
2884 2884
 		inputMessage["infno"] = "4101A" // 交易编码
2885 2885
 
2886 2886
 	}
2887
-
2888 2887
 	year := time.Now().Format("2006")
2889 2888
 	month := time.Now().Format("01")
2890 2889
 	day := time.Now().Format("02")