Просмотр исходного кода

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

csx 2 лет назад
Родитель
Сommit
b6e930ab3b

+ 1 - 1
conf/app.conf Просмотреть файл

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

+ 1 - 1
controllers/js/jsyb_controller.go Просмотреть файл

@@ -794,7 +794,7 @@ func (c *JSybController) ReadCard() {
794 794
 		token := ele.Data.EcToken
795 795
 		fmt.Println(token)
796 796
 		if len(token) > 0 {
797
-			result, _ := service.Jsyb1101ForEleCert(org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, url, ak, token, cainfo, ele.Data.IDNo, ele.Data.UserName)
797
+			result, _ := service.Jsyb1101ForEleCert(org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, url, ak, token, cainfo, ele.Data.IDNo, ConvertToString(DeleteExtraSpace(ele.Data.UserName), "gbk", "utf-8"))
798 798
 			var dat map[string]interface{}
799 799
 			if err := json.Unmarshal([]byte(result), &dat); err == nil {
800 800
 				fmt.Println(dat)

+ 98 - 31
controllers/sg/his_api_controller.go Просмотреть файл

@@ -83,7 +83,14 @@ func HisManagerApiRegistRouters() {
83 83
 	beego.Router("/90990", &HisApiController{}, "get:CheckCardPWDTwo")
84 84
 	beego.Router("/9001", &HisApiController{}, "get:Get9001")
85 85
 
86
+	beego.Router("/api/readelecard", &HisApiController{}, "get:ReadEleCard")
87
+
88
+
89
+
90
+
91
+
86 92
 }
93
+
87 94
 func (c *HisApiController) Get9001() {
88 95
 	adminUser := c.GetAdminUserInfo()
89 96
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
@@ -5176,6 +5183,9 @@ func (c *HisApiController) GetRegisterInfo() {
5176 5183
 				if id_card_type == 3 {
5177 5184
 					psn_info.VerifyNumber = IdCardNo + "|" + psn_info.VerifyNumber
5178 5185
 					cert_no = IdCardNo
5186
+				} else if id_card_type == 4 {
5187
+					cert_no = IdCardNo
5188
+					psn_info.VerifyNumber = psn_info.VerifyNumber
5179 5189
 				} else {
5180 5190
 
5181 5191
 					bas := strings.Split(psn_info.CardInfo, "|")
@@ -5340,6 +5350,8 @@ func (c *HisApiController) GetUploadInfo() {
5340 5350
 	pay_way, _ := c.GetInt64("pay_way")
5341 5351
 	pay_price, _ := c.GetFloat("pay_price")
5342 5352
 	pay_card_no := c.GetString("pay_card_no")
5353
+	token := c.GetString("token")
5354
+
5343 5355
 	discount_price, _ := c.GetFloat("discount_price")
5344 5356
 	preferential_price, _ := c.GetFloat("preferential_price")
5345 5357
 	reality_price, _ := c.GetFloat("reality_price")
@@ -6150,41 +6162,17 @@ func (c *HisApiController) GetUploadInfo() {
6150 6162
 
6151 6163
 						} else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
6152 6164
 							psn_info, _ := service.GetPsnByPatientId(his.PatientId)
6153
-
6154 6165
 							psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
6155
-
6156
-							//psn_info, _ := service.GetPsnByPatientId(id)
6157 6166
 							bas := strings.Split(psn_info.CardInfo, "|")
6158
-
6159 6167
 							if his.IdCardType == 1 {
6160 6168
 								cert_no = bas[2]
6161 6169
 							} else if his.IdCardType == 3 {
6162 6170
 								cert_no = his.Certno
6163 6171
 								psn_info.VerifyNumber = his.Certno + "|" + psn_info.VerifyNumber
6164
-							} else {
6165
-								cert_no = bas[1]
6172
+							} else if his.IdCardType == 4 {
6173
+								cert_no = his.Certno
6174
+								psn_info.VerifyNumber = token
6166 6175
 							}
6167
-
6168
-							//江苏地区国家医保医疗类别
6169
-							//职工透析:医疗类别选特殊情况门诊9933
6170
-							//居民血透门慢: 医疗类别选门诊慢病1402
6171
-							//var med_type string
6172
-							//if his.Insutype == "310" {
6173
-							//	if reg_type == 14 {
6174
-							//		med_type = "9933"
6175
-							//	} else if reg_type == 11 {
6176
-							//		med_type = "11"
6177
-							//
6178
-							//	}
6179
-							//} else if his.Insutype == "390" {
6180
-							//	if reg_type == 14 {
6181
-							//		med_type = "1402"
6182
-							//	} else if reg_type == 11 {
6183
-							//		med_type = "11"
6184
-							//	}
6185
-							//}
6186
-							//psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
6187
-
6188 6176
 							var api string
6189 6177
 							if miConfig.MdtrtareaAdmvs == "320921" {
6190 6178
 								api = "http://192.168.3.111:9532/" + "jsyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
@@ -6194,11 +6182,7 @@ func (c *HisApiController) GetUploadInfo() {
6194 6182
 									"&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
6195 6183
 									"&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
6196 6184
 									"&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&acct_used_flag=" + acct_used_flag + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&verify_number=" + psn_info.VerifyNumber + "&cainfo=" + miConfig.Cainfo
6197
-
6198
-								//req, _ = http.NewRequest("POST", "http://192.168.3.111:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
6199
-
6200 6185
 							} else {
6201
-								//req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
6202 6186
 								api = "http://192.168.5.251:9532/" + "jsyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
6203 6187
 									his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
6204 6188
 									"&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
@@ -12077,3 +12061,86 @@ func ConvertToString(src string, srcCode string, tagCode string) string {
12077 12061
 	result := string(cdata)
12078 12062
 	return result
12079 12063
 }
12064
+
12065
+func (c *HisApiController) ReadEleCard() {
12066
+	id_card_type, _ := c.GetInt64("id_card_type")
12067
+	admin_user_id, _ := c.GetInt64("admin_user_id")
12068
+	fmt.Println(c.GetAdminUserInfo().CurrentOrgId)
12069
+	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
12070
+	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
12071
+
12072
+	if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
12073
+		var api string
12074
+		if miConfig.MdtrtareaAdmvs == "320921" {
12075
+			api = "http://192.168.3.111:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
12076
+				"&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
12077
+			fmt.Println(api)
12078
+
12079
+		} else {
12080
+			api = "http://192.168.5.251:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
12081
+				"&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)
12082
+		}
12083
+
12084
+		resp, requestErr := http.Get(api)
12085
+		if requestErr != nil {
12086
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
12087
+			return
12088
+		}
12089
+
12090
+		body, ioErr := ioutil.ReadAll(resp.Body)
12091
+		if ioErr != nil {
12092
+			utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
12093
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
12094
+			return
12095
+		}
12096
+		var respJSON map[string]interface{}
12097
+		if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
12098
+			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
12099
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
12100
+			return
12101
+		}
12102
+		var status string
12103
+		status = respJSON["data"].(map[string]interface{})["status"].(string)
12104
+		//card_type := respJSON["data"].(map[string]interface{})["type"].(string)
12105
+		var token string
12106
+		var res ResultTwo           //1101结果
12107
+		var res10265 ResultTwo10265 //1101结果
12108
+		if status == "0" { //读卡成功
12109
+			var card_info string //卡信息
12110
+			var busi_card_info string
12111
+			token = respJSON["data"].(map[string]interface{})["token"].(string)
12112
+			busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
12113
+			card_info = respJSON["data"].(map[string]interface{})["card_info"].(string)
12114
+
12115
+			fmt.Println(card_info)
12116
+			fmt.Println(busi_card_info)
12117
+
12118
+			respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
12119
+			result, _ := json.Marshal(respJSON)
12120
+
12121
+			if err := json.Unmarshal([]byte(result), &res10265); err != nil {
12122
+				utils.ErrorLog("解析失败:%v", err)
12123
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
12124
+				return
12125
+			}
12126
+			res.ErrMsg = res10265.ErrMsg
12127
+			infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
12128
+			res.Infcode = infocode
12129
+			res.Output = res10265.Output
12130
+			res.InfRefmsgid = res10265.InfRefmsgid
12131
+			if res.Infcode == 0 {
12132
+					c.ServeSuccessJSON(map[string]interface{}{
12133
+						"number":  token,
12134
+					})
12135
+				}
12136
+			} else {
12137
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
12138
+				return
12139
+			}
12140
+		} else { //读卡失败
12141
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
12142
+			return
12143
+		}
12144
+	}
12145
+
12146
+}

+ 215 - 66
controllers/zh/zh_his_api_controller.go Просмотреть файл

@@ -493,8 +493,71 @@ func ZHHisManagerApiRegistRouters() {
493 493
 	beego.Router("/zh/api/readcard", &ZHHisApiController{}, "get:ReadCard")
494 494
 
495 495
 	beego.Router("/zh/api/clearsettle", &ZHHisApiController{}, "get:ClearSettle")
496
+	beego.Router("/zh/api/readelecard", &ZHHisApiController{}, "get:ReadEleCard")
496 497
 
497 498
 }
499
+func (c *ZHHisApiController) ReadEleCard() {
500
+	id_card_type, _ := c.GetInt64("id_card_type")
501
+	admin_user_id, _ := c.GetInt64("admin_user_id")
502
+	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
503
+	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
504
+
505
+	var api string
506
+	api = "http://172.16.13.254:9532/" + "nmyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
507
+		"&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
508
+
509
+	fmt.Println(api)
510
+
511
+	resp, requestErr := http.Get(api)
512
+	if requestErr != nil {
513
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
514
+		return
515
+	}
516
+
517
+	body, ioErr := ioutil.ReadAll(resp.Body)
518
+	if ioErr != nil {
519
+		utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
520
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
521
+		return
522
+	}
523
+	var respJSON map[string]interface{}
524
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
525
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
526
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
527
+		return
528
+	}
529
+	var status string
530
+	status = respJSON["data"].(map[string]interface{})["status"].(string)
531
+	//card_type := respJSON["data"].(map[string]interface{})["type"].(string)
532
+	var token string
533
+	var res ResultTwo           //1101结果
534
+	var res10265 ResultTwo10265 //1101结果
535
+	if status == "0" {          //读卡成功
536
+		token = respJSON["data"].(map[string]interface{})["token"].(string)
537
+		respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
538
+		result, _ := json.Marshal(respJSON)
539
+		if err := json.Unmarshal([]byte(result), &res10265); err != nil {
540
+			utils.ErrorLog("解析失败:%v", err)
541
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
542
+			return
543
+		}
544
+		res.ErrMsg = res10265.ErrMsg
545
+		infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
546
+		res.Infcode = infocode
547
+		res.Output = res10265.Output
548
+		res.InfRefmsgid = res10265.InfRefmsgid
549
+		if res.Infcode == 0 {
550
+			c.ServeSuccessJSON(map[string]interface{}{
551
+				"number": token,
552
+			})
553
+		}
554
+	} else {
555
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
556
+		return
557
+	}
558
+
559
+}
560
+
498 561
 func (c *ZHHisApiController) ClearSettle() {
499 562
 	order_id, _ := c.GetInt64("order_id")
500 563
 	admin_user_id, _ := c.GetInt64("admin_user_id")
@@ -2824,79 +2887,172 @@ func (this *ZHHisApiController) GetZHInHospitalUnCheck() {
2824 2887
 
2825 2888
 	var result string
2826 2889
 	var requestLog string
2890
+	orders, _ := service.GetHisOrderInfoByNumber(record.Number)
2827 2891
 
2828
-	if miConfig.MdtrtareaAdmvs == "150499" {
2829
-		//请求内网数据
2830
-		api := "http://172.16.13.254:9532/" + "nmyb/2302?psn_no=" + record.PsnNo + "&mdtrtId=" + record.Number + "&number=" + "0000" +
2831
-			"&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName + "&fixmedins_code=" + miConfig.Code +
2832
-			"&insuplc_admdvs=" + record.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&refund_type=0"
2833
-		resp, requestErr := http.Get(api)
2834
-		if requestErr != nil {
2835
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2836
-			return
2837
-		}
2892
+	if len(orders) > 0 { //判断是否上传过明细,有的话需要退明细,后撤销入院
2893
+		if miConfig.MdtrtareaAdmvs == "150499" {
2894
+			//请求内网数据
2895
+			api := "http://172.16.13.254:9532/" + "nmyb/2302?psn_no=" + record.PsnNo + "&mdtrtId=" + record.Number + "&number=" + "0000" +
2896
+				"&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName + "&fixmedins_code=" + miConfig.Code +
2897
+				"&insuplc_admdvs=" + record.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&refund_type=0"
2898
+			resp, requestErr := http.Get(api)
2899
+			if requestErr != nil {
2900
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2901
+				return
2902
+			}
2838 2903
 
2839
-		body, ioErr := ioutil.ReadAll(resp.Body)
2904
+			body, ioErr := ioutil.ReadAll(resp.Body)
2905
+
2906
+			if ioErr != nil {
2907
+				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
2908
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2909
+				return
2910
+			}
2911
+
2912
+			var respJSON map[string]interface{}
2913
+
2914
+			if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
2915
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
2916
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2917
+				return
2918
+			}
2919
+
2920
+			respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
2921
+			result_byte, _ := json.Marshal(respJSON)
2922
+			result = string(result_byte)
2923
+			saveLog(result, requestLog, "2302", "月结退明细")
2924
+
2925
+		} else {
2926
+			result, requestLog = service.Gdyb2302(record.PsnNo, record.Number, miConfig.OrgName, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, "0000", 0)
2927
+			saveLog(result, requestLog, "2302", "月结退明细")
2840 2928
 
2841
-		if ioErr != nil {
2842
-			utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
2843
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2844
-			return
2845 2929
 		}
2846 2930
 
2847
-		var respJSON map[string]interface{}
2931
+		var dat map[string]interface{}
2932
+		if err := json.Unmarshal([]byte(result), &dat); err == nil {
2933
+			fmt.Println(dat)
2934
+		} else {
2935
+			fmt.Println(err)
2936
+		}
2848 2937
 
2849
-		if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
2850
-			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
2851
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2852
-			return
2938
+		userJSONBytes, _ := json.Marshal(dat)
2939
+
2940
+		var res2 ResultEmpty
2941
+		var resEmpty10265 ResultEmpty10265
2942
+		if miConfig.Code == "H15049901371" {
2943
+			if err := json.Unmarshal(userJSONBytes, &resEmpty10265); err != nil {
2944
+				utils.ErrorLog("解析失败:%v", err)
2945
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2946
+				return
2947
+			}
2948
+			Infcode, _ := strconv.ParseInt(resEmpty10265.Infcode, 10, 64)
2949
+			res2.Infcode = Infcode
2950
+			res2.RespondTime = resEmpty10265.RespondTime
2951
+			res2.ErrMsg = resEmpty10265.ErrMsg
2952
+			res2.Output = resEmpty10265.Output
2953
+			res2.WarnMsg = resEmpty10265.WarnMsg
2954
+		} else {
2955
+			if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
2956
+				utils.ErrorLog("解析失败:%v", err)
2957
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2958
+				return
2959
+			}
2853 2960
 		}
2854 2961
 
2855
-		respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
2856
-		result_byte, _ := json.Marshal(respJSON)
2857
-		result = string(result_byte)
2858
-		saveLog(result, requestLog, "2302", "月结退明细")
2962
+		if res2.Infcode == 0 {
2859 2963
 
2860
-	} else {
2861
-		result, requestLog = service.Gdyb2302(record.PsnNo, record.Number, miConfig.OrgName, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, "0000", 0)
2862
-		saveLog(result, requestLog, "2302", "月结退明细")
2964
+			service.UpdataHospitalOrderStatus(record.Number, adminInfo.CurrentOrgId)
2863 2965
 
2864
-	}
2966
+			var result string
2967
+			var requestLog string
2968
+			if miConfig.MdtrtareaAdmvs == "150499" {
2969
+				//请求内网数据
2970
+				api := "http://172.16.13.254:9532/" + "nmyb/2404?mdtrt_id=" + record.Number + "&psn_no=" + record.PsnNo +
2971
+					"&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName + "&fixmedins_code=" + miConfig.Code +
2972
+					"&insuplc_admdvs=" + record.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
2973
+				resp, requestErr := http.Get(api)
2974
+				if requestErr != nil {
2975
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2976
+					return
2977
+				}
2865 2978
 
2866
-	var dat map[string]interface{}
2867
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
2868
-		fmt.Println(dat)
2869
-	} else {
2870
-		fmt.Println(err)
2871
-	}
2979
+				body, ioErr := ioutil.ReadAll(resp.Body)
2872 2980
 
2873
-	userJSONBytes, _ := json.Marshal(dat)
2981
+				if ioErr != nil {
2982
+					utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
2983
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2984
+					return
2985
+				}
2874 2986
 
2875
-	var res2 ResultEmpty
2876
-	var resEmpty10265 ResultEmpty10265
2877
-	if miConfig.Code == "H15049901371" {
2878
-		if err := json.Unmarshal(userJSONBytes, &resEmpty10265); err != nil {
2879
-			utils.ErrorLog("解析失败:%v", err)
2880
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2881
-			return
2882
-		}
2883
-		Infcode, _ := strconv.ParseInt(resEmpty10265.Infcode, 10, 64)
2884
-		res2.Infcode = Infcode
2885
-		res2.RespondTime = resEmpty10265.RespondTime
2886
-		res2.ErrMsg = resEmpty10265.ErrMsg
2887
-		res2.Output = resEmpty10265.Output
2888
-		res2.WarnMsg = resEmpty10265.WarnMsg
2889
-	} else {
2890
-		if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
2891
-			utils.ErrorLog("解析失败:%v", err)
2892
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2893
-			return
2894
-		}
2895
-	}
2987
+				var respJSON map[string]interface{}
2896 2988
 
2897
-	if res2.Infcode == 0 {
2989
+				if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
2990
+					utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
2991
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2992
+					return
2993
+				}
2994
+
2995
+				respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
2996
+				result_byte, _ := json.Marshal(respJSON)
2997
+				result = string(result_byte)
2998
+
2999
+			} else {
3000
+				result, requestLog = service.ZHGdyb2404(record.Number, record.PsnNo, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
3001
+				saveLog(result, requestLog, "2404", "入院登记撤销")
2898 3002
 
2899
-		service.UpdataHospitalOrderStatus(record.Number, adminInfo.CurrentOrgId)
3003
+			}
3004
+
3005
+			var dat map[string]interface{}
3006
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
3007
+				fmt.Println(dat)
3008
+			} else {
3009
+				fmt.Println(err)
3010
+			}
3011
+			userJSONBytes, _ := json.Marshal(dat)
3012
+			var res ResultEmpty
3013
+			var resEmpty10265 ResultEmpty10265
3014
+			if miConfig.Code == "H15049901371" {
3015
+				if err := json.Unmarshal(userJSONBytes, &resEmpty10265); err != nil {
3016
+					utils.ErrorLog("解析失败:%v", err)
3017
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3018
+					return
3019
+				}
3020
+				Infcode, _ := strconv.ParseInt(resEmpty10265.Infcode, 10, 64)
3021
+				res.Infcode = Infcode
3022
+				res.RespondTime = resEmpty10265.RespondTime
3023
+				res.ErrMsg = resEmpty10265.ErrMsg
3024
+				res.Output = resEmpty10265.Output
3025
+				res.WarnMsg = resEmpty10265.WarnMsg
3026
+			} else {
3027
+				if err := json.Unmarshal(userJSONBytes, &res); err != nil {
3028
+					utils.ErrorLog("解析失败:%v", err)
3029
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3030
+					return
3031
+				}
3032
+			}
3033
+
3034
+			if res.Infcode == 0 {
3035
+				record.Status = 0
3036
+				service.CreateHospitalRecord(&record)
3037
+
3038
+				this.ServeSuccessJSON(map[string]interface{}{
3039
+					"msg": "撤销入院成功",
3040
+				})
3041
+
3042
+			} else {
3043
+				this.ServeSuccessJSON(map[string]interface{}{
3044
+					"failed_code": -10,
3045
+					"msg":         res.ErrMsg,
3046
+				})
3047
+			}
3048
+
3049
+		} else {
3050
+			this.ServeSuccessJSON(map[string]interface{}{
3051
+				"code": -10,
3052
+				"msg":  res2.ErrMsg,
3053
+			})
3054
+		}
3055
+	} else { //没有上传过明细的,直接撤销入院
2900 3056
 
2901 3057
 		var result string
2902 3058
 		var requestLog string
@@ -2969,7 +3125,6 @@ func (this *ZHHisApiController) GetZHInHospitalUnCheck() {
2969 3125
 		if res.Infcode == 0 {
2970 3126
 			record.Status = 0
2971 3127
 			service.CreateHospitalRecord(&record)
2972
-
2973 3128
 			this.ServeSuccessJSON(map[string]interface{}{
2974 3129
 				"msg": "撤销入院成功",
2975 3130
 			})
@@ -2980,14 +3135,7 @@ func (this *ZHHisApiController) GetZHInHospitalUnCheck() {
2980 3135
 				"msg":         res.ErrMsg,
2981 3136
 			})
2982 3137
 		}
2983
-
2984
-	} else {
2985
-		this.ServeSuccessJSON(map[string]interface{}{
2986
-			"code": -10,
2987
-			"msg":  res2.ErrMsg,
2988
-		})
2989 3138
 	}
2990
-
2991 3139
 }
2992 3140
 
2993 3141
 func saveLog(result string, request string, infno string, desc string) {
@@ -3074,6 +3222,7 @@ func (c *ZHHisApiController) ReadCard() {
3074 3222
 	var api string
3075 3223
 	api = "http://172.16.13.254:9532/" + "nmyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
3076 3224
 		"&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
3225
+
3077 3226
 	fmt.Println(api)
3078 3227
 
3079 3228
 	resp, requestErr := http.Get(api)

+ 6 - 6
main.go Просмотреть файл

@@ -5,7 +5,7 @@ import (
5 5
 	"fmt"
6 6
 	"gdyb/models"
7 7
 	_ "gdyb/routers"
8
-	//"gdyb/service"
8
+	"gdyb/service"
9 9
 	"github.com/astaxie/beego"
10 10
 	"github.com/qiniu/api.v7/auth/qbox"
11 11
 	"github.com/qiniu/api.v7/storage"
@@ -15,11 +15,11 @@ import (
15 15
 )
16 16
 
17 17
 func init() {
18
-	//service.ConnectDB()
19
-	//org_id, _ := beego.AppConfig.Int64("org_id")
20
-	//miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
21
-	//CreateLog(miConfig)
22
-	//UploadLog(miConfig)
18
+	service.ConnectDB()
19
+	org_id, _ := beego.AppConfig.Int64("org_id")
20
+	miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
21
+	CreateLog(miConfig)
22
+	UploadLog(miConfig)
23 23
 
24 24
 	//UploadSettleList(org_id)
25 25
 }

+ 9 - 0
service/hbyb_service.go Просмотреть файл

@@ -54,6 +54,12 @@ func Hbyb1101(certNo string, org_name string, doctor string, fixmedins_code stri
54 54
 			inputData["certno"] = ""            // 证件号码
55 55
 			inputData["psn_cert_type"] = ""     // 人员证件类型
56 56
 
57
+		} else if id_card_type == 4 {
58
+			inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
59
+			inputData["card_sn"] = ""           // 卡识别码
60
+			inputData["certno"] = ""            // 证件号码
61
+			inputData["psn_cert_type"] = ""     // 人员证件类型
62
+
57 63
 		} else {
58 64
 			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
59 65
 			inputData["card_sn"] = ""           // 卡识别码
@@ -110,6 +116,9 @@ func Hbyb2201(psnNo string, insutype string, certNo string, org_name string, doc
110 116
 	if id_card_type == 1 {
111 117
 		inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
112 118
 		inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
119
+	} else if id_card_type == 4 {
120
+		inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
121
+		inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
113 122
 	} else {
114 123
 		inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
115 124
 		inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号

+ 10 - 2
service/jsyb_service.go Просмотреть файл

@@ -285,9 +285,12 @@ func Jsyb2201(psnNo string, insutype string, certNo string, org_name string, ope
285 285
 	} else if id_card_type == 3 {
286 286
 		inputData["mdtrt_cert_type"] = "04"        // 就诊凭证类型
287 287
 		inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
288
-	} else {
288
+	} else if id_card_type == 4 {
289 289
 		inputData["mdtrt_cert_type"] = "01"        // 就诊凭证类型
290 290
 		inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
291
+	} else {
292
+		inputData["mdtrt_cert_type"] = "02"        // 就诊凭证类型
293
+		inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
291 294
 
292 295
 	}
293 296
 
@@ -711,6 +714,9 @@ func Jsyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
711 714
 		} else if id_card_type == 3 {
712 715
 			inputData["mdtrt_cert_type"] = "04"        // 就诊凭证类型
713 716
 			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
717
+		} else if id_card_type == 4 {
718
+			inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
719
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
714 720
 		} else {
715 721
 			inputData["mdtrt_cert_type"] = "01"        // 就诊凭证类型
716 722
 			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
@@ -775,9 +781,11 @@ func Jsyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
775 781
 		} else if id_card_type == 3 {
776 782
 			inputData["mdtrt_cert_type"] = "04"        // 就诊凭证类型
777 783
 			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
778
-		} else {
784
+		} else if id_card_type == 4 {
779 785
 			inputData["mdtrt_cert_type"] = "01"        // 就诊凭证类型
780 786
 			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
787
+		} else {
788
+
781 789
 		}
782 790
 	}
783 791
 	if med_type == "1111" || med_type == "1112" {