소스 검색

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

csx 3 년 전
부모
커밋
28f4d2d8c8
1개의 변경된 파일83개의 추가작업 그리고 36개의 파일을 삭제
  1. 83 36
      controllers/sg/his_api_controller.go

+ 83 - 36
controllers/sg/his_api_controller.go 파일 보기

@@ -2005,6 +2005,42 @@ type ResultTwo struct {
2005 2005
 	Signtype    interface{} `json:"signtype"`
2006 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 2044
 type ResultThree struct {
2009 2045
 	Cainfo      interface{} `json:"cainfo"`
2010 2046
 	ErrMsg      string      `json:"err_msg"`
@@ -2022,6 +2058,25 @@ type ResultThree struct {
2022 2058
 	Signtype    interface{} `json:"signtype"`
2023 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 2080
 type ResultFour struct {
2026 2081
 	Cainfo      string `json:"cainfo"`
2027 2082
 	ErrMsg      string `json:"err_msg"`
@@ -2581,6 +2636,7 @@ func (c *HisApiController) GetRegisterInfo() {
2581 2636
 
2582 2637
 	if config.IsOpen == 1 {
2583 2638
 		var res ResultTwo
2639
+		var res10265 ResultTwo10265
2584 2640
 		var PsnNo string
2585 2641
 		var PsnCertType string
2586 2642
 		var Certno string
@@ -2591,6 +2647,7 @@ func (c *HisApiController) GetRegisterInfo() {
2591 2647
 		var Age float64
2592 2648
 		var infoStr string
2593 2649
 		var idetinfoStr string
2650
+		var infocode int64
2594 2651
 		if miConfig.MdtrtareaAdmvs == "421300" {
2595 2652
 			psn_info, _ := service.GetPsnByPatientId(id)
2596 2653
 			PsnNo = psn_info.PsnNo
@@ -2613,6 +2670,12 @@ func (c *HisApiController) GetRegisterInfo() {
2613 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 2679
 			PsnNo = res.Output.Baseinfo.PsnNo
2617 2680
 			PsnCertType = res.Output.Baseinfo.PsnCertType
2618 2681
 			Certno = res.Output.Baseinfo.Certno
@@ -2625,10 +2688,17 @@ func (c *HisApiController) GetRegisterInfo() {
2625 2688
 			Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
2626 2689
 			infoStr = string(Iinfos)
2627 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 2702
 			his := models.VMHisPatient{
2633 2703
 				Name:                   name,
2634 2704
 				Gender:                 gender,
@@ -2682,40 +2752,6 @@ func (c *HisApiController) GetRegisterInfo() {
2682 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 2755
 			var rf []*ResultFive
2720 2756
 			json.Unmarshal([]byte(his.Iinfo), &rf)
2721 2757
 			var insutypes []*ResultFive
@@ -2764,7 +2800,10 @@ func (c *HisApiController) GetRegisterInfo() {
2764 2800
 					insuplc_admdvs = item.InsuplcAdmdvs
2765 2801
 				}
2766 2802
 			}
2803
+			var infocode int64
2767 2804
 			var resThree ResultThree
2805
+			var resThree10265 ResultThree10265
2806
+
2768 2807
 			if miConfig.MdtrtareaAdmvs == "421300" {
2769 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 2809
 					"&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
@@ -2798,6 +2837,7 @@ func (c *HisApiController) GetRegisterInfo() {
2798 2837
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2799 2838
 					return
2800 2839
 				}
2840
+				infocode = resThree.Infcode
2801 2841
 
2802 2842
 			} else {
2803 2843
 				fmt.Println(roles.UserName)
@@ -2808,9 +2848,16 @@ func (c *HisApiController) GetRegisterInfo() {
2808 2848
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2809 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 2861
 				adminUser := c.GetAdminUserInfo()
2815 2862
 				errlog := &models.HisOrderError{
2816 2863
 					UserOrgId:  adminUser.CurrentOrgId,