Procházet zdrojové kódy

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

csx před 3 roky
rodič
revize
99b16e0f41

+ 4 - 2
controllers/js/jsyb_controller.go Zobrazit soubor

@@ -317,11 +317,12 @@ func (c *JSybController) PostSeven() {
317 317
 	med_type := c.GetString("med_type")
318 318
 	id_card_type, _ := c.GetInt64("id_card_type")
319 319
 	certificates, _ := c.GetInt64("certificates")
320
+	verify_number := c.GetString("verify_number")
320 321
 
321 322
 	url := c.GetString("url")
322 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 326
 	fmt.Println(request_log)
326 327
 
327 328
 	var dat map[string]interface{}
@@ -368,8 +369,9 @@ func (c *JSybController) PostEight() {
368 369
 
369 370
 	url := c.GetString("url")
370 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 375
 	var dat map[string]interface{}
374 376
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
375 377
 		fmt.Println(dat)

+ 46 - 4
controllers/sg/his_api_controller.go Zobrazit soubor

@@ -3008,7 +3008,7 @@ func (c *HisApiController) GetRegisterInfo() {
3008 3008
 		var idetinfoStr string
3009 3009
 		var infocode int64
3010 3010
 		var verify_number string
3011
-
3011
+		fmt.Println(verify_number)
3012 3012
 		if miConfig.MdtrtareaAdmvs == "421300" {
3013 3013
 			psn_info, _ := service.GetPsnByPatientId(id)
3014 3014
 			PsnNo = psn_info.PsnNo
@@ -3226,7 +3226,7 @@ func (c *HisApiController) GetRegisterInfo() {
3226 3226
 			} else if miConfig.MdtrtareaAdmvs == "320921" {
3227 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 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 3230
 				resp, requestErr := http.Get(api)
3231 3231
 				if requestErr != nil {
3232 3232
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -4114,13 +4114,15 @@ func (c *HisApiController) GetUploadInfo() {
4114 4114
 							}
4115 4115
 
4116 4116
 						} else if miConfig.MdtrtareaAdmvs == "320921" {
4117
+							psn_info, _ := service.GetPsnByPatientId(his.PatientId)
4118
+
4117 4119
 							api := "http://192.168.3.111:9532/" + "jsyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
4118 4120
 								his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
4119 4121
 								"&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
4120 4122
 								"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
4121 4123
 								"&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
4122 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 4127
 							resp, requestErr := http.Get(api)
4126 4128
 							if requestErr != nil {
@@ -4463,13 +4465,15 @@ func (c *HisApiController) GetUploadInfo() {
4463 4465
 				}
4464 4466
 
4465 4467
 			} else if miConfig.MdtrtareaAdmvs == "320921" {
4468
+				psn_info, _ := service.GetPsnByPatientId(his.PatientId)
4469
+
4466 4470
 				api := "http://192.168.3.111:9532/" + "jsyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
4467 4471
 					his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
4468 4472
 					"&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
4469 4473
 					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
4470 4474
 					"&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
4471 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 4478
 				resp, requestErr := http.Get(api)
4475 4479
 				if requestErr != nil {
@@ -5813,6 +5817,44 @@ func (c *HisApiController) GetPreUploadInfo() {
5813 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 5858
 					} else {
5817 5859
 
5818 5860
 						var result string

+ 14 - 14
service/jsyb_service.go Zobrazit soubor

@@ -504,7 +504,7 @@ func Jsyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, d
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 510
 	timestamp := time.Now().Unix()
@@ -515,15 +515,15 @@ func Jsyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
515 515
 	inputMessage["infno"] = "2206" // 交易编码
516 516
 	inputData["psn_no"] = psnNo    // 人员编号 (来自1101接口返回)
517 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 520
 	} else {
521 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 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 529
 	if insuplc_admdvs == "421300" {
@@ -563,7 +563,7 @@ func Jsyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
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 568
 	timestamp := time.Now().Unix()
569 569
 
@@ -574,15 +574,15 @@ func Jsyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
574 574
 	inputMessage["infno"] = "2207" // 交易编码
575 575
 	inputData["psn_no"] = psnNo    // 人员编号 (来自1101接口返回)
576 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 579
 	} else {
580 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 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 588
 	if med_type == "1111" || med_type == "1112" {