test_user 1 년 전
부모
커밋
17400b60d5
7개의 변경된 파일3048개의 추가작업 그리고 38개의 파일을 삭제
  1. 1 1
      conf/app.conf
  2. 21 0
      controllers/nm/nm_controller.go
  3. 812 25
      controllers/sg/his_api_controller.go
  4. 13 7
      controllers/zh/zh_his_api_controller.go
  5. 2000 0
      service/hn_service.go
  6. 145 5
      service/jx_service.go
  7. 56 0
      service/zh_his_service.go

+ 1 - 1
conf/app.conf 파일 보기

@@ -45,7 +45,7 @@ appsecret="61ee2e6268497d5aa9de0b0187c39aea"
45 45
 
46 46
 
47 47
 [prod]
48
-org_id = 10106
48
+org_id = 10387
49 49
 mobile_token_expiration_second = 86400
50 50
 httpdomain = https://api.xt.kuyicloud.com
51 51
 sso_domain = https://sso.kuyicloud.com

+ 21 - 0
controllers/nm/nm_controller.go 파일 보기

@@ -44,6 +44,7 @@ func NmybRegistRouters() {
44 44
 	beego.Router("/nmyb/2202", &NmController{}, "get:Post2202")
45 45
 
46 46
 	beego.Router("/nmyb/4101", &NmController{}, "post:Post4101")
47
+	beego.Router("/nmyb/2601", &NmController{}, "get:Get2601")
47 48
 
48 49
 }
49 50
 
@@ -980,3 +981,23 @@ func (c *NmController) Get3201() {
980 981
 		"pre": dat,
981 982
 	})
982 983
 }
984
+func (c *NmController) Get2601() {
985
+	result := service.Gdyb26011("150000CFSJM100000100135084", "H15049901371202210111721190000", "2305", "赤峰费森血液透析中心", "李彩星", "H15049901371", "150402", "150499", "MSDBYGxXm1Mtyi3PtOUB7n1ktcxwyW57\n")
986
+	var dat map[string]interface{}
987
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
988
+		fmt.Println(dat)
989
+	} else {
990
+		fmt.Println(err)
991
+	}
992
+	result2 := service.Gdyb26011("150000CFSJM100000100135084", "H15049901371202209281143070000", "2304", "赤峰费森血液透析中心", "李彩星", "H15049901371", "150402", "150499", "MSDBYGxXm1Mtyi3PtOUB7n1ktcxwyW57\n")
993
+	var dat2 map[string]interface{}
994
+	if err := json.Unmarshal([]byte(result2), &dat2); err == nil {
995
+		fmt.Println(dat2)
996
+	} else {
997
+		fmt.Println(err)
998
+	}
999
+
1000
+	c.ServeSuccessJSON(map[string]interface{}{
1001
+		"pre": dat,
1002
+	})
1003
+}

+ 812 - 25
controllers/sg/his_api_controller.go 파일 보기

