test_user 1 anno fa
parent
commit
8c32ec915f

+ 145 - 70
controllers/nm/nm_controller.go Vedi File

@@ -11,11 +11,13 @@ import (
11 11
 	"gdyb/utils"
12 12
 	"github.com/astaxie/beego"
13 13
 	"github.com/axgle/mahonia"
14
+	"github.com/gorilla/websocket"
14 15
 	"golang.org/x/text/encoding/simplifiedchinese"
15 16
 	"io/ioutil"
17
+	"log"
16 18
 	"net/http"
19
+	"net/url"
17 20
 	"os"
18
-	"os/exec"
19 21
 	"regexp"
20 22
 	"strconv"
21 23
 	"strings"
@@ -785,6 +787,7 @@ func (c *NmController) ReadCard() {
785 787
 	id_card_type := c.GetString("id_card_type")
786 788
 	operator_id := c.GetString("operator_id")
787 789
 	operator := c.GetString("operator")
790
+	is_settle := c.GetString("is_settle")
788 791
 
789 792
 	switch id_card_type {
790 793
 	case "1":
@@ -857,61 +860,61 @@ func (c *NmController) ReadCard() {
857 860
 
858 861
 		break
859 862
 	case "4": //电子凭证
860
-		c.GetELeInfo()
863
+		//c.GetELeInfo()
864
+		var result_info string
865
+		if len(is_settle) > 0 {
866
+			_, result_info = c.GetELeInfo(fixmedins_code, operator_id, operator)
867
+		} else {
868
+			_, result_info = c.GetELeInfoThree(fixmedins_code, operator_id, operator)
869
+		}
861 870
 		//if result_code == "0000" {
862
-		//	var ele ELeData
863
-		//	err := json.Unmarshal([]byte(result_info), &ele)
864
-		//	if err != nil {
865
-		//		utils.ErrorLog("解析失败:%v", err)
866
-		//	}
867
-		//	token := ele.Data.EcToken
868
-		//	fmt.Println(token)
869
-		//	if len(token) > 0 {
870
-		//		result, _ := service.Gdyb1101ForEleCert(org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, token, ele.Data.UserName, ele.Data.IdNo)
871
-		//		var dat map[string]interface{}
872
-		//		if err := json.Unmarshal([]byte(result), &dat); err == nil {
873
-		//			fmt.Println(dat)
874
-		//		} else {
875
-		//			fmt.Println(err)
876
-		//		}
877
-		//		userJSONBytes, _ := json.Marshal(dat)
878
-		//		var res ResultTwo
879
-		//		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
880
-		//			utils.ErrorLog("解析失败:%v", err)
881
-		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
882
-		//			return
883
-		//		}
884
-		//
885
-		//		infocode, _ := strconv.ParseInt(res.Infcode, 10, 64)
886
-		//
887
-		//		if infocode == 0 {
888
-		//
889
-		//			c.ServeSuccessJSON(map[string]interface{}{
890
-		//				"status":         "0",
891
-		//				"card_info":      result_info,
892
-		//				"busi_card_info": result_info,
893
-		//				"token":          token,
894
-		//				"result":         dat,
895
-		//			})
896
-		//
897
-		//		} else {
898
-		//			c.ServeSuccessJSON(map[string]interface{}{
899
-		//				"status": "-1",
900
-		//			})
901
-		//
902
-		//		}
903
-		//	} else {
904
-		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
905
-		//		return
906
-		//	}
907
-		//} else {
908
-		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
909
-		//	return
910
-		//}
871
+		var ele ELeData
872
+		err := json.Unmarshal([]byte(result_info), &ele)
873
+		if err != nil {
874
+			utils.ErrorLog("解析失败:%v", err)
875
+		}
876
+		token := ele.Data.EcToken
877
+		fmt.Println(token)
878
+		if len(token) > 0 {
879
+			result, _ := service.Gdyb1101ForEleCert(org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, token, ele.Data.UserName, ele.Data.IdNo)
880
+			var dat map[string]interface{}
881
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
882
+				fmt.Println(dat)
883
+			} else {
884
+				fmt.Println(err)
885
+			}
886
+			userJSONBytes, _ := json.Marshal(dat)
887
+			var res ResultTwo
888
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
889
+				utils.ErrorLog("解析失败:%v", err)
890
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
891
+				return
892
+			}
893
+
894
+			infocode, _ := strconv.ParseInt(res.Infcode, 10, 64)
895
+
896
+			if infocode == 0 {
897
+				c.ServeSuccessJSON(map[string]interface{}{
898
+					"status":         "0",
899
+					"card_info":      result_info,
900
+					"busi_card_info": result_info,
901
+					"token":          token,
902
+					"result":         dat,
903
+				})
904
+			} else {
905
+				c.ServeSuccessJSON(map[string]interface{}{
906
+					"status": "-1",
907
+				})
908
+
909
+			}
910
+		} else {
911
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
912
+			return
913
+		}
911 914
 
912 915
 		break
913 916
 	case "5": //电子凭证
914
-		c.GetELeInfoTwo(fixmedins_code, operator_id, operator)
917
+		//c.GetELeInfoTwo(fixmedins_code, operator_id, operator)
915 918
 		//_, pBusiCardInfo := c.GetELeInfoTwo(fixmedins_code, operator_id, operator)
916 919
 
917 920
 		//var ele ELeData
@@ -1106,29 +1109,101 @@ func (c *NmController) GetBasBaseInfo(fixmedins_code string, mdtrtarea_admvs str
1106 1109
 	}
1107 1110
 	return DeleteExtraSpace(string(pBusiCardInfo))
1108 1111
 }
1109
-func (c *NmController) GetELeInfo() (string, string) {
1110
-	fmt.Println("执行java")
1111
-	var json string
1112
-	cmd := exec.Command("java", "-jar", "NM_DZPZ.jar", json)
1113
-	//fmt.Println(cmd)
1114
-	//fmt.Println(cmd.Output())
1115
-
1116
-	out, err := cmd.Output()
1112
+func (c *NmController) GetELeInfo(code string, operator_id string, operator_name string) (string, string) {
1113
+	// WebSocket服务器地址
1114
+	serverURL := "ws://127.0.0.1:8899"
1115
+
1116
+	// 解析WebSocket服务器地址
1117
+	u, err := url.Parse(serverURL)
1118
+	if err != nil {
1119
+		log.Fatal(err)
1120
+	}
1121
+
1122
+	// 建立WebSocket连接
1123
+	conn, _, err := websocket.DefaultDialer.Dial(u.String(), nil)
1124
+	if err != nil {
1125
+		log.Fatal(err)
1126
+	}
1127
+	defer conn.Close()
1128
+	input2 := make(map[string]interface{})
1129
+
1130
+	input := make(map[string]interface{})
1131
+	inputData := make(map[string]interface{})
1132
+	inputData["orgId"] = code
1133
+	inputData["businessType"] = "01103"
1134
+	inputData["operatorId"] = operator_id
1135
+	inputData["operatorName"] = operator_name
1136
+	inputData["officeId"] = "001"
1137
+	inputData["officeName"] = "血透室"
1138
+	inputData["deviceType"] = ""
1139
+	input["data"] = inputData
1140
+	input["orgId"] = code
1141
+	input["transType"] = "ec.query"
1142
+	input2["url"] = "http://10.38.22.15:8081/localcfc/api/hsecfc/localQrCodeQuery"
1143
+	input2["indata"] = input
1144
+
1145
+	bytesData, _ := json.Marshal(input2)
1146
+	err = conn.WriteMessage(websocket.TextMessage, bytesData)
1147
+	if err != nil {
1148
+		fmt.Println(err)
1149
+	}
1150
+
1151
+	// 接收消息
1152
+	_, receivedMessage, err := conn.ReadMessage()
1153
+	if err != nil {
1154
+		fmt.Println(err)
1155
+	}
1156
+
1157
+	return "", string(receivedMessage)
1158
+}
1159
+func (c *NmController) GetELeInfoThree(code string, operator_id string, operator_name string) (string, string) {
1160
+	// WebSocket服务器地址
1161
+	serverURL := "ws://127.0.0.1:8899"
1162
+
1163
+	// 解析WebSocket服务器地址
1164
+	u, err := url.Parse(serverURL)
1165
+	if err != nil {
1166
+		log.Fatal(err)
1167
+	}
1168
+
1169
+	// 建立WebSocket连接
1170
+	conn, _, err := websocket.DefaultDialer.Dial(u.String(), nil)
1117 1171
 	if err != nil {
1118
-		fmt.Println("error:", err.Error())
1172
+		log.Fatal(err)
1119 1173
 	}
1120
-	fmt.Println(err)
1121
-	fmt.Println(string(out))
1122
-	fmt.Println("json:")
1123
-	fmt.Println(cmd.Args[0])
1124
-	fmt.Println(json)
1125
-	fmt.Println(string(json))
1126
-	fmt.Println("json:")
1174
+	defer conn.Close()
1175
+	input2 := make(map[string]interface{})
1127 1176
 
1128
-	results := strings.Split(string(out), "-")
1129
-	return results[0], results[1]
1177
+	input := make(map[string]interface{})
1178
+	inputData := make(map[string]interface{})
1179
+	inputData["orgId"] = code
1180
+	inputData["businessType"] = "01301"
1181
+	inputData["operatorId"] = operator_id
1182
+	inputData["operatorName"] = operator_name
1183
+	inputData["officeId"] = "001"
1184
+	inputData["officeName"] = "血透室"
1185
+	inputData["deviceType"] = ""
1186
+	input["data"] = inputData
1187
+	input["orgId"] = code
1188
+	input["transType"] = "ec.query"
1189
+	input2["url"] = "http://10.38.22.15:8081/localcfc/api/hsecfc/localQrCodeQuery"
1190
+	input2["indata"] = input
1191
+
1192
+	bytesData, _ := json.Marshal(input2)
1193
+	err = conn.WriteMessage(websocket.TextMessage, bytesData)
1194
+	if err != nil {
1195
+		fmt.Println(err)
1196
+	}
1130 1197
 
1198
+	// 接收消息
1199
+	_, receivedMessage, err := conn.ReadMessage()
1200
+	if err != nil {
1201
+		fmt.Println(err)
1202
+	}
1203
+
1204
+	return "", string(receivedMessage)
1131 1205
 }
1206
+
1132 1207
 func IntPtr(n int) uintptr {
1133 1208
 	return uintptr(n)
1134 1209
 }

File diff suppressed because it is too large
+ 1083 - 206
controllers/sg/his_api_controller.go


+ 461 - 221
controllers/zh/zh_his_api_controller.go Vedi File

@@ -1494,20 +1494,13 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
1494 1494
 	if miConfig.MdtrtareaAdmvs == "150499" {
1495 1495
 		if id_card_type == 2 {
1496 1496
 			mdtrt_cert_no := ""
1497
-			card_sn := ""
1498 1497
 
1499
-			if record.IdCardType == 1 {
1500
-				bas := strings.Split(psn_info.CardInfo, "|")
1501
-				cardNumber := bas[2]
1502
-				mdtrt_cert_no = cardNumber
1503
-				card_sn = bas[3]
1504
-			} else {
1505
-				mdtrt_cert_no = id_card_no
1506
-			}
1498
+			mdtrt_cert_no = id_card_no
1499
+
1507 1500
 			//请求内网数据
1508 1501
 			api := "http://172.16.13.254:9532/" + "nmyb/1101?cert_no=" + mdtrt_cert_no +
1509 1502
 				"&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName + "&fixmedins_code=" + miConfig.Code +
1510
-				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&card_sn=" + card_sn + "&certificates=" + strconv.FormatInt(certificates, 10) + "&name=" + patient.Name
1503
+				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&card_sn=" + "" + "&certificates=" + strconv.FormatInt(certificates, 10) + "&name=" + patient.Name
1511 1504
 			resp, requestErr := http.Get(api)
1512 1505
 			if requestErr != nil {
1513 1506
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -1559,8 +1552,15 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
1559 1552
 			res2.Output.Baseinfo.Certno = patient.IdCardNo
1560 1553
 		}
1561 1554
 	} else if miConfig.MdtrtareaAdmvs == "360399" {
1562
-		result, request_log = service.JxybZY1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, "", miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", certificates, miConfig.Url, miConfig.AccessKey, "", patient.IdCardNo, "")
1563
-		saveLog(result_log, request_log, "1101", "人员基本信息获取")
1555
+		//res2.Infcode = 0
1556
+		//res2.Output.Baseinfo.PsnNo = psn_info.PsnNo
1557
+		//res2.Output.Baseinfo.Certno = patient.IdCardNo
1558
+		//result, request_log = service.JxybZY1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, insuplc_admdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, ca, certificates, miConfig.Url, miConfig.AccessKey, "", patient.IdCardNo, "")
1559
+		bas := strings.Split(psn_info.CardInfo, "|")
1560
+		cardNumber := bas[3]
1561
+		result, request_log = service.Jxyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, cardNumber, "1", miConfig.Url, miConfig.AccessKey, "")
1562
+		saveLog(result, request_log, "1101", "人员基本信息获取")
1563
+
1564 1564
 	} else {
1565 1565
 		result, request_log, result_log = service.ZHGdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", certificates, name)
1566 1566
 		saveLog(result_log, request_log, "1101", "人员基本信息获取")
@@ -1694,7 +1694,6 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
1694 1694
 
1695 1695
 		timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
1696 1696
 		var struct2401 service.Struct2401
1697
-		struct2401.PsnNo = res2.Output.Baseinfo.PsnNo
1698 1697
 		//insutype = "310"
1699 1698
 		struct2401.Insutype = insutype
1700 1699
 		psn_info, _ := service.GetPsnByPatientId(patient.ID)
@@ -1704,11 +1703,16 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
1704 1703
 			bas := strings.Split(psn_info.CardInfo, "|")
1705 1704
 			cardNumber := bas[2]
1706 1705
 			struct2401.MdtrtCertNo = cardNumber
1706
+			struct2401.PsnNo = res2.Output.Baseinfo.PsnNo
1707
+		} else if id_card_type == 4 {
1708
+			struct2401.MdtrtCertType = "01"
1709
+			struct2401.MdtrtCertNo = psn_info.VerifyNumber
1710
+			struct2401.PsnNo = psn_info.PsnNo
1707 1711
 		} else {
1708 1712
 			struct2401.MdtrtCertType = "02"
1709
-			struct2401.MdtrtCertNo = res2.Output.Baseinfo.Certno
1713
+			struct2401.MdtrtCertNo = id_card_no
1714
+			struct2401.PsnNo = res2.Output.Baseinfo.PsnNo
1710 1715
 		}
1711
-
1712 1716
 		if miConfig.Code == "H15049901371" {
1713 1717
 			if med_type == 14 {
1714 1718
 				if insutype == "390" {
@@ -1724,8 +1728,8 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
1724 1728
 			}
1725 1729
 		} else {
1726 1730
 			if med_type == 11 {
1727
-				struct2401.MedType = "24"
1728
-				med_type = 24
1731
+				struct2401.MedType = "21"
1732
+				med_type = 21
1729 1733
 			} else {
1730 1734
 				struct2401.MedType = strconv.FormatInt(int64(med_type), 10)
1731 1735
 			}
@@ -1750,7 +1754,12 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
1750 1754
 		for index, item := range diagnosisConfig {
1751 1755
 			var dise service.DiseinfoStruct
1752 1756
 
1753
-			dise.PsnNo = res2.Output.Baseinfo.PsnNo
1757
+			if id_card_type == 4 || id_card_type == 1 {
1758
+				dise.PsnNo = psn_info.PsnNo
1759
+			} else {
1760
+				dise.PsnNo = res2.Output.Baseinfo.PsnNo
1761
+
1762
+			}
1754 1763
 			dise.DiagType = "1"
1755 1764
 			if index == 0 {
1756 1765
 				dise.MaindiagFlag = "1"
@@ -2668,6 +2677,9 @@ func (c *ZHHisApiController) GetPreSettleInfo() {
2668 2677
 		cardNumber := bas[2]
2669 2678
 		cert_no = cardNumber
2670 2679
 
2680
+	} else if record.IdCardType == 4 {
2681
+		cert_no = psn_info.VerifyNumber
2682
+
2671 2683
 	} else {
2672 2684
 		cert_no = record.Certno
2673 2685
 	}
@@ -2722,48 +2734,104 @@ func (c *ZHHisApiController) GetPreSettleInfo() {
2722 2734
 	var res2 ResultSevenTwo
2723 2735
 	var res ResultSeven
2724 2736
 	var resSeven10265 ResultSeven10265
2725
-	if miConfig.Code == "H15049901371" {
2726
-		if err := json.Unmarshal(userJSONBytes, &resSeven10265); err != nil {
2737
+
2738
+	if miConfig.MdtrtareaAdmvs == "360399" {
2739
+		if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
2727 2740
 			utils.ErrorLog("解析失败:%v", err)
2728 2741
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2729 2742
 			return
2730 2743
 		}
2731
-		Infcode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
2732
-		res.Infcode = Infcode
2733
-		res.InfRefmsgid = resSeven10265.InfRefmsgid
2734
-		res.RespondTime = resSeven10265.RespondTime
2735
-		res.ErrMsg = resSeven10265.ErrMsg
2736
-		res.Output = resSeven10265.Output
2737
-		res.WarnMsg = resSeven10265.WarnMsg
2738
-		res.Cainfo = resSeven10265.Cainfo
2739 2744
 
2740
-	} else {
2741
-		if miConfig.MdtrtareaAdmvs == "360399" {
2742
-			if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
2743
-				utils.ErrorLog("解析失败:%v", err)
2744
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2745
-				return
2745
+		if res2.Infcode != 0 {
2746
+			errlog := &models.HisOrderError{
2747
+				UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
2748
+				Ctime:      time.Now().Unix(),
2749
+				Mtime:      time.Now().Unix(),
2750
+				Number:     chrg_bchno,
2751
+				ErrMsg:     res.ErrMsg,
2752
+				Status:     1,
2753
+				PatientId:  patient_id,
2754
+				RecordTime: time.Now().Unix(),
2755
+				Stage:      6,
2746 2756
 			}
2757
+			service.CreateErrMsgLog(errlog)
2758
+			c.ServeSuccessJSON(map[string]interface{}{
2759
+				"failed_code": -10,
2760
+				"msg":         res.ErrMsg,
2761
+			})
2762
+			return
2763
+		} else {
2764
+			//order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
2765
+			order.OrderStatus = 1
2766
+			order.MdtrtId = res2.Output.Setlinfo.MdtrtID
2767
+			order.SetlId = res2.Output.Setlinfo.SetlID
2768
+			order.PsnNo = res2.Output.Setlinfo.PsnNo
2769
+			order.PsnName = res2.Output.Setlinfo.PsnName
2770
+			order.PsnCertType = res2.Output.Setlinfo.PsnCertType
2771
+			order.Certno = res2.Output.Setlinfo.Certno
2772
+			order.Gend = res2.Output.Setlinfo.Gend
2773
+			order.Naty = res2.Output.Setlinfo.Naty
2774
+			val, _ := strconv.ParseFloat(res2.Output.Setlinfo.Age, 64)
2775
+			order.Age = val
2776
+			order.Insutype = res2.Output.Setlinfo.Insutype
2777
+			order.PsnType = res2.Output.Setlinfo.PsnType
2778
+			order.CvlservFlag = res2.Output.Setlinfo.CvlservFlag
2779
+			order.SetlTime = res2.Output.Setlinfo.SetlTime
2780
+			order.MdtrtCertType = res2.Output.Setlinfo.MdtrtCertType
2781
+			if res.Output.Setlinfo.MedType == "140104" {
2782
+
2783
+				order.MedType = "14"
2747 2784
 
2748
-			if res2.Infcode != 0 {
2749
-				errlog := &models.HisOrderError{
2750
-					UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
2751
-					Ctime:      time.Now().Unix(),
2752
-					Mtime:      time.Now().Unix(),
2753
-					Number:     chrg_bchno,
2754
-					ErrMsg:     res.ErrMsg,
2755
-					Status:     1,
2756
-					PatientId:  patient_id,
2757
-					RecordTime: time.Now().Unix(),
2758
-					Stage:      6,
2759
-				}
2760
-				service.CreateErrMsgLog(errlog)
2761
-				c.ServeSuccessJSON(map[string]interface{}{
2762
-					"failed_code": -10,
2763
-					"msg":         res.ErrMsg,
2764
-				})
2765
-				return
2766 2785
 			} else {
2786
+
2787
+				order.MedType = res2.Output.Setlinfo.MedType
2788
+
2789
+			}
2790
+			order.MedfeeSumamt = res2.Output.Setlinfo.MedfeeSumamt
2791
+			order.FulamtOwnpayAmt = res2.Output.Setlinfo.FulamtOwnpayAmt
2792
+			order.OverlmtSelfPay = res2.Output.Setlinfo.OverlmtSelfpay
2793
+			order.PreselfpayAmt = res2.Output.Setlinfo.PreselfpayAmt
2794
+			order.InscpScpAmt = res2.Output.Setlinfo.InscpScpAmt
2795
+			order.ActPayDedc = res2.Output.Setlinfo.ActPayDedc
2796
+			order.HifmiPay = res2.Output.Setlinfo.HifmiPay
2797
+			order.HifpPay = res2.Output.Setlinfo.HifpPay
2798
+			order.HifesPay = res2.Output.Setlinfo.HifesPay
2799
+			order.HifobPay = res2.Output.Setlinfo.HifobPay
2800
+			order.MafPay = res2.Output.Setlinfo.MafPay
2801
+			order.OthPay = res2.Output.Setlinfo.OthPay
2802
+			order.CvlservPay = res2.Output.Setlinfo.CvlservPay
2803
+			order.PoolPropSelfpay = res2.Output.Setlinfo.PoolPropSelfpay
2804
+			order.FundPaySumamt = res2.Output.Setlinfo.FundPaySumamt
2805
+			order.PsnPartAmt = res2.Output.Setlinfo.PsnPartAmt
2806
+			order.AcctPay = res2.Output.Setlinfo.AcctPay
2807
+			order.PsnCashPay = res2.Output.Setlinfo.PsnCashPay
2808
+			order.HospPartAmt = res2.Output.Setlinfo.HospPartAmt
2809
+			order.Balc = res2.Output.Setlinfo.Balc
2810
+			order.AcctMulaidPay = res2.Output.Setlinfo.AcctMulaidPay
2811
+			order.MedinsSetlId = res2.Output.Setlinfo.MedinsSetlID
2812
+			order.ClrOptins = res2.Output.Setlinfo.ClrOptins
2813
+			order.ClrWay = res2.Output.Setlinfo.ClrWay
2814
+			order.Creator = order.Creator
2815
+			order.Modify = roles.AdminUserId
2816
+			order.RequestLog = src_resquest
2817
+			setlDetail, _ := json.Marshal(res2.Output.Setldetail)
2818
+			detailStr := string(setlDetail)
2819
+			order.SetlDetail = detailStr
2820
+			//err := service.UpdataOrderStatusTwo(chrg_bchno, c.GetAdminUserInfo().CurrentOrgId)
2821
+			if record.OutHospitalStatus == 1 && order.ID > 0 {
2822
+				err := service.UpDateOrder(order)
2823
+				if err == nil {
2824
+					c.ServeSuccessJSON(map[string]interface{}{
2825
+						"msg":       "预结算成功",
2826
+						"order_way": 1,
2827
+					})
2828
+				} else {
2829
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
2830
+					return
2831
+				}
2832
+			} else if record.OutHospitalStatus == 0 && order.ID == 0 {
2833
+
2834
+				var order models.HisOrder
2767 2835
 				//order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
2768 2836
 				order.OrderStatus = 1
2769 2837
 				order.MdtrtId = res2.Output.Setlinfo.MdtrtID
@@ -2781,7 +2849,7 @@ func (c *ZHHisApiController) GetPreSettleInfo() {
2781 2849
 				order.CvlservFlag = res2.Output.Setlinfo.CvlservFlag
2782 2850
 				order.SetlTime = res2.Output.Setlinfo.SetlTime
2783 2851
 				order.MdtrtCertType = res2.Output.Setlinfo.MdtrtCertType
2784
-				if res.Output.Setlinfo.MedType == "140104" {
2852
+				if res2.Output.Setlinfo.MedType == "140104" {
2785 2853
 
2786 2854
 					order.MedType = "14"
2787 2855
 
@@ -2820,184 +2888,129 @@ func (c *ZHHisApiController) GetPreSettleInfo() {
2820 2888
 				setlDetail, _ := json.Marshal(res2.Output.Setldetail)
2821 2889
 				detailStr := string(setlDetail)
2822 2890
 				order.SetlDetail = detailStr
2823
-				//err := service.UpdataOrderStatusTwo(chrg_bchno, c.GetAdminUserInfo().CurrentOrgId)
2824
-				if record.OutHospitalStatus == 1 && order.ID > 0 {
2825
-					err := service.UpDateOrder(order)
2826
-					if err == nil {
2827
-						c.ServeSuccessJSON(map[string]interface{}{
2828
-							"msg":       "预结算成功",
2829
-							"order_way": 1,
2830
-						})
2831
-					} else {
2832
-						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
2833
-						return
2834
-					}
2835
-				} else if record.OutHospitalStatus == 0 && order.ID == 0 {
2836
-
2837
-					var order models.HisOrder
2838
-					//order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
2839
-					order.OrderStatus = 1
2840
-					order.MdtrtId = res2.Output.Setlinfo.MdtrtID
2841
-					order.SetlId = res2.Output.Setlinfo.SetlID
2842
-					order.PsnNo = res2.Output.Setlinfo.PsnNo
2843
-					order.PsnName = res2.Output.Setlinfo.PsnName
2844
-					order.PsnCertType = res2.Output.Setlinfo.PsnCertType
2845
-					order.Certno = res2.Output.Setlinfo.Certno
2846
-					order.Gend = res2.Output.Setlinfo.Gend
2847
-					order.Naty = res2.Output.Setlinfo.Naty
2848
-					val, _ := strconv.ParseFloat(res2.Output.Setlinfo.Age, 64)
2849
-					order.Age = val
2850
-					order.Insutype = res2.Output.Setlinfo.Insutype
2851
-					order.PsnType = res2.Output.Setlinfo.PsnType
2852
-					order.CvlservFlag = res2.Output.Setlinfo.CvlservFlag
2853
-					order.SetlTime = res2.Output.Setlinfo.SetlTime
2854
-					order.MdtrtCertType = res2.Output.Setlinfo.MdtrtCertType
2855
-					if res2.Output.Setlinfo.MedType == "140104" {
2856
-
2857
-						order.MedType = "14"
2858 2891
 
2859
-					} else {
2860
-
2861
-						order.MedType = res2.Output.Setlinfo.MedType
2862
-
2863
-					}
2864
-					order.MedfeeSumamt = res2.Output.Setlinfo.MedfeeSumamt
2865
-					order.FulamtOwnpayAmt = res2.Output.Setlinfo.FulamtOwnpayAmt
2866
-					order.OverlmtSelfPay = res2.Output.Setlinfo.OverlmtSelfpay
2867
-					order.PreselfpayAmt = res2.Output.Setlinfo.PreselfpayAmt
2868
-					order.InscpScpAmt = res2.Output.Setlinfo.InscpScpAmt
2869
-					order.ActPayDedc = res2.Output.Setlinfo.ActPayDedc
2870
-					order.HifmiPay = res2.Output.Setlinfo.HifmiPay
2871
-					order.HifpPay = res2.Output.Setlinfo.HifpPay
2872
-					order.HifesPay = res2.Output.Setlinfo.HifesPay
2873
-					order.HifobPay = res2.Output.Setlinfo.HifobPay
2874
-					order.MafPay = res2.Output.Setlinfo.MafPay
2875
-					order.OthPay = res2.Output.Setlinfo.OthPay
2876
-					order.CvlservPay = res2.Output.Setlinfo.CvlservPay
2877
-					order.PoolPropSelfpay = res2.Output.Setlinfo.PoolPropSelfpay
2878
-					order.FundPaySumamt = res2.Output.Setlinfo.FundPaySumamt
2879
-					order.PsnPartAmt = res2.Output.Setlinfo.PsnPartAmt
2880
-					order.AcctPay = res2.Output.Setlinfo.AcctPay
2881
-					order.PsnCashPay = res2.Output.Setlinfo.PsnCashPay
2882
-					order.HospPartAmt = res2.Output.Setlinfo.HospPartAmt
2883
-					order.Balc = res2.Output.Setlinfo.Balc
2884
-					order.AcctMulaidPay = res2.Output.Setlinfo.AcctMulaidPay
2885
-					order.MedinsSetlId = res2.Output.Setlinfo.MedinsSetlID
2886
-					order.ClrOptins = res2.Output.Setlinfo.ClrOptins
2887
-					order.ClrWay = res2.Output.Setlinfo.ClrWay
2888
-					order.Creator = order.Creator
2889
-					order.Modify = roles.AdminUserId
2890
-					order.RequestLog = src_resquest
2891
-					setlDetail, _ := json.Marshal(res2.Output.Setldetail)
2892
-					detailStr := string(setlDetail)
2893
-					order.SetlDetail = detailStr
2894
-
2895
-					c.ServeSuccessJSON(map[string]interface{}{
2896
-						"msg":       "预结算成功",
2897
-						"order":     order,
2898
-						"order_way": 2,
2899
-					})
2900
-				}
2892
+				c.ServeSuccessJSON(map[string]interface{}{
2893
+					"msg":       "预结算成功",
2894
+					"order":     order,
2895
+					"order_way": 2,
2896
+				})
2897
+			}
2898
+		}
2899
+	} else {
2900
+		if miConfig.Code == "H15049901371" {
2901
+			if err := json.Unmarshal(userJSONBytes, &resSeven10265); err != nil {
2902
+				utils.ErrorLog("解析失败:%v", err)
2903
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2904
+				return
2901 2905
 			}
2906
+			Infcode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
2907
+			res.Infcode = Infcode
2908
+			res.InfRefmsgid = resSeven10265.InfRefmsgid
2909
+			res.RespondTime = resSeven10265.RespondTime
2910
+			res.ErrMsg = resSeven10265.ErrMsg
2911
+			res.Output = resSeven10265.Output
2912
+			res.WarnMsg = resSeven10265.WarnMsg
2913
+			res.Cainfo = resSeven10265.Cainfo
2914
+
2902 2915
 		} else {
2903 2916
 			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
2904 2917
 				utils.ErrorLog("解析失败:%v", err)
2905 2918
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2906 2919
 				return
2907 2920
 			}
2908
-			if res.Infcode != 0 {
2909
-				errlog := &models.HisOrderError{
2910
-					UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
2911
-					Ctime:      time.Now().Unix(),
2912
-					Mtime:      time.Now().Unix(),
2913
-					Number:     chrg_bchno,
2914
-					ErrMsg:     res.ErrMsg,
2915
-					Status:     1,
2916
-					PatientId:  patient_id,
2917
-					RecordTime: time.Now().Unix(),
2918
-					Stage:      6,
2919
-				}
2920
-				service.CreateErrMsgLog(errlog)
2921
-				c.ServeSuccessJSON(map[string]interface{}{
2922
-					"failed_code": -10,
2923
-					"msg":         res.ErrMsg,
2924
-				})
2925
-				return
2926
-			} else {
2927
-				//order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
2928
-				order.OrderStatus = 1
2929
-				order.MdtrtId = res.Output.Setlinfo.MdtrtID
2930
-				order.SetlId = res.Output.Setlinfo.SetlID
2931
-				order.PsnNo = res.Output.Setlinfo.PsnNo
2932
-				order.PsnName = res.Output.Setlinfo.PsnName
2933
-				order.PsnCertType = res.Output.Setlinfo.PsnCertType
2934
-				order.Certno = res.Output.Setlinfo.Certno
2935
-				order.Gend = res.Output.Setlinfo.Gend
2936
-				order.Naty = res.Output.Setlinfo.Naty
2937
-				order.Age = res.Output.Setlinfo.Age
2938
-				order.Insutype = res.Output.Setlinfo.Insutype
2939
-				order.PsnType = res.Output.Setlinfo.PsnType
2940
-				order.CvlservFlag = res.Output.Setlinfo.CvlservFlag
2941
-				order.SetlTime = res.Output.Setlinfo.SetlTime
2942
-				order.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
2943
-				if res.Output.Setlinfo.MedType == "140104" {
2944
-
2945
-					order.MedType = "14"
2921
+		}
2922
+		if res.Infcode != 0 {
2923
+			errlog := &models.HisOrderError{
2924
+				UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
2925
+				Ctime:      time.Now().Unix(),
2926
+				Mtime:      time.Now().Unix(),
2927
+				Number:     chrg_bchno,
2928
+				ErrMsg:     res.ErrMsg,
2929
+				Status:     1,
2930
+				PatientId:  patient_id,
2931
+				RecordTime: time.Now().Unix(),
2932
+				Stage:      6,
2933
+			}
2934
+			service.CreateErrMsgLog(errlog)
2935
+			c.ServeSuccessJSON(map[string]interface{}{
2936
+				"failed_code": -10,
2937
+				"msg":         res.ErrMsg,
2938
+			})
2939
+			return
2940
+		} else {
2941
+			//order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
2942
+			order.OrderStatus = 1
2943
+			order.MdtrtId = res.Output.Setlinfo.MdtrtID
2944
+			order.SetlId = res.Output.Setlinfo.SetlID
2945
+			order.PsnNo = res.Output.Setlinfo.PsnNo
2946
+			order.PsnName = res.Output.Setlinfo.PsnName
2947
+			order.PsnCertType = res.Output.Setlinfo.PsnCertType
2948
+			order.Certno = res.Output.Setlinfo.Certno
2949
+			order.Gend = res.Output.Setlinfo.Gend
2950
+			order.Naty = res.Output.Setlinfo.Naty
2951
+			order.Age = res.Output.Setlinfo.Age
2952
+			order.Insutype = res.Output.Setlinfo.Insutype
2953
+			order.PsnType = res.Output.Setlinfo.PsnType
2954
+			order.CvlservFlag = res.Output.Setlinfo.CvlservFlag
2955
+			order.SetlTime = res.Output.Setlinfo.SetlTime
2956
+			order.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
2957
+			if res.Output.Setlinfo.MedType == "140104" {
2958
+
2959
+				order.MedType = "14"
2946 2960
 
2947
-				} else {
2961
+			} else {
2948 2962
 
2949
-					order.MedType = res.Output.Setlinfo.MedType
2963
+				order.MedType = res.Output.Setlinfo.MedType
2950 2964
 
2951
-				}
2952
-				order.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
2953
-				order.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
2954
-				order.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
2955
-				order.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
2956
-				order.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
2957
-				order.ActPayDedc = res.Output.Setlinfo.ActPayDedc
2958
-				order.HifmiPay = res.Output.Setlinfo.HifmiPay
2959
-				order.HifpPay = res.Output.Setlinfo.HifpPay
2960
-				order.HifesPay = res.Output.Setlinfo.HifesPay
2961
-				order.HifobPay = res.Output.Setlinfo.HifobPay
2962
-				order.MafPay = res.Output.Setlinfo.MafPay
2963
-				order.OthPay = res.Output.Setlinfo.OthPay
2964
-				order.CvlservPay = res.Output.Setlinfo.CvlservPay
2965
-				order.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
2966
-				order.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
2967
-				order.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
2968
-				order.AcctPay = res.Output.Setlinfo.AcctPay
2969
-				order.PsnCashPay = res.Output.Setlinfo.PsnCashPay
2970
-				order.HospPartAmt = res.Output.Setlinfo.HospPartAmt
2971
-				order.Balc = res.Output.Setlinfo.Balc
2972
-				order.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
2973
-				order.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
2974
-				order.ClrOptins = res.Output.Setlinfo.ClrOptins
2975
-				order.ClrWay = res.Output.Setlinfo.ClrWay
2976
-				order.Creator = order.Creator
2977
-				order.Modify = roles.AdminUserId
2978
-				order.RequestLog = src_resquest
2979
-				setlDetail, _ := json.Marshal(res.Output.Setldetail)
2980
-				detailStr := string(setlDetail)
2981
-				order.SetlDetail = detailStr
2982
-				//err := service.UpdataOrderStatusTwo(chrg_bchno, c.GetAdminUserInfo().CurrentOrgId)
2983
-				if record.OutHospitalStatus == 1 && order.ID > 0 {
2984
-					err := service.UpDateOrder(order)
2985
-					if err == nil {
2986
-						c.ServeSuccessJSON(map[string]interface{}{
2987
-							"msg":       "预结算成功",
2988
-							"order_way": 1,
2989
-						})
2990
-					} else {
2991
-						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
2992
-						return
2993
-					}
2994
-				} else if record.OutHospitalStatus == 0 && order.ID == 0 {
2965
+			}
2966
+			order.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
2967
+			order.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
2968
+			order.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
2969
+			order.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
2970
+			order.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
2971
+			order.ActPayDedc = res.Output.Setlinfo.ActPayDedc
2972
+			order.HifmiPay = res.Output.Setlinfo.HifmiPay
2973
+			order.HifpPay = res.Output.Setlinfo.HifpPay
2974
+			order.HifesPay = res.Output.Setlinfo.HifesPay
2975
+			order.HifobPay = res.Output.Setlinfo.HifobPay
2976
+			order.MafPay = res.Output.Setlinfo.MafPay
2977
+			order.OthPay = res.Output.Setlinfo.OthPay
2978
+			order.CvlservPay = res.Output.Setlinfo.CvlservPay
2979
+			order.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
2980
+			order.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
2981
+			order.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
2982
+			order.AcctPay = res.Output.Setlinfo.AcctPay
2983
+			order.PsnCashPay = res.Output.Setlinfo.PsnCashPay
2984
+			order.HospPartAmt = res.Output.Setlinfo.HospPartAmt
2985
+			order.Balc = res.Output.Setlinfo.Balc
2986
+			order.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
2987
+			order.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
2988
+			order.ClrOptins = res.Output.Setlinfo.ClrOptins
2989
+			order.ClrWay = res.Output.Setlinfo.ClrWay
2990
+			order.Creator = order.Creator
2991
+			order.Modify = roles.AdminUserId
2992
+			order.RequestLog = src_resquest
2993
+			setlDetail, _ := json.Marshal(res.Output.Setldetail)
2994
+			detailStr := string(setlDetail)
2995
+			order.SetlDetail = detailStr
2996
+			//err := service.UpdataOrderStatusTwo(chrg_bchno, c.GetAdminUserInfo().CurrentOrgId)
2997
+			if record.OutHospitalStatus == 1 && order.ID > 0 {
2998
+				err := service.UpDateOrder(order)
2999
+				if err == nil {
2995 3000
 					c.ServeSuccessJSON(map[string]interface{}{
2996 3001
 						"msg":       "预结算成功",
2997
-						"order":     order,
2998
-						"order_way": 2,
3002
+						"order_way": 1,
2999 3003
 					})
3004
+				} else {
3005
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
3006
+					return
3000 3007
 				}
3008
+			} else if record.OutHospitalStatus == 0 && order.ID == 0 {
3009
+				c.ServeSuccessJSON(map[string]interface{}{
3010
+					"msg":       "预结算成功",
3011
+					"order":     order,
3012
+					"order_way": 2,
3013
+				})
3001 3014
 			}
3002 3015
 		}
3003 3016
 	}
@@ -4282,9 +4295,49 @@ type ELeData struct {
4282 4295
 
4283 4296
 var initFlagTwo int64 = 0
4284 4297
 
4298
+func (c *ZHHisApiController) TestGetJiangXiBasBaseInit() {
4299
+	DllDef := syscall.MustLoadDLL("SSCard.dll")
4300
+	Iinit := DllDef.MustFindProc("Init")
4301
+	//miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
4302
+	//http://10.77.211.236/CSB/hsa-fsi-1303
4303
+	ret, _, err := Iinit.Call(StrPtr("http://10.77.224.18:9001/1.0.0/agent-card-init"), StrPtr("360399"))
4304
+	if ret != 0 {
4305
+		fmt.Println("SSCard的报错原因:", err)
4306
+		fmt.Println("SSCard的运算结果为:", ret)
4307
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
4308
+		return
4309
+	}
4310
+
4311
+	result := int(ret)
4312
+	fmt.Println("SSCard的运算结果为1:", result)
4313
+	initFlag = 1
4314
+	return
4315
+}
4316
+func (c *ZHHisApiController) GetBasBaseInfoxxx() string {
4317
+	DllDef := syscall.MustLoadDLL("SSCard.dll")
4318
+	readCard := DllDef.MustFindProc("ReadCardBas")
4319
+	if readCard == nil {
4320
+		fmt.Println("readcard is nil")
4321
+		readCard = DllDef.MustFindProc("ReadCardBas")
4322
+	}
4323
+	str := make([]byte, 1024)
4324
+	str1 := make([]byte, 1024)
4325
+	ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), uintptr(1024), (uintptr)(unsafe.Pointer(&str1[0])), uintptr(1024))
4326
+	fmt.Println(string(str1))
4327
+	fmt.Println(string(str))
4328
+	fmt.Println(":", ConvertToString(string(str1), "gbk", "utf-8"))
4329
+	fmt.Println(":", ConvertToString(string(str), "gbk", "utf-8"))
4330
+	if ret2 != 0 {
4331
+		return ""
4332
+	}
4333
+	return string(str)
4334
+}
4335
+
4285 4336
 func (c *ZHHisApiController) ReadCard() {
4286 4337
 	id_card_type, _ := c.GetInt64("id_card_type")
4287 4338
 	admin_user_id, _ := c.GetInt64("admin_user_id")
4339
+	is_settle := c.GetString("is_settle")
4340
+
4288 4341
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
4289 4342
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
4290 4343
 
@@ -4488,6 +4541,125 @@ func (c *ZHHisApiController) ReadCard() {
4488 4541
 
4489 4542
 			}
4490 4543
 
4544
+		} else if miConfig.MdtrtareaAdmvs == "360399" {
4545
+			fmt.Println(initFlag)
4546
+			fmt.Println("initFlag")
4547
+
4548
+			if initFlag == 0 {
4549
+				c.TestGetJiangXiBasBaseInit()
4550
+			}
4551
+			basStr := c.GetBasBaseInfoxxx()
4552
+			if len(basStr) == 0 {
4553
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
4554
+				return
4555
+			}
4556
+			fmt.Println(basStr)
4557
+			bas := strings.Split(basStr, "|")
4558
+			basNumber := bas[1]
4559
+			fmt.Println(basNumber)
4560
+			card_sn := bas[3]
4561
+			fmt.Println(card_sn)
4562
+			result, _ := service.Jxyb1101(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, "1", miConfig.Url, miConfig.AccessKey, "")
4563
+
4564
+			//result := service.Jxyb1101(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, certificates)
4565
+			var dat map[string]interface{}
4566
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
4567
+				fmt.Println(dat)
4568
+			} else {
4569
+				fmt.Println(err)
4570
+			}
4571
+
4572
+			userJSONBytes, _ := json.Marshal(dat)
4573
+			var res ResultTwo
4574
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
4575
+				utils.ErrorLog("解析失败:%v", err)
4576
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4577
+				return
4578
+			}
4579
+
4580
+			if res.Infcode == 0 {
4581
+				patient, err := service.GetPatientByNumber(basNumber, c.GetAdminUserInfo().CurrentOrgId)
4582
+				if err == gorm.ErrRecordNotFound {
4583
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
4584
+					return
4585
+				} else if err != nil {
4586
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
4587
+					return
4588
+
4589
+				} else {
4590
+					Iinfos, _ := json.Marshal(res.Output.Iinfo)
4591
+					Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
4592
+					infoStr := string(Iinfos)
4593
+					idetinfoStr := string(Idetinfos)
4594
+					psn := &models.HisPsn{
4595
+						PsnNo:        res.Output.Baseinfo.PsnNo,
4596
+						Age:          res.Output.Baseinfo.Age,
4597
+						PatientId:    patient.ID,
4598
+						Certno:       res.Output.Baseinfo.Certno,
4599
+						Brdy:         res.Output.Baseinfo.Brdy,
4600
+						Gend:         res.Output.Baseinfo.Gend,
4601
+						Naty:         res.Output.Baseinfo.Naty,
4602
+						PsnCertType:  res.Output.Baseinfo.PsnCertType,
4603
+						PsnName:      res.Output.Baseinfo.PsnName,
4604
+						Idetinfo:     idetinfoStr,
4605
+						Insuinfo:     infoStr,
4606
+						UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
4607
+						CardInfo:     basStr,
4608
+						VerifyNumber: "",
4609
+					}
4610
+					service.CreateHisPsn(psn)
4611
+					var rf []*ResultFive
4612
+					json.Unmarshal([]byte(infoStr), &rf)
4613
+
4614
+					var insutypes []*ResultFive
4615
+					var insutype string
4616
+					var is390 int = 0
4617
+					var is310 int = 0
4618
+
4619
+					for _, item := range rf {
4620
+						if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
4621
+							insutypes = append(insutypes, item)
4622
+						}
4623
+					}
4624
+
4625
+					if len(insutypes) == 1 {
4626
+						insutype = insutypes[0].Insutype
4627
+						//insuplc_admdvs = insutypes[0].InsuplcAdmdvs
4628
+					} else {
4629
+						for _, i := range insutypes {
4630
+							if i.Insutype == "390" {
4631
+								is390 = 1
4632
+							}
4633
+
4634
+							if i.Insutype == "310" {
4635
+								is310 = 1
4636
+							}
4637
+						}
4638
+					}
4639
+					if is390 == 1 {
4640
+						insutype = "390"
4641
+					}
4642
+
4643
+					if is310 == 1 {
4644
+						insutype = "310"
4645
+					}
4646
+
4647
+					if len(insutypes) == 0 {
4648
+						insutype = "310"
4649
+					}
4650
+
4651
+					c.ServeSuccessJSON(map[string]interface{}{
4652
+						"patient":  patient,
4653
+						"number":   basNumber,
4654
+						"info":     res,
4655
+						"insutype": insutype,
4656
+					})
4657
+				}
4658
+			} else {
4659
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
4660
+				return
4661
+			}
4662
+
4491 4663
 		} else {
4492 4664
 
4493 4665
 			if initFlagTwo == 0 {
@@ -4601,7 +4773,7 @@ func (c *ZHHisApiController) ReadCard() {
4601 4773
 		if miConfig.MdtrtareaAdmvs == "150499" {
4602 4774
 			var api string
4603 4775
 			api = "http://172.16.13.254:9532/" + "nmyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
4604
-				"&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
4776
+				"&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 + "&is_settle=" + is_settle
4605 4777
 
4606 4778
 			resp, requestErr := http.Get(api)
4607 4779
 			if requestErr != nil {
@@ -4641,13 +4813,81 @@ func (c *ZHHisApiController) ReadCard() {
4641 4813
 				res.Infcode = infocode
4642 4814
 				res.Output = res10265.Output
4643 4815
 				res.InfRefmsgid = res10265.InfRefmsgid
4816
+
4644 4817
 				if res.Infcode == 0 {
4645
-					c.ServeSuccessJSON(map[string]interface{}{
4646
-						"number": token,
4647
-					})
4818
+					patient, err := service.GetPatientByNumber(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
4819
+					if err == gorm.ErrRecordNotFound {
4820
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
4821
+						return
4822
+					} else if err != nil {
4823
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
4824
+						return
4825
+					} else {
4826
+						Iinfos, _ := json.Marshal(res.Output.Iinfo)
4827
+						Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
4828
+						infoStr := string(Iinfos)
4829
+						idetinfoStr := string(Idetinfos)
4830
+						psn := &models.HisPsn{
4831
+							PsnNo:        res.Output.Baseinfo.PsnNo,
4832
+							Age:          res.Output.Baseinfo.Age,
4833
+							PatientId:    patient.ID,
4834
+							Certno:       res.Output.Baseinfo.Certno,
4835
+							Brdy:         res.Output.Baseinfo.Brdy,
4836
+							Gend:         res.Output.Baseinfo.Gend,
4837
+							Naty:         res.Output.Baseinfo.Naty,
4838
+							PsnCertType:  res.Output.Baseinfo.PsnCertType,
4839
+							PsnName:      res.Output.Baseinfo.PsnName,
4840
+							Idetinfo:     idetinfoStr,
4841
+							Insuinfo:     infoStr,
4842
+							UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
4843
+							CardInfo:     "",
4844
+							VerifyNumber: token,
4845
+						}
4846
+						service.CreateHisPsn(psn)
4847
+
4848
+						var insutypes []string
4849
+						var insutype string
4850
+						var is390 int = 0
4851
+						var is310 int = 0
4852
+						for _, item := range res.Output.Iinfo {
4853
+							if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
4854
+								insutypes = append(insutypes, item.Insutype)
4855
+							}
4856
+						}
4857
+						if len(insutypes) == 1 {
4858
+							insutype = insutypes[0]
4859
+						} else {
4860
+							for _, i := range insutypes {
4861
+								if i == "390" {
4862
+									is390 = 1
4863
+								}
4864
+
4865
+								if i == "310" {
4866
+									is310 = 1
4867
+								}
4868
+							}
4869
+						}
4870
+						if is390 == 1 {
4871
+							insutype = "390"
4872
+						}
4873
+						if is310 == 1 {
4874
+							insutype = "310"
4875
+						}
4876
+						if len(insutypes) == 0 {
4877
+							insutype = "390"
4878
+						}
4879
+						c.ServeSuccessJSON(map[string]interface{}{
4880
+							"failed_code": 0,
4881
+							"info":        res,
4882
+							"insutype":    insutype,
4883
+							"patient":     patient,
4884
+						})
4885
+					}
4886
+				} else {
4887
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
4888
+					return
4648 4889
 				}
4649 4890
 			}
4650
-
4651 4891
 		} else {
4652 4892
 			if initFlagTwo == 0 {
4653 4893
 				c.TestGetBasBaseInitTwo()

File diff suppressed because it is too large
+ 3039 - 0
main.go


+ 1 - 0
models/yb_models.go Vedi File

@@ -13,6 +13,7 @@ type Result3260 struct {
13 13
 			MedfeeSumamt    float64 `json:"medfee_sumamt"`
14 14
 			OptinsPaySumamt float64 `json:"optins_pay_sumamt"`
15 15
 		} `json:"data"`
16
+		Totalrow int64 `json:"totalrow"`
16 17
 	} `json:"output"`
17 18
 	RefmsgTime  string      `json:"refmsg_time"`
18 19
 	RespondTime string      `json:"respond_time"`

+ 243 - 40
service/gdyb_service.go Vedi File

@@ -8,6 +8,7 @@ import (
8 8
 	"encoding/json"
9 9
 	"fmt"
10 10
 	"gdyb/models"
11
+	"math"
11 12
 	"strings"
12 13
 
13 14
 	//"gdyb/utils"
@@ -686,7 +687,7 @@ func Gdyb2203A(psnNo string, mdtrtId string, doctor string, department string, o
686 687
 		med_type = "11"
687 688
 	}
688 689
 
689
-	inputMessage["infno"] = "2203A"    // 交易编码
690
+	inputMessage["infno"] = "2203"     // 交易编码
690 691
 	inputData["mdtrt_id"] = mdtrtId    // 就诊 ID(来自2201接口返回)
691 692
 	inputData["psn_no"] = psnNo        // 人员编号 (来自1101接口返回)
692 693
 	inputData["med_type"] = med_type   // 医疗类别 16门诊特殊病
@@ -735,7 +736,7 @@ func Gdyb2203A(psnNo string, mdtrtId string, doctor string, department string, o
735 736
 	if fixmedins_code == "H15049901371" {
736 737
 		url = gdyb_url
737 738
 	} else {
738
-		url = gdyb_url + "2203A"
739
+		url = gdyb_url + "2203"
739 740
 	}
740 741
 
741 742
 	if insuplc_admdvs == "421300" {
@@ -3331,6 +3332,207 @@ func Gdyb4101For10106(struct4101 Struct4101, secret_key string, org_name string,
3331 3332
 	return str, string(bytesData)
3332 3333
 }
3333 3334
 
3335
+func Gdyb4101For10138(struct4101 Struct4101, secret_key string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, org_id int64) (string, string) {
3336
+	// 生成签名
3337
+	nonce := GetRandomString(32)
3338
+	timestamp := time.Now().Unix()
3339
+	signature := setSignature(timestamp, nonce, secret_key)
3340
+
3341
+	// 生成输入报文
3342
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
3343
+	input := make(map[string]interface{})
3344
+	inputData := make(map[string]interface{})
3345
+	inputMessage["infno"] = "4101A" // 交易编码
3346
+
3347
+	year := time.Now().Format("2006")
3348
+	month := time.Now().Format("01")
3349
+	day := time.Now().Format("02")
3350
+	inputData["psn_no"] = struct4101.PsnNo                  // 结算 ID  必填
3351
+	inputData["mdtrt_id"] = struct4101.MdtrtId              // 就诊 ID  必填(来自2201接口返回)
3352
+	inputData["setl_id"] = struct4101.SetlId                // 结算 ID  必填
3353
+	inputData["hi_no"] = struct4101.PsnNo                   // 医保编号
3354
+	inputData["medcasno"] = struct4101.PsnNo                // 病案号  必填
3355
+	inputData["dcla_time"] = year + "-" + month + "-" + day // 申报时间  必填
3356
+	inputData["ntly"] = struct4101.Ntly                     // 国籍  必填
3357
+	inputData["prfs"] = struct4101.Prfs                     // 职业  必填
3358
+	inputData["curr_addr"] = ""                             // 现住址  必填
3359
+	inputData["emp_name"] = ""                              // 单位名称  必填
3360
+	inputData["emp_addr"] = ""                              // 单位地址  必填
3361
+	inputData["emp_tel"] = ""
3362
+	inputData["poscode"] = ""    // 邮编  必填
3363
+	inputData["coner_name"] = "" // 联系人姓名  必填
3364
+	inputData["patn_rlts"] = ""  // 与患者关系  必填
3365
+	inputData["coner_addr"] = "" // 联系人地址  必填
3366
+	inputData["coner_tel"] = ""
3367
+
3368
+	inputData["nwb_adm_type"] = "" // 新生儿入院类型  必填
3369
+	inputData["nwb_bir_wt"] = ""   // 新生儿出生体重  必填
3370
+	inputData["nwb_adm_wt"] = ""   // 新生儿入院体重  必填
3371
+
3372
+	inputData["mul_nwb_bir_wt"] = "" // 新生儿入院体重  必填
3373
+	inputData["mul_nwb_adm_wt"] = "" // 新生儿入院体重  必填
3374
+
3375
+	inputData["opsp_diag_caty"] = ""  // 门诊慢特病诊断  必填
3376
+	inputData["opsp_mdtrt_date"] = "" // 门诊慢特病就诊日期  必填
3377
+
3378
+	inputData["adm_way"] = ""  // 入院途径  必填
3379
+	inputData["trt_type"] = "" // 治疗类别  必填
3380
+	inputData["adm_time"] = "" // 入院时间  必填
3381
+
3382
+	inputData["refldept_dept"] = "" // 转科科别  必填
3383
+	inputData["dscg_time"] = ""     // 出院时间  必填
3384
+	inputData["dscg_caty"] = ""     // 出院科别  必填
3385
+
3386
+	inputData["otp_wm_dise"] = ""   // 门(急) 诊西医诊断  必填
3387
+	inputData["wm_dise_code"] = ""  // 门(急) 诊中医诊断  必填
3388
+	inputData["otp_tcm_dise"] = ""  // 西医诊断疾病代码  必填
3389
+	inputData["tcm_dise_code"] = "" // 中医诊断代码  必填
3390
+
3391
+	inputData["vent_used_dura"] = ""        // 呼吸机使用时长  必填
3392
+	inputData["pwcry_bfadm_coma_dura"] = "" // 颅脑损伤患者入院前昏迷时长  必填
3393
+	inputData["pwcry_afadm_coma_dura"] = "" // 颅脑损伤患者入院后昏迷时长  必填
3394
+
3395
+	inputData["spga_nurscare_days"] = "" // 特级护理天数  必填
3396
+
3397
+	inputData["lv1_nurscare_days"] = ""          // 一级护理天数  必填
3398
+	inputData["scd_nurscare_days"] = ""          // 二级护理天数  必填
3399
+	inputData["lv3_nurscare_days"] = ""          // 三级护理天数  必填
3400
+	inputData["acp_medins_name"] = ""            // 拟接收机构名称  必填
3401
+	inputData["acp_optins_code"] = ""            // 拟接收机构代码  必填
3402
+	inputData["bill_code"] = struct4101.BillCode // 票据代码  必填
3403
+	inputData["bill_no"] = struct4101.BillNo     // 票据号码  必填
3404
+	inputData["biz_sn"] = struct4101.BizSn       // 业务流水号  必填
3405
+	inputData["hi_paymtd"] = "1"                 // 业务流水号  必填
3406
+
3407
+	inputData["days_rinp_flag_31"] = "" // 出院 31 天内再住院计划标志  必填
3408
+	inputData["days_rinp_pup_31"] = ""  // 出院 31 天内再住院目的  必填
3409
+	//inputData["chfpdr_name"] = struct4101.DoctorName          // 主诊医师姓名  必填
3410
+	//inputData["chfpdr_code"] = struct4101.DoctorCode          // 主诊医师代码  必填
3411
+	inputData["setl_begn_date"] = struct4101.SetlBegnDate     // 结算开始日期  必填
3412
+	inputData["setl_end_date"] = struct4101.SetlEndDate       // 结算结束日期  必填
3413
+	inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门  必填
3414
+	inputData["medins_fill_psn"] = struct4101.MedinsFillPsn   // 医疗机构填报人  必填
3415
+
3416
+	//payinfo := make([]map[string]interface{}, 0) // 基金支付信息
3417
+	//for _, item := range struct4101.CustomStruct {
3418
+	//	payinfotemp := make(map[string]interface{})
3419
+	//	if item.FundPayType == "310100" || item.FundPayType == "310200" || item.FundPayType == "320100" || item.FundPayType == "330100" || item.FundPayType == "340100" || item.FundPayType == "350100" || item.FundPayType == "370100" || item.FundPayType == "390100" || item.FundPayType == "610100" || item.FundPayType == "640100" || item.FundPayType == "620100" {
3420
+	//		payinfotemp["fund_pay_type"] = item.FundPayType // 基金支付类型  必填
3421
+	//		payinfotemp["fund_payamt"] = item.FundPayamt    // 基金支付金额
3422
+	//		payinfo = append(payinfo, payinfotemp)
3423
+	//	}
3424
+	//}
3425
+	opspdiseinfo := make([]map[string]interface{}, 0) // 门诊慢特病诊断信息
3426
+
3427
+	opspdiseinfotemp := make(map[string]interface{})
3428
+	opspdiseinfotemp["diag_name"] = struct4101.Diseinfo[len(struct4101.Diseinfo)-1].DiagName // 诊断名称  必填
3429
+	opspdiseinfotemp["diag_code"] = struct4101.Diseinfo[len(struct4101.Diseinfo)-1].DiagCode // 诊断代码 必填
3430
+	opspdiseinfotemp["oprn_oprt_name"] = "血液透析"                                              // 手术操作名称 必填
3431
+	opspdiseinfotemp["oprn_oprt_code"] = "39.9500"                                           // 手术操作代码 必填
3432
+	opspdiseinfo = append(opspdiseinfo, opspdiseinfotemp)
3433
+
3434
+	//diseinfo := make([]map[string]interface{}, 0) // 住院诊断信息
3435
+	//for _, item := range struct4101.Diseinfo {
3436
+	//	diseinfotemp := make(map[string]interface{})
3437
+	//	diseinfotemp["maindiag_flag"] = item.MaindiagFlag // 手术操作代码 必填
3438
+	//	diseinfotemp["diag_type"] = item.DiagType         // 诊断类别  必填
3439
+	//	diseinfotemp["diag_code"] = item.DiagCode         // 诊断代码 必填
3440
+	//	diseinfotemp["diag_name"] = item.DiagName         // 诊断名称 必填
3441
+	//	diseinfotemp["adm_cond_type"] = "3"               // 入院病情类型 必填
3442
+	//	diseinfo = append(diseinfo, diseinfotemp)
3443
+	//}
3444
+
3445
+	//iteminfo := make([]map[string]interface{}, 0)
3446
+	//for _, item := range struct4101.IteminfoStruct {
3447
+	//	iteminfotemp := make(map[string]interface{})
3448
+	//	iteminfotemp["med_chrgitm"] = item.MedChrgitm            // 医疗收费项目  必填
3449
+	//	iteminfotemp["amt"] = item.Amt                           // 金额 必填
3450
+	//	iteminfotemp["claa_sumfee"] = item.ClaaSumfee            // 甲类费用合计 必填
3451
+	//	iteminfotemp["clab_amt"] = item.ClabAmt                  // 乙类金额 必填
3452
+	//	iteminfotemp["fulamt_ownpay_amt"] = item.FulamtOwnpayAmt // 全自费金额 必填
3453
+	//	iteminfotemp["oth_amt"] = item.OthAmt                    // 其他金额 必填
3454
+	//	iteminfo = append(iteminfo, iteminfotemp)
3455
+	//}
3456
+
3457
+	oprninfo := make([]map[string]interface{}, 0) // 手术操作信息
3458
+	oprninfotemp := make(map[string]interface{})
3459
+	oprninfotemp["oprn_oprt_type"] = "" // 手术操作类别  必填
3460
+	oprninfotemp["oprn_oprt_name"] = "" // 手术操作名称 必填
3461
+	oprninfotemp["oprn_oprt_code"] = "" // 手术操作代码 必填
3462
+	oprninfotemp["oprn_oprt_date"] = "" // 手术操作日期 必填
3463
+	oprninfotemp["anst_way"] = ""       // 麻醉方式 必填
3464
+	oprninfotemp["oper_dr_name"] = ""   // 术者医师姓名 必填
3465
+	oprninfotemp["oper_dr_code"] = ""   // 术者医师代码 必填
3466
+	oprninfotemp["anst_dr_name"] = ""   // 麻醉医师姓名 必填
3467
+	oprninfotemp["anst_dr_code"] = ""   // 麻醉医师代码 必填
3468
+	oprninfo = append(oprninfo, oprninfotemp)
3469
+
3470
+	icuinfo := make([]map[string]interface{}, 0) // 重症监护信息
3471
+	icuinfotemp := make(map[string]interface{})
3472
+	icuinfotemp["scs_cutd_ward_type"] = ""   // 重症监护病房类型  必填
3473
+	icuinfotemp["scs_cutd_inpool_time"] = "" // 重症监护进入时间 必填
3474
+	icuinfotemp["scs_cutd_exit_time"] = ""   // 重症监护退出时间 必填
3475
+	icuinfotemp["scs_cutd_sum_dura"] = ""    // 重症监护合计时长 必填
3476
+	icuinfo = append(icuinfo, icuinfotemp)
3477
+
3478
+	input["setlinfo"] = inputData
3479
+	input["opspdiseinfo"] = opspdiseinfo
3480
+	//input["diseinfo"] = payinfo
3481
+	//input["oprninfo"] = payinfo
3482
+	//input["icuinfo"] = payinfo
3483
+	//input["bldinfo"] = payinfo
3484
+	inputMessage["input"] = input //交易输入
3485
+
3486
+	bytesData, err := json.Marshal(inputMessage)
3487
+	fmt.Println(string(bytesData))
3488
+	if err != nil {
3489
+		fmt.Println(err.Error())
3490
+		return err.Error(), ""
3491
+	}
3492
+	reader := bytes.NewReader(bytesData)
3493
+
3494
+	gdyb_url := beego.AppConfig.String("gdyb_url")
3495
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
3496
+	//url := gdyb_url + "4101"
3497
+
3498
+	var url string
3499
+	if fixmedins_code == "H15049901371" {
3500
+		url = gdyb_url
3501
+	} else {
3502
+
3503
+		url = gdyb_url + "4101A"
3504
+
3505
+	}
3506
+
3507
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/4101"
3508
+	request, err := http.NewRequest("POST", url, reader)
3509
+	if err != nil {
3510
+		fmt.Println(err.Error())
3511
+		return err.Error(), ""
3512
+	}
3513
+
3514
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
3515
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
3516
+	request.Header.Set("x-tif-signature", signature)
3517
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
3518
+	request.Header.Set("x-tif-nonce", nonce)
3519
+
3520
+	client := http.Client{}
3521
+	resp, err := client.Do(request)
3522
+	if err != nil {
3523
+		fmt.Println(err.Error())
3524
+		return err.Error(), ""
3525
+	}
3526
+	respBytes, err := ioutil.ReadAll(resp.Body)
3527
+	if err != nil {
3528
+		fmt.Println(err.Error())
3529
+		return err.Error(), ""
3530
+	}
3531
+	str := string(respBytes)
3532
+	fmt.Println(str)
3533
+	return str, string(bytesData)
3534
+}
3535
+
3334 3536
 //func Gdyb7101(psnNo string, insutype string, org_name string, doctor string, fixmedins_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_name string, sick_code string) string {
3335 3537
 //	// 生成签名
3336 3538
 //	nonce := GetRandomString(32)
@@ -4591,7 +4793,7 @@ func Gdyb90100(psn_no string, org_name string, doctor string, fixmedins_code str
4591 4793
 	return str
4592 4794
 }
4593 4795
 
4594
-func Gdyb3260(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, year string, month string, sign string) (string, string) {
4796
+func Gdyb3260(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, year string, month string, sign string, count int) (string, string) {
4595 4797
 	//生成签名
4596 4798
 	nonce := GetRandomString(32)
4597 4799
 	timestamp := time.Now().Unix()
@@ -4604,7 +4806,7 @@ func Gdyb3260(org_name string, doctor string, fixmedins_code string, insuplc_adm
4604 4806
 	inputData["sign"] = sign       // 就诊凭证编号
4605 4807
 	inputData["trt_year"] = year   // 就诊凭证编号
4606 4808
 	inputData["trt_month"] = month // 开始时间
4607
-	inputData["startrow"] = "0"    // 人员姓名
4809
+	inputData["startrow"] = count  // 人员姓名
4608 4810
 	input["data"] = inputData
4609 4811
 	inputMessage["input"] = input //交易输入
4610 4812
 	var inputLog string
@@ -4668,40 +4870,42 @@ func Gdyb3260(org_name string, doctor string, fixmedins_code string, insuplc_adm
4668 4870
 	}
4669 4871
 
4670 4872
 }
4671
-func Gdyb3261(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, year string, month string, result3260 models.Result3260, sign_no string) (string, string, string) {
4672
-	//生成签名
4673
-	nonce := GetRandomString(32)
4674
-	timestamp := time.Now().Unix()
4675
-	signature := setSignature(timestamp, nonce, secret_key)
4676
-
4677
-	msg_month := time.Unix(1557042972, 0).Format("1")
4678
-	msg_year := time.Now().Format("2006")
4679
-	msg_month = time.Now().Format("01")
4680
-	day := time.Now().Format("02")
4873
+func Gdyb3261(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, year string, month string, result3260 models.Result3260, sign_no string) {
4681 4874
 
4682
-	hour := time.Now().Format("15")
4683
-	min := time.Now().Format("04")
4684
-	sec := time.Now().Format("05")
4685
-
4686
-	msec := time.Now().Format("000")
4875
+	//msg_month := time.Unix(1557042972, 0).Format("1")
4876
+	//msg_year := time.Now().Format("2006")
4877
+	//msg_month = time.Now().Format("01")
4878
+	//day := time.Now().Format("02")
4879
+	//
4880
+	//hour := time.Now().Format("15")
4881
+	//min := time.Now().Format("04")
4882
+	//sec := time.Now().Format("05")
4883
+	//
4884
+	//msec := time.Now().Format("000")
4687 4885
 
4688
-	msg_id := fixmedins_code + msg_year + msg_month + day + hour + min + sec + msec + "0"
4886
+	//msg_id := fixmedins_code + msg_year + msg_month + day + hour + min + sec + msec + "0"
4689 4887
 
4690 4888
 	//生成输入报文
4691
-	inputMessage := SetInputMessageTwo(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, sign_no)
4692
-	input := make(map[string]interface{})
4693
-	inputData := make(map[string]interface{})
4694
-	inputMessage["infno"] = "3261" // 交易编码
4695
-	inputData["trt_year"] = year   // 就诊凭证编号
4696
-	inputData["trt_month"] = month // 开始时间
4697
-	feedetail := make([]map[string]interface{}, 0)
4698 4889
 
4699 4890
 	var curpage int
4700 4891
 	var pagesize int = 10
4701 4892
 	var start int = 1
4702 4893
 	var stop int
4703
-	pagecount := 10
4894
+	//pagecount := 10
4895
+	pagecount := int(math.Ceil(float64(len(result3260.Output.Data)) / float64(pagesize)))
4896
+
4704 4897
 	for curpage = 1; curpage <= pagecount; curpage++ {
4898
+		//生成签名
4899
+		nonce := GetRandomString(32)
4900
+		timestamp := time.Now().Unix()
4901
+		signature := setSignature(timestamp, nonce, secret_key)
4902
+		inputMessage := SetInputMessageTwo(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, sign_no)
4903
+		input := make(map[string]interface{})
4904
+		inputData := make(map[string]interface{})
4905
+		inputMessage["infno"] = "3261" // 交易编码
4906
+		inputData["trt_year"] = year   // 就诊凭证编号
4907
+		inputData["trt_month"] = month // 开始时间
4908
+		feedetail := make([]map[string]interface{}, 0)
4705 4909
 		if curpage == 1 {
4706 4910
 			start = 1
4707 4911
 		} else {
@@ -4740,7 +4944,6 @@ func Gdyb3261(org_name string, doctor string, fixmedins_code string, insuplc_adm
4740 4944
 			}
4741 4945
 
4742 4946
 		}
4743
-
4744 4947
 		for _, item := range result3260.Output.Data[start-1 : stop] {
4745 4948
 			if item.MdtrtId == "out20230406681868" {
4746 4949
 				feedetailInfo := make(map[string]interface{})
@@ -4770,18 +4973,18 @@ func Gdyb3261(org_name string, doctor string, fixmedins_code string, insuplc_adm
4770 4973
 
4771 4974
 		}
4772 4975
 
4773
-		inputData["totalrow"] = 119 // 人员姓名
4976
+		inputData["totalrow"] = 314 // 人员姓名
4774 4977
 
4775 4978
 		input["data"] = inputData
4776 4979
 		input["detail"] = feedetail
4777 4980
 		inputMessage["input"] = input //交易输入
4778
-		var inputLog string
4981
+		//var inputLog string
4779 4982
 		bytesData, err := json.Marshal(inputMessage)
4780
-		inputLog = string(bytesData)
4983
+		//inputLog = string(bytesData)
4781 4984
 		fmt.Println(string(bytesData))
4782 4985
 		if err != nil {
4783 4986
 			fmt.Println(err.Error())
4784
-			return err.Error(), "", ""
4987
+			return
4785 4988
 		}
4786 4989
 		reader := bytes.NewReader(bytesData)
4787 4990
 		gdyb_url := beego.AppConfig.String("gdyb_url")
@@ -4798,7 +5001,7 @@ func Gdyb3261(org_name string, doctor string, fixmedins_code string, insuplc_adm
4798 5001
 		request, err := http.NewRequest("POST", url, reader)
4799 5002
 		if err != nil {
4800 5003
 			fmt.Println(err.Error())
4801
-			return err.Error(), "", ""
5004
+			return
4802 5005
 		}
4803 5006
 
4804 5007
 		request.Header.Set("Content-Type", "application/json;charset=UTF-8")
@@ -4811,19 +5014,19 @@ func Gdyb3261(org_name string, doctor string, fixmedins_code string, insuplc_adm
4811 5014
 		resp, err := client.Do(request)
4812 5015
 		if err != nil {
4813 5016
 			fmt.Println(err.Error())
4814
-			return err.Error(), "", ""
5017
+			return
4815 5018
 		}
4816 5019
 		respBytes, err := ioutil.ReadAll(resp.Body)
4817 5020
 		if err != nil {
4818 5021
 			fmt.Println(err.Error())
4819
-			return err.Error(), "", ""
5022
+			return
4820 5023
 		}
4821 5024
 		fmt.Println(string(respBytes))
4822 5025
 		str := string(respBytes)
4823
-		return str, inputLog, msg_id
4824
-
5026
+		fmt.Println(str)
5027
+		//return str, inputLog, msg_id
4825 5028
 	}
4826
-	return "", "", msg_id
5029
+	return
4827 5030
 }
4828 5031
 func Gdyb3262(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, year string, month string, otransid string, sign_no string) (string, string) {
4829 5032
 	//生成签名
@@ -4837,7 +5040,7 @@ func Gdyb3262(org_name string, doctor string, fixmedins_code string, insuplc_adm
4837 5040
 	inputMessage["infno"] = "3262" // 交易编码
4838 5041
 
4839 5042
 	inputData["trt_year"] = year  // 就诊凭证编号
4840
-	inputData["trt_month"] = "04" // 开始时间
5043
+	inputData["trt_month"] = "05" // 开始时间
4841 5044
 	inputData["otransid"] = "0"   // 开始时间
4842 5045
 
4843 5046
 	input["data"] = inputData

+ 17 - 6
service/his_service.go Vedi File

@@ -517,7 +517,7 @@ func FindHisPatientPrescriptionInfo(org_id int64, his_patient_id int64, record_d
517 517
 }
518 518
 
519 519
 func FindLastPatientPrescriptionInfo(org_id int64, patient_id int64, record_date int64) (info models.HisPrescriptionInfo, err error) {
520
-	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date < ? AND patient_id = ?", org_id, record_date, patient_id).Order("record_date desc").First(&info).Error
520
+	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date <= ? AND patient_id = ?", org_id, record_date, patient_id).Order("record_date desc").First(&info).Error
521 521
 	return
522 522
 }
523 523
 
@@ -1485,7 +1485,18 @@ func GetAllHisOrderTwo(org_id int64) (his []*models.HisOrder, err error) {
1485 1485
 }
1486 1486
 
1487 1487
 func GetAllHisOrder10106(org_id int64) (his []*models.HisOrder, err error) {
1488
-	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10106  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND med_type = '14' AND id >= 264212").Order("setl_time asc").Find(&his).Error
1488
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10106  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND med_type = '14' AND setl_time >= '2023-05-01 00:00:00' AND setl_time <= '2023-05-31 00:00:00'").Order("setl_time asc").Find(&his).Error
1489
+	fmt.Println(err)
1490
+	return
1491
+}
1492
+
1493
+func GetAllHisOrder10138() (his []*models.HisOrder, err error) {
1494
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10138  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND med_type = '14' AND setl_time >= '2023-04-01 00:00:00'").Order("setl_time asc").Find(&his).Error
1495
+	fmt.Println(err)
1496
+	return
1497
+}
1498
+func GetAllHisOrder10278() (his []*models.HisOrder, err error) {
1499
+	err = readDb.Model(&models.HisOrder{}).Where("id = 263631 and user_org_id = 10278  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND med_type = '14' AND setl_time >= '2023-04-01 00:00:00'").Order("setl_time asc").Find(&his).Error
1489 1500
 	fmt.Println(err)
1490 1501
 	return
1491 1502
 }
@@ -1494,10 +1505,10 @@ func GetAllHisOrder10106(org_id int64) (his []*models.HisOrder, err error) {
1494 1505
 //	err = readDb.Model(&models.HisOrder{}).Where("id = 180753").Order("setl_time asc").First(&his).Error
1495 1506
 //	return
1496 1507
 //}
1497
-//func GetAllHisOrderErr(org_id int64, stage int64) (his []*models.HisOrderError, err error) {
1498
-//	err = readDb.Model(&models.HisOrderError{}).Where("user_org_id = ? AND status = 1 AND stage = 101060", org_id).Find(&his).Error
1499
-//	return
1500
-//}
1508
+func GetAllHisOrderErr10278() (his []*models.HisOrderError, err error) {
1509
+	err = readDb.Model(&models.HisOrderError{}).Where("user_org_id = 10278 AND status = 1 AND stage = 10276").Find(&his).Error
1510
+	return
1511
+}
1501 1512
 
1502 1513
 func GetHisOrderInfoByNumberFour(order_number string) (order []*models.HisOrderInfo, err error) {
1503 1514
 	db := readDb.Model(&models.HisOrderInfo{})

+ 245 - 0
service/jx_service.go Vedi File

@@ -2510,3 +2510,248 @@ func Jxyb3507(struct3507 models.Struct3507) (string, string) {
2510 2510
 	return JXHttpRequest(struct3507.RequestUrl, struct3507.AccessKey, struct3507.SecretKey, timestamp, string(bytesData), "3507"), string(bytesData)
2511 2511
 
2512 2512
 }
2513
+
2514
+func Jxyb3203(fixmedins_setl_cnt int64, acct_pay float64, fund_pay_sumamt float64, medfee_sumamt float64, stmt_begndate string, stmt_enddate string, setl_optins string, clr_type string, insutype string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, access_key string, secret_key string, cainfo string) (string, string) {
2515
+	// 生成签名
2516
+	timestamp := time.Now().Unix()
2517
+	// 生成输入报文
2518
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
2519
+	input := make(map[string]interface{})
2520
+	inputData := make(map[string]interface{})
2521
+	inputMessage["infno"] = "3203"                       // 交易编码
2522
+	inputData["stmt_begndate"] = stmt_begndate           // 对帐开始时间
2523
+	inputData["stmt_enddate"] = stmt_enddate             //对帐结束时间
2524
+	inputData["medfee_sumamt"] = medfee_sumamt           //医疗费总额
2525
+	inputData["fund_pay_sumamt"] = fund_pay_sumamt       //基金支付总额
2526
+	inputData["acct_pay"] = acct_pay                     //个人账户支付金额
2527
+	inputData["fixmedins_setl_cnt"] = fixmedins_setl_cnt //定点医药机构结算笔数
2528
+	inputData["fixmedins_code"] = fixmedins_code         //个人账户支付金额
2529
+
2530
+	input["data"] = inputData
2531
+	inputMessage["input"] = input //交易输入
2532
+	bytesData, err := json.Marshal(inputMessage)
2533
+	fmt.Println(string(bytesData))
2534
+	if err != nil {
2535
+		fmt.Println(err.Error())
2536
+		return err.Error(), ""
2537
+	}
2538
+	request_url = request_url + "3203"
2539
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "3203"), string(bytesData)
2540
+}
2541
+
2542
+//对账权限查询
2543
+func Jxyb3260(setl_optins string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, access_key string, secret_key string, cainfo string) (string, string) {
2544
+	// 生成签名
2545
+	timestamp := time.Now().Unix()
2546
+	// 生成输入报文
2547
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
2548
+	input := make(map[string]interface{})
2549
+	inputData := make(map[string]interface{})
2550
+	inputMessage["infno"] = "3260"               // 交易编码
2551
+	inputData["fixmedins_code"] = fixmedins_code // 对帐开始时间
2552
+	inputData["fixmedins_name"] = org_name       //对帐结束时间
2553
+	inputData["fix_blng_admdvs"] = setl_optins   //医疗费总额
2554
+
2555
+	input["data"] = inputData
2556
+	inputMessage["input"] = input //交易输入
2557
+	bytesData, err := json.Marshal(inputMessage)
2558
+	fmt.Println(string(bytesData))
2559
+	if err != nil {
2560
+		fmt.Println(err.Error())
2561
+		return err.Error(), ""
2562
+	}
2563
+	request_url = request_url + "3260"
2564
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "3260"), string(bytesData)
2565
+}
2566
+
2567
+//月度对账状态查询
2568
+func Jxyb3261(stmt_mon string, setl_optins string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, access_key string, secret_key string, cainfo string) (string, string) {
2569
+	// 生成签名
2570
+	timestamp := time.Now().Unix()
2571
+	// 生成输入报文
2572
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
2573
+	input := make(map[string]interface{})
2574
+	inputData := make(map[string]interface{})
2575
+	inputMessage["infno"] = "3261"               // 交易编码
2576
+	inputData["fixmedins_code"] = fixmedins_code // 对帐开始时间
2577
+	inputData["fixmedins_name"] = org_name       //对帐结束时间
2578
+	inputData["fix_blng_admdvs"] = setl_optins   //医疗费总额
2579
+	inputData["stmt_mon"] = stmt_mon             //医疗费总额
2580
+
2581
+	input["data"] = inputData
2582
+	inputMessage["input"] = input //交易输入
2583
+	bytesData, err := json.Marshal(inputMessage)
2584
+	fmt.Println(string(bytesData))
2585
+	if err != nil {
2586
+		fmt.Println(err.Error())
2587
+		return err.Error(), ""
2588
+	}
2589
+	request_url = request_url + "3261"
2590
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "3261"), string(bytesData)
2591
+}
2592
+
2593
+func Jxyb3262(stmt_mon string, setl_optins string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, access_key string, secret_key string, cainfo string) (string, string) {
2594
+	// 生成签名
2595
+	timestamp := time.Now().Unix()
2596
+	// 生成输入报文
2597
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
2598
+	input := make(map[string]interface{})
2599
+	inputData := make(map[string]interface{})
2600
+	inputMessage["infno"] = "3262" // 交易编码
2601
+	inputData["fixmedins_code"] = fixmedins_code
2602
+	inputData["fixmedins_name"] = org_name
2603
+	inputData["fix_fill_dept"] = fix_fill_dept
2604
+	inputData["fix_fill_psn_id"] = fix_fill_psn_id
2605
+	inputData["fix_fill_psn"] = fix_fill_psn
2606
+	inputData["fix_fill_date"] = fix_fill_date
2607
+	inputData["stmt_loc"] = stmt_loc
2608
+	inputData["upld_btch"] = upld_btch
2609
+
2610
+	input["data"] = inputData
2611
+	inputMessage["input"] = input //交易输入
2612
+	bytesData, err := json.Marshal(inputMessage)
2613
+	fmt.Println(string(bytesData))
2614
+	if err != nil {
2615
+		fmt.Println(err.Error())
2616
+		return err.Error(), ""
2617
+	}
2618
+	request_url = request_url + "3261"
2619
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "3261"), string(bytesData)
2620
+}
2621
+
2622
+func Jxyb3263(fixmedins_setl_cnt int64, acct_pay float64, fund_pay_sumamt float64, medfee_sumamt float64, stmt_begndate string, stmt_enddate string, setl_optins string, clr_type string, insutype string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, access_key string, secret_key string, cainfo string) (string, string) {
2623
+	// 生成签名
2624
+	timestamp := time.Now().Unix()
2625
+	// 生成输入报文
2626
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
2627
+	input := make(map[string]interface{})
2628
+	inputData := make(map[string]interface{})
2629
+	inputMessage["infno"] = "3263"               // 交易编码
2630
+	inputData["fixmedins_code"] = fixmedins_code // 对帐开始时间
2631
+	inputData["fixmedins_name"] = org_name       //对帐结束时间
2632
+	inputData["stmt_mon"] = ""                   //医疗费总额
2633
+	inputData["stmt_loc"] = ""                   //医疗费总额
2634
+	inputData["upld_btch"] = ""                  //医疗费总额
2635
+
2636
+	input["data"] = inputData
2637
+	inputMessage["input"] = input //交易输入
2638
+	bytesData, err := json.Marshal(inputMessage)
2639
+	fmt.Println(string(bytesData))
2640
+	if err != nil {
2641
+		fmt.Println(err.Error())
2642
+		return err.Error(), ""
2643
+	}
2644
+	request_url = request_url + "3263"
2645
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "3263"), string(bytesData)
2646
+}
2647
+func Jxyb3264(fixmedins_setl_cnt int64, acct_pay float64, fund_pay_sumamt float64, medfee_sumamt float64, stmt_begndate string, stmt_enddate string, setl_optins string, clr_type string, insutype string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, access_key string, secret_key string, cainfo string) (string, string) {
2648
+	// 生成签名
2649
+	timestamp := time.Now().Unix()
2650
+	// 生成输入报文
2651
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
2652
+	input := make(map[string]interface{})
2653
+	inputData := make(map[string]interface{})
2654
+	inputMessage["infno"] = "3264"               // 交易编码
2655
+	inputData["fixmedins_code"] = fixmedins_code // 对帐开始时间
2656
+	inputData["fixmedins_name"] = org_name       //对帐结束时间
2657
+	inputData["stmt_mon"] = ""                   //医疗费总额
2658
+	inputData["stmt_loc"] = ""                   //医疗费总额
2659
+	inputData["upld_btch"] = ""                  //医疗费总额
2660
+
2661
+	input["data"] = inputData
2662
+	inputMessage["input"] = input //交易输入
2663
+	bytesData, err := json.Marshal(inputMessage)
2664
+	fmt.Println(string(bytesData))
2665
+	if err != nil {
2666
+		fmt.Println(err.Error())
2667
+		return err.Error(), ""
2668
+	}
2669
+	request_url = request_url + "3264"
2670
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "3264"), string(bytesData)
2671
+}
2672
+
2673
+func Jxyb3265(fixmedins_setl_cnt int64, acct_pay float64, fund_pay_sumamt float64, medfee_sumamt float64, stmt_begndate string, stmt_enddate string, setl_optins string, clr_type string, insutype string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, access_key string, secret_key string, cainfo string) (string, string) {
2674
+	// 生成签名
2675
+	timestamp := time.Now().Unix()
2676
+	// 生成输入报文
2677
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
2678
+	input := make(map[string]interface{})
2679
+	inputData := make(map[string]interface{})
2680
+	inputMessage["infno"] = "3266"               // 交易编码
2681
+	inputData["fixmedins_code"] = fixmedins_code // 对帐开始时间
2682
+	inputData["fixmedins_name"] = org_name       //对帐结束时间
2683
+	inputData["stmt_mon"] = ""                   //医疗费总额
2684
+	inputData["fix_fill_dept"] = setl_optins     //对帐结束时间
2685
+	inputData["fix_fill_psn_id"] = setl_optins   //对帐结束时间
2686
+	inputData["fix_fill_psn"] = setl_optins      //对帐结束时间
2687
+	inputData["fix_fill_date"] = setl_optins     //对帐结束时间
2688
+	inputData["stmt_loc"] = ""                   //医疗费总额
2689
+	inputData["upld_btch"] = ""                  //医疗费总额
2690
+
2691
+	input["data"] = inputData
2692
+	inputMessage["input"] = input //交易输入
2693
+	bytesData, err := json.Marshal(inputMessage)
2694
+	fmt.Println(string(bytesData))
2695
+	if err != nil {
2696
+		fmt.Println(err.Error())
2697
+		return err.Error(), ""
2698
+	}
2699
+	request_url = request_url + "3266"
2700
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "3266"), string(bytesData)
2701
+}
2702
+func Jxyb3266(fixmedins_setl_cnt int64, acct_pay float64, fund_pay_sumamt float64, medfee_sumamt float64, stmt_begndate string, stmt_enddate string, setl_optins string, clr_type string, insutype string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, access_key string, secret_key string, cainfo string) (string, string) {
2703
+	// 生成签名
2704
+	timestamp := time.Now().Unix()
2705
+	// 生成输入报文
2706
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
2707
+	input := make(map[string]interface{})
2708
+	inputData := make(map[string]interface{})
2709
+	inputMessage["infno"] = "3266"               // 交易编码
2710
+	inputData["fixmedins_code"] = fixmedins_code // 对帐开始时间
2711
+	inputData["fixmedins_name"] = org_name       //对帐结束时间
2712
+
2713
+	inputData["fix_blng_admdvs"] = setl_optins //对帐结束时间
2714
+	inputData["stmt_mon"] = ""                 //医疗费总额
2715
+	inputData["fix_fill_dept"] = setl_optins   //对帐结束时间
2716
+	inputData["fix_fill_psn_id"] = setl_optins //对帐结束时间
2717
+	inputData["fix_fill_psn"] = setl_optins    //对帐结束时间
2718
+	inputData["fix_fill_date"] = setl_optins   //对帐结束时间
2719
+	inputData["stmt_loc"] = ""                 //医疗费总额
2720
+	inputData["upld_btch"] = ""                //医疗费总额
2721
+
2722
+	input["data"] = inputData
2723
+	inputMessage["input"] = input //交易输入
2724
+	bytesData, err := json.Marshal(inputMessage)
2725
+	fmt.Println(string(bytesData))
2726
+	if err != nil {
2727
+		fmt.Println(err.Error())
2728
+		return err.Error(), ""
2729
+	}
2730
+	request_url = request_url + "3266"
2731
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "3266"), string(bytesData)
2732
+}
2733
+func Jxyb3267(fixmedins_setl_cnt int64, acct_pay float64, fund_pay_sumamt float64, medfee_sumamt float64, stmt_begndate string, stmt_enddate string, setl_optins string, clr_type string, insutype string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, access_key string, secret_key string, cainfo string) (string, string) {
2734
+	// 生成签名
2735
+	timestamp := time.Now().Unix()
2736
+	// 生成输入报文
2737
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
2738
+	input := make(map[string]interface{})
2739
+	inputData := make(map[string]interface{})
2740
+	inputMessage["infno"] = "3267"               // 交易编码
2741
+	inputData["fixmedins_code"] = fixmedins_code // 对帐开始时间
2742
+	inputData["fixmedins_name"] = org_name       //对帐结束时间
2743
+	inputData["stmt_mon"] = ""                   //医疗费总额
2744
+	inputData["stmt_loc"] = ""                   //医疗费总额
2745
+	inputData["upld_btch"] = ""                  //医疗费总额
2746
+
2747
+	input["data"] = inputData
2748
+	inputMessage["input"] = input //交易输入
2749
+	bytesData, err := json.Marshal(inputMessage)
2750
+	fmt.Println(string(bytesData))
2751
+	if err != nil {
2752
+		fmt.Println(err.Error())
2753
+		return err.Error(), ""
2754
+	}
2755
+	request_url = request_url + "3267"
2756
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "3267"), string(bytesData)
2757
+}

+ 6 - 0
service/zh_his_service.go Vedi File

@@ -40,6 +40,12 @@ func ZHGdyb1101(certNo string, org_name string, doctor string, fixmedins_code st
40 40
 			inputData["certno"] = certNo        // 证件号码
41 41
 			inputData["psn_cert_type"] = "01"   // 人员证件类型
42 42
 
43
+		} else if id_card_type == 4 {
44
+			inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
45
+			inputData["card_sn"] = ""           // 卡识别码
46
+			inputData["certno"] = certNo        // 证件号码
47
+			inputData["psn_cert_type"] = "01"   // 人员证件类型
48
+
43 49
 		} else {
44 50
 			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
45 51
 			inputData["card_sn"] = ""           // 卡识别码