瀏覽代碼

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

csx 1 年之前
父節點
當前提交
71ce5a29b8
共有 3 個文件被更改,包括 270 次插入240 次删除
  1. 1 1
      conf/app.conf
  2. 267 236
      controllers/sg/his_api_controller.go
  3. 2 3
      service/fj_service.go

+ 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 = 10191
49 49
 mobile_token_expiration_second = 86400
50 50
 httpdomain = https://api.xt.kuyicloud.com
51 51
 sso_domain = https://sso.kuyicloud.com

+ 267 - 236
controllers/sg/his_api_controller.go 查看文件

@@ -49,11 +49,12 @@ func HisManagerApiRegistRouters() {
49 49
 	beego.Router("/api/refundnumber/post", &HisApiController{}, "get:RefundNumber")
50 50
 	//退明细
51 51
 	beego.Router("/api/refunddetail/post", &HisApiController{}, "get:RefundDetail")
52
+	//上传就诊信息-上传明细-预结算
53
+	beego.Router("/api/presettle/get", &HisApiController{}, "get:GetPreUploadInfo")
52 54
 
53 55
 	beego.Router("/api/treatment/check", &HisApiController{}, "get:CheckTreatment")
54 56
 	beego.Router("/api/org/info", &HisApiController{}, "get:GetOrgInfo")
55 57
 	beego.Router("/api/readcard", &HisApiController{}, "get:ReadCard")
56
-	beego.Router("/api/presettle/get", &HisApiController{}, "get:GetPreUploadInfo")
57 58
 	beego.Router("/api/310", &HisApiController{}, "get:Check310")
58 59
 	beego.Router("/api/390", &HisApiController{}, "get:Check390")
59 60
 	beego.Router("/api/patient/info", &HisApiController{}, "get:GetPatientInfo")
@@ -72,11 +73,7 @@ func HisManagerApiRegistRouters() {
72 73
 	beego.Router("/api/insutype/check", &HisApiController{}, "get:CheckInsutype")
73 74
 	beego.Router("/api/batchsettlelist/get", &HisApiController{}, "get:GetBatchSettleList")
74 75
 	beego.Router("/api/psn/info", &HisApiController{}, "get:GetPsnNcdsInfo")
75
-
76
-	//beego.Router("/api/allopatry/get", &HisApiController{}, "get:GetAllopatry")
77
-	//beego.Router("/api/comfirmallopatry/post", &HisApiController{}, "post:ComfirmAllopatry")
78 76
 	beego.Router("/api/allopatry/refund", &HisApiController{}, "post:RefundAllopatry")
79
-
80 77
 	beego.Router("/api/check", &HisApiController{}, "get:Check")
81 78
 	beego.Router("/api/check3101", &HisApiController{}, "get:Check3101")
82 79
 	beego.Router("/api/check3102", &HisApiController{}, "get:Check3102")
@@ -1896,6 +1893,8 @@ func (c *HisApiController) ReadCard() {
1896 1893
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
1897 1894
 				return
1898 1895
 			}
1896
+		} else if miConfig.MdtrtareaAdmvs == "440300" || miConfig.MdtrtareaAdmvs == "440305" {
1897
+
1899 1898
 		}
1900 1899
 		break
1901 1900
 	}
@@ -1995,10 +1994,8 @@ type CustomFundPay struct {
1995 1994
 }
1996 1995
 
