test_user 1 gadu atpakaļ
vecāks
revīzija
77a121df0f

+ 4 - 33
conf/app.conf Parādīt failu

@@ -1,6 +1,6 @@
1 1
 appname = 血透
2 2
 httpport = 9532
3
-runmode = dev
3
+runmode = prod
4 4
 
5 5
 
6 6
 
@@ -45,42 +45,15 @@ appsecret="61ee2e6268497d5aa9de0b0187c39aea"
45 45
 
46 46
 
47 47
 [prod]
48
-org_id = 10409
49 48
 mobile_token_expiration_second = 86400
50 49
 httpdomain = https://api.xt.kuyicloud.com
51 50
 sso_domain = https://sso.kuyicloud.com
52 51
 call_domain = https://hf.sgjyun.com
53 52
 front_end_domain = "https://xt.kuyicloud.com/#"
54
-#url  = "http://192.168.1.228:17001/szsi-portal/transData"
55
-#url = "http://192.168.1.88:6666/szsi-portal/transData"
56
-#gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
57 53
 
58
-gdyb_url = "http://test.inner.getway.ylbzj.hebei.gov.cn/ebus/mbs_fsi_auth"
59
-#test
60
-# gdyb_url = http://10.97.240.206/ebus/gdyb_inf/poc/hsa/hgs/
61
-#gdyb_url="http://igb.hsa.gdgov.cn/ebus/sz_prd/hsa/hgs/"
62
-#gdyb_url = "http://10.97.240.206/ebus/sztest_hosp/poc/hsa/hgs/"
63
-#内蒙古
64
-# http://tyjk.nm.hsip.gov.cn:8090/uif-hsaf-med-api/api/medical/service
65
-# gdyb_url = "http://tyjk.nm.hsip.gov.cn:8090/uif-hsaf-med-api/api/medical/service"
66
-# gdyb_url = "http://19.15.78.136:20001/ebus/gdyb_inf/poc/hsa/hgs/gzzq/"
67
-#韶关
68
-#gdyb_paasid = "sg03_prd"
69
-# gdyb_paasid = "test_hosp"
70
-#江门
71
-#gdyb_paasid = "jm_sc_yjyy"
72
-#珠海
73
-# gdyb_paasid="zh_prd_yrojyy"
74
-#深圳
75
-#gdyb_paasid = "sz_prd_yjyy"
76
-#肇庆
77
-#gdyb_paasid = "zq_prd_yjyy"
78
-# gdyb_paasid = "sztest_hosp"
79
-#广州
80
-#gdyb_paasid = "gdyb_inf"
81
-#江西
82
-#gdyb_url = "http://10.77.211.236/CSB/hsa-fsi-"
83
-gdyb_paasid = "mbs_fsi_auth"
54
+org_id = 10106
55
+gdyb_url = "http://10.97.240.206/ebus/sztest_hosp/poc/hsa/hgs/"
56
+gdyb_paasid = "sztest_hosp"
84 57
 
85 58
 readmysqlhost = shengws1.mysql.rds.aliyuncs.com
86 59
 readmysqlport = 3306
@@ -231,8 +204,6 @@ writemiddleuser = root
231 204
 writemiddlepass = 1Q2W3e4r!@#$
232 205
 writemiddlename = ky_xt_middle
233 206
 
234
-
235
-
236 207
 readpatienthost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
237 208
 readpatientport = 3306
238 209
 readpatientuser = root

+ 186 - 134
controllers/nm/nm_controller.go Parādīt failu