@@ -298,6 +298,84 @@ func (c *HisApiController) ReadEleToken() {
298 298
 		fmt.Println(ele.Data.UserName)
299 299
 		result2, requestLog2 := service.Jxyb1101ForEleCert(miConfig.OrgName, roles.UserName, miConfig.Code, ele.Data.InsuOrg, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Url, miConfig.AccessKey, token, "", ele.Data.IdNo, ele.Data.UserName)
300 300
 
301
+		saveLog(result2, requestLog2, "1101", "获取人员信息")
302
+		var res ResultTwo
303
+		if err := json.Unmarshal([]byte(result2), &res); err != nil {
304
+			utils.ErrorLog("解析失败:%v", err)
305
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
306
+			return
307
+		}
308
+		if res.Infcode == 0 {
309
+			patient, err := service.GetPatientByNumber(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
310
+			if err == gorm.ErrRecordNotFound {
311
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
312
+				return
313
+			} else if err != nil {
314
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
315
+				return
316
+			} else {
317
+				Iinfos, _ := json.Marshal(res.Output.Iinfo)
318
+				Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
319
+				infoStr := string(Iinfos)
320
+				idetinfoStr := string(Idetinfos)
321
+				psn := &models.HisPsn{
322
+					PsnNo:        res.Output.Baseinfo.PsnNo,
323
+					Age:          res.Output.Baseinfo.Age,
324
+					PatientId:    patient.ID,
325
+					Certno:       res.Output.Baseinfo.Certno,
326
+					Brdy:         res.Output.Baseinfo.Brdy,
327
+					Gend:         res.Output.Baseinfo.Gend,
328
+					Naty:         res.Output.Baseinfo.Naty,
329
+					PsnCertType:  res.Output.Baseinfo.PsnCertType,
330
+					PsnName:      res.Output.Baseinfo.PsnName,
331
+					Idetinfo:     idetinfoStr,
332
+					Insuinfo:     infoStr,
333
+					UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
334
+					CardInfo:     "",
335
+					VerifyNumber: token,
336
+				}
337
+				service.CreateHisPsn(psn)
338
+				c.ServeSuccessJSON(map[string]interface{}{
339
+					"patient": patient,
340
+					"number":  token,
341
+				})
342
+			}
343
+		} else {
344
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
345
+			return
346
+		}
347
+	} else if miConfig.MdtrtareaAdmvs == "430800" {
348
+		if initFlag == 0 {
349
+			c.TestGetJiangXiBasBaseInit()
350
+		}
351
+		json_result := GetJxEleBaseInfo(c.GetAdminUserInfo().CurrentOrgId)
352
+		type ELeData struct {
353
+			Data struct {
354
+				IdNo        string `json:"idNo"`
355
+				IdType      string `json:"idType"`
356
+				UserName    string `json:"userName"`
357
+				EcToken     string `json:"ecToken"`
358
+				InsuOrg     string `json:"insuOrg"`
359
+				Gender      string `json:"gender"`
360
+				Birthday    string `json:"birthday"`
361
+				Nationality string `json:"nationality"`
362
+				Email       string `json:"email"`
363
+				Extra       string `json:"extra"`
364
+			} `json:"data"`
365
+			Code    int    `json:"code"`
366
+			Message string `json:"message"`
367
+		}
368
+
369
+		var ele ELeData
370
+		err := json.Unmarshal([]byte(json_result), &ele)
371
+		if err != nil {
372
+			utils.ErrorLog("解析失败:%v", err)
373
+		}
374
+		token := ele.Data.EcToken
375
+		token = Remove0000(token)
376
+		fmt.Println(ele.Data.UserName)
377
+		result2, requestLog2 := service.Hnyb1101ForEleCert(miConfig.OrgName, roles.UserName, miConfig.Code, ele.Data.InsuOrg, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Url, miConfig.AccessKey, token, "", ele.Data.IdNo, ele.Data.UserName)
378
+
301 379
 		saveLog(result2, requestLog2, "1101", "获取人员信息")
302 380
 		var res ResultTwo
303 381
 		if err := json.Unmarshal([]byte(result2), &res); err != nil {
@@ -1416,6 +1494,25 @@ func (c *HisApiController) GetPsnNcdsInfo() {
1416 1494
 			return
1417 1495
 		}
1418 1496
 
1497
+	} else if miConfig.MdtrtareaAdmvs == "430800" {
1498
+		p, _ := service.GetHisPatientById(patient_id)
1499
+
1500
+		result, _ := service.Hnyb5301(p.PsnNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Url, miConfig.AccessKey, "")
1501
+
1502
+		var dat map[string]interface{}
1503
+		if err := json.Unmarshal([]byte(result), &dat); err == nil {
1504
+			fmt.Println(dat)
1505
+		} else {
1506
+			fmt.Println(err)
1507
+		}
1508
+
1509
+		userJSONBytes, _ := json.Marshal(dat)
1510
+		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
1511
+			utils.ErrorLog("解析失败:%v", err)
1512
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1513
+			return
1514
+		}
1515
+
1419 1516
 	} else {
1420 1517
 
1421 1518
 		result := service.Gdyb5301(psn_record.PsnNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey)
@@ -2169,10 +2266,168 @@ func (c *HisApiController) ReadCard() {
2169 2266
 						VerifyNumber: "",
2170 2267
 					}
2171 2268
 					service.CreateHisPsn(psn)
2269
+					var rf []*ResultFive
2270
+					json.Unmarshal([]byte(infoStr), &rf)
2271
+
2272
+					var insutypes []*ResultFive
2273
+					var insutype string
2274
+					var is390 int = 0
2275
+					var is310 int = 0
2276
+
2277
+					for _, item := range rf {
2278
+						if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
2279
+							insutypes = append(insutypes, item)
2280
+						}
2281
+					}
2282
+
2283
+					if len(insutypes) == 1 {
2284
+						insutype = insutypes[0].Insutype
2285
+						//insuplc_admdvs = insutypes[0].InsuplcAdmdvs
2286
+					} else {
2287
+						for _, i := range insutypes {
2288
+							if i.Insutype == "390" {
2289
+								is390 = 1
2290
+							}
2291
+
2292
+							if i.Insutype == "310" {
2293
+								is310 = 1
2294
+							}
2295
+						}
2296
+					}
2297
+					if is390 == 1 {
2298
+						insutype = "390"
2299
+					}
2300
+
2301
+					if is310 == 1 {
2302
+						insutype = "310"
2303
+					}
2304
+
2305
+					if len(insutypes) == 0 {
2306
+						insutype = "310"
2307
+					}
2172 2308
 
2173 2309
 					c.ServeSuccessJSON(map[string]interface{}{
2174
-						"patient": patient,
2175
-						"number":  basNumber,
2310
+						"patient":  patient,
2311
+						"number":   basNumber,
2312
+						"insutype": insutype,
2313
+					})
2314
+				}
2315
+			} else {
2316
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
2317
+				return
2318
+			}
2319
+
2320
+		} else if miConfig.MdtrtareaAdmvs == "430800" {
2321
+			fmt.Println(initFlag)
2322
+			fmt.Println("initFlag")
2323
+
2324
+			if initFlag == 0 {
2325
+				c.TestGetJiangXiBasBaseInit()
2326
+			}
2327
+			basStr := c.GetBasBaseInfo()
2328
+			if len(basStr) == 0 {
2329
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
2330
+				return
2331
+			}
2332
+			fmt.Println(basStr)
2333
+			bas := strings.Split(basStr, "|")
2334
+			basNumber := bas[1]
2335
+			fmt.Println(basNumber)
2336
+			card_sn := bas[3]
2337
+			fmt.Println(card_sn)
2338
+			result, _ := service.Hnyb1101(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, "1", miConfig.Url, miConfig.AccessKey, "")
2339
+
2340
+			//result := service.Jxyb1101(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, certificates)
2341
+			var dat map[string]interface{}
2342
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
2343
+				fmt.Println(dat)
2344
+			} else {
2345
+				fmt.Println(err)
2346
+			}
2347
+
2348
+			userJSONBytes, _ := json.Marshal(dat)
2349
+			var res ResultTwo
2350
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
2351
+				utils.ErrorLog("解析失败:%v", err)
2352
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2353
+				return
2354
+			}
2355
+
2356
+			if res.Infcode == 0 {
2357
+				patient, err := service.GetPatientByNumber(basNumber, c.GetAdminUserInfo().CurrentOrgId)
2358
+				if err == gorm.ErrRecordNotFound {
2359
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
2360
+					return
2361
+				} else if err != nil {
2362
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2363
+					return
2364
+
2365
+				} else {
2366
+					Iinfos, _ := json.Marshal(res.Output.Iinfo)
2367
+					Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
2368
+					infoStr := string(Iinfos)
2369
+					idetinfoStr := string(Idetinfos)
2370
+					psn := &models.HisPsn{
2371
+						PsnNo:        res.Output.Baseinfo.PsnNo,
2372
+						Age:          res.Output.Baseinfo.Age,
2373
+						PatientId:    patient.ID,
2374
+						Certno:       res.Output.Baseinfo.Certno,
2375
+						Brdy:         res.Output.Baseinfo.Brdy,
2376
+						Gend:         res.Output.Baseinfo.Gend,
2377
+						Naty:         res.Output.Baseinfo.Naty,
2378
+						PsnCertType:  res.Output.Baseinfo.PsnCertType,
2379
+						PsnName:      res.Output.Baseinfo.PsnName,
2380
+						Idetinfo:     idetinfoStr,
2381
+						Insuinfo:     infoStr,
2382
+						UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
2383
+						CardInfo:     basStr,
2384
+						VerifyNumber: "",
2385
+					}
2386
+					service.CreateHisPsn(psn)
2387
+					var rf []*ResultFive
2388
+					json.Unmarshal([]byte(infoStr), &rf)
2389
+
2390
+					var insutypes []*ResultFive
2391
+					var insutype string
2392
+					var is390 int = 0
2393
+					var is310 int = 0
2394
+
2395
+					for _, item := range rf {
2396
+						if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
2397
+							insutypes = append(insutypes, item)
2398
+						}
2399
+					}
2400
+
2401
+					if len(insutypes) == 1 {
2402
+						insutype = insutypes[0].Insutype
2403
+						//insuplc_admdvs = insutypes[0].InsuplcAdmdvs
2404
+					} else {
2405
+						for _, i := range insutypes {
2406
+							if i.Insutype == "390" {
2407
+								is390 = 1
2408
+							}
2409
+
2410
+							if i.Insutype == "310" {
2411
+								is310 = 1
2412
+							}
2413
+						}
2414
+					}
2415
+					if is390 == 1 {
2416
+						insutype = "390"
2417
+					}
2418
+
2419
+					if is310 == 1 {
2420
+						insutype = "310"
2421
+					}
2422
+
2423
+					if len(insutypes) == 0 {
2424
+						insutype = "310"
2425
+					}
2426
+
2427
+					c.ServeSuccessJSON(map[string]interface{}{
2428
+						"patient":  patient,
2429
+						"number":   basNumber,
2430
+						"insutype": insutype,
2176 2431
 					})
2177 2432
 				}
2178 2433
 			} else {
@@ -2598,10 +2853,51 @@ func (c *HisApiController) ReadCard() {
2598 2853
 							CardInfo:     card_info,
2599 2854
 							VerifyNumber: token,
2600 2855
 						}
2856
+						var rf []*ResultFive
2857
+						json.Unmarshal([]byte(infoStr), &rf)
2858
+
2859
+						var insutypes []*ResultFive
2860
+						var insutype string
2861
+						var is390 int = 0
2862
+						var is310 int = 0
2863
+
2864
+						for _, item := range rf {
2865
+							if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
2866
+								insutypes = append(insutypes, item)
2867
+							}
2868
+						}
2869
+
2870
+						if len(insutypes) == 1 {
2871
+							insutype = insutypes[0].Insutype
2872
+							//insuplc_admdvs = insutypes[0].InsuplcAdmdvs
2873
+						} else {
2874
+							for _, i := range insutypes {
2875
+								if i.Insutype == "390" {
2876
+									is390 = 1
2877
+								}
2878
+
2879
+								if i.Insutype == "310" {
2880
+									is310 = 1
2881
+								}
2882
+							}
2883
+						}
2884
+						if is390 == 1 {
2885
+							insutype = "390"
2886
+						}
2887
+
2888
+						if is310 == 1 {
2889
+							insutype = "310"
2890
+						}
2891
+
2892
+						if len(insutypes) == 0 {
2893
+							insutype = "310"
2894
+						}
2895
+
2601 2896
 						service.CreateHisPsn(psn)
