Sfoglia il codice sorgente

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

csx 3 anni fa
parent
commit
99b16e0f41

+ 4 - 2
controllers/js/jsyb_controller.go Vedi File

317
 	med_type := c.GetString("med_type")
317
 	med_type := c.GetString("med_type")
318
 	id_card_type, _ := c.GetInt64("id_card_type")
318
 	id_card_type, _ := c.GetInt64("id_card_type")
319
 	certificates, _ := c.GetInt64("certificates")
319
 	certificates, _ := c.GetInt64("certificates")
320
+	verify_number := c.GetString("verify_number")
320
 
321
 
321
 	url := c.GetString("url")
322
 	url := c.GetString("url")
322
 	ak := c.GetString("ak")
323
 	ak := c.GetString("ak")
323
 
324
 
324
-	result, request_log := service.Jsyb2206(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, 0, 0, 0, 0, certificates, url, ak)
325
+	result, request_log := service.Jsyb2206(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, 0, 0, 0, 0, certificates, url, ak, verify_number)
325
 	fmt.Println(request_log)
326
 	fmt.Println(request_log)
326
 
327
 
327
 	var dat map[string]interface{}
328
 	var dat map[string]interface{}
368
 
369
 
369
 	url := c.GetString("url")
370
 	url := c.GetString("url")
370
 	ak := c.GetString("ak")
371
 	ak := c.GetString("ak")
372
+	verify_number := c.GetString("verify_number")
371
 
373
 
372
-	result, request_log := service.Jsyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, fulamt_ownpay_amt, overlmt_selfpay, preselfpay_amt, inscp_scp_amt, certificates, acct_used_flag, url, ak)
374
+	result, request_log := service.Jsyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, fulamt_ownpay_amt, overlmt_selfpay, preselfpay_amt, inscp_scp_amt, certificates, acct_used_flag, url, ak, verify_number)
373
 	var dat map[string]interface{}
375
 	var dat map[string]interface{}
374
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
376
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
375
 		fmt.Println(dat)
377
 		fmt.Println(dat)

+ 46 - 4
controllers/sg/his_api_controller.go Vedi File

3008
 		var idetinfoStr string
3008
 		var idetinfoStr string
3009
 		var infocode int64
3009
 		var infocode int64
3010
 		var verify_number string
3010
 		var verify_number string
3011
-
3011
+		fmt.Println(verify_number)
3012
 		if miConfig.MdtrtareaAdmvs == "421300" {
3012
 		if miConfig.MdtrtareaAdmvs == "421300" {
3013
 			psn_info, _ := service.GetPsnByPatientId(id)
3013
 			psn_info, _ := service.GetPsnByPatientId(id)
3014
 			PsnNo = psn_info.PsnNo
3014
 			PsnNo = psn_info.PsnNo
3226
 			} else if miConfig.MdtrtareaAdmvs == "320921" {
3226
 			} else if miConfig.MdtrtareaAdmvs == "320921" {
3227
 				api := "http://192.168.3.111:9532/" + "jsyb/2201?psn_no=" + PsnNo + "&insutype=" + insutype + "&cert_no=" + Certno + "&ipt_otp_no=" + ipt_otp_no +
3227
 				api := "http://192.168.3.111:9532/" + "jsyb/2201?psn_no=" + PsnNo + "&insutype=" + insutype + "&cert_no=" + Certno + "&ipt_otp_no=" + ipt_otp_no +
3228
 					"&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
3228
 					"&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
3229
-					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&dept_code=" + department.Number + "&dept=" + department.Name + "&doctor_id=" + doctor_id + "&url=" + miConfig.Url + "&ak=" + miConfig.ChannelNumber + "&verify_number" + verify_number
3229
+					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&dept_code=" + department.Number + "&dept=" + department.Name + "&doctor_id=" + doctor_id + "&url=" + miConfig.Url + "&ak=" + miConfig.ChannelNumber + "&verify_number=" + verify_number
3230
 				resp, requestErr := http.Get(api)
3230
 				resp, requestErr := http.Get(api)
3231
 				if requestErr != nil {
3231
 				if requestErr != nil {
3232
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3232
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4114
 							}
4114
 							}
4115
 
4115
 
4116
 						} else if miConfig.MdtrtareaAdmvs == "320921" {
4116
 						} else if miConfig.MdtrtareaAdmvs == "320921" {
4117
+							psn_info, _ := service.GetPsnByPatientId(his.PatientId)
4118
+
4117
 							api := "http://192.168.3.111:9532/" + "jsyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
4119
 							api := "http://192.168.3.111:9532/" + "jsyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
4118
 								his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
4120
 								his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
4119
 								"&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
4121
 								"&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
4120
 								"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
4122
 								"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
4121
 								"&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
4123
 								"&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
4122
 								"&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
4124
 								"&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
4123
-								"&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&acct_used_flag=" + acct_used_flag + "&url=" + miConfig.Url + "&ak=" + miConfig.ChannelNumber
4125
+								"&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&acct_used_flag=" + acct_used_flag + "&url=" + miConfig.Url + "&ak=" + miConfig.ChannelNumber + "&verify_number=" + psn_info.VerifyNumber
4124
 
4126
 
4125
 							resp, requestErr := http.Get(api)
4127
 							resp, requestErr := http.Get(api)
4126
 							if requestErr != nil {
4128
 							if requestErr != nil {
4463
 				}
4465
 				}
4464
 
4466
 
4465
 			} else if miConfig.MdtrtareaAdmvs == "320921" {
4467
 			} else if miConfig.MdtrtareaAdmvs == "320921" {
4468
+				psn_info, _ := service.GetPsnByPatientId(his.PatientId)
4469
+
4466
 				api := "http://192.168.3.111:9532/" + "jsyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
4470
 				api := "http://192.168.3.111:9532/" + "jsyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
4467
 					his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
4471
 					his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
4468
 					"&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
4472
 					"&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
4469
 					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
4473
 					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
4470
 					"&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
4474
 					"&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
4471
 					"&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
4475
 					"&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
4472
-					"&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&acct_used_flag=" + acct_used_flag + "&url=" + miConfig.Url + "&ak=" + miConfig.ChannelNumber
4476
+					"&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&acct_used_flag=" + acct_used_flag + "&url=" + miConfig.Url + "&ak=" + miConfig.ChannelNumber + "&verify_number=" + psn_info.VerifyNumber
4473
 
4477
 
4474
 				resp, requestErr := http.Get(api)
4478
 				resp, requestErr := http.Get(api)
4475
 				if requestErr != nil {
4479
 				if requestErr != nil {
5813
 							return
5817
 							return
5814
 						}
5818
 						}
5815
 
5819
 
5820
+					} else if miConfig.MdtrtareaAdmvs == "320921" {
5821
+						psn_info, _ := service.GetPsnByPatientId(his.PatientId)
5822
+						api := "http://192.168.3.111:9532/" + "jsyb/2206?psn_no=" + his.PsnNo + "&mdtrt_id=" +
5823
+							his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
5824
+							"&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
5825
+							"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
5826
+							"&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
5827
+							"&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
5828
+							"&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&verify_number=" + psn_info.VerifyNumber
5829
+						resp, requestErr := http.Get(api)
5830
+						if requestErr != nil {
5831
+							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5832
+							return
5833
+						}
5834
+
5835
+						body, ioErr := ioutil.ReadAll(resp.Body)
5836
+						if ioErr != nil {
5837
+							utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
5838
+							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5839
+							return
5840
+						}
5841
+						var respJSON map[string]interface{}
5842
+						if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
5843
+							utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
5844
+							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5845
+							return
5846
+						}
5847
+
5848
+						respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
5849
+						result, _ := json.Marshal(respJSON)
5850
+						fmt.Println("log")
5851
+						fmt.Println(string(result))
5852
+						if err := json.Unmarshal([]byte(result), &res); err != nil {
5853
+							utils.ErrorLog("解析失败:%v", err)
5854
+							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5855
+							return
5856
+						}
5857
+
5816
 					} else {
5858
 					} else {
5817
 
5859
 
5818
 						var result string
5860
 						var result string

+ 14 - 14
service/jsyb_service.go Vedi File

504
 }