1997 1996
 func (c *HisApiController) GetSettleList() {
1998
-
1999 1997
 	order_id, _ := c.GetInt64("order_id")
2000 1998
 	admin_user_id, _ := c.GetInt64("admin_user_id")
2001
-
2002 1999
 	order, _ := service.GetHisOrderByIDTwo(order_id)
2003 2000
 	roles, _ := service.GetDoctorListTwo(c.GetAdminUserInfo().CurrentOrgId)
2004 2001
 	his, _ := service.GetHisPatientByNumber(order.MdtrtId)
@@ -5761,7 +5758,19 @@ func (c *HisApiController) GetUploadInfo() {
5761 5758
 
5762 5759
 		} else if miConfig.MdtrtareaAdmvs == "350500" {
5763 5760
 			result, requestLog = service.FJyb2203(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, strconv.FormatInt(reg_type, 10), doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config, begin_time, doctor_info.UserName, roles.UserName, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey)
5764
-
5761
+			saveLog(result, requestLog, "2203", "上传就诊信息")
5762
+			var respJSON2 map[string]interface{}
5763
+			if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
5764
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
5765
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5766
+				return
5767
+			}
5768
+			userJSONBytes2, _ := json.Marshal(respJSON2)
5769
+			if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
5770
+				utils.ErrorLog("解析失败:%v", err)
5771
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5772
+				return
5773
+			}
5765 5774
 		} else {
5766 5775
 			if miConfig.MdtrtareaAdmvs == "440781" { //
5767 5776
 				result, requestLog = service.Gdyb2203A(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, strconv.FormatInt(reg_type, 10), doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config, begin_time)
@@ -6000,7 +6009,29 @@ func (c *HisApiController) GetUploadInfo() {
6000 6009
 
6001 6010
 				} else if miConfig.MdtrtareaAdmvs == "350500" {
6002 6011
 
6003
-					//result, request_log := service.FJyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, strconv.FormatInt(patientPrescription.Departments, 10), miConfig.Code, department.Number, strconv.FormatInt(roles.AdminUserId, 10), his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(his.BalanceAccountsType, 10), patientPrescription.DoctorId, sickConfig.CountryCode)
6012
+					result, request_log := service.FJyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, strconv.FormatInt(patientPrescription.Departments, 10), miConfig.Code, department.Number, strconv.FormatInt(roles.AdminUserId, 10), his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(his.BalanceAccountsType, 10), roles.UserName, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey)
6013
+					var dat map[string]interface{}
6014
+					if err := json.Unmarshal([]byte(result), &dat); err == nil {
6015
+						fmt.Println(dat)
6016
+					} else {
6017
+						fmt.Println(err)
6018
+					}
6019
+					saveLog(result, request_log, "2204", "上传费用明细")
6020
+					userJSONBytes, _ := json.Marshal(dat)
6021
+
6022
+					if err := json.Unmarshal(userJSONBytes, &resFour10265); err != nil {
6023
+						utils.ErrorLog("解析失败:%v", err)
6024
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
6025
+						return
6026
+					}
6027
+
6028
+					res.InfRefmsgid = resFour10265.InfRefmsgid
6029
+					res.Output = resFour10265.Output
6030
+					res.ErrMsg = resFour10265.ErrMsg
6031
+					res.Cainfo = resFour10265.Cainfo
6032
+					res.WarnMsg = resFour10265.WarnMsg
6033
+					infocode, _ := strconv.ParseInt(resFour10265.Infcode, 10, 64)
6034
+					res.Infcode = infocode
6004 6035
 
6005 6036
 				} else {
6006 6037
 
@@ -6382,6 +6413,33 @@ func (c *HisApiController) GetUploadInfo() {
6382 6413
 							infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
6383 6414
 							res.Infcode = infocode
6384 6415
 
6416
+						} else if miConfig.MdtrtareaAdmvs == "350500" {
6417
+
6418
+							result2, src_resquest = service.FJyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, tempOrder.FulamtOwnpayAmt, tempOrder.OverlmtSelfPay, tempOrder.PreselfpayAmt, tempOrder.InscpScpAmt, his.IdType, acct_used_flag, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey)
6419
+
6420
+							//result2, src_resquest = service.Gdyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, acct_used_flag)
6421
+							var dat map[string]interface{}
6422
+							if err := json.Unmarshal([]byte(result2), &dat); err == nil {
6423
+								fmt.Println(dat)
6424
+							} else {
6425
+								fmt.Println(err)
6426
+							}
6427
+							saveLog(result2, src_resquest, "2207", "结算")
6428
+							userJSONBytes, _ := json.Marshal(dat)
6429
+							if err := json.Unmarshal(userJSONBytes, &resSeven10265); err != nil {
6430
+								utils.ErrorLog("解析失败:%v", err)
6431
+								c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
6432
+								return
6433
+							}
6434
+
6435
+							res.InfRefmsgid = resSeven10265.InfRefmsgid
6436
+							res.Output = resSeven10265.Output
6437
+							res.ErrMsg = resSeven10265.ErrMsg
6438
+							res.Cainfo = resSeven10265.Cainfo
6439
+							res.WarnMsg = resSeven10265.WarnMsg
6440
+							infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
6441
+							res.Infcode = infocode
6442
+
6385 6443
 						} else {
6386 6444
 							if miConfig.Code == "H15049901371" {
6387 6445
 								//赤峰地区国家医保医疗类别
@@ -6794,6 +6852,21 @@ func (c *HisApiController) GetUploadInfo() {
6794 6852
 				infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
6795 6853
 				res.Infcode = infocode
6796 6854
 
6855
+			} else if miConfig.MdtrtareaAdmvs == "350500" {
6856
+				result2, src_resquest = service.FJyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, tempOrder.FulamtOwnpayAmt, tempOrder.OverlmtSelfPay, tempOrder.PreselfpayAmt, tempOrder.InscpScpAmt, his.IdType, acct_used_flag, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey)
6857
+				var dat map[string]interface{}
6858
+				if err := json.Unmarshal([]byte(result2), &dat); err == nil {
6859
+					fmt.Println(dat)
6860
+				} else {
6861
+					fmt.Println(err)
6862
+				}
6863
+				saveLog(result2, src_resquest, "2207", "结算")
6864
+				userJSONBytes, _ := json.Marshal(dat)
6865
+				if err := json.Unmarshal(userJSONBytes, &res); err != nil {
6866
+					utils.ErrorLog("解析失败:%v", err)
6867
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
6868
+					return
6869
+				}
6797 6870
 			} else {
6798 6871
 
6799 6872
 				var src_resquest string
@@ -7601,24 +7674,6 @@ func (c *HisApiController) GetPreUploadInfo() {
7601 7674
 		}
7602 7675
 
7603 7676
 	} else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
7604
-		//江苏地区国家医保医疗类别
7605
-		//职工透析:医疗类别选特殊情况门诊9933
7606
-		//居民血透门慢: 医疗类别选门诊慢病1402
7607
-		//var med_type string
7608
-		//if his.Insutype == "310" {
7609
-		//	if reg_type == 14 {
7610
-		//		med_type = "9933"
7611
-		//	} else if reg_type == 11 {
7612
-		//		med_type = "11"
7613
-		//
7614
-		//	}
7615
-		//} else if his.Insutype == "390" {
7616
-		//	if reg_type == 14 {
7617
-		//		med_type = "1402"
7618
-		//	} else if reg_type == 11 {
7619
-		//		med_type = "11"
7620
-		//	}
7621
-		//}
7622 7677
 
7623 7678
 		data := make(map[string]interface{})
7624 7679
 		client := &http.Client{}
@@ -7693,6 +7748,22 @@ func (c *HisApiController) GetPreUploadInfo() {
7693 7748
 		infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
7694 7749
 		res2.Infcode = infocode
7695 7750
 
7751
+	} else if miConfig.MdtrtareaAdmvs == "350500" {
7752
+		result, requestLog := service.FJyb2203(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, strconv.FormatInt(reg_type, 10), doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config, begin_time, doctor_info.UserName, roles.UserName, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey)
7753
+		saveLog(result, requestLog, "2203", "上传就诊信息")
7754
+		var respJSON2 map[string]interface{}
7755
+		if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
7756
+			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
7757
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
7758
+			return
7759
+		}
7760
+		userJSONBytes2, _ := json.Marshal(respJSON2)
7761
+		if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
7762
+			utils.ErrorLog("解析失败:%v", err)
7763
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
7764
+			return
7765
+		}
7766
+
7696 7767
 	} else {
7697 7768
 		var result string
7698 7769
 		var requestLog string
@@ -7918,6 +7989,23 @@ func (c *HisApiController) GetPreUploadInfo() {
7918 7989
 				infocode, _ := strconv.ParseInt(resFour10265.Infcode, 10, 64)
7919 7990
 				res.Infcode = infocode
7920 7991
 
7992
+			} else if miConfig.MdtrtareaAdmvs == "350500" {
7993
+
7994
+				result, request_log := service.FJyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, strconv.FormatInt(patientPrescription.Departments, 10), miConfig.Code, department.Number, strconv.FormatInt(roles.AdminUserId, 10), his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(his.BalanceAccountsType, 10), roles.UserName, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey)
7995
+				var dat map[string]interface{}
7996
+				if err := json.Unmarshal([]byte(result), &dat); err == nil {
7997
+					fmt.Println(dat)
7998
+				} else {
7999
+					fmt.Println(err)
8000
+				}
8001
+				saveLog(result, request_log, "2204", "上传费用明细")
8002
+				userJSONBytes, _ := json.Marshal(dat)
8003
+				if err := json.Unmarshal(userJSONBytes, &res); err != nil {
8004
+					utils.ErrorLog("解析失败:%v", err)
8005
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8006
+					return
8007
+				}
8008
+
7921 8009
 			} else {
7922 8010
 
7923 8011
 				if miConfig.Code == "H15049901371" {
@@ -8272,6 +8360,22 @@ func (c *HisApiController) GetPreUploadInfo() {
8272 8360
 						infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
8273 8361
 						res.Infcode = infocode
8274 8362
 
8363
+					} else if miConfig.MdtrtareaAdmvs == "350500" {
8364
+
8365
+						result, request_log := service.FJyb2206(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey)
8366
+						var dat map[string]interface{}
8367
+						if err := json.Unmarshal([]byte(result), &dat); err == nil {
8368
+							fmt.Println(dat)
8369
+						} else {
8370
+							fmt.Println(err)
8371
+						}
8372
+						saveLog(result, request_log, "2206", "预结算")
8373
+						userJSONBytes, _ := json.Marshal(dat)
8374
+						if err := json.Unmarshal(userJSONBytes, &res); err != nil {
8375
+							utils.ErrorLog("解析失败:%v", err)
8376
+							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8377
+							return
8378
+						}
8275 8379
 					} else {
8276 8380
 
8277 8381
 						var result string
@@ -8466,212 +8570,6 @@ func (c *HisApiController) GetPreUploadInfo() {
8466 8570
 	}
8467 8571
 }
8468 8572
 
8469
-//func (c *HisApiController) GetSettleInfo() {
8470
-//	id, _ := c.GetInt64("id")
8471
-//	order_id, _ := c.GetInt64("order_id")
8472
-//
8473
-//	record_time := c.GetString("record_time")
8474
-//	pay_way, _ := c.GetInt64("pay_way")
8475
-//	pay_price, _ := c.GetFloat("pay_price")
8476
-//	pay_card_no := c.GetString("pay_card_no")
8477
-//	discount_price, _ := c.GetFloat("discount_price")
8478
-//	preferential_price, _ := c.GetFloat("preferential_price")
8479
-//	reality_price, _ := c.GetFloat("reality_price")
8480
-//	found_price, _ := c.GetFloat("found_price")
8481
-//	medical_insurance_price, _ := c.GetFloat("medical_insurance_price")
8482
-//	private_price, _ := c.GetFloat("private_price")
8483
-//	settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
8484
-//	admin_user_id, _ := c.GetInt64("admin_user_id")
8485
-//
8486
-//	timeLayout := "2006-01-02"
8487
-//	loc, _ := time.LoadLocation("Local")
8488
-//	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
8489
-//	if err != nil {
8490
-//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8491
-//		return
8492
-//	}
8493
-//	recordDateTime := theTime.Unix()
8494
-//	adminUser := c.GetAdminUserInfo()
8495
-//
8496
-//	var prescriptions []*models.HisPrescription
8497
-//
8498
-//	data := make(map[string]interface{})
8499
-//	if settle_accounts_type == 1 { //日结
8500
-//		prescriptions, _ = service.GetHisPrescription(adminUser.CurrentOrgId, id, recordDateTime)
8501
-//		data["pre"] = prescriptions
8502
-//
8503
-//	} else { //月结
8504
-//		start_time_str := c.GetString("start_time")
8505
-//		end_time_str := c.GetString("end_time")
8506
-//		timeLayout := "2006-01-02"
8507
-//		loc, _ := time.LoadLocation("Local")
8508
-//		theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
8509
-//		if err != nil {
8510
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8511
-//			return
8512
-//		}
8513
-//		recordStartTime := theStartTime.Unix()
8514
-//		theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
8515
-//		if err != nil {
8516
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8517
-//			return
8518
-//		}
8519
-//		recordEndTime := theEndTime.Unix()
8520
-//		prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime)
8521
-//		data["pre"] = prescriptions
8522
-//
8523
-//	}
8524
-//
8525
-//	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
8526
-//
8527
-//	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
8528
-//	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
8529
-//	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
8530
-//	strconv.FormatInt(his.PatientId, 10)
8531
-//
8532
-//	order_src, _ := service.GetHisOrderByID(order_id)
8533
-//
8534
-//	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
8535
-//	if config.IsOpen == 1 { //对接了医保,走医保流程
8536
-//
8537
-//		var total float64
8538
-//		for _, item := range prescriptions {
8539
-//			if item.Type == 1 { //药品
8540
-//				for _, subItem := range item.HisDoctorAdviceInfo {
8541
-//					total = total + (subItem.Price * subItem.PrescribingNumber)
8542
-//				}
8543
-//			}
8544
-//			if item.Type == 2 { //项目
8545
-//				for _, subItem := range item.HisPrescriptionProject {
8546
-//					total = total + (subItem.Price * float64(subItem.Count))
8547
-//				}
8548
-//			}
8549
-//		}
8550
-//
8551
-//		for _, item := range prescriptions {
8552
-//			for _, subItem := range item.HisAdditionalCharge {
8553
-//				total = total + (subItem.Price * float64(subItem.Count))
8554
-//			}
8555
-//		}
8556
-//
8557
-//		allTotal := fmt.Sprintf("%.2f", total)
8558
-//		var rf []*ResultFive
8559
-//		json.Unmarshal([]byte(his.Iinfo), &rf)
8560
-//		psn_no := order_src.PsnNo
8561
-//		mdtrt_id := order_src.MdtrtId
8562
-//		chrg_bchno := order_src.Number
8563
-//		cert_no := order_src.Certno
8564
-//		insutype := rf[0].Insutype
8565
-//
8566
-//		if his.IdCardType == 1 {
8567
-//			cert_no = his.MedicalInsuranceNumber
8568
-//		} else {
8569
-//			cert_no = his.Certno
8570
-//		}
8571
-//
8572
-//		result, src_resquest := service.Gdyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, strconv.FormatFloat(total, 'E', -1, 64) ,miConfig.OrgName,roles.UserName,miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(patientPrescription.RegisterType, 10),his.IdCardType, order_src.FulamtOwnpayAmt,order_src.OverlmtSelfPay,order_src.PreselfpayAmt,order_src.InscpScpAmt)
8573
-//		var dat map[string]interface{}
8574
-//		if err := json.Unmarshal([]byte(result), &dat); err == nil {
8575
-//			fmt.Println(dat)
8576
-//		} else {
8577
-//			fmt.Println(err)
8578
-//		}
8579
-//
8580
-//		userJSONBytes, _ := json.Marshal(dat)
8581
-//
8582
-//
8583
-//
8584
-//		var res ResultSeven
8585
-//		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
8586
-//			utils.ErrorLog("解析失败:%v", err)
8587
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8588
-//			return
8589
-//		}
8590
-//		if res.Infcode == -1 {
8591
-//			errlog := &models.HisOrderError{
8592
-//				UserOrgId:  adminUser.CurrentOrgId,
8593
-//				Ctime:      time.Now().Unix(),
8594
-//				Mtime:      time.Now().Unix(),
8595
-//				Number:     chrg_bchno,
8596
-//				ErrMsg:     res.ErrMsg,
8597
-//				Status:     1,
8598
-//				PatientId:  id,
8599
-//				RecordTime: recordDateTime,
8600
-//				Stage:      6,
8601
-//			}
8602
-//			service.CreateErrMsgLog(errlog)
8603
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
8604
-//			return
8605
-//		} else {
8606
-//			order_src.OrderStatus = 2
8607
-//			order_src.PayWay = pay_way
8608
-//			order_src.PayPrice = pay_price
8609
-//			order_src.PayCardNo = pay_card_no
8610
-//			order_src.DiscountPrice = discount_price
8611
-//			order_src.PreferentialPrice = preferential_price
8612
-//			order_src.RealityPrice = reality_price
8613
-//			order_src.FoundPrice = found_price
8614
-//			order_src.MedicalInsurancePrice = medical_insurance_price
8615
-//			order_src.PrivatePrice = private_price
8616
-//			order_src.MdtrtId = res.Output.Setlinfo.MdtrtID
8617
-//			order_src.SetlId = res.Output.Setlinfo.SetlID
8618
-//			order_src.PsnNo = res.Output.Setlinfo.PsnNo
8619
-//			order_src.PsnName = res.Output.Setlinfo.PsnName
8620
-//			order_src.PsnCertType = res.Output.Setlinfo.PsnCertType
8621
-//			order_src.Certno = res.Output.Setlinfo.Certno
8622
-//			order_src.Gend = res.Output.Setlinfo.Gend
8623
-//			order_src.Naty = res.Output.Setlinfo.Naty
8624
-//			order_src.Age = res.Output.Setlinfo.Age
8625
-//			order_src.Insutype = res.Output.Setlinfo.Insutype
8626
-//			order_src.PsnType = res.Output.Setlinfo.PsnType
8627
-//			order_src.CvlservFlag = res.Output.Setlinfo.CvlservFlag
8628
-//			order_src.SetlTime = res.Output.Setlinfo.SetlTime
8629
-//			order_src.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
8630
-//			order_src.MedType = res.Output.Setlinfo.MedType
8631
-//			order_src.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
8632
-//			order_src.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
8633
-//			order_src.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
8634
-//			order_src.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
8635
-//			order_src.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
8636
-//			order_src.ActPayDedc = res.Output.Setlinfo.ActPayDedc
8637
-//			order_src.HifpPay = res.Output.Setlinfo.HifpPay
8638
-//			order_src.CvlservPay = res.Output.Setlinfo.CvlservPay
8639
-//			order_src.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
8640
-//			order_src.HifesPay = res.Output.Setlinfo.HifesPay
8641
-//			order_src.HifobPay = res.Output.Setlinfo.HifobPay
8642
-//			order_src.MafPay = res.Output.Setlinfo.MafPay
8643
-//			order_src.OthPay = res.Output.Setlinfo.OthPay
8644
-//			order_src.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
8645
-//			order_src.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
8646
-//			order_src.AcctPay = res.Output.Setlinfo.AcctPay
8647
-//			order_src.PsnCashPay = res.Output.Setlinfo.PsnCashPay
8648
-//			order_src.HospPartAmt = res.Output.Setlinfo.HospPartAmt
8649
-//			order_src.Balc = res.Output.Setlinfo.Balc
8650
-//			order_src.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
8651
-//			order_src.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
8652
-//			order_src.ClrOptins = res.Output.Setlinfo.ClrOptins
8653
-//			order_src.ClrWay = res.Output.Setlinfo.ClrWay
8654
-//			order_src.Creator = order_src.Creator
8655
-//			order_src.Modify = roles.ID
8656
-//			order_src.RequestLog = src_resquest
8657
-//			setlDetail, _ := json.Marshal(res.Output.Setldetail)
8658
-//			detailStr := string(setlDetail)
8659
-//			order_src.SetlDetail = detailStr
8660
-//			err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
8661
-//			err = service.UpDateOrder(order_src)
8662
-//
8663
-//			if err == nil {
8664
-//				c.ServeSuccessJSON(map[string]interface{}{
8665
-//					"msg": "结算成功",
8666
-//				})
8667
-//			} else {
8668
-//				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
8669
-//				return
8670
-//			}
8671
-//		}
8672
-//	}
8673
-//}
8674
-
8675 8573
 //退款
8676 8574
 func (c *HisApiController) Refund() {
8677 8575
 	order_id, _ := c.GetInt64("order_id")
@@ -8778,6 +8676,24 @@ func (c *HisApiController) Refund() {
8778 8676
 			infocode, _ := strconv.ParseInt(resSixteen10265.Infcode, 10, 64)
8779 8677
 			res.Infcode = infocode
8780 8678
 
8679
+		} else if miConfig.MdtrtareaAdmvs == "350500" {
8680
+			result, src_resquest = service.FJyb2208(order.PsnNo, order.MdtrtId, order.SetlId, miConfig.OrgName, roles.UserName, miConfig.SecretKey, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey)
8681
+			var dat map[string]interface{}
8682
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
8683
+				fmt.Println(dat)
8684
+			} else {
8685
+				fmt.Println(err)
8686
+			}
8687
+			saveLog(result, src_resquest, "2208", "退费")
8688
+
8689
+			userJSONBytes, _ := json.Marshal(dat)
8690
+
8691
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
8692
+				utils.ErrorLog("解析失败:%v", err)
8693
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8694
+				return
8695
+			}
8696
+
8781 8697
 		} else {
8782 8698
 
8783 8699
 			if miConfig.Code == "H15049901371" {
@@ -8915,6 +8831,22 @@ func (c *HisApiController) Refund() {
8915 8831
 				infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
8916 8832
 				res2.Infcode = infocode
8917 8833
 
8834
+			} else if miConfig.MdtrtareaAdmvs == "350500" {
8835
+				result2, src_request := service.FJyb2205(order.PsnNo, order.MdtrtId, order.Number, miConfig.OrgName, roles.UserName, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey)
8836
+				var dat map[string]interface{}
8837
+				if err := json.Unmarshal([]byte(result2), &dat); err == nil {
8838
+					fmt.Println(dat)
8839
+				} else {
8840
+					fmt.Println(err)
8841
+				}
8842
+
8843
+				saveLog(result2, src_request, "2205", "撤销明细")
8844
+				userJSONBytes, _ := json.Marshal(dat)
8845
+				if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
8846
+					utils.ErrorLog("解析失败:%v", err)
8847
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8848
+					return
8849
+				}
8918 8850
 			} else {
8919 8851
 
8920 8852
 				if miConfig.Code == "H15049901371" {
@@ -9116,6 +9048,23 @@ func (c *HisApiController) RefundNumber() {
9116 9048
 			infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
9117 9049
 			res2.Infcode = infocode
9118 9050
 
9051
+		} else if miConfig.MdtrtareaAdmvs == "350500" {
9052
+
9053
+			result, request := service.FJyb2202(his.PsnNo, his.Number, his.IptOtpNo, miConfig.OrgName, roles.UserName, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey)
9054
+			var dat map[string]interface{}
9055
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
9056
+				fmt.Println(dat)
9057
+			} else {
9058
+				fmt.Println(err)
9059
+			}
9060
+			saveLog(result, request, "2202", "退号")
9061
+			userJSONBytes, _ := json.Marshal(dat)
9062
+			if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
9063
+				utils.ErrorLog("解析失败:%v", err)
9064
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9065
+				return
9066
+			}
9067
+
9119 9068
 		} else {
9120 9069
 			var api3 string
9121 9070
 
@@ -9211,7 +9160,7 @@ func (c *HisApiController) RefundNumber() {
9211 9160
 }
9212 9161
 func (c *HisApiController) RefundDetail() {
9213 9162
 	order_id, _ := c.GetInt64("order_id")
9214
-	//admin_user_id, _ := c.GetInt64("admin_user_id")
9163
+	admin_user_id, _ := c.GetInt64("admin_user_id")
9215 9164
 
9216 9165
 	//his_patient_id, _ := c.GetInt64("his_patient_id")
9217 9166
 
@@ -9223,7 +9172,7 @@ func (c *HisApiController) RefundDetail() {
9223 9172
 	timeLayout := "2006-01-02"
9224 9173
 	loc, _ := time.LoadLocation("Local")
9225 9174
 	adminUser := c.GetAdminUserInfo()
9226
-	//roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
9175
+	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
9227 9176
 	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
9228 9177
 	fmt.Println(err)
9229 9178
 	if err != nil {
@@ -9350,9 +9299,43 @@ func (c *HisApiController) RefundDetail() {
9350 9299
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9351 9300
 				return
9352 9301
 			}
9302
+		} else if miConfig.MdtrtareaAdmvs == "350500" {
9303
+			result2, src_request := service.FJyb2205(his.PsnNo, his.Number, order.Number, miConfig.OrgName, roles.UserName, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey)
9304
+			var dat map[string]interface{}
9305
+			if err := json.Unmarshal([]byte(result2), &dat); err == nil {
9306
+				fmt.Println(dat)
9307
+			} else {
9308
+				fmt.Println(err)
9309
+			}
9310
+
9311
+			saveLog(result2, src_request, "2205", "撤销明细")
9312
+			userJSONBytes, _ := json.Marshal(dat)
9313
+			if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
9314
+				utils.ErrorLog("解析失败:%v", err)
9315
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9316
+				return
9317
+			}
9318
+			if res2.Infcode == 0 {
9319
+				err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId, "", "")
9320
+				if err == nil {
9321
+					c.ServeSuccessJSON(map[string]interface{}{
9322
+						"msg": "撤销明细成功",
9323
+					})
9324
+					return
9325
+				} else {
9326
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9327
+					return
9328
+				}
9329
+			} else {
9330
+				c.ServeSuccessJSON(map[string]interface{}{
9331
+					"code": -10,
9332
+					"msg":  res2.ErrMsg,
9333
+				})
9334
+			}
9335
+
9353 9336
 		} else {
9354 9337
 			api2 := "http://127.0.0.1:9532/" + "gdyb/six?psn_no=" + his.PsnNo +
9355
-				"&mdtrt_id=" + his.Number + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
9338
+				"&mdtrt_id=" + his.Number + "&chrg_bchno=" + order.Number + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
9356 9339
 				"&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
9357 9340
 			resp2, requestErr2 := http.Get(api2)
9358 9341
 			if requestErr2 != nil {
@@ -10224,6 +10207,20 @@ func (c *HisApiController) GetSettleAccounts() {
10224 10207
 			infocode, _ := strconv.ParseInt(resEleven10265.Infcode, 10, 64)
10225 10208
 			res.Infcode = infocode
10226 10209
 
10210
+		} else if miConfig.MdtrtareaAdmvs == "350500" {
10211
+			result := service.FJyb5203(baseParams, businessParams, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey)
10212
+			var dat map[string]interface{}
10213
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
10214
+				fmt.Println(dat)
10215
+			} else {
10216
+				fmt.Println(err)
10217
+			}
10218
+			userJSONBytes, _ := json.Marshal(dat)
10219
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
10220
+				utils.ErrorLog("解析失败:%v", err)
10221
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
10222
+				return
10223
+			}
10227 10224
 		} else if miConfig.MdtrtareaAdmvs == "150499" {
10228 10225
 			fmt.Println("~~~~~~~")
10229 10226
 
@@ -12323,3 +12320,37 @@ func Remove0000(s string) string {
12323 12320
 	}
12324 12321
 	return string(str)
12325 12322
 }
12323
+
12324
+func (c *HisApiController) GetELeCertInfo(code string, operator_id string, operator_name string) (string, string) {
12325
+	DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
12326
+	readCard := DllDef.MustFindProc("EcQuery")
12327
+	pCardInfo := make([]byte, 8192)
12328
+	pBusiCardInfo := make([]byte, 8192)
12329
+
12330
+	data := make(map[string]interface{})
12331
+	//pData := make(map[string]interface{})
12332
+
12333
+	inputData := make(map[string]interface{})
12334
+	inputData["orgId"] = code
12335
+	inputData["businessType"] = "01101"
12336
+	inputData["operatorId"] = operator_id
12337
+	inputData["operatorName"] = operator_name
12338
+	inputData["officeId"] = "001"
12339
+	inputData["officeName"] = "血透室"
12340
+	//
12341
+	data["data"] = inputData
12342
+	data["transType"] = "ec.query"
12343
+	data["orgId"] = code
12344
+	bytesData, _ := json.Marshal(data)
12345
+	pCardInfo = bytesData
12346
+	ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&pCardInfo[0])), (uintptr)(unsafe.Pointer(&pBusiCardInfo[0])))
12347
+	fmt.Println(ret2)
12348
+	//fmt.Println(DeleteExtraSpace(string(bytesData)))
12349
+	//fmt.Println(DeleteExtraSpace(string(pBusiCardInfo)))
12350
+	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(bytesData)), "gbk", "utf-8"))
12351
+	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pBusiCardInfo)), "gbk", "utf-8"))
12352
+	if ret2 != 0 {
12353
+		return "", ""
12354
+	}
12355
+	return DeleteExtraSpace(string(bytesData)), DeleteExtraSpace(string(pBusiCardInfo))
12356
+}

