test_user 3 weeks ago
parent
commit
87da7d450d

+ 9 - 17
controllers/ah/ahyb_controller.go View File

1009
 	//c.TestGetBasBaseInit(fixmedins_code, secret_key, ak)
1009
 	//c.TestGetBasBaseInit(fixmedins_code, secret_key, ak)
1010
 	switch id_card_type {
1010
 	switch id_card_type {
1011
 	case "1":
1011
 	case "1":
1012
-		pCardInfo, pBusiCardInfo := c.GetBasBaseInfo()
1013
-		pBusiCardInfo = Remove0000(pBusiCardInfo)
1012
+		pCardInfo := c.GetBasBaseInfo()
1014
 		pCardInfo = Remove0000(pCardInfo)
1013
 		pCardInfo = Remove0000(pCardInfo)
1015
 		fmt.Println(":", ConvertToString(pCardInfo, "gbk", "utf-8"))
1014
 		fmt.Println(":", ConvertToString(pCardInfo, "gbk", "utf-8"))
1016
-
1017
-		fmt.Println(pBusiCardInfo)
1018
 		fmt.Println(pCardInfo)
1015
 		fmt.Println(pCardInfo)
1019
 		bas := strings.Split(pCardInfo, "|")
1016
 		bas := strings.Split(pCardInfo, "|")
1020
 		basNumber := bas[2]
1017
 		basNumber := bas[2]
1021
 		id_card_no := bas[1]
1018
 		id_card_no := bas[1]
1022
 		card_sn := bas[3]
1019
 		card_sn := bas[3]
1023
-
1024
 		id_card_type_int, _ := strconv.ParseInt(id_card_type, 10, 64)
1020
 		id_card_type_int, _ := strconv.ParseInt(id_card_type, 10, 64)
1025
 
1021
 
1026
-		if len(pCardInfo) > 0 && len(pBusiCardInfo) > 0 {
1027
-			result, _ := service.AHyb1101A(basNumber, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type_int, card_sn, "1", url, ak, pBusiCardInfo, id_card_no, cainfo)
1022
+		if len(pCardInfo) > 0 {
1023
+			result, _ := service.AHyb1101A(basNumber, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type_int, card_sn, "1", url, ak, id_card_no, cainfo)
1028
 			var dat map[string]interface{}
1024
 			var dat map[string]interface{}
1029
 			if err := json.Unmarshal([]byte(result), &dat); err == nil {
1025
 			if err := json.Unmarshal([]byte(result), &dat); err == nil {
1030
 				fmt.Println(dat)
1026
 				fmt.Println(dat)
1034
 			c.ServeSuccessJSON(map[string]interface{}{
1030
 			c.ServeSuccessJSON(map[string]interface{}{
1035
 				"status":         "0",
1031
 				"status":         "0",
1036
 				"card_info":      pCardInfo,
1032
 				"card_info":      pCardInfo,
1037
-				"busi_card_info": pBusiCardInfo,
1038
 				"result":         dat,
1033
 				"result":         dat,
1039
 				"type":           "1",
1034
 				"type":           "1",
1040
 			})
1035
 			})
1184
 	//initFlag = 1
1179
 	//initFlag = 1
1185
 	return
1180
 	return
1186
 }
1181
 }
1187
-func (c *AHybController) GetBasBaseInfo() (string, string) {
1188
-	DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
1189
-	readCard := DllDef.MustFindProc("ReadCardBas")
1182
+func (c *AHybController) GetBasBaseInfo() (string) {
1183
+	DllDef := syscall.MustLoadDLL("SSCardDriver.dll")
1184
+	readCard := DllDef.MustFindProc("iReadCardBas")
1190
 	fmt.Println(readCard)
1185
 	fmt.Println(readCard)
1191
 	fmt.Println("!!!!!")
1186
 	fmt.Println("!!!!!")
1192
 	pCardInfo := make([]byte, 2048)
1187
 	pCardInfo := make([]byte, 2048)
1193
-	pBusiCardInfo := make([]byte, 8192)
1194
-	ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&pCardInfo[0])), (uintptr)(unsafe.Pointer(&pBusiCardInfo[0])))
1188
+	ret2, _, _ := readCard.Call(uintptr(3), (uintptr)(unsafe.Pointer(&pCardInfo[0])))
1195
 	fmt.Println(ret2)
1189
 	fmt.Println(ret2)
1196
 	fmt.Println(DeleteExtraSpace(string(pCardInfo)))
1190
 	fmt.Println(DeleteExtraSpace(string(pCardInfo)))
1197
-	fmt.Println(DeleteExtraSpace(string(pBusiCardInfo)))
1198
 	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pCardInfo)), "gbk", "utf-8"))
1191
 	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pCardInfo)), "gbk", "utf-8"))
1199
-	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pBusiCardInfo)), "gbk", "utf-8"))
1200
 	if ret2 != 0 {
1192
 	if ret2 != 0 {
1201
-		return "", ""
1193
+		return ""
1202
 	}
1194
 	}
1203
-	return DeleteExtraSpace(string(pCardInfo)), DeleteExtraSpace(string(pBusiCardInfo))
1195
+	return DeleteExtraSpace(string(pCardInfo))
1204
 }
1196
 }
1205
 
1197
 
1206
 func (c *AHybController) GetELeInfo(code string, operator_id string, operator_name string) (string, string) {
1198
 func (c *AHybController) GetELeInfo(code string, operator_id string, operator_name string) (string, string) {

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


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

1494
 			result = string(result_byte)
1494
 			result = string(result_byte)
1495
 			saveLog(result_log, request_log, "1101", "人员基本信息获取")
1495
 			saveLog(result_log, request_log, "1101", "人员基本信息获取")
1496
 
1496
 
1497
-		} else if miConfig.MdtrtareaAdmvs == "360399" {
1497
+		} else if miConfig.MdtrtareaAdmvs == "360399" ||  miConfig.MdtrtareaAdmvs == "361025" {
1498
 			result, request_log = service.JxybZY1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, "", miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", 0, miConfig.Url, miConfig.AccessKey, "", patient.IdCardNo, "")
1498
 			result, request_log = service.JxybZY1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, "", miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", 0, miConfig.Url, miConfig.AccessKey, "", patient.IdCardNo, "")
1499
 			saveLog(result_log, request_log, "1101", "人员基本信息获取")
1499
 			saveLog(result_log, request_log, "1101", "人员基本信息获取")
1500
 		}else if miConfig.MdtrtareaAdmvs == "341203"{
1500
 		}else if miConfig.MdtrtareaAdmvs == "341203"{
1527
 				return
1527
 				return
1528
 			}
1528
 			}
