Browse Source

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

csx 3 years ago
parent
commit
28f4d2d8c8
1 changed files with 83 additions and 36 deletions
  1. 83 36
      controllers/sg/his_api_controller.go

+ 83 - 36
controllers/sg/his_api_controller.go View File

2005
 	Signtype    interface{} `json:"signtype"`
2005
 	Signtype    interface{} `json:"signtype"`
2006
 	WarnInfo    interface{} `json:"warn_info"`
2006
 	WarnInfo    interface{} `json:"warn_info"`
2007
 }
2007
 }
2008
+
2009
+type ResultTwo10265 struct {
2010
+	ErrMsg      string `json:"err_msg"`
2011
+	InfRefmsgid string `json:"inf_refmsgid"`
2012
+	Infcode     string `json:"infcode"`
2013
+	Output      struct {
2014
+		Baseinfo struct {
2015
+			Age         float64 `json:"age"`
2016
+			Brdy        string  `json:"brdy"`
2017
+			Certno      string  `json:"certno"`
2018
+			Gend        string  `json:"gend"`
2019
+			Naty        string  `json:"naty"`
2020
+			PsnCertType string  `json:"psn_cert_type"`
2021
+			PsnName     string  `json:"psn_name"`
2022
+			PsnNo       string  `json:"psn_no"`
2023
+		} `json:"baseinfo"`
2024
+		Idetinfo []interface{} `json:"idetinfo"`
2025
+		Iinfo    []struct {
2026
+			Balc                   float64 `json:"balc"`
2027
+			CvlservFlag            string  `json:"cvlserv_flag"`
2028
+			EmpName                string  `json:"emp_name"`
2029
+			InsuplcAdmdvs          string  `json:"insuplc_admdvs"`
2030
+			Insutype               string  `json:"insutype"`
2031
+			PausInsuDansuplcAdmdvs string  `json:"paus_insu_dansuplc_admdvs"`
2032
+			PausInsuDate           string  `json:"paus_insu_date"`
2033
+			PsnInsuDate            string  `json:"psn_insu_date"`
2034
+			PsnInsuStas            string  `json:"psn_insu_stas"`
2035
+			PsnType                string  `json:"psn_type"`
2036
+		} `json:"insuinfo"`
2037
+	} `json:"output"`
2038
+	RefmsgTime  string      `json:"refmsg_time"`
2039
+	RespondTime string      `json:"respond_time"`
2040
+	Signtype    interface{} `json:"signtype"`
2041
+	WarnInfo    interface{} `json:"warn_info"`
2042
+}
2043
+
2008
 type ResultThree struct {
2044
 type ResultThree struct {
2009
 	Cainfo      interface{} `json:"cainfo"`
2045
 	Cainfo      interface{} `json:"cainfo"`
2010
 	ErrMsg      string      `json:"err_msg"`
2046
 	ErrMsg      string      `json:"err_msg"`
2022
 	Signtype    interface{} `json:"signtype"`
2058
 	Signtype    interface{} `json:"signtype"`
2023
 	WarnMsg     interface{} `json:"warn_msg"`
2059
 	WarnMsg     interface{} `json:"warn_msg"`
2024
 }
2060
 }
