test_user 1 year ago
parent
commit
22d7bc90a7

+ 1 - 1
conf/app.conf View File

1
 appname = 血透
1
 appname = 血透
2
 httpport = 9532
2
 httpport = 9532
3
-runmode = prod
3
+runmode = dev
4
 
4
 
5
 
5
 
6
 
6
 

+ 6 - 6
controllers/js/jsyb_controller.go View File

68
 	}
68
 	}
69
 
69
 
70
 	userJSONBytes, _ := json.Marshal(respJSON["struct_3501s"])
70
 	userJSONBytes, _ := json.Marshal(respJSON["struct_3501s"])
71
-	var struct3501 []models.Struct3501
71
+	var struct3501 models.Struct3501
72
 	if err := json.Unmarshal(userJSONBytes, &struct3501); err != nil {
72
 	if err := json.Unmarshal(userJSONBytes, &struct3501); err != nil {
73
 		utils.ErrorLog("解析失败:%v", err)
73
 		utils.ErrorLog("解析失败:%v", err)
74
 		return
74
 		return
75
 	}
75
 	}
76
 
76
 
77
-	result, request_log := service.Jsyb3501(struct3501[0])
78
-	saveJsLog(result, request_log, "3501", "库存盘点", struct3501[0].OrgName)
77
+	result, request_log := service.Jsyb3501(struct3501)
78
+	saveJsLog(result, request_log, "3501", "库存盘点", struct3501.OrgName)
79
 	var dat2 map[string]interface{}
79
 	var dat2 map[string]interface{}
80
 	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
80
 	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
81
 	} else {
81
 	} else {
100
 	}
100
 	}
101
 
101
 
102
 	userJSONBytes, _ := json.Marshal(respJSON["struct_3502s"])
102
 	userJSONBytes, _ := json.Marshal(respJSON["struct_3502s"])
103
-	var struct3502s []models.Struct3502
103
+	var struct3502s models.Struct3502
104
 	if err := json.Unmarshal(userJSONBytes, &struct3502s); err != nil {
104
 	if err := json.Unmarshal(userJSONBytes, &struct3502s); err != nil {
105
 		utils.ErrorLog("解析失败:%v", err)
105
 		utils.ErrorLog("解析失败:%v", err)
106
 		return
106
 		return
107
 	}
107
 	}
108
 
108
 
109
-	result, request_log := service.Jsyb3502(struct3502s[0])
110
-	saveJsLog(result, request_log, "3502", "库存盘点", struct3502s[0].OrgName)
109
+	result, request_log := service.Jsyb3502(struct3502s)
110
+	saveJsLog(result, request_log, "3502", "库存变更", struct3502s.OrgName)
111
 	var dat2 map[string]interface{}
111
 	var dat2 map[string]interface{}
112
 	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
112
 	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
113
 	} else {
113
 	} else {

+ 327 - 166
controllers/nm/nm_controller.go View File

1
 package nm
1
 package nm
2
 
2
 
3
 import (
3
 import (
4
+	"bytes"
4
 	"encoding/json"
5
 	"encoding/json"
5
 	"fmt"
6
 	"fmt"
6
 	"gdyb/controllers"
7
 	"gdyb/controllers"
11
 	"github.com/astaxie/beego"
12
 	"github.com/astaxie/beego"
12
 	"github.com/axgle/mahonia"
13
 	"github.com/axgle/mahonia"
13
 	"io/ioutil"
14
 	"io/ioutil"
15
+	"net/http"
14
 	"os"
16
 	"os"
17
+	"os/exec"
15
 	"regexp"
18
 	"regexp"
16
 	"strconv"
19
 	"strconv"
17
 	"strings"
20
 	"strings"
38
 
41
 
39
 	beego.Router("/nmyb/5203", &NmController{}, "get:Post5203")
42
 	beego.Router("/nmyb/5203", &NmController{}, "get:Post5203")
40
 
43
 
41
-	//beego.Router("/nmyb/readcard", &NmController{}, "get:ReadCard")
44
+	beego.Router("/nmyb/readcard", &NmController{}, "get:ReadCard")
42
 
45
 
43
 	beego.Router("/nmyb/3201", &NmController{}, "get:Get3201")
46
 	beego.Router("/nmyb/3201", &NmController{}, "get:Get3201")
44
 	beego.Router("/nmyb/2202", &NmController{}, "get:Post2202")
47
 	beego.Router("/nmyb/2202", &NmController{}, "get:Post2202")
46
 	beego.Router("/nmyb/4101", &NmController{}, "post:Post4101")
49
 	beego.Router("/nmyb/4101", &NmController{}, "post:Post4101")
47
 	beego.Router("/nmyb/2601", &NmController{}, "get:Get2601")
50
 	beego.Router("/nmyb/2601", &NmController{}, "get:Get2601")
48
 
51
 
52
+	beego.Router("/api/token", &NmController{}, "get:GetToken")
53
+
54
+}
55
+func (c *NmController) GetToken() {
56
+	token := c.GetString("token")
57
+	results := strings.Split(token, "-")
58
+	fmt.Println(token)
59
+	result_code := results[0]
60
+	result_info := results[1]
61
+	if result_code == "0000" {
62
+		var ele2 ELeData2
63
+		err := json.Unmarshal([]byte(result_info), &ele2)
64
+		if err != nil {
65
+			utils.ErrorLog("解析失败:%v", err)
66
+		}
67
+
68
+		if ele2.Code != -2 {
69
+			var ele ELeData
70
+			err := json.Unmarshal([]byte(result_info), &ele)
71
+			if err != nil {
72
+				utils.ErrorLog("解析失败:%v", err)
73
+			}
74
+			token := ele.Data.EcToken
75
+			fmt.Println(token)
76
+			if len(token) > 0 {
77
+				result, _ := service.Gdyb1101ForEleCert("赤峰费森血液透析中心", "关学丽", "H15049901371", "150499", "150499", "MSDBYGxXm1Mtyi3PtOUB7n1ktcxwyW57", token, ele.Data.UserName, ele.Data.IdNo)
78
+				var dat map[string]interface{}
79
+				if err := json.Unmarshal([]byte(result), &dat); err == nil {
80
+					fmt.Println(dat)
81
+				} else {
82
+					fmt.Println(err)
83
+				}
84
+				userJSONBytes, _ := json.Marshal(dat)
85
+				var res ResultTwo
86
+				if err := json.Unmarshal(userJSONBytes, &res); err != nil {
87
+					utils.ErrorLog("解析失败:%v", err)
88
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
89
+					return
90
+				}
91
+
92
+				infocode, _ := strconv.ParseInt(res.Infcode, 10, 64)
93
+				if infocode == 0 {
94
+					data := make(map[string]interface{})
95
+					data["token"] = token
96
+					data["result"] = dat
97
+					var req *http.Request
98
+					bytesData, _ := json.Marshal(data)
99
+					req, _ = http.NewRequest("POST", "http://172.16.23.189:9532/"+"api/token/get", bytes.NewReader(bytesData))
100
+					client := &http.Client{}
101
+					resp, _ := client.Do(req)
102
+					defer resp.Body.Close()
103
+					body, ioErr := ioutil.ReadAll(resp.Body)
104
+					if ioErr != nil {
105
+						utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
106
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
107
+						return
108
+					}
109
+					var respJSON map[string]interface{}
110
+					if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
111
+						utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
112
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
113
+						return
114
+					}
115
+				}
116
+			} else {
117
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
118
+				return
119
+			}
120
+
121
+		}
122
+
123
+	} else {
124
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
125
+		return
126
+	}
127
+
49
 }
128
 }
50
 
129
 
51
 type ReadCardResult struct {
130
 type ReadCardResult struct {
57
 	ErrMsg string `json:"ERRMSG"`
136
 	ErrMsg string `json:"ERRMSG"`
58
 }
137
 }
59
 
138
 
139
+type ELeData2 struct {
140
+	Code    int    `json:"code"`
141
+	Message string `json:"message"`
142
+}
60
 type ELeData struct {
143
 type ELeData struct {
61
 	Data struct {
144
 	Data struct {
62
 		IdNo        string `json:"idNo"`
145
 		IdNo        string `json:"idNo"`
570
 
653
 
571
 }
654
 }
572
 
655
 
573
-//func (c *NmController) ReadCard() {
574
-//	fixmedins_code := c.GetString("fixmedins_code")
575
-//	secret_key := c.GetString("secret_key")
576
-//	org_name := c.GetString("org_name")
577
-//	insuplc_admdvs := c.GetString("insuplc_admdvs")
578
-//	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
579
-//	id_card_type := c.GetString("id_card_type")
580
-//	operator_id := c.GetString("operator_id")
581
-//	operator := c.GetString("operator")
582
-//
583
-//	if initFlag == 0 {
584
-//		c.TestGetBasBaseInit()
585
-//	}
586
-//	switch id_card_type {
587
-//	case "1":
588
-//		pBusiCardInfo := c.GetBasBaseInfo(fixmedins_code, mdtrtarea_admvs, operator, operator_id, org_name)
589
-//		basStr := Remove0000(pBusiCardInfo)
590
-//
591
-//		if len(basStr) == 0 {
592
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
593
-//			return
594
-//		}
595
-//
596
-//		var dat2 map[string]interface{}
597
-//		if err := json.Unmarshal([]byte(basStr), &dat2); err == nil {
598
-//			fmt.Println(dat2)
599
-//		} else {
600
-//			fmt.Println(err)
601
-//		}
602
-//
603
-//		userJSONBytes, _ := json.Marshal(dat2)
604
-//		var res ReadCardResult
605
-//		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
606
-//			utils.ErrorLog("解析失败:%v", err)
607
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
608
-//			return
609
-//		}
610
-//
611
-//		fmt.Println(basStr)
612
-//		bas := strings.Split(res.Output.CardInfo, "|")
613
-//		basNumber := bas[1]
614
-//		fmt.Println(basNumber)
615
-//		card_sn := bas[3]
616
-//		fmt.Println(card_sn)
617
-//		cardNumber := bas[2]
618
-//		name := bas[4]
619
-//
620
-//		result := service.Gdyb1101G(basNumber, org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, 1, card_sn, 1, name, cardNumber)
621
-//		var dat map[string]interface{}
622
-//		if err := json.Unmarshal([]byte(result), &dat); err == nil {
623
-//			fmt.Println(dat)
624
-//		} else {
625
-//			fmt.Println(err)
626
-//		}
627
-//
628
-//		userJSONBytes2, _ := json.Marshal(dat)
629
-//		var res2 ResultTwo
630
-//		if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
631
-//			utils.ErrorLog("解析失败:%v", err)
632
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
633
-//			return
634
-//		}
635
-//		infocode, _ := strconv.ParseInt(res2.Infcode, 10, 64)
636
-//
637
-//		if infocode == 0 {
638
-//			c.ServeSuccessJSON(map[string]interface{}{
639
-//				"status":         "0",
640
-//				"card_info":      res.Output.CardInfo,
641
-//				"busi_card_info": pBusiCardInfo,
642
-//				"result":         res2,
643
-//				"type":           "1",
644
-//			})
645
-//
646
-//		} else {
647
-//			c.ServeSuccessJSON(map[string]interface{}{
648
-//				"status": "-1",
649
-//			})
650
-//		}
651
-//
652
-//		break
653
-//	case "4": //电子凭证
654
-//		_, pBusiCardInfo := c.GetELeInfo(fixmedins_code, operator_id, operator)
655
-//
656
-//		var ele ELeData
657
-//		err := json.Unmarshal([]byte(pBusiCardInfo), &ele)
658
-//		if err != nil {
659
-//			utils.ErrorLog("解析失败:%v", err)
660
-//		}
661
-//		token := ele.Data.EcToken
662
-//		fmt.Println(token)
663
-//		if len(token) > 0 {
664
-//			result := service.Gdyb1101ForEleCert("", org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, token, "")
665
-//			var dat map[string]interface{}
666
-//			if err := json.Unmarshal([]byte(result), &dat); err == nil {
667
-//				fmt.Println(dat)
668
-//			} else {
669
-//				fmt.Println(err)
670
-//			}
671
-//			userJSONBytes, _ := json.Marshal(dat)
672
-//			var res ResultTwo
673
-//			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
674
-//				utils.ErrorLog("解析失败:%v", err)
675
-//				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
676
-//				return
677
-//			}
678
-//
679
-//			infocode, _ := strconv.ParseInt(res.Infcode, 10, 64)
680
-//
681
-//			if infocode == 0 {
682
-//
683
-//				c.ServeSuccessJSON(map[string]interface{}{
684
-//					"status":         "0",
685
-//					"card_info":      pBusiCardInfo,
686
-//					"busi_card_info": pBusiCardInfo,
687
-//					"token":          token,
688
-//					"result":         dat,
689
-//				})
690
-//
691
-//			} else {
692
-//				c.ServeSuccessJSON(map[string]interface{}{
693
-//					"status": "-1",
694
-//				})
695
-//
696
-//			}
697
-//		} else {
698
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
699
-//			return
700
-//		}
701
-//		break
702
-//
703
-//	}
704
-//
705
-//}
656
+func (c *NmController) ReadCard() {
657
+	fixmedins_code := c.GetString("fixmedins_code")
658
+	secret_key := c.GetString("secret_key")
659
+	org_name := c.GetString("org_name")
660
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
661
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
662
+	id_card_type := c.GetString("id_card_type")
663
+	operator_id := c.GetString("operator_id")
664
+	operator := c.GetString("operator")
665
+
666
+	switch id_card_type {
667
+	case "1":
668
+		if initFlag == 0 {
669
+			c.TestGetBasBaseInit()
670
+		}
671
+		pBusiCardInfo := c.GetBasBaseInfo(fixmedins_code, mdtrtarea_admvs, operator, operator_id, org_name)
672
+		basStr := Remove0000(pBusiCardInfo)
673
+
674
+		if len(basStr) == 0 {
675
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
676
+			return
677
+		}
678
+
679
+		var dat2 map[string]interface{}
680
+		if err := json.Unmarshal([]byte(basStr), &dat2); err == nil {
681
+			fmt.Println(dat2)
682
+		} else {
683
+			fmt.Println(err)
684
+		}
685
+
686
+		userJSONBytes, _ := json.Marshal(dat2)
687
+		var res ReadCardResult
688
+		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
689
+			utils.ErrorLog("解析失败:%v", err)
690
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
691
+			return
692
+		}
693
+
694
+		fmt.Println(basStr)
695
+		bas := strings.Split(res.Output.CardInfo, "|")
696
+		basNumber := bas[1]
697
+		fmt.Println(basNumber)
698
+		card_sn := bas[3]
699
+		fmt.Println(card_sn)
700
+		cardNumber := bas[2]
701
+		name := bas[4]
702
+
703
+		result := service.Gdyb1101G(basNumber, org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, 1, card_sn, 1, name, cardNumber)
704
+		var dat map[string]interface{}
705
+		if err := json.Unmarshal([]byte(result), &dat); err == nil {
706
+			fmt.Println(dat)
707
+		} else {
708
+			fmt.Println(err)
709
+		}
710
+
711
+		userJSONBytes2, _ := json.Marshal(dat)
712
+		var res2 ResultTwo
713
+		if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
714
+			utils.ErrorLog("解析失败:%v", err)
715
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
716
+			return
717
+		}
718
+		infocode, _ := strconv.ParseInt(res2.Infcode, 10, 64)
719
+
720
+		if infocode == 0 {
721
+			c.ServeSuccessJSON(map[string]interface{}{
722
+				"status":         "0",
723
+				"card_info":      res.Output.CardInfo,
724
+				"busi_card_info": pBusiCardInfo,
725
+				"result":         res2,
726
+				"type":           "1",
727
+			})
728
+
729
+		} else {
730
+			c.ServeSuccessJSON(map[string]interface{}{
731
+				"status": "-1",
732
+			})
733
+		}
734
+
735
+		break
736
+	case "4": //电子凭证
737
+		result_code, result_info := c.GetELeInfo()
738
+		if result_code == "0000" {
739
+			var ele ELeData
740
+			err := json.Unmarshal([]byte(result_info), &ele)
741
+			if err != nil {
742
+				utils.ErrorLog("解析失败:%v", err)
743
+			}
744
+			token := ele.Data.EcToken
745
+			fmt.Println(token)
746
+			if len(token) > 0 {
747
+				result, _ := service.Gdyb1101ForEleCert(org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, token, ele.Data.UserName, ele.Data.IdNo)
748
+				var dat map[string]interface{}
749
+				if err := json.Unmarshal([]byte(result), &dat); err == nil {
750
+					fmt.Println(dat)
751
+				} else {
752
+					fmt.Println(err)
753
+				}
754
+				userJSONBytes, _ := json.Marshal(dat)
755
+				var res ResultTwo
756
+				if err := json.Unmarshal(userJSONBytes, &res); err != nil {
757
+					utils.ErrorLog("解析失败:%v", err)
758
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
759
+					return
760
+				}
761
+
762
+				infocode, _ := strconv.ParseInt(res.Infcode, 10, 64)
763
+
764
+				if infocode == 0 {
765
+
766
+					c.ServeSuccessJSON(map[string]interface{}{
767
+						"status":         "0",
768
+						"card_info":      result_info,
769
+						"busi_card_info": result_info,
770
+						"token":          token,
771
+						"result":         dat,
772
+					})
773
+
774
+				} else {
775
+					c.ServeSuccessJSON(map[string]interface{}{
776
+						"status": "-1",
777
+					})
778
+
779
+				}
780
+			} else {
781
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
782
+				return
783
+			}
784
+		} else {
785
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
786
+			return
787
+		}
788
+
789
+		break
790
+	case "5": //电子凭证
791
+		_, pBusiCardInfo := c.GetELeInfoTwo(fixmedins_code, operator_id, operator)
792
+
793
+		var ele ELeData
794
+		err := json.Unmarshal([]byte(pBusiCardInfo), &ele)
795
+		if err != nil {
796
+			utils.ErrorLog("解析失败:%v", err)
797
+		}
798
+		token := ele.Data.EcToken
799
+		fmt.Println(token)
800
+		if len(token) > 0 {
801
+			result, _ := service.Gdyb1101ForEleCert(org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, token, ele.Data.IdNo, ele.Data.UserName)
802
+			var dat map[string]interface{}
803
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
804
+				fmt.Println(dat)
805
+			} else {
806
+				fmt.Println(err)
807
+			}
808
+			userJSONBytes, _ := json.Marshal(dat)
809
+			var res ResultTwo
810
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
811
+				utils.ErrorLog("解析失败:%v", err)
812
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
813
+				return
814
+			}
815
+
816
+			infocode, _ := strconv.ParseInt(res.Infcode, 10, 64)
817
+
818
+			if infocode == 0 {
819
+
820
+				c.ServeSuccessJSON(map[string]interface{}{
821
+					"status":         "0",
822
+					"card_info":      pBusiCardInfo,
823
+					"busi_card_info": pBusiCardInfo,
824
+					"token":          token,
825
+					"result":         dat,
826
+				})
827
+
828
+			} else {
829
+				c.ServeSuccessJSON(map[string]interface{}{
830
+					"status": "-1",
831
+				})
832
+
833
+			}
834
+		} else {
835
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
836
+			return
837
+		}
838
+		break
839
+
840
+	}
841
+
842
+}
706
 
