Browse Source

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

csx 2 years ago
parent
commit
d7f4496368

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

@@ -39,6 +39,10 @@ func NmybRegistRouters() {
39 39
 	beego.Router("/nmyb/5203", &NmController{}, "get:Post5203")
40 40
 
41 41
 	beego.Router("/nmyb/readcard", &NmController{}, "get:ReadCard")
42
+
43
+	beego.Router("/nmyb/3201", &NmController{}, "get:Get3201")
44
+	//beego.Router("/nmyb/3202", &NmController{}, "post:Get3102")
45
+
42 46
 }
43 47
 
44 48
 type ReadCardResult struct {
@@ -873,3 +877,53 @@ func saveJsLog(result string, request string, infno string, desc string, org_nam
873 877
 	}
874 878
 
875 879
 }
880
+
881
+func (c *NmController) Get3201() {
882
+	insutype := c.GetString("insutype")
883
+	clrType := c.GetString("clr_type")
884
+	setlOptins := c.GetString("setl_optins")
885
+	stmtBegndate := c.GetString("stmt_begndate")
886
+	stmtEnddate := c.GetString("stm_enddate")
887
+	medfeeSumamt, _ := c.GetFloat("medfee_sumamt", 0)
888
+	fundPaySumamt, _ := c.GetFloat("fund_pay_sumamt", 0)
889
+	acctPay, _ := c.GetFloat("acct_pay", 0)
890
+	fixmedinsSetlCnt, _ := c.GetInt64("fixmedins_setl_cnt", 0)
891
+	fixmedins_code := c.GetString("fixmedins_code")
892
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
893
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
894
+	secret_key := c.GetString("secret_key")
895
+	org_name := c.GetString("org_name")
896
+	doctor := c.GetString("doctor")
897
+
898
+	baseParams := models.BaseParams{
899
+		SecretKey:      secret_key,
900
+		FixmedinsCode:  fixmedins_code,
901
+		InsuplcAdmdvs:  insuplc_admdvs,
902
+		MdtrtareaAdmvs: mdtrtarea_admvs,
903
+		OrgName:        org_name,
904
+		Doctor:         doctor,
905
+	}
906
+	businessParams := models.BusinessParams{
907
+		Insutype:         insutype,
908
+		ClrType:          clrType,
909
+		SetlOptins:       setlOptins,
910
+		StmtBegndate:     stmtBegndate,
911
+		StmtEnddate:      stmtEnddate,
912
+		MedfeeSumamt:     medfeeSumamt,
913
+		FundPaySumamt:    fundPaySumamt,
914
+		AcctPay:          acctPay,
915
+		FixmedinsSetlCnt: fixmedinsSetlCnt,
916
+	}
917
+	result := service.Gdyb3201(baseParams, businessParams)
918
+	saveJsLog(result, "", "3201", "对总账", org_name)
919
+	var dat map[string]interface{}
920
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
921
+		fmt.Println(dat)
922
+	} else {
923
+		fmt.Println(err)
924
+	}
925
+
926
+	c.ServeSuccessJSON(map[string]interface{}{
927
+		"pre": dat,
928
+	})
929
+}

+ 0 - 4
controllers/sg/gdyb_controller.go View File