504
 }
505
 
505
 
506
 //  门诊预结算
506
 //  门诊预结算
507
-func Jsyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, request_url string, access_key string) (string, string) {
507
+func Jsyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, request_url string, access_key string, verify_number string) (string, string) {
508
 
508
 
509
 	// 生成签名
509
 	// 生成签名
510
 	timestamp := time.Now().Unix()
510
 	timestamp := time.Now().Unix()
515
 	inputMessage["infno"] = "2206" // 交易编码
515
 	inputMessage["infno"] = "2206" // 交易编码
516
 	inputData["psn_no"] = psnNo    // 人员编号 (来自1101接口返回)
516
 	inputData["psn_no"] = psnNo    // 人员编号 (来自1101接口返回)
517
 	if certificates == 3 {
517
 	if certificates == 3 {
518
-		inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
519
-		inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
518
+		inputData["mdtrt_cert_type"] = "99"                       // 就诊凭证类型
519
+		inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
520
 	} else {
520
 	} else {
521
 		if id_card_type == 1 {
521
 		if id_card_type == 1 {
522
-			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
523
-			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
522
+			inputData["mdtrt_cert_type"] = "03"                       // 就诊凭证类型
523
+			inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
524
 		} else {
524
 		} else {
525
-			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
526
-			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
525
+			inputData["mdtrt_cert_type"] = "02"                       // 就诊凭证类型
526
+			inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
527
 		}
527
 		}
528
 	}
528
 	}
529
 	if insuplc_admdvs == "421300" {
529
 	if insuplc_admdvs == "421300" {
563
 }
563
 }
564
 
564
 
565
 //  门诊结算
565
 //  门诊结算
566
-func Jsyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, acct_used_flag string, request_url string, access_key string) (string, string) {
566
+func Jsyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, acct_used_flag string, request_url string, access_key string, verify_number string) (string, string) {
567
 	// 生成签名
567
 	// 生成签名
568
 	timestamp := time.Now().Unix()
568
 	timestamp := time.Now().Unix()
569
 
569
 
574
 	inputMessage["infno"] = "2207" // 交易编码
574
 	inputMessage["infno"] = "2207" // 交易编码
575
 	inputData["psn_no"] = psnNo    // 人员编号 (来自1101接口返回)
575
 	inputData["psn_no"] = psnNo    // 人员编号 (来自1101接口返回)
576
 	if certificates == 3 {
576
 	if certificates == 3 {
577
-		inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
578
-		inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
577
+		inputData["mdtrt_cert_type"] = "99"                       // 就诊凭证类型
578
+		inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
579
 	} else {
579
 	} else {
580
 		if id_card_type == 1 {
580
 		if id_card_type == 1 {
581
-			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
582
-			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
581
+			inputData["mdtrt_cert_type"] = "03"                       // 就诊凭证类型
582
+			inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
583
 		} else {
583
 		} else {
584
-			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
585
-			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
584
+			inputData["mdtrt_cert_type"] = "02"                       // 就诊凭证类型
585
+			inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
586
 		}
586
 		}
587
 	}
587
 	}
588
 	if med_type == "1111" || med_type == "1112" {
588
 	if med_type == "1111" || med_type == "1112" {