@@ -11,6 +11,7 @@ import (
11 11
 	"gdyb/utils"
12 12
 	"github.com/astaxie/beego"
13 13
 	"github.com/axgle/mahonia"
14
+	"golang.org/x/text/encoding/simplifiedchinese"
14 15
 	"io/ioutil"
15 16
 	"net/http"
16 17
 	"os"
@@ -50,8 +51,59 @@ func NmybRegistRouters() {
50 51
 	beego.Router("/nmyb/2601", &NmController{}, "get:Get2601")
51 52
 
52 53
 	beego.Router("/api/token", &NmController{}, "get:GetToken")
54
+	beego.Router("/api/eleinfo", &NmController{}, "get:GetNewELeInfo")
53 55
 
54 56
 }
57
+func (c *NmController) GetNewELeInfo() {
58
+	token := c.GetString("token")
59
+	user_name := c.GetString("user_name")
60
+	id_card_no := c.GetString("id_card_no")
61
+
62
+	result, _ := service.Gdyb1101ForEleCert("赤峰费森血液透析中心", "关学丽", "H15049901371", "150499", "150499", "MSDBYGxXm1Mtyi3PtOUB7n1ktcxwyW57", token, user_name, id_card_no)
63
+	var dat map[string]interface{}
64
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
65
+		fmt.Println(dat)
66
+	} else {
67
+		fmt.Println(err)
68
+	}
69
+	userJSONBytes, _ := json.Marshal(dat)
70
+	var res ResultTwo
71
+
72
+	if err := json.Unmarshal(userJSONBytes, &res); err != nil {
73
+		utils.ErrorLog("解析失败:%v", err)
74
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
75
+		return
76
+	}
77
+
78
+	infocode, _ := strconv.ParseInt(res.Infcode, 10, 64)
79
+	if infocode == 0 {
80
+		data := make(map[string]interface{})
81
+		data["token"] = token
82
+		data["result"] = dat
83
+		var req *http.Request
84
+		bytesData, _ := json.Marshal(data)
85
+		req, _ = http.NewRequest("POST", "http://172.16.23.189:9532/"+"api/ele/info", bytes.NewReader(bytesData))
86
+		client := &http.Client{}
87
+		resp, _ := client.Do(req)
88
+		defer resp.Body.Close()
89
+		body, ioErr := ioutil.ReadAll(resp.Body)
90
+		if ioErr != nil {
91
+			utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
92
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
93
+			return
94
+		}
95
+		var respJSON map[string]interface{}
96
+		if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
97
+			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
98
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
99
+			return
100
+		}
101
+		c.ServeSuccessJSON(map[string]interface{}{
102
+			"msg": "成功",
103
+		})
104
+
105
+	}
106
+}
55 107
 func (c *NmController) GetToken() {
56 108
 	token := c.GetString("token")
57 109
 	results := strings.Split(token, "-")
@@ -59,6 +111,7 @@ func (c *NmController) GetToken() {
59 111
 	result_code := results[0]
60 112
 	result_info := results[1]
61 113
 	if result_code == "0000" {
114
+
62 115
 		var ele2 ELeData2
63 116
 		err := json.Unmarshal([]byte(result_info), &ele2)
64 117
 		if err != nil {
@@ -72,47 +125,30 @@ func (c *NmController) GetToken() {
72 125
 				utils.ErrorLog("解析失败:%v", err)
73 126
 			}
74 127
 			token := ele.Data.EcToken
75
-			fmt.Println(token)
128
+
76 129
 			if len(token) > 0 {
77
-				result, _ := service.Gdyb1101ForEleCert("赤峰费森血液透析中心", "关学丽", "H15049901371", "150499", "150499", "MSDBYGxXm1Mtyi3PtOUB7n1ktcxwyW57", token, ele.Data.UserName, ele.Data.IdNo)
78
-				var dat map[string]interface{}
79
-				if err := json.Unmarshal([]byte(result), &dat); err == nil {
80
-					fmt.Println(dat)
81
-				} else {
82
-					fmt.Println(err)
130
+				data := make(map[string]interface{})
131
+				data["token"] = token
132
+				data["result"] = ele.Data
133
+				var req *http.Request
134
+				bytesData, _ := json.Marshal(data)
135
+				req, _ = http.NewRequest("POST", "http://172.16.23.189:9532/"+"api/token/get", bytes.NewReader(bytesData))
136
+				client := &http.Client{}
137
+				resp, _ := client.Do(req)
138
+				defer resp.Body.Close()
139
+				body, ioErr := ioutil.ReadAll(resp.Body)
140
+				if ioErr != nil {
141
+					utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
142
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
143
+					return
83 144
 				}
84
-				userJSONBytes, _ := json.Marshal(dat)
85
-				var res ResultTwo
86
-				if err := json.Unmarshal(userJSONBytes, &res); err != nil {
87
-					utils.ErrorLog("解析失败:%v", err)
145
+				var respJSON map[string]interface{}
146
+				if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
147
+					utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
88 148
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
89 149
 					return
90 150
 				}
91 151
 
92
-				infocode, _ := strconv.ParseInt(res.Infcode, 10, 64)
93
-				if infocode == 0 {
94
-					data := make(map[string]interface{})
95
-					data["token"] = token
96
-					data["result"] = dat
97
-					var req *http.Request
98
-					bytesData, _ := json.Marshal(data)
99
-					req, _ = http.NewRequest("POST", "http://172.16.23.189:9532/"+"api/token/get", bytes.NewReader(bytesData))
100
-					client := &http.Client{}
101
-					resp, _ := client.Do(req)
102
-					defer resp.Body.Close()
103
-					body, ioErr := ioutil.ReadAll(resp.Body)
104
-					if ioErr != nil {
105
-						utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
106
-						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
107
-						return
108
-					}
109
-					var respJSON map[string]interface{}
110
-					if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
111
-						utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
112
-						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
113
-						return
114
-					}
115
-				}
116 152
 			} else {
117 153
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
118 154
 				return
@@ -734,108 +770,109 @@ func (c *NmController) ReadCard() {
734 770
 
735 771
 		break
736 772
 	case "4": //电子凭证
737
-		result_code, result_info := c.GetELeInfo()
738
-		if result_code == "0000" {
739
-			var ele ELeData
740
-			err := json.Unmarshal([]byte(result_info), &ele)
741
-			if err != nil {
742
-				utils.ErrorLog("解析失败:%v", err)
743
-			}
744
-			token := ele.Data.EcToken
745
-			fmt.Println(token)
746
-			if len(token) > 0 {
747
-				result, _ := service.Gdyb1101ForEleCert(org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, token, ele.Data.UserName, ele.Data.IdNo)
748
-				var dat map[string]interface{}
749
-				if err := json.Unmarshal([]byte(result), &dat); err == nil {
750
-					fmt.Println(dat)
751
-				} else {
752
-					fmt.Println(err)
753
-				}
754
-				userJSONBytes, _ := json.Marshal(dat)
755
-				var res ResultTwo
756
-				if err := json.Unmarshal(userJSONBytes, &res); err != nil {
757
-					utils.ErrorLog("解析失败:%v", err)
758
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
759
-					return
760
-				}
761
-
762
-				infocode, _ := strconv.ParseInt(res.Infcode, 10, 64)
763
-
764
-				if infocode == 0 {
765
-
766
-					c.ServeSuccessJSON(map[string]interface{}{
767
-						"status":         "0",
768
-						"card_info":      result_info,
769
-						"busi_card_info": result_info,
770
-						"token":          token,
771
-						"result":         dat,
772
-					})
773
-
774
-				} else {
775
-					c.ServeSuccessJSON(map[string]interface{}{
776
-						"status": "-1",
777
-					})
778
-
779
-				}
780
-			} else {
781
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
782
-				return
783
-			}
784
-		} else {
785
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
786
-			return
787
-		}
773
+		c.GetELeInfo()
774
+		//if result_code == "0000" {
775
+		//	var ele ELeData
776
+		//	err := json.Unmarshal([]byte(result_info), &ele)
777
+		//	if err != nil {
778
+		//		utils.ErrorLog("解析失败:%v", err)
779
+		//	}
780
+		//	token := ele.Data.EcToken
781
+		//	fmt.Println(token)
782
+		//	if len(token) > 0 {
783
+		//		result, _ := service.Gdyb1101ForEleCert(org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, token, ele.Data.UserName, ele.Data.IdNo)
784
+		//		var dat map[string]interface{}
785
+		//		if err := json.Unmarshal([]byte(result), &dat); err == nil {
786
+		//			fmt.Println(dat)
787
+		//		} else {
788
+		//			fmt.Println(err)
789
+		//		}
790
+		//		userJSONBytes, _ := json.Marshal(dat)
791
+		//		var res ResultTwo
792
+		//		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
793
+		//			utils.ErrorLog("解析失败:%v", err)
794
+		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
795
+		//			return
796
+		//		}
797
+		//
798
+		//		infocode, _ := strconv.ParseInt(res.Infcode, 10, 64)
799
+		//
800
+		//		if infocode == 0 {
801
+		//
802
+		//			c.ServeSuccessJSON(map[string]interface{}{
803
+		//				"status":         "0",
804
+		//				"card_info":      result_info,
805
+		//				"busi_card_info": result_info,
806
+		//				"token":          token,
807
+		//				"result":         dat,
808
+		//			})
809
+		//
810
+		//		} else {
811
+		//			c.ServeSuccessJSON(map[string]interface{}{
812
+		//				"status": "-1",
813
+		//			})
814
+		//
815
+		//		}
816
+		//	} else {
817
+		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
818
+		//		return
819
+		//	}
820
+		//} else {
821
+		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
822
+		//	return
823
+		//}
788 824
 
789 825
 		break
790 826
 	case "5": //电子凭证
791
-		_, pBusiCardInfo := c.GetELeInfoTwo(fixmedins_code, operator_id, operator)
792
-
793
-		var ele ELeData
794
-		err := json.Unmarshal([]byte(pBusiCardInfo), &ele)
795
-		if err != nil {
796
-			utils.ErrorLog("解析失败:%v", err)
797
-		}
798
-		token := ele.Data.EcToken
799
-		fmt.Println(token)
800
-		if len(token) > 0 {
801
-			result, _ := service.Gdyb1101ForEleCert(org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, token, ele.Data.IdNo, ele.Data.UserName)
802
-			var dat map[string]interface{}
803
-			if err := json.Unmarshal([]byte(result), &dat); err == nil {
804
-				fmt.Println(dat)
805
-			} else {
806
-				fmt.Println(err)
807
-			}
808
-			userJSONBytes, _ := json.Marshal(dat)
809
-			var res ResultTwo
810
-			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
811
-				utils.ErrorLog("解析失败:%v", err)
812
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
813
-				return
814
-			}
815
-
816
-			infocode, _ := strconv.ParseInt(res.Infcode, 10, 64)
817
-
818
-			if infocode == 0 {
819
-
820
-				c.ServeSuccessJSON(map[string]interface{}{
821
-					"status":         "0",
822
-					"card_info":      pBusiCardInfo,
823
-					"busi_card_info": pBusiCardInfo,
824
-					"token":          token,
825
-					"result":         dat,
826
-				})
827
-
828
-			} else {
829
-				c.ServeSuccessJSON(map[string]interface{}{
830
-					"status": "-1",
831
-				})
832
-
833
-			}
834
-		} else {
835
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
836
-			return
837
-		}
838
-		break
827
+		c.GetELeInfoTwo(fixmedins_code, operator_id, operator)
828
+		//_, pBusiCardInfo := c.GetELeInfoTwo(fixmedins_code, operator_id, operator)
829
+
830
+		//var ele ELeData
831
+		//err := json.Unmarshal([]byte(pBusiCardInfo), &ele)
832
+		//if err != nil {
833
+		//	utils.ErrorLog("解析失败:%v", err)
834
+		//}
835
+		//token := ele.Data.EcToken
836
+		//fmt.Println(token)
837
+		//if len(token) > 0 {
838
+		//	result, _ := service.Gdyb1101ForEleCert(org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, token, ele.Data.IdNo, ele.Data.UserName)
839
+		//	var dat map[string]interface{}
840
+		//	if err := json.Unmarshal([]byte(result), &dat); err == nil {
841
+		//		fmt.Println(dat)
842
+		//	} else {
843
+		//		fmt.Println(err)
844
+		//	}
845
+		//	userJSONBytes, _ := json.Marshal(dat)
846
+		//	var res ResultTwo
847
+		//	if err := json.Unmarshal(userJSONBytes, &res); err != nil {
848
+		//		utils.ErrorLog("解析失败:%v", err)
849
+		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
850
+		//		return
851
+		//	}
852
+		//
853
+		//	infocode, _ := strconv.ParseInt(res.Infcode, 10, 64)
854
+		//
855
+		//	if infocode == 0 {
856
+		//
857
+		//		c.ServeSuccessJSON(map[string]interface{}{
858
+		//			"status":         "0",
859
+		//			"card_info":      pBusiCardInfo,
860
+		//			"busi_card_info": pBusiCardInfo,
861
+		//			"token":          token,
862
+		//			"result":         dat,
863
+		//		})
864
+		//
865
+		//	} else {
866
+		//		c.ServeSuccessJSON(map[string]interface{}{
867
+		//			"status": "-1",
868
+		//		})
869
+		//
870
+		//	}
871
+		//} else {
872
+		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
873
+		//	return
874
+		//}
875
+		//break
839 876
 
840 877
 	}
841 878
 
@@ -1162,3 +1199,18 @@ func (c *NmController) Get2601() {
1162 1199
 		"pre": dat,
1163 1200
 	})
1164 1201
 }
1202
+func ConvertByte2String(byte []byte, charset Charset) string {
1203
+
1204
+	var str string
1205
+	switch charset {
1206
+	case GB18030:
1207
+		decodeBytes, _ := simplifiedchinese.GB18030.NewDecoder().Bytes(byte)
1208
+		str = string(decodeBytes)
1209
+	case UTF8:
1210
+		fallthrough
1211
+	default:
1212
+		str = string(byte)
1213
+	}
1214
+
1215
+	return str
1216
+}

+ 272 - 170
controllers/sg/his_api_controller.go Parādīt failu

@@ -91,9 +91,9 @@ func HisManagerApiRegistRouters() {
91 91
 
92 92
 	beego.Router("/api/2505", &HisApiController{}, "get:Get2505")
93 93
 
94
-	//beego.Router("/api/4201A", &HisApiController{}, "get:Get4201A")
95
-	//beego.Router("/api/4202", &HisApiController{}, "get:Get4202")
96
-	//beego.Router("/api/4203", &HisApiController{}, "get:Get4203")
94
+	beego.Router("/api/4201A", &HisApiController{}, "get:Get4201A")
95
+	beego.Router("/api/4202", &HisApiController{}, "get:Get4202")
96
+	beego.Router("/api/4203", &HisApiController{}, "get:Get4203")
97 97
 	//beego.Router("/api/4205", &HisApiController{}, "get:Get4205")
98 98
 	//beego.Router("/api/4207", &HisApiController{}, "get:Get4207")
99 99
 	//beego.Router("/api/4208", &HisApiController{}, "get:Get4208")
@@ -109,123 +109,189 @@ func (c *HisApiController) Get2505() {
109 109
 
110 110
 }
111 111
 
112
-//func (c *HisApiController) Get4201A(){
113
-//	order_id, _ := c.GetInt64("order_id")
114
-//	admin_user_id, _ := c.GetInt64("admin_user_id")
115
-//	order, _ := service.GetHisOrderByIDTwo(order_id)
116
-//	his, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
117
-//	order_info, _ := service.GetHisOrderInfoByNumber(order.MdtrtId)
118
-//	order_info_two, _ := service.GetHisOrderInfoByNumberTwo(order.MdtrtId)
119
-//	order_info = append(order_info, order_info_two...)
120
-//	curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
121
-//	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
122
-//
123
-//	department,_ := service.GetDepartMentDetail(his.Departments)
124
-//
125
-//
126
-//
127
-//
128
-//	if order.ID == 0 {
129
-//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
130
-//		return
131
-//	}
132
-//	var fsiOPFLDs []models.FsiOwnpayPatnFeeListDDTO
133
-//	for _,items := range order_info{
134
-//		var fsiOPFLD models.FsiOwnpayPatnFeeListDDTO
135
-//		fsiOPFLD.FixmedinsMdtrtID = items.OrderNumber
136
-//		fsiOPFLD.MedType = "14"
137
-//		fsiOPFLD.BkkpSn = items.OrderNumber
138
-//		fsiOPFLD.FeeOcurTime = time.Unix(items.HisDoctorAdviceInfo.CreatedTime,0).Format("2006-01-02 15:04:05")
139
-//		fsiOPFLD.FixmedinsCode = miConfig.Code
140
-//		fsiOPFLD.FixmedinsName =  miConfig.OrgName
141
-//		fsiOPFLD.Cnt = fmt.Sprintf("%.2f", items.Cnt)
142
-//		fsiOPFLD.Pric = fmt.Sprintf("%.2f", items.Pric)
143
-//		fsiOPFLD.MedChrgitmType = "09"
144
-//		fsiOPFLD.Prodname = items.HisDoctorAdviceInfo.AdviceName
145
-//		fsiOPFLD.BilgDeptCodg = department.Number
146
-//		fsiOPFLD.BilgDeptName = department.Name
147
-//
148
-//
149
-//
150
-//
151
-//
152
-//
153
-//	}
154
-//
155
-//
156
-//
157
-//
158
-//
159
-//
160
-//}
161
-//func (c *HisApiController) Get4202(){
162
-//	order_id, _ := c.GetInt64("order_id")
163
-//	admin_user_id, _ := c.GetInt64("admin_user_id")
164
-//	order, _ := service.GetHisOrderByIDTwo(order_id)
165
-//	his, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
166
-//	curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
167
-//	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
168
-//
169
-//	if order.ID == 0 {
170
-//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
171
-//		return
172
-//	}
173
-//
174
-//	var struct4202 models.Struct4202
175
-//	struct4202.OwnPayPatnMdtrtD.FixmedinsMdtrtID = his.Number
176
-//	struct4202.OwnPayPatnMdtrtD.FixmedinsCode = miConfig.Code
177
-//	struct4202.OwnPayPatnMdtrtD.FixmedinsName = miConfig.OrgName
178
-//	struct4202.OwnPayPatnMdtrtD.PsnCertType ="01"
179
-//	struct4202.OwnPayPatnMdtrtD.Certno =his.IdCardNo
180
-//	struct4202.OwnPayPatnMdtrtD.PsnName = his.Name
181
-//	struct4202.OwnPayPatnMdtrtD.Begntime = his.InHosptialTime
182
-//	struct4202.OwnPayPatnMdtrtD.MedType = "14"
183
-//	struct4202.OwnPayPatnMdtrtD.ValiFlag = "1"
184
-//	struct4202.OwnPayPatnMdtrtD.MedfeeSumamt = fmt.Sprintf("%.2f",order.MedfeeSumamt)
185
-//
186
-//
187
-//	diagnosis_ids := strings.Split(his.Diagnosis, ",")
188
-//	var config []*models.HisXtDiagnoseConfig
189
-//	for _, item := range diagnosis_ids {
190
-//		id, _ := strconv.ParseInt(item, 10, 64)
191
-//		diagnosisConfig, _ := service.FindDiagnoseById(id)
192
-//		config = append(config, &diagnosisConfig)
193
-//	}
194
-//	var tempDiaginfos []models.OwnPayPatnDiagListD
195
-//	for index, item := range config {
196
-//		if index == 0 {
197
-//			var tempDiaginfo  models.OwnPayPatnDiagListD
198
-//			tempDiaginfo.InoutDiagType = "1"
199
-//			tempDiaginfo.DiagCode = item.CountryCode
200
-//			tempDiaginfo.DiagName = item.CountryContentName
201
-//			tempDiaginfo.DiagType = "1"
202
-//			tempDiaginfo.DiagSrtNo = "1"
203
-//			tempDiaginfo.MaindiagFlag = "1"
204
-//			tempDiaginfo.ValiFlag = "1"
205
-//			tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
206
-//		} else {
207
-//
208
-//			var tempDiaginfo models.OwnPayPatnDiagListD
209
-//			tempDiaginfo.DiagCode = item.CountryCode
210
-//			tempDiaginfo.DiagName = item.CountryContentName
211
-//			tempDiaginfo.DiagType = "2"
212
-//			tempDiaginfo.DiagSrtNo = strconv.FormatInt(int64(index+1),10)
213
-//			tempDiaginfo.MaindiagFlag = "0"
214
-//			tempDiaginfo.ValiFlag = "1"
215
-//			tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
216
-//		}
217
-//	}
218
-//	struct4202.ODiagListD = tempDiaginfos
219
-//	service.Gdyb4202(miConfig.OrgName,curRoles.UserName,miConfig.Code,miConfig.InsuplcAdmdvs,miConfig.MdtrtareaAdmvs,miConfig.SecretKey,struct4202)
220
-//
221
-//
222
-//
223
-//
224
-//}
225
-//func (c *HisApiController) Get4203(){
226
-//
227
-//
228
-//}
112
+func (c *HisApiController) Get4201A() {
113
+	order_id, _ := c.GetInt64("order_id")
114
+	admin_user_id, _ := c.GetInt64("admin_user_id")
115
+	order, _ := service.GetHisOrderByIDTwo(order_id)
116
+	his, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
117
+	order_info, _ := service.GetHisOrderInfoByNumber(order.MdtrtId)
118
+	order_info_two, _ := service.GetHisOrderInfoByNumberTwo(order.MdtrtId)
119
+	order_info = append(order_info, order_info_two...)
120
+	curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
121
+	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
122
+	department, _ := service.GetDepartMentDetail(his.Departments)
123
+	pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
124
+	doctor, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, pre.Creator)
125
+
126
+	if order.ID == 0 {
127
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
128
+		return
129
+	}
130
+	var struct4201A models.Struct4201A
131
+	var fsiOPFLDs []models.FsiOwnpayPatnFeeListDDTO
132
+	for _, items := range order_info {
133
+		var fsiOPFLD models.FsiOwnpayPatnFeeListDDTO
134
+		fsiOPFLD.FixmedinsMdtrtID = items.OrderNumber
135
+		fsiOPFLD.MedType = "14"
136
+		fsiOPFLD.BkkpSn = items.OrderNumber
137
+		fsiOPFLD.FeeOcurTime = time.Unix(items.HisDoctorAdviceInfo.CreatedTime, 0).Format("2006-01-02 15:04:05")
138
+		fsiOPFLD.FixmedinsCode = miConfig.Code
139
+		fsiOPFLD.FixmedinsName = miConfig.OrgName
140
+		fsiOPFLD.Cnt = fmt.Sprintf("%.2f", items.Cnt)
141
+		fsiOPFLD.Pric = fmt.Sprintf("%.2f", items.Pric)
142
+		fsiOPFLD.DetItemFeeSumamt = fmt.Sprintf("%.2f", items.DetItemFeeSumamt)
143
+
144
+		if items.AdviceId > 0 && items.ProjectId == 0 {
145
+			fsiOPFLD.MedinsListCodg = items.HisDoctorAdviceInfo.BaseDrugLib.MedicalInsuranceNumber
146
+			fsiOPFLD.MedinsListName = items.HisDoctorAdviceInfo.BaseDrugLib.DrugName
147
+			fsiOPFLD.Prodname = items.HisDoctorAdviceInfo.BaseDrugLib.DrugName
148
+			fsiOPFLD.BilgDeptName = department.Name
149
+			fsiOPFLD.BilgDeptCodg = department.Number
150
+			fsiOPFLD.BilgDrCode = doctor.DoctorCode
151
+			fsiOPFLD.BilgDrName = doctor.UserName
152
+
153
+		} else if items.AdviceId == 0 && items.ProjectId > 0 {
154
+			fsiOPFLD.MedinsListCodg = items.HisPrescriptionProject.HisProject.MedicalCode
155
+			fsiOPFLD.MedinsListName = items.HisPrescriptionProject.HisProject.ProjectName
156
+			fsiOPFLD.Prodname = items.HisPrescriptionProject.HisProject.ProjectName
157
+			fsiOPFLD.BilgDeptName = department.Name
158
+			fsiOPFLD.BilgDeptCodg = department.Number
159
+			fsiOPFLD.BilgDrCode = doctor.DoctorCode
160
+			fsiOPFLD.BilgDrName = doctor.UserName
161
+		}
162
+
163
+		//fsiOPFLD.DetItemFeeSumamt = items.DetItemFeeSumamt
164
+		fsiOPFLD.MedChrgitmType = "09"
165
+		fsiOPFLD.Prodname = items.HisDoctorAdviceInfo.AdviceName
166
+		fsiOPFLD.BilgDeptCodg = department.Number
167
+		fsiOPFLD.BilgDeptName = department.Name
168
+		fsiOPFLDs = append(fsiOPFLDs, fsiOPFLD)
169
+	}
170
+	struct4201A.Fopfd = fsiOPFLDs
171
+	result, requestLog := service.Gdyb4201A(miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, struct4201A)
172
+
173
+}
174
+func (c *HisApiController) Get4202() {
175
+	order_id, _ := c.GetInt64("order_id")
176
+	admin_user_id, _ := c.GetInt64("admin_user_id")
177
+	order, _ := service.GetHisOrderByIDTwo(order_id)
178
+	his, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
179
+	curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
180
+	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
181
+
182
+	if order.ID == 0 {
183
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
184
+		return
185
+	}
186
+
187
+	var struct4202 models.Struct4202
188
+	struct4202.OwnPayPatnMdtrtD.FixmedinsMdtrtID = his.Number
189
+	struct4202.OwnPayPatnMdtrtD.FixmedinsCode = miConfig.Code
190
+	struct4202.OwnPayPatnMdtrtD.FixmedinsName = miConfig.OrgName
191
+	struct4202.OwnPayPatnMdtrtD.PsnCertType = "01"
192
+	struct4202.OwnPayPatnMdtrtD.Certno = his.IdCardNo
193
+	struct4202.OwnPayPatnMdtrtD.PsnName = his.Name
194
+	struct4202.OwnPayPatnMdtrtD.Begntime = his.InHosptialTime
195
+	struct4202.OwnPayPatnMdtrtD.MedType = "14"
196
+	struct4202.OwnPayPatnMdtrtD.ValiFlag = "1"
197
+	struct4202.OwnPayPatnMdtrtD.MedfeeSumamt = fmt.Sprintf("%.2f", order.MedfeeSumamt)
198
+
199
+	diagnosis_ids := strings.Split(his.Diagnosis, ",")
200
+	var config []*models.HisXtDiagnoseConfig
201
+	for _, item := range diagnosis_ids {
202
+		id, _ := strconv.ParseInt(item, 10, 64)
203
+		diagnosisConfig, _ := service.FindDiagnoseById(id)
204
+		config = append(config, &diagnosisConfig)
205
+	}
206
+	var tempDiaginfos []models.OwnPayPatnDiagListD
207
+	for index, item := range config {
208
+		if index == 0 {
209
+			var tempDiaginfo models.OwnPayPatnDiagListD
210
+			tempDiaginfo.InoutDiagType = "1"
211
+			tempDiaginfo.DiagCode = item.CountryCode
212
+			tempDiaginfo.DiagName = item.CountryContentName
213
+			tempDiaginfo.DiagType = "1"
214
+			tempDiaginfo.DiagSrtNo = "1"
215
+			tempDiaginfo.MaindiagFlag = "1"
216
+			tempDiaginfo.ValiFlag = "1"
217
+			tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
218
+		} else {
219
+
220
+			var tempDiaginfo models.OwnPayPatnDiagListD
221
+			tempDiaginfo.DiagCode = item.CountryCode
222
+			tempDiaginfo.DiagName = item.CountryContentName
223
+			tempDiaginfo.DiagType = "2"
224
+			tempDiaginfo.DiagSrtNo = strconv.FormatInt(int64(index+1), 10)
225
+			tempDiaginfo.MaindiagFlag = "0"
226
+			tempDiaginfo.ValiFlag = "1"
227
+			tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
228
+		}
229
+	}
230
+	struct4202.ODiagListD = tempDiaginfos
231
+	result, requestLog := service.Gdyb4202(miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, struct4202)
232
+	saveLog(result, requestLog, "4202", "自费就诊和诊断信息上传")
233
+	var res2 ResultSix
234
+	var respJSON2 map[string]interface{}
235
+	if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
236
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
237
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
238
+		return
239
+	}
240
+	userJSONBytes2, _ := json.Marshal(respJSON2)
241
+	if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
242
+		utils.ErrorLog("解析失败:%v", err)
243
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
244
+		return
245
+	}
246
+	if res2.Infcode != 0 {
247
+		c.ServeSuccessJSON(map[string]interface{}{
248
+			"failed_code": -10,
249
+			"msg":         res2.ErrMsg,
250
+		})
251
+		return
252
+
253
+	} else {
254
+		c.ServeSuccessJSON(map[string]interface{}{
255
+			"msg": "上传成功",
256
+		})
257
+	}
258
+}
259
+func (c *HisApiController) Get4203() {
260
+	admin_user_id, _ := c.GetInt64("admin_user_id")
261
+	curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
262
+	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
263
+	order_id, _ := c.GetInt64("order_id")
264
+	order, _ := service.GetHisOrderByIDTwo(order_id)
265
+	his, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
266
+	result, requestLog := service.Gdyb4203(miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, his.Number)
267
+	saveLog(result, requestLog, "4203", "自费就诊与结算明细上传完成")
268
+	var res2 ResultSix
269
+	var respJSON2 map[string]interface{}
270
+	if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
271
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
272
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
273
+		return
274
+	}
275
+	userJSONBytes2, _ := json.Marshal(respJSON2)
276
+	if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
277
+		utils.ErrorLog("解析失败:%v", err)
278
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
279
+		return
280
+	}
281
+	if res2.Infcode != 0 {
282
+		c.ServeSuccessJSON(map[string]interface{}{
283
+			"failed_code": -10,
284
+			"msg":         res2.ErrMsg,
285
+		})
286
+		return
287
+
288
+	} else {
289
+		c.ServeSuccessJSON(map[string]interface{}{
290
+			"msg": "上传成功",
291
+		})
292
+	}
293
+}
294
+
229 295
 //func (c *HisApiController) Get4205(){