2602 2897
 						c.ServeSuccessJSON(map[string]interface{}{
2603
-							"patient": patient,
2604
-							"number":  token,
2898
+							"patient":  patient,
2899
+							"number":   token,
2900
+							"insutype": insutype,
2605 2901
 						})
2606 2902
 					}
2607 2903
 				} else {
@@ -2743,9 +3039,171 @@ func (c *HisApiController) ReadCard() {
2743 3039
 						VerifyNumber: token,
2744 3040
 					}
2745 3041
 					service.CreateHisPsn(psn)
3042
+					var rf []*ResultFive
3043
+					json.Unmarshal([]byte(infoStr), &rf)
3044
+
3045
+					var insutypes []*ResultFive
3046
+					var insutype string
3047
+					var is390 int = 0
3048
+					var is310 int = 0
3049
+
3050
+					for _, item := range rf {
3051
+						if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
3052
+							insutypes = append(insutypes, item)
3053
+						}
3054
+					}
3055
+
3056
+					if len(insutypes) == 1 {
3057
+						insutype = insutypes[0].Insutype
3058
+						//insuplc_admdvs = insutypes[0].InsuplcAdmdvs
3059
+					} else {
3060
+						for _, i := range insutypes {
3061
+							if i.Insutype == "390" {
3062
+								is390 = 1
3063
+							}
3064
+
3065
+							if i.Insutype == "310" {
3066
+								is310 = 1
3067
+							}
3068
+						}
3069
+					}
3070
+					if is390 == 1 {
3071
+						insutype = "390"
3072
+					}
3073
+
3074
+					if is310 == 1 {
3075
+						insutype = "310"
3076
+					}
3077
+
3078
+					if len(insutypes) == 0 {
3079
+						insutype = "310"
3080
+					}
3081
+
2746 3082
 					c.ServeSuccessJSON(map[string]interface{}{
2747
-						"patient": patient,
2748
-						"number":  token,
3083
+						"patient":  patient,
3084
+						"number":   token,
3085
+						"insutype": insutype,
3086
+					})
3087
+				}
3088
+			} else {
3089
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
3090
+				return
3091
+			}
3092
+
3093
+		} else if miConfig.MdtrtareaAdmvs == "430800" {
3094
+			//if initFlag == 0 {
3095
+			c.TestGetJiangXiBasBaseInit()
3096
+			//}
3097
+			//if initEleFlag == 0 {
3098
+			//	GetJxEleBaseInitInfo(c.GetAdminUserInfo().CurrentOrgId)
3099
+			//}
3100
+			json_result := GetJxEleBaseInfo(c.GetAdminUserInfo().CurrentOrgId)
3101
+			type ELeData struct {
3102
+				Data struct {
3103
+					IdNo        string `json:"idNo"`
3104
+					IdType      string `json:"idType"`
3105
+					UserName    string `json:"userName"`
3106
+					EcToken     string `json:"ecToken"`
3107
+					InsuOrg     string `json:"insuOrg"`
3108
+					Gender      string `json:"gender"`
3109
+					Birthday    string `json:"birthday"`
3110
+					Nationality string `json:"nationality"`
3111
+					Email       string `json:"email"`
3112
+					Extra       string `json:"extra"`
3113
+				} `json:"data"`
3114
+				Code    int    `json:"code"`
3115
+				Message string `json:"message"`
3116
+			}
3117
+
3118
+			var ele ELeData
3119
+			err := json.Unmarshal([]byte(json_result), &ele)
3120
+			if err != nil {
3121
+				utils.ErrorLog("解析失败:%v", err)
3122
+			}
3123
+			token := ele.Data.EcToken
3124
+			token = Remove0000(token)
3125
+			result2, requestLog2 := service.Hnyb1101ForEleCert(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Url, miConfig.AccessKey, token, "", ele.Data.IdNo, ele.Data.UserName)
3126
+			saveLog(result2, requestLog2, "1101", "获取人员信息")
3127
+			var res ResultTwo
3128
+			if err := json.Unmarshal([]byte(result2), &res); err != nil {
3129
+				utils.ErrorLog("解析失败:%v", err)
3130
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3131
+				return
3132
+			}
3133
+			if res.Infcode == 0 {
3134
+				patient, err := service.GetPatientByNumber(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
3135
+				if err == gorm.ErrRecordNotFound {
3136
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
3137
+					return
3138
+				} else if err != nil {
3139
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3140
+					return
3141
+				} else {
3142
+					Iinfos, _ := json.Marshal(res.Output.Iinfo)
3143
+					Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
3144
+					infoStr := string(Iinfos)
3145
+					idetinfoStr := string(Idetinfos)
3146
+					psn := &models.HisPsn{
3147
+						PsnNo:        res.Output.Baseinfo.PsnNo,
3148
+						Age:          res.Output.Baseinfo.Age,
3149
+						PatientId:    patient.ID,
3150
+						Certno:       res.Output.Baseinfo.Certno,
3151
+						Brdy:         res.Output.Baseinfo.Brdy,
3152
+						Gend:         res.Output.Baseinfo.Gend,
3153
+						Naty:         res.Output.Baseinfo.Naty,
3154
+						PsnCertType:  res.Output.Baseinfo.PsnCertType,
3155
+						PsnName:      res.Output.Baseinfo.PsnName,
3156
+						Idetinfo:     idetinfoStr,
3157
+						Insuinfo:     infoStr,
3158
+						UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
3159
+						CardInfo:     "",
3160
+						VerifyNumber: token,
3161
+					}
3162
+					service.CreateHisPsn(psn)
3163
+					var rf []*ResultFive
3164
+					json.Unmarshal([]byte(infoStr), &rf)
3165
+
3166
+					var insutypes []*ResultFive
3167
+					var insutype string
3168
+					var is390 int = 0
3169
+					var is310 int = 0
3170
+
3171
+					for _, item := range rf {
3172
+						if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
3173
+							insutypes = append(insutypes, item)
3174
+						}
3175
+					}
3176
+
3177
+					if len(insutypes) == 1 {
3178
+						insutype = insutypes[0].Insutype
3179
+						//insuplc_admdvs = insutypes[0].InsuplcAdmdvs
3180
+					} else {
3181
+						for _, i := range insutypes {
3182
+							if i.Insutype == "390" {
3183
+								is390 = 1
3184
+							}
3185
+
3186
+							if i.Insutype == "310" {
3187
+								is310 = 1
3188
+							}
3189
+						}
3190
+					}
3191
+					if is390 == 1 {
3192
+						insutype = "390"
3193
+					}
3194
+
3195
+					if is310 == 1 {
3196
+						insutype = "310"
3197
+					}
3198
+
3199
+					if len(insutypes) == 0 {
3200
+						insutype = "310"
3201
+					}
3202
+
3203
+					c.ServeSuccessJSON(map[string]interface{}{
3204
+						"patient":  patient,
3205
+						"number":   token,
3206
+						"insutype": insutype,
2749 3207
 					})
2750 3208
 				}
2751 3209
 			} else {
@@ -3263,8 +3721,8 @@ func (c *HisApiController) GetSettleList() {
3263 3721
 		HiType:         order.Insutype,
3264 3722
 		Insuplc:        miConfig.InsuplcAdmdvs,
3265 3723
 		MaindiagFlag:   "1",
3266
-		BillCode:       last_order.FaPiaoCode,
3267
-		BillNo:         zero,
3724
+		BillCode:       order.SetlId,
3725
+		BillNo:         order.SetlId,
3268 3726
 		BizSn:          order.Number,
3269 3727
 		PsnSelfPay:     order.PsnPartAmt,
3270 3728
 		PsnOwnPay:      order.PsnPartAmt,
@@ -3299,7 +3757,7 @@ func (c *HisApiController) GetSettleList() {
3299 3757
 	var tempOpspdiseinfo2 service.OpspdiseinfoStruct
3300 3758
 	var tempOpspdiseinfos []service.OpspdiseinfoStruct
3301 3759
 
3302
-	diagnosis_ids := strings.Split(order.Diagnosis, ",")
3760
+	diagnosis_ids := strings.Split(his.Diagnosis, ",")
3303 3761
 	var config []*models.HisXtDiagnoseConfig
3304 3762
 	for _, item := range diagnosis_ids {
3305 3763
 		id, _ := strconv.ParseInt(item, 10, 64)
@@ -3743,21 +4201,73 @@ func (c *HisApiController) GetSettleList() {
3743 4201
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3744 4202
 			return
3745 4203
 		}
3746
-
3747
-		respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
3748
-		userJSONBytes, _ := json.Marshal(respJSON)
3749
-		fmt.Println("log")
3750
-		fmt.Println(string(userJSONBytes))
3751
-		if err := json.Unmarshal(userJSONBytes, &resOther); err != nil {
4204
+
4205
+		respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
4206
+		userJSONBytes, _ := json.Marshal(respJSON)
4207
+		fmt.Println("log")
4208
+		fmt.Println(string(userJSONBytes))
4209
+		if err := json.Unmarshal(userJSONBytes, &resOther); err != nil {
4210
+			utils.ErrorLog("解析失败:%v", err)
4211
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4212
+			return
4213
+		}
4214
+		res.InfRefmsgid = resOther.InfRefmsgid
4215
+		res.Output = resOther.Output
4216
+		res.ErrMsg = resOther.ErrMsg
4217
+		infocode, _ := strconv.ParseInt(resOther.Infcode, 10, 64)
4218
+		res.Infcode = infocode
4219
+	} else if miConfig.MdtrtareaAdmvs == "360399" {
4220
+
4221
+		var pp models.PublicParams
4222
+		pp.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
4223
+		pp.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
4224
+		pp.FixmedinsName = miConfig.OrgName
4225
+		pp.FixmedinsCode = miConfig.Code
4226
+		pp.RequestUrl = miConfig.Url
4227
+		pp.Cainfo = miConfig.Cainfo
4228
+		pp.SecretKey = miConfig.SecretKey
4229
+		pp.AccessKey = miConfig.AccessKey
4230
+		pp.OpterName = curRoles.UserName
4231
+		result, _ := service.Jxyb4101(struct4101, pp)
4232
+		var dat map[string]interface{}
4233
+		if err := json.Unmarshal([]byte(result), &dat); err == nil {
4234
+			fmt.Println(dat)
4235
+		} else {
4236
+			fmt.Println(err)
4237
+		}
4238
+		userJSONBytes, _ := json.Marshal(dat)
4239
+		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
4240
+			utils.ErrorLog("解析失败:%v", err)
4241
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4242
+			return
4243
+		}
4244
+
4245
+	} else if miConfig.MdtrtareaAdmvs == "430800" {
4246
+
4247
+		var pp models.PublicParams
4248
+		pp.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
4249
+		pp.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
4250
+		pp.FixmedinsName = miConfig.OrgName
4251
+		pp.FixmedinsCode = miConfig.Code
4252
+		pp.RequestUrl = miConfig.Url
4253
+		pp.Cainfo = miConfig.Cainfo
4254
+		pp.SecretKey = miConfig.SecretKey
4255
+		pp.AccessKey = miConfig.AccessKey
4256
+		pp.OpterName = curRoles.UserName
4257
+		result, _ := service.Hnyb4101(struct4101, pp)
4258
+		var dat map[string]interface{}
4259
+		if err := json.Unmarshal([]byte(result), &dat); err == nil {
4260
+			fmt.Println(dat)
4261
+		} else {
4262
+			fmt.Println(err)
4263
+		}
4264
+		userJSONBytes, _ := json.Marshal(dat)
4265
+		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
3752 4266
 			utils.ErrorLog("解析失败:%v", err)
3753 4267
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3754 4268
 			return
3755 4269
 		}
3756
-		res.InfRefmsgid = resOther.InfRefmsgid
3757
-		res.Output = resOther.Output
3758
-		res.ErrMsg = resOther.ErrMsg
3759
-		infocode, _ := strconv.ParseInt(resOther.Infcode, 10, 64)
3760
-		res.Infcode = infocode
4270
+
3761 4271
 	} else {
3762 4272
 
3763 4273
 		result := service.Gdyb4101(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.UserOrgId)
@@ -3860,8 +4370,8 @@ func (c *HisApiController) GetSettleListHospital() {
3860 4370
 		HiType:         order.Insutype,
3861 4371
 		Insuplc:        miConfig.InsuplcAdmdvs,
3862 4372
 		MaindiagFlag:   "1",
3863
-		BillCode:       order.FaPiaoNumber,
3864
-		BillNo:         order.FaPiaoNumber,
4373
+		BillCode:       order.SetlId,
4374
+		BillNo:         order.SetlId,
3865 4375
 		BizSn:          order.Number,
3866 4376
 		PsnSelfPay:     order.PsnPartAmt,
3867 4377
 		PsnOwnPay:      order.PsnPartAmt,
@@ -6492,6 +7002,47 @@ func (c *HisApiController) GetRegisterInfo() {
6492 7002
 
6493 7003
 			}
6494 7004
 
7005
+		} else if miConfig.MdtrtareaAdmvs == "430800" {
7006
+			if id_card_type == 1 {
7007
+				psn_info, _ := service.GetPsnByPatientId(id)
7008
+				PsnNo = psn_info.PsnNo
7009
+				PsnCertType = psn_info.PsnCertType
7010
+				Certno = psn_info.Certno
7011
+				PsnName = psn_info.PsnName
7012
+				Gend = psn_info.Gend
7013
+				Naty = psn_info.Naty
7014
+				Brdy = psn_info.Brdy
7015
+				Age = psn_info.Age
7016
+				infoStr = psn_info.Insuinfo
7017
+				idetinfoStr = psn_info.Idetinfo
7018
+				infocode = 0
7019
+				verify_number = psn_info.VerifyNumber
7020
+
7021
+			} else if id_card_type == 2 {
7022
+				result, requestLog := service.Hnyb1101(patient.IdCardNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", "1", miConfig.Url, miConfig.AccessKey, "")
7023
+				saveLog(result, requestLog, "1101", "人员基本信息获取")
7024
+				if err := json.Unmarshal([]byte(result), &res); err != nil {
7025
+					utils.ErrorLog("解析失败:%v", err)
7026
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
7027
+					return
7028
+				}
7029
+
7030
+				PsnNo = res.Output.Baseinfo.PsnNo
7031
+				PsnCertType = res.Output.Baseinfo.PsnCertType
7032
+				Certno = res.Output.Baseinfo.Certno
7033
+				PsnName = res.Output.Baseinfo.PsnName
7034
+				Gend = res.Output.Baseinfo.Gend
7035
+				Naty = res.Output.Baseinfo.Naty
7036
+				Brdy = res.Output.Baseinfo.Brdy
7037
+				Age = res.Output.Baseinfo.Age
7038
+				Iinfos, _ := json.Marshal(res.Output.Iinfo)
7039
+				Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
7040
+				infoStr = string(Iinfos)
7041
+				idetinfoStr = string(Idetinfos)
7042
+				infocode = res.Infcode
7043
+
7044
+			}
7045
+
6495 7046
 		} else {
6496 7047
 
6497 7048
 			var result string
@@ -6865,16 +7416,48 @@ func (c *HisApiController) GetRegisterInfo() {
6865 7416
 				var result string
6866 7417
 				var requestLog string
6867 7418
 				if id_card_type == 1 {
6868
-					result, requestLog = service.Jxyb2201(PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, miConfig.MdtrtareaAdmvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, miConfig.Url, miConfig.AccessKey, psn_info.VerifyNumber, "")
7419
+					bas := strings.Split(psn_info.CardInfo, "|")
7420
+					basNumber := bas[2]
7421
+					card_sn := bas[3]
7422
+					result, requestLog = service.Jxyb2201(PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, miConfig.MdtrtareaAdmvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, miConfig.Url, miConfig.AccessKey, basNumber, "", card_sn)
7423
+					saveLog(result, requestLog, "2201A", "挂号")
7424
+
7425
+				} else if id_card_type == 2 {
7426
+					result, requestLog = service.Jxyb2201(PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, miConfig.Url, miConfig.AccessKey, IdCardNo, "", "")
7427
+					saveLog(result, requestLog, "2201A", "挂号")
7428
+
7429
+				} else {
7430
+
7431
+					result, requestLog = service.Jxyb2201(PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, insuplc_admdvs_temp, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, miConfig.Url, miConfig.AccessKey, psn_info.VerifyNumber, "", "")
7432
+					saveLog(result, requestLog, "2201A", "挂号")
7433
+
7434
+				}
7435
+
7436
+				if err := json.Unmarshal([]byte(result), &resThree); err != nil {
7437
+					utils.ErrorLog("解析失败:%v", err)
7438
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
7439
+					return
7440
+				}
7441
+				infocode = resThree.Infcode
7442
+			} else if miConfig.MdtrtareaAdmvs == "430800" { //江西萍乡
7443
+
7444
+				psn_info, _ := service.GetPsnByPatientId(id)
7445
+				var result string
7446
+				var requestLog string
7447
+				if id_card_type == 1 {
7448
+					bas := strings.Split(psn_info.CardInfo, "|")
7449
+					basNumber := bas[2]
7450
+					card_sn := bas[3]
7451
+					result, requestLog = service.Hnyb2201(PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, miConfig.MdtrtareaAdmvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, miConfig.Url, miConfig.AccessKey, basNumber, "", card_sn)
6869 7452
 					saveLog(result, requestLog, "2201A", "挂号")
6870 7453
 
6871 7454
 				} else if id_card_type == 2 {
6872
-					result, requestLog = service.Jxyb2201(PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, miConfig.Url, miConfig.AccessKey, IdCardNo, "")
7455
+					result, requestLog = service.Hnyb2201(PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, miConfig.Url, miConfig.AccessKey, IdCardNo, "", "")
6873 7456
 					saveLog(result, requestLog, "2201A", "挂号")
6874 7457
 
6875 7458
 				} else {
6876 7459
 
6877
-					result, requestLog = service.Jxyb2201(PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, insuplc_admdvs_temp, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, miConfig.Url, miConfig.AccessKey, psn_info.VerifyNumber, "")
7460
+					result, requestLog = service.Hnyb2201(PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, insuplc_admdvs_temp, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, miConfig.Url, miConfig.AccessKey, psn_info.VerifyNumber, "", "")
6878 7461
 					saveLog(result, requestLog, "2201A", "挂号")
6879 7462
 
6880 7463
 				}
@@ -8446,6 +9029,32 @@ func (c *HisApiController) GetUploadInfo() {
8446 9029
 					return
8447 9030
 				}
8448 9031
 
9032
+			} else if miConfig.MdtrtareaAdmvs == "430800" {
9033
+				psn_info, _ := service.GetPsnByPatientId(his.PatientId)
9034
+				var cert_no string
9035
+				if his.IdCardType == 1 {
9036
+					cert_no = strings.Split(psn_info.CardInfo, "|")[0]
9037
+				} else if his.IdCardType == 2 {
9038
+					cert_no = his.IdCardNo
9039
+				} else {
9040
+					cert_no = psn_info.VerifyNumber
9041
+
9042
+				}
9043
+				result2, src_resquest := service.Hnyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, tempOrder.FulamtOwnpayAmt, tempOrder.OverlmtSelfPay, tempOrder.PreselfpayAmt, tempOrder.InscpScpAmt, his.IdCardType, acct_used_flag, miConfig.Url, miConfig.AccessKey, cert_no, "")
9044
+				var dat map[string]interface{}
9045
+				if err := json.Unmarshal([]byte(result2), &dat); err == nil {
9046
+					fmt.Println(dat)
9047
+				} else {
9048
+					fmt.Println(err)
9049
+				}
9050
+				saveLog(result2, src_resquest, "2207", "结算")
9051
+				userJSONBytes, _ := json.Marshal(dat)
9052
+				if err := json.Unmarshal(userJSONBytes, &res); err != nil {
9053
+					utils.ErrorLog("解析失败:%v", err)
9054
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9055
+					return
9056
+				}
9057
+
8449 9058
 			} else {
8450 9059
 
8451 9060
 				var src_resquest string
@@ -9367,6 +9976,25 @@ func (c *HisApiController) GetPreUploadInfo() {
9367 9976
 			return
9368 9977
 		}
9369 9978
 
9979
+	} else if miConfig.MdtrtareaAdmvs == "430800" {
9980
+		var result string
9981
+		var requestLog string
9982
+		result, requestLog = service.Hnyb2203A(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, strconv.FormatInt(reg_type, 10), doctor_info.DoctorNumber, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config, miConfig.Url, miConfig.AccessKey, "")
9983
+
9984
+		saveLog(result, requestLog, "2203", "上传就诊信息")
9985
+		var respJSON2 map[string]interface{}
9986
+		if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
9987
+			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
9988
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9989
+			return
9990
+		}
9991
+		userJSONBytes2, _ := json.Marshal(respJSON2)
9992
+		if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
9993
+			utils.ErrorLog("解析失败:%v", err)
9994
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9995
+			return
9996
+		}
9997
+
9370 9998
 	} else {
9371 9999
 		var result string
9372 10000
 		var requestLog string
@@ -9640,6 +10268,24 @@ func (c *HisApiController) GetPreUploadInfo() {
9640 10268
 					return
9641 10269
 				}
9642 10270
 
10271
+			} else if miConfig.MdtrtareaAdmvs == "430800" {
10272
+				result, request_log := service.Hnyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, data["dept"].(string), data["fixmedins_code"].(string), data["dept_code"].(string), data["doctor_id"].(string), his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, data["balance_accounts_type"].(string), sickConfig.CountryCode, miConfig.Url, miConfig.AccessKey, doctor_info.UserName, "", "")
10273
+				var dat map[string]interface{}
10274
+				if err := json.Unmarshal([]byte(result), &dat); err == nil {
10275
+					fmt.Println(dat)
10276
+				} else {
10277
+					fmt.Println(err)
10278
+				}
10279
+				saveLog(result, request_log, "2204", "上传费用明细")
10280
+
10281
+				userJSONBytes, _ := json.Marshal(dat)
10282
+
10283
+				if err := json.Unmarshal(userJSONBytes, &res); err != nil {
10284
+					utils.ErrorLog("解析失败:%v", err)
10285
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
10286
+					return
10287
+				}
10288
+
9643 10289
 			} else {
9644 10290
 
9645 10291
 				if miConfig.Code == "H15049901371" {
@@ -10045,8 +10691,50 @@ func (c *HisApiController) GetPreUploadInfo() {
10045 10691
 						if his.IdCardType == 2 {
10046 10692
 							result, request_log = service.Jxyb2206(his.PsnNo, his.Number, chrg_bchno, his.IdCardNo, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, miConfig.Url, miConfig.AccessKey, his.IdCardNo, "")
10047 10693
 
10694
+						} else if his.IdCardType == 1 {
10695
+							psn_info, _ := service.GetPsnByPatientId(his.PatientId)
10696
+							bas := strings.Split(psn_info.CardInfo, "|")
10697
+							basNumber := bas[2]
10698
+							card_sn := bas[3]
10699
+							result, request_log = service.Jxyb2206Two(his.PsnNo, his.Number, chrg_bchno, psn_info.VerifyNumber, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, miConfig.Url, miConfig.AccessKey, basNumber, "", card_sn)
10700
+
10701
+						} else {
10702
+							psn_info, _ := service.GetPsnByPatientId(his.PatientId)
10703
+
10704
+							result, request_log = service.Jxyb2206(his.PsnNo, his.Number, chrg_bchno, psn_info.VerifyNumber, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, miConfig.Url, miConfig.AccessKey, psn_info.VerifyNumber, "")
10705
+
10706
+						}
10707
+						var dat map[string]interface{}
10708
+						if err := json.Unmarshal([]byte(result), &dat); err == nil {
10709
+							fmt.Println(dat)
10710
+						} else {
10711
+							fmt.Println(err)
10712
+						}
10713
+						saveLog(result, request_log, "2206", "预结算")
10714
+
10715
+						userJSONBytes, _ := json.Marshal(dat)
10716
+						if err := json.Unmarshal(userJSONBytes, &res); err != nil {
10717
+							utils.ErrorLog("解析失败:%v", err)
10718
+							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
10719
+							return
10720
+						}
10721
+
10722
+					} else if miConfig.MdtrtareaAdmvs == "430800" {
10723
+						var result string
10724
+						var request_log string
10725
+						if his.IdCardType == 2 {
10726
+							result, request_log = service.Hnyb2206(his.PsnNo, his.Number, chrg_bchno, his.IdCardNo, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, miConfig.Url, miConfig.AccessKey, his.IdCardNo, "")
10727
+
10728
+						} else if his.IdCardType == 1 {
10729
+							psn_info, _ := service.GetPsnByPatientId(his.PatientId)
10730
+							bas := strings.Split(psn_info.CardInfo, "|")
10731
+							basNumber := bas[2]
10732
+							card_sn := bas[3]
10733
+							result, request_log = service.Jxyb2206Two(his.PsnNo, his.Number, chrg_bchno, psn_info.VerifyNumber, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, miConfig.Url, miConfig.AccessKey, basNumber, "", card_sn)
10734
+
10048 10735
 						} else {
10049 10736
 							psn_info, _ := service.GetPsnByPatientId(his.PatientId)
10737
+
10050 10738
 							result, request_log = service.Jxyb2206(his.PsnNo, his.Number, chrg_bchno, psn_info.VerifyNumber, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, miConfig.Url, miConfig.AccessKey, psn_info.VerifyNumber, "")
10051 10739
 
10052 10740
 						}
@@ -10407,6 +11095,24 @@ func (c *HisApiController) Refund() {
10407 11095
 				return
10408 11096
 			}
10409 11097
 
11098
+		} else if miConfig.MdtrtareaAdmvs == "430800" {
11099
+			result, src_resquest = service.Hnyb2208(order.PsnNo, order.MdtrtId, order.SetlId, miConfig.OrgName, roles.UserName, miConfig.SecretKey, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.Url, miConfig.AccessKey, "")
11100
+			var dat map[string]interface{}
11101
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
11102
+				fmt.Println(dat)
11103
+			} else {
11104
+				fmt.Println(err)
11105
+			}
11106
+			saveLog(result, src_resquest, "2208", "退费")
11107
+
11108
+			userJSONBytes, _ := json.Marshal(dat)
11109
+
11110
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
11111
+				utils.ErrorLog("解析失败:%v", err)
11112
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
11113
+				return
11114
+			}
11115
+
10410 11116
 		} else {
10411 11117
 
10412 11118
 			if miConfig.Code == "H15049901371" {
@@ -10569,6 +11275,22 @@ func (c *HisApiController) Refund() {
10569 11275
 					fmt.Println(err)
10570 11276
 				}
10571 11277
 
11278
+				saveLog(result2, src_request, "2205", "撤销明细")
11279
+				userJSONBytes, _ := json.Marshal(dat)
11280
+				if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
11281
+					utils.ErrorLog("解析失败:%v", err)
11282
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
11283
+					return
11284
+				}
11285
+			} else if miConfig.MdtrtareaAdmvs == "430800" {
11286
+				result2, src_request := service.Hnyb2205(order.PsnNo, order.MdtrtId, order.Number, miConfig.OrgName, roles.UserName, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, miConfig.Url, miConfig.AccessKey, "")
11287
+				var dat map[string]interface{}
11288
+				if err := json.Unmarshal([]byte(result2), &dat); err == nil {
11289
+					fmt.Println(dat)
11290
+				} else {
11291
+					fmt.Println(err)
11292
+				}
11293
+
10572 11294
 				saveLog(result2, src_request, "2205", "撤销明细")
10573 11295
 				userJSONBytes, _ := json.Marshal(dat)
10574 11296
 				if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
@@ -10810,6 +11532,22 @@ func (c *HisApiController) RefundNumber() {
10810 11532
 				return
10811 11533
 			}
10812 11534
 
11535
+		} else if miConfig.MdtrtareaAdmvs == "430800" {
11536
+			result, request := service.Hnyb2202(his.PsnNo, his.Number, his.IptOtpNo, miConfig.OrgName, roles.UserName, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, miConfig.Url, miConfig.AccessKey, "")
11537
+			var dat map[string]interface{}
11538
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
11539
+				fmt.Println(dat)
11540
+			} else {
11541
+				fmt.Println(err)
11542
+			}
11543
+			saveLog(result, request, "2202", "退号")
11544
+			userJSONBytes, _ := json.Marshal(dat)
11545
+			if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
11546
+				utils.ErrorLog("解析失败:%v", err)
11547
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
11548
+				return
11549
+			}
11550
+
10813 11551
 		} else {
10814 11552
 			var api3 string
10815 11553
 
@@ -11112,6 +11850,40 @@ func (c *HisApiController) RefundDetail() {
11112 11850
 				})
