test_user 1 gadu atpakaļ
vecāks
revīzija
f4c8b3eb1d

+ 1 - 1
conf/app.conf Parādīt failu

@@ -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 = 10215
54
+org_id = 10188
55 55
 gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
56 56
 gdyb_paasid = "sg02_prd"
57 57
 

+ 2 - 1
controllers/gz/new_his_api_controller.go Parādīt failu

@@ -1136,7 +1136,8 @@ func (c *HisApiController) CheckCardPWD() {
1136 1136
 		})
1137 1137
 		return
1138 1138
 	} else {
1139
-		if res.Output.Result.SscnoCheckStat == "0" {
1139
+		fmt.Println(res.Output.Result.CardStat)
1140
+		if res.Output.Result.SscnoCheckStat == "0" && res.Output.Result.CardStat != "10" {
1140 1141
 			var msg string
1141 1142
 			switch res.Output.Result.CardStat {
1142 1143
 			case "00":

+ 0 - 2
controllers/hb/hbyb_controller.go Parādīt failu

@@ -266,9 +266,7 @@ func (c *HBybController) PostFour() {
266 266
 
267 267
 	var dat map[string]interface{}
268 268
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
269
-
270 269
 	} else {
271
-
272 270
 	}
273 271
 	c.ServeSuccessJSON(map[string]interface{}{
274 272
 		"pre": dat,

+ 14 - 3
controllers/nm/nm_controller.go Parādīt failu

@@ -85,7 +85,7 @@ func (c *NmController) GetNewELeInfo() {
85 85
 		data["result"] = dat
86 86
 		var req *http.Request
87 87
 		bytesData, _ := json.Marshal(data)
88
-		req, _ = http.NewRequest("POST", "http://172.16.23.189:9532/"+"api/ele/info", bytes.NewReader(bytesData))
88
+		req, _ = http.NewRequest("POST", "http://172.16.13.253:9532/"+"api/ele/info", bytes.NewReader(bytesData))
89 89
 		client := &http.Client{}
90 90
 		resp, _ := client.Do(req)
91 91
 		defer resp.Body.Close()
@@ -132,14 +132,25 @@ func (c *NmController) GetToken() {
132 132
 			if len(token) > 0 {
133 133
 				data := make(map[string]interface{})
134 134
 				data["token"] = token
135
-				data["result"] = ele.Data
135
+				data["id_card_no"] = ele.Data.IdNo
136
+				fmt.Println(data)
136 137
 				var req *http.Request
138
+				fmt.Println(req)
139
+
137 140
 				bytesData, _ := json.Marshal(data)
138
-				req, _ = http.NewRequest("POST", "http://172.16.23.189:9532/"+"api/token/get", bytes.NewReader(bytesData))
141
+				fmt.Println(bytesData)
142
+
143
+				req, _ = http.NewRequest("POST", "http://172.16.13.253:9532/"+"api/token/get", bytes.NewReader(bytesData))
144
+				fmt.Println(req)
139 145
 				client := &http.Client{}
140 146
 				resp, _ := client.Do(req)
147
+				fmt.Println(resp)
148
+
141 149
 				defer resp.Body.Close()
142 150
 				body, ioErr := ioutil.ReadAll(resp.Body)
151
+				fmt.Println(resp.Body)
152
+				fmt.Println(body)
153
+				fmt.Println(ioErr)
143 154
 				if ioErr != nil {
144 155
 					utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
145 156
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 803 - 195
controllers/sg/his_api_controller.go


+ 88 - 25
controllers/zh/zh_his_api_controller.go Parādīt failu

@@ -506,6 +506,22 @@ func ZHHisManagerApiRegistRouters() {
506 506
 	beego.Router("/api/4102", &ZHHisApiController{}, "get:Get4102")
507 507
 	beego.Router("/api/4103", &ZHHisApiController{}, "get:Get4103")
508 508
 
509
+	beego.Router("/api/cardstatus", &ZHHisApiController{}, "get:GetCardStatus")
510
+
511
+}
512
+func (c *ZHHisApiController) GetCardStatus() {
513
+	//patient_id, _ := c.GetInt64("patient_id")
514
+	//record_date, _ := c.GetInt64("record_date")
515
+	//psn, _  := service.GetPsnByPatientIdtWO(patient_id,record_date)
516
+	//if len(psn.VerifyNumber) > 0{
517
+	//	c.ServeSuccessJSON(map[string]interface{}{
518
+	//		"msg": "读卡成功",
519
+	//	})
520
+	//} else{
521
+	//	c.ServeSuccessJSON(map[string]interface{}{
522
+	//		"msg": "",
523
+	//	})
524
+	//}
509 525
 }
510 526
 
511 527
 func (c *ZHHisApiController) GetEleInfo() {
@@ -516,16 +532,67 @@ func (c *ZHHisApiController) GetEleInfo() {
516 532
 		return
517 533
 	}
518 534
 	token := respJSON["token"].(string)
519
-	result_respJson := respJSON["result"].(string)
535
+	respJSON = respJSON["result"].(map[string]interface{})
536
+	result_byte, _ := json.Marshal(respJSON)
537
+	result := string(result_byte)
538
+
520 539
 	fmt.Println("token")
521 540
 	fmt.Println(token)
522 541
 	fmt.Println("result")
523
-	fmt.Println(result_respJson)
542
+	fmt.Println(result)
524 543
 
525
-	c.ServeSuccessJSON(map[string]interface{}{
526
-		"msg": "读卡成功",
527
-	})
544
+	var res ResultTwo
545
+	var res10265 ResultTwo10265 //1101结果
546
+	if err := json.Unmarshal([]byte(result), &res10265); err != nil {
547
+		utils.ErrorLog("解析失败:%v", err)
548
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
549
+		return
550
+	}
551
+	res.ErrMsg = res10265.ErrMsg
552
+	infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
553
+	res.Infcode = infocode
554
+	res.Output = res10265.Output
555
+	res.InfRefmsgid = res10265.InfRefmsgid
528 556
 
557
+	if res.Infcode == 0 {
558
+		patient, err := service.GetPatientByNumber(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
559
+		if err == gorm.ErrRecordNotFound {
560
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
561
+			return
562
+		} else if err != nil {
563
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
564
+			return
565
+		} else {
566
+			Iinfos, _ := json.Marshal(res.Output.Iinfo)
567
+			Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
568
+			infoStr := string(Iinfos)
569
+			idetinfoStr := string(Idetinfos)
570
+			psn := &models.HisPsn{
571
+				PsnNo:        res.Output.Baseinfo.PsnNo,
572
+				Age:          res.Output.Baseinfo.Age,
573
+				PatientId:    patient.ID,
574
+				Certno:       res.Output.Baseinfo.Certno,
575
+				Brdy:         res.Output.Baseinfo.Brdy,
576
+				Gend:         res.Output.Baseinfo.Gend,
577
+				Naty:         res.Output.Baseinfo.Naty,
578
+				PsnCertType:  res.Output.Baseinfo.PsnCertType,
579
+				PsnName:      res.Output.Baseinfo.PsnName,
580
+				Idetinfo:     idetinfoStr,
581
+				Insuinfo:     infoStr,
582
+				UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
583
+				CardInfo:     "",
584
+				VerifyNumber: token,
585
+			}
586
+			service.CreateHisPsn(psn)
587
+			c.ServeSuccessJSON(map[string]interface{}{
588
+				"patient": patient,
589
+				"number":  token,
590
+			})
591
+		}
592
+	} else {
593
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
594
+		return
595
+	}
529 596
 }
530 597
 func (c *ZHHisApiController) GetToken() {
531 598
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
@@ -535,27 +602,17 @@ func (c *ZHHisApiController) GetToken() {
535 602
 		return
536 603
 	}
537 604
 	token := respJSON["token"].(string)
538
-	result_respJson := respJSON["result"].(string)
605
+	id_card_no := respJSON["id_card_no"].(string)
539 606
 	fmt.Println("token")
540 607
 	fmt.Println(token)
541 608
 	fmt.Println("result")
542
-	fmt.Println(result_respJson)
543
-	var res ELeData
544
-	result, _ := json.Marshal(result_respJson)
545
-	if err := json.Unmarshal([]byte(result), &res); err != nil {
546
-		utils.ErrorLog("解析失败:%v", err)
547
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
548
-		return
549
-	}
609
+	fmt.Println(id_card_no)
550 610
 
551 611
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
552
-
553
-	patient, _ := service.GetPatientByIDCard(res.Data.IdNo, c.GetAdminUserInfo().CurrentOrgId)
554
-
612
+	patient, _ := service.GetPatientByIDCard(id_card_no, c.GetAdminUserInfo().CurrentOrgId)
555 613
 	var api string
556 614
 	api = "http://172.16.13.254:9532/" + "api/eleinfo?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&org_name=" + miConfig.OrgName +
557 615
 		"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&token=" + token + "&user_name=" + patient.Name + "&id_card_no=" + patient.IdCardNo
558
-
559 616
 	resp, requestErr := http.Get(api)
560 617
 	if requestErr != nil {
561 618
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -568,12 +625,6 @@ func (c *ZHHisApiController) GetToken() {
568 625
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
569 626
 		return
570 627
 	}
571
-	//var respJSON map[string]interface{}
572
-	//if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
573
-	//	utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
574
-	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
575
-	//	return
576
-	//}
577 628
 
578 629
 	c.ServeSuccessJSON(map[string]interface{}{
579 630
 		"msg": "读卡成功",
@@ -1602,7 +1653,6 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
1602 1653
 				} else if insutype == "310" {
1603 1654
 
1604 1655
 					struct2401.MedType = "990502"
1605
-
1606 1656
 				}
1607 1657
 			} else if med_type == 11 {
1608 1658
 				struct2401.MedType = "21"
@@ -2285,6 +2335,7 @@ func (c *ZHHisApiController) GetSettleInfo() {
2285 2335
 	}
2286 2336
 
2287 2337
 	if miConfig.MdtrtareaAdmvs == "150499" {
2338
+
2288 2339
 		psn_info, _ := service.GetPsnByPatientId(patient_id)
2289 2340
 		mdtrt_cert_no := ""
2290 2341
 		if record.IdCardType == 1 {
@@ -2302,6 +2353,18 @@ func (c *ZHHisApiController) GetSettleInfo() {
2302 2353
 			acct_used_flag = "0"
2303 2354
 		}
2304 2355
 
2356
+		if pay_way == 6 {
2357
+			mdtrt_cert_no = psn_info.VerifyNumber
2358
+			acct_used_flag = "1"
2359
+			record.IdCardType = 4
2360
+		} else {
2361
+			acct_used_flag = "0"
2362
+		}
2363
+
2364
+		fmt.Println(mdtrt_cert_no)
2365
+		fmt.Println(acct_used_flag)
2366
+		fmt.Println(record.IdCardType)
2367
+
2305 2368
 		//请求内网数据
2306 2369
 		api := "http://172.16.13.254:9532/" + "nmyb/2304?psn_no=" + record.PsnNo + "&mdtrt_id=" + record.Number + "&chrg_bchno=" + chrg_bchno +
2307 2370
 			"&insutype_type=" + record.InsutypeType + "&total=" + allTotal +

+ 163 - 152
main.go Parādīt failu

@@ -65,25 +65,26 @@ type ResultSeventeen struct {
65 65
 func GetBatchSettleList() {
66 66
 
67 67
 	org_id, _ := beego.AppConfig.Int64("org_id")
68
-	list, _ := service.GetLastFundList(org_id)
69
-	order, _ := service.GetHisOrderByID(list.OrderId)
70
-	var orders []*models.HisOrder
71
-	if order.ID > 0 {
72
-
73
-		orders, _ = service.GetAllHisOrderTwo(org_id, order.ID)
74
-
75
-	} else {
76
-		orders, _ = service.GetAllHisOrder(org_id)
77
-
78
-	}
68
+	//list, _ := service.GetLastFundList(org_id)
69
+	orders, _ := service.GetOrderError(org_id)
70
+	//order, _ := service.GetHisOrderByID(list.OrderId)
71
+	//var orders []*models.HisOrder
72
+	//if order.ID > 0 {
73
+	//
74
+	//	orders, _ = service.GetAllHisOrderTwo(org_id, order.ID)
75
+	//
76
+	//} else {
77
+	//	orders, _ = service.GetAllHisOrder(org_id)
78
+	//
79
+	//}
79 80
 
80 81
 	for _, item := range orders {
81
-		order_id := item.ID
82
+		order_id := item.PatientId
82 83
 		order, _ := service.GetHisOrderByIDTwo(order_id)
83 84
 		roles, _ := service.GetDoctorListTwo(org_id)
84 85
 		his, _ := service.GetHisPatientByNumber(order.MdtrtId)
85 86
 		admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
86
-		curRoles, _ := service.GetAdminUserInfoByID(org_id, 2495)
87
+		curRoles, _ := service.GetAdminUserInfoByID(org_id, 2185)
87 88
 		depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
88 89
 		miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
89 90
 
@@ -132,6 +133,12 @@ func GetBatchSettleList() {
132 133
 		}
133 134
 		struct4101.SetlBegnDate = order.SetlTime
134 135
 		struct4101.SetlEndDate = order.SetlTime
136
+
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
+		}
135 142
 		//if order.SettleType == 1 {
136 143
 		//	t := time.Unix(int64(order.SettleAccountsDate), 0)
137 144
 		//	dateStr := t.Format("2006-01-02")
@@ -605,166 +612,170 @@ func GetBatchSettleList() {
605 612
 
606 613
 		var iteminfoStructs []service.IteminfoStruct
607 614
 
608
-		if bedCostTotal != 0 {
609
-			iteminfo.MedChrgitm = "01"
610
-			iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
611
-			iteminfo.Amt = bedCostTotal
612
-			iteminfo.ClaaSumfee = bed_claa_sunmfee
613
-			iteminfo.ClabAmt = bed_clab_amt
614
-			iteminfo.OthAmt = bed_other_amt
615
-			iteminfoStructs = append(iteminfoStructs, iteminfo)
616
-		}
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
+			}
617 625
 
618
-		if examineCostTotal != 0 {
619
-			iteminfo.MedChrgitm = "02"
620
-			iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
621
-			iteminfo.Amt = examineCostTotal
622
-			iteminfo.ClaaSumfee = examine_claa_sunmfee
623
-			iteminfo.ClabAmt = examine_clab_amt
624
-			iteminfo.OthAmt = examine_other_amt
625
-			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
626
-			iteminfoStructs = append(iteminfoStructs, iteminfo)
627
-		}
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
+			}
628 636
 
629
-		if checkCostTotal != 0 {
630
-			iteminfo.MedChrgitm = "03"
631
-			iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
632
-			iteminfo.Amt = checkCostTotal
633
-			iteminfo.ClaaSumfee = check_claa_sunmfee
634
-			iteminfo.ClabAmt = check_clab_amt
635
-			iteminfo.OthAmt = check_other_amt
636
-			iteminfoStructs = append(iteminfoStructs, iteminfo)
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)
637 645
 
638
-		}
646
+			}
639 647
 
640
-		if laboratoryCostTotal != 0 {
641
-			iteminfo.MedChrgitm = "04"
642
-			iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
643
-			iteminfo.Amt = laboratoryCostTotal
644
-			iteminfo.ClaaSumfee = laboratory_claa_sunmfee
645
-			iteminfo.ClabAmt = laboratory_clab_amt
646
-			iteminfo.OthAmt = laboratory_other_amt
647
-			iteminfoStructs = append(iteminfoStructs, iteminfo)
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)
648 656
 
649
-			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
657
+				//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
650 658
 
651
-		}
659
+			}
652 660
 
653
-		if treatCostTotal != 0 {
654
-			iteminfo.MedChrgitm = "05"
655
-			iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
656
-			iteminfo.Amt = treatCostTotal
657
-			iteminfo.ClaaSumfee = treat_claa_sunmfee
658
-			iteminfo.ClabAmt = treat_clab_amt
659
-			iteminfo.OthAmt = treat_other_amt
660
-			iteminfoStructs = append(iteminfoStructs, iteminfo)
661
-			//(struct4101.IteminfoStruct, iteminfo)
662
-			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
663
-		}
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
+			}
664 672
 
665
-		if operationCostTotal != 0 {
666
-			iteminfo.MedChrgitm = "06"
667
-			iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
668
-			iteminfo.Amt = operationCostTotal
669
-			iteminfo.ClaaSumfee = operation_claa_sunmfee
670
-			iteminfo.ClabAmt = operation_clab_amt
671
-			iteminfo.OthAmt = operation_other_amt
672
-			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
673
-			iteminfoStructs = append(iteminfoStructs, iteminfo)
674
-		}
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
+			}
675 683
 
676
-		if nursingCostTotal != 0 {
677
-			iteminfo.MedChrgitm = "07"
678
-			iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
679
-			iteminfo.Amt = nursingCostTotal
680
-			iteminfo.ClaaSumfee = nursing_claa_sunmfee
681
-			iteminfo.ClabAmt = nursing_clab_amt
682
-			iteminfo.OthAmt = nursing_other_amt
683
-			iteminfoStructs = append(iteminfoStructs, iteminfo)
684
-		}
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
+			}
685 693
 
686
-		if materialCostTotal != 0 {
687
-			iteminfo.MedChrgitm = "08"
688
-			iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
689
-			iteminfo.Amt = materialCostTotal
690
-			iteminfo.ClaaSumfee = material_claa_sunmfee
691
-			iteminfo.ClabAmt = material_clab_amt
692
-			iteminfo.OthAmt = material_other_amt
693
-			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
694
-			iteminfoStructs = append(iteminfoStructs, iteminfo)
695
-		}
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
+			}
696 704
 
697
-		if westernMedicineCostTotal != 0 {
698
-			iteminfo.MedChrgitm = "09"
699
-			iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
700
-			iteminfo.Amt = westernMedicineCostTotal
701
-			iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
702
-			iteminfo.ClabAmt = westernMedicine_clab_amt
703
-			iteminfo.OthAmt = westernMedicine_other_amt
704
-			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
705
-			iteminfoStructs = append(iteminfoStructs, iteminfo)
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)
706 714
 
707
-		}
715
+			}
708 716
 
709
-		if chineseMedicineCostTotal != 0 {
710
-			iteminfo.MedChrgitm = "10"
711
-			iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
712
-			iteminfo.Amt = chineseMedicineCostTotal
713
-			iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
714
-			iteminfo.ClabAmt = chinese_medicine_clab_amt
715
-			iteminfo.OthAmt = chinese_medicine_other_amt
716
-			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
717
-			iteminfoStructs = append(iteminfoStructs, iteminfo)
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)
718 726
 
719
-		}
727
+			}
720 728
 
721
-		if chineseTraditionalMedicineCostTotal != 0 {
722
-			iteminfo.MedChrgitm = "11"
723
-			iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
724
-			iteminfo.Amt = westernMedicineCostTotal
725
-			iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
726
-			iteminfo.ClabAmt = westernMedicine_clab_amt
727
-			iteminfo.OthAmt = westernMedicine_other_amt
728
-			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
729
-			iteminfoStructs = append(iteminfoStructs, iteminfo)
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)
730 738
 
731
-		}
739
+			}
732 740
 
733
-		if commonlyTreatmentCostTotal != 0 {
734
-			iteminfo.MedChrgitm = "12"
735
-			iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
736
-			iteminfo.Amt = commonlyTreatmentCostTotal
737
-			iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
738
-			iteminfo.ClabAmt = commonly_treatment_clab_amt
739
-			iteminfo.OthAmt = commonly_treatment_other_amt
740
-			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
741
-			iteminfoStructs = append(iteminfoStructs, iteminfo)
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)
742 750
 
743
-		}
751
+			}
744 752
 
745
-		if registerCostTotal != 0 {
746
-			iteminfo.MedChrgitm = "13"
747
-			iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
748
-			iteminfo.Amt = registerCostTotal
749
-			iteminfo.ClaaSumfee = register_claa_sunmfee
750
-			iteminfo.ClabAmt = register_clab_amt
751
-			iteminfo.OthAmt = register_other_amt
752
-			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
753
-			iteminfoStructs = append(iteminfoStructs, iteminfo)
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)
754 762
 
755
-		}
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)
756 774
 