1529
 
1529
 
1530
+			status := respJSON["data"].(map[string]interface{})["status"].(string)
1531
+			if  status == "0"{
1532
+				err_msg := respJSON["data"].(map[string]interface{})["msg"].(string)
1533
+				c.ServeSuccessJSON(map[string]interface{}{
1534
+					"failed_code": -10,
1535
+					"msg":        err_msg,
1536
+				})
1537
+				return
1538
+			}
1539
+			respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
1540
+			result_byte, _ := json.Marshal(respJSON)
1541
+			result = string(result_byte)
1542
+			saveLog(result_log, request_log, "1101", "人员基本信息获取")
1543
+		}else if miConfig.MdtrtareaAdmvs == "340699"{
1544
+			var insuplc_admdvs string
1545
+			if len(patient.InsuplcAdmdvs) > 0 {
1546
+				insuplc_admdvs = patient.InsuplcAdmdvs
1547
+			} else {
1548
+				insuplc_admdvs = miConfig.InsuplcAdmdvs
1549
+			}
1550
+			//请求内网数据
1551
+			api := miConfig.SecretKey + "ahyb/1101?url=" + miConfig.Url + "&cert_no=" + patient.IdCardNo +
1552
+				"&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName + "&fixmedins_code=" + miConfig.Code +
1553
+				"&insuplc_admdvs=" + insuplc_admdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(2, 10) + "&card_sn=" + "" + "&certificates=" + strconv.FormatInt(1, 10) + "&name=" + patient.Name+"&token="+""
1554
+
1555
+			resp, requestErr := http.Get(api)
1556
+			if requestErr != nil {
1557
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1558
+				return
1559
+			}
1560
+			body, ioErr := ioutil.ReadAll(resp.Body)
1561
+			if ioErr != nil {
1562
+				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
1563
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1564
+				return
1565
+			}
1566
+			var respJSON map[string]interface{}
1567
+			if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
1568
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1569
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1570
+				return
1571
+			}
1572
+
1530
 			status := respJSON["data"].(map[string]interface{})["status"].(string)
1573
 			status := respJSON["data"].(map[string]interface{})["status"].(string)
1531
 			if  status == "0"{
1574
 			if  status == "0"{
1532
 				err_msg := respJSON["data"].(map[string]interface{})["msg"].(string)
1575
 				err_msg := respJSON["data"].(map[string]interface{})["msg"].(string)

+ 10 - 2
main.go View File

4
 	_ "gdyb/routers"
4
 	_ "gdyb/routers"
5
 	 "gdyb/service"
5
 	 "gdyb/service"
6
 	"gdyb/models"
6
 	"gdyb/models"
7
+	//"gdyb/controllers/sg"
8
+	"time"
7
 	"strings"
9
 	"strings"
8
 	"strconv"
10
 	"strconv"
9
-	"time"
10
 	"encoding/json"
11
 	"encoding/json"
11
 	"gdyb/utils"
12
 	"gdyb/utils"
12
 	"os"
13
 	"os"
81
 	//GetbrBatchSettleList()
82
 	//GetbrBatchSettleList()
82
 
83
 
83
 	//a, _ := service.GetResultRecord("2023-01-01")
84
 	//a, _ := service.GetResultRecord("2023-01-01")
84
-
85
+	//ticker := time.Tick(2 * time.Hour)
86
+	//// 无限循环,等待定时器触发
87
+	//for {
88
+	//	select {
89
+	//	case <-ticker:
90
+	//		sg.ChangeDrugTenone()
91
+	//	}
92
+	//}
85
 
93
 
86
 
94
 
87
 
95
 

+ 182 - 66
service/ahyb_service.go View File

10
 	"io/ioutil"
10
 	"io/ioutil"
11
 	"net/http"
11
 	"net/http"
12
 	"strconv"
12
 	"strconv"
13
+	"strings"
13
 	"time"
14
 	"time"
14
 )
15
 )
15
 
16
 
104
 }
105
 }
105
 
106
 
106
 //人员基本信息版本2
107
 //人员基本信息版本2
107
-func AHyb1101A(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, request_url string, access_key string, pBusiCardInfo string, id_card_no string, cainfo string) (string, string) {
108
+func AHyb1101A(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, request_url string, access_key string, id_card_no string, cainfo string) (string, string) {
108
 	timestamp := time.Now().Unix()
109
 	timestamp := time.Now().Unix()
109
 	//生成输入报文
110
 	//生成输入报文
110
 	inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
111
 	inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
133
 		}
134
 		}
134
 	}
135
 	}
135
 
136
 
136
-	inputData["mdtrt_cert_no"] = certNo + "|" + pBusiCardInfo // 就诊凭证编号
137
-	inputData["begntime"] = ""                                // 开始时间
137
+	inputData["mdtrt_cert_no"] = certNo  // 就诊凭证编号
138
+	month := time.Unix(1557042972, 0).Format("1")
139
+	year := time.Now().Format("2006")
140
+	month = time.Now().Format("01")
141
+	day := time.Now().Format("02")
142
+	inputData["begntime"] = year + "-" +month + "-" + day          // 开始时间                               // 开始时间
138
 	inputData["psn_name"] = ""                                // 人员姓名
143
 	inputData["psn_name"] = ""                                // 人员姓名
139
 	input["data"] = inputData
144
 	input["data"] = inputData
140
 	inputMessage["input"] = input //交易输入
145
 	inputMessage["input"] = input //交易输入
3272
 
3277
 
3273
 }
3278
 }
3274
 
3279
 