@@ -431,11 +431,7 @@ func (c *GdybController) PostTen() {
431 431
 	fmt.Println(baseParams)
432 432
 	fmt.Println(businessParams)
433 433
 
434
-	fmt.Println("11222333--33333---")
435
-
436 434
 	result := service.Gdyb3201(baseParams, businessParams)
437
-	fmt.Println("11222333--33333---555555")
438
-
439 435
 	var dat map[string]interface{}
440 436
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
441 437
 		fmt.Println(dat)

+ 143 - 1
controllers/sg/his_api_controller.go View File

@@ -80,6 +80,8 @@ func HisManagerApiRegistRouters() {
80 80
 	beego.Router("/api/check3101", &HisApiController{}, "get:Check3101")
81 81
 	beego.Router("/api/check3102", &HisApiController{}, "get:Check3102")
82 82
 
83
+	beego.Router("/90990", &HisApiController{}, "get:CheckCardPWDTwo")
84
+
83 85
 }
84 86
 func (c *HisApiController) Check3101() {
85 87
 	patient_id, _ := c.GetInt64("patient_id")
@@ -972,6 +974,93 @@ func (c *HisApiController) CheckCardPWD() {
972 974
 	}
973 975
 
974 976
 }
977
+
978
+func (c *HisApiController) CheckCardPWDTwo() {
979
+	//card_pwd := c.GetString("card_pwd")
980
+	//his_patient_id, _ := c.GetInt64("his_patient_id")
981
+	admin_user_id, _ := c.GetInt64("admin_user_id")
982
+	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
983
+	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
984
+
985
+	result := service.Gdyb90991("44030000000629690364", miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, "000000", "220881198702101914")
986
+
987
+	var dat map[string]interface{}
988
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
989
+		fmt.Println(dat)
990
+	} else {
991
+		fmt.Println(err)
992
+	}
993
+
994
+	userJSONBytes, _ := json.Marshal(dat)
995
+	var res Result90991
996
+	if err := json.Unmarshal(userJSONBytes, &res); err != nil {
997
+		utils.ErrorLog("解析失败:%v", err)
998
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
999
+		return
1000
+	}
1001
+
1002
+	if res.Infcode != 0 {
1003
+		c.ServeSuccessJSON(map[string]interface{}{
1004
+			"failed_code": -10,
1005
+			"msg":         res.ErrMsg,
1006
+		})
1007
+		return
1008
+	} else {
1009
+		if res.Output.Result.SscnoCheckStat == "0" {
1010
+			var msg string
1011
+			switch res.Output.Result.CardStat {
1012
+			case "00":
1013
+				msg = "未激活"
1014
+				break
1015
+			case "10":
1016
+				msg = "激活"
1017
+				break
1018
+			case "20":
1019
+				msg = "窗口挂失"
1020
+				break
1021
+			case "21":
1022
+				msg = "电话挂失"
1023
+				break
1024
+			case "22":
1025
+				msg = "单位网上申报挂失"
1026
+				break
1027
+			case "23":
1028
+				msg = "保健办挂失"
1029
+
1030
+				break
1031
+			case "24":
1032
+				msg = "个人网上挂失"
1033
+
1034
+				break
1035
+			case "25":
1036
+				msg = "网上服务大厅挂失"
1037
+				break
1038
+			case "30":
1039
+				msg = "注销"
1040
+				break
1041
+			case "40":
1042
+				msg = "回收"
1043
+				break
1044
+			case "99":
1045
+				msg = "制卡中(无效卡)"
1046
+				break
1047
+			}
1048
+			c.ServeSuccessJSON(map[string]interface{}{
1049
+				"failed_code": -10,
1050
+				"msg":         msg,
1051
+			})
1052
+			return
1053
+
1054
+		} else {
1055
+			c.ServeSuccessJSON(map[string]interface{}{
1056
+				"msg": "校验成功",
1057
+			})
1058
+			return
1059
+		}
1060
+	}
1061
+
1062
+}
1063
+
975 1064
 func (c *HisApiController) ReadCard() {
976 1065
 	id_card_type, _ := c.GetInt64("id_card_type")
977 1066
 	admin_user_id, _ := c.GetInt64("admin_user_id")
@@ -9033,6 +9122,60 @@ func (c *HisApiController) GetCheckAccount() {
9033 9122
 			infocode, _ := strconv.ParseInt(res10188.Infcode, 10, 64)
9034 9123
 			res.Infcode = infocode
9035 9124
 
9125
+		} else if miConfig.MdtrtareaAdmvs == "150499" {
9126
+
9127
+			api := "http://172.16.13.254:9532/" + "nmyb/3201?" +
9128
+				"insutype=" + insutype +
9129
+				"&clr_type=" + "11" +
9130
+				"&setl_optins=" + clr_org +
9131
+				"&stmt_begndate=" + start_time +
9132
+				"&stm_enddate=" + end_time +
9133
+				"&medfee_sumamt=" + fmt.Sprintf("%.4f", medfee_sumamt) +
9134
+				"&fund_pay_sumamt=" + fmt.Sprintf("%.4f", fund_pay_sumamt) +
9135
+				"&acct_pay=" + fmt.Sprintf("%.4f", acct_pay) +
9136
+				"&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
9137
+				"&fixmedins_code=" + miConfig.Code +
9138
+				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
9139
+				"&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
9140
+				"&secret_key=" + miConfig.SecretKey +
9141
+				"&org_name=" + miConfig.OrgName +
9142
+				"&doctor=" + user_name
9143
+			resp, requestErr := http.Get(api)
9144
+			if requestErr != nil {
9145
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9146
+				return
9147
+			}
9148
+			body, ioErr := ioutil.ReadAll(resp.Body)
9149
+			if ioErr != nil {
9150
+				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
9151
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9152
+				return
9153
+			}
9154
+			var respJSON map[string]interface{}
9155
+			if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
9156
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
9157
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9158
+				return
9159
+			}
9160
+
9161
+			respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
9162
+			result, _ := json.Marshal(respJSON)
9163
+			fmt.Println("log")
9164
+			fmt.Println(string(result))
9165
+			if err := json.Unmarshal([]byte(result), &res10188); err != nil {
9166
+				utils.ErrorLog("解析失败:%v", err)
9167
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9168
+				return
9169
+			}
9170
+
9171
+			res.InfRefmsgid = res10188.InfRefmsgid
9172
+			res.Output = res10188.Output
9173
+			res.ErrMsg = res10188.ErrMsg
9174
+			res.Cainfo = res10188.Cainfo
9175
+			res.WarnMsg = res10188.WarnMsg
9176
+			infocode, _ := strconv.ParseInt(res10188.Infcode, 10, 64)
9177
+			res.Infcode = infocode
9178
+
9036 9179
 		} else {
9037 9180
 			api := "http://127.0.0.1:9532/" + "gdyb/ten?" +
9038 9181
 				"insutype=" + insutype +
@@ -9103,7 +9246,6 @@ func (c *HisApiController) GetCheckAccount() {
9103 9246
 						"stmt_rslt":      res.Output.Stmtinfo.StmtRslt,
9104 9247
 						"stmt_rslt_dscr": res.Output.Stmtinfo.StmtRsltDscr,
9105 9248
 					})
9106
-
9107 9249
 				} else {
9108 9250
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9109 9251
 				}

+ 1 - 1
service/gdyb_service.go View File

@@ -1833,7 +1833,7 @@ func Gdyb3201(baseParams models.BaseParams, businessParams models.BusinessParams
1833 1833
 	inputMessage["infno"] = "3201"                                    // 交易编码
1834 1834
 	inputData["insutype"] = businessParams.Insutype                   // 险种
1835 1835
 	inputData["clr_type"] = businessParams.ClrType                    // 就诊 ID(来自2201接口返回)
1836
-	inputData["setl_optins"] = "440311"                               // 结算经办机构
1836
+	inputData["setl_optins"] = businessParams.SetlOptins              // 结算经办机构
1837 1837
 	inputData["stmt_begndate"] = businessParams.StmtBegndate          // 对帐开始时间
1838 1838
 	inputData["stmt_enddate"] = businessParams.StmtEnddate            //对帐结束时间
1839 1839
 	inputData["medfee_sumamt"] = businessParams.MedfeeSumamt          //医疗费总额