757
-		if otherCostTotal != 0 {
758
-			iteminfo.MedChrgitm = "14"
759
-			iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
760
-			iteminfo.Amt = otherCostTotal
761
-			iteminfo.ClaaSumfee = other_claa_sunmfee
762
-			iteminfo.ClabAmt = other_clab_amt
763
-			iteminfo.OthAmt = other_other_amt
764
-			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
765
-			iteminfoStructs = append(iteminfoStructs, iteminfo)
775
+			}
766 776
 
767 777
 		}
778
+
768 779
 		struct4101.IteminfoStruct = iteminfoStructs
769 780
 		time_arr := strings.Split(order.SetlTime, " ")
770 781
 		struct4101.AdmTime = time_arr[0]
@@ -845,7 +856,7 @@ func GetBatchSettleList() {
845 856
 					ErrMsg:    res.ErrMsg + "解析失败",
846 857
 					Status:    1,
847 858
 					PatientId: order_id,
848
-					Stage:     10106,
859
+					Stage:     90000,
849 860
 				}
850 861
 				service.CreateErrMsgLog(errlog)
851 862
 				continue
@@ -861,7 +872,7 @@ func GetBatchSettleList() {
861 872
 				ErrMsg:    res.ErrMsg,
862 873
 				Status:    1,
863 874
 				PatientId: order_id,
864
-				Stage:     10106,
875
+				Stage:     90000,
865 876
 			}
866 877
 			service.CreateErrMsgLog(errlog)
867 878
 			continue

+ 86 - 76
models/his_models.go Parādīt failu

@@ -609,82 +609,83 @@ func (XtHisPatient) TableName() string {
609 609
 }
610 610
 
