test_user vor 1 Jahr
Ursprung
Commit
c7953883d6

+ 1 - 1
conf/app.conf Datei anzeigen

@@ -51,7 +51,7 @@ sso_domain = https://sso.kuyicloud.com
51 51
 call_domain = https://hf.sgjyun.com
52 52
 front_end_domain = "https://xt.kuyicloud.com/#"
53 53
 
54
-org_id = 10188
54
+org_id = 9919
55 55
 gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
56 56
 gdyb_paasid = "sg02_prd"
57 57
 

+ 1 - 1
controllers/nm/nm_controller.go Datei anzeigen

@@ -295,7 +295,7 @@ func (c *NmController) Post4101() {
295 295
 		utils.ErrorLog("解析失败:%v", err)
296 296
 		return
297 297
 	}
298
-	result := service.Gdyb4101(struct4101, pp.SecretKey, pp.FixmedinsName, pp.OpterName, pp.FixmedinsCode, pp.InsuplcAdmdvs, pp.MdtrtareaAdmvs, 0)
298
+	result, _ := service.Gdyb4101(struct4101, pp.SecretKey, pp.FixmedinsName, pp.OpterName, pp.FixmedinsCode, pp.InsuplcAdmdvs, pp.MdtrtareaAdmvs, 0)
299 299
 	var dat map[string]interface{}
300 300
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
301 301
 		fmt.Println(dat)

Datei-Diff unterdrückt, da er zu groß ist
+ 1358 - 1041
controllers/sg/his_api_controller.go


+ 372 - 99
controllers/zh/zh_his_api_controller.go Datei anzeigen

@@ -220,6 +220,64 @@ type ResultFive struct {
220 220
 	PsnInsuStas            string  `json:"psn_insu_stas"`
221 221
 	PsnType                string  `json:"psn_type"`
222 222
 }
223
+type ResultSevenTwo struct {
224
+	Cainfo      string `json:"cainfo"`
225
+	ErrMsg      string `json:"err_msg"`
226
+	InfRefmsgid string `json:"inf_refmsgid"`
227
+	Infcode     int64  `json:"infcode"`
228
+	Output      struct {
229
+		Setldetail []interface{} `json:"setldetail"`
230
+		Setlinfo   struct {
231
+			AcctMulaidPay   float64 `json:"acct_mulaid_pay"`
232
+			AcctPay         float64 `json:"acct_pay"`
233
+			ActPayDedc      float64 `json:"act_pay_dedc"`
234
+			Age             string  `json:"age"`
235
+			Balc            float64 `json:"balc"`
236
+			Brdy            string  `json:"brdy"`
237
+			Certno          string  `json:"certno"`
238
+			ClrOptins       string  `json:"clr_optins"`
239
+			ClrType         string  `json:"clr_type"`
240
+			ClrWay          string  `json:"clr_way"`
241
+			CvlservFlag     string  `json:"cvlserv_flag"`
242
+			CvlservPay      float64 `json:"cvlserv_pay"`
243
+			FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
244
+			FundPaySumamt   float64 `json:"fund_pay_sumamt"`
245
+			Gend            string  `json:"gend"`
246
+			HifesPay        float64 `json:"hifes_pay"`
247
+			HifmiPay        float64 `json:"hifmi_pay"`
248
+			HifpPay         float64 `json:"hifp_pay"`
249
+			HospPartAmt     float64 `json:"hosp_part_amt"`
250
+			InscpScpAmt     float64 `json:"inscp_scp_amt"`
251
+			Insutype        string  `json:"insutype"`
252
+			MafPay          float64 `json:"maf_pay"`
253
+			MdtrtCertType   string  `json:"mdtrt_cert_type"`
254
+			HifobPay        float64 `json:"hifob_pay"`
255
+
256
+			MdtrtID         string  `json:"mdtrt_id"`
257
+			MedType         string  `json:"med_type"`
258
+			MedfeeSumamt    float64 `json:"medfee_sumamt"`
259
+			MedinsSetlID    string  `json:"medins_setl_id"`
260
+			Naty            string  `json:"naty"`
261
+			OthPay          float64 `json:"oth_pay"`
262
+			OverlmtSelfpay  float64 `json:"overlmt_selfpay"`
263
+			PoolPropSelfpay float64 `json:"pool_prop_selfpay"`
264
+			PreselfpayAmt   float64 `json:"preselfpay_amt"`
265
+			PsnCashPay      float64 `json:"psn_cash_pay"`
266
+			PsnCertType     string  `json:"psn_cert_type"`
267
+			PsnName         string  `json:"psn_name"`
268
+			PsnNo           string  `json:"psn_no"`
269
+			PsnPartAmt      float64 `json:"psn_part_amt"`
270
+			PsnType         string  `json:"psn_type"`
271
+			SetlID          string  `json:"setl_id"`
272
+			SetlTime        string  `json:"setl_time"`
273
+		} `json:"setlinfo"`
274
+	} `json:"output"`
275
+	RefmsgTime  string      `json:"refmsg_time"`
276
+	RespondTime string      `json:"respond_time"`
277
+	Signtype    interface{} `json:"signtype"`
278
+	WarnMsg     interface{} `json:"warn_msg"`
279
+}
280
+
223 281
 type ResultSeven struct {
224 282
 	Cainfo      string `json:"cainfo"`
225 283
 	ErrMsg      string `json:"err_msg"`
@@ -1283,6 +1341,9 @@ func (c *ZHHisApiController) GetZHPatientInfo() {
1283 1341
 			result = string(result_byte)
1284 1342
 			saveLog(result_log, request_log, "1101", "人员基本信息获取")
1285 1343
 
1344
+		} else if miConfig.MdtrtareaAdmvs == "360399" {
1345
+			result, request_log = service.JxybZY1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, "", miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", 0, miConfig.Url, miConfig.AccessKey, "", patient.IdCardNo, "")
1346
+			saveLog(result_log, request_log, "1101", "人员基本信息获取")
1286 1347
 		} else {
1287 1348
 			result, request_log, result_log = service.ZHGdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", 1, patient.Name)
1288 1349
 			saveLog(result_log, request_log, "1101", "人员基本信息获取")
@@ -1497,9 +1558,13 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
1497 1558
 			res2.Output.Baseinfo.PsnNo = psn_info.PsnNo
1498 1559
 			res2.Output.Baseinfo.Certno = patient.IdCardNo
1499 1560
 		}
1561
+	} else if miConfig.MdtrtareaAdmvs == "360399" {
1562
+		result, request_log = service.JxybZY1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, "", miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", certificates, miConfig.Url, miConfig.AccessKey, "", patient.IdCardNo, "")
1563
+		saveLog(result_log, request_log, "1101", "人员基本信息获取")
1500 1564
 	} else {
1501 1565
 		result, request_log, result_log = service.ZHGdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", certificates, name)
1502 1566
 		saveLog(result_log, request_log, "1101", "人员基本信息获取")
1567
+
1503 1568
 	}
1504 1569
 
1505 1570
 	doctorInfo, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, doctor)
@@ -1659,10 +1724,10 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
1659 1724
 			}
1660 1725
 		} else {
1661 1726
 			if med_type == 11 {
1662
-				struct2401.MedType = "21"
1727
+				struct2401.MedType = "24"
1728
+				med_type = 24
1663 1729
 			} else {
1664 1730
 				struct2401.MedType = strconv.FormatInt(int64(med_type), 10)
1665
-
1666 1731
 			}
1667 1732
 		}
1668 1733
 		struct2401.IptNo = ipt_otp_no
@@ -1738,6 +1803,11 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
1738 1803
 			respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
1739 1804
 			result_byte, _ := json.Marshal(respJSON)
1740 1805
 			result = string(result_byte)
