Browse Source

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

csx 3 years ago
parent
commit
f3fce50b05
4 changed files with 71 additions and 36 deletions
  1. 1 1
      conf/app.conf
  2. 32 29
      controllers/sg/his_api_controller.go
  3. 17 1
      models/yb_models.go
  4. 21 5
      service/gdyb_service.go

+ 1 - 1
conf/app.conf View File

45
 
45
 
46
 
46
 
47
 [prod]
47
 [prod]
48
-org_id = 10188
48
+org_id = 9919
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

+ 32 - 29
controllers/sg/his_api_controller.go View File

71
 	beego.Router("/api/psn/info", &HisApiController{}, "get:GetPsnNcdsInfo")
71
 	beego.Router("/api/psn/info", &HisApiController{}, "get:GetPsnNcdsInfo")
72
 
72
 
73
 	beego.Router("/api/allopatry/get", &HisApiController{}, "get:GetAllopatry")
73
 	beego.Router("/api/allopatry/get", &HisApiController{}, "get:GetAllopatry")
74
-	beego.Router("/api/comfirmallopatry/post", &HisApiController{}, "post:ComfirmAllopatry")
74
+	//beego.Router("/api/comfirmallopatry/post", &HisApiController{}, "post:ComfirmAllopatry")
75
 	beego.Router("/api/allopatry/refund", &HisApiController{}, "post:RefundAllopatry")
75
 	beego.Router("/api/allopatry/refund", &HisApiController{}, "post:RefundAllopatry")
76
 
76
 
77
 }
77
 }
9313
 		fmt.Println(result)
9313
 		fmt.Println(result)
9314
 	}
9314
 	}
9315
 }
9315
 }
9316
+
9316
 func (c *HisApiController) GetAllopatry() {
9317
 func (c *HisApiController) GetAllopatry() {
9317
 	year := c.GetString("year")
9318
 	year := c.GetString("year")
9318
 	month := c.GetString("month")
9319
 	month := c.GetString("month")
9334
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9335
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9335
 		return
9336
 		return
9336
 	}
9337
 	}
9337
-	c.ServeSuccessJSON(map[string]interface{}{
9338
-		"result": res2,
9339
-	})
9338
+	fmt.Println(res2)
9340
 
9339
 
9341
-}
9342
-func (c *HisApiController) ComfirmAllopatry() {
9343
-	year := c.GetString("year")
9344
-	month := c.GetString("month")
9345
-	admin_user_id, _ := c.GetInt64("admin_user_id")
9346
-	adminUser := c.GetAdminUserInfo()
9347
-	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
9348
-	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
9349
-	result, _ := service.Gdyb3261(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, year, month)
9350
-	var dat map[string]interface{}
9351
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
9352
-		fmt.Println(dat)
9353
-	} else {
9354
-		fmt.Println(err)
9355
-	}
9356
-	userJSONBytes, _ := json.Marshal(dat)
9357
-	var res2 models.Result3261
9358
-	if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
9359
-		utils.ErrorLog("解析失败:%v", err)
9360
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9361
-		return
9362
-	}
9363
-	c.ServeSuccessJSON(map[string]interface{}{
9364
-		"result": res2,
9365
-	})
9340
+	result2, _ := service.Gdyb3261(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, year, month, res2)
9341
+	fmt.Println(result2)
9366
 
9342
 
9367
 }
9343
 }
9368
 
9344
 
9345
+//func (c *HisApiController) ComfirmAllopatry() {
9346
+//	year := c.GetString("year")
9347
+//	month := c.GetString("month")
9348
+//	admin_user_id, _ := c.GetInt64("admin_user_id")
9349
+//	adminUser := c.GetAdminUserInfo()
9350
+//	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
9351
+//	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
9352
+//	result, _ := service.Gdyb3261(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, year, month)
9353
+//	var dat map[string]interface{}
9354
+//	if err := json.Unmarshal([]byte(result), &dat); err == nil {
9355
+//		fmt.Println(dat)
9356
+//	} else {
9357
+//		fmt.Println(err)
9358
+//	}
9359
+//	userJSONBytes, _ := json.Marshal(dat)
9360
+//	var res2 models.Result3261
9361
+//	if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
9362
+//		utils.ErrorLog("解析失败:%v", err)
9363
+//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9364
+//		return
9365
+//	}
9366
+//	c.ServeSuccessJSON(map[string]interface{}{
9367
+//		"result": res2,
9368
+//	})
9369
+//
9370
+//}
9371
+
9369
 func (c *HisApiController) RefundAllopatry() {
9372
 func (c *HisApiController) RefundAllopatry() {
9370
 	//year := c.GetString("year")
9373
 	//year := c.GetString("year")
9371
 	//month := c.GetString("month")
9374
 	//month := c.GetString("month")

+ 17 - 1
models/yb_models.go View File

5
 	InfRefmsgid string `json:"inf_refmsgid"`
5
 	InfRefmsgid string `json:"inf_refmsgid"`
6
 	Infcode     int64  `json:"infcode"`
6
 	Infcode     int64  `json:"infcode"`
7
 	Output      struct {
7
 	Output      struct {
8
-		Data []interface{} `json:"data"`
8
+		Data []struct {
9
+			Certno          string  `json:"certno"`
10
+			MdtrtId         string  `json:"mdtrt_id"`
11
+			MdtrtSetlTime   string  `json:"mdtrt_setl_time"`
12
+			SetlNo          string  `json:"setl_no"`
13
+			MedfeeSumamt    float64 `json:"medfee_sumamt"`
14
+			OptinsPaySumamt float64 `json:"optins_pay_sumamt"`
15
+		} `json:"data"`
9
 	} `json:"output"`
16
 	} `json:"output"`
10
 	RefmsgTime  string      `json:"refmsg_time"`
17
 	RefmsgTime  string      `json:"refmsg_time"`
11
 	RespondTime string      `json:"respond_time"`
18
 	RespondTime string      `json:"respond_time"`
25
 	Signtype    interface{} `json:"signtype"`
32
 	Signtype    interface{} `json:"signtype"`
26
 	WarnMsg     interface{} `json:"warn_msg"`
33
 	WarnMsg     interface{} `json:"warn_msg"`
27
 }
34
 }