611 611
 type HisOrder struct {
612
-	ID                    int64     `gorm:"column:id" json:"id" form:"id"`
613
-	UserOrgId             int64     `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
614
-	HisPatientId          int64     `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
615
-	SettleAccountsDate    int64     `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
616
-	Ctime                 int64     `gorm:"column:ctime" json:"ctime" form:"ctime"`
617
-	Mtime                 int64     `gorm:"column:mtime" json:"mtime" form:"mtime"`
618
-	Status                int64     `gorm:"column:status" json:"status" form:"status"`
619
-	Number                string    `gorm:"column:number" json:"number" form:"number"`
620
-	PatientId             int64     `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
621
-	Infcode               int64     `gorm:"column:infcode" json:"infcode" form:"infcode"`
622
-	WarnMsg               string    `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
623
-	Cainfo                string    `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
624
-	ErrMsg                string    `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
625
-	RespondTime           string    `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
626
-	InfRefmsgid           string    `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
627
-	OrderStatus           int64     `gorm:"column:order_status" json:"order_status" form:"order_status"`
628
-	MdtrtId               string    `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
629
-	SetlId                string    `gorm:"column:setl_id" json:"setl_id" form:"setl_id"`
630
-	PsnNo                 string    `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
631
-	PsnName               string    `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
632
-	PsnCertType           string    `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
633
-	Certno                string    `gorm:"column:certno" json:"certno" form:"certno"`
634
-	Gend                  string    `gorm:"column:gend" json:"gend" form:"gend"`
635
-	Naty                  string    `gorm:"column:naty" json:"naty" form:"naty"`
636
-	Brdy                  time.Time `gorm:"column:brdy" json:"brdy" form:"brdy"`
637
-	Age                   float64   `gorm:"column:age" json:"age" form:"age"`
638
-	Insutype              string    `gorm:"column:insutype" json:"insutype" form:"insutype"`
639
-	PsnType               string    `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
640
-	CvlservFlag           string    `gorm:"column:cvlserv_flag" json:"cvlserv_flag" form:"cvlserv_flag"`
641
-	SetlTime              string    `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
642
-	MdtrtCertType         string    `gorm:"column:mdtrt_cert_type" json:"mdtrt_cert_type" form:"mdtrt_cert_type"`
643
-	MedType               string    `gorm:"column:med_type" json:"med_type" form:"med_type"`
644
-	MedfeeSumamt          float64   `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
645
-	FulamtOwnpayAmt       float64   `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
646
-	OverlmtSelfPay        float64   `gorm:"column:overlmt_self_pay" json:"overlmt_self_pay" form:"overlmt_self_pay"`
647
-	PreselfpayAmt         float64   `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
648
-	InscpScpAmt           float64   `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
649
-	ActPayDedc            float64   `gorm:"column:act_pay_dedc" json:"act_pay_dedc" form:"act_pay_dedc"`
650
-	HifpPay               float64   `gorm:"column:hifp_pay" json:"hifp_pay" form:"hifp_pay"`
651
-	CvlservPay            float64   `gorm:"column:cvlserv_pay" json:"cvlserv_pay" form:"cvlserv_pay"`
652
-	PoolPropSelfpay       float64   `gorm:"column:pool_prop_selfpay" json:"pool_prop_selfpay" form:"pool_prop_selfpay"`
653
-	HifesPay              float64   `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
654
-	HifmiPay              float64   `gorm:"column:hifmi_pay" json:"hifmi_pay" form:"hifmi_pay"`
655
-	HifobPay              float64   `gorm:"column:hifob_pay" json:"hifob_pay" form:"hifob_pay"`
656
-	MafPay                float64   `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
657
-	OthPay                float64   `gorm:"column:oth_pay" json:"oth_pay" form:"oth_pay"`
658
-	FundPaySumamt         float64   `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
659
-	PsnPartAmt            float64   `gorm:"column:psn_part_amt" json:"psn_part_amt" form:"psn_part_amt"`
660
-	AcctPay               float64   `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
661
-	PsnCashPay            float64   `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
662
-	HospPartAmt           float64   `gorm:"column:hosp_part_amt" json:"hosp_part_amt" form:"hosp_part_amt"`
663
-	Balc                  float64   `gorm:"column:balc" json:"balc" form:"balc"`
664
-	AcctMulaidPay         float64   `gorm:"column:acct_mulaid_pay" json:"acct_mulaid_pay" form:"acct_mulaid_pay"`
665
-	MedinsSetlId          string    `gorm:"column:medins_setl_id" json:"medins_setl_id" form:"medins_setl_id"`
666
-	ClrOptins             string    `gorm:"column:clr_optins" json:"clr_optins" form:"clr_optins"`
667
-	ClrWay                string    `gorm:"column:clr_way" json:"clr_way" form:"clr_way"`
668
-	ClrType               string    `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
669
-	SetlDetail            string    `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
670
-	IsMedicineInsurance   int64     `gorm:"column:is_medicine_insurance" json:"is_medicine_insurance" form:"is_medicine_insurance"`
671
-	PayWay                int64     `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
672
-	PayPrice              float64   `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
673
-	PayCardNo             string    `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
674
-	DiscountPrice         float64   `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
675
-	PreferentialPrice     float64   `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
676
-	RealityPrice          float64   `gorm:"column:reality_price" json:"reality_price" form:"reality_price"`
677
-	FoundPrice            float64   `gorm:"column:found_price" json:"found_price" form:"found_price"`
678
-	MedicalInsurancePrice float64   `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
679
-	PrivatePrice          float64   `gorm:"column:private_price" json:"private_price" form:"private_price"`
680
-	Creator               int64     `gorm:"column:creator" json:"creator" form:"creator"`
681
-	Modify                int64     `gorm:"column:modify" json:"modify" form:"modify"`
682
-	AccountPrice          float64   `gorm:"column:account_price" json:"account_price" form:"account_price"`
683
-
684
-	SzChargeInfo            string `gorm:"column:sz_charge_info" json:"sz_charge_info" form:"sz_charge_info"`
685
-	SzProjectInfo           string `gorm:"column:sz_project_info" json:"sz_project_info" form:"sz_project_info"`
686
-	SzMedicineInsuranceInfo string `gorm:"column:sz_medicine_insurance_info" json:"sz_medicine_insurance_info" form:"sz_medicine_insurance_info"`
687
-	YiliaoNumber            string `gorm:"column:yiliao_number" json:"yiliao_number" form:"yiliao_number"`
612
+	ID                      int64     `gorm:"column:id" json:"id" form:"id"`
613
+	UserOrgId               int64     `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
614
+	HisPatientId            int64     `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
615
+	SettleAccountsDate      int64     `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
616
+	Ctime                   int64     `gorm:"column:ctime" json:"ctime" form:"ctime"`
617
+	Mtime                   int64     `gorm:"column:mtime" json:"mtime" form:"mtime"`
618
+	Status                  int64     `gorm:"column:status" json:"status" form:"status"`
619
+	Number                  string    `gorm:"column:number" json:"number" form:"number"`
620
+	PatientId               int64     `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
621
+	Infcode                 int64     `gorm:"column:infcode" json:"infcode" form:"infcode"`
622
+	WarnMsg                 string    `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
623
+	Cainfo                  string    `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
624
+	ErrMsg                  string    `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
625
+	RespondTime             string    `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
626
+	InfRefmsgid             string    `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
627
+	OrderStatus             int64     `gorm:"column:order_status" json:"order_status" form:"order_status"`
628
+	MdtrtId                 string    `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
629
+	SetlId                  string    `gorm:"column:setl_id" json:"setl_id" form:"setl_id"`
630
+	PsnNo                   string    `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
631
+	PsnName                 string    `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
632
+	PsnCertType             string    `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
633
+	Certno                  string    `gorm:"column:certno" json:"certno" form:"certno"`
634
+	Gend                    string    `gorm:"column:gend" json:"gend" form:"gend"`
635
+	Naty                    string    `gorm:"column:naty" json:"naty" form:"naty"`
636
+	Brdy                    time.Time `gorm:"column:brdy" json:"brdy" form:"brdy"`
637
+	Age                     float64   `gorm:"column:age" json:"age" form:"age"`
638
+	Insutype                string    `gorm:"column:insutype" json:"insutype" form:"insutype"`
639
+	PsnType                 string    `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
640
+	CvlservFlag             string    `gorm:"column:cvlserv_flag" json:"cvlserv_flag" form:"cvlserv_flag"`
641
+	SetlTime                string    `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
642
+	MdtrtCertType           string    `gorm:"column:mdtrt_cert_type" json:"mdtrt_cert_type" form:"mdtrt_cert_type"`
643
+	MedType                 string    `gorm:"column:med_type" json:"med_type" form:"med_type"`
644
+	MedfeeSumamt            float64   `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
645
+	FulamtOwnpayAmt         float64   `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
646
+	OverlmtSelfPay          float64   `gorm:"column:overlmt_self_pay" json:"overlmt_self_pay" form:"overlmt_self_pay"`
647
+	PreselfpayAmt           float64   `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
648
+	InscpScpAmt             float64   `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
649
+	ActPayDedc              float64   `gorm:"column:act_pay_dedc" json:"act_pay_dedc" form:"act_pay_dedc"`
650
+	HifpPay                 float64   `gorm:"column:hifp_pay" json:"hifp_pay" form:"hifp_pay"`
651
+	CvlservPay              float64   `gorm:"column:cvlserv_pay" json:"cvlserv_pay" form:"cvlserv_pay"`
652
+	PoolPropSelfpay         float64   `gorm:"column:pool_prop_selfpay" json:"pool_prop_selfpay" form:"pool_prop_selfpay"`
653
+	HifesPay                float64   `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
654
+	HifmiPay                float64   `gorm:"column:hifmi_pay" json:"hifmi_pay" form:"hifmi_pay"`
655
+	HifobPay                float64   `gorm:"column:hifob_pay" json:"hifob_pay" form:"hifob_pay"`
656
+	MafPay                  float64   `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
657
+	OthPay                  float64   `gorm:"column:oth_pay" json:"oth_pay" form:"oth_pay"`
658
+	FundPaySumamt           float64   `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
659
+	PsnPartAmt              float64   `gorm:"column:psn_part_amt" json:"psn_part_amt" form:"psn_part_amt"`
660
+	AcctPay                 float64   `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
661
+	PsnCashPay              float64   `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
662
+	HospPartAmt             float64   `gorm:"column:hosp_part_amt" json:"hosp_part_amt" form:"hosp_part_amt"`
663
+	Balc                    float64   `gorm:"column:balc" json:"balc" form:"balc"`
664
+	AcctMulaidPay           float64   `gorm:"column:acct_mulaid_pay" json:"acct_mulaid_pay" form:"acct_mulaid_pay"`
665
+	MedinsSetlId            string    `gorm:"column:medins_setl_id" json:"medins_setl_id" form:"medins_setl_id"`
666
+	ClrOptins               string    `gorm:"column:clr_optins" json:"clr_optins" form:"clr_optins"`
667
+	ClrWay                  string    `gorm:"column:clr_way" json:"clr_way" form:"clr_way"`
668
+	ClrType                 string    `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
669
+	SetlDetail              string    `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
670
+	IsMedicineInsurance     int64     `gorm:"column:is_medicine_insurance" json:"is_medicine_insurance" form:"is_medicine_insurance"`
671
+	PayWay                  int64     `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
672
+	PayPrice                float64   `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
673
+	PayCardNo               string    `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
674
+	DiscountPrice           float64   `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
675
+	PreferentialPrice       float64   `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
676
+	RealityPrice            float64   `gorm:"column:reality_price" json:"reality_price" form:"reality_price"`
677
+	FoundPrice              float64   `gorm:"column:found_price" json:"found_price" form:"found_price"`
678
+	MedicalInsurancePrice   float64   `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
679
+	PrivatePrice            float64   `gorm:"column:private_price" json:"private_price" form:"private_price"`
680
+	Creator                 int64     `gorm:"column:creator" json:"creator" form:"creator"`
681
+	Modify                  int64     `gorm:"column:modify" json:"modify" form:"modify"`
682
+	AccountPrice            float64   `gorm:"column:account_price" json:"account_price" form:"account_price"`
683
+	PayWays                 string    `gorm:"column:pay_ways" json:"pay_way" form:"pay_ways"`
684
+	SzChargeInfo            string    `gorm:"column:sz_charge_info" json:"sz_charge_info" form:"sz_charge_info"`
685
+	SzProjectInfo           string    `gorm:"column:sz_project_info" json:"sz_project_info" form:"sz_project_info"`
686
+	SzMedicineInsuranceInfo string    `gorm:"column:sz_medicine_insurance_info" json:"sz_medicine_insurance_info" form:"sz_medicine_insurance_info"`
687
+	YiliaoNumber            string    `gorm:"column:yiliao_number" json:"yiliao_number" form:"yiliao_number"`
688
+	OthDesc                 string    `gorm:"column:oth_desc" json:"oth_desc" form:"oth_desc"`
688 689
 
689 690
 	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
690 691
 	FaPiaoNumber string `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
@@ -712,6 +713,13 @@ type HisOrder struct {
712 713
 	Decimal float64 `gorm:"column:decimal" json:"decimal" form:"decimal"`
713 714
 
714 715
 	Diagnosis string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
716
+
717
+	AcctUsedFlag string `gorm:"column:acct_used_flag" json:"acct_used_flag" form:"acct_used_flag"`
718
+	CashPay      string `gorm:"cash_pay" json:"cash_pay" form:"cash_pay"`
719
+	BandCardPay  string `gorm:"band_card_pay" json:"band_card_pay" form:"band_card_pay"`
720
+	WechatPay    string `gorm:"wechat_pay" json:"wechat_pay" form:"wechat_pay"`
721
+	AliPay       string `gorm:"ali_pay" json:"ali_pay" form:"ali_pay"`
722
+	JifenPay     string `gorm:"jifen_pay" json:"jifen_pay" form:"jifen_pay"`
715 723
 }
716 724
 
717 725
 func (HisOrder) TableName() string {
@@ -1536,6 +1544,8 @@ type HisChargeSettleOrder struct {
1536 1544
 	SettleStartTime     int64   `gorm:"column:settle_start_time" json:"settle_start_time" form:"settle_start_time"`
1537 1545
 	SettleEndTime       int64   `gorm:"column:settle_end_time" json:"settle_end_time" form:"settle_end_time"`
1538 1546
 	IsPre               int64   `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
1547
+	PayWays             string  `gorm:"column:pay_ways" json:"pay_way" form:"pay_ways"`
1548
+	OthDesc             string  `gorm:"column:oth_desc" json:"oth_desc" form:"oth_desc"`
1539 1549
 }