11113 11851
 			}
11114 11852
 
11853
+		} else if miConfig.MdtrtareaAdmvs == "430800" {
11854
+			result2, src_request := service.Hnyb2205(his.PsnNo, his.Number, order.Number, miConfig.OrgName, roles.UserName, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, miConfig.Url, miConfig.AccessKey, "")
11855
+			var dat map[string]interface{}
11856
+			if err := json.Unmarshal([]byte(result2), &dat); err == nil {
11857
+				fmt.Println(dat)
11858
+			} else {
11859
+				fmt.Println(err)
11860
+			}
11861
+
11862
+			saveLog(result2, src_request, "2205", "撤销明细")
11863
+			userJSONBytes, _ := json.Marshal(dat)
11864
+			if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
11865
+				utils.ErrorLog("解析失败:%v", err)
11866
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
11867
+				return
11868
+			}
11869
+			if res2.Infcode == 0 {
11870
+				err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId, "", "")
11871
+				if err == nil {
11872
+					c.ServeSuccessJSON(map[string]interface{}{
11873
+						"msg": "撤销明细成功",
11874
+					})
11875
+					return
11876
+				} else {
11877
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
11878
+					return
11879
+				}
11880
+			} else {
11881
+				c.ServeSuccessJSON(map[string]interface{}{
11882
+					"code": -10,
11883
+					"msg":  res2.ErrMsg,
11884
+				})
11885
+			}
11886
+
11115 11887
 		} else {
11116 11888
 			api2 := "http://127.0.0.1:9532/" + "gdyb/six?psn_no=" + his.PsnNo +
11117 11889
 				"&mdtrt_id=" + his.Number + "&chrg_bchno=" + order.Number + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
@@ -12109,6 +12881,21 @@ func (c *HisApiController) GetSettleAccounts() {
12109 12881
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
12110 12882
 				return
12111 12883
 			}
12884
+		} else if miConfig.MdtrtareaAdmvs == "430800" {
12885
+			result, requestLog := service.Hnyb5203(baseParams, businessParams)
12886
+			saveLog(result, requestLog, "5203", "结算单")
12887
+			var dat map[string]interface{}
12888
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
12889
+				fmt.Println(dat)
12890
+			} else {
12891
+				fmt.Println(err)
12892
+			}
12893
+			userJSONBytes, _ := json.Marshal(dat)
12894
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
12895
+				utils.ErrorLog("解析失败:%v", err)
12896
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
12897
+				return
12898
+			}
12112 12899
 		} else if miConfig.MdtrtareaAdmvs == "150499" {
12113 12900
 
12114 12901
 			api := "http://172.16.13.254:9532/" + "nmyb/5203?psn_no=" + businessParams.PsnNo + "&mdtrt_id=" + businessParams.MdtrtId + "&setl_id=" + businessParams.SetlId +

+ 13 - 7
controllers/zh/zh_his_api_controller.go 파일 보기

@@ -1492,6 +1492,7 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
1492 1492
 		timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
1493 1493
 		var struct2401 service.Struct2401
1494 1494
 		struct2401.PsnNo = res2.Output.Baseinfo.PsnNo
1495
+		//insutype = "310"
1495 1496
 		struct2401.Insutype = insutype
1496 1497
 		psn_info, _ := service.GetPsnByPatientId(patient.ID)
1497 1498
 
@@ -1504,7 +1505,6 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
1504 1505
 			struct2401.MdtrtCertType = "02"
1505 1506
 			struct2401.MdtrtCertNo = res2.Output.Baseinfo.Certno
1506 1507
 		}