2061
+
2062
+type ResultThree10265 struct {
2063
+	Cainfo      interface{} `json:"cainfo"`
2064
+	ErrMsg      string      `json:"err_msg"`
2065
+	InfRefmsgid string      `json:"inf_refmsgid"`
2066
+	Infcode     string      `json:"infcode"`
2067
+	Output      struct {
2068
+		Data struct {
2069
+			IptOtpNo string `json:"ipt_otp_no"`
2070
+			MdtrtID  string `json:"mdtrt_id"`
2071
+			PsnNo    string `json:"psn_no"`
2072
+		} `json:"data"`
2073
+	} `json:"output"`
2074
+	RefmsgTime  string      `json:"refmsg_time"`
2075
+	RespondTime string      `json:"respond_time"`
2076
+	Signtype    interface{} `json:"signtype"`
2077
+	WarnMsg     interface{} `json:"warn_msg"`
2078
+}
2079
+
2025
 type ResultFour struct {
2080
 type ResultFour struct {
2026
 	Cainfo      string `json:"cainfo"`
2081
 	Cainfo      string `json:"cainfo"`
2027
 	ErrMsg      string `json:"err_msg"`
2082
 	ErrMsg      string `json:"err_msg"`
2581
 
2636
 
2582
 	if config.IsOpen == 1 {
2637
 	if config.IsOpen == 1 {
2583
 		var res ResultTwo
2638
 		var res ResultTwo
2639
+		var res10265 ResultTwo10265
2584
 		var PsnNo string
2640
 		var PsnNo string
2585
 		var PsnCertType string
2641
 		var PsnCertType string
2586
 		var Certno string
2642
 		var Certno string
2591
 		var Age float64
2647
 		var Age float64
2592
 		var infoStr string
2648
 		var infoStr string
2593
 		var idetinfoStr string
2649
 		var idetinfoStr string
2650
+		var infocode int64
2594
 		if miConfig.MdtrtareaAdmvs == "421300" {
2651
 		if miConfig.MdtrtareaAdmvs == "421300" {
2595
 			psn_info, _ := service.GetPsnByPatientId(id)
2652
 			psn_info, _ := service.GetPsnByPatientId(id)
2596
 			PsnNo = psn_info.PsnNo
2653
 			PsnNo = psn_info.PsnNo
2613
 				return
2670
 				return
2614
 			}
2671
 			}
2615
 
2672
 
2673
+			if err := json.Unmarshal([]byte(result), &res10265); err != nil {
2674
+				utils.ErrorLog("解析失败:%v", err)
2675
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2676
+				return
2677
+			}
2678
+
2616
 			PsnNo = res.Output.Baseinfo.PsnNo
2679
 			PsnNo = res.Output.Baseinfo.PsnNo
2617
 			PsnCertType = res.Output.Baseinfo.PsnCertType
2680
 			PsnCertType = res.Output.Baseinfo.PsnCertType
2618
 			Certno = res.Output.Baseinfo.Certno
2681
 			Certno = res.Output.Baseinfo.Certno
2625
 			Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
2688
 			Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
2626
 			infoStr = string(Iinfos)
2689
 			infoStr = string(Iinfos)
2627
 			idetinfoStr = string(Idetinfos)
2690
 			idetinfoStr = string(Idetinfos)
2691
+			if miConfig.Code == "H15049901371" {
2692
+				infocode, _ = strconv.ParseInt(res10265.Infcode, 10, 64)
2693
+
2694
+			} else {
2695
+
2696
+				infocode = res.Infcode
2697
+			}
2628
 
2698
 
2629
 		}
2699
 		}
2630
 
2700
 
2631
-		if res.Infcode == 0 {
2701
+		if infocode == 0 {
2632
 			his := models.VMHisPatient{
2702
 			his := models.VMHisPatient{
2633
 				Name:                   name,
2703
 				Name:                   name,
2634
 				Gender:                 gender,
2704
 				Gender:                 gender,
2682
 				IdCardNo = patient.IdCardNo
2752
 				IdCardNo = patient.IdCardNo
2683
 			}
2753
 			}
2684
 
2754
 
2685
-			//var insutypes []string
2686
-			//
2687
-			//var insutype string
2688
-			//var is390 int = 0
2689
-			//var is310 int = 0
2690
-			//for _, item := range res.Output.Iinfo {
2691
-			//	if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
2692
-			//		insutypes = append(insutypes, item.Insutype)
2693
-			//	}
2694
-			//}
2695
-			//if len(insutypes) == 1 {
2696
-			//	insutype = insutypes[0]
2697
-			//} else {
2698
-			//	for _, i := range insutypes {
2699
-			//		if i == "390" {
2700
-			//			is390 = 1
2701
-			//		}
2702
-			//
2703
-			//		if i == "310" {
2704
-			//			is310 = 1
2705
-			//		}
2706
-			//	}
2707
-			//}
2708
-			//if is390 == 1 {
2709
-			//	insutype = "390"
2710
-			//}
2711
-			//if is310 == 1 {
2712
-			//	insutype = "310"
2713
-			//}
2714
-			//
2715
-			//if len(insutypes) == 0 {
2716
-			//	insutype = "310"
2717
-			//}
2718
-
2719
 			var rf []*ResultFive
2755
 			var rf []*ResultFive
2720
 			json.Unmarshal([]byte(his.Iinfo), &rf)
2756
 			json.Unmarshal([]byte(his.Iinfo), &rf)
2721
 			var insutypes []*ResultFive
2757
 			var insutypes []*ResultFive
2764
 					insuplc_admdvs = item.InsuplcAdmdvs
2800
 					insuplc_admdvs = item.InsuplcAdmdvs
2765
 				}
2801
 				}
2766
 			}
2802
 			}
2803
+			var infocode int64
2767
 			var resThree ResultThree
2804
 			var resThree ResultThree
2805
+			var resThree10265 ResultThree10265
2806
+
2768
 			if miConfig.MdtrtareaAdmvs == "421300" {
2807
 			if miConfig.MdtrtareaAdmvs == "421300" {
2769
 				api := "http://192.168.124.4:9532/" + "hbyb/2201?psn_no=" + PsnNo + "&insutype=" + insutype + "&cert_no=" + Certno + "&ipt_otp_no=" + ipt_otp_no +
2808
 				api := "http://192.168.124.4:9532/" + "hbyb/2201?psn_no=" + PsnNo + "&insutype=" + insutype + "&cert_no=" + Certno + "&ipt_otp_no=" + ipt_otp_no +
2770
 					"&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
2809
 					"&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
2798
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2837
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2799
 					return
2838
 					return
2800
 				}
2839
 				}
2840
+				infocode = resThree.Infcode
2801
 
2841
 
2802
 			} else {
2842
 			} else {
2803
 				fmt.Println(roles.UserName)
2843
 				fmt.Println(roles.UserName)
2808
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2848
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2809
 					return
2849
 					return
2810
 				}
2850
 				}
2851
+				if miConfig.Code == "H15049901371" {
2852
+					infocode, _ = strconv.ParseInt(resThree10265.Infcode, 10, 64)
2853
+				} else {
2854
+					infocode = resThree.Infcode
2855
+
2856
+				}
2857
+
2811
 			}
2858
 			}
2812
 
2859
 
2813
-			if resThree.Infcode != 0 {
2860
+			if infocode != 0 {
2814
 				adminUser := c.GetAdminUserInfo()
2861
 				adminUser := c.GetAdminUserInfo()
2815
 				errlog := &models.HisOrderError{
2862
 				errlog := &models.HisOrderError{
2816
 					UserOrgId:  adminUser.CurrentOrgId,
2863
 					UserOrgId:  adminUser.CurrentOrgId,