35
+
36
+type CustomData struct {
37
+	Certno          string  `json:"certno"`
38
+	MdtrtId         string  `json:"mdtrt_id"`
39
+	MdtrtSetlTime   string  `json:"mdtrt_setl_time"`
40
+	SetlNo          string  `json:"setl_no"`
41
+	MedfeeSumamt    float64 `json:"medfee_sumamt"`
42
+	OptinsPaySumamt float64 `json:"optins_pay_sumamt"`
43
+}

+ 21 - 5
service/gdyb_service.go View File

934
 	inputMessage["infno"] = "2204" // 交易编码
934
 	inputMessage["infno"] = "2204" // 交易编码
935
 
935
 
936
 	//chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
936
 	//chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
937
+
937
 	for _, item := range customs {
938
 	for _, item := range customs {
938
 		feedetailInfo := make(map[string]interface{})
939
 		feedetailInfo := make(map[string]interface{})
939
 		feedetailInfo["feedetl_sn"] = item.FeedetlSn
940
 		feedetailInfo["feedetl_sn"] = item.FeedetlSn
3864
 	}
3865
 	}
3865
 
3866
 
3866
 }
3867
 }
3867
-func Gdyb3261(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, year string, month string) (string, string) {
3868
+func Gdyb3261(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, year string, month string, result3260 models.Result3260) (string, string) {
3868
 	//生成签名
3869
 	//生成签名
3869
 	nonce := GetRandomString(32)
3870
 	nonce := GetRandomString(32)
3870
 	timestamp := time.Now().Unix()
3871
 	timestamp := time.Now().Unix()
3873
 	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
3874
 	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
3874
 	input := make(map[string]interface{})
3875
 	input := make(map[string]interface{})
3875
 	inputData := make(map[string]interface{})
3876
 	inputData := make(map[string]interface{})
3876
-	inputMessage["infno"] = "3261" // 交易编码
3877
-	inputData["trt_year"] = ""     // 就诊凭证编号
3878
-	inputData["trt_month"] = ""    // 开始时间
3879
-	inputData["startrow"] = "100"  // 人员姓名
3877
+	inputMessage["infno"] = "3261"                      // 交易编码
3878
+	inputData["trt_year"] = year                        // 就诊凭证编号
3879
+	inputData["trt_month"] = month                      // 开始时间
3880
+	inputData["startrow"] = len(result3260.Output.Data) // 人员姓名
3881
+
3882
+	feedetail := make([]map[string]interface{}, 0)
3883
+
3884
+	for _, item := range result3260.Output.Data {
3885
+		feedetailInfo := make(map[string]interface{})
3886
+		feedetailInfo["certno"] = item.Certno
3887
+		feedetailInfo["mdtrt_id"] = item.MdtrtId                  // 就诊 ID(来自2201接口返回)
3888
+		feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime     // 人员编号 (来自1101接口返回)
3889
+		feedetailInfo["setl_no"] = item.SetlNo                    // 收费批次号
3890
+		feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt        // 病种编码
3891
+		feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
3892
+		feedetail = append(feedetail, feedetailInfo)
3893
+	}
3894
+	inputData["detail"] = feedetail // 人员姓名
3895
+
3880
 	input["data"] = inputData
3896
 	input["data"] = inputData
3881
 	inputMessage["input"] = input //交易输入
3897
 	inputMessage["input"] = input //交易输入
3882
 	var inputLog string
3898
 	var inputLog string