1507
-		insutype = "310"
1508 1508
 
1509 1509
 		if miConfig.Code == "H15049901371" {
1510 1510
 			if med_type == 14 {
@@ -1778,7 +1778,7 @@ func (this *ZHHisApiController) GetZHOutHospitalCheck() {
1778 1778
 		dise.DiagCode = item.CountryCode
1779 1779
 		dise.DiagName = item.ClassName
1780 1780
 		dise.DiagDept = departmentInfo.Name
1781
-		dise.DiseDorNo = strconv.FormatInt(int64(doctorInfo.AdminUserId), 10)
1781
+		dise.DiseDorNo = doctorInfo.DoctorNumber
1782 1782
 		dise.DiagTime = timeFormatOne
1783 1783
 
1784 1784
 		dises = append(dises, dise)
@@ -2982,11 +2982,11 @@ func (c *ZHHisApiController) ZHRefund() {
2982 2982
 
2983 2983
 		if res.Infcode == 0 {
2984 2984
 			err := service.UpdataOrderStatusThree(order_id, order.Number, adminUser.CurrentOrgId, "", result)
2985
-			////不同地区退费流程不一样,肇庆那边退费就包括撤销出院,内蒙古退费不包括撤销明细,所以下面需要根据不同情况进行判断
2986
-			//if miConfig.UserOrgId == 10215 {
2987
-			//	record.OutHospitalStatus = 0
2988
-			//	service.CreateHospitalRecord(&record)
2989
-			//}
2985
+			//不同地区退费流程不一样,肇庆那边退费就包括撤销出院,内蒙古退费不包括撤销明细,所以下面需要根据不同情况进行判断
2986
+			if miConfig.UserOrgId == 10215 {
2987
+				record.OutHospitalStatus = 0
2988
+				service.CreateHospitalRecord(&record)
2989
+			}
2990 2990
 			service.UpdataOrderStatusByNumber(record.Number)
2991 2991
 			if err == nil {
2992 2992
 				////当押金不为零时产生退费记录
@@ -3689,6 +3689,12 @@ func (c *ZHHisApiController) ReadCard() {
3689 3689
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
3690 3690
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
3691 3691
 
3692
+	if miConfig.MdtrtareaAdmvs == "" {
3693
+
3694
+	} else {
3695
+
3696
+	}
3697
+
3692 3698
 	var api string
3693 3699
 	api = "http://172.16.13.254:9532/" + "nmyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
3694 3700
 		"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&operator_id=" + strconv.FormatInt(admin_user_id, 10) + "&operator=" + roles.UserName

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2000 - 0
service/hn_service.go


+ 145 - 5
service/jx_service.go 파일 보기

@@ -172,7 +172,7 @@ func Jxyb1101ForEleCert(org_name string, doctor string, fixmedins_code string, i
172 172
 }
173 173
 
174 174
 // 门诊挂号
175
-func Jxyb2201(psnNo string, insutype string, certNo string, org_name string, opera string, ipt_otp_no string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, doctor_name string, request_url string, access_key string, verify_number string, cainfo string) (string, string) {
175
+func Jxyb2201(psnNo string, insutype string, certNo string, org_name string, opera string, ipt_otp_no string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, doctor_name string, request_url string, access_key string, verify_number string, cainfo string, card_sn string) (string, string) {
176 176
 	fmt.Println(opera)
177 177
 
178 178
 	// 生成签名
@@ -190,8 +190,11 @@ func Jxyb2201(psnNo string, insutype string, certNo string, org_name string, ope
190 190
 	inputData["begntime"] = timeFormatOne // 开始时间
191 191
 
192 192
 	if id_card_type == 1 {
193
-		inputData["mdtrt_cert_type"] = "03"                       // 就诊凭证类型
194
-		inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
193
+		inputData["mdtrt_cert_type"] = "03"        // 就诊凭证类型
194
+		inputData["card_sn"] = card_sn             // 卡识别码
195
+		inputData["certno"] = certNo               // 证件号码
196
+		inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
197
+
195 198
 	} else if id_card_type == 3 {
196 199
 		inputData["mdtrt_cert_type"] = "04"        // 就诊凭证类型
197 200
 		inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
@@ -626,8 +629,78 @@ func Jxyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
626 629
 		inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
627 630
 	} else {
628 631
 		if id_card_type == 1 {
632
+			inputData["mdtrt_cert_type"] = "03"        // 就诊凭证类型
633
+			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
634
+		} else if id_card_type == 3 {
635
+			inputData["mdtrt_cert_type"] = "04"        // 就诊凭证类型
636
+			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
637
+		} else if id_card_type == 4 {
638
+			inputData["mdtrt_cert_type"] = "01"        // 就诊凭证类型
639
+			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
640
+		} else {
629 641
 			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
630 642
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
643
+		}
644
+	}
645
+	if insuplc_admdvs == "421300" {
646
+		if med_type == "11" || med_type == "1112" || med_type == "1111" {
647
+			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
648
+		} else if med_type == "14" {
649
+			inputData["med_type"] = "140110" // 医疗类别 11 普通门诊  12 门诊挂号
650
+		}
651
+	} else {
652
+		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
653
+	}
654
+
655
+	inputData["medfee_sumamt"] = total  // 医疗费总额
656
+	inputData["psn_setlway"] = "01"     // 个人结算方式 01 按项目结 02 按定额结算
657
+	inputData["mdtrt_id"] = mdtrtId     // 就诊 ID(来自2201接口返回)
658
+	inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
659
+	inputData["acct_used_flag"] = "0"   // 个人账户使用标志 0否 1是
660
+	inputData["insutype"] = insutype    // 险种类型
661
+	inputData["invono"] = ""            // 发票号
662
+	inputData["exp_content"] = ""       // 人员编号 (来自1101接口返回)
663
+
664
+	input["data"] = inputData
665
+	inputMessage["input"] = input //交易输入
666
+
667
+	var requestLog string
668
+
669
+	bytesData, err := json.Marshal(inputMessage)
670
+
671
+	requestLog = string(bytesData)
672
+	fmt.Println(string(bytesData))
673
+	if err != nil {
674
+		fmt.Println(err.Error())
675
+		return err.Error(), ""
676
+	}
677
+	request_url = request_url + "2206"
678
+	//fmt.Println(JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
679
+
680
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2206"), requestLog
681
+
682
+}
683
+
684
+//  门诊预结算
685
+func Jxyb2206Two(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, request_url string, access_key string, verify_number string, cainfo string, card_sn string) (string, string) {
686
+
687
+	// 生成签名
688
+	timestamp := time.Now().Unix() //		inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
689
+	//		inputData["mdtrt_cert_no"] = certNo
690
+	// 生成输入报文
691
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
692
+	input := make(map[string]interface{})
693
+	inputData := make(map[string]interface{})
694
+	inputMessage["infno"] = "2206" // 交易编码
695
+	inputData["psn_no"] = psnNo    // 人员编号 (来自1101接口返回)
696
+	if certificates == 3 {
697
+		inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
698
+		inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
699
+	} else {
700
+		if id_card_type == 1 {
701
+			inputData["mdtrt_cert_type"] = "03"        // 就诊凭证类型
702
+			inputData["card_sn"] = card_sn             // 卡识别码
703
+			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
631 704
 		} else if id_card_type == 3 {
632 705
 			inputData["mdtrt_cert_type"] = "04"        // 就诊凭证类型
633 706
 			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
@@ -635,8 +708,8 @@ func Jxyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
635 708
 			inputData["mdtrt_cert_type"] = "01"        // 就诊凭证类型
636 709
 			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
637 710
 		} else {
638
-			inputData["mdtrt_cert_type"] = "02"        // 就诊凭证类型
639
-			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
711
+			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
712
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
640 713
 		}
641 714
 	}
642 715
 	if insuplc_admdvs == "421300" {
@@ -743,6 +816,73 @@ func Jxyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
743 816
 
744 817
 }
745 818
 
819
+//  门诊结算
820
+func Jxyb2207Two(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, acct_used_flag string, request_url string, access_key string, verify_number string, cainfo string, card_sn string) (string, string) {
821
+	// 生成签名
822
+	timestamp := time.Now().Unix()
823
+	// 生成输入报文
824
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
825
+	input := make(map[string]interface{})
826
+	inputData := make(map[string]interface{})
827
+	inputMessage["infno"] = "2207" // 交易编码
828
+	inputData["psn_no"] = psnNo    // 人员编号 (来自1101接口返回)
829
+
830
+	if id_card_type == 1 {
831
+		inputData["mdtrt_cert_type"] = "03"        // 就诊凭证类型
832
+		inputData["card_sn"] = card_sn             // 卡识别码
833
+		inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
834
+
835
+	} else if id_card_type == 3 {
836
+		inputData["mdtrt_cert_type"] = "04"        // 就诊凭证类型
837
+		inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
838
+	} else if id_card_type == 4 {
839
+		inputData["mdtrt_cert_type"] = "01"        // 就诊凭证类型
840
+		inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
841
+	} else {
842
+		inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
843
+		inputData["mdtrt_cert_no"] = certNo
844
+	}
845
+
846
+	if med_type == "1111" || med_type == "1112" {
847
+		med_type = "11"
848
+	}
849
+	if insuplc_admdvs == "421300" {
850
+		if med_type == "11" {
851
+			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
852
+		} else if med_type == "14" {
853
+			inputData["med_type"] = "140101" // 医疗类别 11 普通门诊  12 门诊挂号
854
+		}
855
+	} else {
856
+		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
857
+	}
858
+	inputData["medfee_sumamt"] = total           // 医疗费总额
859
+	inputData["psn_setlway"] = "01"              // 个人结算方式 01 按项目结 02 按定额结算
860
+	inputData["mdtrt_id"] = mdtrtId              // 就诊 ID(来自2201接口返回)
861
+	inputData["chrg_bchno"] = chrgBchno          // 收费批次号(来自2204生成的)
862
+	inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
863
+	inputData["insutype"] = insutype             // 险种类型
864
+	inputData["invono"] = ""                     // 发票号
865
+
866
+	inputData["fulamt_ownpay_amt"] = fulamt_ownpay_amt //
867
+	inputData["overlmt_selfpay"] = overlmt_selfpay     //
868
+	inputData["preselfpay_amt"] = preselfpay_amt       //
869
+	inputData["inscp_scp_amt"] = inscp_scp_amt         //
870
+	inputData["exp_content"] = ""                      // 人员编号 (来自1101接口返回)
871
+
872
+	input["data"] = inputData
873
+	inputMessage["input"] = input //交易输入
874
+
875
+	bytesData, err := json.Marshal(inputMessage)
876
+	fmt.Println(string(bytesData))
877
+	if err != nil {
878
+		fmt.Println(err.Error())
879
+		return err.Error(), ""
880
+	}
881
+	request_url = request_url + "2207"
882
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2207"), string(bytesData)
883
+
884
+}
885
+
746 886
 func Jxyb2207A(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, acct_used_flag string, request_url string, access_key string, cainfo string) (string, string) {
747 887
 	// 生成签名
748 888
 	timestamp := time.Now().Unix()

+ 56 - 0
service/zh_his_service.go 파일 보기

@@ -1046,6 +1046,62 @@ func ZHGdyb2304(psnNo string, mdtrtId string, chrgBchno string, certNo string, i
1046 1046
 
1047 1047
 	return str, str2
1048 1048
 }
1049
+func Gdyb26011(psnNo string, omsgid string, oinfno string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
1050
+	// 生成签名
1051
+	nonce := GetRandomString(32)
1052
+	timestamp := time.Now().Unix()
1053
+	signature := setSignature(timestamp, nonce, secret_key)
1054
+
1055
+	// 生成输入报文
1056
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
1057
+	input := make(map[string]interface{})
1058
+	inputData := make(map[string]interface{})
1059
+	inputMessage["infno"] = "2601" // 交易编码
1060
+	inputData["psn_no"] = psnNo
1061
+	inputData["omsgid"] = omsgid
1062
+	inputData["oinfno"] = oinfno
1063
+
1064
+	input["data"] = inputData
1065
+	inputMessage["input"] = input //交易输入
1066
+	bytesData, err := json.Marshal(inputMessage)
1067
+	fmt.Println(string(bytesData))
1068
+	if err != nil {
1069
+		fmt.Println(err.Error())
1070
+		return err.Error()
1071
+	}
1072
+	reader := bytes.NewReader(bytesData)
1073
+	gdyb_url := beego.AppConfig.String("gdyb_url")
1074
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
1075
+	url := gdyb_url + "2601"
1076
+	if mdtrtarea_admvs == "150499" {
1077
+		url = gdyb_url
1078
+	}
1079
+	request, err := http.NewRequest("POST", url, reader)
1080
+	if err != nil {
1081
+		fmt.Println(err.Error())
1082
+		return err.Error()
1083
+	}
1084
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1085
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
1086
+	request.Header.Set("x-tif-signature", signature)
1087
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1088
+	request.Header.Set("x-tif-nonce", nonce)
1089
+
1090
+	client := http.Client{}
1091
+	resp, err := client.Do(request)
1092
+	if err != nil {
1093
+		fmt.Println(err.Error())
1094
+		return err.Error()
1095
+	}
1096
+	respBytes, err := ioutil.ReadAll(resp.Body)
1097
+	if err != nil {
1098
+		fmt.Println(err.Error())
1099
+		return err.Error()
1100
+	}
1101
+	str := string(respBytes)
1102
+	fmt.Println(str)
1103
+	return str
1104
+}
1049 1105
 
1050 1106
 //  住院结算撤销
1051 1107
 func Gdyb2305(psnNo string, mdtrtId string, setlId string, org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) (string, string) {