1806
+		} else if miConfig.MdtrtareaAdmvs == "360399" {
1807
+
1808
+			result, request_log = service.Jxyb2401(struct2401, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, role.UserName, insuplc_admdvs, miConfig.MdtrtareaAdmvs, miConfig.Url, "", miConfig.AccessKey)
1809
+			saveLog(result, request_log, "2401", "入院登记")
1810
+
1741 1811
 		} else {
1742 1812
 			result, request_log = service.ZHGdyb2401(struct2401, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, role.UserName, insuplc_admdvs, miConfig.MdtrtareaAdmvs)
1743 1813
 			saveLog(result, request_log, "2401", "入院登记")
@@ -1915,7 +1985,7 @@ func (this *ZHHisApiController) GetZHOutHospitalCheck() {
1915 1985
 		}
1916 1986
 
1917 1987
 		dise.MdtrtId = record.Number
1918
-		dise.DiagSrtNo = strconv.FormatInt(int64(item.ID), 10)
1988
+		dise.DiagSrtNo = strconv.FormatInt(int64(index), 10)
1919 1989
 		dise.DiseDorName = doctorInfo.UserName
1920 1990
 		dise.DiagCode = item.CountryCode
1921 1991
 		dise.DiagName = item.ClassName
@@ -1961,6 +2031,10 @@ func (this *ZHHisApiController) GetZHOutHospitalCheck() {
1961 2031
 		respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
1962 2032
 		result_byte, _ := json.Marshal(respJSON)
1963 2033
 		result = string(result_byte)
2034
+	} else if miConfig.MdtrtareaAdmvs == "360399" {
2035
+		result, request_log = service.Jxyb2402(struct2402, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.Url, "", miConfig.AccessKey)
2036
+		saveLog(result, request_log, "2402", "出院")
2037
+
1964 2038
 	} else {
1965 2039
 		result, request_log = service.ZHGdyb2402(struct2402, miConfig.OrgName, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code)
1966 2040
 		saveLog(result, request_log, "2402", "出院")
@@ -2394,6 +2468,10 @@ func (c *ZHHisApiController) GetSettleInfo() {
2394 2468
 		result_byte, _ := json.Marshal(respJSON)
2395 2469
 		result = string(result_byte)
2396 2470
 
2471
+	} else if miConfig.MdtrtareaAdmvs == "360399" {
2472
+		result, src_resquest = service.Jxyb2304(record.PsnNo, record.Number, cert_no, record.InsutypeType, allTotal, record.Certificates, record.IdCardType, "", miConfig.SecretKey, miConfig.OrgName, miConfig.Code, roles.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.Url, "", miConfig.AccessKey, "", "1")
2473
+		saveLog(result, src_resquest, "2304", "住院结算")
2474
+
2397 2475
 	} else {
2398 2476
 
2399 2477
 		result, src_resquest = service.ZHGdyb2304(record.PsnNo, record.Number, chrg_bchno, cert_no, record.InsutypeType, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, "0", record.IdCardType, 0, 0, 0, 0, record.Certificates, "", "1")
@@ -2563,11 +2641,11 @@ func (c *ZHHisApiController) GetPreSettleInfo() {
2563 2641
 		for _, item := range orders {
2564 2642
 			total = total + item.DetItemFeeSumamt
2565 2643
 		}
2566
-		allTotal = fmt.Sprintf("%.4f", total)
2644
+		allTotal = fmt.Sprintf("%.2f", total)
2567 2645
 
2568 2646
 	} else {
2569 2647
 
2570
-		allTotal = fmt.Sprintf("%.4f", order.MedfeeSumamt)
2648
+		allTotal = fmt.Sprintf("%.2f", order.MedfeeSumamt)
2571 2649
 
2572 2650
 	}
2573 2651
 
@@ -2626,12 +2704,13 @@ func (c *ZHHisApiController) GetPreSettleInfo() {
2626 2704
 		result_byte, _ := json.Marshal(respJSON)
2627 2705
 		result = string(result_byte)
2628 2706
 
2707
+	} else if miConfig.MdtrtareaAdmvs == "360399" {
2708
+		result, src_resquest = service.Jxyb2303(record.PsnNo, record.Number, cert_no, record.InsutypeType, allTotal, record.Certificates, record.IdCardType, "", miConfig.SecretKey, miConfig.OrgName, miConfig.Code, roles.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.Url, "", miConfig.AccessKey)
2709
+		saveLog(result, src_resquest, "2303", "住院预结算")
2629 2710
 	} else {
2630 2711
 		result, src_resquest = service.ZHGdyb2303(record.PsnNo, record.Number, chrg_bchno, cert_no, record.InsutypeType, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, "0", record.IdCardType, 0, 0, 0, 0, record.Certificates)
2631 2712
 		saveLog(result, src_resquest, "2303", "住院预结算")
2632
-
2633 2713
 	}
2634
-
2635 2714
 	var dat map[string]interface{}
2636 2715
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
2637 2716
 		fmt.Println(dat)
@@ -2639,6 +2718,8 @@ func (c *ZHHisApiController) GetPreSettleInfo() {
2639 2718
 		fmt.Println(err)
2640 2719
 	}
2641 2720
 	userJSONBytes, _ := json.Marshal(dat)
2721
+
2722
+	var res2 ResultSevenTwo
2642 2723
 	var res ResultSeven
2643 2724
 	var resSeven10265 ResultSeven10265
2644 2725
 	if miConfig.Code == "H15049901371" {
@@ -2657,106 +2738,267 @@ func (c *ZHHisApiController) GetPreSettleInfo() {
2657 2738
 		res.Cainfo = resSeven10265.Cainfo
2658 2739
 
2659 2740
 	} else {
2660
-		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
2661
-			utils.ErrorLog("解析失败:%v", err)
2662
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2663
-			return
2664
-		}
2741
+		if miConfig.MdtrtareaAdmvs == "360399" {
2742
+			if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
2743
+				utils.ErrorLog("解析失败:%v", err)
2744
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2745
+				return
2746
+			}
2665 2747
 
2666
-	}
2748
+			if res2.Infcode != 0 {
2749
+				errlog := &models.HisOrderError{
2750
+					UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
2751
+					Ctime:      time.Now().Unix(),
2752
+					Mtime:      time.Now().Unix(),
2753
+					Number:     chrg_bchno,
2754
+					ErrMsg:     res.ErrMsg,
2755
+					Status:     1,
2756
+					PatientId:  patient_id,
2757
+					RecordTime: time.Now().Unix(),
2758
+					Stage:      6,
2759
+				}
2760
+				service.CreateErrMsgLog(errlog)
2761
+				c.ServeSuccessJSON(map[string]interface{}{
2762
+					"failed_code": -10,
2763
+					"msg":         res.ErrMsg,
2764
+				})
2765
+				return
2766
+			} else {
2767
+				//order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
2768
+				order.OrderStatus = 1
2769
+				order.MdtrtId = res2.Output.Setlinfo.MdtrtID
2770
+				order.SetlId = res2.Output.Setlinfo.SetlID
2771
+				order.PsnNo = res2.Output.Setlinfo.PsnNo
2772
+				order.PsnName = res2.Output.Setlinfo.PsnName
2773
+				order.PsnCertType = res2.Output.Setlinfo.PsnCertType
2774
+				order.Certno = res2.Output.Setlinfo.Certno
2775
+				order.Gend = res2.Output.Setlinfo.Gend
2776
+				order.Naty = res2.Output.Setlinfo.Naty
2777
+				val, _ := strconv.ParseFloat(res2.Output.Setlinfo.Age, 64)
2778
+				order.Age = val
2779
+				order.Insutype = res2.Output.Setlinfo.Insutype
2780
+				order.PsnType = res2.Output.Setlinfo.PsnType
2781
+				order.CvlservFlag = res2.Output.Setlinfo.CvlservFlag
2782
+				order.SetlTime = res2.Output.Setlinfo.SetlTime
2783
+				order.MdtrtCertType = res2.Output.Setlinfo.MdtrtCertType
2784
+				if res.Output.Setlinfo.MedType == "140104" {
2785
+
2786
+					order.MedType = "14"
2667 2787
 
2668
-	if res.Infcode != 0 {
2669
-		errlog := &models.HisOrderError{
2670
-			UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
2671
-			Ctime:      time.Now().Unix(),
2672
-			Mtime:      time.Now().Unix(),
2673
-			Number:     chrg_bchno,
2674
-			ErrMsg:     res.ErrMsg,
2675
-			Status:     1,
2676
-			PatientId:  patient_id,
2677
-			RecordTime: time.Now().Unix(),
2678
-			Stage:      6,
2679
-		}
2680
-		service.CreateErrMsgLog(errlog)
2681
-		c.ServeSuccessJSON(map[string]interface{}{
2682
-			"failed_code": -10,
2683
-			"msg":         res.ErrMsg,
2684
-		})
2685
-		return
2686
-	} else {
2687
-		//order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
2688
-		order.OrderStatus = 1
2689
-		order.MdtrtId = res.Output.Setlinfo.MdtrtID
2690
-		order.SetlId = res.Output.Setlinfo.SetlID
2691
-		order.PsnNo = res.Output.Setlinfo.PsnNo
2692
-		order.PsnName = res.Output.Setlinfo.PsnName
2693
-		order.PsnCertType = res.Output.Setlinfo.PsnCertType
2694
-		order.Certno = res.Output.Setlinfo.Certno
2695
-		order.Gend = res.Output.Setlinfo.Gend
2696
-		order.Naty = res.Output.Setlinfo.Naty
2697
-		order.Age = res.Output.Setlinfo.Age
2698
-		order.Insutype = res.Output.Setlinfo.Insutype
2699
-		order.PsnType = res.Output.Setlinfo.PsnType
2700
-		order.CvlservFlag = res.Output.Setlinfo.CvlservFlag
2701
-		order.SetlTime = res.Output.Setlinfo.SetlTime
2702
-		order.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
2703
-		if res.Output.Setlinfo.MedType == "140104" {
2788
+				} else {
2704 2789
 
2705
-			order.MedType = "14"
2790
+					order.MedType = res2.Output.Setlinfo.MedType
2706 2791
 
2707
-		} else {
2792
+				}
2793
+				order.MedfeeSumamt = res2.Output.Setlinfo.MedfeeSumamt
2794
+				order.FulamtOwnpayAmt = res2.Output.Setlinfo.FulamtOwnpayAmt
2795
+				order.OverlmtSelfPay = res2.Output.Setlinfo.OverlmtSelfpay
2796
+				order.PreselfpayAmt = res2.Output.Setlinfo.PreselfpayAmt
2797
+				order.InscpScpAmt = res2.Output.Setlinfo.InscpScpAmt
2798
+				order.ActPayDedc = res2.Output.Setlinfo.ActPayDedc
2799
+				order.HifmiPay = res2.Output.Setlinfo.HifmiPay
2800
+				order.HifpPay = res2.Output.Setlinfo.HifpPay
2801
+				order.HifesPay = res2.Output.Setlinfo.HifesPay
2802
+				order.HifobPay = res2.Output.Setlinfo.HifobPay
2803
+				order.MafPay = res2.Output.Setlinfo.MafPay
2804
+				order.OthPay = res2.Output.Setlinfo.OthPay
2805
+				order.CvlservPay = res2.Output.Setlinfo.CvlservPay
2806
+				order.PoolPropSelfpay = res2.Output.Setlinfo.PoolPropSelfpay
2807
+				order.FundPaySumamt = res2.Output.Setlinfo.FundPaySumamt
2808
+				order.PsnPartAmt = res2.Output.Setlinfo.PsnPartAmt
2809
+				order.AcctPay = res2.Output.Setlinfo.AcctPay
2810
+				order.PsnCashPay = res2.Output.Setlinfo.PsnCashPay
2811
+				order.HospPartAmt = res2.Output.Setlinfo.HospPartAmt
2812
+				order.Balc = res2.Output.Setlinfo.Balc
2813
+				order.AcctMulaidPay = res2.Output.Setlinfo.AcctMulaidPay
2814
+				order.MedinsSetlId = res2.Output.Setlinfo.MedinsSetlID
2815
+				order.ClrOptins = res2.Output.Setlinfo.ClrOptins
2816
+				order.ClrWay = res2.Output.Setlinfo.ClrWay
2817
+				order.Creator = order.Creator
2818
+				order.Modify = roles.AdminUserId
2819
+				order.RequestLog = src_resquest
2820
+				setlDetail, _ := json.Marshal(res2.Output.Setldetail)
2821
+				detailStr := string(setlDetail)
2822
+				order.SetlDetail = detailStr
2823
+				//err := service.UpdataOrderStatusTwo(chrg_bchno, c.GetAdminUserInfo().CurrentOrgId)
2824
+				if record.OutHospitalStatus == 1 && order.ID > 0 {
2825
+					err := service.UpDateOrder(order)
2826
+					if err == nil {
2827
+						c.ServeSuccessJSON(map[string]interface{}{
2828
+							"msg":       "预结算成功",
2829
+							"order_way": 1,
2830
+						})
2831
+					} else {
2832
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
2833
+						return
2834
+					}
2835
+				} else if record.OutHospitalStatus == 0 && order.ID == 0 {
2836
+
2837
+					var order models.HisOrder
2838
+					//order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
2839
+					order.OrderStatus = 1
2840
+					order.MdtrtId = res2.Output.Setlinfo.MdtrtID
2841
+					order.SetlId = res2.Output.Setlinfo.SetlID
2842
+					order.PsnNo = res2.Output.Setlinfo.PsnNo
2843
+					order.PsnName = res2.Output.Setlinfo.PsnName
2844
+					order.PsnCertType = res2.Output.Setlinfo.PsnCertType
2845
+					order.Certno = res2.Output.Setlinfo.Certno
2846
+					order.Gend = res2.Output.Setlinfo.Gend
2847
+					order.Naty = res2.Output.Setlinfo.Naty
2848
+					val, _ := strconv.ParseFloat(res2.Output.Setlinfo.Age, 64)
2849
+					order.Age = val
2850
+					order.Insutype = res2.Output.Setlinfo.Insutype
2851
+					order.PsnType = res2.Output.Setlinfo.PsnType
2852
+					order.CvlservFlag = res2.Output.Setlinfo.CvlservFlag
2853
+					order.SetlTime = res2.Output.Setlinfo.SetlTime
2854
+					order.MdtrtCertType = res2.Output.Setlinfo.MdtrtCertType
2855
+					if res2.Output.Setlinfo.MedType == "140104" {
2856
+
2857
+						order.MedType = "14"
2708 2858
 
2709
-			order.MedType = res.Output.Setlinfo.MedType
2859
+					} else {
2710 2860
 
2711
-		}
2712
-		order.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
2713
-		order.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
2714
-		order.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
2715
-		order.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
2716
-		order.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
2717
-		order.ActPayDedc = res.Output.Setlinfo.ActPayDedc
2718
-		order.HifmiPay = res.Output.Setlinfo.HifmiPay
2719
-		order.HifpPay = res.Output.Setlinfo.HifpPay
2720
-		order.HifesPay = res.Output.Setlinfo.HifesPay
2721
-		order.HifobPay = res.Output.Setlinfo.HifobPay
2722
-		order.MafPay = res.Output.Setlinfo.MafPay
2723
-		order.OthPay = res.Output.Setlinfo.OthPay
2724
-		order.CvlservPay = res.Output.Setlinfo.CvlservPay
2725
-		order.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
2726
-		order.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
2727
-		order.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
2728
-		order.AcctPay = res.Output.Setlinfo.AcctPay
2729
-		order.PsnCashPay = res.Output.Setlinfo.PsnCashPay
2730
-		order.HospPartAmt = res.Output.Setlinfo.HospPartAmt
2731
-		order.Balc = res.Output.Setlinfo.Balc
2732
-		order.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
2733
-		order.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
2734
-		order.ClrOptins = res.Output.Setlinfo.ClrOptins
2735
-		order.ClrWay = res.Output.Setlinfo.ClrWay
2736
-		order.Creator = order.Creator
2737
-		order.Modify = roles.AdminUserId
2738
-		order.RequestLog = src_resquest
2739
-		setlDetail, _ := json.Marshal(res.Output.Setldetail)
2740
-		detailStr := string(setlDetail)
2741
-		order.SetlDetail = detailStr
2742
-		//err := service.UpdataOrderStatusTwo(chrg_bchno, c.GetAdminUserInfo().CurrentOrgId)
2743
-		if record.OutHospitalStatus == 1 && order.ID > 0 {
2744
-			err := service.UpDateOrder(order)
2745
-			if err == nil {
2861
+						order.MedType = res2.Output.Setlinfo.MedType
2862
+
2863
+					}
2864
+					order.MedfeeSumamt = res2.Output.Setlinfo.MedfeeSumamt
2865
+					order.FulamtOwnpayAmt = res2.Output.Setlinfo.FulamtOwnpayAmt
2866
+					order.OverlmtSelfPay = res2.Output.Setlinfo.OverlmtSelfpay
2867
+					order.PreselfpayAmt = res2.Output.Setlinfo.PreselfpayAmt
2868
+					order.InscpScpAmt = res2.Output.Setlinfo.InscpScpAmt
2869
+					order.ActPayDedc = res2.Output.Setlinfo.ActPayDedc
2870
+					order.HifmiPay = res2.Output.Setlinfo.HifmiPay
2871
+					order.HifpPay = res2.Output.Setlinfo.HifpPay
2872
+					order.HifesPay = res2.Output.Setlinfo.HifesPay
2873
+					order.HifobPay = res2.Output.Setlinfo.HifobPay
2874
+					order.MafPay = res2.Output.Setlinfo.MafPay
2875
+					order.OthPay = res2.Output.Setlinfo.OthPay
2876
+					order.CvlservPay = res2.Output.Setlinfo.CvlservPay
2877
+					order.PoolPropSelfpay = res2.Output.Setlinfo.PoolPropSelfpay
2878
+					order.FundPaySumamt = res2.Output.Setlinfo.FundPaySumamt
2879
+					order.PsnPartAmt = res2.Output.Setlinfo.PsnPartAmt
2880
+					order.AcctPay = res2.Output.Setlinfo.AcctPay
2881
+					order.PsnCashPay = res2.Output.Setlinfo.PsnCashPay
2882
+					order.HospPartAmt = res2.Output.Setlinfo.HospPartAmt
2883
+					order.Balc = res2.Output.Setlinfo.Balc
2884
+					order.AcctMulaidPay = res2.Output.Setlinfo.AcctMulaidPay
2885
+					order.MedinsSetlId = res2.Output.Setlinfo.MedinsSetlID
2886
+					order.ClrOptins = res2.Output.Setlinfo.ClrOptins
2887
+					order.ClrWay = res2.Output.Setlinfo.ClrWay
2888
+					order.Creator = order.Creator
2889
+					order.Modify = roles.AdminUserId
2890
+					order.RequestLog = src_resquest
2891
+					setlDetail, _ := json.Marshal(res2.Output.Setldetail)
2892
+					detailStr := string(setlDetail)
2893
+					order.SetlDetail = detailStr
2894
+
2895
+					c.ServeSuccessJSON(map[string]interface{}{
2896
+						"msg":       "预结算成功",
2897
+						"order":     order,
2898
+						"order_way": 2,
2899
+					})
2900
+				}
2901
+			}
2902
+		} else {
2903
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
2904
+				utils.ErrorLog("解析失败:%v", err)
2905
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2906
+				return
2907
+			}
2908
+			if res.Infcode != 0 {
2909
+				errlog := &models.HisOrderError{
2910
+					UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
2911
+					Ctime:      time.Now().Unix(),
2912
+					Mtime:      time.Now().Unix(),
2913
+					Number:     chrg_bchno,
2914
+					ErrMsg:     res.ErrMsg,
2915
+					Status:     1,
2916
+					PatientId:  patient_id,
2917
+					RecordTime: time.Now().Unix(),
2918
+					Stage:      6,
2919
+				}
2920
+				service.CreateErrMsgLog(errlog)
2746 2921
 				c.ServeSuccessJSON(map[string]interface{}{
2747
-					"msg":       "预结算成功",
2748
-					"order_way": 1,
2922
+					"failed_code": -10,
2923
+					"msg":         res.ErrMsg,
2749 2924
 				})
2750
-			} else {
2751
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
2752 2925
 				return
2926
+			} else {
2927
+				//order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
2928
+				order.OrderStatus = 1
2929
+				order.MdtrtId = res.Output.Setlinfo.MdtrtID
2930
+				order.SetlId = res.Output.Setlinfo.SetlID
2931
+				order.PsnNo = res.Output.Setlinfo.PsnNo
2932
+				order.PsnName = res.Output.Setlinfo.PsnName
2933
+				order.PsnCertType = res.Output.Setlinfo.PsnCertType
2934
+				order.Certno = res.Output.Setlinfo.Certno
2935
+				order.Gend = res.Output.Setlinfo.Gend
2936
+				order.Naty = res.Output.Setlinfo.Naty
2937
+				order.Age = res.Output.Setlinfo.Age
2938
+				order.Insutype = res.Output.Setlinfo.Insutype
2939
+				order.PsnType = res.Output.Setlinfo.PsnType
2940
+				order.CvlservFlag = res.Output.Setlinfo.CvlservFlag
2941
+				order.SetlTime = res.Output.Setlinfo.SetlTime
2942
+				order.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
2943
+				if res.Output.Setlinfo.MedType == "140104" {
2944
+
2945
+					order.MedType = "14"
2946
+
2947
+				} else {
2948
+
2949
+					order.MedType = res.Output.Setlinfo.MedType
2950
+
2951
+				}
2952
+				order.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
2953
+				order.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
2954
+				order.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
2955
+				order.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
2956
+				order.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
2957
+				order.ActPayDedc = res.Output.Setlinfo.ActPayDedc
2958
+				order.HifmiPay = res.Output.Setlinfo.HifmiPay
2959
+				order.HifpPay = res.Output.Setlinfo.HifpPay
2960
+				order.HifesPay = res.Output.Setlinfo.HifesPay
2961
+				order.HifobPay = res.Output.Setlinfo.HifobPay
2962
+				order.MafPay = res.Output.Setlinfo.MafPay
2963
+				order.OthPay = res.Output.Setlinfo.OthPay
2964
+				order.CvlservPay = res.Output.Setlinfo.CvlservPay
2965
+				order.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
2966
+				order.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
2967
+				order.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
2968
+				order.AcctPay = res.Output.Setlinfo.AcctPay
2969
+				order.PsnCashPay = res.Output.Setlinfo.PsnCashPay
2970
+				order.HospPartAmt = res.Output.Setlinfo.HospPartAmt
2971
+				order.Balc = res.Output.Setlinfo.Balc
2972
+				order.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
2973
+				order.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
2974
+				order.ClrOptins = res.Output.Setlinfo.ClrOptins
2975
+				order.ClrWay = res.Output.Setlinfo.ClrWay
2976
+				order.Creator = order.Creator
2977
+				order.Modify = roles.AdminUserId
2978
+				order.RequestLog = src_resquest
2979
+				setlDetail, _ := json.Marshal(res.Output.Setldetail)
2980
+				detailStr := string(setlDetail)
2981
+				order.SetlDetail = detailStr
2982
+				//err := service.UpdataOrderStatusTwo(chrg_bchno, c.GetAdminUserInfo().CurrentOrgId)
2983
+				if record.OutHospitalStatus == 1 && order.ID > 0 {
2984
+					err := service.UpDateOrder(order)
2985
+					if err == nil {
2986
+						c.ServeSuccessJSON(map[string]interface{}{
2987
+							"msg":       "预结算成功",
2988
+							"order_way": 1,
2989
+						})
2990
+					} else {
2991
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
2992
+						return
2993
+					}
2994
+				} else if record.OutHospitalStatus == 0 && order.ID == 0 {
2995
+					c.ServeSuccessJSON(map[string]interface{}{
2996
+						"msg":       "预结算成功",
2997
+						"order":     order,
2998
+						"order_way": 2,
2999
+					})
3000
+				}
2753 3001
 			}
2754
-		} else if record.OutHospitalStatus == 0 && order.ID == 0 {
2755
-			c.ServeSuccessJSON(map[string]interface{}{
2756
-				"msg":       "预结算成功",
2757
-				"order":     order,
2758
-				"order_way": 2,
2759
-			})
2760 3002
 		}
2761 3003
 	}
2762 3004
 
@@ -2875,7 +3117,7 @@ func (c *ZHHisApiController) GetUploadInfo() {
2875 3117
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
2876 3118
 	if config.IsOpen == 1 { //对接了医保,走医保流程
2877 3119
 
2878
-		var pagesize int = 100
3120
+		var pagesize int = 10
2879 3121
 		var start int = 1
2880 3122
 		var stop int
2881 3123
 		var pagecount int
@@ -3018,6 +3260,10 @@ func (c *ZHHisApiController) GetUploadInfo() {
3018 3260
 				respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
3019 3261
 				result_byte, _ := json.Marshal(respJSON)
3020 3262
 				result = string(result_byte)
3263
+			} else if miConfig.MdtrtareaAdmvs == "360399" {
3264
+				result, requestLog = service.Jxyb2301(record.PsnNo, record.Number, customs[start-1:stop], data["med_type"].(string), chrg_bchno, department.Number, strconv.FormatInt(department.ID, 10), strconv.FormatInt(roles.AdminUserId, 10), miConfig.SecretKey, miConfig.OrgName, miConfig.Code, roles.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.Url, "", miConfig.AccessKey)
3265
+				saveLog(result, requestLog, "2301", "上传明细")
3266
+
3021 3267
 			} else {
3022 3268
 				result, requestLog = service.ZHGdyb2301(record.PsnNo, record.Number, customs[start-1:stop], chrg_bchno, miConfig.OrgName, roles.UserName, strconv.FormatInt(department.ID, 10), miConfig.Code, department.Number, strconv.FormatInt(roles.AdminUserId, 10), record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, data["med_type"].(string), doctor_info.UserName, doctor_info.DoctorNumber)
3023 3269
 				saveLog(result, requestLog, "2301", "上传明细")
@@ -3263,6 +3509,11 @@ func (c *ZHHisApiController) ZHRefund() {
3263 3509
 			//saveLog(result, requestLog, "2404", "入院登记撤销")
3264 3510
 			saveLog(result, requestLog, "2305", "退费")
3265 3511
 
3512
+		} else if miConfig.MdtrtareaAdmvs == "360399" {
3513
+
3514
+			result, requestLog := service.Jxyb2305(order.PsnNo, order.MdtrtId, order.SetlId, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, roles.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.Url, "", miConfig.AccessKey)
3515
+			saveLog(result, requestLog, "2305", "退费")
3516
+
3266 3517
 		} else {
3267 3518
 			result, requestLog := service.Gdyb2305(order.PsnNo, order.MdtrtId, order.SetlId, miConfig.OrgName, roles.UserName, miConfig.SecretKey, miConfig.Code, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
3268 3519
 			saveLog(result, requestLog, "2305", "退费")
@@ -3414,6 +3665,9 @@ func (c *ZHHisApiController) ZHRefundDetail() {
3414 3665
 				result = string(result_byte)
3415 3666
 				saveLog(result, requestLog, "2302", "日结退明细")
3416 3667
 
3668
+			} else if miConfig.MdtrtareaAdmvs == "360399" {
3669
+				result, requestLog := service.Jxyb2302(record.PsnNo, record.Number, 1, item.FeedetlSn, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, roles.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.Url, "", miConfig.AccessKey)
3670
+				saveLog(result, requestLog, "2302", "日结退明细")
3417 3671
 			} else {
3418 3672
 				result, requestLog := service.Gdyb2302(record.PsnNo, record.Number, miConfig.OrgName, roles.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, item.FeedetlSn, 1)
3419 3673
 				saveLog(result, requestLog, "2302", "日结退明细")
@@ -3510,6 +3764,10 @@ func (c *ZHHisApiController) ZHRefundDetail() {
3510 3764
 				result = string(result_byte)
3511 3765
 				//saveLog(result, requestLog, "2302", "日结退明细")
3512 3766
 
3767
+			} else if miConfig.MdtrtareaAdmvs == "360399" {
3768
+				result, requestLog = service.Jxyb2302(record.PsnNo, record.Number, 0, "0000", miConfig.SecretKey, miConfig.OrgName, miConfig.Code, roles.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.Url, "", miConfig.AccessKey)
3769
+				saveLog(result, requestLog, "2302", "月结退明细")
3770
+
3513 3771
 			} else {
3514 3772
 				result, requestLog = service.Gdyb2302(record.PsnNo, record.Number, miConfig.OrgName, roles.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, "0000", 0)
3515 3773
 				saveLog(result, requestLog, "2302", "月结退明细")
@@ -3566,7 +3824,6 @@ func (c *ZHHisApiController) ZHRefundDetail() {
3566 3824
 	}
3567 3825
 
3568 3826
 }
3569
-
3570 3827
 func (this *ZHHisApiController) GetZHOutHospitalUnCheck() {
3571 3828
 	id, _ := this.GetInt64("id")
3572 3829
 	admin_user_id, _ := this.GetInt64("admin_user_id")
@@ -3615,6 +3872,11 @@ func (this *ZHHisApiController) GetZHOutHospitalUnCheck() {
3615 3872
 		result_byte, _ := json.Marshal(respJSON)
3616 3873
 		result = string(result_byte)
3617 3874
 
3875
+	} else if miConfig.MdtrtareaAdmvs == "360399" {
3876
+
3877
+		result, requestLog = service.Jxyb2405(record.Number, record.PsnNo, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.Url, "", miConfig.AccessKey)
3878
+		saveLog(result, requestLog, "2405", "出院登记撤销")
3879
+
3618 3880
 	} else {
3619 3881
 		result, requestLog = service.ZHGdyb2405(record.Number, record.PsnNo, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
3620 3882
 		saveLog(result, requestLog, "2405", "出院登记撤销")
@@ -3716,6 +3978,9 @@ func (this *ZHHisApiController) GetZHInHospitalUnCheck() {
3716 3978
 			result = string(result_byte)
3717 3979
 			saveLog(result, requestLog, "2302", "月结退明细")
3718 3980
 
3981
+		} else if miConfig.MdtrtareaAdmvs == "360399" {
3982
+			result, requestLog = service.Jxyb2302(record.PsnNo, record.Number, 0, "0000", miConfig.SecretKey, miConfig.OrgName, miConfig.Code, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.Url, "", miConfig.AccessKey)
3983
+			saveLog(result, requestLog, "2302", "月结退明细")
3719 3984
 		} else {
3720 3985
 			result, requestLog = service.Gdyb2302(record.PsnNo, record.Number, miConfig.OrgName, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, "0000", 0)
3721 3986
 			saveLog(result, requestLog, "2302", "月结退明细")
@@ -3790,6 +4055,10 @@ func (this *ZHHisApiController) GetZHInHospitalUnCheck() {
3790 4055
 				result_byte, _ := json.Marshal(respJSON)
3791 4056
 				result = string(result_byte)
3792 4057
 
4058
+			} else if miConfig.MdtrtareaAdmvs == "360399" {
4059
+				result, requestLog = service.Jxyb2404(record.Number, record.PsnNo, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.Url, "", miConfig.AccessKey)
4060
+				saveLog(result, requestLog, "2404", "入院登记撤销")
4061
+
3793 4062
 			} else {
3794 4063
 				result, requestLog = service.ZHGdyb2404(record.Number, record.PsnNo, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
3795 4064
 				saveLog(result, requestLog, "2404", "入院登记撤销")
@@ -3881,6 +4150,10 @@ func (this *ZHHisApiController) GetZHInHospitalUnCheck() {
3881 4150
 			result_byte, _ := json.Marshal(respJSON)
3882 4151
 			result = string(result_byte)
3883 4152
 
4153
+		} else if miConfig.MdtrtareaAdmvs == "360399" {
4154
+			result, requestLog = service.Jxyb2404(record.Number, record.PsnNo, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.Url, "", miConfig.AccessKey)
4155
+			saveLog(result, requestLog, "2404", "入院登记撤销")
4156
+
3884 4157
 		} else {
3885 4158
 			result, requestLog = service.ZHGdyb2404(record.Number, record.PsnNo, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
3886 4159
 			saveLog(result, requestLog, "2404", "入院登记撤销")

+ 191 - 155
main.go Datei anzeigen

@@ -7,9 +7,11 @@ import (
7 7
 	"gdyb/models"
8 8
 	_ "gdyb/routers"
9 9
 	"gdyb/service"
10
+	"gdyb/utils"
10 11
 	"github.com/shopspring/decimal"
11 12
 	"io/ioutil"
12 13
 	"net/http"
14
+	"os"
13 15
 	"strconv"
14 16
 	"strings"
15 17
 	"time"
@@ -66,25 +68,25 @@ func GetBatchSettleList() {
66 68
 
67 69
 	org_id, _ := beego.AppConfig.Int64("org_id")
68 70
 	//list, _ := service.GetLastFundList(org_id)
69
-	orders, _ := service.GetOrderError(org_id)
71
+	//orders, _ := service.GetOrderError(org_id)
70 72
 	//order, _ := service.GetHisOrderByID(list.OrderId)
71
-	//var orders []*models.HisOrder
73
+	var orders []*models.HisOrder
72 74
 	//if order.ID > 0 {
73 75
 	//
74 76
 	//	orders, _ = service.GetAllHisOrderTwo(org_id, order.ID)
75 77
 	//
76 78
 	//} else {
77
-	//	orders, _ = service.GetAllHisOrder(org_id)
79
+	orders, _ = service.GetAllHisOrder10106(org_id)
78 80
 	//
79 81
 	//}
80 82
 
81 83
 	for _, item := range orders {
82
-		order_id := item.PatientId
84
+		order_id := item.ID
83 85
 		order, _ := service.GetHisOrderByIDTwo(order_id)
84 86
 		roles, _ := service.GetDoctorListTwo(org_id)
85 87
 		his, _ := service.GetHisPatientByNumber(order.MdtrtId)
86 88
 		admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
87
-		curRoles, _ := service.GetAdminUserInfoByID(org_id, 2185)
89
+		curRoles, _ := service.GetAdminUserInfoByID(org_id, 2495)
88 90
 		depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
89 91
 		miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
90 92
 
@@ -131,14 +133,10 @@ func GetBatchSettleList() {
131 133
 			MedinsFillDept: depart.Name,
132 134
 			IptMedType:     "2",
133 135
 		}
136
+
134 137
 		struct4101.SetlBegnDate = order.SetlTime
135 138
 		struct4101.SetlEndDate = order.SetlTime
136 139
 
137
-		if len(order.SetlTime) == 0 {
138
-			struct4101.SetlBegnDate = time.Unix(order.Ctime, 0).Format("2006-01-02 15:04:05")
139
-			struct4101.SetlEndDate = time.Unix(order.Ctime, 0).Format("2006-01-02 15:04:05")
140
-
141
-		}
142 140
 		//if order.SettleType == 1 {
143 141
 		//	t := time.Unix(int64(order.SettleAccountsDate), 0)
144 142
 		//	dateStr := t.Format("2006-01-02")
@@ -612,167 +610,164 @@ func GetBatchSettleList() {
612 610
 
613 611
 		var iteminfoStructs []service.IteminfoStruct
614 612
 
615
-		if order.Insutype != "310" {
616
-			if bedCostTotal != 0 {
617
-				iteminfo.MedChrgitm = "01"
618
-				iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
619
-				iteminfo.Amt = bedCostTotal
620
-				iteminfo.ClaaSumfee = bed_claa_sunmfee
621
-				iteminfo.ClabAmt = bed_clab_amt
622
-				iteminfo.OthAmt = bed_other_amt
623
-				iteminfoStructs = append(iteminfoStructs, iteminfo)
624
-			}
613
+		if bedCostTotal != 0 {
614
+			iteminfo.MedChrgitm = "01"
615
+			iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
616
+			iteminfo.Amt = bedCostTotal
617
+			iteminfo.ClaaSumfee = bed_claa_sunmfee
618
+			iteminfo.ClabAmt = bed_clab_amt
619
+			iteminfo.OthAmt = bed_other_amt
620
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
621
+		}
625 622
 
626
-			if examineCostTotal != 0 {
627
-				iteminfo.MedChrgitm = "02"
628
-				iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
629
-				iteminfo.Amt = examineCostTotal
630
-				iteminfo.ClaaSumfee = examine_claa_sunmfee
631
-				iteminfo.ClabAmt = examine_clab_amt
632
-				iteminfo.OthAmt = examine_other_amt
633
-				//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
634
-				iteminfoStructs = append(iteminfoStructs, iteminfo)
635
-			}
623
+		if examineCostTotal != 0 {
624
+			iteminfo.MedChrgitm = "02"
625
+			iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
626
+			iteminfo.Amt = examineCostTotal
627
+			iteminfo.ClaaSumfee = examine_claa_sunmfee
628
+			iteminfo.ClabAmt = examine_clab_amt
629
+			iteminfo.OthAmt = examine_other_amt
630
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
631
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
632
+		}
636 633
 
637
-			if checkCostTotal != 0 {
638
-				iteminfo.MedChrgitm = "03"
639
-				iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
640
-				iteminfo.Amt = checkCostTotal
641
-				iteminfo.ClaaSumfee = check_claa_sunmfee
642
-				iteminfo.ClabAmt = check_clab_amt
643
-				iteminfo.OthAmt = check_other_amt
644
-				iteminfoStructs = append(iteminfoStructs, iteminfo)
634
+		if checkCostTotal != 0 {
635
+			iteminfo.MedChrgitm = "03"
636
+			iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
637
+			iteminfo.Amt = checkCostTotal
638
+			iteminfo.ClaaSumfee = check_claa_sunmfee
639
+			iteminfo.ClabAmt = check_clab_amt
640
+			iteminfo.OthAmt = check_other_amt
641
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
645 642
 
646
-			}
643
+		}
647 644
 
648
-			if laboratoryCostTotal != 0 {
649
-				iteminfo.MedChrgitm = "04"
650
-				iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
651
-				iteminfo.Amt = laboratoryCostTotal
652
-				iteminfo.ClaaSumfee = laboratory_claa_sunmfee
653
-				iteminfo.ClabAmt = laboratory_clab_amt
654
-				iteminfo.OthAmt = laboratory_other_amt
655
-				iteminfoStructs = append(iteminfoStructs, iteminfo)
645
+		if laboratoryCostTotal != 0 {
646
+			iteminfo.MedChrgitm = "04"
647
+			iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
648
+			iteminfo.Amt = laboratoryCostTotal
649
+			iteminfo.ClaaSumfee = laboratory_claa_sunmfee
650
+			iteminfo.ClabAmt = laboratory_clab_amt
651
+			iteminfo.OthAmt = laboratory_other_amt
652
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
656 653
 
657
-				//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
654
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
658 655
 
659
-			}
656
+		}
660 657
 
661
-			if treatCostTotal != 0 {
662
-				iteminfo.MedChrgitm = "05"
663
-				iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
664
-				iteminfo.Amt = treatCostTotal
665
-				iteminfo.ClaaSumfee = treat_claa_sunmfee
666
-				iteminfo.ClabAmt = treat_clab_amt
667
-				iteminfo.OthAmt = treat_other_amt
668
-				iteminfoStructs = append(iteminfoStructs, iteminfo)
669
-				//(struct4101.IteminfoStruct, iteminfo)
670
-				//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
671
-			}
658
+		if treatCostTotal != 0 {
659
+			iteminfo.MedChrgitm = "05"
660
+			iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
661
+			iteminfo.Amt = treatCostTotal
662
+			iteminfo.ClaaSumfee = treat_claa_sunmfee
663
+			iteminfo.ClabAmt = treat_clab_amt
664
+			iteminfo.OthAmt = treat_other_amt
665
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
666
+			//(struct4101.IteminfoStruct, iteminfo)
667
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
668
+		}
672 669
 
673
-			if operationCostTotal != 0 {
674
-				iteminfo.MedChrgitm = "06"
675
-				iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
676
-				iteminfo.Amt = operationCostTotal
677
-				iteminfo.ClaaSumfee = operation_claa_sunmfee
678
-				iteminfo.ClabAmt = operation_clab_amt
679
-				iteminfo.OthAmt = operation_other_amt
680
-				//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
681
-				iteminfoStructs = append(iteminfoStructs, iteminfo)
682
-			}
670
+		if operationCostTotal != 0 {
671
+			iteminfo.MedChrgitm = "06"
672
+			iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
673
+			iteminfo.Amt = operationCostTotal
674
+			iteminfo.ClaaSumfee = operation_claa_sunmfee
675
+			iteminfo.ClabAmt = operation_clab_amt
676
+			iteminfo.OthAmt = operation_other_amt
677
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
678
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
679
+		}
683 680
 
684
-			if nursingCostTotal != 0 {
685
-				iteminfo.MedChrgitm = "07"
686
-				iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
687
-				iteminfo.Amt = nursingCostTotal
688
-				iteminfo.ClaaSumfee = nursing_claa_sunmfee
689
-				iteminfo.ClabAmt = nursing_clab_amt
690
-				iteminfo.OthAmt = nursing_other_amt
691
-				iteminfoStructs = append(iteminfoStructs, iteminfo)
692
-			}
681
+		if nursingCostTotal != 0 {
682
+			iteminfo.MedChrgitm = "07"
683
+			iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
684
+			iteminfo.Amt = nursingCostTotal
685
+			iteminfo.ClaaSumfee = nursing_claa_sunmfee
686
+			iteminfo.ClabAmt = nursing_clab_amt
687
+			iteminfo.OthAmt = nursing_other_amt
688
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
689
+		}
693 690
 
694
-			if materialCostTotal != 0 {
695
-				iteminfo.MedChrgitm = "08"
696
-				iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
697
-				iteminfo.Amt = materialCostTotal
698
-				iteminfo.ClaaSumfee = material_claa_sunmfee
699
-				iteminfo.ClabAmt = material_clab_amt
700
-				iteminfo.OthAmt = material_other_amt
701
-				//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
702
-				iteminfoStructs = append(iteminfoStructs, iteminfo)
703
-			}
691
+		if materialCostTotal != 0 {
692
+			iteminfo.MedChrgitm = "08"
693
+			iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
694
+			iteminfo.Amt = materialCostTotal
695
+			iteminfo.ClaaSumfee = material_claa_sunmfee
696
+			iteminfo.ClabAmt = material_clab_amt
697
+			iteminfo.OthAmt = material_other_amt
698
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
699
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
700
+		}
704 701
 
705
-			if westernMedicineCostTotal != 0 {
706
-				iteminfo.MedChrgitm = "09"
707
-				iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
708
-				iteminfo.Amt = westernMedicineCostTotal
709
-				iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
710
-				iteminfo.ClabAmt = westernMedicine_clab_amt
711
-				iteminfo.OthAmt = westernMedicine_other_amt
712
-				//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
713
-				iteminfoStructs = append(iteminfoStructs, iteminfo)
702
+		if westernMedicineCostTotal != 0 {
703
+			iteminfo.MedChrgitm = "09"
704
+			iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
705
+			iteminfo.Amt = westernMedicineCostTotal
706
+			iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
707
+			iteminfo.ClabAmt = westernMedicine_clab_amt
708
+			iteminfo.OthAmt = westernMedicine_other_amt
709
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
710
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
714 711
 
715
-			}
712
+		}
716 713
 
717
-			if chineseMedicineCostTotal != 0 {
718
-				iteminfo.MedChrgitm = "10"
719
-				iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
720
-				iteminfo.Amt = chineseMedicineCostTotal
721
-				iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
722
-				iteminfo.ClabAmt = chinese_medicine_clab_amt
723
-				iteminfo.OthAmt = chinese_medicine_other_amt
724
-				//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
725
-				iteminfoStructs = append(iteminfoStructs, iteminfo)
714
+		if chineseMedicineCostTotal != 0 {
715
+			iteminfo.MedChrgitm = "10"
716
+			iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
717
+			iteminfo.Amt = chineseMedicineCostTotal
718
+			iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
719
+			iteminfo.ClabAmt = chinese_medicine_clab_amt
720
+			iteminfo.OthAmt = chinese_medicine_other_amt
721
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
722
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
726 723
 
727
-			}
724
+		}
728 725
 
729
-			if chineseTraditionalMedicineCostTotal != 0 {
730
-				iteminfo.MedChrgitm = "11"
731
-				iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
732
-				iteminfo.Amt = westernMedicineCostTotal
733
-				iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
734
-				iteminfo.ClabAmt = westernMedicine_clab_amt
735
-				iteminfo.OthAmt = westernMedicine_other_amt
736
-				//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
737
-				iteminfoStructs = append(iteminfoStructs, iteminfo)
726
+		if chineseTraditionalMedicineCostTotal != 0 {
727
+			iteminfo.MedChrgitm = "11"
728
+			iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
729
+			iteminfo.Amt = westernMedicineCostTotal
730
+			iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
731
+			iteminfo.ClabAmt = westernMedicine_clab_amt
732
+			iteminfo.OthAmt = westernMedicine_other_amt
733
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
734
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
738 735
 
739
-			}
736
+		}
740 737
 
741
-			if commonlyTreatmentCostTotal != 0 {
742
-				iteminfo.MedChrgitm = "12"
743
-				iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
744
-				iteminfo.Amt = commonlyTreatmentCostTotal
745
-				iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
746
-				iteminfo.ClabAmt = commonly_treatment_clab_amt
747
-				iteminfo.OthAmt = commonly_treatment_other_amt
748
-				//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
749
-				iteminfoStructs = append(iteminfoStructs, iteminfo)
738
+		if commonlyTreatmentCostTotal != 0 {
739
+			iteminfo.MedChrgitm = "12"
740
+			iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
741
+			iteminfo.Amt = commonlyTreatmentCostTotal
742
+			iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
743
+			iteminfo.ClabAmt = commonly_treatment_clab_amt
744
+			iteminfo.OthAmt = commonly_treatment_other_amt
745
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
746
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
750 747
 
751
-			}
748
+		}
752 749
 
753
-			if registerCostTotal != 0 {
754
-				iteminfo.MedChrgitm = "13"
755
-				iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
756
-				iteminfo.Amt = registerCostTotal
757
-				iteminfo.ClaaSumfee = register_claa_sunmfee
758
-				iteminfo.ClabAmt = register_clab_amt
759
-				iteminfo.OthAmt = register_other_amt
760
-				//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
761
-				iteminfoStructs = append(iteminfoStructs, iteminfo)
750
+		if registerCostTotal != 0 {
751
+			iteminfo.MedChrgitm = "13"
752
+			iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
753
+			iteminfo.Amt = registerCostTotal
754
+			iteminfo.ClaaSumfee = register_claa_sunmfee
755
+			iteminfo.ClabAmt = register_clab_amt
756
+			iteminfo.OthAmt = register_other_amt
757
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
758
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
762 759
 
763
-			}
764
-
765
-			if otherCostTotal != 0 {
766
-				iteminfo.MedChrgitm = "14"
767
-				iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
768
-				iteminfo.Amt = otherCostTotal
769
-				iteminfo.ClaaSumfee = other_claa_sunmfee
770
-				iteminfo.ClabAmt = other_clab_amt
771
-				iteminfo.OthAmt = other_other_amt
772
-				//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
773
-				iteminfoStructs = append(iteminfoStructs, iteminfo)
760
+		}
774 761
 
775
-			}
762
+		if otherCostTotal != 0 {
763
+			iteminfo.MedChrgitm = "14"
764
+			iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
765
+			iteminfo.Amt = otherCostTotal
766
+			iteminfo.ClaaSumfee = other_claa_sunmfee
767
+			iteminfo.ClabAmt = other_clab_amt
768
+			iteminfo.OthAmt = other_other_amt
769
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
770
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
776 771
 
777 772
 		}
778 773
 
@@ -780,7 +775,6 @@ func GetBatchSettleList() {
780 775
 		time_arr := strings.Split(order.SetlTime, " ")
781 776
 		struct4101.AdmTime = time_arr[0]
782 777
 		struct4101.AdmEndTime = time_arr[0]
783
-
784 778
 		struct4101.DoctorName = doctor.UserName
785 779
 		struct4101.DoctorCode = doctor.DoctorNumber
786 780
 
@@ -835,9 +829,9 @@ func GetBatchSettleList() {
835 829
 			}
836 830
 
837 831
 		} else {
838
-			result := service.Gdyb4101(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
832
+			result, request := service.Gdyb4101For10106(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
839 833
 			fmt.Println(result)
840
-
834
+			saveLog(result, request, "4205", "自费就诊和诊断信息上传")
841 835
 			var dat map[string]interface{}
842 836
 			if err := json.Unmarshal([]byte(result), &dat); err == nil {
843 837
 				fmt.Println(dat)
@@ -856,7 +850,7 @@ func GetBatchSettleList() {
856 850
 					ErrMsg:    res.ErrMsg + "解析失败",
857 851
 					Status:    1,
858 852
 					PatientId: order_id,
859
-					Stage:     90000,
853
+					Stage:     50000,
860 854
 				}
861 855
 				service.CreateErrMsgLog(errlog)
862 856
 				continue
@@ -872,7 +866,7 @@ func GetBatchSettleList() {
872 866
 				ErrMsg:    res.ErrMsg,
873 867
 				Status:    1,
874 868
 				PatientId: order_id,
875
-				Stage:     90000,
869
+				Stage:     50000,
876 870
 			}
877 871
 			service.CreateErrMsgLog(errlog)
878 872
 			continue
@@ -892,6 +886,48 @@ func GetBatchSettleList() {
892 886
 	}
893 887
 }
894 888
 
889
+func saveLog(result string, request string, infno string, desc string) {
890
+
891
+	org_id, _ := beego.AppConfig.Int64("org_id")
892
+	miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
893
+	dir := miConfig.OrgName + "日志"
894
+	utils.Mkdir(dir)
895
+	month := time.Unix(1557042972, 0).Format("1")
896
+	year := time.Now().Format("2006")
897
+	month = time.Now().Format("01")
898
+	day := time.Now().Format("02")
899
+	hour := time.Now().Format("15")
900
+	min := time.Now().Format("04")
901
+	sec := time.Now().Format("05")
902
+
903
+	result_time := year + "-" + month + "-" + day + " " + hour + ":" + min + ":" + sec
904
+
905
+	file := strconv.FormatInt(org_id, 10) + "_" + year + month + day + "_log"
906
+	file_name := file + ".txt"
907
+	file_path := miConfig.OrgName + "日志" + "/" + file_name
908
+	exist, _ := utils.PathExists(file_path)
909
+	if exist { //存在
910
+		fmt.Println("存在")
911
+		f, err := os.OpenFile(file_path, os.O_WRONLY, 0644)
912
+		if err != nil {
913
+			fmt.Println("read fail")
914
+		}
915
+		content := "\r\n" + "\r\n" + "\r\n" + result_time + " " + "【 " + desc + infno + "入参" + " 】:" + "\r\n" + request + "\r\n" + result_time + " " + "【 " + desc + infno + "出参" + " 】:" + "\r\n" + result
916
+		n, _ := f.Seek(0, 2)
917
+		_, err = f.WriteAt([]byte(content), n)
918
+
919
+	} else { //不存在
920
+		fmt.Println("文件不存在,创建文件")
921
+		f, err := os.Create(miConfig.OrgName + "日志" + "/" + file_name)
922
+		defer f.Close()
923
+		if err != nil {
924
+		} else {
925
+			_, err = f.Write([]byte("记录日志"))
926
+		}
927
+	}
928
+
929
+}
930
+
895 931
 //func UploadSettleList(org_id int64) {
896 932
 //	orders, _ := service.GetAllHisOrder(org_id)
897 933
 //	for _, item := range orders {

+ 6 - 6
models/drug.go Datei anzeigen

@@ -63,12 +63,12 @@ type BaseDrugLib struct {
63 63
 	HospApprFlag                int64   `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
64 64
 	LmtUsedFlag                 int64   `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
65 65
 
66
-	MinNumber int64 `gorm:"column:min_number" json:"min_number" form:"min_number"`
67
-	//Dose      string  `gorm:"column:dose" json:"dose" form:"dose"`
68
-	DoseUnit string  `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
69
-	DrugDay  string  `gorm:"column:drug_day" json:"drug_day" form:"drug_day"`
70
-	MinPrice float64 `gorm:"column:min_price" json:"min_price" form:"min_price"`
71
-	IsUser   int64   `gorm:"column:is_user" json:"is_user" form:"is_user"`
66
+	MinNumber int64   `gorm:"column:min_number" json:"min_number" form:"min_number"`
67
+	Dose      string  `gorm:"column:dose" json:"dose" form:"dose"`
68
+	DoseUnit  string  `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
69
+	DrugDay   string  `gorm:"column:drug_day" json:"drug_day" form:"drug_day"`
70
+	MinPrice  float64 `gorm:"column:min_price" json:"min_price" form:"min_price"`
71
+	IsUser    int64   `gorm:"column:is_user" json:"is_user" form:"is_user"`
72 72
 
73 73
 	//MedicineInsurancePercentage []*MedicineInsurancePercentage `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
74 74
 }

+ 116 - 0
models/his_models.go Datei anzeigen

@@ -1713,3 +1713,119 @@ type Item struct {
1713 1713
 	Vaf58  string `json:"vaf58"`
1714 1714
 	Vaf61  string `json:"vaf61"`
1715 1715
 }
1716
+type NewHisOrder111 struct {
1717
+	ID                      int64     `gorm:"column:id" json:"id" form:"id"`
1718
+	UserOrgId               int64     `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1719
+	HisPatientId            int64     `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
1720
+	SettleAccountsDate      int64     `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
1721
+	Ctime                   int64     `gorm:"column:ctime" json:"ctime" form:"ctime"`
1722
+	Mtime                   int64     `gorm:"column:mtime" json:"mtime" form:"mtime"`
1723
+	Status                  int64     `gorm:"column:status" json:"status" form:"status"`
1724
+	Number                  string    `gorm:"column:number" json:"number" form:"number"`
1725
+	PatientId               int64     `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1726
+	Infcode                 int64     `gorm:"column:infcode" json:"infcode" form:"infcode"`
1727
+	WarnMsg                 string    `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
1728
+	Cainfo                  string    `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
1729
+	ErrMsg                  string    `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
1730
+	RespondTime             string    `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
1731
+	InfRefmsgid             string    `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
1732
+	OrderStatus             int64     `gorm:"column:order_status" json:"order_status" form:"order_status"`
1733
+	MdtrtId                 string    `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
1734
+	SetlId                  string    `gorm:"column:setl_id" json:"setl_id" form:"setl_id"`
1735
+	PsnNo                   string    `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
1736
+	PsnName                 string    `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
1737
+	PsnCertType             string    `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
1738
+	Certno                  string    `gorm:"column:certno" json:"certno" form:"certno"`
1739
+	Gend                    string    `gorm:"column:gend" json:"gend" form:"gend"`
1740
+	Naty                    string    `gorm:"column:naty" json:"naty" form:"naty"`
1741
+	Brdy                    time.Time `gorm:"column:brdy" json:"brdy" form:"brdy"`
1742
+	Age                     float64   `gorm:"column:age" json:"age" form:"age"`
1743
+	Insutype                string    `gorm:"column:insutype" json:"insutype" form:"insutype"`
1744
+	PsnType                 string    `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
1745
+	CvlservFlag             string    `gorm:"column:cvlserv_flag" json:"cvlserv_flag" form:"cvlserv_flag"`
1746
+	SetlTime                string    `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
1747
+	MdtrtCertType           string    `gorm:"column:mdtrt_cert_type" json:"mdtrt_cert_type" form:"mdtrt_cert_type"`
1748
+	MedType                 string    `gorm:"column:med_type" json:"med_type" form:"med_type"`
1749
+	MedfeeSumamt            float64   `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
1750
+	FulamtOwnpayAmt         float64   `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
1751
+	OverlmtSelfPay          float64   `gorm:"column:overlmt_self_pay" json:"overlmt_self_pay" form:"overlmt_self_pay"`
1752
+	PreselfpayAmt           float64   `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
1753
+	InscpScpAmt             float64   `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
1754
+	ActPayDedc              float64   `gorm:"column:act_pay_dedc" json:"act_pay_dedc" form:"act_pay_dedc"`
1755
+	HifpPay                 float64   `gorm:"column:hifp_pay" json:"hifp_pay" form:"hifp_pay"`
1756
+	CvlservPay              float64   `gorm:"column:cvlserv_pay" json:"cvlserv_pay" form:"cvlserv_pay"`
1757
+	PoolPropSelfpay         float64   `gorm:"column:pool_prop_selfpay" json:"pool_prop_selfpay" form:"pool_prop_selfpay"`
1758
+	HifesPay                float64   `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
1759
+	HifmiPay                float64   `gorm:"column:hifmi_pay" json:"hifmi_pay" form:"hifmi_pay"`
1760
+	HifobPay                float64   `gorm:"column:hifob_pay" json:"hifob_pay" form:"hifob_pay"`
1761
+	MafPay                  float64   `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
1762
+	OthPay                  float64   `gorm:"column:oth_pay" json:"oth_pay" form:"oth_pay"`
1763
+	FundPaySumamt           float64   `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
1764
+	PsnPartAmt              float64   `gorm:"column:psn_part_amt" json:"psn_part_amt" form:"psn_part_amt"`
1765
+	AcctPay                 float64   `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
1766
+	PsnCashPay              float64   `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
1767
+	HospPartAmt             float64   `gorm:"column:hosp_part_amt" json:"hosp_part_amt" form:"hosp_part_amt"`
1768
+	Balc                    float64   `gorm:"column:balc" json:"balc" form:"balc"`
1769
+	AcctMulaidPay           float64   `gorm:"column:acct_mulaid_pay" json:"acct_mulaid_pay" form:"acct_mulaid_pay"`
1770
+	MedinsSetlId            string    `gorm:"column:medins_setl_id" json:"medins_setl_id" form:"medins_setl_id"`
1771
+	ClrOptins               string    `gorm:"column:clr_optins" json:"clr_optins" form:"clr_optins"`
1772
+	ClrWay                  string    `gorm:"column:clr_way" json:"clr_way" form:"clr_way"`
1773
+	ClrType                 string    `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
1774
+	SetlDetail              string    `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
1775
+	IsMedicineInsurance     int64     `gorm:"column:is_medicine_insurance" json:"is_medicine_insurance" form:"is_medicine_insurance"`
1776
+	PayWay                  int64     `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
1777
+	PayPrice                float64   `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
1778
+	PayCardNo               string    `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
1779
+	DiscountPrice           float64   `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
1780
+	PreferentialPrice       float64   `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
1781
+	RealityPrice            float64   `gorm:"column:reality_price" json:"reality_price" form:"reality_price"`
1782
+	FoundPrice              float64   `gorm:"column:found_price" json:"found_price" form:"found_price"`
1783
+	MedicalInsurancePrice   float64   `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
1784
+	PrivatePrice            float64   `gorm:"column:private_price" json:"private_price" form:"private_price"`
1785
+	Creator                 int64     `gorm:"column:creator" json:"creator" form:"creator"`
1786
+	Modify                  int64     `gorm:"column:modify" json:"modify" form:"modify"`
1787
+	AccountPrice            float64   `gorm:"column:account_price" json:"account_price" form:"account_price"`
1788
+	PayWays                 string    `gorm:"column:pay_ways" json:"pay_way" form:"pay_ways"`
1789
+	SzChargeInfo            string    `gorm:"column:sz_charge_info" json:"sz_charge_info" form:"sz_charge_info"`
1790
+	SzProjectInfo           string    `gorm:"column:sz_project_info" json:"sz_project_info" form:"sz_project_info"`
1791
+	SzMedicineInsuranceInfo string    `gorm:"column:sz_medicine_insurance_info" json:"sz_medicine_insurance_info" form:"sz_medicine_insurance_info"`
1792
+	YiliaoNumber            string    `gorm:"column:yiliao_number" json:"yiliao_number" form:"yiliao_number"`
1793
+	OthDesc                 string    `gorm:"column:oth_desc" json:"oth_desc" form:"oth_desc"`
1794
+
1795
+	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
1796
+	FaPiaoNumber string `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
1797
+
1798
+	MzNumber      string `gorm:"column:mz_number" json:"mz_number" form:"mz_number"`
1799
+	OrgSetlNumber string `gorm:"column:org_setl_number" json:"org_setl_number" form:"org_setl_number"`
1800
+
1801
+	SettleType      int64 `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
1802
+	SettleStartTime int64 `gorm:"column:settle_start_time" json:"settle_start_time" form:"settle_start_time"`
1803
+	SettleEndTime   int64 `gorm:"column:settle_end_time" json:"settle_end_time" form:"settle_end_time"`
1804
+
1805
+	RefundLog string `gorm:"column:refund_log" json:"refund_log" form:"refund_log"`
1806
+	DetailLog string `gorm:"column:detail_log" json:"detail_log" form:"detail_log"`
1807
+
1808
+	RequestLog       string `gorm:"column:request_log" json:"request_log" form:"request_log"`
1809
+	RefundRequestLog string `gorm:"column:refund_request_log" json:"refund_request_log" form:"refund_request_log"`
1810
+
1811
+	PType   int64   `gorm:"column:p_type" json:"p_type" form:"p_type"`
1812
+	IsPre   int64   `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
1813
+	Decimal float64 `gorm:"column:decimal" json:"decimal" form:"decimal"`
1814
+
1815
+	Diagnosis string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
1816
+
1817
+	AcctUsedFlag string `gorm:"column:acct_used_flag" json:"acct_used_flag" form:"acct_used_flag"`
1818
+	CashPay      string `gorm:"cash_pay" json:"cash_pay" form:"cash_pay"`
1819
+	BandCardPay  string `gorm:"band_card_pay" json:"band_card_pay" form:"band_card_pay"`
1820
+	WechatPay    string `gorm:"wechat_pay" json:"wechat_pay" form:"wechat_pay"`
1821
+	AliPay       string `gorm:"ali_pay" json:"ali_pay" form:"ali_pay"`
1822
+	JifenPay     string `gorm:"jifen_pay" json:"jifen_pay" form:"jifen_pay"`
1823
+
1824
+	IsUploadDiagnose  int64 `gorm:"column:is_upload_diagnose" json:"is_upload_diagnose" form:"is_upload_diagnose"`
1825
+	IsUploadOrderInfo int64 `gorm:"column:is_upload_order_info" json:"is_upload_order_info" form:"is_upload_order_info"`
1826
+	IsUploadSuccess   int64 `gorm:"column:is_upload_success" json:"is_upload_success" form:"is_upload_success"`
1827
+}
1828
+
1829
+func (NewHisOrder111) TableName() string {
1830
+	return "his_order"
1831
+}

+ 1 - 1
models/yb_models.go Datei anzeigen

@@ -9,7 +9,7 @@ type Result3260 struct {
9 9
 			Certno          string  `json:"certno"`
10 10
 			MdtrtId         string  `json:"mdtrt_id"`
11 11
 			MdtrtSetlTime   string  `json:"mdtrt_setl_time"`
12
-			SetlNo          string  `json:"setl_no"`
12
+			SetlSn          string  `json:"setl_sn"`
13 13
 			MedfeeSumamt    float64 `json:"medfee_sumamt"`
14 14
 			OptinsPaySumamt float64 `json:"optins_pay_sumamt"`
15 15
 		} `json:"data"`

+ 18 - 18
service/fj_service.go Datei anzeigen

@@ -30,7 +30,7 @@ import (
30 30
 
31 31
 //
32 32
 // 人员基本信息
33
-func FJyb1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, id_card_type int64, card_sn string, certificates int64, url string, app_id string, app_secret string, sign_key string, enc_key string, name string) (string, string, string) {
33
+func FJyb1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, id_card_type int64, card_sn string, certificates int64, url string, app_id string, app_secret string, sign_key string, enc_key string, name string, id_card_no string) (string, string, string) {
34 34
 	//生成签名
35 35
 	nonce := GetRandomString(32)
36 36
 	timestamp := time.Now().Unix()
@@ -67,7 +67,7 @@ func FJyb1101(certNo string, org_name string, doctor string, fixmedins_code stri
67 67
 
68 68
 		}
69 69
 	}
70
-	inputData["certno"] = certNo // 证件号码
70
+	inputData["certno"] = id_card_no // 证件号码
71 71
 
72 72
 	inputData["begntime"] = ""   // 开始时间
73 73
 	inputData["psn_name"] = name // 人员姓名
@@ -552,7 +552,7 @@ func FJyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, d
552 552
 }
553 553
 
554 554
 //  门诊预结算
555
-func FJyb2206(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, url string, app_id string, app_secret string, sign_key string, enc_key string) (string, string, string) {
555
+func FJyb2206(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, url string, app_id string, app_secret string, sign_key string, enc_key string, acct_used_flag string) (string, string, string) {
556 556
 
557 557
 	// 生成签名
558 558
 	nonce := GetRandomString(32)
@@ -593,13 +593,13 @@ func FJyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
593 593
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
594 594
 	}
595 595
 
596
-	inputData["medfee_sumamt"] = total  // 医疗费总额
597
-	inputData["psn_setlway"] = "01"     // 个人结算方式 01 按项目结 02 按定额结算
598
-	inputData["mdtrt_id"] = mdtrtId     // 就诊 ID(来自2201接口返回)
599
-	inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
600
-	inputData["acct_used_flag"] = "0"   // 个人账户使用标志 0否 1是
601
-	inputData["insutype"] = insutype    // 险种类型
602
-	inputData["invono"] = ""            // 发票号
596
+	inputData["medfee_sumamt"] = total           // 医疗费总额
597
+	inputData["psn_setlway"] = "01"              // 个人结算方式 01 按项目结 02 按定额结算
598
+	inputData["mdtrt_id"] = mdtrtId              // 就诊 ID(来自2201接口返回)
599
+	inputData["chrg_bchno"] = chrgBchno          // 收费批次号(来自2204生成的)
600
+	inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
601
+	inputData["insutype"] = insutype             // 险种类型
602
+	inputData["invono"] = ""                     // 发票号
603 603
 
604 604
 	inputData2 := make(map[string]interface{})
605 605
 	inputData2["trum_flag"] = "0"
@@ -628,7 +628,7 @@ func FJyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
628 628
 	return output, requestLog, err_msg
629 629
 }
630 630
 
631
-func FJyb2206ForToken(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, url string, app_id string, app_secret string, sign_key string, enc_key string) (string, string, string) {
631
+func FJyb2206ForToken(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, url string, app_id string, app_secret string, sign_key string, enc_key string, acct_used_flag string) (string, string, string) {
632 632
 
633 633
 	// 生成签名
634 634
 	nonce := GetRandomString(32)
@@ -673,13 +673,13 @@ func FJyb2206ForToken(psnNo string, mdtrtId string, chrgBchno string, certNo str
673 673
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
674 674
 	}
675 675
 
676
-	inputData["medfee_sumamt"] = total  // 医疗费总额
677
-	inputData["psn_setlway"] = "01"     // 个人结算方式 01 按项目结 02 按定额结算
678
-	inputData["mdtrt_id"] = mdtrtId     // 就诊 ID(来自2201接口返回)
679
-	inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
680
-	inputData["acct_used_flag"] = "0"   // 个人账户使用标志 0否 1是
681
-	inputData["insutype"] = insutype    // 险种类型
682
-	inputData["invono"] = ""            // 发票号
676
+	inputData["medfee_sumamt"] = total           // 医疗费总额
677
+	inputData["psn_setlway"] = "01"              // 个人结算方式 01 按项目结 02 按定额结算
678
+	inputData["mdtrt_id"] = mdtrtId              // 就诊 ID(来自2201接口返回)
679
+	inputData["chrg_bchno"] = chrgBchno          // 收费批次号(来自2204生成的)
680
+	inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
681
+	inputData["insutype"] = insutype             // 险种类型
682
+	inputData["invono"] = ""                     // 发票号
683 683
 
684 684
 	input["data"] = inputData
685 685
 	inputMessage["input"] = input //交易输入

+ 410 - 65
service/gdyb_service.go Datei anzeigen

@@ -1221,6 +1221,7 @@ func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
1221 1221
 	inputData["acct_used_flag"] = "0"   // 个人账户使用标志 0否 1是
1222 1222
 	inputData["insutype"] = insutype    // 险种类型
1223 1223
 	inputData["invono"] = ""            // 发票号
1224
+	inputData["dise_codg"] = "M07803"   // 发票号
1224 1225
 
1225 1226
 	input["data"] = inputData
1226 1227
 	inputMessage["input"] = input //交易输入
@@ -2883,7 +2884,7 @@ type Struct4101 struct {
2883 2884
 }
2884 2885
 
2885 2886
 //
2886
-func Gdyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, org_id int64) string {
2887
+func Gdyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, org_id int64) (string, string) {
2887 2888
 	// 生成签名
2888 2889
 	nonce := GetRandomString(32)
2889 2890
 	timestamp := time.Now().Unix()
@@ -2950,12 +2951,13 @@ func Gdyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor
2950 2951
 	inputData["opsp_mdtrt_date"] = ""                         // 门诊慢特病就诊日期  必填
2951 2952
 	inputData["ipt_med_type"] = ""                            // 住院医疗类型  必填
2952 2953
 	inputData["adm_way"] = ""                                 // 入院途径  必填
2953
-	inputData["trt_type"] = ""                                // 治疗类别  必填
2954
+	inputData["trt_type"] = "10"                              // 治疗类别  必填
2954 2955
 	inputData["adm_time"] = ""                                // 入院时间  必填
2955
-	inputData["adm_caty"] = ""                                // 入院科别  必填
2956
+	inputData["adm_caty"] = "A03.06"                          // 入院科别  必填
2956 2957
 	inputData["refldept_dept"] = ""                           // 转科科别  必填
2957 2958
 	inputData["dscg_time"] = ""                               // 出院时间  必填
2958
-	inputData["dscg_caty"] = ""                               // 出院科别  必填
2959
+	inputData["dscg_caty"] = "A03.06"                         // 出院科别  必填
2960
+	inputData["caty"] = "A03.06"                              // 出院科别  必填
2959 2961
 	inputData["act_ipt_days"] = ""                            // 实际住院天数  必填
2960 2962
 	inputData["otp_wm_dise"] = ""                             // 门(急) 诊西医诊断  必填
2961 2963
 	inputData["wm_dise_code"] = ""                            // 门(急) 诊中医诊断  必填
@@ -3057,7 +3059,7 @@ func Gdyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor
3057 3059
 
3058 3060
 	input["setlinfo"] = inputData
3059 3061
 	input["payinfo"] = payinfo
3060
-	//input["opspdiseinfo"] = opspdiseinfo
3062
+	input["opspdiseinfo"] = opspdiseinfo
3061 3063
 	input["diseinfo"] = diseinfo
3062 3064
 	input["iteminfo"] = iteminfo
3063 3065
 	inputMessage["input"] = input //交易输入
@@ -3066,7 +3068,7 @@ func Gdyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor
3066 3068
 	fmt.Println(string(bytesData))
3067 3069
 	if err != nil {
3068 3070
 		fmt.Println(err.Error())
3069
-		return err.Error()
3071
+		return err.Error(), ""
3070 3072
 	}
3071 3073
 	reader := bytes.NewReader(bytesData)
3072 3074
 
@@ -3087,7 +3089,7 @@ func Gdyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor
3087 3089
 	request, err := http.NewRequest("POST", url, reader)
3088 3090
 	if err != nil {
3089 3091
 		fmt.Println(err.Error())
3090
-		return err.Error()
3092
+		return err.Error(), ""
3091 3093
 	}
3092 3094
 
3093 3095
 	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
@@ -3100,16 +3102,233 @@ func Gdyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor
3100 3102
 	resp, err := client.Do(request)
3101 3103
 	if err != nil {
3102 3104
 		fmt.Println(err.Error())
3103
-		return err.Error()
3105
+		return err.Error(), ""
3104 3106
 	}
3105 3107
 	respBytes, err := ioutil.ReadAll(resp.Body)
3106 3108
 	if err != nil {
3107 3109
 		fmt.Println(err.Error())
3108
-		return err.Error()
3110
+		return err.Error(), ""
3109 3111
 	}
3110 3112
 	str := string(respBytes)
3111 3113
 	fmt.Println(str)
3112
-	return str
3114
+	return str, string(bytesData)
3115
+}
3116
+
3117
+func Gdyb4101For10106(struct4101 Struct4101, secret_key string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, org_id int64) (string, string) {
3118
+	// 生成签名
3119
+	nonce := GetRandomString(32)
3120
+	timestamp := time.Now().Unix()
3121
+	signature := setSignature(timestamp, nonce, secret_key)
3122
+
3123
+	// 生成输入报文
3124
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
3125
+	input := make(map[string]interface{})
3126
+	inputData := make(map[string]interface{})
3127
+	inputMessage["infno"] = "4101A" // 交易编码
3128
+
3129
+	year := time.Now().Format("2006")
3130
+	month := time.Now().Format("01")
3131
+	day := time.Now().Format("02")
3132
+
3133
+	inputData["mdtrt_id"] = struct4101.MdtrtId // 就诊 ID  必填(来自2201接口返回)
3134
+	inputData["setl_id"] = struct4101.SetlId   // 结算 ID  必填
3135
+	inputData["psn_no"] = struct4101.PsnNo     // 结算 ID  必填
3136
+
3137
+	inputData["fixmedins_name"] = org_name                    // 定点医药机构名称  必填
3138
+	inputData["fixmedins_code"] = fixmedins_code              // 定点医药机构编码  必填
3139
+	inputData["hi_setl_lv"] = ""                              // 医保结算等级
3140
+	inputData["hi_no"] = struct4101.PsnNo                     // 医保编号
3141
+	inputData["medcasno"] = struct4101.PsnNo                  // 病案号  必填
3142
+	inputData["dcla_time"] = year + "-" + month + "-" + day   // 申报时间  必填
3143
+	inputData["psn_name"] = struct4101.PsnName                // 人员姓名  必填
3144
+	inputData["gend"] = struct4101.Gend                       // 性别  必填
3145
+	inputData["brdy"] = struct4101.Brdy                       // 出生日期  必填
3146
+	inputData["age"] = struct4101.Age                         // 年龄  必填
3147
+	inputData["ntly"] = struct4101.Ntly                       // 国籍  必填
3148
+	inputData["nwb_age"] = ""                                 // 年龄  必填
3149
+	inputData["naty"] = struct4101.Naty                       // 民族  必填
3150
+	inputData["patn_cert_type"] = struct4101.PatnCertType     // 患者证件类别  必填
3151
+	inputData["certno"] = struct4101.Certno                   // 证件号码  必填
3152
+	inputData["prfs"] = struct4101.Prfs                       // 职业  必填
3153
+	inputData["curr_addr"] = ""                               // 现住址  必填
3154
+	inputData["emp_name"] = ""                                // 单位名称  必填
3155
+	inputData["emp_addr"] = ""                                // 单位地址  必填
3156
+	inputData["emp_tel"] = ""                                 // 单位电话  必填
3157
+	inputData["poscode"] = ""                                 // 邮编  必填
3158
+	inputData["coner_name"] = struct4101.ConerName            // 联系人姓名  必填
3159
+	inputData["patn_rlts"] = struct4101.PatnRlts              // 与患者关系  必填
3160
+	inputData["coner_addr"] = struct4101.ConerAddr            // 联系人地址  必填
3161
+	inputData["coner_tel"] = struct4101.ConerTel              // 联系人电话  必填
3162
+	inputData["hi_type"] = struct4101.HiType                  // 医保类型  必填
3163
+	inputData["insuplc"] = struct4101.Insuplc                 // 参保地  必填
3164
+	inputData["sp_psn_type"] = ""                             // 特殊人员类型  必填
3165
+	inputData["nwb_adm_type"] = ""                            // 新生儿入院类型  必填
3166
+	inputData["nwb_bir_wt"] = ""                              // 新生儿出生体重  必填
3167
+	inputData["nwb_adm_wt"] = ""                              // 新生儿入院体重  必填
3168
+	inputData["opsp_diag_caty"] = ""                          // 门诊慢特病诊断  必填
3169
+	inputData["opsp_mdtrt_date"] = ""                         // 门诊慢特病就诊日期  必填
3170
+	inputData["ipt_med_type"] = ""                            // 住院医疗类型  必填
3171
+	inputData["adm_way"] = ""                                 // 入院途径  必填
3172
+	inputData["trt_type"] = "10"                              // 治疗类别  必填
3173
+	inputData["adm_time"] = struct4101.AdmTime                // 入院时间  必填
3174
+	inputData["adm_caty"] = struct4101.AdmCaty                // 入院科别  必填
3175
+	inputData["refldept_dept"] = ""                           // 转科科别  必填
3176
+	inputData["dscg_time"] = struct4101.AdmEndTime            // 出院时间  必填
3177
+	inputData["dscg_caty"] = struct4101.DscgCaty              // 出院科别  必填
3178
+	inputData["act_ipt_days"] = ""                            // 实际住院天数  必填
3179
+	inputData["otp_wm_dise"] = ""                             // 门(急) 诊西医诊断  必填
3180
+	inputData["wm_dise_code"] = ""                            // 门(急) 诊中医诊断  必填
3181
+	inputData["otp_tcm_dise"] = ""                            // 西医诊断疾病代码  必填
3182
+	inputData["tcm_dise_code"] = ""                           // 中医诊断代码  必填
3183
+	inputData["oprn_oprt_code_cnt"] = ""                      // 手术操作代码计数  必填
3184
+	inputData["vent_used_dura"] = ""                          // 呼吸机使用时长  必填
3185
+	inputData["pwcry_bfadm_coma_dura"] = ""                   // 颅脑损伤患者入院前昏迷时长  必填
3186
+	inputData["pwcry_afadm_coma_dura"] = ""                   // 颅脑损伤患者入院后昏迷时长  必填
3187
+	inputData["bld_cat"] = ""                                 // 输血品种  必填
3188
+	inputData["bld_amt"] = ""                                 // 输血量  必填
3189
+	inputData["bld_unt"] = ""                                 // 输血计量单位  必填
3190
+	inputData["spga_nurscare_days"] = ""                      // 特级护理天数  必填
3191
+	inputData["lv1_nurscare_days"] = ""                       // 一级护理天数  必填
3192
+	inputData["scd_nurscare_days"] = ""                       // 二级护理天数  必填
3193
+	inputData["lv3_nurscare_days"] = ""                       // 三级护理天数  必填
3194
+	inputData["acp_medins_name"] = ""                         // 拟接收机构名称  必填
3195
+	inputData["acp_optins_code"] = ""                         // 拟接收机构代码  必填
3196
+	inputData["bill_code"] = struct4101.BillCode              // 票据代码  必填
3197
+	inputData["bill_no"] = struct4101.BillNo                  // 票据号码  必填
3198
+	inputData["biz_sn"] = struct4101.BizSn                    // 业务流水号  必填
3199
+	inputData["days_rinp_flag_31"] = ""                       // 出院 31 天内再住院计划标志  必填
3200
+	inputData["days_rinp_pup_31"] = ""                        // 出院 31 天内再住院目的  必填
3201
+	inputData["chfpdr_name"] = struct4101.DoctorName          // 主诊医师姓名  必填
3202
+	inputData["chfpdr_code"] = struct4101.DoctorCode          // 主诊医师代码  必填
3203
+	inputData["setl_begn_date"] = struct4101.SetlBegnDate     // 结算开始日期  必填
3204
+	inputData["setl_end_date"] = struct4101.SetlEndDate       // 结算结束日期  必填
3205
+	inputData["psn_selfpay"] = struct4101.PsnSelfPay          // 个人自付  必填
3206
+	inputData["psn_ownpay"] = struct4101.PsnOwnPay            // 个人自费  必填
3207
+	inputData["acct_pay"] = struct4101.AcctPay                // 个人账户支出  必填
3208
+	inputData["hi_paymtd"] = struct4101.HiPaymtd              // 医保支付方式  必填
3209
+	inputData["hsorg"] = struct4101.Hsorg                     // 医保机构  必填
3210
+	inputData["hsorg_opter"] = struct4101.HsorgOpter          // 医保机构经办人  必填
3211
+	inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门  必填
3212
+	inputData["medins_fill_psn"] = struct4101.MedinsFillPsn   // 医疗机构填报人  必填
3213
+	inputData["psn_cashpay"] = struct4101.PsnCashpay          // 医疗机构填报人  必填
3214
+
3215
+	payinfo := make([]map[string]interface{}, 0) // 基金支付信息
3216
+	for _, item := range struct4101.CustomStruct {
3217
+		payinfotemp := make(map[string]interface{})
3218
+		if item.FundPayType == "310100" || item.FundPayType == "310200" || item.FundPayType == "320100" || item.FundPayType == "330100" || item.FundPayType == "340100" || item.FundPayType == "350100" || item.FundPayType == "370100" || item.FundPayType == "390100" || item.FundPayType == "610100" || item.FundPayType == "640100" || item.FundPayType == "620100" {
3219
+			payinfotemp["fund_pay_type"] = item.FundPayType // 基金支付类型  必填
3220
+			payinfotemp["fund_payamt"] = item.FundPayamt    // 基金支付金额
3221
+			payinfo = append(payinfo, payinfotemp)
3222
+		}
3223
+	}
3224
+	opspdiseinfo := make([]map[string]interface{}, 0) // 门诊慢特病诊断信息
3225
+
3226
+	opspdiseinfotemp := make(map[string]interface{})
3227
+	opspdiseinfotemp["diag_name"] = struct4101.Diseinfo[len(struct4101.Diseinfo)-1].DiagName // 诊断名称  必填
3228
+	opspdiseinfotemp["diag_code"] = struct4101.Diseinfo[len(struct4101.Diseinfo)-1].DiagCode // 诊断代码 必填
3229
+	opspdiseinfotemp["oprn_oprt_name"] = "血液透析"                                              // 手术操作名称 必填
3230
+	opspdiseinfotemp["oprn_oprt_code"] = "39.9500"                                           // 手术操作代码 必填
3231
+	opspdiseinfo = append(opspdiseinfo, opspdiseinfotemp)
3232
+
3233
+	diseinfo := make([]map[string]interface{}, 0) // 住院诊断信息
3234
+	for _, item := range struct4101.Diseinfo {
3235
+		diseinfotemp := make(map[string]interface{})
3236
+		diseinfotemp["maindiag_flag"] = item.MaindiagFlag // 手术操作代码 必填
3237
+		diseinfotemp["diag_type"] = item.DiagType         // 诊断类别  必填
3238
+		diseinfotemp["diag_code"] = item.DiagCode         // 诊断代码 必填
3239
+		diseinfotemp["diag_name"] = item.DiagName         // 诊断名称 必填
3240
+		diseinfotemp["adm_cond_type"] = "3"               // 入院病情类型 必填
3241
+		diseinfo = append(diseinfo, diseinfotemp)
3242
+	}
3243
+
3244
+	iteminfo := make([]map[string]interface{}, 0)
3245
+	for _, item := range struct4101.IteminfoStruct {
3246
+		iteminfotemp := make(map[string]interface{})
3247
+		iteminfotemp["med_chrgitm"] = item.MedChrgitm            // 医疗收费项目  必填
3248
+		iteminfotemp["amt"] = item.Amt                           // 金额 必填
3249
+		iteminfotemp["claa_sumfee"] = item.ClaaSumfee            // 甲类费用合计 必填
3250
+		iteminfotemp["clab_amt"] = item.ClabAmt                  // 乙类金额 必填
3251
+		iteminfotemp["fulamt_ownpay_amt"] = item.FulamtOwnpayAmt // 全自费金额 必填
3252
+		iteminfotemp["oth_amt"] = item.OthAmt                    // 其他金额 必填
3253
+		iteminfo = append(iteminfo, iteminfotemp)
3254
+	}
3255
+
3256
+	oprninfo := make([]map[string]interface{}, 0) // 手术操作信息
3257
+	oprninfotemp := make(map[string]interface{})
3258
+	oprninfotemp["oprn_oprt_type"] = "" // 手术操作类别  必填
3259
+	oprninfotemp["oprn_oprt_name"] = "" // 手术操作名称 必填
3260
+	oprninfotemp["oprn_oprt_code"] = "" // 手术操作代码 必填
3261
+	oprninfotemp["oprn_oprt_date"] = "" // 手术操作日期 必填
3262
+	oprninfotemp["anst_way"] = ""       // 麻醉方式 必填
3263
+	oprninfotemp["oper_dr_name"] = ""   // 术者医师姓名 必填
3264
+	oprninfotemp["oper_dr_code"] = ""   // 术者医师代码 必填
3265
+	oprninfotemp["anst_dr_name"] = ""   // 麻醉医师姓名 必填
3266
+	oprninfotemp["anst_dr_code"] = ""   // 麻醉医师代码 必填
3267
+	oprninfo = append(oprninfo, oprninfotemp)
3268
+
3269
+	icuinfo := make([]map[string]interface{}, 0) // 重症监护信息
3270
+	icuinfotemp := make(map[string]interface{})
3271
+	icuinfotemp["scs_cutd_ward_type"] = ""   // 重症监护病房类型  必填
3272
+	icuinfotemp["scs_cutd_inpool_time"] = "" // 重症监护进入时间 必填
3273
+	icuinfotemp["scs_cutd_exit_time"] = ""   // 重症监护退出时间 必填
3274
+	icuinfotemp["scs_cutd_sum_dura"] = ""    // 重症监护合计时长 必填
3275
+	icuinfo = append(icuinfo, icuinfotemp)
3276
+
3277
+	input["setlinfo"] = inputData
3278
+	input["payinfo"] = payinfo
3279
+	input["opspdiseinfo"] = opspdiseinfo
3280
+	input["diseinfo"] = diseinfo
3281
+	input["iteminfo"] = iteminfo
3282
+	inputMessage["input"] = input //交易输入
3283
+
3284
+	bytesData, err := json.Marshal(inputMessage)
3285
+	fmt.Println(string(bytesData))
3286
+	if err != nil {
3287
+		fmt.Println(err.Error())
3288
+		return err.Error(), ""
3289
+	}
3290
+	reader := bytes.NewReader(bytesData)
3291
+
3292
+	gdyb_url := beego.AppConfig.String("gdyb_url")
3293
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
3294
+	//url := gdyb_url + "4101"
3295
+
3296
+	var url string
3297
+	if fixmedins_code == "H15049901371" {
3298
+		url = gdyb_url
3299
+	} else {
3300
+
3301
+		url = gdyb_url + "4101A"
3302
+
3303
+	}
3304
+
3305
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/4101"
3306
+	request, err := http.NewRequest("POST", url, reader)
3307
+	if err != nil {
3308
+		fmt.Println(err.Error())
3309
+		return err.Error(), ""
3310
+	}
3311
+
3312
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
3313
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
3314
+	request.Header.Set("x-tif-signature", signature)
3315
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
3316
+	request.Header.Set("x-tif-nonce", nonce)
3317
+
3318
+	client := http.Client{}
3319
+	resp, err := client.Do(request)
3320
+	if err != nil {
3321
+		fmt.Println(err.Error())
3322
+		return err.Error(), ""
3323
+	}
3324
+	respBytes, err := ioutil.ReadAll(resp.Body)
3325
+	if err != nil {
3326
+		fmt.Println(err.Error())
3327
+		return err.Error(), ""
3328
+	}
3329
+	str := string(respBytes)
3330
+	fmt.Println(str)
3331
+	return str, string(bytesData)
3113 3332
 }
3114 3333
 
3115 3334
 //func Gdyb7101(psnNo string, insutype string, org_name string, doctor string, fixmedins_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_name string, sick_code string) string {
@@ -3844,10 +4063,10 @@ func Gdyb1101f(certNo string, org_name string, doctor string, fixmedins_code str
3844 4063
 			}
3845 4064
 
3846 4065
 		} else if certificates == 6 {
3847
-			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
4066
+			inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
3848 4067
 			inputData["card_sn"] = ""           // 卡识别码
3849 4068
 			inputData["certno"] = certNo        // 证件号码
3850
-			inputData["psn_cert_type"] = "17"   // 人员证件类型
4069
+			inputData["psn_cert_type"] = ""     // 人员证件类型
3851 4070
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
3852 4071
 
3853 4072
 		}
@@ -4056,6 +4275,80 @@ func Gdyb1101ForEleCert(org_name string, doctor string, fixmedins_code string, i
4056 4275
 
4057 4276
 }
4058 4277
 
4278
+func Gdyb1101ForEleCerttwo(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, token string, user_name string, idNo string) (string, string) {
4279
+	//生成签名
4280
+	nonce := GetRandomString(32)
4281
+	timestamp := time.Now().Unix()
4282
+	signature := setSignature(timestamp, nonce, secret_key)
4283
+	//生成输入报文
4284
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
4285
+	input := make(map[string]interface{})
4286
+	inputData := make(map[string]interface{})
4287
+	inputMessage["infno"] = "1101" // 交易编码
4288
+
4289
+	inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
4290
+	inputData["card_sn"] = ""           // 卡识别码
4291
+	inputData["certno"] = idNo          // 证件号码
4292
+	inputData["psn_cert_type"] = "01"   // 人员证件类型
4293
+
4294
+	inputData["mdtrt_cert_no"] = token // 就诊凭证编号
4295
+	inputData["begntime"] = ""         // 开始时间
4296
+	inputData["psn_name"] = user_name  // 人员姓名
4297
+	input["data"] = inputData
4298
+	inputMessage["input"] = input //交易输入
4299
+
4300
+	bytesData, err := json.Marshal(inputMessage)
4301
+	fmt.Println(string(bytesData))
4302
+	if err != nil {
4303
+		fmt.Println(err.Error())
4304
+		return err.Error(), ""
4305
+	}
4306
+	reader := bytes.NewReader(bytesData)
4307
+	gdyb_url := beego.AppConfig.String("gdyb_url")
4308
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
4309
+
4310
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
4311
+	//url := gdyb_url + "1101"
4312
+	var url string
4313
+	if fixmedins_code == "H15049901371" {
4314
+		url = gdyb_url
4315
+	} else {
4316
+		url = gdyb_url + "1101"
4317
+	}
4318
+
4319
+	fmt.Println(url)
4320
+	fmt.Println(gdyb_paasid)
4321
+	fmt.Println(secret_key)
4322
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
4323
+	request, err := http.NewRequest("POST", url, reader)
4324
+	if err != nil {
4325
+		fmt.Println(err.Error())
4326
+		return err.Error(), ""
4327
+	}
4328
+
4329
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
4330
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
4331
+	request.Header.Set("x-tif-signature", signature)
4332
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
4333
+	request.Header.Set("x-tif-nonce", nonce)
4334
+
4335
+	client := http.Client{}
4336
+	resp, err := client.Do(request)
4337
+	if err != nil {
4338
+		fmt.Println(err.Error())
4339
+		return err.Error(), ""
4340
+	}
4341
+	respBytes, err := ioutil.ReadAll(resp.Body)
4342
+	if err != nil {
4343
+		fmt.Println(err.Error())
4344
+		return err.Error(), ""
4345
+	}
4346
+	fmt.Println(string(respBytes))
4347
+	str := string(respBytes)
4348
+	return str, string(bytesData)
4349
+
4350
+}
4351
+
4059 4352
 func Gdyb6101(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) (string, string) {
4060 4353
 	//生成签名
4061 4354
 	nonce := GetRandomString(32)
@@ -4311,7 +4604,7 @@ func Gdyb3260(org_name string, doctor string, fixmedins_code string, insuplc_adm
4311 4604
 	inputData["sign"] = sign       // 就诊凭证编号
4312 4605
 	inputData["trt_year"] = year   // 就诊凭证编号
4313 4606
 	inputData["trt_month"] = month // 开始时间
4314
-	inputData["startrow"] = "100"  // 人员姓名
4607
+	inputData["startrow"] = "0"    // 人员姓名
4315 4608
 	input["data"] = inputData
4316 4609
 	inputMessage["input"] = input //交易输入
4317 4610
 	var inputLog string
@@ -4375,7 +4668,7 @@ func Gdyb3260(org_name string, doctor string, fixmedins_code string, insuplc_adm
4375 4668
 	}
4376 4669
 
4377 4670
 }
4378
-func Gdyb3261(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, year string, month string, result3260 models.Result3260) (string, string, string) {
4671
+func Gdyb3261(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, year string, month string, result3260 models.Result3260, sign_no string) (string, string, string) {
4379 4672
 	//生成签名
4380 4673
 	nonce := GetRandomString(32)
4381 4674
 	timestamp := time.Now().Unix()
@@ -4395,59 +4688,111 @@ func Gdyb3261(org_name string, doctor string, fixmedins_code string, insuplc_adm
4395 4688
 	msg_id := fixmedins_code + msg_year + msg_month + day + hour + min + sec + msec + "0"
4396 4689
 
4397 4690
 	//生成输入报文
4398
-	inputMessage := SetInputMessageThree(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, msg_id)
4691
+	inputMessage := SetInputMessageTwo(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, sign_no)
4399 4692
 	input := make(map[string]interface{})
4400 4693
 	inputData := make(map[string]interface{})
4401
-	inputMessage["infno"] = "3261"                      // 交易编码
4402
-	inputData["trt_year"] = year                        // 就诊凭证编号
4403
-	inputData["trt_month"] = month                      // 开始时间
4404
-	inputData["startrow"] = len(result3260.Output.Data) // 人员姓名
4405
-
4694
+	inputMessage["infno"] = "3261" // 交易编码
4695
+	inputData["trt_year"] = year   // 就诊凭证编号
4696
+	inputData["trt_month"] = month // 开始时间
4406 4697
 	feedetail := make([]map[string]interface{}, 0)
4407 4698
 
4408
-	for _, item := range result3260.Output.Data {
4409
-		feedetailInfo := make(map[string]interface{})
4410
-		feedetailInfo["certno"] = item.Certno
4411
-		feedetailInfo["mdtrt_id"] = item.MdtrtId                  // 就诊 ID(来自2201接口返回)
4412
-		feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime     // 人员编号 (来自1101接口返回)
4413
-		feedetailInfo["setl_no"] = item.SetlNo                    // 收费批次号
4414
-		feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt        // 病种编码
4415
-		feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
4416
-		feedetail = append(feedetail, feedetailInfo)
4417
-	}
4418
-	inputData["detail"] = feedetail // 人员姓名
4699
+	var curpage int
4700
+	var pagesize int = 10
4701
+	var start int = 1
4702
+	var stop int
4703
+	pagecount := 10
4704
+	for curpage = 1; curpage <= pagecount; curpage++ {
4705
+		if curpage == 1 {
4706
+			start = 1
4707
+		} else {
4708
+			start = (curpage-1)*pagesize + 1
4709
+		}
4710
+		stop = curpage * pagesize
4711
+		if stop > len(result3260.Output.Data) {
4712
+			stop = len(result3260.Output.Data)
4713
+		}
4419 4714
 
4420
-	input["data"] = inputData
4421
-	inputMessage["input"] = input //交易输入
4422
-	var inputLog string
4423
-	bytesData, err := json.Marshal(inputMessage)
4424
-	inputLog = string(bytesData)
4425
-	fmt.Println(string(bytesData))
4426
-	if err != nil {
4427
-		fmt.Println(err.Error())
4428
-		return err.Error(), "", ""
4429
-	}
4430
-	reader := bytes.NewReader(bytesData)
4431
-	gdyb_url := beego.AppConfig.String("gdyb_url")
4432
-	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
4715
+		for _, item := range result3260.Output.Data[start-1 : stop] {
4716
+			if item.MdtrtId != "out20230406681871" && item.MdtrtId != "out20230406681868" && item.MdtrtId != "out20230418732788" {
4717
+				feedetailInfo := make(map[string]interface{})
4718
+				feedetailInfo["certno"] = item.Certno
4719
+				feedetailInfo["mdtrt_id"] = item.MdtrtId                  // 就诊 ID(来自2201接口返回)
4720
+				feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime     // 人员编号 (来自1101接口返回)
4721
+				feedetailInfo["setl_sn"] = item.SetlSn                    // 收费批次号
4722
+				feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt        // 病种编码
4723
+				feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
4724
+				feedetailInfo["cnfm_flag"] = "1"                          // 处方号
4725
+				feedetail = append(feedetail, feedetailInfo)
4726
+			}
4433 4727
 
4434
-	var url string
4435
-	if fixmedins_code == "H15049901371" {
4436
-		url = gdyb_url
4437
-	} else {
4438
-		url = gdyb_url + "3261"
4439
-	}
4728
+		}
4729
+		for _, item := range result3260.Output.Data[start-1 : stop] {
4730
+			if item.MdtrtId == "out20230406681871" {
4731
+				feedetailInfo := make(map[string]interface{})
4732
+				feedetailInfo["certno"] = item.Certno
4733
+				feedetailInfo["mdtrt_id"] = item.MdtrtId                  // 就诊 ID(来自2201接口返回)
4734
+				feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime     // 人员编号 (来自1101接口返回)
4735
+				feedetailInfo["setl_sn"] = item.SetlSn                    // 收费批次号
4736
+				feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt        // 病种编码
4737
+				feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
4738
+				feedetailInfo["cnfm_flag"] = "0"                          // 处方号
4739
+				feedetail = append(feedetail, feedetailInfo)
4740
+			}
4440 4741
 
4441
-	if insuplc_admdvs == "421300" {
4442
-		var json2 string
4443
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
4444
-		out, err := cmd.Output()
4742
+		}
4743
+
4744
+		for _, item := range result3260.Output.Data[start-1 : stop] {
4745
+			if item.MdtrtId == "out20230406681868" {
4746
+				feedetailInfo := make(map[string]interface{})
4747
+				feedetailInfo["certno"] = item.Certno
4748
+				feedetailInfo["mdtrt_id"] = item.MdtrtId                  // 就诊 ID(来自2201接口返回)
4749
+				feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime     // 人员编号 (来自1101接口返回)
4750
+				feedetailInfo["setl_sn"] = item.SetlSn                    // 收费批次号
4751
+				feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt        // 病种编码
4752
+				feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
4753
+				feedetailInfo["cnfm_flag"] = "0"                          // 处方号
4754
+				feedetail = append(feedetail, feedetailInfo)
4755
+			}
4756
+
4757
+		}
4758
+		for _, item := range result3260.Output.Data[start-1 : stop] {
4759
+			if item.MdtrtId == "out20230418732788" {
4760
+				feedetailInfo := make(map[string]interface{})
4761
+				feedetailInfo["certno"] = item.Certno
4762
+				feedetailInfo["mdtrt_id"] = item.MdtrtId                  // 就诊 ID(来自2201接口返回)
4763
+				feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime     // 人员编号 (来自1101接口返回)
4764
+				feedetailInfo["setl_sn"] = item.SetlSn                    // 收费批次号
4765
+				feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt        // 病种编码
4766
+				feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
4767
+				feedetailInfo["cnfm_flag"] = "0"                          // 处方号
4768
+				feedetail = append(feedetail, feedetailInfo)
4769
+			}
4770
+
4771
+		}
4772
+
4773
+		inputData["totalrow"] = 119 // 人员姓名
4774
+
4775
+		input["data"] = inputData
4776
+		input["detail"] = feedetail
4777
+		inputMessage["input"] = input //交易输入
4778
+		var inputLog string
4779
+		bytesData, err := json.Marshal(inputMessage)
4780
+		inputLog = string(bytesData)
4781
+		fmt.Println(string(bytesData))
4445 4782
 		if err != nil {
4446
-			fmt.Println("error:", err.Error())
4783
+			fmt.Println(err.Error())
4784
+			return err.Error(), "", ""
4785
+		}
4786
+		reader := bytes.NewReader(bytesData)
4787
+		gdyb_url := beego.AppConfig.String("gdyb_url")
4788
+		gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
4789
+
4790
+		var url string
4791
+		if fixmedins_code == "H15049901371" {
4792
+			url = gdyb_url
4793
+		} else {
4794
+			url = gdyb_url + "3261"
4447 4795
 		}
4448
-		fmt.Println(string(out))
4449
-		return hex.EncodeToString(out), inputLog, ""
4450
-	} else {
4451 4796
 
4452 4797
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
4453 4798
 		request, err := http.NewRequest("POST", url, reader)
@@ -4478,22 +4823,22 @@ func Gdyb3261(org_name string, doctor string, fixmedins_code string, insuplc_adm
4478 4823
 		return str, inputLog, msg_id
4479 4824
 
4480 4825
 	}
4481
-
4826
+	return "", "", msg_id
4482 4827
 }
4483
-func Gdyb3262(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, year string, month string, otransid string) (string, string) {
4828
+func Gdyb3262(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, year string, month string, otransid string, sign_no string) (string, string) {
4484 4829
 	//生成签名
4485 4830
 	nonce := GetRandomString(32)
4486 4831
 	timestamp := time.Now().Unix()
4487 4832
 	signature := setSignature(timestamp, nonce, secret_key)
4488 4833
 	//生成输入报文
4489
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
4834
+	inputMessage := SetInputMessageTwo(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, sign_no)
4490 4835
 	input := make(map[string]interface{})
4491 4836
 	inputData := make(map[string]interface{})
4492 4837
 	inputMessage["infno"] = "3262" // 交易编码
4493 4838
 
4494
-	inputData["trt_year"] = year     // 就诊凭证编号
4495
-	inputData["trt_month"] = ""      // 开始时间
4496
-	inputData["otransid"] = otransid // 开始时间
4839
+	inputData["trt_year"] = year  // 就诊凭证编号
4840
+	inputData["trt_month"] = "04" // 开始时间
4841
+	inputData["otransid"] = "0"   // 开始时间
4497 4842
 
4498 4843
 	input["data"] = inputData
4499 4844
 	inputMessage["input"] = input //交易输入
@@ -4513,7 +4858,7 @@ func Gdyb3262(org_name string, doctor string, fixmedins_code string, insuplc_adm
4513 4858
 	if fixmedins_code == "H15049901371" {
4514 4859
 		url = gdyb_url
4515 4860
 	} else {
4516
-		url = gdyb_url + "3261"
4861
+		url = gdyb_url + "3262"
4517 4862
 	}
4518 4863
 
4519 4864
 	if insuplc_admdvs == "421300" {

+ 10 - 6
service/gdyb_zifei_service.go Datei anzeigen

@@ -407,8 +407,11 @@ func Gdyb4205(org_name string, doctor string, fixmedins_code string, insuplc_adm
407 407
 	signature := setSignature(timestamp, nonce, secret_key)
408 408
 	//生成输入报文
409 409
 	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
410
-	input := make(map[string]interface{})
410
+	//input := make(map[string]interface{})
411
+	inputData0 := make(map[string]interface{})
412
+
411 413
 	inputData := make(map[string]interface{})
414
+
412 415
 	inputMessage["infno"] = "4205" // 交易编码
413 416
 
414 417
 	inputData["fixmedins_mdtrt_id"] = struct4202.OwnPayPatnMdtrtD.FixmedinsMdtrtID
@@ -459,10 +462,11 @@ func Gdyb4205(org_name string, doctor string, fixmedins_code string, insuplc_adm
459 462
 		diagInfo["vali_flag"] = "1"
460 463
 		diagInfos = append(diagInfos, diagInfo)
461 464
 	}
462
-	inputData["diseinfo"] = diagInfos
463
-
465
+	inputData0["diseinfo"] = diagInfos
464 466
 	feedetail := make([]map[string]interface{}, 0)
465 467
 	for _, item := range struct4201A.Fopfd {
468
+		fmt.Println("item.BkkpSn")
469
+		fmt.Println(item.BkkpSn)
466 470
 		inputData := make(map[string]interface{})
467 471
 		inputData["fixmedins_mdtrt_id"] = item.FixmedinsMdtrtID
468 472
 		inputData["med_type"] = item.MedType
@@ -503,9 +507,9 @@ func Gdyb4205(org_name string, doctor string, fixmedins_code string, insuplc_adm
503 507
 		feedetail = append(feedetail, inputData)
504 508
 
505 509
 	}
506
-	inputData["feedetail"] = feedetail
507
-	input["data"] = inputData
508
-	inputMessage["input"] = input //交易输入
510
+	inputData0["feedetail"] = feedetail
511
+	inputData0["mdtrtinfo"] = inputData
512
+	inputMessage["input"] = inputData0 //交易输入
509 513
 
510 514
 	var inputLog string
511 515
 	bytesData, err := json.Marshal(inputMessage)

+ 105 - 104
service/hb_service.go Datei anzeigen

@@ -3572,111 +3572,112 @@ func HeBeiyb3260(org_name string, doctor string, fixmedins_code string, insuplc_
3572 3572
 	}
3573 3573
 
3574 3574
 }
3575
-func HeBeiyb3261(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, year string, month string, result3260 models.Result3260) (string, string, string) {
3576
-	//生成签名
3577
-	nonce := GetRandomString(32)
3578
-	timestamp := time.Now().Unix()
3579
-	signature := setSignature(timestamp, nonce, secret_key)
3580
-
3581
-	msg_month := time.Unix(1557042972, 0).Format("1")
3582
-	msg_year := time.Now().Format("2006")
3583
-	msg_month = time.Now().Format("01")
3584
-	day := time.Now().Format("02")
3585
-
3586
-	hour := time.Now().Format("15")
3587
-	min := time.Now().Format("04")
3588
-	sec := time.Now().Format("05")
3589
-
3590
-	msec := time.Now().Format("000")
3591
-
3592
-	msg_id := fixmedins_code + msg_year + msg_month + day + hour + min + sec + msec + "0"
3593
-
3594
-	//生成输入报文
3595
-	inputMessage := SetInputMessageThree(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, msg_id)
3596
-	input := make(map[string]interface{})
3597
-	inputData := make(map[string]interface{})
3598
-	inputMessage["infno"] = "3261"                      // 交易编码
3599
-	inputData["trt_year"] = year                        // 就诊凭证编号
3600
-	inputData["trt_month"] = month                      // 开始时间
3601
-	inputData["startrow"] = len(result3260.Output.Data) // 人员姓名
3602
-
3603
-	feedetail := make([]map[string]interface{}, 0)
3604
-
3605
-	for _, item := range result3260.Output.Data {
3606
-		feedetailInfo := make(map[string]interface{})
3607
-		feedetailInfo["certno"] = item.Certno
3608
-		feedetailInfo["mdtrt_id"] = item.MdtrtId                  // 就诊 ID(来自2201接口返回)
3609
-		feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime     // 人员编号 (来自1101接口返回)
3610
-		feedetailInfo["setl_no"] = item.SetlNo                    // 收费批次号
3611
-		feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt        // 病种编码
3612
-		feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
3613
-		feedetail = append(feedetail, feedetailInfo)
3614
-	}
3615
-	inputData["detail"] = feedetail // 人员姓名
3616
-
3617
-	input["data"] = inputData
3618
-	inputMessage["input"] = input //交易输入
3619
-	var inputLog string
3620
-	bytesData, err := json.Marshal(inputMessage)
3621
-	inputLog = string(bytesData)
3622
-	fmt.Println(string(bytesData))
3623
-	if err != nil {
3624
-		fmt.Println(err.Error())
3625
-		return err.Error(), "", ""
3626
-	}
3627
-	reader := bytes.NewReader(bytesData)
3628
-	gdyb_url := beego.AppConfig.String("gdyb_url")
3629
-	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
3630
-
3631
-	var url string
3632
-	if fixmedins_code == "H15049901371" {
3633
-		url = gdyb_url
3634
-	} else {
3635
-		url = gdyb_url + "3261"
3636
-	}
3637
-
3638
-	if insuplc_admdvs == "421300" {
3639
-		var json2 string
3640
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
3641
-		out, err := cmd.Output()
3642
-		if err != nil {
3643
-			fmt.Println("error:", err.Error())
3644
-		}
3645
-		fmt.Println(string(out))
3646
-		return hex.EncodeToString(out), inputLog, ""
3647
-	} else {
3648
-
3649
-		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
3650
-		request, err := http.NewRequest("POST", url, reader)
3651
-		if err != nil {
3652
-			fmt.Println(err.Error())
3653
-			return err.Error(), "", ""
3654
-		}
3655
-
3656
-		request.Header.Set("Content-Type", "application/json;charset=UTF-8")
3657
-		request.Header.Set("x-tif-paasid", gdyb_paasid)
3658
-		request.Header.Set("x-tif-signature", signature)
3659
-		request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
3660
-		request.Header.Set("x-tif-nonce", nonce)
3661 3575
 
3662
-		client := http.Client{}
3663
-		resp, err := client.Do(request)
3664
-		if err != nil {
3665
-			fmt.Println(err.Error())
3666
-			return err.Error(), "", ""
3667
-		}
3668
-		respBytes, err := ioutil.ReadAll(resp.Body)
3669
-		if err != nil {
3670
-			fmt.Println(err.Error())
3671
-			return err.Error(), "", ""
3672
-		}
3673
-		fmt.Println(string(respBytes))
3674
-		str := string(respBytes)
3675
-		return str, inputLog, msg_id
3676
-
3677
-	}
3678
-
3679
-}
3576
+//func HeBeiyb3261(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, year string, month string, result3260 models.Result3260) (string, string, string) {
3577
+//	//生成签名
3578
+//	nonce := GetRandomString(32)
3579
+//	timestamp := time.Now().Unix()
3580
+//	signature := setSignature(timestamp, nonce, secret_key)
3581
+//
3582
+//	msg_month := time.Unix(1557042972, 0).Format("1")
3583
+//	msg_year := time.Now().Format("2006")
3584
+//	msg_month = time.Now().Format("01")
3585
+//	day := time.Now().Format("02")
3586
+//
3587
+//	hour := time.Now().Format("15")
3588
+//	min := time.Now().Format("04")
3589
+//	sec := time.Now().Format("05")
3590
+//
3591
+//	msec := time.Now().Format("000")
3592
+//
3593
+//	msg_id := fixmedins_code + msg_year + msg_month + day + hour + min + sec + msec + "0"
3594
+//
3595
+//	//生成输入报文
3596
+//	inputMessage := SetInputMessageThree(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, msg_id)
3597
+//	input := make(map[string]interface{})
3598
+//	inputData := make(map[string]interface{})
3599
+//	inputMessage["infno"] = "3261"                      // 交易编码
3600
+//	inputData["trt_year"] = year                        // 就诊凭证编号
3601
+//	inputData["trt_month"] = month                      // 开始时间
3602
+//	inputData["startrow"] = len(result3260.Output.Data) // 人员姓名
3603
+//
3604
+//	feedetail := make([]map[string]interface{}, 0)
3605
+//
3606
+//	for _, item := range result3260.Output.Data {
3607
+//		feedetailInfo := make(map[string]interface{})
3608
+//		feedetailInfo["certno"] = item.Certno
3609
+//		feedetailInfo["mdtrt_id"] = item.MdtrtId                  // 就诊 ID(来自2201接口返回)
3610
+//		feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime     // 人员编号 (来自1101接口返回)
3611
+//		feedetailInfo["setl_no"] = item.SetlNo                    // 收费批次号
3612
+//		feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt        // 病种编码
3613
+//		feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
3614
+//		feedetail = append(feedetail, feedetailInfo)
3615
+//	}
3616
+//	inputData["detail"] = feedetail // 人员姓名
3617
+//
3618
+//	input["data"] = inputData
3619
+//	inputMessage["input"] = input //交易输入
3620
+//	var inputLog string
3621
+//	bytesData, err := json.Marshal(inputMessage)
3622
+//	inputLog = string(bytesData)
3623
+//	fmt.Println(string(bytesData))
3624
+//	if err != nil {
3625
+//		fmt.Println(err.Error())
3626
+//		return err.Error(), "", ""
3627
+//	}
3628
+//	reader := bytes.NewReader(bytesData)
3629
+//	gdyb_url := beego.AppConfig.String("gdyb_url")
3630
+//	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
3631
+//
3632
+//	var url string
3633
+//	if fixmedins_code == "H15049901371" {
3634
+//		url = gdyb_url
3635
+//	} else {
3636
+//		url = gdyb_url + "3261"
3637
+//	}
3638
+//
3639
+//	if insuplc_admdvs == "421300" {
3640
+//		var json2 string
3641
+//		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
3642
+//		out, err := cmd.Output()
3643
+//		if err != nil {
3644
+//			fmt.Println("error:", err.Error())
3645
+//		}
3646
+//		fmt.Println(string(out))
3647
+//		return hex.EncodeToString(out), inputLog, ""
3648
+//	} else {
3649
+//
3650
+//		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
3651
+//		request, err := http.NewRequest("POST", url, reader)
3652
+//		if err != nil {
3653
+//			fmt.Println(err.Error())
3654
+//			return err.Error(), "", ""
3655
+//		}
3656
+//
3657
+//		request.Header.Set("Content-Type", "application/json;charset=UTF-8")
3658
+//		request.Header.Set("x-tif-paasid", gdyb_paasid)
3659
+//		request.Header.Set("x-tif-signature", signature)
3660
+//		request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
3661
+//		request.Header.Set("x-tif-nonce", nonce)
3662
+//
3663
+//		client := http.Client{}
3664
+//		resp, err := client.Do(request)
3665
+//		if err != nil {
3666
+//			fmt.Println(err.Error())
3667
+//			return err.Error(), "", ""
3668
+//		}
3669
+//		respBytes, err := ioutil.ReadAll(resp.Body)
3670
+//		if err != nil {
3671
+//			fmt.Println(err.Error())
3672
+//			return err.Error(), "", ""
3673
+//		}
3674
+//		fmt.Println(string(respBytes))
3675
+//		str := string(respBytes)
3676
+//		return str, inputLog, msg_id
3677
+//
3678
+//	}
3679
+//
3680
+//}
3680 3681
 func HeBeiyb3262(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, year string, month string, otransid string) (string, string) {
3681 3682
 	//生成签名
3682 3683
 	nonce := GetRandomString(32)

+ 17 - 3
service/his_service.go Datei anzeigen

@@ -1478,8 +1478,14 @@ func GetAllHisOrder(org_id int64) (his []*models.HisOrder, err error) {
1478 1478
 	return
1479 1479
 }
1480 1480
 
1481
-func GetAllHisOrderTwo(org_id int64, id int64) (his []*models.HisOrder, err error) {
1482
-	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ?  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND med_type = '14' AND id > ?", org_id, id).Order("setl_time asc").Find(&his).Error
1481
+func GetAllHisOrderTwo(org_id int64) (his []*models.HisOrder, err error) {
1482
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ?  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND med_type = '14' AND id >= 247903", org_id).Order("setl_time asc").Find(&his).Error
1483
+	fmt.Println(err)
1484
+	return
1485
+}
1486
+
1487
+func GetAllHisOrder10106(org_id int64) (his []*models.HisOrder, err error) {
1488
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10106  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND med_type = '14' AND id >= 264212").Order("setl_time asc").Find(&his).Error
1483 1489
 	fmt.Println(err)
1484 1490
 	return
1485 1491
 }
@@ -1532,7 +1538,10 @@ func UpdateOrder(order models.HisOrder) (err error) {
1532 1538
 	err = writeDb.Save(&order).Error
1533 1539
 	return
1534 1540
 }
1535
-
1541
+func UpdateOrderTwo(order models.NewHisOrder111) (err error) {
1542
+	err = writeDb.Save(&order).Error
1543
+	return
1544
+}
1536 1545
 func GetNewHisPrescriptionTen(org_id int64, his_patient_id int64, record_date int64) (prescription []*models.HisPrescriptionTen, err error) {
1537 1546
 	err = readDb.Model(&models.HisPrescriptionTen{}).
1538 1547
 		Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
@@ -1545,3 +1554,8 @@ func GetNewHisPrescriptionTen(org_id int64, his_patient_id int64, record_date in
1545 1554
 		Find(&prescription).Error
1546 1555
 	return
1547 1556
 }
1557
+
1558
+func GetHisOrderByIDTwo1111(order_id int64) (order models.NewHisOrder111, err error) {
1559
+	err = readDb.Model(&models.HisOrder{}).Where("id = ? AND status = 1", order_id).First(&order).Error
1560
+	return
1561
+}

+ 498 - 0
service/jx_service.go Datei anzeigen

@@ -6,6 +6,7 @@ import (
6 6
 	"fmt"
7 7
 	"gdyb/models"
8 8
 	"gdyb/utils/csbhttp"
9
+	"github.com/astaxie/beego"
9 10
 
10 11
 	//"net/http"
11 12
 	"strconv"
@@ -1012,6 +1013,503 @@ func Jxyb5203(baseParams models.BaseParams, businessParams models.BusinessParams
1012 1013
 	return JXHttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData), "5203"), string(bytesData)
1013 1014
 }
1014 1015
 
1016
+func JxybZY1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates int64, request_url string, access_key string, pBusiCardInfo string, id_card_no string, cainfo string) (string, string) {
1017
+	timestamp := time.Now().Unix()
1018
+	//生成输入报文
1019
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
1020
+
1021
+	input := make(map[string]interface{})
1022
+	inputData := make(map[string]interface{})
1023
+	inputMessage["infno"] = "1101" // 交易编码
1024
+
1025
+	if certificates == 3 {
1026
+		inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
1027
+		inputData["certno"] = certNo        // 证件号码
1028
+		inputData["psn_cert_type"] = "99"   // 人员证件类型
1029
+
1030
+	} else {
1031
+		if id_card_type == 1 {
1032
+			inputData["mdtrt_cert_type"] = "03"                       // 就诊凭证类型
1033
+			inputData["card_sn"] = card_sn                            // 卡识别码
1034
+			inputData["certno"] = id_card_no                          // 证件号码
1035
+			inputData["psn_cert_type"] = "01"                         // 人员证件类型
1036
+			inputData["mdtrt_cert_no"] = certNo + "|" + pBusiCardInfo // 就诊凭证编号
1037
+
1038
+		} else {
1039
+			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
1040
+			inputData["card_sn"] = ""           // 卡识别码
1041
+			inputData["certno"] = certNo        // 证件号码
1042
+			inputData["psn_cert_type"] = "01"   // 人员证件类型
1043
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
1044
+		}
1045
+	}
1046
+
1047
+	inputData["begntime"] = "" // 开始时间
1048
+	inputData["psn_name"] = "" // 人员姓名
1049
+	input["data"] = inputData
1050
+	inputMessage["input"] = input //交易输入
1051
+
1052
+	var inputLog string
1053
+	bytesData, _ := json.Marshal(inputMessage)
1054
+	inputLog = string(bytesData)
1055
+	fmt.Println(string(bytesData))
1056
+	if err != nil {
1057
+		fmt.Println(err.Error())
1058
+		return err.Error(), ""
1059
+	}
1060
+	request_url = request_url + "1101"
1061
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "1101"), inputLog
1062
+
1063
+}
1064
+
1065
+// 住院登记
1066
+func Jxyb2401(struct2401 Struct2401, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
1067
+	// 生成签名
1068
+	timestamp := time.Now().Unix()
1069
+	//tempTime := time.Unix(timestamp, 0)
1070
+	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
1071
+
1072
+	// 生成输入报文
1073
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
1074
+	//inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
1075
+	input := make(map[string]interface{})
1076
+	inputData := make(map[string]interface{})
1077
+	inputMessage["infno"] = "2401"              // 交易编码
1078
+	inputData["psn_no"] = struct2401.PsnNo      // 人员编号 (来自1101接口返回)
1079
+	inputData["insutype"] = struct2401.Insutype // 险种类型(来自1101接口返回)
1080
+	inputData["tel"] = ""
1081
+	inputData["coner_name"] = ""
1082
+	inputData["begntime"] = struct2401.Begntime             // 开始时间
1083
+	inputData["mdtrt_cert_type"] = struct2401.MdtrtCertType // 就诊凭证类型
1084
+	inputData["mdtrt_cert_no"] = struct2401.MdtrtCertNo     // 就诊凭证编号
1085
+	inputData["med_type"] = struct2401.MedType              // 就诊凭证编号
1086
+	inputData["ipt_no"] = struct2401.IptNo                  // 住院/门诊号
1087
+	inputData["medrcdno"] = ""
1088
+	inputData["atddr_no"] = struct2401.AtddrNo
1089
+	inputData["chfpdr_name"] = struct2401.ChfpdrName
1090
+	inputData["adm_diag_dscr"] = struct2401.AdmDiagDscr
1091
+	inputData["adm_dept_codg"] = struct2401.AdmDeptCodg
1092
+	inputData["adm_dept_name"] = struct2401.AdmDeptName
1093
+	inputData["adm_bed"] = struct2401.AdmBed
1094
+	inputData["dscg_maindiag_code"] = struct2401.DscgMaindiagCode
1095
+	inputData["dscg_maindiag_name"] = struct2401.DscgMaindiagName
1096
+	inputData["main_cond_dscr"] = ""
1097
+	inputData["dise_codg"] = struct2401.DiseCodg
1098
+	inputData["dise_name"] = struct2401.DiseName
1099
+	inputData["oprn_oprt_code"] = ""
1100
+	inputData["oprn_oprt_name"] = ""
1101
+	inputData["fpsc_no"] = ""
1102
+	inputData["matn_type"] = ""
1103
+	inputData["birctrl_type"] = ""
1104
+	inputData["latechb_flag"] = ""
1105
+	inputData["geso_val"] = ""
1106
+	inputData["fetts"] = ""
1107
+	inputData["fetus_cnt"] = ""
1108
+	inputData["pret_flag"] = ""
1109
+	inputData["birctrl_matn_date"] = ""
1110
+	inputData["dise_type_code"] = ""
1111
+	inputData["insuplc_admdvs"] = insuplc_admdvs
1112
+	inputData["mdtrtarea_admvs"] = mdtrtarea_admvs
1113
+
1114
+	inputDataArr := make([]map[string]interface{}, 0)
1115
+	for _, item := range struct2401.Diseinfo {
1116
+		inputDataTwo := make(map[string]interface{})
1117
+		inputDataTwo["psn_no"] = item.PsnNo
1118
+		inputDataTwo["diag_type"] = item.DiagType
1119
+		inputDataTwo["maindiag_flag"] = item.MaindiagFlag
1120
+		inputDataTwo["diag_srt_no"] = item.DiagSrtNo
1121
+		inputDataTwo["diag_code"] = item.DiagCode
1122
+		inputDataTwo["diag_name"] = item.DiagName
1123
+		inputDataTwo["adm_cond"] = ""
1124
+		inputDataTwo["diag_dept"] = item.DiagDept
1125
+		inputDataTwo["dise_dor_no"] = item.DiseDorNo
1126
+		inputDataTwo["dise_dor_name"] = item.DiseDorName
1127
+		inputDataTwo["diag_time"] = item.DiagTime
1128
+		inputDataArr = append(inputDataArr, inputDataTwo)
1129
+	}
1130
+	input["mdtrtinfo"] = inputData
1131
+	input["diseinfo"] = inputDataArr
1132
+	inputMessage["input"] = input //交易输入
1133
+
1134
+	bytesData, err := json.Marshal(inputMessage)
1135
+	fmt.Println(string(bytesData))
1136
+	requestLog := string(bytesData)
1137
+	if err != nil {
1138
+		fmt.Println(err.Error())
1139
+		return err.Error(), ""
1140
+	}
1141
+	request_url = request_url + "2401"
1142
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2401"), requestLog
1143
+
1144
+}
1145
+func Jxyb2404(mdtrt_id string, psn_no string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
1146
+	// 生成签名
1147
+	timestamp := time.Now().Unix()
1148
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
1149
+	input := make(map[string]interface{})
1150
+	inputData := make(map[string]interface{})
1151
+	inputMessage["infno"] = "2404"   // 交易编码
1152
+	inputData["mdtrt_id"] = mdtrt_id // 人员编号 (来自1101接口返回)
1153
+	inputData["psn_no"] = psn_no     // 人员编号 (来自1101接口返回)
1154
+	input["data"] = inputData
1155
+	inputMessage["input"] = input //交易输入
1156
+	bytesData, err := json.Marshal(inputMessage)
1157
+	fmt.Println(string(bytesData))
1158
+	requestLog := string(bytesData)
1159
+	if err != nil {
1160
+		fmt.Println(err.Error())
1161
+		return err.Error(), ""
1162
+	}
1163
+
1164
+	request_url = request_url + "2404"
1165
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2404"), requestLog
1166
+
1167
+}
1168
+func Jxyb2405(mdtrt_id string, psn_no string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
1169
+	// 生成签名
1170
+	timestamp := time.Now().Unix()
1171
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
1172
+	input := make(map[string]interface{})
1173
+	inputData := make(map[string]interface{})
1174
+	inputMessage["infno"] = "2405"   // 交易编码
1175
+	inputData["mdtrt_id"] = mdtrt_id // 人员编号 (来自1101接口返回)
1176
+	inputData["psn_no"] = psn_no     // 人员编号 (来自1101接口返回)
1177
+	input["data"] = inputData
1178
+	inputMessage["input"] = input //交易输入
1179
+	bytesData, err := json.Marshal(inputMessage)
1180
+	fmt.Println(string(bytesData))
1181
+	requestLog := string(bytesData)
1182
+	if err != nil {
1183
+		fmt.Println(err.Error())
1184
+		return err.Error(), ""
1185
+	}
1186
+
1187
+	request_url = request_url + "2405"
1188
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2405"), requestLog
1189
+
1190
+}
1191
+
1192
+func Jxyb2402(struct2402 Struct2402, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
1193
+	// 生成签名
1194
+	nonce := GetRandomString(32)
1195
+	timestamp := time.Now().Unix()
1196
+
1197
+	// 生成输入报文
1198
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
1199
+	input := make(map[string]interface{})
1200
+	inputData := make(map[string]interface{})
1201
+	inputMessage["infno"] = "2402"               // 交易编码
1202
+	inputData["mdtrt_id"] = struct2402.MdtrtId   // 人员编号 (来自1101接口返回)
1203
+	inputData["psn_no"] = struct2402.PsnNo       // 人员编号 (来自1101接口返回)
1204
+	inputData["insutype"] = struct2402.Insutype  // 险种类型(来自1101接口返回)
1205
+	inputData["endtime"] = struct2402.Endtime    // 结束时间
1206
+	inputData["dise_codg"] = struct2402.DiseCode // 就诊凭证类型
1207
+
1208
+	inputData["dise_name"] = struct2402.DiseName // 就诊凭证类型
1209
+	inputData["oprn_oprt_code"] = ""             // 就诊凭证类型
1210
+	inputData["oprn_oprt_name"] = ""             // 就诊凭证类型
1211
+	inputData["fpsc_no"] = ""                    // 就诊凭证类型
1212
+
1213
+	inputData["matn_type"] = ""    // 就诊凭证类型
1214
+	inputData["birctrl_type"] = "" // 就诊凭证类型
1215
+	inputData["latechb_flag"] = "" // 就诊凭证类型
1216
+	inputData["geso_val"] = ""
1217
+	inputData["fetts"] = ""
1218
+	inputData["fetus_cnt"] = ""
1219
+	inputData["pret_flag"] = ""
1220
+	inputData["birctrl_matn_date"] = ""
1221
+	inputData["cop_flag"] = ""
1222
+
1223
+	inputData["dscg_dept_codg"] = struct2402.DscgDeptCodg
1224
+	inputData["dscg_dept_name"] = struct2402.DscgDeptName
1225
+	inputData["dscg_bed"] = "待定"
1226
+	inputData["dscg_way"] = struct2402.DscgWay
1227
+	inputData["die_date"] = ""
1228
+
1229
+	inputDataArr := make([]map[string]interface{}, 0)
1230
+	for _, item := range struct2402.Diseinfo {
1231
+		inputDataTwo := make(map[string]interface{})
1232
+		inputDataTwo["psn_no"] = item.PsnNo
1233
+		inputDataTwo["mdtrt_id"] = item.MdtrtId
1234
+		inputDataTwo["diag_type"] = item.DiagType
1235
+		inputDataTwo["maindiag_flag"] = item.MaindiagFlag
1236
+		inputDataTwo["diag_srt_no"] = item.DiagSrtNo
1237
+		inputDataTwo["diag_code"] = item.DiagCode
1238
+		inputDataTwo["diag_name"] = item.DiagName
1239
+		inputDataTwo["diag_dept"] = item.DiagDept
1240
+		inputDataTwo["dise_dor_no"] = item.DiseDorNo
1241
+		inputDataTwo["dise_dor_name"] = item.DiseDorName
1242
+		inputDataTwo["diag_time"] = item.DiagTime
1243
+		inputDataArr = append(inputDataArr, inputDataTwo)
1244
+	}
1245
+
1246
+	input["dscginfo"] = inputData
1247
+	input["diseinfo"] = inputDataArr
1248
+
1249
+	inputMessage["input"] = input //交易输入
1250
+	bytesData, err := json.Marshal(inputMessage)
1251
+	fmt.Println(string(bytesData))
1252
+	requestLog := string(bytesData)
1253
+	if err != nil {
1254
+		fmt.Println(err.Error())
1255
+		return err.Error(), ""
1256
+	}
1257
+
1258
+	request_url = request_url + "2402"
1259
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2402"), requestLog
1260
+
1261
+}
1262
+
1263
+func Jxyb2301(psnNo string, mdtrtId string, hisPrescription []*models.NewCustom, med_type string, chrg_bchno string, dept_code string, dept string, doctor_id string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
1264
+	// 生成签名
1265
+	timestamp := time.Now().Unix()
1266
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
1267
+	var customs []*models.NewCustom
1268
+
1269
+	customs = hisPrescription
1270
+	// 生成输入报文
1271
+	input := make(map[string]interface{})
1272
+	feedetail := make([]map[string]interface{}, 0)
1273
+	inputMessage["infno"] = "2301" // 交易编码
1274
+
1275
+	//chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
1276
+	for _, item := range customs {
1277
+		org_id, _ := beego.AppConfig.Int64("org_id")
1278
+		doctor_info, _ := GetAdminUserInfoByID(org_id, item.DoctorId)
1279
+
1280
+		feedetailInfo := make(map[string]interface{})
1281
+		feedetailInfo["feedetl_sn"] = item.FeedetlSn
1282
+		feedetailInfo["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
1283
+		feedetailInfo["psn_no"] = psnNo     // 人员编号 (来自1101接口返回)
1284
+		feedetailInfo["med_type"] = med_type
1285
+		feedetailInfo["fee_ocur_time"] = item.FeeOcurTime            // 费用发生时间
1286
+		feedetailInfo["med_list_codg"] = item.MedListCodg            // 医疗目录编码
1287
+		feedetailInfo["medins_list_codg"] = fixmedins_code           // 医药机构目录编码
1288
+		feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
1289
+		feedetailInfo["cnt"] = item.Cut                              // 数量
1290
+		feedetailInfo["pric"] = item.Price                           // 单价
1291
+		feedetailInfo["bilg_dept_codg"] = dept_code                  // 开单科室编码
1292
+		feedetailInfo["bilg_dept_name"] = dept                       // 开单科室名称
1293
+		feedetailInfo["bilg_dr_codg"] = doctor_info.DoctorNumber     // 开单医生编码
1294
+		feedetailInfo["bilg_dr_name"] = doctor_info.UserName
1295
+		feedetailInfo["acord_dept_codg"] = dept_code               // 受单科室编码
1296
+		feedetailInfo["acord_dept_name"] = dept                    // 受单科室名称
1297
+		feedetailInfo["orders_dr_code"] = doctor_info.DoctorNumber // 受单医生编码
1298
+		feedetailInfo["orders_dr_name"] = doctor_info.UserName     // 受单医生姓名
1299
+		feedetailInfo["chrg_bchno"] = chrg_bchno                   // 收费批次号
1300
+		feedetailInfo["dise_codg"] = ""                            // 病种编码
1301
+		feedetailInfo["rxno"] = ""                                 // 处方号
1302
+		feedetailInfo["rx_circ_flag"] = "0"                        // 外购处方标志
1303
+		feedetailInfo["sin_dos_dscr"] = ""                         // 单次剂量描述
1304
+		feedetailInfo["used_frqu_dscr"] = ""                       // 使用频次描述
1305
+		feedetailInfo["prd_days"] = "0"                            // 周期天数
1306
+		feedetailInfo["medc_way_dscr"] = ""                        // 用药途径描述
1307
+		// 开单医师姓名
1308
+
1309
+		if item.HospApprFlag != -1 {
1310
+			if item.HospApprFlag == 1 {
1311
+				feedetailInfo["hosp_appr_flag"] = "0" // 医院审批标志
1312
+			} else if item.HospApprFlag == 2 {
1313
+				feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
1314
+			} else if item.HospApprFlag == 3 {
1315
+				feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
1316
+			} else {
1317
+				feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
1318
+			}
1319
+		} else {
1320
+			feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
1321
+		}
1322
+
1323
+		//feedetailInfo["tcmdrug_used_way"] = "" // 中药使用方式
1324
+		feedetailInfo["etip_flag"] = ""        // 外检标志
1325
+		feedetailInfo["etip_hosp_code"] = ""   // 外检医院编码
1326
+		feedetailInfo["dscg_tkdrug_flag"] = "" // 出院带药标志
1327
+		feedetailInfo["matn_fee_flag"] = ""    // 生育费用标志
1328
+		feedetail = append(feedetail, feedetailInfo)
1329
+	}
1330
+	input["feedetail"] = feedetail
1331
+	inputMessage["input"] = input //交易输入
1332
+
1333
+	bytesData, err := json.Marshal(inputMessage)
1334
+	fmt.Println(string(bytesData))
1335
+	requestLog := string(bytesData)
1336
+	if err != nil {
1337
+		fmt.Println(err.Error())
1338
+		return err.Error(), ""
1339
+	}
1340
+
1341
+	request_url = request_url + "2301"
1342
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2301"), requestLog
1343
+
1344
+}
1345
+
1346
+func Jxyb2302(psnNo string, mdtrtId string, refund_type int64, number string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
1347
+	// 生成签名
1348
+	nonce := GetRandomString(32)
1349
+	timestamp := time.Now().Unix()
1350
+
1351
+	// 生成输入报文
1352
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
1353
+	input := make(map[string]interface{})
1354
+	inputData := make(map[string]interface{})
1355
+	inputMessage["infno"] = "2302" // 交易编码
1356
+	if refund_type == 1 {
1357
+		inputData["feedetl_sn"] = number //
1358
+
1359
+	} else {
1360
+		inputData["feedetl_sn"] = "0000" //
1361
+	}
1362
+
1363
+	inputData["mdtrt_id"] = mdtrtId // 就诊 ID
1364
+	inputData["psn_no"] = psnNo     // 人员编号
1365
+
1366
+	input["data"] = inputData
1367
+	inputMessage["input"] = input //交易输入
1368
+	bytesData, err := json.Marshal(inputMessage)
1369
+	fmt.Println(string(bytesData))
1370
+	requestLog := string(bytesData)
1371
+	if err != nil {
1372
+		fmt.Println(err.Error())
1373
+		return err.Error(), ""
1374
+	}
1375
+
1376
+	request_url = request_url + "2302"
1377
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2302"), requestLog
1378
+
1379
+}
1380
+
1381
+func Jxyb2303(psnNo string, mdtrtId string, certNo string, insutype string, total string, certificates int64, id_card_type int64, mid_setl_flag string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
1382
+	// 生成签名
1383
+	nonce := GetRandomString(32)
1384
+	timestamp := time.Now().Unix()
1385
+
1386
+	// 生成输入报文
1387
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
1388
+	input := make(map[string]interface{})
1389
+	inputData := make(map[string]interface{})
1390
+	inputMessage["infno"] = "2303" // 交易编码
1391
+	inputData["psn_no"] = psnNo    // 人员编号 (来自1101接口返回)
1392
+	if certificates == 3 {
1393
+		inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
1394
+		inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
1395
+	} else {
1396
+		if id_card_type == 1 {
1397
+			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
1398
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
1399
+		} else {
1400
+			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
1401
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
1402
+		}
1403
+	}
1404
+	inputData["mdtrt_cert_sn"] = ""
1405
+	inputData["mid_setl_flag"] = mid_setl_flag // 中途退费标志
1406
+	inputData["medfee_sumamt"] = total         // 医疗费总额
1407
+	inputData["psn_setlway"] = "02"            // 个人结算方式 01 按项目结 02 按定额结算
1408
+	inputData["mdtrt_id"] = mdtrtId            // 就诊 ID(来自2201接口返回)
1409
+	inputData["acct_used_flag"] = "1"          // 个人账户使用标志 0否 1是
1410
+	inputData["insutype"] = insutype           // 险种类型
1411
+	inputData["invono"] = ""                   // 发票号
1412
+	inputData["dise_codg"] = "M07803"          // 发票号
1413
+
1414
+	inputData["insuplc_admdvs"] = insuplc_admdvs   // 发票号
1415
+	inputData["mdtrtarea_admvs"] = mdtrtarea_admvs // 发票号
1416
+
1417
+	input["data"] = inputData
1418
+	inputMessage["input"] = input //交易输入
1419
+	bytesData, err := json.Marshal(inputMessage)
1420
+	fmt.Println(string(bytesData))
1421
+	requestLog := string(bytesData)
1422
+	if err != nil {
1423
+		fmt.Println(err.Error())
1424
+		return err.Error(), ""
1425
+	}
1426
+
1427
+	request_url = request_url + "2303"
1428
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2303"), requestLog
1429
+
1430
+}
1431
+
1432
+func Jxyb2304(psnNo string, mdtrtId string, certNo string, insutype string, total string, certificates int64, id_card_type int64, mid_setl_flag string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string, fapiao_number string, acct_used_flag string) (string, string) {
1433
+	// 生成签名
1434
+	nonce := GetRandomString(32)
1435
+	timestamp := time.Now().Unix()
1436
+
1437
+	// 生成输入报文
1438
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
1439
+	input := make(map[string]interface{})
1440
+	inputData := make(map[string]interface{})
1441
+	inputMessage["infno"] = "2304" // 交易编码
1442
+	inputData["psn_no"] = psnNo    // 人员编号 (来自1101接口返回)
1443
+	if certificates == 3 {
1444
+		inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
1445
+		inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
1446
+	} else {
1447
+		if id_card_type == 1 {
1448
+			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
1449
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
1450
+		} else if id_card_type == 4 {
1451
+
1452
+			inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
1453
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
1454
+
1455
+		} else {
1456
+			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
1457
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
1458
+		}
1459
+	}
1460
+	inputData["insuplc_admdvs"] = insuplc_admdvs
1461
+	inputData["mdtrtarea_admvs"] = mdtrtarea_admvs
1462
+
1463
+	inputData["mdtrt_cert_sn"] = ""
1464
+	inputData["mid_setl_flag"] = mid_setl_flag   // 中途退费标志
1465
+	inputData["medfee_sumamt"] = total           // 医疗费总额
1466
+	inputData["psn_setlway"] = "01"              // 个人结算方式 01 按项目结 02 按定额结算
1467
+	inputData["mdtrt_id"] = mdtrtId              // 就诊 ID(来自2201接口返回)
1468
+	inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
1469
+	inputData["insutype"] = insutype             // 险种类型
1470
+
1471
+	input["data"] = inputData
1472
+	inputMessage["input"] = input //交易输入
1473
+
1474
+	bytesData, err := json.Marshal(inputMessage)
1475
+	fmt.Println(string(bytesData))
1476
+	requestLog := string(bytesData)
1477
+	if err != nil {
1478
+		fmt.Println(err.Error())
1479
+		return err.Error(), ""
1480
+	}
1481
+
1482
+	request_url = request_url + "2304"
1483
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2304"), requestLog
1484
+
1485
+}
1486
+func Jxyb2305(psnNo string, mdtrtId string, setlId string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
1487
+	// 生成签名
1488
+	timestamp := time.Now().Unix()
1489
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
1490
+	input := make(map[string]interface{})
1491
+	inputData := make(map[string]interface{})
1492
+	inputMessage["infno"] = "2305" // 交易编码
1493
+
1494
+	inputData["psn_no"] = psnNo     // 人员编号 (来自1101接口返回)
1495
+	inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
1496
+	inputData["setl_id"] = setlId   // 结算 ID
1497
+
1498
+	input["data"] = inputData
1499
+	inputMessage["input"] = input //交易输入
1500
+	bytesData, err := json.Marshal(inputMessage)
1501
+	fmt.Println(string(bytesData))
1502
+	requestLog := string(bytesData)
1503
+	if err != nil {
1504
+		fmt.Println(err.Error())
1505
+		return err.Error(), ""
1506
+	}
1507
+
1508
+	request_url = request_url + "2305"
1509
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2305"), requestLog
1510
+
1511
+}
1512
+
1015 1513
 //CBS总线
1016 1514
 func JXHttpRequest(url string, ak string, sk string, timestamp int64, json string, infno string) string {
1017 1515
 	fmt.Println(url)

+ 84 - 0
service/zh_his_service.go Datei anzeigen

@@ -99,6 +99,90 @@ func ZHGdyb1101(certNo string, org_name string, doctor string, fixmedins_code st
99 99
 	resultLog = str
100 100
 	return str, requestLog, resultLog
101 101
 }
102
+func ZHGdyb1101C(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates int64, name string) (string, string, string) {
103
+	//生成签名
104
+	var requestLog string
105
+	var resultLog string
106
+	nonce := GetRandomString(32)
107
+	timestamp := time.Now().Unix()
108
+	signature := setSignature(timestamp, nonce, secret_key)
109
+	//生成输入报文
110
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
111
+	input := make(map[string]interface{})
112
+	inputData := make(map[string]interface{})
113
+	inputMessage["infno"] = "1101" // 交易编码
114
+
115
+	if certificates == 3 {
116
+		inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
117
+		inputData["certno"] = certNo        // 证件号码
118
+		inputData["psn_cert_type"] = "99"   // 人员证件类型
119
+
120
+	} else {
121
+		if id_card_type == 1 {
122
+			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
123
+			inputData["card_sn"] = card_sn      // 卡识别码
124
+			inputData["certno"] = certNo        // 证件号码
125
+			inputData["psn_cert_type"] = "01"   // 人员证件类型
126
+
127
+		} else {
128
+			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
129
+			inputData["card_sn"] = ""           // 卡识别码
130
+			inputData["certno"] = certNo        // 证件号码
131
+			inputData["psn_cert_type"] = "01"   // 人员证件类型
132
+		}
133
+	}
134
+
135
+	inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
136
+	inputData["begntime"] = ""          // 开始时间
137
+	inputData["psn_name"] = name        // 人员姓名
138
+	input["data"] = inputData
139
+	inputMessage["input"] = input //交易输入
140
+
141
+	bytesData, err := json.Marshal(inputMessage)
142
+	fmt.Println(string(bytesData))
143
+	requestLog = string(bytesData)
144
+	if err != nil {
145
+		fmt.Println(err.Error())
146
+		return err.Error(), "", ""
147
+	}
148
+	reader := bytes.NewReader(bytesData)
149
+	gdyb_url := beego.AppConfig.String("gdyb_url")
150
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
151
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
152
+	url := gdyb_url + "1101"
153
+	if mdtrtarea_admvs == "150499" {
154
+		url = gdyb_url
155
+	}
156
+
157
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
158
+	request, err := http.NewRequest("POST", url, reader)
159
+	if err != nil {
160
+		fmt.Println(err.Error())
161
+		return err.Error(), "", ""
162
+	}
163
+
164
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
165
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
166
+	request.Header.Set("x-tif-signature", signature)
167
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
168
+	request.Header.Set("x-tif-nonce", nonce)
169
+
170
+	client := http.Client{}
171
+	resp, err := client.Do(request)
172
+	if err != nil {
173
+		fmt.Println(err.Error())
174
+		return err.Error(), "", ""
175
+	}
176
+	respBytes, err := ioutil.ReadAll(resp.Body)
177
+	if err != nil {
178
+		fmt.Println(err.Error())
179
+		return err.Error(), "", ""
180
+	}
181
+	fmt.Println(string(respBytes))
182
+	str := string(respBytes)
183
+	resultLog = str
184
+	return str, requestLog, resultLog
185
+}
102 186
 
103 187
 func ZHGdyb1101B(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates int64, name string) (string, string) {
104 188
 	//生成签名