843
 
707
 var initFlag int64 = 0
844
 var initFlag int64 = 0
708
 
845
 
846
+func (c *NmController) GetELeInfoTwo(code string, operator_id string, operator_name string) (string, string) {
847
+	DllDef := syscall.MustLoadDLL("NationECCode.dll")
848
+	readCard := DllDef.MustFindProc("NationEcTrans")
849
+	fmt.Println(readCard)
850
+	fmt.Println("!!!!!")
851
+	pBusiCardInfo := make([]byte, 1024*10)
852
+	input := make(map[string]interface{})
853
+	inputData := make(map[string]interface{})
854
+	inputData["orgId"] = code
855
+	inputData["businessType"] = "01101"
856
+	inputData["operatorId"] = operator_id
857
+	inputData["operatorName"] = operator_name
858
+	inputData["officeId"] = "001"
859
+	inputData["officeName"] = "血透室"
860
+	inputData["deviceType"] = ""
861
+	input["data"] = inputData
862
+	input["orgId"] = code
863
+	input["transType"] = "ec.query"
864
+
865
+	bytesData, _ := json.Marshal(input)
866
+	//gdyb_url := beego.AppConfig.String("gdyb_url")
867
+	fmt.Println(string(bytesData))
868
+	url := "http://10.38.22.15:8081" + "/localcfc/api/hsecfc/localQrCodeQuery"
869
+	ret2, aa, bb := readCard.Call(StrPtr(url), (uintptr)(unsafe.Pointer(&bytesData[0])), (uintptr)(unsafe.Pointer(&pBusiCardInfo[0])))
870
+	fmt.Println(aa)
871
+	fmt.Println(bb)
872
+
873
+	fmt.Println(ret2)
874
+	fmt.Println(DeleteExtraSpace(string(pBusiCardInfo)))
875
+	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pBusiCardInfo)), "gbk", "utf-8"))
876
+	if ret2 != 0 {
877
+		return "", ""
878
+	}
879
+	return DeleteExtraSpace(""), DeleteExtraSpace(string(pBusiCardInfo))
880
+}
881
+
709
 func (c *NmController) TestGetBasBaseInit() {
882
 func (c *NmController) TestGetBasBaseInit() {
710
 	DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
883
 	DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
711
 	Iinit := DllDef.MustFindProc("Init")
884
 	Iinit := DllDef.MustFindProc("Init")
809
 	}
982
 	}
810
 	return DeleteExtraSpace(string(pBusiCardInfo))
983
 	return DeleteExtraSpace(string(pBusiCardInfo))
811
 }
984
 }
812
-func (c *NmController) GetELeInfo(code string, operator_id string, operator_name string) (string, string) {
813
-	DllDef := syscall.MustLoadDLL("NationECCode.dll")
814
-	readCard := DllDef.MustFindProc("NationEcTrans")
815
-	fmt.Println(readCard)
816
-	fmt.Println("!!!!!")
817
-	pBusiCardInfo := make([]byte, 2048)
818
-	input := make(map[string]interface{})
819
-	inputData := make(map[string]interface{})
820
-	inputData["orgId"] = code
821
-	inputData["businessType"] = "01101"
822
-	inputData["operatorId"] = operator_id
823
-	inputData["operatorName"] = operator_name
824
-	inputData["officeId"] = "001"
825
-	inputData["officeName"] = "血透室"
826
-	inputData["deviceType"] = ""
827
-	input["data"] = inputData
828
-	input["orgId"] = code
829
-	input["transType"] = "ec.query"
985
+func (c *NmController) GetELeInfo() (string, string) {
986
+	fmt.Println("执行java")
987
+	var json string
988
+	cmd := exec.Command("java", "-jar", "NM_DZPZ.jar", json)
989
+	//fmt.Println(cmd)
990
+	//fmt.Println(cmd.Output())
991
+
992
+	out, err := cmd.Output()
993
+	if err != nil {
994
+		fmt.Println("error:", err.Error())
995
+	}
996
+	fmt.Println(err)
997
+	fmt.Println(string(out))
998
+	fmt.Println("json:")
999
+	fmt.Println(cmd.Args[0])
1000
+	fmt.Println(json)
1001
+	fmt.Println(string(json))
1002
+	fmt.Println("json:")
830
 
1003
 
831
-	bytesData, _ := json.Marshal(input)
832
-	//gdyb_url := beego.AppConfig.String("gdyb_url")
833
-	fmt.Println(string(bytesData))
834
-	url := "http://10.38.22.15:8081" + "/localcfc/api/hsecfc/localQrCodeQuery"
835
-	ret2, aa, bb := readCard.Call(StrPtr(url), (uintptr)(unsafe.Pointer(&bytesData[0])), (uintptr)(unsafe.Pointer(&pBusiCardInfo[0])))
836
-	fmt.Println(aa)
837
-	fmt.Println(bb)
1004
+	results := strings.Split(string(out), "-")
1005
+	return results[0], results[1]
838
 
1006
 
839
-	fmt.Println(ret2)
840
-	fmt.Println(DeleteExtraSpace(string(pBusiCardInfo)))
841
-	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pBusiCardInfo)), "gbk", "utf-8"))
842
-	if ret2 != 0 {
843
-		return "", ""
844
-	}
845
-	return DeleteExtraSpace(""), DeleteExtraSpace(string(pBusiCardInfo))
846
 }
1007
 }
847
 func IntPtr(n int) uintptr {
1008
 func IntPtr(n int) uintptr {
848
 	return uintptr(n)
1009
 	return uintptr(n)

+ 197 - 2
controllers/sg/his_api_controller.go View File

89
 
89
 
90
 	beego.Router("/api/readele", &HisApiController{}, "get:ReadEleToken")
90
 	beego.Router("/api/readele", &HisApiController{}, "get:ReadEleToken")
91
 
91
 
92
+	beego.Router("/api/2505", &HisApiController{}, "get:Get2505")
93
+
94
+	//beego.Router("/api/4201A", &HisApiController{}, "get:Get4201A")
95
+	//beego.Router("/api/4202", &HisApiController{}, "get:Get4202")
96
+	//beego.Router("/api/4203", &HisApiController{}, "get:Get4203")
97
+	//beego.Router("/api/4205", &HisApiController{}, "get:Get4205")
98
+	//beego.Router("/api/4207", &HisApiController{}, "get:Get4207")
99
+	//beego.Router("/api/4208", &HisApiController{}, "get:Get4208")
100
+	//beego.Router("/api/4209", &HisApiController{}, "get:Get4209")
101
+	//
102
+
92
 }
103
 }
93
 
104
 
105
+func (c *HisApiController) Get2505() {
106
+
107
+	miConfig, _ := service.FindMedicalInsuranceInfo(10215)
108
+	service.Gdyb2505("44120000000010585742", "高慧裕", miConfig.OrgName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, "2022-12-23 09:00:00", "2023-12-31 23:00:00")
109
+
110
+}
111
+
112
+//func (c *HisApiController) Get4201A(){
113
+//	order_id, _ := c.GetInt64("order_id")
114
+//	admin_user_id, _ := c.GetInt64("admin_user_id")
115
+//	order, _ := service.GetHisOrderByIDTwo(order_id)
116
+//	his, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
117
+//	order_info, _ := service.GetHisOrderInfoByNumber(order.MdtrtId)
118
+//	order_info_two, _ := service.GetHisOrderInfoByNumberTwo(order.MdtrtId)
119
+//	order_info = append(order_info, order_info_two...)
120
+//	curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
121
+//	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
122
+//
123
+//	department,_ := service.GetDepartMentDetail(his.Departments)
124
+//
125
+//
126
+//
127
+//
128
+//	if order.ID == 0 {
129
+//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
130
+//		return
131
+//	}
132
+//	var fsiOPFLDs []models.FsiOwnpayPatnFeeListDDTO
133
+//	for _,items := range order_info{
134
+//		var fsiOPFLD models.FsiOwnpayPatnFeeListDDTO
135
+//		fsiOPFLD.FixmedinsMdtrtID = items.OrderNumber
136
+//		fsiOPFLD.MedType = "14"
137
+//		fsiOPFLD.BkkpSn = items.OrderNumber
138
+//		fsiOPFLD.FeeOcurTime = time.Unix(items.HisDoctorAdviceInfo.CreatedTime,0).Format("2006-01-02 15:04:05")
139
+//		fsiOPFLD.FixmedinsCode = miConfig.Code
140
+//		fsiOPFLD.FixmedinsName =  miConfig.OrgName
141
+//		fsiOPFLD.Cnt = fmt.Sprintf("%.2f", items.Cnt)
142
+//		fsiOPFLD.Pric = fmt.Sprintf("%.2f", items.Pric)
143
+//		fsiOPFLD.MedChrgitmType = "09"
144
+//		fsiOPFLD.Prodname = items.HisDoctorAdviceInfo.AdviceName
145
+//		fsiOPFLD.BilgDeptCodg = department.Number
146
+//		fsiOPFLD.BilgDeptName = department.Name
147
+//
148
+//
149
+//
150
+//
151
+//
152
+//
153
+//	}
154
+//
155
+//
156
+//
157
+//
158
+//
159
+//
160
+//}
161
+//func (c *HisApiController) Get4202(){
162
+//	order_id, _ := c.GetInt64("order_id")
163
+//	admin_user_id, _ := c.GetInt64("admin_user_id")
164
+//	order, _ := service.GetHisOrderByIDTwo(order_id)
165
+//	his, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
166
+//	curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
167
+//	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
168
+//
169
+//	if order.ID == 0 {
170
+//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
171
+//		return
172
+//	}
173
+//
174
+//	var struct4202 models.Struct4202
175
+//	struct4202.OwnPayPatnMdtrtD.FixmedinsMdtrtID = his.Number
176
+//	struct4202.OwnPayPatnMdtrtD.FixmedinsCode = miConfig.Code
177
+//	struct4202.OwnPayPatnMdtrtD.FixmedinsName = miConfig.OrgName
178
+//	struct4202.OwnPayPatnMdtrtD.PsnCertType ="01"
179
+//	struct4202.OwnPayPatnMdtrtD.Certno =his.IdCardNo
180
+//	struct4202.OwnPayPatnMdtrtD.PsnName = his.Name
181
+//	struct4202.OwnPayPatnMdtrtD.Begntime = his.InHosptialTime
182
+//	struct4202.OwnPayPatnMdtrtD.MedType = "14"
183
+//	struct4202.OwnPayPatnMdtrtD.ValiFlag = "1"
184
+//	struct4202.OwnPayPatnMdtrtD.MedfeeSumamt = fmt.Sprintf("%.2f",order.MedfeeSumamt)
185
+//
186
+//
187
+//	diagnosis_ids := strings.Split(his.Diagnosis, ",")
188
+//	var config []*models.HisXtDiagnoseConfig
189
+//	for _, item := range diagnosis_ids {
190
+//		id, _ := strconv.ParseInt(item, 10, 64)
191
+//		diagnosisConfig, _ := service.FindDiagnoseById(id)
192
+//		config = append(config, &diagnosisConfig)
193
+//	}
194
+//	var tempDiaginfos []models.OwnPayPatnDiagListD
195
+//	for index, item := range config {
196
+//		if index == 0 {
197
+//			var tempDiaginfo  models.OwnPayPatnDiagListD
198
+//			tempDiaginfo.InoutDiagType = "1"
199
+//			tempDiaginfo.DiagCode = item.CountryCode
200
+//			tempDiaginfo.DiagName = item.CountryContentName
201
+//			tempDiaginfo.DiagType = "1"
202
+//			tempDiaginfo.DiagSrtNo = "1"
203
+//			tempDiaginfo.MaindiagFlag = "1"
204
+//			tempDiaginfo.ValiFlag = "1"
205
+//			tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
206
+//		} else {
207
+//
208
+//			var tempDiaginfo models.OwnPayPatnDiagListD
209
+//			tempDiaginfo.DiagCode = item.CountryCode
210
+//			tempDiaginfo.DiagName = item.CountryContentName
211
+//			tempDiaginfo.DiagType = "2"
212
+//			tempDiaginfo.DiagSrtNo = strconv.FormatInt(int64(index+1),10)
213
+//			tempDiaginfo.MaindiagFlag = "0"
214
+//			tempDiaginfo.ValiFlag = "1"
215
+//			tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
216
+//		}
217
+//	}
218
+//	struct4202.ODiagListD = tempDiaginfos
219
+//	service.Gdyb4202(miConfig.OrgName,curRoles.UserName,miConfig.Code,miConfig.InsuplcAdmdvs,miConfig.MdtrtareaAdmvs,miConfig.SecretKey,struct4202)
220
+//
221
+//
222
+//
223
+//
224
+//}
225
+//func (c *HisApiController) Get4203(){
226
+//
227
+//
228
+//}
229
+//func (c *HisApiController) Get4205(){
230
+//
231
+//
232
+//}
233
+//func (c *HisApiController) Get4207(){
234
+//
235
+//
236
+//}
237
+//func (c *HisApiController) Get4208(){
238
+//
239
+//
240
+//}
241
+//func (c *HisApiController) Get4209(){
242
+//
243
+//
244
+//}
245
+
94
 type Result3101 struct {
246
 type Result3101 struct {
95
 	Infcode     string `json:"infcode"`
247
 	Infcode     string `json:"infcode"`
96
 	InfRefmsgid string `json:"inf_refmsgid"`
248
 	InfRefmsgid string `json:"inf_refmsgid"`
153
 		token := c.GetEleBaseInfo()
305
 		token := c.GetEleBaseInfo()
154
 		token = Remove0000(token)
306
 		token = Remove0000(token)
155
 		if len(token) > 0 {
307
 		if len(token) > 0 {
156
-			result2, requestLog2 := service.Gdyb1101ForEleCert(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, token)
308
+			result2, requestLog2 := service.Gdyb1101ForEleCert(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, token, "", "")
157
 			saveLog(result2, requestLog2, "1101", "获取人员信息")
309
 			saveLog(result2, requestLog2, "1101", "获取人员信息")
158
 			var res ResultTwo
310
 			var res ResultTwo
159
 			if err := json.Unmarshal([]byte(result2), &res); err != nil {
311
 			if err := json.Unmarshal([]byte(result2), &res); err != nil {
3056
 
3208
 
3057
 			token = Remove0000(token)
3209
 			token = Remove0000(token)
3058
 
3210
 
3059
-			result2, requestLog2 := service.Gdyb1101ForEleCert(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, token)
3211
+			result2, requestLog2 := service.Gdyb1101ForEleCert(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, token, "", "")
3060
 			saveLog(result2, requestLog2, "1101", "获取人员信息")
3212
 			saveLog(result2, requestLog2, "1101", "获取人员信息")
3061
 			//
3213
 			//
3062
 			var res ResultTwo
3214
 			var res ResultTwo
12447
 				return
12599
 				return
12448
 			}
12600
 			}
12449
 
12601
 
12602
+		} else if miConfig.MdtrtareaAdmvs == "430800" {
12603
+			var baseParams models.BaseParams
12604
+			baseParams.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
12605
+			baseParams.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
12606
+			baseParams.SecretKey = miConfig.SecretKey
12607
+			baseParams.OrgName = miConfig.OrgName
12608
+			baseParams.FixmedinsCode = miConfig.Code
12609
+			baseParams.EncKey = miConfig.EncKey
12610
+			baseParams.AppSecret = miConfig.AppSecret
12611
+			baseParams.SignKey = miConfig.SignKey
12612
+			baseParams.AppID = miConfig.Code
12613
+			baseParams.Doctor = role.UserName
12614
+			baseParams.RequestUrl = miConfig.Url
12615
+			baseParams.AccessKey = miConfig.AccessKey
12616
+
12617
+			businessParams := models.BusinessParams{
12618
+				Insutype:         insutype,
12619
+				ClrType:          clr_type,
12620
+				SetlOptins:       "430822",
12621
+				StmtBegndate:     start_time,
12622
+				StmtEnddate:      end_time,
12623
+				MedfeeSumamt:     medfee_sumamt,
12624
+				FundPaySumamt:    fund_pay_sumamt,
12625
+				AcctPay:          acct_pay,
12626
+				FixmedinsSetlCnt: fixmedins_setl_cnt,
12627
+			}
12628
+			result, requestLog := service.Hnyb3201(businessParams.FixmedinsSetlCnt, businessParams.AcctPay, businessParams.FundPaySumamt, businessParams.MedfeeSumamt, businessParams.StmtBegndate, businessParams.StmtEnddate, businessParams.SetlOptins, businessParams.ClrType, businessParams.Insutype, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs, baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, baseParams.Cainfo)
12629
+			fmt.Println(requestLog)
12630
+			fmt.Println(result)
12631
+
12632
+			var dat map[string]interface{}
12633
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
12634
+				fmt.Println(dat)
12635
+			} else {
12636
+				fmt.Println(err)
12637
+			}
12638
+			userJSONBytes, _ := json.Marshal(dat)
12639
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
12640
+				utils.ErrorLog("解析失败:%v", err)
12641
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
12642
+				return
12643
+			}
12644
+
12450
 		} else if miConfig.MdtrtareaAdmvs == "" {
12645
 		} else if miConfig.MdtrtareaAdmvs == "" {
12451
 			var baseParams models.BaseParams
12646
 			var baseParams models.BaseParams
12452
 			baseParams.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
12647
 			baseParams.InsuplcAdmdvs = miConfig.InsuplcAdmdvs

+ 135 - 1
controllers/zh/zh_his_api_controller.go View File

500
 	beego.Router("/zh/api/lingbao/refund", &ZHHisApiController{}, "get:RefundLingBao")
500
 	beego.Router("/zh/api/lingbao/refund", &ZHHisApiController{}, "get:RefundLingBao")
501
 	beego.Router("/zh/api/lingbao/get", &ZHHisApiController{}, "get:GetLingBao")
501
 	beego.Router("/zh/api/lingbao/get", &ZHHisApiController{}, "get:GetLingBao")
502
 
502
 
503
+	beego.Router("/api/token/get", &ZHHisApiController{}, "post:GetToken")
504
+
505
+}
506
+func (c *ZHHisApiController) GetToken() {
507
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
508
+	var respJSON map[string]interface{}
509
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
510
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
511
+		return
512
+	}
513
+	token := respJSON["token"].(string)
514
+	result_respJson := respJSON["result"].(string)
515
+	fmt.Println("token")
516
+	fmt.Println(token)
517
+	fmt.Println("result")
518
+	fmt.Println(result_respJson)
519
+	var res ResultTwo           //1101结果
520
+	var res10265 ResultTwo10265 //1101结果
521
+	result, _ := json.Marshal(result_respJson)
522
+	if err := json.Unmarshal([]byte(result), &res10265); err != nil {
523
+		utils.ErrorLog("解析失败:%v", err)
524
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
525
+		return
526
+	}
527
+	res.ErrMsg = res10265.ErrMsg
528
+	infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
529
+	res.Infcode = infocode
530
+	res.Output = res10265.Output
531
+	res.InfRefmsgid = res10265.InfRefmsgid
532
+	if res.Infcode == 0 {
533
+		var insutypes []string
534
+		var insutype string
535
+		var is390 int = 0
536
+		var is310 int = 0
537
+		for _, item := range res.Output.Iinfo {
538
+			if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
539
+				insutypes = append(insutypes, item.Insutype)
540
+			}
541
+		}
542
+		if len(insutypes) == 1 {
543
+			insutype = insutypes[0]
544
+		} else {
545
+			for _, i := range insutypes {
546
+				if i == "390" {
547
+					is390 = 1
548
+				}
549
+
550
+				if i == "310" {
551
+					is310 = 1
552
+				}
553
+			}
554
+		}
555
+		if is390 == 1 {
556
+			insutype = "390"
557
+		}
558
+		if is310 == 1 {
559
+			insutype = "310"
560
+		}
561
+		if len(insutypes) == 0 {
562
+			insutype = "310"
563
+		}
564
+		fmt.Println(insutype)
565
+		patient, _ := service.GetPatientByIDCard(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
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
+	}
588
+
503
 }