+ 2 - 3
service/fj_service.go 查看文件

@@ -546,7 +546,7 @@ func FJyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
546 546
 }
547 547
 
548 548
 //  门诊结算
549
-func FJyb2207(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 int64, url string, app_id string, app_secret string, sign_key string, enc_key string) (string, string) {
549
+func FJyb2207(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, url string, app_id string, app_secret string, sign_key string, enc_key string) (string, string) {
550 550
 	// 生成签名
551 551
 	nonce := GetRandomString(32)
552 552
 	timestamp := time.Now().Unix()
@@ -652,7 +652,7 @@ func FJyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doct
652 652
 
653 653
 }
654 654
 
655
-func FJyb5203(baseParams models.BaseParams, businessParams models.BusinessParams, med_type string, url string, app_id string, app_secret string, sign_key string, enc_key string) string {
655
+func FJyb5203(baseParams models.BaseParams, businessParams models.BusinessParams, url string, app_id string, app_secret string, sign_key string, enc_key string) string {
656 656
 	// 生成签名
657 657
 	nonce := GetRandomString(32)
658 658
 	timestamp := time.Now().Unix()
@@ -668,7 +668,6 @@ func FJyb5203(baseParams models.BaseParams, businessParams models.BusinessParams
668 668
 	inputData["setl_id"] = businessParams.SetlId
669 669
 	inputData["mdtrt_id"] = businessParams.MdtrtId
670 670
 	//inputData["med_type"] = med_type
671
-	fmt.Println(med_type)
672 671
 	input["data"] = inputData
673 672
 	inputMessage["input"] = input //交易输入
674 673
 	bytesData, err := json.Marshal(inputMessage)