1540 1550
 
1541 1551
 func (HisChargeSettleOrder) TableName() string {

+ 146 - 52
service/auto_create_week_schedules_service.go Parādīt failu

@@ -198,40 +198,19 @@ func AutoGdybCreateStock() {
198 198
 	var NewWarehousing []*models.NewWarehousingInfo
199 199
 	var NewWarehouseOut []*models.NewWarehouseOutInfo
200 200
 	var NewCancelStock []*models.NewCancelStockInfo
201
-
202 201
 	var NewDrugWarehouse []*models.NewDrugWarehouseInfo
203 202
 	var NewDrugWarehouseOut []*models.NewDrugWarehouseOutInfo
204 203
 	var NewDrugCancelStock []*models.NewDrugCancelStockInfo
205
-
206 204
 	var XtDrugInventorys []*models.XtDrugInventory
207 205
 	var XtStockInventorys []*models.XtStockInventoryTwo
208
-
209 206
 	var NewDrugWarehouseOutTwo []*models.NewDrugWarehouseOutInfo
210 207
 
211
-	//var XtDrugInventorys2 []*models.XtDrugInventory
212
-
213
-	readDb.Model(&models.XtDrugInventory{}).Where("user_org_id = ? and status = 1 and is_upload <> 1 AND stock_max_number > 0", org_id).Preload("BaseDrugLib", "status = 1").Find(&XtDrugInventorys)
214
-	readDb.Model(&models.XtStockInventoryTwo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1 AND stock_max_number > 0", org_id).Preload("GoodInfo", "status = 1").Find(&XtStockInventorys)
215
-
216 208
 	readDb.Model(&models.NewWarehousingInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).First(&NewWarehousing)
217
-	readDb.Model(&models.NewWarehouseOutInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewWarehouseOut)
218
-	readDb.Model(&models.NewCancelStockInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewCancelStock)
219
-
220
-	////大丰
221
-	//readDb.Model(&models.NewDrugWarehouseInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 AND id >= 4778", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouse)
222
-	//readDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 AND id >= 360136", org_id).Preload("NewDrugWarehouseInfo","status = 1").Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouseOut)
223
-	//readDb.Model(&models.NewDrugCancelStockInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugCancelStock)
224
-
225
-	//响水
226
-	//readDb.Model(&models.NewDrugWarehouseInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 AND id >= 5720", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouse)
227
-	//readDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 AND id >= 366003", org_id).Preload("NewDrugWarehouseInfo","status = 1").Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouseOut)
228
-	//readDb.Model(&models.NewDrugCancelStockInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 ", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugCancelStock)
229
-	//3502
230
-	//readDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("org_id = ? and status = 1 and is_upload = 1 ", org_id).Preload("NewDrugWarehouseInfo","status = 1").Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouseOut)
231
-
232
-	//3502
233
-	readDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("org_id = ? and status = 1 and is_upload = 1 ", org_id).Preload("NewDrugWarehouseInfo", "status = 1").Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouseOutTwo)
209
+	readDb.Model(&models.NewCancelStockInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewCancelStock)
234 210
 
211
+	//3501,药品和耗材
212
+	readDb.Model(&models.XtDrugInventory{}).Where("user_org_id = ? and status = 1 and is_upload <> 1 AND stock_max_number > 0", org_id).Preload("BaseDrugLib", "status = 1").Find(&XtDrugInventorys)
213
+	readDb.Model(&models.XtStockInventoryTwo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1 ", org_id).Preload("GoodInfo", "status = 1").Find(&XtStockInventorys)
235 214
 	for _, item := range XtDrugInventorys {
236 215
 		res := Post3501ForDrug(org_id, item)
237 216
 		if res.Infcode == 0 {
@@ -244,9 +223,8 @@ func AutoGdybCreateStock() {
244 223
 		}
245 224
 
246 225
 	}
247
-
248
-	for _, item := range NewDrugWarehouseOutTwo {
249
-		res := Post3502ForDrug(org_id, item)
226
+	for _, item := range XtStockInventorys {
227
+		res := Post3501ForGoodInfo(org_id, item)
250 228
 		if res.Infcode == 0 {
251 229
 			writeDb.Model(&models.XtDrugInventory{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
252 230
 				"is_upload": 1,
@@ -258,34 +236,41 @@ func AutoGdybCreateStock() {
258 236
 
259 237
 	}
260 238
 
261
-	for _, item := range NewWarehousing {
262
-		res := Post3503ForGoodInfo(org_id, item)
239
+	//3502
240
+	readDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("org_id = ? and status = 1 and is_upload = 1 ", org_id).Preload("NewDrugWarehouseInfo", "status = 1").Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouseOutTwo)
241
+	//readDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("org_id = ? and status = 1 and is_upload = 1 ", org_id).Preload("NewDrugWarehouseInfo", "status = 1").Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouseOutTwo)
242
+	readDb.Model(&models.NewWarehouseOutInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewWarehouseOut)
243
+
244
+	for _, item := range NewDrugWarehouseOutTwo {
245
+		res := Post3502ForDrug(org_id, item)
263 246
 		if res.Infcode == 0 {
264
-			writeDb.Model(&models.NewWarehousingInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
247
+			writeDb.Model(&models.XtDrugInventory{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
265 248
 				"is_upload": 1,
266 249
 			})
267 250
 		} else {
268 251
 
269 252
 			continue
270 253
 		}
271
-	}
272 254
 
255
+	}
273 256
 	for _, item := range NewWarehouseOut {
274
-		res := Post3505ForGoodInfo(org_id, item)
257
+		res := Post3502ForGoodInfo(org_id, item)
275 258
 		if res.Infcode == 0 {
276
-			writeDb.Model(&models.NewWarehouseOutInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
259
+			writeDb.Model(&models.XtDrugInventory{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
277 260
 				"is_upload": 1,
278 261
 			})
279 262
 		} else {
280 263
 
281 264
 			continue
282 265
 		}
266
+
283 267
 	}
284 268
 
285
-	for _, item := range NewCancelStock {
286
-		res := Post3506ForGoodInfo(org_id, item)
269
+	//3503
270
+	for _, item := range NewWarehousing {
271
+		res := Post3503ForGoodInfo(org_id, item)
287 272
 		if res.Infcode == 0 {
288
-			writeDb.Model(&models.NewCancelStockInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
273
+			writeDb.Model(&models.NewWarehousingInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
289 274
 				"is_upload": 1,
290 275
 			})
291 276
 		} else {
@@ -293,7 +278,6 @@ func AutoGdybCreateStock() {
293 278
 			continue
294 279
 		}
295 280
 	}
296
-
297 281
 	for _, item := range NewDrugWarehouse {
298 282
 		res := Post3503ForDrug(org_id, item)
299 283
 		if res.Infcode == 0 {
@@ -306,6 +290,18 @@ func AutoGdybCreateStock() {
306 290
 		}
307 291
 	}
308 292
 
293
+	//3505
294
+	for _, item := range NewWarehouseOut {
295
+		res := Post3505ForGoodInfo(org_id, item)
296
+		if res.Infcode == 0 {
297
+			writeDb.Model(&models.NewWarehouseOutInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
298
+				"is_upload": 1,
299
+			})
300
+		} else {
301
+
302
+			continue
303
+		}
304
+	}
309 305
 	for _, item := range NewDrugWarehouseOut {
310 306
 		res := Post3505ForDrug(org_id, item)
311 307
 		if res.Infcode == 0 {
@@ -314,7 +310,18 @@ func AutoGdybCreateStock() {
314 310
 			})
315 311
 		}
316 312
 	}
313
+	//3506
314
+	for _, item := range NewCancelStock {
315
+		res := Post3506ForGoodInfo(org_id, item)
316
+		if res.Infcode == 0 {
317
+			writeDb.Model(&models.NewCancelStockInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
318
+				"is_upload": 1,
319
+			})
320
+		} else {
317 321
 
322
+			continue
323
+		}
324
+	}
318 325
 	for _, item := range NewDrugCancelStock {
319 326
 		res := Post3506ForDrug(org_id, item)
320 327
 		if res.Infcode == 0 {
@@ -330,16 +337,16 @@ func AutoGdybCreateStock() {
330 337
 }
331 338
 
332 339
 //耗材库盘上传
333
-func Post3501ForGoodInfo(org_id int64, infos *models.XtDrugInventory) ResultSix {
340
+func Post3501ForGoodInfo(org_id int64, infos *models.XtStockInventoryTwo) ResultSix {
334 341
 	var res ResultSix
335 342
 	miConfig, _ := FindMedicalInsuranceInfo(org_id)
336 343
 	data := make(map[string]interface{})
337 344
 	var struct3501s []models.Struct3501
338 345
 	var struct3501 models.Struct3501
339
-	struct3501.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber
346
+	struct3501.MedListCodg = infos.GoodInfo.MedicalInsuranceNumber
340 347
 	struct3501.FixmedinsHilistId = miConfig.Code
341 348
 	struct3501.FixmedinsHilistName = miConfig.OrgName
342
-	struct3501.FixmedinsBchno = infos.BatchNumber
349
+	struct3501.FixmedinsBchno = infos.Number
343 350
 	struct3501.RxFlag = "0"
344 351
 	struct3501.Invdate = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
345 352
 	struct3501.OrgName = miConfig.OrgName
@@ -349,8 +356,8 @@ func Post3501ForGoodInfo(org_id int64, infos *models.XtDrugInventory) ResultSix
349 356
 	struct3501.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
350 357
 	struct3501.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
351 358
 	struct3501.InvCnt = strconv.FormatInt(infos.Count, 10)
352
-	struct3501.ManuDate = time.Unix(infos.DrugWarehouseInfo.ProductDate, 0).Format("2006-01-02 15:04:05")
353
-	struct3501.ExpyEnd = time.Unix(infos.DrugWarehouseInfo.ExpiryDate, 0).Format("2006-01-02 15:04:05")
359
+	struct3501.ManuDate = time.Unix(infos.WarehousingInfo.ProductDate, 0).Format("2006-01-02 15:04:05")
360
+	struct3501.ExpyEnd = time.Unix(infos.WarehousingInfo.ExpiryDate, 0).Format("2006-01-02 15:04:05")
354 361
 
355 362
 	struct3501s = append(struct3501s, struct3501)
356 363
 	data["struct_3501s"] = struct3501s[0]
@@ -358,7 +365,7 @@ func Post3501ForGoodInfo(org_id int64, infos *models.XtDrugInventory) ResultSix
358 365
 	bytesData, _ := json.Marshal(data)
359 366
 	var req *http.Request
360 367
 
361
-	if miConfig.MdtrtareaAdmvs == "441202" {
368
+	if miConfig.UserOrgId == 10215 {
362 369
 		result := Gdyb3501(struct3501, miConfig.SecretKey)
363 370
 
364 371
 		var dat map[string]interface{}
@@ -449,7 +456,7 @@ func Post3501ForDrug(org_id int64, infos *models.XtDrugInventory) ResultSix {
449 456
 	bytesData, _ := json.Marshal(data)
450 457
 	var req *http.Request
451 458
 
452
-	if miConfig.MdtrtareaAdmvs == "441202" {
459
+	if miConfig.UserOrgId == 10215 {
453 460
 		result := Gdyb3501(struct3501, miConfig.SecretKey)
454 461
 
455 462
 		var dat map[string]interface{}
@@ -540,7 +547,94 @@ func Post3502ForDrug(org_id int64, infos *models.NewDrugWarehouseOutInfo) Result
540 547
 	bytesData, _ := json.Marshal(data)
541 548
 	var req *http.Request
542 549
 
543
-	if miConfig.MdtrtareaAdmvs == "441202" {
550
+	if miConfig.UserOrgId == 10215 {
551
+		result := Gdyb3502(struct3502, miConfig.SecretKey)
552
+
553
+		var dat map[string]interface{}
554
+		if err := json.Unmarshal([]byte(result), &dat); err == nil {
555
+			fmt.Println(dat)
556
+		} else {
557
+			fmt.Println(err)
558
+		}
559
+		userJSONBytes, _ := json.Marshal(dat)
560
+		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
561
+			utils.ErrorLog("解析失败:%v", err)
562
+			res.Infcode = -1
563
+			return res
564
+		}
565
+		return res
566
+
567
+	} else {
568
+		if miConfig.MdtrtareaAdmvs == "320921" {
569
+			req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3502", bytes.NewReader(bytesData))
570
+		} else {
571
+			req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3502", bytes.NewReader(bytesData))
572
+		}
573
+
574
+		resp, _ := client.Do(req)
575
+		defer resp.Body.Close()
576
+		body, ioErr := ioutil.ReadAll(resp.Body)
577
+		if ioErr != nil {
578
+			utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
579
+			res.Infcode = -1
580
+			return res
581
+		}
582
+		var respJSON map[string]interface{}
583
+		if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
584
+			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
585
+			res.Infcode = -1
586
+			return res
587
+		}
588
+
589
+		var resSix10265 ResultSix10265 //1101结果
590
+
591
+		respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
592
+		result, _ := json.Marshal(respJSON)
593
+		if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
594
+			utils.ErrorLog("解析失败:%v", err)
595
+			res.Infcode = -1
596
+			return res
597
+		}
598
+		res.InfRefmsgid = resSix10265.InfRefmsgid
599
+		res.Output = resSix10265.Output
600
+		res.ErrMsg = resSix10265.ErrMsg
601
+		res.Cainfo = resSix10265.Cainfo
602
+		res.WarnMsg = resSix10265.WarnMsg
603
+		infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
604
+		res.Infcode = infocode
605
+
606
+		return res
607
+	}
608
+}
609
+func Post3502ForGoodInfo(org_id int64, infos *models.NewWarehouseOutInfo) ResultSix {
610
+	var res ResultSix
611
+	miConfig, _ := FindMedicalInsuranceInfo(org_id)
612
+	data := make(map[string]interface{})
613
+	//var struct3502s []models.Struct3502
614
+	var struct3502 models.Struct3502
615
+	struct3502.MedListCodg = infos.GoodInfo.MedicalInsuranceNumber
616
+	struct3502.FixmedinsHilistId = miConfig.Code
617
+	struct3502.FixmedinsHilistName = miConfig.OrgName
618
+	struct3502.FixmedinsBchno = infos.WarehousingInfo.Number
619
+	struct3502.FixmedinsCode = miConfig.Code
620
+	struct3502.RxFlag = "0"
621
+	struct3502.InvChgTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
622
+	struct3502.OrgName = miConfig.OrgName
623
+	struct3502.AccessKey = miConfig.AccessKey
624
+	struct3502.RequestUrl = miConfig.Url
625
+	struct3502.SecretKey = miConfig.SecretKey
626
+	struct3502.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
627
+	struct3502.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
628
+	struct3502.InvChgType = "102"
629
+	struct3502.Cnt = strconv.FormatInt(infos.Count, 10)
630
+	struct3502.Pric = fmt.Sprintf("%.2f", infos.GoodInfo.RetailPrice)
631
+
632
+	data["struct_3502s"] = struct3502
633
+	client := &http.Client{}
634
+	bytesData, _ := json.Marshal(data)
635
+	var req *http.Request
636
+
637
+	if miConfig.UserOrgId == 10215 {
544 638
 		result := Gdyb3502(struct3502, miConfig.SecretKey)
545 639
 
546 640
 		var dat map[string]interface{}
@@ -647,7 +741,7 @@ func Post3503ForGoodInfo(org_id int64, infos *models.NewWarehousingInfo) ResultS
647 741
 	bytesData, _ := json.Marshal(data)
648 742
 	fmt.Println(string(bytesData))
649 743
 	var req *http.Request
650
-	if miConfig.MdtrtareaAdmvs == "441202" {
744
+	if miConfig.UserOrgId == 10215 {
651 745
 		result := Gdyb3503(struct3503, miConfig.SecretKey)
652 746
 
653 747
 		var dat map[string]interface{}
@@ -745,7 +839,7 @@ func Post3503ForDrug(org_id int64, infos *models.NewDrugWarehouseInfo) ResultSix
745 839
 	client := &http.Client{}
746 840
 	bytesData, _ := json.Marshal(data)
747 841
 	var req *http.Request
748
-	if miConfig.MdtrtareaAdmvs == "441202" {
842
+	if miConfig.UserOrgId == 10215 {
749 843
 		result := Gdyb3503(struct3503, miConfig.SecretKey)
750 844
 
751 845
 		var dat map[string]interface{}
@@ -854,7 +948,7 @@ func Post3505ForGoodInfo(org_id int64, infos *models.NewWarehouseOutInfo) Result
854 948
 	bytesData, _ := json.Marshal(data)
855 949
 	var req *http.Request
856 950
 
857
-	if miConfig.MdtrtareaAdmvs == "441202" {
951
+	if miConfig.UserOrgId == 10215 {
858 952
 		result := Gdyb3505(struct3501, miConfig.SecretKey)
859 953
 
860 954
 		var dat map[string]interface{}
@@ -972,7 +1066,7 @@ func Post3505ForDrug(org_id int64, infos *models.NewDrugWarehouseOutInfo) Result
972 1066
 	bytesData, _ := json.Marshal(data)
973 1067
 	var req *http.Request
974 1068
 
975
-	if miConfig.MdtrtareaAdmvs == "441202" {
1069
+	if miConfig.UserOrgId == 10215 {
976 1070
 		result := Gdyb3505(struct3505, miConfig.SecretKey)
977 1071
 
978 1072
 		var dat map[string]interface{}
@@ -1070,7 +1164,7 @@ func Post3506ForGoodInfo(org_id int64, infos *models.NewCancelStockInfo) ResultS
1070 1164
 	client := &http.Client{}
1071 1165
 	bytesData, _ := json.Marshal(data)
1072 1166
 	var req *http.Request
1073
-	if miConfig.MdtrtareaAdmvs == "441202" {
1167
+	if miConfig.UserOrgId == 10215 {
1074 1168
 		result := Gdyb3506(struct3506, miConfig.SecretKey)
1075 1169
 
1076 1170
 		var dat map[string]interface{}
@@ -1165,7 +1259,7 @@ func Post3506ForDrug(org_id int64, infos *models.NewDrugCancelStockInfo) ResultS
1165 1259
 	client := &http.Client{}
1166 1260
 	bytesData, _ := json.Marshal(data)
1167 1261
 	var req *http.Request
1168
-	if miConfig.MdtrtareaAdmvs == "441202" {
1262
+	if miConfig.UserOrgId == 10215 {
1169 1263
 		result := Gdyb3506(struct3506, miConfig.SecretKey)
1170 1264
 		var dat map[string]interface{}
1171 1265
 		if err := json.Unmarshal([]byte(result), &dat); err == nil {

+ 12 - 4
service/fj_service.go Parādīt failu

@@ -50,7 +50,7 @@ func FJyb1101(certNo string, org_name string, doctor string, fixmedins_code stri
50 50
 		if id_card_type == 1 {
51 51
 			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
52 52
 			inputData["card_sn"] = card_sn      // 卡识别码
53
-			inputData["psn_cert_type"] = ""     // 人员证件类型
53
+			inputData["psn_cert_type"] = "01"   // 人员证件类型
54 54
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
55 55
 
56 56
 		} else if id_card_type == 4 {
@@ -278,7 +278,7 @@ func FJyb2203(psnNo string, mdtrtId string, doctor string, department string, or
278 278
 	for index, item := range config {
279 279
 		diseinfo_sun := make(map[string]interface{})
280 280
 		diseinfo_sun["diag_type"] = "1"                                                     // 诊断类别
281
-		diseinfo_sun["diag_srt_no"] = index                                                 // 诊断排序号
281
+		diseinfo_sun["diag_srt_no"] = index + 1                                             // 诊断排序号
282 282
 		diseinfo_sun["diag_code"] = item.CountryCode                                        // 诊断代码
283 283
 		diseinfo_sun["diag_name"] = item.ClassName                                          // 诊断名称
284 284
 		diseinfo_sun["diag_dept"] = department                                              // 诊断科室
@@ -992,8 +992,16 @@ func FJyb3201(baseParams models.BaseParams, businessParams models.BusinessParams
992 992
 	inputMessage["sign_key"] = baseParams.SignKey     // 险种
993 993
 	inputMessage["enc_key"] = baseParams.EncKey       // 险种
994 994
 
995
-	inputData["insutype"] = businessParams.Insutype                   // 险种
996
-	inputData["clr_type"] = "11"                                      // 就诊 ID(来自2201接口返回)
995
+	inputData["insutype"] = businessParams.Insutype // 险种
996
+	fmt.Println(businessParams.ClrType)
997
+	if len(businessParams.ClrType) > 0 {
998
+		inputData["clr_type"] = "9903"
999
+	} else {
1000
+
1001
+		inputData["clr_type"] = "11"
1002
+
1003
+	}
1004
+	// 就诊 ID(来自2201接口返回)
997 1005
 	inputData["setl_optins"] = "350581"                               // 结算经办机构
998 1006
 	inputData["stmt_begndate"] = businessParams.StmtBegndate          // 对帐开始时间
999 1007
 	inputData["stmt_enddate"] = businessParams.StmtEnddate            //对帐结束时间

+ 76 - 32
service/gdyb_service.go Parādīt failu

@@ -2948,14 +2948,14 @@ func Gdyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor
2948 2948
 	inputData["nwb_adm_wt"] = ""                              // 新生儿入院体重  必填
2949 2949
 	inputData["opsp_diag_caty"] = ""                          // 门诊慢特病诊断  必填
2950 2950
 	inputData["opsp_mdtrt_date"] = ""                         // 门诊慢特病就诊日期  必填
2951
-	inputData["ipt_med_type"] = struct4101.IptMedType         // 住院医疗类型  必填
2952
-	inputData["adm_way"] = "2"                                // 入院途径  必填
2953
-	inputData["trt_type"] = "1"                               // 治疗类别  必填
2954
-	inputData["adm_time"] = struct4101.AdmTime                // 入院时间  必填
2955
-	inputData["adm_caty"] = struct4101.AdmCaty                // 入院科别  必填
2951
+	inputData["ipt_med_type"] = ""                            // 住院医疗类型  必填
2952
+	inputData["adm_way"] = ""                                 // 入院途径  必填
2953
+	inputData["trt_type"] = ""                                // 治疗类别  必填
2954
+	inputData["adm_time"] = ""                                // 入院时间  必填
2955
+	inputData["adm_caty"] = ""                                // 入院科别  必填
2956 2956
 	inputData["refldept_dept"] = ""                           // 转科科别  必填
2957
-	inputData["dscg_time"] = struct4101.AdmEndTime            // 出院时间  必填
2958
-	inputData["dscg_caty"] = struct4101.AdmCaty               // 出院科别  必填
2957
+	inputData["dscg_time"] = ""                               // 出院时间  必填
2958
+	inputData["dscg_caty"] = ""                               // 出院科别  必填
2959 2959
 	inputData["act_ipt_days"] = ""                            // 实际住院天数  必填
2960 2960
 	inputData["otp_wm_dise"] = ""                             // 门(急) 诊西医诊断  必填
2961 2961
 	inputData["wm_dise_code"] = ""                            // 门(急) 诊中医诊断  必填
@@ -3012,15 +3012,15 @@ func Gdyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor
3012 3012
 	opspdiseinfo = append(opspdiseinfo, opspdiseinfotemp)
3013 3013
 
3014 3014
 	diseinfo := make([]map[string]interface{}, 0) // 住院诊断信息
3015
-	for _, item := range struct4101.Diseinfo {
3016
-		diseinfotemp := make(map[string]interface{})
3017
-		diseinfotemp["maindiag_flag"] = item.MaindiagFlag // 手术操作代码 必填
3018
-		diseinfotemp["diag_type"] = item.DiagType         // 诊断类别  必填
3019
-		diseinfotemp["diag_code"] = item.DiagCode         // 诊断代码 必填
3020
-		diseinfotemp["diag_name"] = item.DiagName         // 诊断名称 必填
3021
-		diseinfotemp["adm_cond_type"] = "3"               // 入院病情类型 必填
3022
-		diseinfo = append(diseinfo, diseinfotemp)
3023
-	}
3015
+	//for _, item := range struct4101.Diseinfo {
3016
+	//	diseinfotemp := make(map[string]interface{})
3017
+	//	diseinfotemp["maindiag_flag"] = item.MaindiagFlag // 手术操作代码 必填
3018
+	//	diseinfotemp["diag_type"] = item.DiagType         // 诊断类别  必填
3019
+	//	diseinfotemp["diag_code"] = item.DiagCode         // 诊断代码 必填
3020
+	//	diseinfotemp["diag_name"] = item.DiagName         // 诊断名称 必填
3021
+	//	diseinfotemp["adm_cond_type"] = "3"               // 入院病情类型 必填
3022
+	//	diseinfo = append(diseinfo, diseinfotemp)
3023
+	//}
3024 3024
 
3025 3025
 	iteminfo := make([]map[string]interface{}, 0)
3026 3026
 	for _, item := range struct4101.IteminfoStruct {
@@ -3057,7 +3057,7 @@ func Gdyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor
3057 3057
 
3058 3058
 	input["setlinfo"] = inputData
3059 3059
 	input["payinfo"] = payinfo
3060
-	input["opspdiseinfo"] = opspdiseinfo
3060
+	//input["opspdiseinfo"] = opspdiseinfo
3061 3061
 	input["diseinfo"] = diseinfo
3062 3062
 	input["iteminfo"] = iteminfo
3063 3063
 	inputMessage["input"] = input //交易输入
@@ -3706,7 +3706,7 @@ func Gdyb2601(psnNo string, omsgid string, oinfno string, org_name string, docto
3706 3706
 }
3707 3707
 
3708 3708
 //人员信息版本3
3709
-func Gdyb1101B(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) string {
3709
+func Gdyb1101B(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, cardNumber string) string {
3710 3710
 	//生成签名
3711 3711
 	nonce := GetRandomString(32)
3712 3712
 	timestamp := time.Now().Unix()
@@ -3726,11 +3726,11 @@ func Gdyb1101B(certNo string, org_name string, doctor string, fixmedins_code str
3726 3726
 	} else {
3727 3727
 		if certificates == 1 {
3728 3728
 			if id_card_type == 1 {
3729
-				inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
3730
-				inputData["card_sn"] = ""           // 卡识别码
3731
-				inputData["certno"] = certNo        // 证件号码
3732
-				inputData["psn_cert_type"] = "01"   // 人员证件类型
3733
-				inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
3729
+				inputData["mdtrt_cert_type"] = "03"     // 就诊凭证类型
3730
+				inputData["card_sn"] = card_sn          // 卡识别码
3731
+				inputData["certno"] = certNo            // 证件号码
3732
+				inputData["psn_cert_type"] = "01"       // 人员证件类型
3733
+				inputData["mdtrt_cert_no"] = cardNumber // 就诊凭证编号
3734 3734
 
3735 3735
 			} else {
3736 3736
 				inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
@@ -3752,8 +3752,8 @@ func Gdyb1101B(certNo string, org_name string, doctor string, fixmedins_code str
3752 3752
 
3753 3753
 	}
3754 3754
 
3755
-	inputData["begntime"] = "" // 开始时间
3756
-	inputData["psn_name"] = "" // 人员姓名
3755
+	inputData["begntime"] = ""   // 开始时间
3756
+	inputData["psn_name"] = name // 人员姓名
3757 3757
 	input["data"] = inputData
3758 3758
 	inputMessage["input"] = input //交易输入
3759 3759
 
@@ -4815,7 +4815,7 @@ func Gdyb3501(struct3501 models.Struct3501, secret_key string) string {
4815 4815
 	signature := setSignature(timestamp, nonce, secret_key)
4816 4816
 
4817 4817
 	// 生成输入报文
4818
-	inputMessage := SetJSInputMessage(timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsHilistId, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Cainfo)
4818
+	inputMessage := SetGdInputMessage(timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsHilistId, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Cainfo)
4819 4819
 	input := make(map[string]interface{})
4820 4820
 	inputData := make(map[string]interface{})
4821 4821
 	inputMessage["infno"] = "3501"                                  // 交易编码
@@ -4879,7 +4879,7 @@ func Gdyb3502(struct3502 models.Struct3502, secret_key string) string {
4879 4879
 	signature := setSignature(timestamp, nonce, secret_key)
4880 4880
 
4881 4881
 	// 生成输入报文
4882
-	inputMessage := SetJSInputMessage(timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsCode, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, struct3502.Cainfo)
4882
+	inputMessage := SetGdInputMessage(timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsCode, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, struct3502.Cainfo)
4883 4883
 	input := make(map[string]interface{})
4884 4884
 	inputData := make(map[string]interface{})
4885 4885
 	inputMessage["infno"] = "3502"                      // 交易编码
@@ -4947,7 +4947,7 @@ func Gdyb3503(struct3503 models.Struct3503, secret_key string) string {
4947 4947
 	signature := setSignature(timestamp, nonce, secret_key)
4948 4948
 
4949 4949
 	// 生成输入报文
4950
-	inputMessage := SetJSInputMessage(timestamp, struct3503.OrgName, struct3503.Opter, struct3503.FixmedinsHilistId, struct3503.InsuplcAdmdvs, struct3503.MdtrtareaAdmvs, struct3503.Cainfo)
4950
+	inputMessage := SetGdInputMessage(timestamp, struct3503.OrgName, struct3503.Opter, struct3503.FixmedinsHilistId, struct3503.InsuplcAdmdvs, struct3503.MdtrtareaAdmvs, struct3503.Cainfo)
4951 4951
 
4952 4952
 	input := make(map[string]interface{})
4953 4953
 
@@ -5025,7 +5025,7 @@ func Gdyb3504(struct3504 models.Struct3504, secret_key string) string {
5025 5025
 	signature := setSignature(timestamp, nonce, secret_key)
5026 5026
 
5027 5027
 	// 生成输入报文
5028
-	inputMessage := SetJSInputMessage(timestamp, struct3504.OrgName, struct3504.Opter, struct3504.FixmedinsCode, struct3504.InsuplcAdmdvs, struct3504.MdtrtareaAdmvs, struct3504.Cainfo)
5028
+	inputMessage := SetGdInputMessage(timestamp, struct3504.OrgName, struct3504.Opter, struct3504.FixmedinsCode, struct3504.InsuplcAdmdvs, struct3504.MdtrtareaAdmvs, struct3504.Cainfo)
5029 5029
 	input := make(map[string]interface{})
5030 5030
 	inputData := make(map[string]interface{})
5031 5031
 	inputMessage["infno"] = "3504"                                      // 交易编码
@@ -5096,7 +5096,7 @@ func Gdyb3505(struct3505 models.Struct3505, secret_key string) string {
5096 5096
 	signature := setSignature(timestamp, nonce, secret_key)
5097 5097
 
5098 5098
 	// 生成输入报文
5099
-	inputMessage := SetJSInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
5099
+	inputMessage := SetGdInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
5100 5100
 	input := make(map[string]interface{})
5101 5101
 	inputData := make(map[string]interface{})
5102 5102
 	inputMessage["infno"] = "3505"                                  // 交易编码
@@ -5191,7 +5191,7 @@ func Gdyb3506(struct3506 models.Struct3506, secret_key string) string {
5191 5191
 	signature := setSignature(timestamp, nonce, secret_key)
5192 5192
 
5193 5193
 	// 生成输入报文
5194
-	inputMessage := SetJSInputMessage(timestamp, struct3506.OrgName, struct3506.Opter, struct3506.FixmedinsCode, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs, struct3506.Cainfo)
5194
+	inputMessage := SetGdInputMessage(timestamp, struct3506.OrgName, struct3506.Opter, struct3506.FixmedinsCode, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs, struct3506.Cainfo)
5195 5195
 	input := make(map[string]interface{})
5196 5196
 	inputData := make(map[string]interface{})
5197 5197
 	inputMessage["infno"] = "3506"                                  // 交易编码
@@ -5266,7 +5266,7 @@ func Gdyb3507(struct3507 models.Struct3507, secret_key string) string {
5266 5266
 	signature := setSignature(timestamp, nonce, secret_key)
5267 5267
 
5268 5268
 	// 生成输入报文
5269
-	inputMessage := SetJSInputMessage(timestamp, struct3507.OrgName, struct3507.Opter, struct3507.FixmedinsCode, struct3507.InsuplcAdmdvs, struct3507.MdtrtareaAdmvs, struct3507.Cainfo)
5269
+	inputMessage := SetGdInputMessage(timestamp, struct3507.OrgName, struct3507.Opter, struct3507.FixmedinsCode, struct3507.InsuplcAdmdvs, struct3507.MdtrtareaAdmvs, struct3507.Cainfo)
5270 5270
 	input := make(map[string]interface{})
5271 5271
 	inputData := make(map[string]interface{})
5272 5272
 	inputMessage["infno"] = "3507"                          // 交易编码
@@ -5315,3 +5315,47 @@ func Gdyb3507(struct3507 models.Struct3507, secret_key string) string {
5315 5315
 	fmt.Println(str)
5316 5316
 	return str
5317 5317
 }
5318
+
5319
+// 生成基础报文
5320
+func SetGdInputMessage(timestamp int64, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, cainfo string) map[string]interface{} {
5321
+	// 生成签名
5322
+	tempTime := time.Unix(timestamp, 0)
5323
+	//timeFormat := tempTime.Format("20060102150405")
5324
+	timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
5325
+	//randNum := rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000)
5326
+
5327
+	month := time.Unix(1557042972, 0).Format("1")
5328
+	year := time.Now().Format("2006")
5329
+	month = time.Now().Format("01")
5330
+	day := time.Now().Format("02")
5331
+
5332
+	hour := time.Now().Format("15")
5333
+	min := time.Now().Format("04")
5334
+	sec := time.Now().Format("05")
5335
+
5336
+	msec := time.Now().Format("000")
5337
+
5338
+	// 生成输入报文
5339
+	inputMessage := make(map[string]interface{})
5340
+	inputMessage["msgid"] = fixmedins_code + year + month + day + hour + min + sec + msec + "0" // 发送方报文 ID
5341
+	inputMessage["mdtrtarea_admvs"] = mdtrtarea_admvs                                           // 就医地医保区划
5342
+	inputMessage["insuplc_admdvs"] = insuplc_admdvs                                             // 参保地医保区划
5343
+	inputMessage["recer_sys_code"] = "MBS_LOCAL"                                                // 接收方系统代码
5344
+	inputMessage["dev_no"] = "1"                                                                // 设备编号
5345
+	inputMessage["dev_safe_info"] = "1"                                                         // 设备安全信息
5346
+	inputMessage["cainfo"] = cainfo                                                             // 数字签名信息
5347
+	inputMessage["signtype"] = "SM3"                                                            // 签名类型
5348
+	inputMessage["infver"] = "1.0.0"                                                            // 接收方系统代码
5349
+	inputMessage["opter_type"] = "1"                                                            // 经办人类别
5350
+
5351
+	inputMessage["opter"] = doctor      // 经办人
5352
+	inputMessage["opter_name"] = doctor // 经办人姓名
5353
+
5354
+	inputMessage["inf_time"] = timeFormatOne        // 交易时间
5355
+	inputMessage["fixmedins_code"] = fixmedins_code // 定点医药机构编号
5356
+	inputMessage["fixmedins_name"] = org_name
5357
+	inputMessage["fixmedins_soft_fcty"] = "深圳市领透科技有限公司" //定点医药机构名称
5358
+	//定点医药机构名称
5359
+	inputMessage["sign_no"] = "" //交易签到流水号
5360
+	return inputMessage
5361
+}

+ 86 - 87
service/gdyb_zifei_service.go Parādīt failu

@@ -400,7 +400,7 @@ func Gdyb4204(certNo string, org_name string, doctor string, fixmedins_code stri
400 400
 
401 401
 }
402 402
 
403
-func Gdyb4205(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 string, psn_name string) (string, string) {
403
+func Gdyb4205(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, struct4202 models.Struct4202, struct4201A models.Struct4201A) (string, string) {
404 404
 	//生成签名
405 405
 	nonce := GetRandomString(32)
406 406
 	timestamp := time.Now().Unix()
@@ -411,14 +411,14 @@ func Gdyb4205(certNo string, org_name string, doctor string, fixmedins_code stri
411 411
 	inputData := make(map[string]interface{})
412 412
 	inputMessage["infno"] = "4205" // 交易编码
413 413
 
414
-	inputData["fixmedins_mdtrt_id"] = ""
415
-	inputData["fixmedins_code"] = ""
416
-	inputData["fixmedins_name"] = ""
414
+	inputData["fixmedins_mdtrt_id"] = struct4202.OwnPayPatnMdtrtD.FixmedinsMdtrtID
415
+	inputData["fixmedins_code"] = struct4202.OwnPayPatnMdtrtD.FixmedinsCode
416
+	inputData["fixmedins_name"] = struct4202.OwnPayPatnMdtrtD.FixmedinsName
417 417
 
418
-	inputData["psn_cert_type"] = ""
418
+	inputData["psn_cert_type"] = struct4202.OwnPayPatnMdtrtD.PsnCertType
419 419
 
420
-	inputData["certno"] = ""
421
-	inputData["psn_name"] = ""
420
+	inputData["certno"] = struct4202.OwnPayPatnMdtrtD.Certno
421
+	inputData["psn_name"] = struct4202.OwnPayPatnMdtrtD.PsnName
422 422
 
423 423
 	inputData["gend"] = ""
424 424
 	inputData["naty"] = ""
@@ -428,9 +428,9 @@ func Gdyb4205(certNo string, org_name string, doctor string, fixmedins_code stri
428 428
 	inputData["tel"] = ""
429 429
 
430 430
 	inputData["addr"] = ""
431
-	inputData["begntime"] = ""
431
+	inputData["begntime"] = struct4202.OwnPayPatnMdtrtD.Begntime
432 432
 	inputData["endtime"] = ""
433
-	inputData["med_type"] = ""
433
+	inputData["med_type"] = struct4202.OwnPayPatnMdtrtD.MedType
434 434
 	inputData["main_cond_dscr"] = ""
435 435
 	inputData["dise_codg"] = ""
436 436
 	inputData["dise_name"] = ""
@@ -446,65 +446,64 @@ func Gdyb4205(certNo string, org_name string, doctor string, fixmedins_code stri
446 446
 	inputData["exp_content"] = ""
447 447
 
448 448
 	diagInfos := make([]map[string]interface{}, 0)
449
-
450
-	diagInfo := make(map[string]interface{})
451
-	diagInfo["diag_type"] = ""   // 就诊 ID(来自2201接口返回)
452
-	diagInfo["diag_srt_no"] = "" // 收费批次号
453
-	diagInfo["diag_code"] = ""   // 病种编码
454
-	diagInfo["diag_name"] = ""   // 处方号
455
-	diagInfo["diag_dept"] = ""
456
-	diagInfo["diag_dr_code"] = ""
457
-	diagInfo["diag_dr_name"] = ""
458
-	diagInfo["diag_time"] = ""
459
-	diagInfo["vali_flag"] = ""
460
-	diagInfos = append(diagInfos, diagInfo)
449
+	for index, item := range struct4202.ODiagListD {
450
+		diagInfo := make(map[string]interface{})
451
+		diagInfo["diag_type"] = item.DiagType // 就诊 ID(来自2201接口返回)
452
+		diagInfo["diag_srt_no"] = index       // 收费批次号
453
+		diagInfo["diag_code"] = item.DiagCode // 病种编码
454
+		diagInfo["diag_name"] = item.DiagName // 处方号
455
+		diagInfo["diag_dept"] = "血透"
456
+		diagInfo["diag_dr_code"] = item.DiagDrCode
457
+		diagInfo["diag_dr_name"] = item.DiagDrName
458
+		diagInfo["diag_time"] = item.DiagTime
459
+		diagInfo["vali_flag"] = "1"
460
+		diagInfos = append(diagInfos, diagInfo)
461
+	}
461 462
 	inputData["diseinfo"] = diagInfos
462 463
 
463 464
 	feedetail := make([]map[string]interface{}, 0)
464
-	feedetailInfo := make(map[string]interface{})
465
-	feedetailInfo["fixmedins_mdtrt_id"] = "" // 就诊 ID(来自2201接口返回)
466
-	feedetailInfo["med_type"] = ""           // 收费批次号
467
-	feedetailInfo["bkkp_sn"] = ""            // 病种编码
468
-	feedetailInfo["fee_ocur_time"] = ""      // 处方号
469
-	feedetailInfo["fixmedins_code"] = ""
470
-	feedetailInfo["fixmedins_name"] = ""
471
-	feedetailInfo["cnt"] = ""
472
-	feedetailInfo["pric"] = ""
473
-	feedetailInfo["det_item_fee_sumamt"] = ""
474
-	feedetailInfo["medins_list_codg"] = ""
475
-	feedetailInfo["medins_list_name"] = ""
476
-	feedetailInfo["med_chrgitm_type"] = ""
477
-	feedetailInfo["prodname"] = ""
478
-	feedetailInfo["bilg_dept_codg"] = ""
479
-	feedetailInfo["bilg_dept_name"] = ""
480
-
481
-	feedetailInfo["bilg_dr_code"] = ""
482
-	feedetailInfo["bilg_dr_name"] = ""
483
-	feedetailInfo["acord_dept_codg"] = ""
484
-	feedetailInfo["acord_dept_name"] = ""
485
-	feedetailInfo["acord_dr_code"] = ""
486
-	feedetailInfo["acord_dr_name"] = ""
487
-
488
-	feedetailInfo["tcmdrug_used_way"] = ""
489
-	feedetailInfo["etip_flag"] = ""
490
-	feedetailInfo["etip_hosp_code"] = ""
491
-
492
-	feedetailInfo["dscg_tkdrug_flag"] = ""
493
-	feedetailInfo["sin_dos_dscr"] = ""
494
-	feedetailInfo["used_frqu_dscr"] = ""
495
-	feedetailInfo["prd_days"] = ""
496
-	feedetailInfo["medc_way_dscr"] = ""
497
-	feedetailInfo["memo"] = ""
498
-
499
-	feedetailInfo["fulamt_ownpay_amt"] = ""
500
-	feedetailInfo["overlmt_selfpay"] = ""
501
-	feedetailInfo["preselfpay_amt"] = ""
502
-	feedetailInfo["inscp_amt"] = ""
503
-	feedetailInfo["rxno"] = ""
465
+	for _, item := range struct4201A.Fopfd {
466
+		inputData := make(map[string]interface{})
467
+		inputData["fixmedins_mdtrt_id"] = item.FixmedinsMdtrtID
468
+		inputData["med_type"] = item.MedType
469
+		inputData["bkkp_sn"] = item.BkkpSn
470
+		inputData["fee_ocur_time"] = item.FeeOcurTime
471
+		inputData["fixmedins_code"] = item.FixmedinsCode
472
+		inputData["fixmedins_name"] = item.FixmedinsName
473
+		inputData["cnt"] = item.Cnt
474
+		inputData["pric"] = item.Pric
475
+		inputData["det_item_fee_sumamt"] = item.DetItemFeeSumamt
504 476
 
505
-	feedetail = append(feedetail, feedetailInfo)
506
-	inputData["feedetail"] = feedetail
477
+		inputData["medins_list_name"] = item.MedinsListName
478
+		inputData["medins_list_code"] = item.MedinsListCodg
479
+		inputData["med_chrgitm_type"] = item.MedChrgitmType
480
+		inputData["prodname"] = item.Prodname
481
+		inputData["bilg_dept_codg"] = item.BilgDeptCodg
482
+		inputData["bilg_dept_name"] = item.BilgDeptName
483
+		inputData["bilg_dr_code"] = item.BilgDrCode
484
+		inputData["bilg_dr_name"] = item.BilgDrName
485
+		inputData["acord_dept_codg"] = ""
486
+		inputData["acord_dept_name"] = ""
487
+		inputData["acord_dr_code"] = ""
488
+		inputData["acord_dr_name"] = ""
489
+		inputData["tcmdrug_used_way"] = ""
490
+		inputData["etip_flag"] = ""
491
+		inputData["etip_hosp_code"] = ""
492
+		inputData["dscg_tkdrug_flag"] = ""
493
+		inputData["sin_dos_dscr"] = ""
494
+		inputData["used_frqu_dscr"] = ""
495
+		inputData["prd_days"] = ""
496
+		inputData["medc_way_dscr"] = ""
497
+		inputData["memo"] = item.Memo
498
+		inputData["fulamt_ownpay_amt"] = ""
499
+		inputData["overlmt_selfpay"] = ""
500
+		inputData["preselfpay_amt"] = ""
501
+		inputData["inscp_amt"] = ""
502
+		inputData["rxno"] = ""
503
+		feedetail = append(feedetail, inputData)
507 504
 
505
+	}
506
+	inputData["feedetail"] = feedetail
508 507
 	input["data"] = inputData
509 508
 	inputMessage["input"] = input //交易输入
510 509
 
@@ -524,7 +523,7 @@ func Gdyb4205(certNo string, org_name string, doctor string, fixmedins_code stri
524 523
 	if fixmedins_code == "H15049901371" {
525 524
 		url = gdyb_url
526 525
 	} else {
527
-		url = gdyb_url + "1101"
526
+		url = gdyb_url + "4205"
528 527
 	}
529 528
 
530 529
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
@@ -556,7 +555,7 @@ func Gdyb4205(certNo string, org_name string, doctor string, fixmedins_code stri
556 555
 	return str, inputLog
557 556
 
558 557
 }
559
-func Gdyb4206(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 string, psn_name string) (string, string) {
558
+func Gdyb4206(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) (string, string) {
560 559
 	//生成签名
561 560
 	nonce := GetRandomString(32)
562 561
 	timestamp := time.Now().Unix()
@@ -619,7 +618,7 @@ func Gdyb4206(certNo string, org_name string, doctor string, fixmedins_code stri
619 618
 	return str, inputLog
620 619
 
621 620
 }
622
-func Gdyb4207(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 string, psn_name string) (string, string) {
621
+func Gdyb4207(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, struct4207 models.Struct4207) (string, string) {
623 622
 	//生成签名
624 623
 	nonce := GetRandomString(32)
625 624
 	timestamp := time.Now().Unix()
@@ -630,10 +629,10 @@ func Gdyb4207(certNo string, org_name string, doctor string, fixmedins_code stri
630 629
 	inputData := make(map[string]interface{})
631 630
 	inputMessage["infno"] = "4207" // 交易编码
632 631
 
633
-	inputData["fixmedins_mdtrt_id"] = "" // 开始时间
634
-	inputData["fixmedins_code"] = ""     // 人员姓名
635
-	inputData["page_num"] = ""           // 人员姓名
636
-	inputData["page_size"] = ""          // 人员姓名
632
+	inputData["fixmedins_mdtrt_id"] = struct4207.FixmedinsMdtrtID // 开始时间
633
+	inputData["fixmedins_code"] = struct4207.FixmedinsCode        // 人员姓名
634
+	inputData["page_num"] = struct4207.PageNum                    // 人员姓名
635
+	inputData["page_size"] = struct4207.PageSize                  // 人员姓名
637 636
 
638 637
 	input["input"] = inputData
639 638
 	inputMessage["input"] = input //交易输入
@@ -654,7 +653,7 @@ func Gdyb4207(certNo string, org_name string, doctor string, fixmedins_code stri
654 653
 	if fixmedins_code == "H15049901371" {
655 654
 		url = gdyb_url
656 655
 	} else {
657
-		url = gdyb_url + "1101"
656
+		url = gdyb_url + "4207"
658 657
 	}
659 658
 
660 659
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
@@ -686,7 +685,7 @@ func Gdyb4207(certNo string, org_name string, doctor string, fixmedins_code stri
686 685
 	return str, inputLog
687 686
 
688 687
 }
689
-func Gdyb4208(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 string, psn_name string) (string, string) {
688
+func Gdyb4208(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, struct4208 models.Struct4208) (string, string) {
690 689
 	//生成签名
691 690
 	nonce := GetRandomString(32)
692 691
 	timestamp := time.Now().Unix()
@@ -697,16 +696,16 @@ func Gdyb4208(certNo string, org_name string, doctor string, fixmedins_code stri
697 696
 	inputData := make(map[string]interface{})
698 697
 	inputMessage["infno"] = "4208" // 交易编码
699 698
 
700
-	inputData["psn_cert_type"] = ""    // 开始时间
701
-	inputData["certno"] = ""           // 人员姓名
702
-	inputData["psn_name"] = ""         // 人员姓名
703
-	inputData["begintime"] = ""        // 人员姓名
704
-	inputData["endtime"] = ""          // 人员姓名
705
-	inputData["med_type"] = ""         // 人员姓名
706
-	inputData["medfee_sumamt"] = ""    // 人员姓名
707
-	inputData["elec_billno_code"] = "" // 人员姓名
708
-	inputData["page_num"] = ""         // 人员姓名
709
-	inputData["page_size"] = ""        // 人员姓名
699
+	inputData["psn_cert_type"] = struct4208.PsnCertType       // 开始时间
700
+	inputData["certno"] = struct4208.Certno                   // 人员姓名
701
+	inputData["psn_name"] = struct4208.PsnName                // 人员姓名
702
+	inputData["begintime"] = struct4208.Begntime              // 人员姓名
703
+	inputData["endtime"] = struct4208.Endtime                 // 人员姓名
704
+	inputData["med_type"] = struct4208.MedType                // 人员姓名
705
+	inputData["medfee_sumamt"] = struct4208.MedfeeSumamt      // 人员姓名
706
+	inputData["elec_billno_code"] = struct4208.ElecBillnoCode // 人员姓名
707
+	inputData["page_num"] = struct4208.PageNum                // 人员姓名
708
+	inputData["page_size"] = struct4208.PageSize              // 人员姓名
710 709
 
711 710
 	input["input"] = inputData
712 711
 	inputMessage["input"] = input //交易输入
@@ -759,7 +758,7 @@ func Gdyb4208(certNo string, org_name string, doctor string, fixmedins_code stri
759 758
 	return str, inputLog
760 759
 
761 760
 }
762
-func Gdyb4209(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 string, psn_name string) (string, string) {
761
+func Gdyb4209(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, struct4209 models.Struct4209) (string, string) {
763 762
 	//生成签名
764 763
 	nonce := GetRandomString(32)
765 764
 	timestamp := time.Now().Unix()
@@ -770,10 +769,10 @@ func Gdyb4209(certNo string, org_name string, doctor string, fixmedins_code stri
770 769
 	inputData := make(map[string]interface{})
771 770
 	inputMessage["infno"] = "4209" // 交易编码
772 771
 
773
-	inputData["fixmedins_mdtrt_id"] = "" // 开始时间
774
-	inputData["fixmedins_code"] = ""     // 人员姓名
775
-	inputData["page_num"] = ""           // 人员姓名
776
-	inputData["page_size"] = ""          // 人员姓名
772
+	inputData["fixmedins_mdtrt_id"] = struct4209.FixmedinsMdtrtID // 开始时间
773
+	inputData["fixmedins_code"] = struct4209.FixmedinsCode        // 人员姓名
774
+	inputData["page_num"] = struct4209.PageNum                    // 人员姓名
775
+	inputData["page_size"] = struct4209.PageSize                  // 人员姓名
777 776
 
778 777
 	input["input"] = inputData
779 778
 	inputMessage["input"] = input //交易输入

+ 23 - 2
service/his_service.go Parādīt failu

@@ -614,6 +614,8 @@ type HisOrder struct {
614 614
 	SzMedicineInsuranceInfo string  `gorm:"column:sz_medicine_insurance_info" json:"sz_medicine_insurance_info" form:"sz_medicine_insurance_info"`
615 615
 	MzNumber                string  `gorm:"column:mz_number" json:"mz_number" form:"mz_number"`
616 616
 	OrgSetlNumber           string  `gorm:"column:org_setl_number" json:"org_setl_number" form:"org_setl_number"`
617
+	PayWays                 string  `gorm:"column:pay_ways" json:"pay_way" form:"pay_ways"`
618
+	OthDesc                 string  `gorm:"column:oth_desc" json:"oth_desc" form:"oth_desc"`
617 619
 
618 620
 	HisOrderInfo        models.HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
619 621
 	Patients            models.Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
@@ -833,6 +835,8 @@ type XtHisOrder struct {
833 835
 	PatientId          int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
834 836
 	Creator            int64  `gorm:"column:creator" json:"creator" form:"creator"`
835 837
 	Modify             int64  `gorm:"column:modify" json:"modify" form:"modify"`
838
+	PayWays            string `gorm:"column:pay_ways" json:"pay_way" form:"pay_ways"`
839
+	OthDesc            string `gorm:"column:oth_desc" json:"oth_desc" form:"oth_desc"`
836 840
 
837 841
 	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
838 842
 	FaPiaoNumber string `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
@@ -995,6 +999,9 @@ func GetOrderByTime(start_time int64, end_time int64, org_id int64, insutype str
995 999
 			db = db.Where("clr_type = ?", clr_type)
996 1000
 
997 1001
 		}
1002
+	} else {
1003
+		db = db.Where("clr_type <> ?", "9903")
1004
+
998 1005
 	}
999 1006
 	err = db.Find(&orders).Error
1000 1007
 	return
@@ -1423,6 +1430,11 @@ func GetLastFundList(org_id int64) (order models.HisFundSettleListResult, err er
1423 1430
 	return
1424 1431
 }
1425 1432
 
1433
+func GetOrderError(org_id int64) (order []*models.HisOrderError, err error) {
1434
+	err = readDb.Model(&models.HisOrderError{}).Where("user_org_id = ? AND status = 1 AND stage = 10106 ", org_id).Find(&order).Error
1435
+	return
1436
+}
1437
+
1426 1438
 func GetOrderCountByNumber(org_id int64, patient_id int64, record_time int64, number string) (count int64, err error) {
1427 1439
 	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ? AND status = 1 AND patient_id = ? AND settle_accounts_date = ? AND order_status = 2 AND mdtrt_id = ?", org_id, patient_id, record_time, number).Count(&count).Error
1428 1440
 
@@ -1437,9 +1449,18 @@ func GetPsnByPatientId(patient_id int64) (psn models.HisPsn, err error) {
1437 1449
 	err = readDb.Model(&models.HisPsn{}).Where("patient_id = ?", patient_id).Last(&psn).Error
1438 1450
 	return
1439 1451
 }
1452
+func GetPsnByPatientIdtWO(patient_id int64, record_date int64) (psn models.HisPsn, err error) {
1453
+	err = readDb.Model(&models.HisPsn{}).Where("patient_id = ? AND record_date = ?", patient_id, record_date).Last(&psn).Error
1454
+	return
1455
+}
1440 1456
 
1441
-func GetPsnByPatientIdTwo(patient_id int64, record_date int64) (psn models.HisPsn, err error) {
1442
-	err = readDb.Model(&models.HisPsn{}).Where("patient_id = ? AND record_date = ? AND stage = 1", patient_id, record_date).Last(&psn).Error
1457
+//func GetPsnByPatientIdTwo(patient_id int64, record_date int64) (psn models.HisPsn, err error) {
1458
+//	err = readDb.Model(&models.HisPsn{}).Where("patient_id = ? AND record_date = ? AND stage = 1", patient_id, record_date).Last(&psn).Error
1459
+//	return
1460
+//}
1461
+
1462
+func GetPsnByPatientIdTwo(patient_id int64) (psn models.HisPsn, err error) {
1463
+	err = readDb.Model(&models.HisPsn{}).Where("patient_id = ?", patient_id).Last(&psn).Error
1443 1464
 	return
1444 1465
 }
1445 1466
 

+ 18 - 18
service/hn_service.go Parādīt failu

@@ -616,7 +616,7 @@ func Hnyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, d
616 616
 }
617 617
 
618 618
 //  门诊预结算
619
-func Hnyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, request_url string, access_key string, verify_number string, cainfo string) (string, string) {
619
+func Hnyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, request_url string, access_key string, verify_number string, cainfo string, acct_used_flag string) (string, string) {
620 620
 
621 621
 	// 生成签名
622 622
 	timestamp := time.Now().Unix() //		inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
@@ -655,14 +655,14 @@ func Hnyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
655 655
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
656 656
 	}
657 657
 
658
-	inputData["medfee_sumamt"] = total  // 医疗费总额
659
-	inputData["psn_setlway"] = "01"     // 个人结算方式 01 按项目结 02 按定额结算
660
-	inputData["mdtrt_id"] = mdtrtId     // 就诊 ID(来自2201接口返回)
661
-	inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
662
-	inputData["acct_used_flag"] = "0"   // 个人账户使用标志 0否 1是
663
-	inputData["insutype"] = insutype    // 险种类型
664
-	inputData["invono"] = ""            // 发票号
665
-	inputData["exp_content"] = ""       // 人员编号 (来自1101接口返回)
658
+	inputData["medfee_sumamt"] = total           // 医疗费总额
659
+	inputData["psn_setlway"] = "01"              // 个人结算方式 01 按项目结 02 按定额结算
660
+	inputData["mdtrt_id"] = mdtrtId              // 就诊 ID(来自2201接口返回)
661
+	inputData["chrg_bchno"] = chrgBchno          // 收费批次号(来自2204生成的)
662
+	inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
663
+	inputData["insutype"] = insutype             // 险种类型
664
+	inputData["invono"] = ""                     // 发票号
665
+	inputData["exp_content"] = ""                // 人员编号 (来自1101接口返回)
666 666
 
667 667
 	input["data"] = inputData
668 668
 	inputMessage["input"] = input //交易输入
@@ -685,7 +685,7 @@ func Hnyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
685 685
 }
686 686
 
687 687
 //  门诊预结算
688
-func Hnyb2206Two(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, request_url string, access_key string, verify_number string, cainfo string, card_sn string) (string, string) {
688
+func Hnyb2206Two(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, request_url string, access_key string, verify_number string, cainfo string, card_sn string, acct_used_flag string) (string, string) {
689 689
 
690 690
 	// 生成签名
691 691
 	timestamp := time.Now().Unix() //		inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
@@ -725,14 +725,14 @@ func Hnyb2206Two(psnNo string, mdtrtId string, chrgBchno string, certNo string,
725 725
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
726 726
 	}
727 727
 
728
-	inputData["medfee_sumamt"] = total  // 医疗费总额
729
-	inputData["psn_setlway"] = "01"     // 个人结算方式 01 按项目结 02 按定额结算
730
-	inputData["mdtrt_id"] = mdtrtId     // 就诊 ID(来自2201接口返回)
731
-	inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
732
-	inputData["acct_used_flag"] = "0"   // 个人账户使用标志 0否 1是
733
-	inputData["insutype"] = insutype    // 险种类型
734
-	inputData["invono"] = ""            // 发票号
735
-	inputData["exp_content"] = ""       // 人员编号 (来自1101接口返回)
728
+	inputData["medfee_sumamt"] = total           // 医疗费总额
729
+	inputData["psn_setlway"] = "01"              // 个人结算方式 01 按项目结 02 按定额结算
730
+	inputData["mdtrt_id"] = mdtrtId              // 就诊 ID(来自2201接口返回)
731
+	inputData["chrg_bchno"] = chrgBchno          // 收费批次号(来自2204生成的)
732
+	inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
733
+	inputData["insutype"] = insutype             // 险种类型
734
+	inputData["invono"] = ""                     // 发票号
735
+	inputData["exp_content"] = ""                // 人员编号 (来自1101接口返回)
736 736
 
737 737
 	input["data"] = inputData
738 738
 	inputMessage["input"] = input //交易输入

+ 5 - 0
service/zh_his_service.go Parādīt failu

@@ -1063,6 +1063,11 @@ func ZHGdyb2304(psnNo string, mdtrtId string, chrgBchno string, certNo string, i
1063 1063
 		if id_card_type == 1 {
1064 1064
 			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
1065 1065
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
1066
+		} else if id_card_type == 4 {
1067
+
1068
+			inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
1069
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
1070
+
1066 1071
 		} else {
1067 1072
 			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
1068 1073
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号