230 296
 //
231 297
 //
@@ -2354,7 +2420,7 @@ func (c *HisApiController) ReadCard() {
2354 2420
 						}
2355 2421
 
2356 2422
 						if len(insutypes) == 0 {
2357
-							insutype = "310"
2423
+							insutype = "390"
2358 2424
 						}
2359 2425
 
2360 2426
 						c.ServeSuccessJSON(map[string]interface{}{
@@ -3605,7 +3671,7 @@ func (c *HisApiController) ReadCard() {
3605 3671
 				token := ele.Data.EcToken
3606 3672
 				fmt.Println(inputInfo)
3607 3673
 				fmt.Println(outPutInfo)
3608
-				result, requestLog, errMsgLog := service.FJyb1101ForEleToken(ele.Data.IDNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, id_card_type, "", 1, miConfig.Url, miConfig.Cainfo, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey, token, ele.Data.UserName)
3674
+				result, requestLog, errMsgLog := service.FJyb1101ForEleToken(ele.Data.IDNo, miConfig.OrgName, roles.UserName, miConfig.Code, ele.Data.InsuOrg, miConfig.MdtrtareaAdmvs, id_card_type, "", 1, miConfig.Url, miConfig.Cainfo, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey, token, ele.Data.UserName)
3609 3675
 				saveLog(result, requestLog, "1101", "获取人员信息")
3610 3676
 				var dat map[string]interface{}
3611 3677
 				if err := json.Unmarshal([]byte(result), &dat); err == nil {
@@ -3638,20 +3704,21 @@ func (c *HisApiController) ReadCard() {
3638 3704
 						infoStr := string(Iinfos)
3639 3705
 						idetinfoStr := string(Idetinfos)
3640 3706
 						psn := &models.HisPsn{
3641
-							PsnNo:        res.Output.Baseinfo.PsnNo,
3642
-							Age:          res.Output.Baseinfo.Age,
3643
-							PatientId:    patient.ID,
3644
-							Certno:       res.Output.Baseinfo.Certno,
3645
-							Brdy:         res.Output.Baseinfo.Brdy,
3646
-							Gend:         res.Output.Baseinfo.Gend,
3647
-							Naty:         res.Output.Baseinfo.Naty,
3648
-							PsnCertType:  res.Output.Baseinfo.PsnCertType,
3649
-							PsnName:      res.Output.Baseinfo.PsnName,
3650
-							Idetinfo:     idetinfoStr,
3651
-							Insuinfo:     infoStr,
3652
-							UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
3653
-							CardInfo:     outPutInfo,
3654
-							VerifyNumber: token,
3707
+							PsnNo:         res.Output.Baseinfo.PsnNo,
3708
+							Age:           res.Output.Baseinfo.Age,
3709
+							PatientId:     patient.ID,
3710
+							Certno:        res.Output.Baseinfo.Certno,
3711
+							Brdy:          res.Output.Baseinfo.Brdy,
3712
+							Gend:          res.Output.Baseinfo.Gend,
3713
+							Naty:          res.Output.Baseinfo.Naty,
3714
+							PsnCertType:   res.Output.Baseinfo.PsnCertType,
3715
+							PsnName:       res.Output.Baseinfo.PsnName,
3716
+							Idetinfo:      idetinfoStr,
3717
+							Insuinfo:      infoStr,
3718
+							UserOrgId:     c.GetAdminUserInfo().CurrentOrgId,
3719
+							CardInfo:      outPutInfo,
3720
+							VerifyNumber:  token,
3721
+							InsuplcAdmdvs: ele.Data.InsuOrg,
3655 3722
 						}
3656 3723
 						service.CreateHisPsn(psn)
3657 3724
 
@@ -4047,30 +4114,32 @@ func (c *HisApiController) GetSettleList() {
4047 4114
 	curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
4048 4115
 	depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
4049 4116
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
4117
+	pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
4118
+	doctor, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, pre.Creator)
4050 4119
 
4051 4120
 	if order.ID == 0 {
4052 4121
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
4053 4122
 		return
4054 4123
 	}
4055 4124
 
4056
-	last_order, _ := service.GetLastHisOrder(c.GetAdminUserInfo().CurrentOrgId)
4057
-	max_order, _ := service.GetLastHisOrderTwo(c.GetAdminUserInfo().CurrentOrgId)
4058
-	count, _ := strconv.ParseInt(max_order.FaPiaoNumber, 10, 64)
4059
-	fmt.Println(count)
4060
-	var zero string
4061
-	number := count + 1
4062
-	if number >= 1000 {
4063
-		zero = "0000" + strconv.FormatInt(number, 10)
4064
-	} else if number >= 10000 {
4065
-		zero = "000" + strconv.FormatInt(number, 10)
4066
-	} else if number >= 100000 {
4067
-		zero = "00" + strconv.FormatInt(number, 10)
4068
-	} else if number >= 1000000 {
4069
-		zero = "0" + strconv.FormatInt(number, 10)
4070
-	} else {
4071
-		zero = strconv.FormatInt(number, 10)
4072
-	}
4073
-	fmt.Println(zero)
4125
+	//last_order, _ := service.GetLastHisOrder(c.GetAdminUserInfo().CurrentOrgId)
4126
+	//max_order, _ := service.GetLastHisOrderTwo(c.GetAdminUserInfo().CurrentOrgId)
4127
+	//count, _ := strconv.ParseInt(max_order.FaPiaoNumber, 10, 64)
4128
+	//fmt.Println(count)
4129
+	//var zero string
4130
+	//number := count + 1
4131
+	//if number >= 1000 {
4132
+	//	zero = "0000" + strconv.FormatInt(number, 10)
4133
+	//} else if number >= 10000 {
4134
+	//	zero = "000" + strconv.FormatInt(number, 10)
4135
+	//} else if number >= 100000 {
4136
+	//	zero = "00" + strconv.FormatInt(number, 10)
4137
+	//} else if number >= 1000000 {
4138
+	//	zero = "0" + strconv.FormatInt(number, 10)
4139
+	//} else {
4140
+	//	zero = strconv.FormatInt(number, 10)
4141
+	//}
4142
+	//fmt.Println(zero)
4074 4143
 
4075 4144
 	struct4101 := service.Struct4101{
4076 4145
 		PsnNo:          order.PsnNo,
@@ -4144,7 +4213,6 @@ func (c *HisApiController) GetSettleList() {
4144 4213
 			tempDiaginfo.MaindiagFlag = "1"
4145 4214
 			tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
4146 4215
 		} else {
4147
-
4148 4216
 			var tempDiaginfo service.DiaginfoStructTwo
4149 4217
 			tempDiaginfo.DiagCode = item.CountryCode
4150 4218
 			tempDiaginfo.DiagName = item.CountryContentName
@@ -4529,6 +4597,9 @@ func (c *HisApiController) GetSettleList() {
4529 4597
 	struct4101.Ntly = "中国"
4530 4598
 	struct4101.AdmCaty = "A03.06"
4531 4599
 
4600
+	struct4101.DoctorName = doctor.UserName
4601
+	struct4101.DoctorCode = doctor.DoctorNumber
4602
+
4532 4603
 	var res ResultSeventeen
4533 4604
 
4534 4605
 	if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
@@ -4613,7 +4684,6 @@ func (c *HisApiController) GetSettleList() {
4613 4684
 		}
4614 4685
 
4615 4686
 	} else if miConfig.MdtrtareaAdmvs == "430800" {
4616
-
4617 4687
 		var pp models.PublicParams
4618 4688
 		pp.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
4619 4689
 		pp.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
@@ -4663,9 +4733,9 @@ func (c *HisApiController) GetSettleList() {
4663 4733
 		})
4664 4734
 		return
4665 4735
 	} else {
4666
-		order.FaPiaoNumber = zero
4667
-		order.FaPiaoCode = last_order.FaPiaoCode
4668
-		service.UpdateOrder(order)
4736
+		//order.FaPiaoNumber = zero
4737
+		//order.FaPiaoCode = last_order.FaPiaoCode
4738
+		//service.UpdateOrder(order)
4669 4739
 		hisFundSettleListResult := &models.HisFundSettleListResult{
4670 4740
 			Number:    res.Output.SetlListId,
4671 4741
 			Status:    1,
@@ -7673,13 +7743,32 @@ func (c *HisApiController) GetRegisterInfo() {
7673 7743
 				json.Unmarshal([]byte(idetinfoStr), &rf)
7674 7744
 				if len(rf) > 0 {
7675 7745
 					if len(rf[0].Memo) > 0 {
7746
+						fmt.Println("122222222222222")
7747
+
7676 7748
 						content := rf[0].Memo[1:len(rf[0].Memo)]
7677
-						content2 := content[:len(rf[0].Memo)-1]
7749
+						content2 := content[:len(content)-1]
7678 7750
 						fmt.Println(content2)
7679
-						var rf2 ResultMemo
7680
-						json.Unmarshal([]byte(content2), &rf2)
7681
-						fmt.Println(rf2)
7682
-						fmt.Println(rf2.InsuAdmdvs)
7751
+						//var rf2 ResultMemo
7752
+						//json.Unmarshal([]byte(content2), &rf2)
7753
+						//fmt.Println(rf2)
7754
+						//fmt.Println(rf2.InsuAdmdvs)
7755
+						arr := strings.Split(content2, ",")
7756
+
7757
+						var tarstring string
7758
+						for _, item := range arr {
7759
+							if find := strings.Contains(item, "insuAdmdvs"); find {
7760
+								tarstring = item
7761
+							}
7762
+						}
7763
+						fmt.Println(tarstring)
7764
+
7765
+						if len(tarstring) > 0 {
7766
+							arr := strings.Split(tarstring, ":")
7767
+
7768
+							insuplc_admdvs_temp = strings.Replace(arr[1], "\"", "", -1)
7769
+
7770
+							//insuplc_admdvs_temp = arr[1]
7771
+						}
7683 7772
 
7684 7773
 					}
7685 7774
 				}
@@ -7841,11 +7930,12 @@ func (c *HisApiController) GetRegisterInfo() {
7841 7930
 					cert_no = strings.Split(psn_info.CardInfo, "|")[0]
7842 7931
 				} else if id_card_type == 4 {
7843 7932
 					cert_no = psn_info.VerifyNumber
7933
+					insuplc_admdvs_temp = psn_info.InsuplcAdmdvs
7844 7934
 				} else {
7845 7935
 					cert_no = psn_info.VerifyNumber
7846 7936
 				}
7847 7937
 
7848
-				result, requestLog, _ := service.FJyb2201(psn_info.PsnNo, insutype, IdCardNo, miConfig.OrgName, doctor_info.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, insuplc_admdvs_temp, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, roles.UserName, doctor_info.UserName, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey, cert_no)
7938
+				result, requestLog, _ := service.FJyb2201(psn_info.PsnNo, insutype, IdCardNo, miConfig.OrgName, doctor_info.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, insuplc_admdvs_temp, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, roles.UserName, doctor_info.UserName, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey, cert_no, record_time)
7849 7939
 				saveLog(result, requestLog, "2201", "挂号")
7850 7940
 				if miConfig.Code == "H15049901371" {
7851 7941
 
@@ -12451,8 +12541,8 @@ func (c *HisApiController) GetCheckAccount() {
12451 12541
 	loc, _ := time.LoadLocation("Local")
12452 12542
 	startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
12453 12543
 	endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
12454
-	orders, _ := service.GetOrderByTime(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, "", clr_type)
12455
-	orders_two, _ := service.GetOrderByTimeFive(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, "", clr_type)
12544
+	orders, _ := service.GetOrderByTime(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, "", clr_type, miConfig.MdtrtareaAdmvs)
12545
+	orders_two, _ := service.GetOrderByTimeFive(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, "", clr_type, miConfig.MdtrtareaAdmvs)
12456 12546
 
12457 12547
 	fixmedins_setl_cnt := int64(len(orders))
12458 12548
 	var medfee_sumamt float64
@@ -12528,10 +12618,12 @@ func (c *HisApiController) GetCheckAccount() {
12528 12618
 			res.Infcode = infocode
12529 12619
 
12530 12620
 		} else if miConfig.MdtrtareaAdmvs == "150499" {
12531
-
12621
+			if clr_type == "11" {
12622
+				fixmedins_setl_cnt = 2
12623
+			}
12532 12624
 			api := "http://172.16.13.254:9532/" + "nmyb/3201?" +
12533 12625
 				"insutype=" + insutype +
12534
-				"&clr_type=" + "21" +
12626
+				"&clr_type=" + clr_type +
12535 12627
 				"&setl_optins=" + clr_org +
12536 12628
 				"&stmt_begndate=" + start_time +
12537 12629
 				"&stm_enddate=" + end_time +
@@ -14490,12 +14582,22 @@ func (c *HisApiController) PsnPutNCDSOnRecord() {
14490 14582
 	end_time := c.GetString("end_time")
14491 14583
 	check_time := c.GetString("check_time")
14492 14584
 
14585
+	hospital_code := c.GetString("hospital_code")
14586
+	hospital_name := c.GetString("hospital_name")
14587
+
14493 14588
 	adminUser := c.GetAdminUserInfo()
14494 14589
 	patient, _ := service.GetPatientByID(adminUser.CurrentOrgId, patient_id)
14495 14590
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
14496 14591
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
14497 14592
 	sick, _ := service.FindSickById(sick_id)
14498 14593
 	doctor, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, doctor_id)
14594
+	if len(hospital_code) == 0 {
14595
+
14596
+		hospital_code = miConfig.Code
14597
+	}
14598
+	if len(hospital_name) == 0 {
14599
+		hospital_name = miConfig.OrgName
14600
+	}
14499 14601
 
14500 14602
 	role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, doctor_id)
14501 14603
 	var res ResultTwo
@@ -14629,7 +14731,7 @@ func (c *HisApiController) PsnPutNCDSOnRecord() {
14629 14731
 		if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
14630 14732
 
14631 14733
 		} else {
14632
-			result := service.Gdyb2503(psn_no, insutype, miConfig.OrgName, doctor.UserName, miConfig.Code, strconv.FormatInt(doctor.ID, 10), insuplc_admdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sick.ClassName, sick.ContentCode, start_time, end_time, check_time)
14734
+			result := service.Gdyb2503(psn_no, insutype, miConfig.OrgName, doctor.UserName, miConfig.Code, strconv.FormatInt(doctor.ID, 10), insuplc_admdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sick.ClassName, sick.ContentCode, start_time, end_time, check_time, hospital_code, hospital_name)
14633 14735
 			var dat map[string]interface{}
14634 14736
 			if err := json.Unmarshal([]byte(result), &dat); err == nil {
14635 14737
 				fmt.Println(dat)

+ 52 - 62
controllers/zh/zh_his_api_controller.go Parādīt failu

@@ -501,6 +501,27 @@ func ZHHisManagerApiRegistRouters() {
501 501
 	beego.Router("/zh/api/lingbao/get", &ZHHisApiController{}, "get:GetLingBao")
502 502
 
503 503
 	beego.Router("/api/token/get", &ZHHisApiController{}, "post:GetToken")
504
+	beego.Router("/api/ele/info", &ZHHisApiController{}, "post:GetEleInfo")
505
+
506
+}
507
+
508
+func (c *ZHHisApiController) GetEleInfo() {
509
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
510
+	var respJSON map[string]interface{}
511
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
512
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
513
+		return
514
+	}
515
+	token := respJSON["token"].(string)
516
+	result_respJson := respJSON["result"].(string)
517
+	fmt.Println("token")
518
+	fmt.Println(token)
519
+	fmt.Println("result")
520
+	fmt.Println(result_respJson)
521
+
522
+	c.ServeSuccessJSON(map[string]interface{}{
523
+		"msg": "读卡成功",
524
+	})
504 525
 
505 526
 }
506 527
 func (c *ZHHisApiController) GetToken() {
@@ -516,76 +537,45 @@ func (c *ZHHisApiController) GetToken() {
516 537
 	fmt.Println(token)
517 538
 	fmt.Println("result")
518 539
 	fmt.Println(result_respJson)
519
-	var res ResultTwo           //1101结果
520
-	var res10265 ResultTwo10265 //1101结果
540
+	var res ELeData
521 541
 	result, _ := json.Marshal(result_respJson)
522
-	if err := json.Unmarshal([]byte(result), &res10265); err != nil {
542
+	if err := json.Unmarshal([]byte(result), &res); err != nil {
523 543
 		utils.ErrorLog("解析失败:%v", err)
524 544
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
525 545
 		return
526 546
 	}
527
-	res.ErrMsg = res10265.ErrMsg
528
-	infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
529
-	res.Infcode = infocode
530
-	res.Output = res10265.Output
531
-	res.InfRefmsgid = res10265.InfRefmsgid
532
-	if res.Infcode == 0 {
533
-		var insutypes []string
534
-		var insutype string
535
-		var is390 int = 0
536
-		var is310 int = 0
537
-		for _, item := range res.Output.Iinfo {
538
-			if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
539
-				insutypes = append(insutypes, item.Insutype)
540
-			}
541
-		}
542
-		if len(insutypes) == 1 {
543
-			insutype = insutypes[0]
544
-		} else {
545
-			for _, i := range insutypes {
546
-				if i == "390" {
547
-					is390 = 1
548
-				}
549 547
 
550
-				if i == "310" {
551
-					is310 = 1
552
-				}
553
-			}
554
-		}
555
-		if is390 == 1 {
556
-			insutype = "390"
557
-		}
558
-		if is310 == 1 {
559
-			insutype = "310"
560
-		}
561
-		if len(insutypes) == 0 {
562
-			insutype = "310"
563
-		}
564
-		fmt.Println(insutype)
565
-		patient, _ := service.GetPatientByIDCard(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
566
-		Iinfos, _ := json.Marshal(res.Output.Iinfo)
567
-		Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
568
-		infoStr := string(Iinfos)
569
-		idetinfoStr := string(Idetinfos)
570
-		psn := &models.HisPsn{
571
-			PsnNo:        res.Output.Baseinfo.PsnNo,
572
-			Age:          res.Output.Baseinfo.Age,
573
-			PatientId:    patient.ID,
574
-			Certno:       res.Output.Baseinfo.Certno,
575
-			Brdy:         res.Output.Baseinfo.Brdy,
576
-			Gend:         res.Output.Baseinfo.Gend,
577
-			Naty:         res.Output.Baseinfo.Naty,
578
-			PsnCertType:  res.Output.Baseinfo.PsnCertType,
579
-			PsnName:      res.Output.Baseinfo.PsnName,
580
-			Idetinfo:     idetinfoStr,
581
-			Insuinfo:     infoStr,
582
-			UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
583
-			CardInfo:     "",
584
-			VerifyNumber: token,
585
-		}
586
-		service.CreateHisPsn(psn)
548
+	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
549
+
550
+	patient, _ := service.GetPatientByIDCard(res.Data.IdNo, c.GetAdminUserInfo().CurrentOrgId)
551
+
552
+	var api string
553
+	api = "http://172.16.13.254:9532/" + "api/eleinfo?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&org_name=" + miConfig.OrgName +
554
+		"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&token=" + token + "&user_name=" + patient.Name + "&id_card_no=" + patient.IdCardNo
555
+
556
+	resp, requestErr := http.Get(api)
557
+	if requestErr != nil {
558
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
559
+		return
587 560
 	}
588 561
 
562
+	body, ioErr := ioutil.ReadAll(resp.Body)
563
+	if ioErr != nil {
564
+		utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
565
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
566
+		return
567
+	}
568
+	//var respJSON map[string]interface{}
569
+	//if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
570
+	//	utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
571
+	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
572
+	//	return
573
+	//}
574
+
575
+	c.ServeSuccessJSON(map[string]interface{}{
576
+		"msg": "读卡成功",
577
+	})
578
+
589 579
 }
590 580
 
591 581
 func (c *ZHHisApiController) UploadLingBao() {

+ 18 - 8
main.go Parādīt failu

@@ -25,13 +25,13 @@ import (
25 25
 
26 26
 func init() {
27 27
 	service.ConnectDB()
28
-	//org_id, _ := beego.AppConfig.Int64("org_id")
29
-	//miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
30
-	////CreateLog(miConfig)
31
-	////UploadLog(miConfig)
32
-	//if org_id == 10191 {
33
-	//	service.GetFjAuthorizationInfo(miConfig.Code)
34
-	//}
28
+	org_id, _ := beego.AppConfig.Int64("org_id")
29
+	miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
30
+	//CreateLog(miConfig)
31
+	//UploadLog(miConfig)
32
+	if org_id == 10191 {
33
+		service.GetFjAuthorizationInfo(miConfig.Code)
34
+	}
35 35
 
36 36
 }
37 37
 func main() {
@@ -63,8 +63,18 @@ type ResultSeventeen struct {
63 63
 func GetBatchSettleList() {
64 64
 
65 65
 	org_id, _ := beego.AppConfig.Int64("org_id")
66
+	list, _ := service.GetLastFundList(org_id)
67
+	order, _ := service.GetHisOrderByID(list.OrderId)
68
+	var orders []*models.HisOrder
69
+	if order.ID > 0 {
70
+
71
+		orders, _ = service.GetAllHisOrderTwo(org_id, order.ID)
72
+
73
+	} else {
74
+		orders, _ = service.GetAllHisOrder(org_id)
75
+
76
+	}
66 77
 
67
-	orders, _ := service.GetAllHisOrder(org_id)
68 78
 	for _, item := range orders {
69 79
 		order_id := item.ID
70 80
 		order, _ := service.GetHisOrderByIDTwo(order_id)

+ 18 - 17
models/his_models.go Parādīt failu

@@ -1315,23 +1315,24 @@ type NewCustom struct {
1315 1315
 }
1316 1316
 
1317 1317
 type HisPsn struct {
1318
-	ID           int64   `gorm:"column:id" json:"id" form:"id"`
1319
-	PsnNo        string  `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
1320
-	Age          float64 `gorm:"column:age" json:"age" form:"age"`
1321
-	PatientId    int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1322
-	Certno       string  `gorm:"column:certno" json:"certno" form:"certno"`
1323
-	Brdy         string  `gorm:"column:brdy" json:"brdy" form:"brdy"`
1324
-	Gend         string  `gorm:"column:gend" json:"gend" form:"gend"`
1325
-	Naty         string  `gorm:"column:naty" json:"naty" form:"naty"`
1326
-	PsnCertType  string  `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
1327
-	PsnName      string  `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
1328
-	Idetinfo     string  `gorm:"column:idetinfo" json:"idetinfo" form:"idetinfo"`
1329
-	Insuinfo     string  `gorm:"column:insuinfo" json:"insuinfo" form:"insuinfo"`
1330
-	UserOrgId    int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1331
-	CardInfo     string  `gorm:"column:card_info" json:"card_info" form:"card_info"`
1332
-	VerifyNumber string  `gorm:"column:verify_number" json:"verify_number" form:"verify_number"`
1333
-	Stage        string  `gorm:"column:stage" json:"stage" form:"stage"`
1334
-	RecordDate   int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
1318
+	ID            int64   `gorm:"column:id" json:"id" form:"id"`
1319
+	PsnNo         string  `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
1320
+	Age           float64 `gorm:"column:age" json:"age" form:"age"`
1321
+	PatientId     int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1322
+	Certno        string  `gorm:"column:certno" json:"certno" form:"certno"`
1323
+	Brdy          string  `gorm:"column:brdy" json:"brdy" form:"brdy"`
1324
+	Gend          string  `gorm:"column:gend" json:"gend" form:"gend"`
1325
+	Naty          string  `gorm:"column:naty" json:"naty" form:"naty"`
1326
+	PsnCertType   string  `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
1327
+	PsnName       string  `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
1328
+	Idetinfo      string  `gorm:"column:idetinfo" json:"idetinfo" form:"idetinfo"`
1329
+	Insuinfo      string  `gorm:"column:insuinfo" json:"insuinfo" form:"insuinfo"`
1330
+	UserOrgId     int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1331
+	CardInfo      string  `gorm:"column:card_info" json:"card_info" form:"card_info"`
1332
+	VerifyNumber  string  `gorm:"column:verify_number" json:"verify_number" form:"verify_number"`
1333
+	Stage         string  `gorm:"column:stage" json:"stage" form:"stage"`
1334
+	RecordDate    int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
1335
+	InsuplcAdmdvs string  `gorm:"column:insuplc_admdvs" json:"insuplc_admdvs" form:"insuplc_admdvs"`
1335 1336
 }
1336 1337
 
1337 1338
 func (HisPsn) TableName() string {

+ 20 - 14
service/fj_service.go Parādīt failu

@@ -148,7 +148,7 @@ func FJyb1101ForEleToken(certNo string, org_name string, doctor string, fixmedin
148 148
 }
149 149
 
150 150
 // 门诊挂号
151
-func FJyb2201(psnNo string, insutype string, certNo string, org_name string, doctor 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, opter string, doctor_name string, url string, app_id string, app_secret string, sign_key string, enc_key string, card_number string) (string, string, string) {
151
+func FJyb2201(psnNo string, insutype string, certNo string, org_name string, doctor 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, opter string, doctor_name string, url string, app_id string, app_secret string, sign_key string, enc_key string, card_number string, record_time string) (string, string, string) {
152 152
 	// 生成签名
153 153
 	nonce := GetRandomString(32)
154 154
 	timestamp := time.Now().Unix()
@@ -160,10 +160,10 @@ func FJyb2201(psnNo string, insutype string, certNo string, org_name string, doc
160 160
 	inputMessage := SetFjInputMessage(nonce, timestamp, org_name, opter, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, url, app_id, app_secret, sign_key, enc_key)
161 161
 	input := make(map[string]interface{})
162 162
 	inputData := make(map[string]interface{})
163
-	inputMessage["infno"] = "2201"        // 交易编码
164
-	inputData["psn_no"] = psnNo           // 人员编号 (来自1101接口返回)
165
-	inputData["insutype"] = insutype      // 险种类型(来自1101接口返回)
166
-	inputData["begntime"] = timeFormatOne // 开始时间
163
+	inputMessage["infno"] = "2201"                                                   // 交易编码
164
+	inputData["psn_no"] = psnNo                                                      // 人员编号 (来自1101接口返回)
165
+	inputData["insutype"] = insutype                                                 // 险种类型(来自1101接口返回)
166
+	inputData["begntime"] = record_time + " " + strings.Split(timeFormatOne, " ")[1] // 开始时间
167 167
 
168 168
 	if id_card_type == 1 {
169 169
 		inputData["mdtrt_cert_type"] = "03"      // 就诊凭证类型
@@ -277,15 +277,15 @@ func FJyb2203(psnNo string, mdtrtId string, doctor string, department string, or
277 277
 
278 278
 	for index, item := range config {
279 279
 		diseinfo_sun := make(map[string]interface{})
280
-		diseinfo_sun["diag_type"] = "1"              // 诊断类别
281
-		diseinfo_sun["diag_srt_no"] = index          // 诊断排序号
282
-		diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码
283
-		diseinfo_sun["diag_name"] = item.ClassName   // 诊断名称
284
-		diseinfo_sun["diag_dept"] = department       // 诊断科室
285
-		diseinfo_sun["dise_dor_no"] = doctor_id      // 诊断医生编码
286
-		diseinfo_sun["dise_dor_name"] = doctor_name  // 诊断医生姓名
287
-		diseinfo_sun["diag_time"] = timeFormatOne    // 诊断时间
288
-		diseinfo_sun["vali_flag"] = "1"              // 有效标志
280
+		diseinfo_sun["diag_type"] = "1"                                                     // 诊断类别
281
+		diseinfo_sun["diag_srt_no"] = index                                                 // 诊断排序号
282
+		diseinfo_sun["diag_code"] = item.CountryCode                                        // 诊断代码
283
+		diseinfo_sun["diag_name"] = item.ClassName                                          // 诊断名称
284
+		diseinfo_sun["diag_dept"] = department                                              // 诊断科室
285
+		diseinfo_sun["dise_dor_no"] = doctor_id                                             // 诊断医生编码
286
+		diseinfo_sun["dise_dor_name"] = doctor_name                                         // 诊断医生姓名
287
+		diseinfo_sun["diag_time"] = begin_time + " " + strings.Split(timeFormatOne, " ")[1] // 诊断时间
288
+		diseinfo_sun["vali_flag"] = "1"                                                     // 有效标志
289 289
 		diseinfo = append(diseinfo, diseinfo_sun)
290 290
 	}
291 291
 
@@ -2765,3 +2765,9 @@ func ReadEleCardForSettle(code string, user_name string, id int64) (string, stri
2765 2765
 	return ConvertByte2String([]byte(DeleteExtraSpace(string(bytesData))), GB18030), ConvertByte2String([]byte(DeleteExtraSpace(string(pBusiCardInfo))), GB18030), ConvertByte2String([]byte(DeleteExtraSpace(string(pErrMsg))), GB18030)
2766 2766
 
2767 2767
 }
2768
+
2769
+//
2770
+//func GetLastPsnByInsOrg(patient_id int64) (psn models.HisPsn, err error){
2771
+//	err := readDb.Model(&models.HisPsn{}).Where("patient_id = ? AND insuplc_admdvs <> ''",patient_id).Last(&psn).Error
2772
+//	return
2773
+//}

+ 16 - 16
service/gdyb_service.go Parādīt failu

@@ -2467,7 +2467,7 @@ func Gdyb2506(psnNo string, doctor string, org_name string, fixmedins_code strin
2467 2467
 	fmt.Println(str)
2468 2468
 	return str
2469 2469
 }
2470
-func Gdyb2503(psnNo string, insutype string, org_name string, doctor string, fixmedins_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_name string, sick_code string, start_time string, end_time string, check_time string) string {
2470
+func Gdyb2503(psnNo string, insutype string, org_name string, doctor string, fixmedins_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_name string, sick_code string, start_time string, end_time string, check_time string, hospital_code string, hospital_name string) string {
2471 2471
 	// 生成签名
2472 2472
 	nonce := GetRandomString(32)
2473 2473
 	timestamp := time.Now().Unix()
@@ -2485,21 +2485,21 @@ func Gdyb2503(psnNo string, insutype string, org_name string, doctor string, fix
2485 2485
 	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
2486 2486
 	input := make(map[string]interface{})
2487 2487
 	inputData := make(map[string]interface{})
2488
-	inputMessage["infno"] = "2503"                 // 交易编码
2489
-	inputData["psn_no"] = psnNo                    // 人员编号 (来自1101接口返回)
2490
-	inputData["insutype"] = insutype               // 险种类型(来自1101接口返回)
2491
-	inputData["opsp_dise_code"] = sick_code        // 险种类型(来自1101接口返回)
2492
-	inputData["opsp_dise_name"] = sick_name        // 险种类型(来自1101接口返回)
2493
-	inputData["insu_optins"] = insuplc_admdvs      // 险种类型(来自1101接口返回)
2494
-	inputData["ide_fixmedins_no"] = "H44122400103" // 险种类型(来自1101接口返回)
2495
-	inputData["ide_fixmedins_name"] = "广东省怀集县人民医院" // 险种类型(来自1101接口返回)
2496
-	inputData["hosp_ide_date"] = check_time        // 险种类型(来自1101接口返回)
2497
-	inputData["diag_dr_codg"] = doctor_id          // 开始时间
2498
-	inputData["diag_dr_name"] = doctor             // 开始时间
2499
-	inputData["begndate"] = start_time             // 医师编码
2500
-	inputData["tel"] = ""                          // 医师编码
2501
-	inputData["addr"] = ""                         // 医师编码
2502
-	inputData["enddate"] = end_time                // 医师编码
2488
+	inputMessage["infno"] = "2503"                  // 交易编码
2489
+	inputData["psn_no"] = psnNo                     // 人员编号 (来自1101接口返回)
2490
+	inputData["insutype"] = insutype                // 险种类型(来自1101接口返回)
2491
+	inputData["opsp_dise_code"] = sick_code         // 险种类型(来自1101接口返回)
2492
+	inputData["opsp_dise_name"] = sick_name         // 险种类型(来自1101接口返回)
2493
+	inputData["insu_optins"] = insuplc_admdvs       // 险种类型(来自1101接口返回)
2494
+	inputData["ide_fixmedins_no"] = hospital_code   // 险种类型(来自1101接口返回)
2495
+	inputData["ide_fixmedins_name"] = hospital_name // 险种类型(来自1101接口返回)
2496
+	inputData["hosp_ide_date"] = check_time         // 险种类型(来自1101接口返回)
2497
+	inputData["diag_dr_codg"] = doctor_id           // 开始时间
2498
+	inputData["diag_dr_name"] = doctor              // 开始时间
2499
+	inputData["begndate"] = start_time              // 医师编码
2500
+	inputData["tel"] = ""                           // 医师编码
2501
+	inputData["addr"] = ""                          // 医师编码
2502
+	inputData["enddate"] = end_time                 // 医师编码
2503 2503
 
2504 2504
 	input["data"] = inputData
2505 2505
 	inputMessage["input"] = input //交易输入

+ 17 - 15
service/gdyb_zifei_service.go Parādīt failu

@@ -14,7 +14,7 @@ import (
14 14
 )
15 15
 
16 16
 // 人员基本信息
17
-func Gdyb4201A(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, psn_name string) (string, string) {
17
+func Gdyb4201A(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, struct4201A models.Struct4201A) (string, string) {
18 18
 	//生成签名
19 19
 	nonce := GetRandomString(32)
20 20
 	timestamp := time.Now().Unix()
@@ -25,6 +25,10 @@ func Gdyb4201A(certNo string, org_name string, doctor string, fixmedins_code str
25 25
 	inputData := make(map[string]interface{})
26 26
 	inputMessage["infno"] = "4201A" // 交易编码
27 27
 
28
+	for _, item := range struct4201A.Fopfd {
29
+
30
+	}
31
+
28 32
 	inputData["fixmedins_mdtrt_id"] = ""
29 33
 	inputData["med_type"] = ""
30 34
 	inputData["bkkp_sn"] = ""
@@ -195,22 +199,20 @@ func Gdyb4202(org_name string, doctor string, fixmedins_code string, insuplc_adm
195 199
 	inputData["elec_billno_code"] = ""
196 200
 	inputData["exp_content"] = ""
197 201
 
198
-	for _, item := range struct4202.ODiagListD {
199
-
202
+	for index, item := range struct4202.ODiagListD {
200 203
 		feedetailInfo := make(map[string]interface{})
201 204
 		feedetailInfo["inout_diag_type"] = item.InoutDiagType
202 205
 		feedetailInfo["diag_type"] = item.DiagType         // 就诊 ID(来自2201接口返回)
203 206
 		feedetailInfo["maindiag_flag"] = item.MaindiagFlag // 人员编号 (来自1101接口返回)
204
-		feedetailInfo["diag_srt_no"] = ""                  // 收费批次号
205
-		feedetailInfo["diag_code"] = ""                    // 病种编码
207
+		feedetailInfo["diag_srt_no"] = index               // 收费批次号
208
+		feedetailInfo["diag_code"] = item.DiagCode         // 病种编码
206 209
 		feedetailInfo["diag_name"] = ""                    // 处方号
207 210
 		feedetailInfo["diag_dept"] = ""
208 211
 		feedetailInfo["diag_dr_code"] = ""
209 212
 		feedetailInfo["diag_dr_name"] = ""
210 213
 		feedetailInfo["diag_time"] = ""
211
-		feedetailInfo["vali_flag"] = ""
214
+		feedetailInfo["vali_flag"] = "1"
212 215
 		feedetail = append(feedetail, feedetailInfo)
213
-
214 216
 	}
215 217
 
216 218
 	inputData["ownPayPatnDiagListD"] = feedetail
@@ -234,7 +236,7 @@ func Gdyb4202(org_name string, doctor string, fixmedins_code string, insuplc_adm
234 236
 	if fixmedins_code == "H15049901371" {
235 237
 		url = gdyb_url
236 238
 	} else {
237
-		url = gdyb_url + "1101"
239
+		url = gdyb_url + "4202"
238 240
 	}
239 241
 
240 242
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
@@ -266,7 +268,7 @@ func Gdyb4202(org_name string, doctor string, fixmedins_code string, insuplc_adm
266 268
 	return str, inputLog
267 269
 
268 270
 }
269
-func Gdyb4203(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, psn_name string) (string, string) {
271
+func Gdyb4203(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_mdtrt_id string) (string, string) {
270 272
 	//生成签名
271 273
 	nonce := GetRandomString(32)
272 274
 	timestamp := time.Now().Unix()
@@ -275,11 +277,11 @@ func Gdyb4203(certNo string, org_name string, doctor string, fixmedins_code stri
275 277
 	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
276 278
 	//input := make(map[string]interface{})
277 279
 	inputData := make(map[string]interface{})
278
-	inputMessage["infno"] = "4203"       // 交易编码
279
-	inputData["fixmedins_mdtrt_id"] = "" // 开始时间
280
-	inputData["fixmedins_code"] = ""     // 开始时间
281
-	inputData["cplt_flag"] = ""          // 人员姓名
282
-	inputMessage["input"] = inputData    //交易输入
280
+	inputMessage["infno"] = "4203"                       // 交易编码
281
+	inputData["fixmedins_mdtrt_id"] = fixmedins_mdtrt_id // 开始时间
282
+	inputData["fixmedins_code"] = fixmedins_code         // 开始时间
283
+	inputData["cplt_flag"] = "1"                         // 人员姓名
284
+	inputMessage["input"] = inputData                    //交易输入
283 285
 
284 286
 	var inputLog string
285 287
 	bytesData, err := json.Marshal(inputMessage)
@@ -297,7 +299,7 @@ func Gdyb4203(certNo string, org_name string, doctor string, fixmedins_code stri
297 299
 	if fixmedins_code == "H15049901371" {
298 300
 		url = gdyb_url
299 301
 	} else {
300
-		url = gdyb_url + "1101"
302
+		url = gdyb_url + "4203"
301 303
 	}
302 304
 
303 305
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"

+ 33 - 6
service/his_service.go Parādīt failu

@@ -749,7 +749,7 @@ func UpdataRegStatus2(id int64) error {
749 749
 	return err
750 750
 }
751 751
 func GetAdminUserInfoByID(org_id int64, admin_user_id int64) (role models.UserAdminRole, err error) {
752
-	err = readUserDb.Model(&models.UserAdminRole{}).Where("org_id = ? AND status = 1 AND admin_user_id = ?", org_id, admin_user_id).First(&role).Error
752
+	err = readUserDb.Model(&models.UserAdminRole{}).Where("org_id = ?  AND admin_user_id = ?", org_id, admin_user_id).First(&role).Error
753 753
 	return
754 754
 }
755 755
 
@@ -978,27 +978,43 @@ func GetHisOrderInfoByNumberThree(order_number string) (order []*models.HisOrder
978 978
 	return
979 979
 }
980 980
 
981
-func GetOrderByTime(start_time int64, end_time int64, org_id int64, insutype string, clr_org string, clr_type string) (orders []*models.HisOrder, err error) {
981
+func GetOrderByTime(start_time int64, end_time int64, org_id int64, insutype string, clr_org string, clr_type string, mdtrtareaAdmvs string) (orders []*models.HisOrder, err error) {
982 982
 	db := readDb.Model(&models.HisOrder{})
983 983
 	db = db.Where("user_org_id = ? AND status = 1 AND order_status = 2 AND is_medicine_insurance = 1 AND UNIX_TIMESTAMP(setl_time)  <= ? AND UNIX_TIMESTAMP(setl_time) >= ? AND insutype = ?", org_id, end_time, start_time, insutype)
984 984
 	if len(clr_org) > 0 {
985 985
 		db = db.Where("clr_optins = ?", clr_org)
986 986
 	}
987 987
 	if len(clr_type) > 0 {
988
-		db = db.Where("clr_type = ?", clr_type)
988
+		if mdtrtareaAdmvs == "150499" {
989
+			if clr_type == "11" {
990
+				db = db.Where("clr_type = ?", clr_type)
991
+			}
992
+
993
+		} else {
994
+			db = db.Where("clr_type = ?", clr_type)
995
+
996
+		}
989 997
 	}
990 998
 	err = db.Find(&orders).Error
991 999
 	return
992 1000
 }
993 1001
 
994
-func GetOrderByTimeFive(start_time int64, end_time int64, org_id int64, insutype string, clr_org string, clr_type string) (orders []*models.HisOrder, err error) {
1002
+func GetOrderByTimeFive(start_time int64, end_time int64, org_id int64, insutype string, clr_org string, clr_type string, mdtrtareaAdmvs string) (orders []*models.HisOrder, err error) {
995 1003
 	db := readDb.Model(&models.HisOrder{})
996 1004
 	db = db.Where("user_org_id = ?  AND order_status = 3 AND is_medicine_insurance = 1 AND UNIX_TIMESTAMP(setl_time)  <= ? AND UNIX_TIMESTAMP(setl_time) >= ? AND insutype = ?", org_id, end_time, start_time, insutype)
997 1005
 	if len(clr_org) > 0 {
998 1006
 		db = db.Where("clr_optins = ?", clr_org)
999 1007
 	}
1000 1008
 	if len(clr_type) > 0 {
1001
-		db = db.Where("clr_type = ?", clr_type)
1009
+		if mdtrtareaAdmvs == "150499" {
1010
+			if clr_type == "11" {
1011
+				db = db.Where("clr_type = ?", clr_type)
1012
+			}
1013
+
1014
+		} else {
1015
+			db = db.Where("clr_type = ?", clr_type)
1016
+
1017
+		}
1002 1018
 	}
1003 1019
 	err = db.Find(&orders).Error
1004 1020
 	return
@@ -1401,6 +1417,11 @@ func GetTodayHisOrder(org_id int64, patient_id int64, record_time int64, number
1401 1417
 	return
1402 1418
 }
1403 1419
 
1420
+func GetLastFundList(org_id int64) (order models.HisFundSettleListResult, err error) {
1421
+	err = readDb.Model(&models.HisFundSettleListResult{}).Where("user_org_id = ? AND status = 1 ", org_id).Last(&order).Error
1422
+	return
1423
+}
1424
+
1404 1425
 func GetOrderCountByNumber(org_id int64, patient_id int64, record_time int64, number string) (count int64, err error) {
1405 1426
 	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ? AND status = 1 AND patient_id = ? AND settle_accounts_date = ? AND order_status = 2 AND mdtrt_id = ?", org_id, patient_id, record_time, number).Count(&count).Error
1406 1427
 
@@ -1422,7 +1443,13 @@ func GetPsnByPatientIdTwo(patient_id int64, record_date int64) (psn models.HisPs
1422 1443
 }
1423 1444
 
1424 1445
 func GetAllHisOrder(org_id int64) (his []*models.HisOrder, err error) {
1425
-	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ?  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND med_type = '14' AND setl_time >= '2022-11-01 00:00:00'", org_id).Order("setl_time asc").Find(&his).Error
1446
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ?  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND med_type = '14' AND setl_time >= '2022-12-15 00:00:00'", org_id).Order("setl_time asc").Find(&his).Error
1447
+	fmt.Println(err)
1448
+	return
1449
+}
1450
+
1451
+func GetAllHisOrderTwo(org_id int64, id int64) (his []*models.HisOrder, err error) {
1452
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ?  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND med_type = '14' AND id > ?", org_id, id).Order("setl_time asc").Find(&his).Error
1426 1453
 	fmt.Println(err)
1427 1454
 	return
1428 1455
 }

+ 16 - 13
service/hn_service.go Parādīt failu

@@ -1566,17 +1566,20 @@ func Hnyb4101(struct4101 Struct4101, params models.PublicParams) (string, string
1566 1566
 	inputData["setl_id"] = struct4101.SetlId   // 结算 ID  必填
1567 1567
 	inputData["psn_no"] = struct4101.PsnNo     // 结算 ID  必填
1568 1568
 
1569
-	inputData["fixmedins_name"] = params.FixmedinsName        // 定点医药机构名称  必填
1570
-	inputData["fixmedins_code"] = params.FixmedinsCode        // 定点医药机构编码  必填
1571
-	inputData["hi_setl_lv"] = ""                              // 医保结算等级
1572
-	inputData["hi_no"] = struct4101.PsnNo                     // 医保编号
1573
-	inputData["medcasno"] = struct4101.PsnNo                  // 病案号  必填
1574
-	inputData["dcla_time"] = year + "-" + month + "-" + day   // 申报时间  必填
1575
-	inputData["psn_name"] = struct4101.PsnName                // 人员姓名  必填
1576
-	inputData["gend"] = struct4101.Gend                       // 性别  必填
1577
-	inputData["brdy"] = struct4101.Brdy                       // 出生日期  必填
1578
-	inputData["age"] = struct4101.Age                         // 年龄  必填
1579
-	inputData["ntly"] = struct4101.Ntly                       // 国籍  必填
1569
+	inputData["fixmedins_name"] = params.FixmedinsName      // 定点医药机构名称  必填
1570
+	inputData["fixmedins_code"] = params.FixmedinsCode      // 定点医药机构编码  必填
1571
+	inputData["hi_setl_lv"] = ""                            // 医保结算等级
1572
+	inputData["hi_no"] = struct4101.PsnNo                   // 医保编号
1573
+	inputData["medcasno"] = struct4101.PsnNo                // 病案号  必填
1574
+	inputData["dcla_time"] = year + "-" + month + "-" + day // 申报时间  必填
1575
+	inputData["psn_name"] = struct4101.PsnName              // 人员姓名  必填
1576
+	inputData["gend"] = struct4101.Gend                     // 性别  必填
1577
+	inputData["brdy"] = struct4101.Brdy                     // 出生日期  必填
1578
+	inputData["age"] = struct4101.Age                       // 年龄  必填
1579
+	inputData["ntly"] = struct4101.Ntly                     // 国籍  必填
1580
+
1581
+	inputData["resp_nurs_code"] = "N430822004867" // 民族  必填
1582
+
1580 1583
 	inputData["nwb_age"] = ""                                 // 年龄  必填
1581 1584
 	inputData["naty"] = struct4101.Naty                       // 民族  必填
1582 1585
 	inputData["patn_cert_type"] = struct4101.PatnCertType     // 患者证件类别  必填
@@ -1630,8 +1633,8 @@ func Hnyb4101(struct4101 Struct4101, params models.PublicParams) (string, string
1630 1633
 	inputData["biz_sn"] = struct4101.BizSn                    // 业务流水号  必填
1631 1634
 	inputData["days_rinp_flag_31"] = ""                       // 出院 31 天内再住院计划标志  必填
1632 1635
 	inputData["days_rinp_pup_31"] = ""                        // 出院 31 天内再住院目的  必填
1633
-	inputData["chfpdr_name"] = ""                             // 主诊医师姓名  必填
1634
-	inputData["chfpdr_code"] = ""                             // 主诊医师代码  必填
1636
+	inputData["chfpdr_name"] = struct4101.DoctorName          // 主诊医师姓名  必填
1637
+	inputData["chfpdr_code"] = struct4101.DoctorCode          // 主诊医师代码  必填
1635 1638
 	inputData["setl_begn_date"] = struct4101.SetlBegnDate     // 结算开始日期  必填
1636 1639
 	inputData["setl_end_date"] = struct4101.SetlEndDate       // 结算结束日期  必填
1637 1640
 	inputData["psn_selfpay"] = struct4101.PsnSelfPay          // 个人自付  必填