589
 }
504
 
590
 
505
 func (c *ZHHisApiController) UploadLingBao() {
591
 func (c *ZHHisApiController) UploadLingBao() {
4007
 		break
4093
 		break
4008
 	case 4: //电子凭证
4094
 	case 4: //电子凭证
4009
 		if miConfig.MdtrtareaAdmvs == "150499" {
4095
 		if miConfig.MdtrtareaAdmvs == "150499" {
4096
+			var api string
4097
+			api = "http://172.16.13.254:9532/" + "nmyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
4098
+				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&operator_id=" + strconv.FormatInt(admin_user_id, 10) + "&operator=" + roles.UserName
4099
+
4100
+			resp, requestErr := http.Get(api)
4101
+			if requestErr != nil {
4102
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4103
+				return
4104
+			}
4105
+
4106
+			body, ioErr := ioutil.ReadAll(resp.Body)
4107
+			if ioErr != nil {
4108
+				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
4109
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4110
+				return
4111
+			}
4112
+			var respJSON map[string]interface{}
4113
+			if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
4114
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
4115
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4116
+				return
4117
+			}
4118
+			var status string
4119
+			status = respJSON["data"].(map[string]interface{})["status"].(string)
4120
+			//card_type := respJSON["data"].(map[string]interface{})["type"].(string)
4121
+			var token string
4122
+			var res ResultTwo           //1101结果
4123
+			var res10265 ResultTwo10265 //1101结果
4124
+			if status == "0" {          //读卡成功
4125
+				token = respJSON["data"].(map[string]interface{})["token"].(string)
4126
+				respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
4127
+				result, _ := json.Marshal(respJSON)
4128
+				if err := json.Unmarshal([]byte(result), &res10265); err != nil {
4129
+					utils.ErrorLog("解析失败:%v", err)
4130
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4131
+					return
4132
+				}
4133
+				res.ErrMsg = res10265.ErrMsg
4134
+				infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
4135
+				res.Infcode = infocode
4136
+				res.Output = res10265.Output
4137
+				res.InfRefmsgid = res10265.InfRefmsgid
4138
+				if res.Infcode == 0 {
4139
+					c.ServeSuccessJSON(map[string]interface{}{
4140
+						"number": token,
4141
+					})
4142
+				}
4143
+			}
4010
 
4144
 
4011
 		} else {
4145
 		} else {
4012
 			if initFlagTwo == 0 {
4146
 			if initFlagTwo == 0 {
4014
 			}
4148
 			}
4015
 			token := c.GetEleBaseInfoTwo()
4149
 			token := c.GetEleBaseInfoTwo()
4016
 			token = Remove0000(token)
4150
 			token = Remove0000(token)
4017
-			result2, requestLog2 := service.Gdyb1101ForEleCert(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, token)
4151
+			result2, requestLog2 := service.Gdyb1101ForEleCert(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, token, "", "")
4018
 			saveLog(result2, requestLog2, "1101", "获取人员信息")
4152
 			saveLog(result2, requestLog2, "1101", "获取人员信息")
4019
 			//
4153
 			//
4020
 			var res ResultTwo
4154
 			var res ResultTwo

+ 830 - 8
main.go View File

1
 package main
1
 package main
2
 
2
 
3
 import (
3
 import (
4
+	"bytes"
5
+	"encoding/json"
6
+	"fmt"
7
+	"gdyb/models"
4
 	_ "gdyb/routers"
8
 	_ "gdyb/routers"
5
 	"gdyb/service"
9
 	"gdyb/service"
10
+	"github.com/shopspring/decimal"
11
+	"io/ioutil"
12
+	"net/http"
13
+	"strconv"
14
+	"strings"
15
+	"time"
6
 
16
 
7
 	"github.com/astaxie/beego"
17
 	"github.com/astaxie/beego"
8
 	//"github.com/qiniu/api.v7/auth/qbox"
18
 	//"github.com/qiniu/api.v7/auth/qbox"
15
 
25
 
16
 func init() {
26
 func init() {
17
 	service.ConnectDB()
27
 	service.ConnectDB()
18
-	org_id, _ := beego.AppConfig.Int64("org_id")
19
-	miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
20
-	//CreateLog(miConfig)
21
-	//UploadLog(miConfig)
22
-	if org_id == 10191 {
23
-		service.GetFjAuthorizationInfo(miConfig.Code)
24
-	}
28
+	//org_id, _ := beego.AppConfig.Int64("org_id")
29
+	//miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
30
+	////CreateLog(miConfig)
31
+	////UploadLog(miConfig)
32
+	//if org_id == 10191 {
33
+	//	service.GetFjAuthorizationInfo(miConfig.Code)
34
+	//}
25
 
35
 
26
 }
36
 }
27
 func main() {
37
 func main() {
28
-	service.AutoCreateStock()
38
+	//service.AutoCreateStock()
39
+	//service.AutoUploadData
40
+	//GetBatchSettleList()
29
 	beego.Run()
41
 	beego.Run()
42
+
30
 }
43
 }
31
 
44
 
32
 type CustomFundPay struct {
45
 type CustomFundPay struct {
47
 	WarnInfo    string `json:"warn_info"`
60
 	WarnInfo    string `json:"warn_info"`
48
 }
61
 }
49
 
62
 
63
+func GetBatchSettleList() {
64
+
65
+	org_id, _ := beego.AppConfig.Int64("org_id")
66
+
67
+	orders, _ := service.GetAllHisOrder(org_id)
68
+	for _, item := range orders {
69
+		order_id := item.ID
70
+		order, _ := service.GetHisOrderByIDTwo(order_id)
71
+		roles, _ := service.GetDoctorListTwo(org_id)
72
+		his, _ := service.GetHisPatientByNumber(order.MdtrtId)
73
+		admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
74
+		curRoles, _ := service.GetAdminUserInfoByID(org_id, 2495)
75
+		depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
76
+		miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
77
+
78
+		pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
79
+
80
+		doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
81
+
82
+		if order.ID == 0 {
83
+			return
84
+		}
85
+		if his.BalanceAccountsType == 2 {
86
+			continue
87
+		}
88
+		struct4101 := service.Struct4101{
89
+			PsnNo:          order.PsnNo,
90
+			MdtrtId:        order.MdtrtId,
91
+			SetlId:         order.SetlId,
92
+			PsnName:        order.PsnName,
93
+			Gend:           order.Gend,
94
+			Brdy:           his.Brdy,
95
+			Age:            his.Age,
96
+			Naty:           order.Naty,
97
+			PatnCertType:   "01",
98
+			Certno:         order.Certno,
99
+			Prfs:           "90",
100
+			ConerName:      roles[0].UserName,
101
+			PatnRlts:       "99",
102
+			ConerAddr:      miConfig.OrgName,
103
+			ConerTel:       admin.Mobile,
104
+			HiType:         order.Insutype,
105
+			Insuplc:        his.InsuplcAdmdvs,
106
+			MaindiagFlag:   "1",
107
+			BillCode:       order.SetlId,
108
+			BillNo:         order.SetlId,
109
+			BizSn:          order.Number,
110
+			PsnSelfPay:     order.PsnPartAmt,
111
+			PsnOwnPay:      order.PsnPartAmt,
112
+			AcctPay:        order.AcctPay,
113
+			PsnCashpay:     order.PsnCashPay,
114
+			HiPaymtd:       "1",
115
+			Hsorg:          his.InsuplcAdmdvs,
116
+			HsorgOpter:     his.InsuplcAdmdvs,
117
+			MedinsFillPsn:  curRoles.UserName,
118
+			MedinsFillDept: depart.Name,
119
+			IptMedType:     "2",
120
+		}
121
+		struct4101.SetlBegnDate = order.SetlTime
122
+		struct4101.SetlEndDate = order.SetlTime
123
+		//if order.SettleType == 1 {
124
+		//	t := time.Unix(int64(order.SettleAccountsDate), 0)
125
+		//	dateStr := t.Format("2006-01-02")
126
+		//	struct4101.SetlBegnDate = dateStr
127
+		//	struct4101.SetlEndDate = dateStr
128
+		//} else {
129
+		//	t := time.Unix(int64(order.SettleStartTime), 0)
130
+		//	t2 := time.Unix(int64(order.SettleEndTime), 0)
131
+		//	dateStartStr := t.Format("2006-01-02")
132
+		//	dateEndStr := t2.Format("2006-01-02")
133
+		//	struct4101.SetlBegnDate = dateStartStr
134
+		//	struct4101.SetlEndDate = dateEndStr
135
+		//}
136
+
137
+		var rf []CustomFundPay
138
+		json.Unmarshal([]byte(order.SetlDetail), &rf)
139
+
140
+		var tempFunPays []service.CustomStruct
141
+		var tempFunPay610100 service.CustomStruct
142
+
143
+		for _, item := range rf {
144
+			if item.FundPayType == "610100" {
145
+				tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
146
+				tempFunPay610100.FundPayType = item.FundPayType
147
+			} else {
148
+				var tempFunPay service.CustomStruct
149
+				tempFunPay.FundPayamt = item.FundPayamt
150
+				tempFunPay.FundPayType = item.FundPayType
151
+				tempFunPays = append(tempFunPays, tempFunPay)
152
+			}
153
+		}
154
+		tempFunPays = append(tempFunPays, tempFunPay610100)
155
+		struct4101.CustomStruct = tempFunPays
156
+
157
+		var tempDiaginfos []service.DiaginfoStructTwo
158
+		var tempOpspdiseinfo2 service.OpspdiseinfoStruct
159
+		var tempOpspdiseinfos []service.OpspdiseinfoStruct
160
+
161
+		diagnosis_ids := strings.Split(his.Diagnosis, ",")
162
+		var config []*models.HisXtDiagnoseConfig
163
+		for _, item := range diagnosis_ids {
164
+			id, _ := strconv.ParseInt(item, 10, 64)
165
+			diagnosisConfig, _ := service.FindDiagnoseById(id)
166
+			config = append(config, &diagnosisConfig)
167
+		}
168
+
169
+		for index, item := range config {
170
+			if index == 0 {
171
+				var tempDiaginfo service.DiaginfoStructTwo
172
+				tempDiaginfo.DiagCode = item.CountryCode
173
+				tempDiaginfo.DiagName = item.CountryContentName
174
+				tempDiaginfo.DiagType = "1"
175
+				tempDiaginfo.MaindiagFlag = "1"
176
+				tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
177
+			} else {
178
+
179
+				var tempDiaginfo service.DiaginfoStructTwo
180
+				tempDiaginfo.DiagCode = item.CountryCode
181
+				tempDiaginfo.DiagName = item.CountryContentName
182
+				tempDiaginfo.DiagType = "2"
183
+				tempDiaginfo.MaindiagFlag = "0"
184
+				tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
185
+			}
186
+		}
187
+		struct4101.Diseinfo = tempDiaginfos
188
+
189
+		sickConfigTwo, _ := service.FindSickById(his.SickType)
190
+		tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
191
+		tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
192
+		tempOpspdiseinfo2.OprnOprtCode = ""
193
+		tempOpspdiseinfo2.OprnOprtName = ""
194
+		tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
195
+		struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
196
+
197
+		var iteminfo service.IteminfoStruct
198
+
199
+		var bedCostTotal float64 = 0         //床位总费
200
+		var bedCostSelfTotal float64 = 0     //床位自费
201
+		var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
202
+
203
+		var examineCostTotal float64 = 0         //诊查总费
204
+		var examineCostSelfTotal float64 = 0     //诊查自费
205
+		var examineCostPartSelfTotal float64 = 0 //诊查部分项目自费
206
+
207
+		var nursingCostTotal float64 = 0         //护理总费
208
+		var nursingCostSelfTotal float64 = 0     //护理自费
209
+		var nursingCostPartSelfTotal float64 = 0 //护理部分项目自费
210
+
211
+		var chineseMedicineCostTotal float64 = 0         //中成药
212
+		var chineseMedicineCostSelfTotal float64 = 0     //中成药
213
+		var chineseMedicineCostPartSelfTotal float64 = 0 //中成药
214
+
215
+		var commonlyTreatmentCostTotal float64 = 0         //一般诊疗费
216
+		var commonlyTreatmentCostSelfTotal float64 = 0     //一般诊疗费
217
+		var commonlyTreatmentCostPartSelfTotal float64 = 0 //一般诊疗费
218
+
219
+		var registerCostTotal float64 = 0     //一般诊疗费
220
+		var registerCostSelfTotal float64 = 0 //一般诊疗费
221
+		var registerPartSelfTotal float64 = 0 //一般诊疗费
222
+
223
+		var operationCostTotal float64 = 0         //手术费
224
+		var operationCostSelfTotal float64 = 0     //手术费
225
+		var operationCostPartSelfTotal float64 = 0 //手术费
226
+
227
+		var otherCostTotal float64 = 0         //其他费用
228
+		var otherCostSelfTotal float64 = 0     //其他费用
229
+		var otherCostPartSelfTotal float64 = 0 //其他费用
230
+
231
+		var materialCostTotal float64 = 0         //材料费
232
+		var materialCostSelfTotal float64 = 0     //材料费
233
+		var materialCostPartSelfTotal float64 = 0 //材料费
234
+
235
+		var westernMedicineCostTotal float64 = 0         //西药费
236
+		var westernMedicineCostSelfTotal float64 = 0     //西药费
237
+		var westernMedicineCostPartSelfTotal float64 = 0 //西药费
238
+
239
+		var chineseTraditionalMedicineCostTotal float64 = 0         //中成药
240
+		var chineseTraditionalMedicineCostSelfTotal float64 = 0     //中成药
241
+		var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
242
+
243
+		var checkCostTotal float64 = 0         //检查费
244
+		var checkCostSelfTotal float64 = 0     //检查费
245
+		var checkCostPartSelfTotal float64 = 0 //检查费
246
+
247
+		var laboratoryCostTotal float64 = 0         //化验费
248
+		var laboratoryCostSelfTotal float64 = 0     //化验费
249
+		var laboratoryCostPartSelfTotal float64 = 0 //化验费
250
+
251
+		var treatCostTotal float64 = 0         //治疗费用
252
+		var treatCostSelfTotal float64 = 0     //治疗费用
253
+		var treatCostPartSelfTotal float64 = 0 //治疗费用
254
+
255
+		decimal.DivisionPrecision = 2
256
+
257
+		var bed_fulamt_ownpay_amt float64 = 0
258
+
259
+		var examine_fulamt_ownpay_amt float64 = 0
260
+
261
+		var nursing_fulamt_ownpay_amt float64 = 0
262
+
263
+		var chinese_medicine_fulamt_ownpay_amt float64 = 0
264
+
265
+		var commonly_treatment_fulamt_ownpay_amt float64 = 0
266
+
267
+		var register_fulamt_ownpay_amt float64 = 0
268
+
269
+		var operation_fulamt_ownpay_amt float64 = 0
270
+		var other_fulamt_ownpay_amt float64 = 0
271
+		var westernMedicine_fulamt_ownpay_amt float64 = 0
272
+		var chineseTraditional_fulamt_ownpay_amt float64 = 0
273
+		var check_fulamt_ownpay_amt float64 = 0
274
+		var material_fulamt_ownpay_amt float64 = 0
275
+		var laboratory_fulamt_ownpay_amt float64 = 0
276
+		var treat_fulamt_ownpay_amt float64 = 0
277
+
278
+		var bed_claa_sunmfee float64 = 0
279
+		var bed_clab_amt float64 = 0
280
+		var bed_other_amt float64 = 0
281
+
282
+		var examine_claa_sunmfee float64 = 0
283
+		var examine_clab_amt float64 = 0
284
+		var examine_other_amt float64 = 0
285
+
286
+		var nursing_claa_sunmfee float64 = 0
287
+		var nursing_clab_amt float64 = 0
288
+		var nursing_other_amt float64 = 0
289
+
290
+		var chinese_medicine_claa_sunmfee float64 = 0
291
+		var chinese_medicine_clab_amt float64 = 0
292
+		var chinese_medicine_other_amt float64 = 0
293
+
294
+		var commonly_treatment_claa_sunmfee float64 = 0
295
+		var commonly_treatment_clab_amt float64 = 0
296
+		var commonly_treatment_other_amt float64 = 0
297
+
298
+		var operation_claa_sunmfee float64 = 0
299
+		var operation_clab_amt float64 = 0
300
+		var operation_other_amt float64 = 0
301
+
302
+		var other_claa_sunmfee float64 = 0
303
+		var other_clab_amt float64 = 0
304
+		var other_other_amt float64 = 0
305
+
306
+		var westernMedicine_claa_sunmfee float64 = 0
307
+		var westernMedicine_clab_amt float64 = 0
308
+		var westernMedicine_other_amt float64 = 0
309
+
310
+		var chineseTraditional_claa_sunmfee float64 = 0
311
+		var chineseTraditional_clab_amt float64 = 0
312
+		var chineseTraditional_other_amt float64 = 0
313
+
314
+		var check_claa_sunmfee float64 = 0
315
+		var check_clab_amt float64 = 0
316
+		var check_other_amt float64 = 0
317
+
318
+		var material_claa_sunmfee float64 = 0
319
+		var material_clab_amt float64 = 0
320
+		var material_other_amt float64 = 0
321
+
322
+		var laboratory_claa_sunmfee float64 = 0
323
+		var laboratory_clab_amt float64 = 0
324
+		var laboratory_other_amt float64 = 0
325
+
326
+		var treat_claa_sunmfee float64 = 0
327
+		var treat_clab_amt float64 = 0
328
+		var treat_other_amt float64 = 0
329
+
330
+		var register_claa_sunmfee float64 = 0
331
+		var register_clab_amt float64 = 0
332
+		var register_other_amt float64 = 0
333
+
334
+		for _, item := range order.HisOrderInfo {
335
+			if item.MedChrgitmType == "01" { //床位费
336
+				bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
337
+				bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
338
+				bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
339
+				bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
340
+				if item.ChrgitmLv == "1" {
341
+					bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
342
+				}
343
+				if item.ChrgitmLv == "2" {
344
+					bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
345
+
346
+				}
347
+				if item.ChrgitmLv == "3" {
348
+					bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
349
+				}
350
+
351
+			}
352
+
353
+			if item.MedChrgitmType == "02" { //诊查
354
+				examineCostTotal, _ = decimal.NewFromFloat(examineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
355
+				examineCostSelfTotal, _ = decimal.NewFromFloat(examineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
356
+				examineCostPartSelfTotal, _ = decimal.NewFromFloat(examineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
357
+				examine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(examine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
358
+				if item.ChrgitmLv == "1" {
359
+					examine_claa_sunmfee, _ = decimal.NewFromFloat(examine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
360
+				}
361
+				if item.ChrgitmLv == "2" {
362
+					examine_clab_amt, _ = decimal.NewFromFloat(examine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
363
+
364
+				}
365
+				if item.ChrgitmLv == "3" {
366
+					examine_other_amt, _ = decimal.NewFromFloat(examine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
367
+				}
368
+
369
+			}
370
+
371
+			if item.MedChrgitmType == "03" { //检查费
372
+				checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
373
+				checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
374
+				checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
375
+				check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
376
+				if item.ChrgitmLv == "1" {
377
+
378
+					check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
379
+
380
+				}
381
+				if item.ChrgitmLv == "2" {
382
+					check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
383
+
384
+				}
385
+				if item.ChrgitmLv == "3" {
386
+					check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
387
+				}
388
+			}
389
+
390
+			if item.MedChrgitmType == "04" { //化验费
391
+				laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
392
+				laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
393
+				laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
394
+				laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
395
+				if item.ChrgitmLv == "1" {
396
+
397
+					laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
398
+
399
+				}
400
+				if item.ChrgitmLv == "2" {
401
+					laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
402
+
403
+				}
404
+				if item.ChrgitmLv == "3" {
405
+					laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
406
+				}
407
+			}
408
+
409
+			if item.MedChrgitmType == "05" { //治疗费
410
+				treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
411
+				treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
412
+				treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
413
+				treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
414
+				if item.ChrgitmLv == "1" {
415
+
416
+					treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
417
+
418
+				}
419
+				if item.ChrgitmLv == "2" {
420
+					treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
421
+
422
+				}
423
+				if item.ChrgitmLv == "3" {
424
+					treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
425
+				}
426
+			}
427
+
428
+			if item.MedChrgitmType == "06" { //手术费
429
+				operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
430
+				operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
431
+				operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
432
+				operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
433
+
434
+				if item.ChrgitmLv == "1" {
435
+
436
+					operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
437
+
438
+				}
439
+				if item.ChrgitmLv == "2" {
440
+					operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
441
+
442
+				}
443
+				if item.ChrgitmLv == "3" {
444
+					operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
445
+				}
446
+			}
447
+
448
+			if item.MedChrgitmType == "07" { //手术费
449
+				nursingCostTotal, _ = decimal.NewFromFloat(nursingCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
450
+				nursingCostSelfTotal, _ = decimal.NewFromFloat(nursingCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
451
+				nursingCostPartSelfTotal, _ = decimal.NewFromFloat(nursingCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
452
+				nursing_fulamt_ownpay_amt, _ = decimal.NewFromFloat(nursing_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
453
+
454
+				if item.ChrgitmLv == "1" {
455
+
456
+					nursing_claa_sunmfee, _ = decimal.NewFromFloat(nursing_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
457
+
458
+				}
459
+				if item.ChrgitmLv == "2" {
460
+					nursing_clab_amt, _ = decimal.NewFromFloat(nursing_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
461
+
462
+				}
463
+				if item.ChrgitmLv == "3" {
464
+					nursing_other_amt, _ = decimal.NewFromFloat(nursing_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
465
+				}
466
+			}
467
+
468
+			if item.MedChrgitmType == "08" { //材料费
469
+				materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
470
+				materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
471
+				materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
472
+				material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
473
+				if item.ChrgitmLv == "1" {
474
+
475
+					material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
476
+
477
+				}
478
+				if item.ChrgitmLv == "2" {
479
+					material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
480
+
481
+				}
482
+				if item.ChrgitmLv == "3" {
483
+					material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
484
+				}
485
+			}
486
+			if item.MedChrgitmType == "09" { //西药费
487
+				westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
488
+				westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
489
+				westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
490
+				westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
491
+				if item.ChrgitmLv == "1" {
492
+					westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
493
+				}
494
+				if item.ChrgitmLv == "2" {
495
+					westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
496
+				}
497
+				if item.ChrgitmLv == "3" {
498
+					westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
499
+				}
500
+			}
501
+			if item.MedChrgitmType == "10" { //中药饮片
502
+				chineseMedicineCostTotal, _ = decimal.NewFromFloat(chineseMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
503
+				chineseMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
504
+				chineseMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
505
+				chinese_medicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chinese_medicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
506
+				if item.ChrgitmLv == "1" {
507
+					chinese_medicine_claa_sunmfee, _ = decimal.NewFromFloat(chinese_medicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
508
+				}
509
+				if item.ChrgitmLv == "2" {
510
+					chinese_medicine_clab_amt, _ = decimal.NewFromFloat(chinese_medicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
511
+				}
512
+				if item.ChrgitmLv == "3" {
513
+					chinese_medicine_other_amt, _ = decimal.NewFromFloat(chinese_medicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
514
+				}
515
+			}
516
+
517
+			if item.MedChrgitmType == "11" { //中成费
518
+				chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
519
+				chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
520
+				chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
521
+				chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
522
+				if item.ChrgitmLv == "1" {
523
+
524
+					chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
525
+
526
+				}
527
+				if item.ChrgitmLv == "2" {
528
+					chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
529
+
530
+				}
531
+				if item.ChrgitmLv == "3" {
532
+					chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
533
+				}
534
+			}
535
+
536
+			if item.MedChrgitmType == "12" { //中成费
537
+				commonlyTreatmentCostTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
538
+				commonlyTreatmentCostSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
539
+				commonlyTreatmentCostPartSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
540
+				commonly_treatment_fulamt_ownpay_amt, _ = decimal.NewFromFloat(commonly_treatment_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
541
+				if item.ChrgitmLv == "1" {
542
+
543
+					commonly_treatment_claa_sunmfee, _ = decimal.NewFromFloat(commonly_treatment_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
544
+
545
+				}
546
+				if item.ChrgitmLv == "2" {
547
+					commonly_treatment_clab_amt, _ = decimal.NewFromFloat(commonly_treatment_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
548
+
549
+				}
550
+				if item.ChrgitmLv == "3" {
551
+					commonly_treatment_other_amt, _ = decimal.NewFromFloat(commonly_treatment_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
552
+				}
553
+			}
554
+
555
+			if item.MedChrgitmType == "13" { //中成费
556
+				registerCostTotal, _ = decimal.NewFromFloat(registerCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
557
+				registerCostSelfTotal, _ = decimal.NewFromFloat(registerCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
558
+				registerPartSelfTotal, _ = decimal.NewFromFloat(registerPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
559
+				register_fulamt_ownpay_amt, _ = decimal.NewFromFloat(register_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
560
+				if item.ChrgitmLv == "1" {
561
+
562
+					register_claa_sunmfee, _ = decimal.NewFromFloat(register_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
563
+
564
+				}
565
+				if item.ChrgitmLv == "2" {
566
+					register_clab_amt, _ = decimal.NewFromFloat(register_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
567
+
568
+				}
569
+				if item.ChrgitmLv == "3" {
570
+					register_other_amt, _ = decimal.NewFromFloat(register_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
571
+				}
572
+			}
573
+
574
+			if item.MedChrgitmType == "14" { //其他费
575
+				otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
576
+				otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
577
+				otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
578
+				other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
579
+				if item.ChrgitmLv == "1" {
580
+					other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
581
+
582
+				}
583
+				if item.ChrgitmLv == "2" {
584
+					other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
585
+
586
+				}
587
+				if item.ChrgitmLv == "3" {
588
+					other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
589
+				}
590
+			}
591
+
592
+		}
593
+
594
+		var iteminfoStructs []service.IteminfoStruct
595
+
596
+		if bedCostTotal != 0 {
597
+			iteminfo.MedChrgitm = "01"
598
+			iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
599
+			iteminfo.Amt = bedCostTotal
600
+			iteminfo.ClaaSumfee = bed_claa_sunmfee
601
+			iteminfo.ClabAmt = bed_clab_amt
602
+			iteminfo.OthAmt = bed_other_amt
603
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
604
+		}
605
+
606
+		if examineCostTotal != 0 {
607
+			iteminfo.MedChrgitm = "02"
608
+			iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
609
+			iteminfo.Amt = examineCostTotal
610
+			iteminfo.ClaaSumfee = examine_claa_sunmfee
611
+			iteminfo.ClabAmt = examine_clab_amt
612
+			iteminfo.OthAmt = examine_other_amt
613
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
614
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
615
+		}
616
+
617
+		if checkCostTotal != 0 {
618
+			iteminfo.MedChrgitm = "03"
619
+			iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
620
+			iteminfo.Amt = checkCostTotal
621
+			iteminfo.ClaaSumfee = check_claa_sunmfee
622
+			iteminfo.ClabAmt = check_clab_amt
623
+			iteminfo.OthAmt = check_other_amt
624
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
625
+
626
+		}
627
+
628
+		if laboratoryCostTotal != 0 {
629
+			iteminfo.MedChrgitm = "04"
630
+			iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
631
+			iteminfo.Amt = laboratoryCostTotal
632
+			iteminfo.ClaaSumfee = laboratory_claa_sunmfee
633
+			iteminfo.ClabAmt = laboratory_clab_amt
634
+			iteminfo.OthAmt = laboratory_other_amt
635
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
636
+
637
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
638
+
639
+		}
640
+
641
+		if treatCostTotal != 0 {
642
+			iteminfo.MedChrgitm = "05"
643
+			iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
644
+			iteminfo.Amt = treatCostTotal
645
+			iteminfo.ClaaSumfee = treat_claa_sunmfee
646
+			iteminfo.ClabAmt = treat_clab_amt
647
+			iteminfo.OthAmt = treat_other_amt
648
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
649
+			//(struct4101.IteminfoStruct, iteminfo)
650
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
651
+		}
652
+
653
+		if operationCostTotal != 0 {
654
+			iteminfo.MedChrgitm = "06"
655
+			iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
656
+			iteminfo.Amt = operationCostTotal
657
+			iteminfo.ClaaSumfee = operation_claa_sunmfee
658
+			iteminfo.ClabAmt = operation_clab_amt
659
+			iteminfo.OthAmt = operation_other_amt
660
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
661
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
662
+		}
663
+
664
+		if nursingCostTotal != 0 {
665
+			iteminfo.MedChrgitm = "07"
666
+			iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
667
+			iteminfo.Amt = nursingCostTotal
668
+			iteminfo.ClaaSumfee = nursing_claa_sunmfee
669
+			iteminfo.ClabAmt = nursing_clab_amt
670
+			iteminfo.OthAmt = nursing_other_amt
671
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
672
+		}
673
+
674
+		if materialCostTotal != 0 {
675
+			iteminfo.MedChrgitm = "08"
676
+			iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
677
+			iteminfo.Amt = materialCostTotal
678
+			iteminfo.ClaaSumfee = material_claa_sunmfee
679
+			iteminfo.ClabAmt = material_clab_amt
680
+			iteminfo.OthAmt = material_other_amt
681
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
682
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
683
+		}
684
+
685
+		if westernMedicineCostTotal != 0 {
686
+			iteminfo.MedChrgitm = "09"
687
+			iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
688
+			iteminfo.Amt = westernMedicineCostTotal
689
+			iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
690
+			iteminfo.ClabAmt = westernMedicine_clab_amt
691
+			iteminfo.OthAmt = westernMedicine_other_amt
692
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
693
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
694
+
695
+		}
696
+
697
+		if chineseMedicineCostTotal != 0 {
698
+			iteminfo.MedChrgitm = "10"
699
+			iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
700
+			iteminfo.Amt = chineseMedicineCostTotal
701
+			iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
702
+			iteminfo.ClabAmt = chinese_medicine_clab_amt
703
+			iteminfo.OthAmt = chinese_medicine_other_amt
704
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
705
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
706
+
707
+		}
708
+
709
+		if chineseTraditionalMedicineCostTotal != 0 {
710
+			iteminfo.MedChrgitm = "11"
711
+			iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
712
+			iteminfo.Amt = westernMedicineCostTotal
713
+			iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
714
+			iteminfo.ClabAmt = westernMedicine_clab_amt
715
+			iteminfo.OthAmt = westernMedicine_other_amt
716
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
717
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
718
+
719
+		}
720
+
721
+		if commonlyTreatmentCostTotal != 0 {
722
+			iteminfo.MedChrgitm = "12"
723
+			iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
724
+			iteminfo.Amt = commonlyTreatmentCostTotal
725
+			iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
726
+			iteminfo.ClabAmt = commonly_treatment_clab_amt
727
+			iteminfo.OthAmt = commonly_treatment_other_amt
728
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
729
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
730
+
731
+		}
732
+
733
+		if registerCostTotal != 0 {
734
+			iteminfo.MedChrgitm = "13"
735
+			iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
736
+			iteminfo.Amt = registerCostTotal
737
+			iteminfo.ClaaSumfee = register_claa_sunmfee
738
+			iteminfo.ClabAmt = register_clab_amt
739
+			iteminfo.OthAmt = register_other_amt
740
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
741
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
742
+
743
+		}
744
+
745
+		if otherCostTotal != 0 {
746
+			iteminfo.MedChrgitm = "14"
747
+			iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
748
+			iteminfo.Amt = otherCostTotal
749
+			iteminfo.ClaaSumfee = other_claa_sunmfee
750
+			iteminfo.ClabAmt = other_clab_amt
751
+			iteminfo.OthAmt = other_other_amt
752
+			//struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
753
+			iteminfoStructs = append(iteminfoStructs, iteminfo)
754
+
755
+		}
756
+		struct4101.IteminfoStruct = iteminfoStructs
757
+		time_arr := strings.Split(order.SetlTime, " ")
758
+		struct4101.AdmTime = time_arr[0]
759
+		struct4101.AdmEndTime = time_arr[0]
760
+
761
+		struct4101.DoctorName = doctor.UserName
762
+		struct4101.DoctorCode = doctor.DoctorNumber
763
+
764
+		struct4101.Ntly = "中国"
765
+		struct4101.AdmCaty = "A03.06"
766
+		var res ResultSeventeen
767
+		if miConfig.MdtrtareaAdmvs == "421300" {
768
+			data := make(map[string]interface{})
769
+			data["struct4101"] = struct4101
770
+			data["secret_key"] = miConfig.SecretKey
771
+			data["org_name"] = miConfig.OrgName
772
+			data["opera"] = curRoles.UserName
773
+			data["code"] = miConfig.Code
774
+			data["insuplc_admdvs"] = miConfig.InsuplcAdmdvs
775
+			data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
776
+
777
+			client := &http.Client{}
778
+			bytesData, _ := json.Marshal(data)
779
+			req, _ := http.NewRequest("POST", "http://192.168.124.4:9532/"+"hbyb/4101", bytes.NewReader(bytesData))
780
+			resp, _ := client.Do(req)
781
+			defer resp.Body.Close()
782
+			body, ioErr := ioutil.ReadAll(resp.Body)
783
+			if ioErr != nil {
784
+				//utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
785
+				//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
786
+				return
787
+			}
788
+			var respJSON map[string]interface{}
789
+			if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
790
+				//utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
791
+				//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
792
+				return
793
+			}
794
+
795
+			respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
796
+			userJSONBytes, _ := json.Marshal(respJSON)
797
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
798
+				//utils.ErrorLog("解析失败:%v", err)
799
+				//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
800
+
801
+				errlog := &models.HisOrderError{
802
+					UserOrgId: org_id,
803
+					Ctime:     time.Now().Unix(),
804
+					Mtime:     time.Now().Unix(),
805
+					ErrMsg:    res.ErrMsg + "解析失败",
806
+					Status:    1,
807
+					PatientId: order_id,
808
+					Stage:     10088,
809
+				}
810
+				service.CreateErrMsgLog(errlog)
811
+				continue
812
+			}
813
+
814
+		} else {
815
+			result := service.Gdyb4101(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
816
+			fmt.Println(result)
817
+
818
+			var dat map[string]interface{}
819
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
820
+				fmt.Println(dat)
821
+			} else {
822
+				fmt.Println(err)
823
+			}
824
+			userJSONBytes, _ := json.Marshal(dat)
825
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
826
+				//utils.ErrorLog("解析失败:%v", err)
827
+				//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
828
+				//adminUser := c.GetAdminUserInfo()
829
+				errlog := &models.HisOrderError{
830
+					UserOrgId: org_id,
831
+					Ctime:     time.Now().Unix(),
832
+					Mtime:     time.Now().Unix(),
833
+					ErrMsg:    res.ErrMsg + "解析失败",
834
+					Status:    1,
835
+					PatientId: order_id,
836
+					Stage:     10106,
837
+				}
838
+				service.CreateErrMsgLog(errlog)
839
+				continue
840
+			}
841
+		}
842
+
843
+		if res.Infcode != 0 {
844
+			//adminUser := c.GetAdminUserInfo()
845
+			errlog := &models.HisOrderError{
846
+				UserOrgId: org_id,
847
+				Ctime:     time.Now().Unix(),
848
+				Mtime:     time.Now().Unix(),
849
+				ErrMsg:    res.ErrMsg,
850
+				Status:    1,
851
+				PatientId: order_id,
852
+				Stage:     10106,
853
+			}
854
+			service.CreateErrMsgLog(errlog)
855
+			continue
856
+		} else {
857
+			hisFundSettleListResult := &models.HisFundSettleListResult{
858
+				Number:    res.Output.SetlListId,
859
+				Status:    1,
860
+				Ctime:     time.Now().Unix(),
861
+				Mtime:     time.Now().Unix(),
862
+				UserOrgId: org_id,
863
+				IsUpload:  1,
864
+				OrderId:   order_id,
865
+			}
866
+			service.CreateUploadRecord(hisFundSettleListResult)
867
+			continue
868
+		}
869
+	}
870
+}
871
+
50
 //func UploadSettleList(org_id int64) {
872
 //func UploadSettleList(org_id int64) {
51
 //	orders, _ := service.GetAllHisOrder(org_id)
873
 //	orders, _ := service.GetAllHisOrder(org_id)
52
 //	for _, item := range orders {
874
 //	for _, item := range orders {

+ 255 - 0
models/zifei_modes.go View File

1
+package models
2
+
3
+type FsiOwnpayPatnFeeListDDTO struct {
4
+	AcordDeptCodg    string `json:"acord_dept_codg"`
5
+	AcordDeptName    string `json:"acord_dept_name"`
6
+	AcordDrCode      string `json:"acord_dr_code"`
7
+	AcordDrName      string `json:"acord_dr_name"`
8
+	BilgDeptCodg     string `json:"bilg_dept_codg"`
9
+	BilgDeptName     string `json:"bilg_dept_name"`
10
+	BilgDrCode       string `json:"bilg_dr_code"`
11
+	BilgDrName       string `json:"bilg_dr_name"`
12
+	BkkpSn           string `json:"bkkp_sn"`
13
+	Cnt              string `json:"cnt"`
14
+	DetItemFeeSumamt string `json:"det_item_fee_sumamt"`
15
+	DscgTkdrugFlag   string `json:"dscg_tkdrug_flag"`
16
+	EtipFlag         string `json:"etip_flag"`
17
+	EtipHospCode     string `json:"etip_hosp_code"`
18
+	FeeOcurTime      string `json:"fee_ocur_time"`
19
+	FixmedinsCode    string `json:"fixmedins_code"`
20
+	FixmedinsMdtrtID string `json:"fixmedins_mdtrt_id"`
21
+	FixmedinsName    string `json:"fixmedins_name"`
22
+	FulamtOwnpayAmt  string `json:"fulamt_ownpay_amt"`
23
+	InscpAmt         string `json:"inscp_amt"`
24
+	MedChrgitmType   string `json:"med_chrgitm_type"`
25
+	MedListCodg      string `json:"med_list_codg"`
26
+	MedType          string `json:"med_type"`
27
+	MedcWayDscr      string `json:"medc_way_dscr "`
28
+	MedinsListCodg   string `json:"medins_list_codg"`
29
+	MedinsListName   string `json:"medins_list_name"`
30
+	Memo             struct {
31
+		HospApprFlag string `json:"hosp_appr_flag"`
32
+		InvoiceNo    string `json:"invoice_no"`
33
+		Memo         string `json:"memo"`
34
+	} `json:"memo"`
35
+	OverlmtSelfpay string `json:"overlmt_selfpay"`
36
+	PrdDays        string `json:"prd_days"`
37
+	PreselfpayAmt  string `json:"preselfpay_amt"`
38
+	Pric           string `json:"pric"`
39
+	Prodname       string `json:"prodname"`
40
+	SinDosDscr     string `json:"sin_dos_dscr "`
41
+	TcmdrugUsedWay string `json:"tcmdrug_used_way"`
42
+	UsedFrquDscr   string `json:"used_frqu_dscr "`
43
+}
44
+type Struct4201A struct {
45
+	Fopfd []FsiOwnpayPatnFeeListDDTO
46
+}
47
+type OwnPayPatnDiagListD struct {
48
+	DiagCode      string `json:"diag_code"`
49
+	DiagDept      string `json:"diag_dept"`
50
+	DiagDrCode    string `json:"diag_dr_code"`
51
+	DiagDrName    string `json:"diag_dr_name"`
52
+	DiagName      string `json:"diag_name"`
53
+	DiagSrtNo     string `json:"diag_srt_no"`
54
+	DiagTime      string `json:"diag_time"`
55
+	DiagType      string `json:"diag_type"`
56
+	InoutDiagType string `json:"inout_diag_type"`
57
+	MaindiagFlag  string `json:"maindiag_flag"`
58
+	ValiFlag      string `json:"vali_flag"`
59
+}
60
+
61
+type Struct4203 struct {
62
+	CpltFlag         string `json:"cplt_flag"`
63
+	FixmedinsCode    string `json:"fixmedins_code"`
64
+	FixmedinsMdtrtID string `json:"fixmedins_mdtrt_id"`
65
+}
66
+
67
+type Struct4204 struct {
68
+	FixmedinsCode    string `json:"fixmedins_code"`
69
+	FixmedinsMdtrtID string `json:"fixmedins_mdtrt_id"`
70
+}
71
+
72
+type Struct4205 struct {
73
+	Diseinfo struct {
74
+		DiagCode   string `json:"diag_code"`
75
+		DiagDept   string `json:"diag_dept"`
76
+		DiagDrCode string `json:"diag_dr_code"`
77
+		DiagDrName string `json:"diag_dr_name"`
78
+		DiagName   string `json:"diag_name"`
79
+		DiagSrtNo  string `json:"diag_srt_no"`
80
+		DiagTime   string `json:"diag_time"`
81
+		DiagType   string `json:"diag_type"`
82
+		ValiFlag   string `json:"vali_flag"`
83
+	} `json:"diseinfo"`
84
+	Feedetail []struct {
85
+		AcordDeptCodg    string `json:"acord_dept_codg"`
86
+		AcordDeptName    string `json:"acord_dept_name"`
87
+		AcordDrCode      string `json:"acord_dr_code"`
88
+		AcordDrName      string `json:"acord_dr_name"`
89
+		BilgDeptCodg     string `json:"bilg_dept_codg"`
90
+		BilgDeptName     string `json:"bilg_dept_name"`
91
+		BilgDrCode       string `json:"bilg_dr_code"`
92
+		BilgDrName       string `json:"bilg_dr_name"`
93
+		BkkpSn           string `json:"bkkp_sn"`
94
+		Cnt              string `json:"cnt"`
95
+		DetItemFeeSumamt string `json:"det_item_fee_sumamt"`
96
+		DscgTkdrugFlag   string `json:"dscg_tkdrug_flag"`
97
+		EtipFlag         string `json:"etip_flag"`
98
+		EtipHospCode     string `json:"etip_hosp_code"`
99
+		FeeOcurTime      string `json:"fee_ocur_time"`
100
+		FixmedinsCode    string `json:"fixmedins_code"`
101
+		FixmedinsMdtrtID string `json:"fixmedins_mdtrt_id"`
102
+		FixmedinsName    string `json:"fixmedins_name"`
103
+		FulamtOwnpayAmt  string `json:"fulamt_ownpay_amt"`
104
+		InscpAmt         string `json:"inscp_amt"`
105
+		MedChrgitmType   string `json:"med_chrgitm_type"`
106
+		MedListCodg      string `json:"med_list_codg"`
107
+		MedType          string `json:"med_type"`
108
+		MedcWayDscr      string `json:"medc_way_dscr "`
109
+		MedinsListCodg   string `json:"medins_list_codg"`
110
+		MedinsListName   string `json:"medins_list_name"`
111
+		Memo             struct {
112
+			HospApprFlag string `json:"hosp_appr_flag"`
113
+			InvoiceNo    string `json:"invoice_no"`
114
+			Memo         string `json:"memo"`
115
+		} `json:"memo"`
116
+		OverlmtSelfpay string `json:"overlmt_selfpay"`
117
+		PrdDays        string `json:"prd_days"`
118
+		PreselfpayAmt  string `json:"preselfpay_amt"`
119
+		Pric           string `json:"pric"`
120
+		Prodname       string `json:"prodname"`
121
+		SinDosDscr     string `json:"sin_dos_dscr "`
122
+		TcmdrugUsedWay string `json:"tcmdrug_used_way"`
123
+		UsedFrquDscr   string `json:"used_frqu_dscr "`
124
+	} `json:"feedetail"`
125
+	Mdtrtinfo struct {
126
+		Addr             string `json:"addr"`
127
+		Age              string `json:"age"`
128
+		Begntime         string `json:"begntime"`
129
+		BirctrlMatnDate  string `json:"birctrl_matn_date"`
130
+		BirctrlType      string `json:"birctrl_type"`
131
+		Brdy             string `json:"brdy"`
132
+		Certno           string `json:"certno"`
133
+		ConerName        string `json:"coner_name"`
134
+		DiseCodg         string `json:"dise_codg"`
135
+		DiseName         string `json:"dise_name"`
136
+		ElecBillChkcode  string `json:"elec_bill_chkcode"`
137
+		ElecBillCode     string `json:"elec_bill_code"`
138
+		ElecBillnoCode   string `json:"elec_billno_code"`
139
+		Endtime          string `json:"endtime"`
140
+		ExpContent       string `json:"exp_content"`
141
+		FixmedinsCode    string `json:"fixmedins_code"`
142
+		FixmedinsMdtrtID string `json:"fixmedins_mdtrt_id"`
143
+		FixmedinsName    string `json:"fixmedins_name"`
144
+		Gend             string `json:"gend"`
145
+		GesoVal          string `json:"geso_val"`
146
+		MainCondDscr     string `json:"main_cond_dscr"`
147
+		MatnType         string `json:"matn_type"`
148
+		MedType          string `json:"med_type"`
149
+		Naty             string `json:"naty"`
150
+		PsnCertType      string `json:"psn_cert_type"`
151
+		PsnName          string `json:"psn_name"`
152
+		Tel              string `json:"tel"`
153
+	} `json:"mdtrtinfo"`
154
+}
155
+
156
+type Struct4206 struct {
157
+	FixmedinsCode    string `json:"fixmedins_code"`
158
+	FixmedinsMdtrtID string `json:"fixmedins_mdtrt_id"`
159
+}
160
+
161
+type Struct4207 struct {
162
+	FixmedinsCode    string `json:"fixmedins_code"`
163
+	FixmedinsMdtrtID string `json:"fixmedins_mdtrt_id"`
164
+	PageNum          string `json:"page_num"`
165
+	PageSize         string `json:"page_size"`
166
+}
167
+
168
+type Struct4208 struct {
169
+	Begntime       string `json:"begntime"`
170
+	Certno         string `json:"certno"`
171
+	CpltFlag       string `json:"cplt_flag"`
172
+	ElecBillnoCode string `json:"elec_billno_code"`
173
+	Endtime        string `json:"endtime"`
174
+	MedType        string `json:"med_type"`
175
+	MedfeeSumamt   string `json:"medfee_sumamt"`
176
+	PageNum        string `json:"page_num"`
177
+	PageSize       string `json:"page_size"`
178
+	PsnCertType    string `json:"psn_cert_type"`
179
+	PsnName        string `json:"psn_name"`
180
+}
181
+
182
+type Struct4209 struct {
183
+	FixmedinsCode    string `json:"fixmedins_code"`
184
+	FixmedinsMdtrtID string `json:"fixmedins_mdtrt_id"`
185
+	PageNum          string `json:"page_num"`
186
+	PageSize         string `json:"page_size"`
187
+}
188
+
189
+type Struct4202 struct {
190
+	ODiagListD       []OwnPayPatnDiagListD
191
+	OwnPayPatnMdtrtD struct {
192
+		Addr             string `json:"addr"`
193
+		AdmBed           string `json:"adm_bed"`
194
+		AdmDeptCodg      string `json:"adm_dept_codg"`
195
+		AdmDeptName      string `json:"adm_dept_name"`
196
+		AdmDiagDscr      string `json:"adm_diag_dscr"`
197
+		Age              string `json:"age"`
198
+		Begntime         string `json:"begntime"`
199
+		BirctrlMatnDate  string `json:"birctrl_matn_date"`
200
+		BirctrlType      string `json:"birctrl_type"`
201
+		Brdy             string `json:"brdy"`
202
+		Certno           string `json:"certno"`
203
+		ChfpdrCode       string `json:"chfpdr_code"`
204
+		ChfpdrName       string `json:"chfpdr_name"`
205
+		ConerName        string `json:"coner_name"`
206
+		CopFlag          string `json:"cop_flag"`
207
+		DieDate          string `json:"die_date"`
208
+		DiseName         string `json:"dise_name"`
209
+		DiseNo           string `json:"dise_no"`
210
+		DscgBed          string `json:"dscg_bed"`
211
+		DscgDeptCodg     string `json:"dscg_dept_codg"`
212
+		DscgDeptName     string `json:"dscg_dept_name"`
213
+		DscgMaindiagCode string `json:"dscg_maindiag_code"`
214
+		DscgMaindiagName string `json:"dscg_maindiag_name"`
215
+		DscgWay          string `json:"dscg_way"`
216
+		ElecBillChkcode  string `json:"elec_bill_chkcode"`
217
+		ElecBillCode     string `json:"elec_bill_code"`
218
+		ElecBillnoCode   string `json:"elec_billno_code"`
219
+		Endtime          string `json:"endtime"`
220
+		ExpContent       string `json:"exp_content"`
221
+		Fetts            string `json:"fetts"`
222
+		FetusCnt         string `json:"fetus_cnt"`
223
+		FixmedinsCode    string `json:"fixmedins_code"`
224
+		FixmedinsMdtrtID string `json:"fixmedins_mdtrt_id"`
225
+		FixmedinsName    string `json:"fixmedins_name"`
226
+		FpscNo           string `json:"fpsc_no"`
227
+		Gend             string `json:"gend"`
228
+		GesoVal          string `json:"geso_val"`
229
+		InhospStas       string `json:"inhosp_stas"`
230
+		IptDays          string `json:"ipt_days"`
231
+		IptOtpNo         string `json:"ipt_otp_no"`
232
+		LatechbFlag      string `json:"latechb_flag"`
233
+		MainCondDscr     string `json:"main_cond_dscr"`
234
+		MatnType         string `json:"matn_type"`
235
+		MedType          string `json:"med_type"`
236
+		MedfeeSumamt     string `json:"medfee_sumamt"`
237
+		Medrcdno         string `json:"medrcdno"`
238
+		Memo             string `json:"memo"`
239
+		Naty             string `json:"naty"`
240
+		OprnOprtCode     string `json:"oprn_oprt_code"`
241
+		OprnOprtName     string `json:"oprn_oprt_name"`
242
+		OptTime          string `json:"opt_time"`
243
+		OpterID          string `json:"opter_id"`
244
+		OpterName        string `json:"opter_name"`
245
+		OtpDiagInfo      string `json:"otp_diag_info"`
246
+		PretFlag         string `json:"pret_flag"`
247
+		PreyTime         string `json:"prey_time"`
248
+		PsnCertType      string `json:"psn_cert_type"`
249
+		PsnName          string `json:"psn_name"`
250
+		Tel              string `json:"tel"`
251
+		TrafDeptFlag     string `json:"traf_dept_flag"`
252
+		ValiFlag         string `json:"vali_flag"`
253
+		WardareaBed      string `json:"wardarea_bed"`
254
+	} `json:"ownPayPatnMdtrtD"`
255
+}

+ 97 - 3
service/auto_create_week_schedules_service.go View File

71
 
71
 
72
 	var XtDrugInventorys []*models.XtDrugInventory
72
 	var XtDrugInventorys []*models.XtDrugInventory
73
 
73
 
74
-	readDb.Model(&models.XtDrugInventory{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("BaseDrugLib", "status = 1").Find(&XtDrugInventorys)
74
+	var NewDrugWarehouseOutTwo []*models.NewDrugWarehouseOutInfo
75
+
76
+	//var XtDrugInventorys2 []*models.XtDrugInventory
77
+
78
+	//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)
75
 
79
 
76
 	//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)
80
 	//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)
77
 	//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)
81
 	//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)
78
 	//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)
82
 	//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)
79
 
83
 
84
+	////大丰
80
 	//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)
85
 	//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)
81
 	//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)
86
 	//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)
82
-	//readDb.Model(&models.NewDrugCancelStockInfo{}).Where("user_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(&NewDrugCancelStock)
87
+	//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)
83
 
88
 
89
+	//香水
84
 	//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)
90
 	//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)
85
 	//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)
91
 	//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)
86
 	//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)
92
 	//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)
93
+	//3502
94
+	//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)
95
+
96
+	//3502
97
+	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)
87
 
98
 
88
 	for _, item := range XtDrugInventorys {
99
 	for _, item := range XtDrugInventorys {
89
 		res := Post3501ForDrug(org_id, item)
100
 		res := Post3501ForDrug(org_id, item)
98
 
109
 
99
 	}
110
 	}
100
 
111
 
112
+	for _, item := range NewDrugWarehouseOutTwo {
113
+		res := Post3502ForDrug(org_id, item)
114
+		if res.Infcode == 0 {
115
+			writeDb.Model(&models.XtDrugInventory{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
116
+				"is_upload": 1,
117
+			})
118
+		} else {
119
+
120
+			continue
121
+		}
122
+
123
+	}
124
+
101
 	for _, item := range NewWarehousing {
125
 	for _, item := range NewWarehousing {
102
 		res := Post3503ForGoodInfo(org_id, item)
126
 		res := Post3503ForGoodInfo(org_id, item)
103
 		if res.Infcode == 0 {
127
 		if res.Infcode == 0 {
247
 	struct3501.FixmedinsHilistId = miConfig.Code
271
 	struct3501.FixmedinsHilistId = miConfig.Code
248
 	struct3501.FixmedinsHilistName = miConfig.OrgName
272
 	struct3501.FixmedinsHilistName = miConfig.OrgName
249
 	struct3501.FixmedinsBchno = infos.BatchNumber
273
 	struct3501.FixmedinsBchno = infos.BatchNumber
274
+	struct3501.FixmedinsCode = miConfig.Code
250
 	struct3501.RxFlag = "0"
275
 	struct3501.RxFlag = "0"
251
 	struct3501.Invdate = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
276
 	struct3501.Invdate = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
252
 	struct3501.OrgName = miConfig.OrgName
277
 	struct3501.OrgName = miConfig.OrgName
255
 	struct3501.SecretKey = miConfig.SecretKey
280
 	struct3501.SecretKey = miConfig.SecretKey
256
 	struct3501.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
281
 	struct3501.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
257
 	struct3501.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
282
 	struct3501.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
258
-	struct3501.InvCnt = strconv.FormatInt(infos.Count, 10)
283
+	struct3501.InvCnt = strconv.FormatInt(infos.StockMaxNumber, 10)
259
 	struct3501.ManuDate = time.Unix(infos.DrugWarehouseInfo.ProductDate, 0).Format("2006-01-02 15:04:05")
284
 	struct3501.ManuDate = time.Unix(infos.DrugWarehouseInfo.ProductDate, 0).Format("2006-01-02 15:04:05")
260
 	struct3501.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
285
 	struct3501.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
261
 
286
 
306
 	return res
331
 	return res
307
 }
332
 }
308
 
333
 
334
+func Post3502ForDrug(org_id int64, infos *models.NewDrugWarehouseOutInfo) ResultSix {
335
+	var res ResultSix
336
+	miConfig, _ := FindMedicalInsuranceInfo(org_id)
337
+	data := make(map[string]interface{})
338
+	//var struct3502s []models.Struct3502
339
+	var struct3502 models.Struct3502
340
+	struct3502.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber
341
+	struct3502.FixmedinsHilistId = miConfig.Code
342
+	struct3502.FixmedinsHilistName = miConfig.OrgName
343
+	struct3502.FixmedinsBchno = infos.NewDrugWarehouseInfo.BatchNumber
344
+	struct3502.FixmedinsCode = miConfig.Code
345
+	struct3502.RxFlag = "0"
346
+	struct3502.InvChgTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
347
+	struct3502.OrgName = miConfig.OrgName
348
+	struct3502.AccessKey = miConfig.AccessKey
349
+	struct3502.RequestUrl = miConfig.Url
350
+	struct3502.SecretKey = miConfig.SecretKey
351
+	struct3502.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
352
+	struct3502.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
353
+	struct3502.InvChgType = "102"
354
+	struct3502.Cnt = strconv.FormatInt(infos.Count, 10)
355
+	struct3502.Pric = fmt.Sprintf("%.2f", infos.BaseDrugLib.RetailPrice)
356
+
357
+	data["struct_3502s"] = struct3502
358
+	client := &http.Client{}
359
+	bytesData, _ := json.Marshal(data)
360
+	var req *http.Request
361
+
362
+	if miConfig.MdtrtareaAdmvs == "320921" {
363
+		req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3502", bytes.NewReader(bytesData))
364
+	} else {
365
+		req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3502", bytes.NewReader(bytesData))
366
+	}
367
+
368
+	resp, _ := client.Do(req)
369
+	defer resp.Body.Close()
370
+	body, ioErr := ioutil.ReadAll(resp.Body)
371
+	if ioErr != nil {
372
+		utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
373
+		res.Infcode = -1
374
+		return res
375
+	}
376
+	var respJSON map[string]interface{}
377
+	if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
378
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
379
+		res.Infcode = -1
380
+		return res
381
+	}
382
+
383
+	var resSix10265 ResultSix10265 //1101结果
384
+
385
+	respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
386
+	result, _ := json.Marshal(respJSON)
387
+	if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
388
+		utils.ErrorLog("解析失败:%v", err)
389
+		res.Infcode = -1
390
+		return res
391
+	}
392
+	res.InfRefmsgid = resSix10265.InfRefmsgid
393
+	res.Output = resSix10265.Output
394
+	res.ErrMsg = resSix10265.ErrMsg
395
+	res.Cainfo = resSix10265.Cainfo
396
+	res.WarnMsg = resSix10265.WarnMsg
397
+	infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
398
+	res.Infcode = infocode
399
+
400
+	return res
401
+}
402
+
309
 //采购
403
 //采购
310
 func Post3503ForGoodInfo(org_id int64, infos *models.NewWarehousingInfo) ResultSix {
404
 func Post3503ForGoodInfo(org_id int64, infos *models.NewWarehousingInfo) ResultSix {
311
 	fmt.Println(&infos)
405
 	fmt.Println(&infos)

+ 13 - 0
service/fj_service.go View File

567
 	inputData["insutype"] = insutype    // 险种类型
567
 	inputData["insutype"] = insutype    // 险种类型
568
 	inputData["invono"] = ""            // 发票号
568
 	inputData["invono"] = ""            // 发票号
569
 
569
 
570
+	inputData2 := make(map[string]interface{})
571
+	inputData2["trum_flag"] = "0"
572
+	inputData2["rel_ttp_flag"] = ""
573
+	inputData2["otp_er_refl_flag"] = ""
574
+
575
+	inputData["exp_content"] = inputData2 // 发票号
576
+
570
 	input["data"] = inputData
577
 	input["data"] = inputData
571
 	inputMessage["input"] = input //交易输入
578
 	inputMessage["input"] = input //交易输入
572
 
579
 
714
 	inputData["preselfpay_amt"] = preselfpay_amt       //
721
 	inputData["preselfpay_amt"] = preselfpay_amt       //
715
 	inputData["inscp_scp_amt"] = inscp_scp_amt         //
722
 	inputData["inscp_scp_amt"] = inscp_scp_amt         //
716
 
723
 
724
+	inputData2 := make(map[string]interface{})
725
+	inputData2["trum_flag"] = "0"
726
+	inputData2["rel_ttp_flag"] = ""
727
+	inputData2["otp_er_refl_flag"] = ""
728
+	inputData["exp_content"] = inputData2 // 发票号
729
+
717
 	input["data"] = inputData
730
 	input["data"] = inputData
718
 	inputMessage["input"] = input //交易输入
731
 	inputMessage["input"] = input //交易输入
719
 
732
 

+ 10 - 7
service/gdyb_service.go View File

2350
 	inputData := make(map[string]interface{})
2350
 	inputData := make(map[string]interface{})
2351
 	inputMessage["infno"] = "2505"
2351
 	inputMessage["infno"] = "2505"
2352
 	inputData["psn_no"] = psnNo
2352
 	inputData["psn_no"] = psnNo
2353
-	inputData["biz_appy_type"] = "03"
2353
+	inputData["biz_appy_type"] = "01"
2354
 	inputData["begndate"] = start_time
2354
 	inputData["begndate"] = start_time
2355
 	inputData["enddate"] = end_time
2355
 	inputData["enddate"] = end_time
2356
 	inputData["fixmedins_code"] = fixmedins_code
2356
 	inputData["fixmedins_code"] = fixmedins_code
2363
 	inputData["agnter_tel"] = ""
2363
 	inputData["agnter_tel"] = ""
2364
 	inputData["agnter_addr"] = ""
2364
 	inputData["agnter_addr"] = ""
2365
 	inputData["agnter_rlts"] = ""
2365
 	inputData["agnter_rlts"] = ""
2366
-	inputData["fix_srt_no"] = ""
2366
+	inputData["fix_srt_no"] = "1"
2367
 	inputData["memo"] = ""
2367
 	inputData["memo"] = ""
2368
 	input["data"] = inputData
2368
 	input["data"] = inputData
2369
 	inputMessage["input"] = input //交易输入
2369
 	inputMessage["input"] = input //交易输入
2373
 		return err.Error()
2373
 		return err.Error()
2374
 	}
2374
 	}
2375
 	reader := bytes.NewReader(bytesData)
2375
 	reader := bytes.NewReader(bytesData)
2376
+	//fmt.Println(String(bytesData))
2377
+	fmt.Println(string(bytesData))
2378
+
2376
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2505"
2379
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2505"
2377
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2505"
2380
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2505"
2378
 	gdyb_url := beego.AppConfig.String("gdyb_url")
2381
 	gdyb_url := beego.AppConfig.String("gdyb_url")
2488
 	inputData["opsp_dise_code"] = sick_code        // 险种类型(来自1101接口返回)
2491
 	inputData["opsp_dise_code"] = sick_code        // 险种类型(来自1101接口返回)
2489
 	inputData["opsp_dise_name"] = sick_name        // 险种类型(来自1101接口返回)
2492
 	inputData["opsp_dise_name"] = sick_name        // 险种类型(来自1101接口返回)
2490
 	inputData["insu_optins"] = insuplc_admdvs      // 险种类型(来自1101接口返回)
2493
 	inputData["insu_optins"] = insuplc_admdvs      // 险种类型(来自1101接口返回)
2491
-	inputData["ide_fixmedins_no"] = fixmedins_code // 险种类型(来自1101接口返回)
2492
-	inputData["ide_fixmedins_name"] = org_name     // 险种类型(来自1101接口返回)
2494
+	inputData["ide_fixmedins_no"] = "H44122400103" // 险种类型(来自1101接口返回)
2495
+	inputData["ide_fixmedins_name"] = "广东省怀集县人民医院" // 险种类型(来自1101接口返回)
2493
 	inputData["hosp_ide_date"] = check_time        // 险种类型(来自1101接口返回)
2496
 	inputData["hosp_ide_date"] = check_time        // 险种类型(来自1101接口返回)
2494
 	inputData["diag_dr_codg"] = doctor_id          // 开始时间
2497
 	inputData["diag_dr_codg"] = doctor_id          // 开始时间
2495
 	inputData["diag_dr_name"] = doctor             // 开始时间
2498
 	inputData["diag_dr_name"] = doctor             // 开始时间
3881
 	return str
3884
 	return str
3882
 }
3885
 }
3883
 
3886
 
3884
-func Gdyb1101ForEleCert(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, token string) (string, string) {
3887
+func Gdyb1101ForEleCert(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, token string, user_name string, idNo string) (string, string) {
3885
 	//生成签名
3888
 	//生成签名
3886
 	nonce := GetRandomString(32)
3889
 	nonce := GetRandomString(32)
3887
 	timestamp := time.Now().Unix()
3890
 	timestamp := time.Now().Unix()
3894
 
3897
 
3895
 	inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
3898
 	inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
3896
 	inputData["card_sn"] = ""           // 卡识别码
3899
 	inputData["card_sn"] = ""           // 卡识别码
3897
-	inputData["certno"] = ""            // 证件号码
3900
+	inputData["certno"] = idNo          // 证件号码
3898
 	inputData["psn_cert_type"] = "01"   // 人员证件类型
3901
 	inputData["psn_cert_type"] = "01"   // 人员证件类型
3899
 
3902
 
3900
 	inputData["mdtrt_cert_no"] = token // 就诊凭证编号
3903
 	inputData["mdtrt_cert_no"] = token // 就诊凭证编号
3901
 	inputData["begntime"] = ""         // 开始时间
3904
 	inputData["begntime"] = ""         // 开始时间
3902
-	inputData["psn_name"] = ""         // 人员姓名
3905
+	inputData["psn_name"] = user_name  // 人员姓名
3903
 	input["data"] = inputData
3906
 	input["data"] = inputData
3904
 	inputMessage["input"] = input //交易输入
3907
 	inputMessage["input"] = input //交易输入
3905
 
3908
 

+ 828 - 0
service/gdyb_zifei_service.go View File

1
+package service
2
+
3
+import (
4
+	"bytes"
5
+	"encoding/json"
6
+	"fmt"
7
+	"gdyb/models"
8
+
9
+	"github.com/astaxie/beego"
10
+	"io/ioutil"
11
+	"net/http"
12
+	"strconv"
13
+	"time"
14
+)
15
+
16
+// 人员基本信息
17
+func Gdyb4201A(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) {
18
+	//生成签名
19
+	nonce := GetRandomString(32)
20
+	timestamp := time.Now().Unix()
21
+	signature := setSignature(timestamp, nonce, secret_key)
22
+	//生成输入报文
23
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
24
+	input := make(map[string]interface{})
25
+	inputData := make(map[string]interface{})
26
+	inputMessage["infno"] = "4201A" // 交易编码
27
+
28
+	inputData["fixmedins_mdtrt_id"] = ""
29
+	inputData["med_type"] = ""
30
+	inputData["bkkp_sn"] = ""
31
+	inputData["fee_ocur_time"] = ""
32
+	inputData["fixmedins_code"] = ""
33
+	inputData["fixmedins_name"] = ""
34
+	inputData["cnt"] = ""
35
+	inputData["pric"] = ""
36
+	inputData["det_item_fee_sumamt"] = ""
37
+	inputData["med_list_codg"] = ""
38
+	inputData["medins_list_name"] = ""
39
+	inputData["medins_list_code"] = ""
40
+
41
+	inputData["med_chrgitm_type"] = ""
42
+	inputData["prodname"] = ""
43
+	inputData["bilg_dept_codg"] = ""
44
+	inputData["bilg_dept_name"] = ""
45
+	inputData["bilg_dr_code"] = ""
46
+	inputData["bilg_dr_name"] = ""
47
+	inputData["acord_dept_codg"] = ""
48
+	inputData["acord_dept_name"] = ""
49
+	inputData["acord_dr_code"] = ""
50
+	inputData["acord_dr_name"] = ""
51
+	inputData["tcmdrug_used_way"] = ""
52
+	inputData["etip_flag"] = ""
53
+	inputData["etip_hosp_code"] = ""
54
+	inputData["dscg_tkdrug_flag"] = ""
55
+	inputData["sin_dos_dscr"] = ""
56
+	inputData["used_frqu_dscr"] = ""
57
+	inputData["prd_days"] = ""
58
+	inputData["medc_way_dscr"] = ""
59
+	inputData["memo"] = ""
60
+	inputData["fulamt_ownpay_amt"] = ""
61
+	inputData["overlmt_selfpay"] = ""
62
+	inputData["preselfpay_amt"] = ""
63
+	inputData["inscp_amt"] = ""
64
+
65
+	input["data"] = inputData
66
+	inputMessage["input"] = input //交易输入
67
+
68
+	var inputLog string
69
+	bytesData, err := json.Marshal(inputMessage)
70
+	inputLog = string(bytesData)
71
+	fmt.Println(string(bytesData))
72
+	if err != nil {
73
+		fmt.Println(err.Error())
74
+		return err.Error(), ""
75
+	}
76
+	reader := bytes.NewReader(bytesData)
77
+	gdyb_url := beego.AppConfig.String("gdyb_url")
78
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
79
+
80
+	var url string
81
+	if fixmedins_code == "H15049901371" {
82
+		url = gdyb_url
83
+	} else {
84
+		url = gdyb_url + "1101"
85
+	}
86
+
87
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
88
+	request, err := http.NewRequest("POST", url, reader)
89
+	if err != nil {
90
+		fmt.Println(err.Error())
91
+		return err.Error(), ""
92
+	}
93
+
94
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
95
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
96
+	request.Header.Set("x-tif-signature", signature)
97
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
98
+	request.Header.Set("x-tif-nonce", nonce)
99
+
100
+	client := http.Client{}
101
+	resp, err := client.Do(request)
102
+	if err != nil {
103
+		fmt.Println(err.Error())
104
+		return err.Error(), ""
105
+	}
106
+	respBytes, err := ioutil.ReadAll(resp.Body)
107
+	if err != nil {
108
+		fmt.Println(err.Error())
109
+		return err.Error(), ""
110
+	}
111
+	fmt.Println(string(respBytes))
112
+	str := string(respBytes)
113
+	return str, inputLog
114
+
115
+}
116
+func Gdyb4202(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, struct4202 models.Struct4202) (string, string) {
117
+	//生成签名
118
+	nonce := GetRandomString(32)
119
+	timestamp := time.Now().Unix()
120
+	signature := setSignature(timestamp, nonce, secret_key)
121
+	//生成输入报文
122
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
123
+	input := make(map[string]interface{})
124
+	inputData := make(map[string]interface{})
125
+	inputMessage["infno"] = "4202" // 交易编码
126
+
127
+	feedetail := make([]map[string]interface{}, 0)
128
+
129
+	inputData["fixmedins_mdtrt_id"] = struct4202.OwnPayPatnMdtrtD.FixmedinsMdtrtID
130
+	inputData["fixmedins_code"] = struct4202.OwnPayPatnMdtrtD.FixmedinsCode
131
+	inputData["fixmedins_name"] = struct4202.OwnPayPatnMdtrtD.FixmedinsName
132
+
133
+	inputData["psn_cert_type"] = struct4202.OwnPayPatnMdtrtD.PsnCertType
134
+
135
+	inputData["certno"] = struct4202.OwnPayPatnMdtrtD.Certno
136
+	inputData["psn_name"] = struct4202.OwnPayPatnMdtrtD.PsnName
137
+
138
+	inputData["gend"] = ""
139
+	inputData["naty"] = ""
140
+	inputData["brdy"] = ""
141
+	inputData["age"] = ""
142
+	inputData["coner_name"] = ""
143
+	inputData["tel"] = ""
144
+
145
+	inputData["addr"] = ""
146
+	inputData["begntime"] = struct4202.OwnPayPatnMdtrtD.Begntime
147
+	inputData["endtime"] = ""
148
+	inputData["med_type"] = struct4202.OwnPayPatnMdtrtD.MedType
149
+	inputData["ipt_otp_no"] = ""
150
+	inputData["medrcdno"] = ""
151
+	inputData["chfpdr_code"] = ""
152
+	inputData["adm_dept_dscr"] = ""
153
+	inputData["adm_dept_codg"] = ""
154
+	inputData["adm_dept_name"] = ""
155
+	inputData["adm_bed"] = ""
156
+	inputData["wardarea_bed"] = ""
157
+	inputData["traf_dept_flag"] = ""
158
+	inputData["dscg_maindiag_code"] = ""
159
+	inputData["dscg_dept_codg"] = ""
160
+	inputData["dscg_dept_name"] = ""
161
+	inputData["dscg_bed"] = ""
162
+	inputData["dscg_way"] = ""
163
+	inputData["main_cond_dscr"] = ""
164
+	inputData["dise_no"] = ""
165
+	inputData["dise_name"] = ""
166
+	inputData["oprn_oprt_code"] = ""
167
+	inputData["oprn_oprt_name"] = ""
168
+
169
+	inputData["otp_diag_info"] = ""
170
+	inputData["inhosp_stas"] = ""
171
+	inputData["die_date"] = ""
172
+	inputData["ipt_days"] = ""
173
+	inputData["fpsc_no"] = ""
174
+
175
+	inputData["matn_type"] = ""
176
+	inputData["birctrl_type"] = ""
177
+	inputData["latechb_flag"] = ""
178
+	inputData["geso_val"] = ""
179
+	inputData["fetts"] = ""
180
+
181
+	inputData["fetus_cnt"] = ""
182
+	inputData["pret_flag"] = ""
183
+	inputData["prey_time"] = ""
184
+	inputData["birctrl_matn_date"] = ""
185
+	inputData["cop_flag"] = ""
186
+	inputData["vali_flag"] = "1"
187
+	inputData["memo"] = ""
188
+	inputData["opter_id"] = ""
189
+	inputData["opter_name"] = ""
190
+	inputData["opt_time"] = ""
191
+	inputData["chfpdr_name"] = ""
192
+	inputData["dscg_maindiag_name"] = ""
193
+	inputData["medfee_sumamt"] = struct4202.OwnPayPatnMdtrtD.MedfeeSumamt
194
+	inputData["elec_bill_code"] = ""
195
+	inputData["elec_billno_code"] = ""
196
+	inputData["exp_content"] = ""
197
+
198
+	for _, item := range struct4202.ODiagListD {
199
+
200
+		feedetailInfo := make(map[string]interface{})
201
+		feedetailInfo["inout_diag_type"] = item.InoutDiagType
202
+		feedetailInfo["diag_type"] = item.DiagType         // 就诊 ID(来自2201接口返回)
203
+		feedetailInfo["maindiag_flag"] = item.MaindiagFlag // 人员编号 (来自1101接口返回)
204
+		feedetailInfo["diag_srt_no"] = ""                  // 收费批次号
205
+		feedetailInfo["diag_code"] = ""                    // 病种编码
206
+		feedetailInfo["diag_name"] = ""                    // 处方号
207
+		feedetailInfo["diag_dept"] = ""
208
+		feedetailInfo["diag_dr_code"] = ""
209
+		feedetailInfo["diag_dr_name"] = ""
210
+		feedetailInfo["diag_time"] = ""
211
+		feedetailInfo["vali_flag"] = ""
212
+		feedetail = append(feedetail, feedetailInfo)
213
+
214
+	}
215
+
216
+	inputData["ownPayPatnDiagListD"] = feedetail
217
+
218
+	input["data"] = inputData
219
+	inputMessage["input"] = input //交易输入
220
+
221
+	var inputLog string
222
+	bytesData, err := json.Marshal(inputMessage)
223
+	inputLog = string(bytesData)
224
+	fmt.Println(string(bytesData))
225
+	if err != nil {
226
+		fmt.Println(err.Error())
227
+		return err.Error(), ""
228
+	}
229
+	reader := bytes.NewReader(bytesData)
230
+	gdyb_url := beego.AppConfig.String("gdyb_url")
231
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
232
+
233
+	var url string
234
+	if fixmedins_code == "H15049901371" {
235
+		url = gdyb_url
236
+	} else {
237
+		url = gdyb_url + "1101"
238
+	}
239
+
240
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
241
+	request, err := http.NewRequest("POST", url, reader)
242
+	if err != nil {
243
+		fmt.Println(err.Error())
244
+		return err.Error(), ""
245
+	}
246
+
247
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
248
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
249
+	request.Header.Set("x-tif-signature", signature)
250
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
251
+	request.Header.Set("x-tif-nonce", nonce)
252
+
253
+	client := http.Client{}
254
+	resp, err := client.Do(request)
255
+	if err != nil {
256
+		fmt.Println(err.Error())
257
+		return err.Error(), ""
258
+	}
259
+	respBytes, err := ioutil.ReadAll(resp.Body)
260
+	if err != nil {
261
+		fmt.Println(err.Error())
262
+		return err.Error(), ""
263
+	}
264
+	fmt.Println(string(respBytes))
265
+	str := string(respBytes)
266
+	return str, inputLog
267
+
268
+}
269
+func Gdyb4203(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) {
270
+	//生成签名
271
+	nonce := GetRandomString(32)
272
+	timestamp := time.Now().Unix()
273
+	signature := setSignature(timestamp, nonce, secret_key)
274
+	//生成输入报文
275
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
276
+	//input := make(map[string]interface{})
277
+	inputData := make(map[string]interface{})
278
+	inputMessage["infno"] = "4203"       // 交易编码
279
+	inputData["fixmedins_mdtrt_id"] = "" // 开始时间
280
+	inputData["fixmedins_code"] = ""     // 开始时间
281
+	inputData["cplt_flag"] = ""          // 人员姓名
282
+	inputMessage["input"] = inputData    //交易输入
283
+
284
+	var inputLog string
285
+	bytesData, err := json.Marshal(inputMessage)
286
+	inputLog = string(bytesData)
287
+	fmt.Println(string(bytesData))
288
+	if err != nil {
289
+		fmt.Println(err.Error())
290
+		return err.Error(), ""
291
+	}
292
+	reader := bytes.NewReader(bytesData)
293
+	gdyb_url := beego.AppConfig.String("gdyb_url")
294
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
295
+
296
+	var url string
297
+	if fixmedins_code == "H15049901371" {
298
+		url = gdyb_url
299
+	} else {
300
+		url = gdyb_url + "1101"
301
+	}
302
+
303
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
304
+	request, err := http.NewRequest("POST", url, reader)
305
+	if err != nil {
306
+		fmt.Println(err.Error())
307
+		return err.Error(), ""
308
+	}
309
+
310
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
311
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
312
+	request.Header.Set("x-tif-signature", signature)
313
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
314
+	request.Header.Set("x-tif-nonce", nonce)
315
+
316
+	client := http.Client{}
317
+	resp, err := client.Do(request)
318
+	if err != nil {
319
+		fmt.Println(err.Error())
320
+		return err.Error(), ""
321
+	}
322
+	respBytes, err := ioutil.ReadAll(resp.Body)
323
+	if err != nil {
324
+		fmt.Println(err.Error())
325
+		return err.Error(), ""
326
+	}
327
+	fmt.Println(string(respBytes))
328
+	str := string(respBytes)
329
+	return str, inputLog
330
+
331
+}
332
+func Gdyb4204(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) {
333
+	//生成签名
334
+	nonce := GetRandomString(32)
335
+	timestamp := time.Now().Unix()
336
+	signature := setSignature(timestamp, nonce, secret_key)
337
+	//生成输入报文
338
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
339
+	input := make(map[string]interface{})
340
+	inputData := make(map[string]interface{})
341
+	feedetail := make([]map[string]interface{}, 0)
342
+
343
+	inputMessage["infno"] = "4204" // 交易编码
344
+	inputData["fixmedins_mdtrt_id"] = ""
345
+	inputData["fixmedins_code"] = ""
346
+
347
+	feedetailInfo := make(map[string]interface{})
348
+	feedetailInfo["bkkp_sn"] = ""
349
+	feedetail = append(feedetail, feedetailInfo)
350
+	input["feedetl"] = feedetail
351
+	input["feedetail"] = inputData
352
+	inputMessage["input"] = input //交易输入
353
+
354
+	var inputLog string
355
+	bytesData, err := json.Marshal(inputMessage)
356
+	inputLog = string(bytesData)
357
+	fmt.Println(string(bytesData))
358
+	if err != nil {
359
+		fmt.Println(err.Error())
360
+		return err.Error(), ""
361
+	}
362
+	reader := bytes.NewReader(bytesData)
363
+	gdyb_url := beego.AppConfig.String("gdyb_url")
364
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
365
+
366
+	var url string
367
+	if fixmedins_code == "H15049901371" {
368
+		url = gdyb_url
369
+	} else {
370
+		url = gdyb_url + "1101"
371
+	}
372
+
373
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
374
+	request, err := http.NewRequest("POST", url, reader)
375
+	if err != nil {
376
+		fmt.Println(err.Error())
377
+		return err.Error(), ""
378
+	}
379
+
380
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
381
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
382
+	request.Header.Set("x-tif-signature", signature)
383
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
384
+	request.Header.Set("x-tif-nonce", nonce)
385
+
386
+	client := http.Client{}
387
+	resp, err := client.Do(request)
388
+	if err != nil {
389
+		fmt.Println(err.Error())
390
+		return err.Error(), ""
391
+	}
392
+	respBytes, err := ioutil.ReadAll(resp.Body)
393
+	if err != nil {
394
+		fmt.Println(err.Error())
395
+		return err.Error(), ""
396
+	}
397
+	fmt.Println(string(respBytes))
398
+	str := string(respBytes)
399
+	return str, inputLog
400
+
401
+}
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) {
404
+	//生成签名
405
+	nonce := GetRandomString(32)
406
+	timestamp := time.Now().Unix()
407
+	signature := setSignature(timestamp, nonce, secret_key)
408
+	//生成输入报文
409
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
410
+	input := make(map[string]interface{})
411
+	inputData := make(map[string]interface{})
412
+	inputMessage["infno"] = "4205" // 交易编码
413
+
414
+	inputData["fixmedins_mdtrt_id"] = ""
415
+	inputData["fixmedins_code"] = ""
416
+	inputData["fixmedins_name"] = ""
417
+
418
+	inputData["psn_cert_type"] = ""
419
+
420
+	inputData["certno"] = ""
421
+	inputData["psn_name"] = ""
422
+
423
+	inputData["gend"] = ""
424
+	inputData["naty"] = ""
425
+	inputData["brdy"] = ""
426
+	inputData["age"] = ""
427
+	inputData["coner_name"] = ""
428
+	inputData["tel"] = ""
429
+
430
+	inputData["addr"] = ""
431
+	inputData["begntime"] = ""
432
+	inputData["endtime"] = ""
433
+	inputData["med_type"] = ""
434
+	inputData["main_cond_dscr"] = ""
435
+	inputData["dise_codg"] = ""
436
+	inputData["dise_name"] = ""
437
+	inputData["birctrl_type"] = ""
438
+	inputData["birctrl_matn_date"] = ""
439
+	inputData["matn_type"] = ""
440
+	inputData["geso_val"] = ""
441
+	inputData["elec_bill_code"] = ""
442
+	inputData["elec_billno_code"] = ""
443
+
444
+	inputData["elec_bill_chkcode"] = ""
445
+
446
+	inputData["exp_content"] = ""
447
+
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)
461
+	inputData["diseinfo"] = diagInfos
462
+
463
+	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"] = ""
504
+
505
+	feedetail = append(feedetail, feedetailInfo)
506
+	inputData["feedetail"] = feedetail
507
+
508
+	input["data"] = inputData
509
+	inputMessage["input"] = input //交易输入
510
+
511
+	var inputLog string
512
+	bytesData, err := json.Marshal(inputMessage)
513
+	inputLog = string(bytesData)
514
+	fmt.Println(string(bytesData))
515
+	if err != nil {
516
+		fmt.Println(err.Error())
517
+		return err.Error(), ""
518
+	}
519
+	reader := bytes.NewReader(bytesData)
520
+	gdyb_url := beego.AppConfig.String("gdyb_url")
521
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
522
+
523
+	var url string
524
+	if fixmedins_code == "H15049901371" {
525
+		url = gdyb_url
526
+	} else {
527
+		url = gdyb_url + "1101"
528
+	}
529
+
530
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
531
+	request, err := http.NewRequest("POST", url, reader)
532
+	if err != nil {
533
+		fmt.Println(err.Error())
534
+		return err.Error(), ""
535
+	}
536
+
537
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
538
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
539
+	request.Header.Set("x-tif-signature", signature)
540
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
541
+	request.Header.Set("x-tif-nonce", nonce)
542
+
543
+	client := http.Client{}
544
+	resp, err := client.Do(request)
545
+	if err != nil {
546
+		fmt.Println(err.Error())
547
+		return err.Error(), ""
548
+	}
549
+	respBytes, err := ioutil.ReadAll(resp.Body)
550
+	if err != nil {
551
+		fmt.Println(err.Error())
552
+		return err.Error(), ""
553
+	}
554
+	fmt.Println(string(respBytes))
555
+	str := string(respBytes)
556
+	return str, inputLog
557
+
558
+}
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) {
560
+	//生成签名
561
+	nonce := GetRandomString(32)
562
+	timestamp := time.Now().Unix()
563
+	signature := setSignature(timestamp, nonce, secret_key)
564
+	//生成输入报文
565
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
566
+	input := make(map[string]interface{})
567
+	inputData := make(map[string]interface{})
568
+	inputMessage["infno"] = "4206"       // 交易编码
569
+	inputData["fixmedins_mdtrt_id"] = "" // 开始时间
570
+	inputData["fixmedins_code"] = ""     // 开始时间
571
+	input["input"] = inputData           // 开始时间
572
+	inputMessage["input"] = input        //交易输入
573
+
574
+	var inputLog string
575
+	bytesData, err := json.Marshal(inputMessage)
576
+	inputLog = string(bytesData)
577
+	fmt.Println(string(bytesData))
578
+	if err != nil {
579
+		fmt.Println(err.Error())
580
+		return err.Error(), ""
581
+	}
582
+	reader := bytes.NewReader(bytesData)
583
+	gdyb_url := beego.AppConfig.String("gdyb_url")
584
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
585
+
586
+	var url string
587
+	if fixmedins_code == "H15049901371" {
588
+		url = gdyb_url
589
+	} else {
590
+		url = gdyb_url + "1101"
591
+	}
592
+
593
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
594
+	request, err := http.NewRequest("POST", url, reader)
595
+	if err != nil {
596
+		fmt.Println(err.Error())
597
+		return err.Error(), ""
598
+	}
599
+
600
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
601
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
602
+	request.Header.Set("x-tif-signature", signature)
603
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
604
+	request.Header.Set("x-tif-nonce", nonce)
605
+
606
+	client := http.Client{}
607
+	resp, err := client.Do(request)
608
+	if err != nil {
609
+		fmt.Println(err.Error())
610
+		return err.Error(), ""
611
+	}
612
+	respBytes, err := ioutil.ReadAll(resp.Body)
613
+	if err != nil {
614
+		fmt.Println(err.Error())
615
+		return err.Error(), ""
616
+	}
617
+	fmt.Println(string(respBytes))
618
+	str := string(respBytes)
619
+	return str, inputLog
620
+
621
+}
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) {
623
+	//生成签名
624
+	nonce := GetRandomString(32)
625
+	timestamp := time.Now().Unix()
626
+	signature := setSignature(timestamp, nonce, secret_key)
627
+	//生成输入报文
628
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
629
+	input := make(map[string]interface{})
630
+	inputData := make(map[string]interface{})
631
+	inputMessage["infno"] = "4207" // 交易编码
632
+
633
+	inputData["fixmedins_mdtrt_id"] = "" // 开始时间
634
+	inputData["fixmedins_code"] = ""     // 人员姓名
635
+	inputData["page_num"] = ""           // 人员姓名
636
+	inputData["page_size"] = ""          // 人员姓名
637
+
638
+	input["input"] = inputData
639
+	inputMessage["input"] = input //交易输入
640
+
641
+	var inputLog string
642
+	bytesData, err := json.Marshal(inputMessage)
643
+	inputLog = string(bytesData)
644
+	fmt.Println(string(bytesData))
645
+	if err != nil {
646
+		fmt.Println(err.Error())
647
+		return err.Error(), ""
648
+	}
649
+	reader := bytes.NewReader(bytesData)
650
+	gdyb_url := beego.AppConfig.String("gdyb_url")
651
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
652
+
653
+	var url string
654
+	if fixmedins_code == "H15049901371" {
655
+		url = gdyb_url
656
+	} else {
657
+		url = gdyb_url + "1101"
658
+	}
659
+
660
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
661
+	request, err := http.NewRequest("POST", url, reader)
662
+	if err != nil {
663
+		fmt.Println(err.Error())
664
+		return err.Error(), ""
665
+	}
666
+
667
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
668
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
669
+	request.Header.Set("x-tif-signature", signature)
670
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
671
+	request.Header.Set("x-tif-nonce", nonce)
672
+
673
+	client := http.Client{}
674
+	resp, err := client.Do(request)
675
+	if err != nil {
676
+		fmt.Println(err.Error())
677
+		return err.Error(), ""
678
+	}
679
+	respBytes, err := ioutil.ReadAll(resp.Body)
680
+	if err != nil {
681
+		fmt.Println(err.Error())
682
+		return err.Error(), ""
683
+	}
684
+	fmt.Println(string(respBytes))
685
+	str := string(respBytes)
686
+	return str, inputLog
687
+
688
+}
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) {
690
+	//生成签名
691
+	nonce := GetRandomString(32)
692
+	timestamp := time.Now().Unix()
693
+	signature := setSignature(timestamp, nonce, secret_key)
694
+	//生成输入报文
695
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
696
+	input := make(map[string]interface{})
697
+	inputData := make(map[string]interface{})
698
+	inputMessage["infno"] = "4208" // 交易编码
699
+
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"] = ""        // 人员姓名
710
+
711
+	input["input"] = inputData
712
+	inputMessage["input"] = input //交易输入
713
+
714
+	var inputLog string
715
+	bytesData, err := json.Marshal(inputMessage)
716
+	inputLog = string(bytesData)
717
+	fmt.Println(string(bytesData))
718
+	if err != nil {
719
+		fmt.Println(err.Error())
720
+		return err.Error(), ""
721
+	}
722
+	reader := bytes.NewReader(bytesData)
723
+	gdyb_url := beego.AppConfig.String("gdyb_url")
724
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
725
+
726
+	var url string
727
+	if fixmedins_code == "H15049901371" {
728
+		url = gdyb_url
729
+	} else {
730
+		url = gdyb_url + "1101"
731
+	}
732
+
733
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
734
+	request, err := http.NewRequest("POST", url, reader)
735
+	if err != nil {
736
+		fmt.Println(err.Error())
737
+		return err.Error(), ""
738
+	}
739
+
740
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
741
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
742
+	request.Header.Set("x-tif-signature", signature)
743
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
744
+	request.Header.Set("x-tif-nonce", nonce)
745
+
746
+	client := http.Client{}
747
+	resp, err := client.Do(request)
748
+	if err != nil {
749
+		fmt.Println(err.Error())
750
+		return err.Error(), ""
751
+	}
752
+	respBytes, err := ioutil.ReadAll(resp.Body)
753
+	if err != nil {
754
+		fmt.Println(err.Error())
755
+		return err.Error(), ""
756
+	}
757
+	fmt.Println(string(respBytes))
758
+	str := string(respBytes)
759
+	return str, inputLog
760
+
761
+}
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) {
763
+	//生成签名
764
+	nonce := GetRandomString(32)
765
+	timestamp := time.Now().Unix()
766
+	signature := setSignature(timestamp, nonce, secret_key)
767
+	//生成输入报文
768
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
769
+	input := make(map[string]interface{})
770
+	inputData := make(map[string]interface{})
771
+	inputMessage["infno"] = "4209" // 交易编码
772
+
773
+	inputData["fixmedins_mdtrt_id"] = "" // 开始时间
774
+	inputData["fixmedins_code"] = ""     // 人员姓名
775
+	inputData["page_num"] = ""           // 人员姓名
776
+	inputData["page_size"] = ""          // 人员姓名
777
+
778
+	input["input"] = inputData
779
+	inputMessage["input"] = input //交易输入
780
+
781
+	var inputLog string
782
+	bytesData, err := json.Marshal(inputMessage)
783
+	inputLog = string(bytesData)
784
+	fmt.Println(string(bytesData))
785
+	if err != nil {
786
+		fmt.Println(err.Error())
787
+		return err.Error(), ""
788
+	}
789
+	reader := bytes.NewReader(bytesData)
790
+	gdyb_url := beego.AppConfig.String("gdyb_url")
791
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
792
+
793
+	var url string
794
+	if fixmedins_code == "H15049901371" {
795
+		url = gdyb_url
796
+	} else {
797
+		url = gdyb_url + "1101"
798
+	}
799
+
800
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
801
+	request, err := http.NewRequest("POST", url, reader)
802
+	if err != nil {
803
+		fmt.Println(err.Error())
804
+		return err.Error(), ""
805
+	}
806
+
807
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
808
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
809
+	request.Header.Set("x-tif-signature", signature)
810
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
811
+	request.Header.Set("x-tif-nonce", nonce)
812
+
813
+	client := http.Client{}
814
+	resp, err := client.Do(request)
815
+	if err != nil {
816
+		fmt.Println(err.Error())
817
+		return err.Error(), ""
818
+	}
819
+	respBytes, err := ioutil.ReadAll(resp.Body)
820
+	if err != nil {
821
+		fmt.Println(err.Error())
822
+		return err.Error(), ""
823
+	}
824
+	fmt.Println(string(respBytes))
825
+	str := string(respBytes)
826
+	return str, inputLog
827
+
828
+}

+ 11 - 5
service/his_service.go View File

1422
 }
1422
 }
1423
 
1423
 
1424
 func GetAllHisOrder(org_id int64) (his []*models.HisOrder, err error) {
1424
 func GetAllHisOrder(org_id int64) (his []*models.HisOrder, err error) {
1425
-	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ?  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND med_type = '14' AND setl_time >= '2022-09-01 00:00:00'", org_id).Order("setl_time asc").Find(&his).Error
1426
-	return
1427
-}
1428
-func GetAllHisOrderErr(org_id int64, stage int64) (his []*models.HisOrderError, err error) {
1429
-	err = readDb.Model(&models.HisOrderError{}).Where("user_org_id = ? AND status = 1 AND stage = 101060", org_id).Find(&his).Error
1425
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ?  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND med_type = '14' AND setl_time >= '2022-11-01 00:00:00'", org_id).Order("setl_time asc").Find(&his).Error
1426
+	fmt.Println(err)
1430
 	return
1427
 	return
1431
 }
1428
 }
1432
 
1429
 
1430
+//func GetAllHisOrder2(org_id int64) (his []models.HisOrder, err error) {
1431
+//	err = readDb.Model(&models.HisOrder{}).Where("id = 180753").Order("setl_time asc").First(&his).Error
1432
+//	return
1433
+//}
1434
+//func GetAllHisOrderErr(org_id int64, stage int64) (his []*models.HisOrderError, err error) {
1435
+//	err = readDb.Model(&models.HisOrderError{}).Where("user_org_id = ? AND status = 1 AND stage = 101060", org_id).Find(&his).Error
1436
+//	return
1437
+//}
1438
+
1433
 func GetHisOrderInfoByNumberFour(order_number string) (order []*models.HisOrderInfo, err error) {
1439
 func GetHisOrderInfoByNumberFour(order_number string) (order []*models.HisOrderInfo, err error) {
1434
 	db := readDb.Model(&models.HisOrderInfo{})
1440
 	db := readDb.Model(&models.HisOrderInfo{})
1435
 	err = db.Where("order_number = ? AND status = 1", order_number).Find(&order).Error
1441
 	err = db.Where("order_number = ? AND status = 1", order_number).Find(&order).Error

+ 32 - 9
service/jsyb_service.go View File

613
 		feedetailInfo["bilg_dept_codg"] = dept_code                  // 开单科室编码
613
 		feedetailInfo["bilg_dept_codg"] = dept_code                  // 开单科室编码
614
 		feedetailInfo["bilg_dept_name"] = dept                       // 开单科室名称
614
 		feedetailInfo["bilg_dept_name"] = dept                       // 开单科室名称
615
 
615
 
616
-		feedetailInfo["bilg_dr_codg"] = "D371621008686"   // 开单医生编码
617
-		feedetailInfo["bilg_dr_name"] = "王云刚"             // 开单医师姓名
618
-		feedetailInfo["acord_dept_codg"] = ""             // 受单科室编码
619
-		feedetailInfo["acord_dept_name"] = ""             // 受单科室名称
620
-		feedetailInfo["orders_dr_code"] = "D371621008686" // 受单医生编码
621
-		feedetailInfo["orders_dr_name"] = "王云刚"           // 受单医生姓名
616
+		if fixmedins_code == "H32092103007" {
617
+			feedetailInfo["bilg_dr_codg"] = "D320923012139"   // 开单医生编码
618
+			feedetailInfo["bilg_dr_name"] = "王曙光"             // 开单医师姓名
619
+			feedetailInfo["acord_dept_codg"] = ""             // 受单科室编码
620
+			feedetailInfo["acord_dept_name"] = ""             // 受单科室名称
621
+			feedetailInfo["orders_dr_code"] = "D320923012139" // 受单医生编码
622
+			feedetailInfo["orders_dr_name"] = "王曙光"           // 受单医生姓名
623
+
624
+		} else {
625
+			feedetailInfo["bilg_dr_codg"] = "D371621008686"   // 开单医生编码
626
+			feedetailInfo["bilg_dr_name"] = "王云刚"             // 开单医师姓名
627
+			feedetailInfo["acord_dept_codg"] = ""             // 受单科室编码
628
+			feedetailInfo["acord_dept_name"] = ""             // 受单科室名称
629
+			feedetailInfo["orders_dr_code"] = "D371621008686" // 受单医生编码
630
+			feedetailInfo["orders_dr_name"] = "王云刚"           // 受单医生姓名
631
+
632
+		}
633
+
622
 		if balance_accounts_type == "8" {
634
 		if balance_accounts_type == "8" {
623
 			feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
635
 			feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
624
 		} else {
636
 		} else {
747
 	inputData["acct_used_flag"] = "0"   // 个人账户使用标志 0否 1是
759
 	inputData["acct_used_flag"] = "0"   // 个人账户使用标志 0否 1是
748
 	inputData["insutype"] = insutype    // 险种类型
760
 	inputData["insutype"] = insutype    // 险种类型
749
 	inputData["invono"] = ""            // 发票号
761
 	inputData["invono"] = ""            // 发票号
750
-	inputData["exp_content"] = ""       // 人员编号 (来自1101接口返回)
751
-
762
+	inputData2 := make(map[string]interface{})
763
+	inputData2["trum_flag"] = ""
764
+	inputData2["rel_ttp_flag"] = ""
765
+	inputData2["otp_er_refl_flag"] = ""
766
+	inputData2["mdtrt_grp_type"] = ""
767
+	inputData2["need_ipt_flag"] = ""
768
+	inputData["exp_content"] = inputData2
752
 	input["data"] = inputData
769
 	input["data"] = inputData
753
 	inputMessage["input"] = input //交易输入
770
 	inputMessage["input"] = input //交易输入
754
 
771
 
821
 	inputData["overlmt_selfpay"] = overlmt_selfpay     //
838
 	inputData["overlmt_selfpay"] = overlmt_selfpay     //
822
 	inputData["preselfpay_amt"] = preselfpay_amt       //
839
 	inputData["preselfpay_amt"] = preselfpay_amt       //
823
 	inputData["inscp_scp_amt"] = inscp_scp_amt         //
840
 	inputData["inscp_scp_amt"] = inscp_scp_amt         //
824
-	inputData["exp_content"] = ""                      // 人员编号 (来自1101接口返回)
841
+	inputData2 := make(map[string]interface{})
842
+	inputData2["trum_flag"] = ""
843
+	inputData2["rel_ttp_flag"] = ""
844
+	inputData2["otp_er_refl_flag"] = ""
845
+	inputData2["mdtrt_grp_type"] = ""
846
+	inputData2["need_ipt_flag"] = ""
847
+	inputData["exp_content"] = inputData2
825
 
848
 
826
 	input["data"] = inputData
849
 	input["data"] = inputData
827
 	inputMessage["input"] = input //交易输入
850
 	inputMessage["input"] = input //交易输入

+ 16 - 2
service/jx_service.go View File

659
 	inputData["acct_used_flag"] = "0"   // 个人账户使用标志 0否 1是
659
 	inputData["acct_used_flag"] = "0"   // 个人账户使用标志 0否 1是
660
 	inputData["insutype"] = insutype    // 险种类型
660
 	inputData["insutype"] = insutype    // 险种类型
661
 	inputData["invono"] = ""            // 发票号
661
 	inputData["invono"] = ""            // 发票号
662
-	inputData["exp_content"] = ""       // 人员编号 (来自1101接口返回)
662
+
663
+	inputData2 := make(map[string]interface{})
664
+	inputData2["trum_flag"] = ""
665
+	inputData2["rel_ttp_flag"] = ""
666
+	inputData2["otp_er_refl_flag"] = ""
667
+	inputData2["mdtrt_grp_type"] = ""
668
+	inputData2["need_ipt_flag"] = ""
669
+	inputData["exp_content"] = inputData2 // 发票号
663
 
670
 
664
 	input["data"] = inputData
671
 	input["data"] = inputData
665
 	inputMessage["input"] = input //交易输入
672
 	inputMessage["input"] = input //交易输入
800
 	inputData["overlmt_selfpay"] = overlmt_selfpay     //
807
 	inputData["overlmt_selfpay"] = overlmt_selfpay     //
801
 	inputData["preselfpay_amt"] = preselfpay_amt       //
808
 	inputData["preselfpay_amt"] = preselfpay_amt       //
802
 	inputData["inscp_scp_amt"] = inscp_scp_amt         //
809
 	inputData["inscp_scp_amt"] = inscp_scp_amt         //
803
-	inputData["exp_content"] = ""                      // 人员编号 (来自1101接口返回)
810
+
811
+	inputData2 := make(map[string]interface{})
812
+	inputData2["trum_flag"] = ""
813
+	inputData2["rel_ttp_flag"] = ""
814
+	inputData2["otp_er_refl_flag"] = ""
815
+	inputData2["mdtrt_grp_type"] = ""
816
+	inputData2["need_ipt_flag"] = ""
817
+	inputData["exp_content"] = inputData2
804
 
818
 
805
 	input["data"] = inputData
819
 	input["data"] = inputData
806
 	inputMessage["input"] = input //交易输入
820
 	inputMessage["input"] = input //交易输入