3275
-func AHyb3505(struct3505 models.Struct3505) (string, string) {
3276
-	timestamp := time.Now().Unix()
3277
-	// 生成输入报文
3278
-	inputMessage := SetAHInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsCode, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
3279
-	input := make(map[string]interface{})
3280
-	inputData := make(map[string]interface{})
3281
-	inputMessage["infno"] = "3505"                              // 交易编码
3282
-	inputData["med_list_codg"] = struct3505.MedListCodg         // 定点医药机构目录编号
3283
-	inputData["fixmedins_hilist_id"] = struct3505.FixmedinsCode // 定点医药机构目录编号
3284
-	inputData["fixmedins_hilist_name"] = struct3505.OrgName     // 定点医药机构目录名称
3285
-	inputData["fixmedins_bchno"] = struct3505.FixmedinsCode     // 人员编号 (来自1101接口返回)
3286
-
3287
-	inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
3288
-	inputData["prsc_dr_certno"] = struct3505.PrscDrCertno      // 人员编号 (来自1101接口返回)
3289
-	inputData["prsc_dr_name"] = struct3505.PrscDrName          // 人员编号 (来自1101接口返回)
3290
-	inputData["phar_cert_type"] = struct3505.PharCertType      // 人员编号 (来自1101接口返回)
3291
-	inputData["phar_certno"] = struct3505.PharCertno           // 人员编号 (来自1101接口返回)
3292
-
3293
-	inputData["phar_name"] = struct3505.PharName               // 人员编号 (来自1101接口返回)
3294
-	inputData["phar_prac_cert_no"] = struct3505.PharPracCertNo // 人员编号 (来自1101接口返回)
3295
-	inputData["hi_feesetl_type"] = struct3505.HiFeesetlType    // 人员编号 (来自1101接口返回)
3296
-	inputData["setl_id"] = struct3505.SetlId                   // 人员编号 (来自1101接口返回)
3297
-	inputData["mdtrt_sn"] = struct3505.MdtrtSn                 // 人员编号 (来自1101接口返回)
3298
-	inputData["psn_no"] = struct3505.PsnNo                     // 人员编号 (来自1101接口返回)
3299
-	inputData["psn_cert_type"] = struct3505.PsnCertType        // 人员编号 (来自1101接口返回)
3300
-	inputData["certno"] = struct3505.CertNo                    // 人员编号 (来自1101接口返回)
3301
-	inputData["psn_name"] = struct3505.PsnName                 // 人员编号 (来自1101接口返回)
3302
-	inputData["manu_lotnum"] = struct3505.ManuLotnum           // 人员编号 (来自1101接口返回)
3303
-	inputData["manu_date"] = struct3505.ManuDate               // 人员编号 (来自1101接口返回)
3304
-	inputData["expy_end"] = struct3505.ExpyEnd                 // 人员编号 (来自1101接口返回)
3305
-
3306
-	inputData["rx_flag"] = struct3505.RxFlag     // 人员编号 (来自1101接口返回)
3307
-	inputData["trdn_flag"] = struct3505.TrdnFlag // 人员编号 (来自1101接口返回)
3308
-
3309
-	inputData["finl_trns_pric"] = struct3505.FinlTrnsPric // 人员编号 (来自1101接口返回)
3310
-	inputData["rxno"] = struct3505.Rxno                   // 人员编号 (来自1101接口返回)
3311
-	inputData["rx_circ_flag"] = struct3505.RxCircFlag     // 人员编号 (来自1101接口返回)
3312
-
3313
-	inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
3314
-	inputData["stoout_no"] = struct3505.StooutNo   // 人员编号 (来自1101接口返回)
3315
-
3316
-	inputData["bchno"] = struct3505.Bchno                          // 人员编号 (来自1101接口返回)
3317
-	inputData["drug_trac_codg"] = struct3505.DrugTracCodg          // 人员编号 (来自1101接口返回)
3318
-	inputData["drug_prod_barc"] = struct3505.DrugProdBarc          // 人员编号 (来自1101接口返回)
3319
-	inputData["shelf_posi"] = struct3505.ShelfPosi                 // 人员编号 (来自1101接口返回)
3320
-	inputData["sel_retn_cnt"] = struct3505.SelRetnCnt              // 人员编号 (来自1101接口返回)
3321
-	inputData["sel_retn_time"] = struct3505.SelRetnTime            // 人员编号 (来自1101接口返回)
3322
-	inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
3323
-	inputData["memo"] = struct3505.Memo                            // 人员编号 (来自1101接口返回)
3324
-	input["selinfo"] = inputData
3325
-	inputMessage["input"] = input //交易输入
3326
-	argInputMessage  := make(map[string]interface{})
3327
-	argInputMessage["arg0"] = inputMessage
3328
-	bytesData, err := json.Marshal(argInputMessage)
3329
-	fmt.Println(string(bytesData))
3330
-	if err != nil {
3331
-		fmt.Println(err.Error())
3332
-		return err.Error(), ""
3333
-	}
3334
-	struct3505.RequestUrl = struct3505.RequestUrl + "3505"
3335
-	return AHHttpRequest(struct3505.RequestUrl, struct3505.AccessKey, struct3505.SecretKey, timestamp, string(bytesData), "3505"), string(bytesData)
3336
-
3337
-}
3280
+//func AHyb3505(struct3505 models.Struct3505) (string, string) {
3281
+//	timestamp := time.Now().Unix()
3282
+//	// 生成输入报文
3283
+//	inputMessage := SetAHInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsCode, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
3284
+//	input := make(map[string]interface{})
3285
+//	inputData := make(map[string]interface{})
3286
+//	inputMessage["infno"] = "3505"                              // 交易编码
3287
+//	inputData["med_list_codg"] = struct3505.MedListCodg         // 定点医药机构目录编号
3288
+//	inputData["fixmedins_hilist_id"] = struct3505.FixmedinsCode // 定点医药机构目录编号
3289
+//	inputData["fixmedins_hilist_name"] = struct3505.OrgName     // 定点医药机构目录名称
3290
+//	inputData["fixmedins_bchno"] = struct3505.FixmedinsCode     // 人员编号 (来自1101接口返回)
3291
+//
3292
+//	inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
3293
+//	inputData["prsc_dr_certno"] = struct3505.PrscDrCertno      // 人员编号 (来自1101接口返回)
3294
+//	inputData["prsc_dr_name"] = struct3505.PrscDrName          // 人员编号 (来自1101接口返回)
3295
+//	inputData["phar_cert_type"] = struct3505.PharCertType      // 人员编号 (来自1101接口返回)
3296
+//	inputData["phar_certno"] = struct3505.PharCertno           // 人员编号 (来自1101接口返回)
3297
+//
3298
+//	inputData["phar_name"] = struct3505.PharName               // 人员编号 (来自1101接口返回)
3299
+//	inputData["phar_prac_cert_no"] = struct3505.PharPracCertNo // 人员编号 (来自1101接口返回)
3300
+//	inputData["hi_feesetl_type"] = struct3505.HiFeesetlType    // 人员编号 (来自1101接口返回)
3301
+//	inputData["setl_id"] = struct3505.SetlId                   // 人员编号 (来自1101接口返回)
3302
+//	inputData["mdtrt_sn"] = struct3505.MdtrtSn                 // 人员编号 (来自1101接口返回)
3303
+//	inputData["psn_no"] = struct3505.PsnNo                     // 人员编号 (来自1101接口返回)
3304
+//	inputData["psn_cert_type"] = struct3505.PsnCertType        // 人员编号 (来自1101接口返回)
3305
+//	inputData["certno"] = struct3505.CertNo                    // 人员编号 (来自1101接口返回)
3306
+//	inputData["psn_name"] = struct3505.PsnName                 // 人员编号 (来自1101接口返回)
3307
+//	inputData["manu_lotnum"] = struct3505.ManuLotnum           // 人员编号 (来自1101接口返回)
3308
+//	inputData["manu_date"] = struct3505.ManuDate               // 人员编号 (来自1101接口返回)
3309
+//	inputData["expy_end"] = struct3505.ExpyEnd                 // 人员编号 (来自1101接口返回)
3310
+//
3311
+//	inputData["rx_flag"] = struct3505.RxFlag     // 人员编号 (来自1101接口返回)
3312
+//	inputData["trdn_flag"] = struct3505.TrdnFlag // 人员编号 (来自1101接口返回)
3313
+//
3314
+//	inputData["finl_trns_pric"] = struct3505.FinlTrnsPric // 人员编号 (来自1101接口返回)
3315
+//	inputData["rxno"] = struct3505.Rxno                   // 人员编号 (来自1101接口返回)
3316
+//	inputData["rx_circ_flag"] = struct3505.RxCircFlag     // 人员编号 (来自1101接口返回)
3317
+//
3318
+//	inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
3319
+//	inputData["stoout_no"] = struct3505.StooutNo   // 人员编号 (来自1101接口返回)
3320
+//
3321
+//	inputData["bchno"] = struct3505.Bchno                          // 人员编号 (来自1101接口返回)
3322
+//	inputData["drug_trac_codg"] = struct3505.DrugTracCodg          // 人员编号 (来自1101接口返回)
3323
+//	inputData["drug_prod_barc"] = struct3505.DrugProdBarc          // 人员编号 (来自1101接口返回)
3324
+//	inputData["shelf_posi"] = struct3505.ShelfPosi                 // 人员编号 (来自1101接口返回)
3325
+//	inputData["sel_retn_cnt"] = struct3505.SelRetnCnt              // 人员编号 (来自1101接口返回)
3326
+//	inputData["sel_retn_time"] = struct3505.SelRetnTime            // 人员编号 (来自1101接口返回)
3327
+//	inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
3328
+//	inputData["memo"] = struct3505.Memo                            // 人员编号 (来自1101接口返回)
3329
+//	input["selinfo"] = inputData
3330
+//	inputMessage["input"] = input //交易输入
3331
+//	argInputMessage  := make(map[string]interface{})
3332
+//	argInputMessage["arg0"] = inputMessage
3333
+//	bytesData, err := json.Marshal(argInputMessage)
3334
+//	fmt.Println(string(bytesData))
3335
+//	if err != nil {
3336
+//		fmt.Println(err.Error())
3337
+//		return err.Error(), ""
3338
+//	}
3339
+//	struct3505.RequestUrl = struct3505.RequestUrl + "3505"
3340
+//	return AHHttpRequest(struct3505.RequestUrl, struct3505.AccessKey, struct3505.SecretKey, timestamp, string(bytesData), "3505"), string(bytesData)
3341
+//
3342
+//}
3338
 func AHyb3506(struct3506 models.Struct3506) (string, string) {
3343
 func AHyb3506(struct3506 models.Struct3506) (string, string) {
3339
 	timestamp := time.Now().Unix()
3344
 	timestamp := time.Now().Unix()
3340
 	// 生成输入报文
3345
 	// 生成输入报文
3437
 
3442
 
3438
 
3443
 
3439
 
3444
 
3445
+
3446
+
3447
+func AHyb3505(struct3505 models.Struct3505, secret_key string,request_url string) (string, string) {
3448
+	// 生成签名
3449
+	//nonce := GetRandomString(32)
3450
+	timestamp := time.Now().Unix()
3451
+	//signature := setSignature(timestamp, nonce, secret_key)
3452
+
3453
+	// 生成输入报文
3454
+	inputMessage := SetAHInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.Code, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
3455
+	input := make(map[string]interface{})
3456
+	inputData := make(map[string]interface{})
3457
+	inputMessage["infno"] = "3505"                                      // 交易编码
3458
+	inputData["med_list_codg"] = struct3505.MedListCodg                 // 定点医药机构目录编号
3459
+	inputData["fixmedins_hilist_id"] = struct3505.FixmedinsHilistId     // 定点医药机构目录编号
3460
+	inputData["fixmedins_hilist_name"] = struct3505.FixmedinsHilistName // 定点医药机构目录名称
3461
+	inputData["fixmedins_bchno"] = struct3505.FixmedinsBchno            // 人员编号 (来自1101接口返回)
3462
+
3463
+	inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
3464
+	inputData["prsc_dr_certno"] = struct3505.PrscDrCertno      // 人员编号 (来自1101接口返回)
3465
+	inputData["prsc_dr_name"] = struct3505.PrscDrName          // 人员编号 (来自1101接口返回)
3466
+	inputData["phar_cert_type"] = struct3505.PharCertType      // 人员编号 (来自1101接口返回)
3467
+	inputData["phar_certno"] = struct3505.PharCertno           // 人员编号 (来自1101接口返回)
3468
+
3469
+	inputData["phar_name"] = struct3505.PharName               // 人员编号 (来自1101接口返回)
3470
+	inputData["phar_prac_cert_no"] = struct3505.PharPracCertNo // 人员编号 (来自1101接口返回)
3471
+	inputData["hi_feesetl_type"] = struct3505.HiFeesetlType    // 人员编号 (来自1101接口返回)
3472
+	inputData["setl_id"] = struct3505.SetlId                   // 人员编号 (来自1101接口返回)
3473
+	inputData["mdtrt_sn"] = struct3505.MdtrtSn                 // 人员编号 (来自1101接口返回)
3474
+	inputData["psn_no"] = struct3505.PsnNo                     // 人员编号 (来自1101接口返回)
3475
+	inputData["psn_cert_type"] = struct3505.PsnCertType        // 人员编号 (来自1101接口返回)
3476
+	inputData["certno"] = struct3505.CertNo                    // 人员编号 (来自1101接口返回)
3477
+	inputData["psn_name"] = struct3505.PsnName                 // 人员编号 (来自1101接口返回)
3478
+	inputData["manu_lotnum"] = struct3505.ManuLotnum           // 人员编号 (来自1101接口返回)
3479
+	inputData["manu_date"] = struct3505.ManuDate               // 人员编号 (来自1101接口返回)
3480
+	inputData["expy_end"] = struct3505.ExpyEnd                 // 人员编号 (来自1101接口返回)
3481
+
3482
+	inputData["rx_flag"] = struct3505.RxFlag     // 人员编号 (来自1101接口返回)
3483
+	inputData["trdn_flag"] = struct3505.TrdnFlag // 人员编号 (来自1101接口返回)
3484
+
3485
+	inputData["finl_trns_pric"] = struct3505.FinlTrnsPric // 人员编号 (来自1101接口返回)
3486
+	inputData["rxno"] = struct3505.Rxno                   // 人员编号 (来自1101接口返回)
3487
+	inputData["rx_circ_flag"] = struct3505.RxCircFlag     // 人员编号 (来自1101接口返回)
3488
+
3489
+	inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
3490
+	inputData["stoout_no"] = struct3505.StooutNo   // 人员编号 (来自1101接口返回)
3491
+
3492
+	inputData["bchno"] = struct3505.Bchno                          // 人员编号 (来自1101接口返回)
3493
+	inputData["drug_trac_codg"] = struct3505.DrugTracCodg          // 人员编号 (来自1101接口返回)
3494
+	inputData["drug_prod_barc"] = struct3505.DrugProdBarc          // 人员编号 (来自1101接口返回)
3495
+	inputData["shelf_posi"] = struct3505.ShelfPosi                 // 人员编号 (来自1101接口返回)
3496
+	inputData["sel_retn_cnt"] = struct3505.SelRetnCnt              // 人员编号 (来自1101接口返回)
3497
+	inputData["sel_retn_time"] = struct3505.SelRetnTime            // 人员编号 (来自1101接口返回)
3498
+	inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
3499
+	inputData["mdtrt_setl_type"] = struct3505.MdtrtSetlType // 人员编号 (来自1101接口返回)
3500
+
3501
+
3502
+	inputData["memo"] = struct3505.Memo                            // 人员编号 (来自1101接口返回)
3503
+	//input["selinfo"] = inputData
3504
+	feedetail := make([]map[string]interface{}, 0)
3505
+
3506
+	codes := strings.Split(struct3505.DrugTracCodg, ",")
3507
+	for _, item := range codes {
3508
+		druginputData := make(map[string]interface{})
3509
+		druginputData["drug_trac_codg"] = item
3510
+		feedetail = append(feedetail, druginputData)
3511
+	}
3512
+	inputData["drugtracinfo"] = feedetail
3513
+	input["selinfo"] = inputData
3514
+	inputMessage["input"] = input //交易输入
3515
+	argInputMessage  := make(map[string]interface{})
3516
+	argInputMessage["arg0"] = inputMessage
3517
+
3518
+	bytesData, err := json.Marshal(argInputMessage)
3519
+	fmt.Println(string(bytesData))
3520
+	if err != nil {
3521
+		fmt.Println(err.Error())
3522
+		return err.Error(), ""
3523
+	}
3524
+	reader := bytes.NewReader(bytesData)
3525
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
3526
+	//gdyb_url := beego.AppConfig.String("gdyb_url")
3527
+	//gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
3528
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
3529
+	//url := gdyb_url + "3505"
3530
+	request_url = request_url + "1101"
3531
+
3532
+	request, err := http.NewRequest("POST", request_url, reader)
3533
+	if err != nil {
3534
+		fmt.Println(err.Error())
3535
+		return err.Error(), ""
3536
+	}
3537
+
3538
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
3539
+
3540
+
3541
+	client := http.Client{}
3542
+	resp, err := client.Do(request)
3543
+	if err != nil {
3544
+		fmt.Println(err.Error())
3545
+		return err.Error(), ""
3546
+	}
3547
+	respBytes, err := ioutil.ReadAll(resp.Body)
3548
+	if err != nil {
3549
+		fmt.Println(err.Error())
3550
+		return err.Error(), ""
3551
+	}
3552
+	str := string(respBytes)
3553
+	fmt.Println(str)
3554
+	return str , string(bytesData)
3555
+}

+ 23 - 11
service/gdyb_service.go View File

6939
 	nonce := GetRandomString(32)
6939
 	nonce := GetRandomString(32)
6940
 	timestamp := time.Now().Unix()
6940
 	timestamp := time.Now().Unix()
6941
 	signature := setSignature(timestamp, nonce, secret_key)
6941
 	signature := setSignature(timestamp, nonce, secret_key)
6942
-
6943
 	// 生成输入报文
6942
 	// 生成输入报文
6944
-	inputMessage := SetGdInputMessage(timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsHilistId, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Cainfo)
6943
+	inputMessage := SetGdInputMessage(timestamp, struct3501.OrgName, struct3501.Opter, struct3501.Code, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Cainfo)
6945
 	input := make(map[string]interface{})
6944
 	input := make(map[string]interface{})
6946
 	inputData := make(map[string]interface{})
6945
 	inputData := make(map[string]interface{})
6947
 	inputMessage["infno"] = "3501"                                      // 交易编码
6946
 	inputMessage["infno"] = "3501"                                      // 交易编码
6956
 	inputData["manu_date"] = struct3501.ManuDate                        // 人员编号 (来自1101接口返回)
6955
 	inputData["manu_date"] = struct3501.ManuDate                        // 人员编号 (来自1101接口返回)
6957
 	inputData["expy_end"] = struct3501.ExpyEnd                          // 人员编号 (来自1101接口返回)
6956
 	inputData["expy_end"] = struct3501.ExpyEnd                          // 人员编号 (来自1101接口返回)
6958
 	inputData["memo"] = ""                                              // 人员编号 (来自1101接口返回)
6957
 	inputData["memo"] = ""                                              // 人员编号 (来自1101接口返回)
6958
+
6959
 	feedetail := make([]map[string]interface{}, 0)
6959
 	feedetail := make([]map[string]interface{}, 0)
6960
-	druginputData := make(map[string]interface{})
6961
-	druginputData["drug_trac_codg"] = struct3501.DrugTracCodg
6962
-	feedetail = append(feedetail, druginputData)
6960
+
6961
+	codes := strings.Split(struct3501.DrugTracCodg, ",")
6962
+	for _, item := range codes {
6963
+		if len(item) > 0 {
6964
+			druginputData := make(map[string]interface{})
6965
+			druginputData["drug_trac_codg"] = item
6966
+			feedetail = append(feedetail, druginputData)
6967
+		}
6968
+	}
6963
 	inputData["drugtracinfo"] = feedetail
6969
 	inputData["drugtracinfo"] = feedetail
6964
 	input["invinfo"] = inputData
6970
 	input["invinfo"] = inputData
6965
 	inputMessage["input"] = input //交易输入
6971
 	inputMessage["input"] = input //交易输入
6966
 
6972
 
6973
+
6967
 	bytesData, err := json.Marshal(inputMessage)
6974
 	bytesData, err := json.Marshal(inputMessage)
6968
 	fmt.Println(string(bytesData))
6975
 	fmt.Println(string(bytesData))
6969
 	if err != nil {
6976
 	if err != nil {
7242
 	signature := setSignature(timestamp, nonce, secret_key)
7249
 	signature := setSignature(timestamp, nonce, secret_key)
7243
 
7250
 
7244
 	// 生成输入报文
7251
 	// 生成输入报文
7245
-	inputMessage := SetGdInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
7252
+	inputMessage := SetGdInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.Code, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
7246
 	input := make(map[string]interface{})
7253
 	input := make(map[string]interface{})
7247
 	inputData := make(map[string]interface{})
7254
 	inputData := make(map[string]interface{})
7248
 	inputMessage["infno"] = "3505"                                      // 交易编码
7255
 	inputMessage["infno"] = "3505"                                      // 交易编码
7279
 
7286
 
7280
 	inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
7287
 	inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
7281
 	inputData["stoout_no"] = struct3505.StooutNo   // 人员编号 (来自1101接口返回)
7288
 	inputData["stoout_no"] = struct3505.StooutNo   // 人员编号 (来自1101接口返回)
7289
+	inputData["MDTRT_SETL_TYPE"] = struct3505.MdtrtSetlType // 人员编号 (来自1101接口返回)
7282
 
7290
 
7283
 	inputData["bchno"] = struct3505.Bchno                          // 人员编号 (来自1101接口返回)
7291
 	inputData["bchno"] = struct3505.Bchno                          // 人员编号 (来自1101接口返回)
7284
 	inputData["drug_trac_codg"] = struct3505.DrugTracCodg          // 人员编号 (来自1101接口返回)
7292
 	inputData["drug_trac_codg"] = struct3505.DrugTracCodg          // 人员编号 (来自1101接口返回)
7293
 
7301
 
7294
 	codes := strings.Split(struct3505.DrugTracCodg, ",")
7302
 	codes := strings.Split(struct3505.DrugTracCodg, ",")
7295
 	for _, item := range codes {
7303
 	for _, item := range codes {
7296
-		druginputData := make(map[string]interface{})
7297
-		druginputData["drug_trac_codg"] = item
7298
-		feedetail = append(feedetail, druginputData)
7304
+		if len(item) > 0 {
7305
+			druginputData := make(map[string]interface{})
7306
+			druginputData["drug_trac_codg"] = item
7307
+			feedetail = append(feedetail, druginputData)
7308
+		}
7299
 	}
7309
 	}
7300
 	inputData["drugtracinfo"] = feedetail
7310
 	inputData["drugtracinfo"] = feedetail
7301
 	input["selinfo"] = inputData
7311
 	input["selinfo"] = inputData
8747
 	inputData["MDTRT_SETL_TYPE"] = struct3505.MdtrtSetlType // 人员编号 (来自1101接口返回)
8757
 	inputData["MDTRT_SETL_TYPE"] = struct3505.MdtrtSetlType // 人员编号 (来自1101接口返回)
8748
 
8758
 
8749
 	inputData["bchno"] = struct3505.Bchno // 人员编号 (来自1101接口返回)
8759
 	inputData["bchno"] = struct3505.Bchno // 人员编号 (来自1101接口返回)
8750
-	inputData["drug_trac_codg"] = struct3505.DrugTracCodg          // 人员编号 (来自1101接口返回)
8760
+	codes := strings.Split(struct3505.DrugTracCodg, ",")
8761
+
8762
+	inputData["drug_trac_codg"] = codes[0]          // 人员编号 (来自1101接口返回)
8751
 	inputData["drug_prod_barc"] = struct3505.DrugProdBarc          // 人员编号 (来自1101接口返回)
8763
 	inputData["drug_prod_barc"] = struct3505.DrugProdBarc          // 人员编号 (来自1101接口返回)
8752
 	inputData["shelf_posi"] = struct3505.ShelfPosi                 // 人员编号 (来自1101接口返回)
8764
 	inputData["shelf_posi"] = struct3505.ShelfPosi                 // 人员编号 (来自1101接口返回)
8753
 	inputData["sel_retn_cnt"] = struct3505.SelRetnCnt              // 人员编号 (来自1101接口返回)
8765
 	inputData["sel_retn_cnt"] = struct3505.SelRetnCnt              // 人员编号 (来自1101接口返回)
8757
 	//drug_trac_cod .g
8769
 	//drug_trac_cod .g
8758
 	feedetail := make([]map[string]interface{}, 0)
8770
 	feedetail := make([]map[string]interface{}, 0)
8759
 
8771
 
8760
-	codes := strings.Split(struct3505.DrugTracCodg, ",")
8772
+	//codes = strings.Split(struct3505.DrugTracCodg, ",")
8761
 	for _, item := range codes {
8773
 	for _, item := range codes {
8762
 		if len(item) > 0{
8774
 		if len(item) > 0{
8763
 			druginputData := make(map[string]interface{})
8775
 			druginputData := make(map[string]interface{})

+ 9 - 2
service/his_service.go View File

1770
 	return
1770
 	return
1771
 }
1771
 }
1772
 
1772
 
1773
-func GetNewDrugFlowInforTen(system_time int,org_id int64) (flows []*models.DrugFlow, err error) {
1773
+func GetNewDrugFlowInforTen(system_time int64,org_id int64) (flows []*models.DrugFlow, err error) {
1774
 	err = readDb.Model(&models.DrugFlow{}).Joins("join his_doctor_advice_info info on info.patient_id = xt_drug_flow.patient_id and info.drug_id = xt_drug_flow.drug_id and info.record_date = xt_drug_flow.system_time").Where("xt_drug_flow.user_org_id = ? and xt_drug_flow.status = 1 and xt_drug_flow.consumable_type = 3 and xt_drug_flow.is_sale = 0 and xt_drug_flow.system_time = ?", org_id,system_time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1774
 	err = readDb.Model(&models.DrugFlow{}).Joins("join his_doctor_advice_info info on info.patient_id = xt_drug_flow.patient_id and info.drug_id = xt_drug_flow.drug_id and info.record_date = xt_drug_flow.system_time").Where("xt_drug_flow.user_org_id = ? and xt_drug_flow.status = 1 and xt_drug_flow.consumable_type = 3 and xt_drug_flow.is_sale = 0 and xt_drug_flow.system_time = ?", org_id,system_time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1775
 		return db.Where("status = 1 and drug_code <> ''").Preload("BaseDrugLib", "status=1")
1775
 		return db.Where("status = 1 and drug_code <> ''").Preload("BaseDrugLib", "status=1")
1776
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1776
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1777
 	return
1777
 	return
1778
 }
1778
 }
1779
 
1779
 
1780
+func GetNewDrugFlowInforTenone(start_system_time int64,end_system_time int64,org_id int64) (flows []*models.DrugFlow, err error) {
1781
+	err = readDb.Model(&models.DrugFlow{}).Joins("join his_doctor_advice_info info on info.patient_id = xt_drug_flow.patient_id and info.drug_id = xt_drug_flow.drug_id and info.record_date = xt_drug_flow.system_time").Where("xt_drug_flow.user_org_id = ? and xt_drug_flow.status = 1 and xt_drug_flow.consumable_type = 3 and xt_drug_flow.is_sale = 0 and xt_drug_flow.system_time >= ? and xt_drug_flow.system_time <= ?", org_id,start_system_time,end_system_time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1782
+		return db.Where("status = 1 and drug_code <> ''").Preload("BaseDrugLib", "status=1")
1783
+	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1784
+	return
1785
+}
1786
+
1780
 func GetHisPrescriptionByID(id int64) (pre models.HisPrescription) {
1787
 func GetHisPrescriptionByID(id int64) (pre models.HisPrescription) {
1781
 	err = readDb.Model(&models.HisPrescription{}).Where("id = ? and status = 1", id).Find(&pre).Error
1788
 	err = readDb.Model(&models.HisPrescription{}).Where("id = ? and status = 1", id).Find(&pre).Error
1782
 	return
1789
 	return
2101
 
2108
 
2102
 func FindeHisAdviceDocAdvice(orgid int64, patient_id int64, stime int64, etime int64) (advice []*models.HisDoctorAdviceInfo, err error) {
2109
 func FindeHisAdviceDocAdvice(orgid int64, patient_id int64, stime int64, etime int64) (advice []*models.HisDoctorAdviceInfo, err error) {
2103
 
2110
 
2104
-	db := XTReadDB().Model(&advice).Where("status= 1 and is_medicine = 0")
2111
+	db := XTReadDB().Model(&advice).Where("status= 1 and is_medicine = 0 and drug_code <> ''")
2105
 
2112
 
2106
 	if orgid > 0 {
2113
 	if orgid > 0 {
2107
 		db = db.Where("user_org_id = ?", orgid)
2114
 		db = db.Where("user_org_id = ?", orgid)

+ 7 - 4
service/jsyb_service.go View File

1917
 
1917
 
1918
 	inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
1918
 	inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
1919
 	inputData["stoout_no"] = struct3505.StooutNo   // 人员编号 (来自1101接口返回)
1919
 	inputData["stoout_no"] = struct3505.StooutNo   // 人员编号 (来自1101接口返回)
1920
-
1920
+	inputData["stoout_no"] = struct3505.StooutNo   // 人员编号 (来自1101接口返回)
1921
+	inputData["MDTRT_SETL_TYPE"] = struct3505.MdtrtSetlType // 人员编号 (来自1101接口返回)
1921
 	inputData["bchno"] = struct3505.Bchno                          // 人员编号 (来自1101接口返回)
1922
 	inputData["bchno"] = struct3505.Bchno                          // 人员编号 (来自1101接口返回)
1922
 	inputData["drug_trac_codg"] = struct3505.DrugTracCodg          // 人员编号 (来自1101接口返回)
1923
 	inputData["drug_trac_codg"] = struct3505.DrugTracCodg          // 人员编号 (来自1101接口返回)
1923
 	inputData["drug_prod_barc"] = struct3505.DrugProdBarc          // 人员编号 (来自1101接口返回)
1924
 	inputData["drug_prod_barc"] = struct3505.DrugProdBarc          // 人员编号 (来自1101接口返回)
1931
 
1932
 
1932
 	codes := strings.Split(struct3505.DrugTracCodg, ",")
1933
 	codes := strings.Split(struct3505.DrugTracCodg, ",")
1933
 	for _, item := range codes {
1934
 	for _, item := range codes {
1934
-		druginputData := make(map[string]interface{})
1935
-		druginputData["drug_trac_codg"] = item
1936
-		feedetail = append(feedetail, druginputData)
1935
+		if len(item) > 0 {
1936
+			druginputData := make(map[string]interface{})
1937
+			druginputData["drug_trac_codg"] = item
1938
+			feedetail = append(feedetail, druginputData)
1939
+		}
1937
 	}
1940
 	}
1938
 	inputData["drugtracinfo"] = feedetail
1941
 	inputData["drugtracinfo"] = feedetail
1939
 	input["selinfo"] = inputData
1942
 	input["selinfo"] = inputData

+ 90 - 3
service/jx_service.go View File

7
 	"gdyb/models"
7
 	"gdyb/models"
8
 	"gdyb/utils/csbhttp"
8
 	"gdyb/utils/csbhttp"
9
 	"github.com/astaxie/beego"
9
 	"github.com/astaxie/beego"
10
-
10
+	"strings"
11
 	//"net/http"
11
 	//"net/http"
12
 	"strconv"
12
 	"strconv"
13
 	"time"
13
 	"time"
1763
 
1763
 
1764
 }
1764
 }
1765
 
1765
 
1766
+
1767
+func JXyb3505(struct3505 models.Struct3505, secret_key string, ak string,request_url string) (string, string) {
1768
+	// 生成签名
1769
+	// 生成签名
1770
+	timestamp := time.Now().Unix()
1771
+	inputMessage := SetJXInputMessage(timestamp, struct3505.OrgName, struct3505.Opter,  struct3505.Code, struct3505.InsuplcAdmdvs,  struct3505.MdtrtareaAdmvs, "")
1772
+	//inputMessage := SetGZInputMessage(nonce, timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsCode, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, sign)
1773
+
1774
+	input := make(map[string]interface{})
1775
+	inputData := make(map[string]interface{})
1776
+	inputMessage["infno"] = "3505"                                      // 交易编码
1777
+	inputData["med_list_codg"] = struct3505.MedListCodg                 // 定点医药机构目录编号
1778
+	inputData["fixmedins_hilist_id"] = struct3505.FixmedinsHilistId     // 定点医药机构目录编号
1779
+	inputData["fixmedins_hilist_name"] = struct3505.FixmedinsHilistName // 定点医药机构目录名称
1780
+	inputData["fixmedins_bchno"] = struct3505.FixmedinsBchno            // 人员编号 (来自1101接口返回)
1781
+
1782
+	inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
1783
+	inputData["prsc_dr_certno"] = struct3505.PrscDrCertno      // 人员编号 (来自1101接口返回)
1784
+	inputData["prsc_dr_name"] = struct3505.PrscDrName          // 人员编号 (来自1101接口返回)
1785
+	inputData["phar_cert_type"] = struct3505.PharCertType      // 人员编号 (来自1101接口返回)
1786
+	inputData["phar_certno"] = struct3505.PharCertno           // 人员编号 (来自1101接口返回)
1787
+
1788
+	inputData["phar_name"] = struct3505.PharName               // 人员编号 (来自1101接口返回)
1789
+	inputData["phar_prac_cert_no"] = struct3505.PharPracCertNo // 人员编号 (来自1101接口返回)
1790
+	inputData["hi_feesetl_type"] = struct3505.HiFeesetlType    // 人员编号 (来自1101接口返回)
1791
+	inputData["setl_id"] = struct3505.SetlId                   // 人员编号 (来自1101接口返回)
1792
+	inputData["mdtrt_sn"] = struct3505.MdtrtSn                 // 人员编号 (来自1101接口返回)
1793
+	inputData["psn_no"] = struct3505.PsnNo                     // 人员编号 (来自1101接口返回)
1794
+	inputData["psn_cert_type"] = struct3505.PsnCertType        // 人员编号 (来自1101接口返回)
1795
+	inputData["certno"] = struct3505.CertNo                    // 人员编号 (来自1101接口返回)
1796
+	inputData["psn_name"] = struct3505.PsnName                 // 人员编号 (来自1101接口返回)
1797
+	inputData["manu_lotnum"] = struct3505.ManuLotnum           // 人员编号 (来自1101接口返回)
1798
+	inputData["manu_date"] = struct3505.ManuDate               // 人员编号 (来自1101接口返回)
1799
+	inputData["expy_end"] = struct3505.ExpyEnd                 // 人员编号 (来自1101接口返回)
1800
+
1801
+	inputData["rx_flag"] = struct3505.RxFlag     // 人员编号 (来自1101接口返回)
1802
+	inputData["trdn_flag"] = struct3505.TrdnFlag // 人员编号 (来自1101接口返回)
1803
+
1804
+	inputData["finl_trns_pric"] = struct3505.FinlTrnsPric // 人员编号 (来自1101接口返回)
1805
+	inputData["rxno"] = struct3505.Rxno                   // 人员编号 (来自1101接口返回)
1806
+	inputData["rx_circ_flag"] = struct3505.RxCircFlag     // 人员编号 (来自1101接口返回)
1807
+
1808
+	inputData["rtal_docno"] = struct3505.RtalDocno          // 人员编号 (来自1101接口返回)
1809
+	inputData["stoout_no"] = struct3505.StooutNo            // 人员编号 (来自1101接口返回)
1810
+	inputData["MDTRT_SETL_TYPE"] = struct3505.MdtrtSetlType // 人员编号 (来自1101接口返回)
1811
+
1812
+	inputData["bchno"] = struct3505.Bchno // 人员编号 (来自1101接口返回)
1813
+	codes := strings.Split(struct3505.DrugTracCodg, ",")
1814
+
1815
+	inputData["drug_trac_codg"] = codes[0]          // 人员编号 (来自1101接口返回)
1816
+	inputData["drug_prod_barc"] = struct3505.DrugProdBarc          // 人员编号 (来自1101接口返回)
1817
+	inputData["shelf_posi"] = struct3505.ShelfPosi                 // 人员编号 (来自1101接口返回)
1818
+	inputData["sel_retn_cnt"] = struct3505.SelRetnCnt              // 人员编号 (来自1101接口返回)
1819
+	inputData["sel_retn_time"] = struct3505.SelRetnTime            // 人员编号 (来自1101接口返回)
1820
+	inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
1821
+	inputData["memo"] = struct3505.Memo                            // 人员编号 (来自1101接口返回)
1822
+	//drug_trac_cod .g
1823
+	feedetail := make([]map[string]interface{}, 0)
1824
+
1825
+	//codes = strings.Split(struct3505.DrugTracCodg, ",")
1826
+	for _, item := range codes {
1827
+		if len(item) > 0{
1828
+			druginputData := make(map[string]interface{})
1829
+			druginputData["drug_trac_codg"] = item
1830
+			feedetail = append(feedetail, druginputData)
1831
+		}
1832
+	}
1833
+	inputData["drugtracinfo"] = feedetail
1834
+	input["selinfo"] = inputData
1835
+	inputMessage["input"] = input //交易输入
1836
+
1837
+	input["selinfo"] = inputData
1838
+	inputMessage["input"] = input //交易输入
1839
+
1840
+	bytesData, err := json.Marshal(inputMessage)
1841
+	requestLog := string(bytesData)
1842
+	if err != nil {
1843
+		fmt.Println(err.Error())
1844
+		return err.Error(), ""
1845
+	}
1846
+
1847
+	request_url = request_url + "3505"
1848
+	return JXHttpRequest(request_url, ak, secret_key, timestamp, string(bytesData), "3505"), requestLog
1849
+
1850
+}
1851
+
1852
+
1766
 //CBS总线
1853
 //CBS总线
1767
 func JXHttpRequest(url string, ak string, sk string, timestamp int64, json string, infno string) string {
1854
 func JXHttpRequest(url string, ak string, sk string, timestamp int64, json string, infno string) string {
1768
 	fmt.Println(url)
1855
 	fmt.Println(url)
1931
 	inputData["medfee_sumamt"] = medfee_sumamt           //医疗费总额
2018
 	inputData["medfee_sumamt"] = medfee_sumamt           //医疗费总额
1932
 	inputData["fund_pay_sumamt"] = fund_pay_sumamt       //基金支付总额
2019
 	inputData["fund_pay_sumamt"] = fund_pay_sumamt       //基金支付总额
1933
 	inputData["acct_pay"] = acct_pay                     //个人账户支付金额
2020
 	inputData["acct_pay"] = acct_pay                     //个人账户支付金额
1934
-	inputData["fixmedins_setl_cnt"] = 20 //定点医药机构结算笔数
1935
-	inputData["refd_setl_flag"] = 1                  //
2021
+	inputData["fixmedins_setl_cnt"] = fixmedins_setl_cnt //定点医药机构结算笔数
2022
+	inputData["refd_setl_flag"] = 0                  //
1936
 
2023
 
1937
 	input["data"] = inputData
2024
 	input["data"] = inputData
1938
 	inputMessage["input"] = input //交易输入
2025
 	inputMessage["input"] = input //交易输入