Browse Source

Merge branch 'master' of http://git.shengws.com/csx/gdyb

陈少旭 1 month ago
parent
commit
02aa58a19b

+ 222 - 60
controllers/js/jsyb_controller.go View File

1478
 	}
1478
 	}
1479
 	fmt.Println(respJSON["psn_no"].(string))
1479
 	fmt.Println(respJSON["psn_no"].(string))
1480
 	fmt.Println(respJSON["mdtrt_id"].(string))
1480
 	fmt.Println(respJSON["mdtrt_id"].(string))
1481
+	fmt.Println(respJSON["new_doctor_name"].(string))
1481
 
1482
 
1482
 	psnNo := respJSON["psn_no"].(string)
1483
 	psnNo := respJSON["psn_no"].(string)
1483
 	mdtrtId := respJSON["mdtrt_id"].(string)
1484
 	mdtrtId := respJSON["mdtrt_id"].(string)
1492
 	sick_name := respJSON["sick_name"].(string)
1493
 	sick_name := respJSON["sick_name"].(string)
1493
 	dept := respJSON["dept"].(string)
1494
 	dept := respJSON["dept"].(string)
1494
 
1495
 
1496
+	new_doctor_name := respJSON["new_doctor_name"].(string)
1497
+
1495
 	insuplc_admdvs := respJSON["insuplc_admdvs"].(string)
1498
 	insuplc_admdvs := respJSON["insuplc_admdvs"].(string)
1496
 	mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
1499
 	mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
1497
 	secret_key := respJSON["secret_key"].(string)
1500
 	secret_key := respJSON["secret_key"].(string)
1503
 
1506
 
1504
 	//cainfo := c.GetString("cainfo")
1507
 	//cainfo := c.GetString("cainfo")
1505
 
1508
 
1506
-	result, request_log, timeStamp := service.Jsyb2203(psnNo, mdtrtId, doctor, department, org_name, med_type, doctor_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_code, sick_name, dept, config, url, ak, begin_time, cainfo)
1509
+	result, request_log, timeStamp := service.Jsyb2203(psnNo, mdtrtId, doctor, department, org_name, med_type, doctor_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_code, sick_name, dept, config, url, ak, begin_time, cainfo,new_doctor_name)
1507
 	saveJsLog(result, request_log, "2203", "上传就诊信息", org_name)
1510
 	saveJsLog(result, request_log, "2203", "上传就诊信息", org_name)
1508
 	var dat2 map[string]interface{}
1511
 	var dat2 map[string]interface{}
1509
 	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
1512
 	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
2176
 	c.TestGetBasBaseInit(fixmedins_code, secret_key, ak)
2179
 	c.TestGetBasBaseInit(fixmedins_code, secret_key, ak)
2177
 	switch id_card_type {
2180
 	switch id_card_type {
2178
 	case "1":
2181
 	case "1":
2179
-		pCardInfo, pBusiCardInfo := c.GetBasBaseInfo()
2180
-		pBusiCardInfo = Remove0000(pBusiCardInfo)
2181
-		pCardInfo = Remove0000(pCardInfo)
2182
-		fmt.Println(":", ConvertToString(pCardInfo, "gbk", "utf-8"))
2183
-
2184
-		fmt.Println(pBusiCardInfo)
2185
-		fmt.Println(pCardInfo)
2186
-		bas := strings.Split(pCardInfo, "|")
2187
-		basNumber := bas[2]
2188
-		id_card_no := bas[1]
2189
-		card_sn := bas[3]
2182
+		if mdtrtarea_admvs == "320830"{
2183
+			pCardInfo, pBusiCardInfo := c.GetBasBaseInfo()
2184
+			pBusiCardInfo = Remove0000(pBusiCardInfo)
2185
+
2186
+			pCardInfo = Remove0000(pCardInfo)
2187
+			fmt.Println(":", ConvertToString(pCardInfo, "gbk", "utf-8"))
2188
+
2189
+			fmt.Println(pCardInfo)
2190
+			bas := strings.Split(pCardInfo, "|")
2191
+			basNumber := bas[2]
2192
+			id_card_no := bas[1]
2193
+			card_sn := bas[3]
2194
+
2195
+			id_card_type_int, _ := strconv.ParseInt(id_card_type, 10, 64)
2196
+
2197
+			if len(pCardInfo) > 0 && len(pBusiCardInfo) > 0 {
2198
+				result, _ := service.Jsyb1101A(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)
2199
+				var dat map[string]interface{}
2200
+				if err := json.Unmarshal([]byte(result), &dat); err == nil {
2201
+					fmt.Println(dat)
2202
+				} else {
2203
+					fmt.Println(err)
2204
+				}
2205
+				c.ServeSuccessJSON(map[string]interface{}{
2206
+					"status":         "0",
2207
+					"card_info":      pCardInfo,
2208
+					"busi_card_info": pBusiCardInfo,
2209
+					"result":         dat,
2210
+					"type":           "1",
2211
+				})
2212
+			} else {
2213
+				c.ServeSuccessJSON(map[string]interface{}{
2214
+					"status": "-1",
2215
+				})
2190
 
2216
 
2191
-		id_card_type_int, _ := strconv.ParseInt(id_card_type, 10, 64)
2217
+			}
2192
 
2218
 
2193
-		if len(pCardInfo) > 0 && len(pBusiCardInfo) > 0 {
2194
-			result, _ := service.Jsyb1101A(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)
2195
-			var dat map[string]interface{}
2196
-			if err := json.Unmarshal([]byte(result), &dat); err == nil {
2197
-				fmt.Println(dat)
2219
+		}else{
2220
+			pCardInfo, pBusiCardInfo := c.GetBasBaseInfo()
2221
+			pBusiCardInfo = Remove0000(pBusiCardInfo)
2222
+			pCardInfo = Remove0000(pCardInfo)
2223
+			fmt.Println(":", ConvertToString(pCardInfo, "gbk", "utf-8"))
2224
+
2225
+			fmt.Println(pBusiCardInfo)
2226
+			fmt.Println(pCardInfo)
2227
+			bas := strings.Split(pCardInfo, "|")
2228
+			basNumber := bas[2]
2229
+			id_card_no := bas[1]
2230
+			card_sn := bas[3]
2231
+
2232
+			id_card_type_int, _ := strconv.ParseInt(id_card_type, 10, 64)
2233
+
2234
+			if len(pCardInfo) > 0 && len(pBusiCardInfo) > 0 {
2235
+				result, _ := service.Jsyb1101A(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)
2236
+				var dat map[string]interface{}
2237
+				if err := json.Unmarshal([]byte(result), &dat); err == nil {
2238
+					fmt.Println(dat)
2239
+				} else {
2240
+					fmt.Println(err)
2241
+				}
2242
+				c.ServeSuccessJSON(map[string]interface{}{
2243
+					"status":         "0",
2244
+					"card_info":      pCardInfo,
2245
+					"busi_card_info": pBusiCardInfo,
2246
+					"result":         dat,
2247
+					"type":           "1",
2248
+				})
2198
 			} else {
2249
 			} else {
2199
-				fmt.Println(err)
2250
+				c.ServeSuccessJSON(map[string]interface{}{
2251
+					"status": "-1",
2252
+				})
2253
+
2200
 			}
2254
 			}
2201
-			c.ServeSuccessJSON(map[string]interface{}{
2202
-				"status":         "0",
2203
-				"card_info":      pCardInfo,
2204
-				"busi_card_info": pBusiCardInfo,
2205
-				"result":         dat,
2206
-				"type":           "1",
2207
-			})
2208
-		} else {
2209
-			c.ServeSuccessJSON(map[string]interface{}{
2210
-				"status": "-1",
2211
-			})
2255
+
2212
 
2256
 
2213
 		}
2257
 		}
2258
+
2214
 		break
2259
 		break
2215
 	case "3": //电子社保卡
2260
 	case "3": //电子社保卡
2216
 		_, pBusiCardInfo := c.GetELeInfo(fixmedins_code, operator_id, operator)
2261
 		_, pBusiCardInfo := c.GetELeInfo(fixmedins_code, operator_id, operator)
2314
 	c.TestGetBasBaseInit(fixmedins_code, secret_key, ak)
2359
 	c.TestGetBasBaseInit(fixmedins_code, secret_key, ak)
2315
 	switch id_card_type {
2360
 	switch id_card_type {
2316
 	case "1":
2361
 	case "1":
2317
-		pCardInfo, pBusiCardInfo := c.GetBasBaseInfo()
2318
-		pBusiCardInfo = Remove0000(pBusiCardInfo)
2319
-		pCardInfo = Remove0000(pCardInfo)
2320
-		fmt.Println(":", ConvertToString(pCardInfo, "gbk", "utf-8"))
2362
+		if mdtrtarea_admvs == "320830"{
2363
+			pCardInfo, pBusiCardInfo := c.GetBasBaseInfo()
2364
+			pBusiCardInfo = Remove0000(pBusiCardInfo)
2365
+
2366
+			pCardInfo = Remove0000(pCardInfo)
2367
+			fmt.Println(":", ConvertToString(pCardInfo, "gbk", "utf-8"))
2368
+			fmt.Println(pBusiCardInfo)
2369
+			fmt.Println(pCardInfo)
2370
+
2371
+			bas := strings.Split(pCardInfo, "|")
2372
+			basNumber := bas[2]
2373
+			id_card_no := bas[1]
2374
+			card_sn := bas[3]
2375
+
2376
+			id_card_type_int, _ := strconv.ParseInt(id_card_type, 10, 64)
2377
+			if len(pCardInfo) > 0 && len(pBusiCardInfo) > 0 {
2378
+				result, _ := service.Jsyb1101A(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)
2379
+				var dat map[string]interface{}
2380
+				if err := json.Unmarshal([]byte(result), &dat); err == nil {
2381
+					fmt.Println(dat)
2382
+				} else {
2383
+					fmt.Println(err)
2384
+				}
2385
+				c.ServeSuccessJSON(map[string]interface{}{
2386
+					"status":         "0",
2387
+					"card_info":      pCardInfo,
2388
+					"busi_card_info": pBusiCardInfo,
2389
+					"result":         dat,
2390
+					"type":           "1",
2391
+				})
2392
+			} else {
2393
+				c.ServeSuccessJSON(map[string]interface{}{
2394
+					"status": "-1",
2395
+				})
2321
 
2396
 
2322
-		fmt.Println(pBusiCardInfo)
2323
-		fmt.Println(pCardInfo)
2324
-		bas := strings.Split(pCardInfo, "|")
2325
-		basNumber := bas[2]
2326
-		id_card_no := bas[1]
2327
-		card_sn := bas[3]
2397
+			}
2328
 
2398
 
2329
-		id_card_type_int, _ := strconv.ParseInt(id_card_type, 10, 64)
2330
 
2399
 
2331
-		if len(pCardInfo) > 0 && len(pBusiCardInfo) > 0 {
2332
-			result, _ := service.Jsyb1101A(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)
2333
-			var dat map[string]interface{}
2334
-			if err := json.Unmarshal([]byte(result), &dat); err == nil {
2335
-				fmt.Println(dat)
2400
+		}else{
2401
+			pCardInfo, pBusiCardInfo := c.GetBasBaseInfo()
2402
+			pBusiCardInfo = Remove0000(pBusiCardInfo)
2403
+			pCardInfo = Remove0000(pCardInfo)
2404
+			fmt.Println(":", ConvertToString(pCardInfo, "gbk", "utf-8"))
2405
+
2406
+			fmt.Println(pBusiCardInfo)
2407
+			fmt.Println(pCardInfo)
2408
+			bas := strings.Split(pCardInfo, "|")
2409
+			basNumber := bas[2]
2410
+			id_card_no := bas[1]
2411
+			card_sn := bas[3]
2412
+
2413
+			id_card_type_int, _ := strconv.ParseInt(id_card_type, 10, 64)
2414
+
2415
+			if len(pCardInfo) > 0 && len(pBusiCardInfo) > 0 {
2416
+				result, _ := service.Jsyb1101A(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)
2417
+				var dat map[string]interface{}
2418
+				if err := json.Unmarshal([]byte(result), &dat); err == nil {
2419
+					fmt.Println(dat)
2420
+				} else {
2421
+					fmt.Println(err)
2422
+				}
2423
+				c.ServeSuccessJSON(map[string]interface{}{
2424
+					"status":         "0",
2425
+					"card_info":      pCardInfo,
2426
+					"busi_card_info": pBusiCardInfo,
2427
+					"result":         dat,
2428
+					"type":           "1",
2429
+				})
2336
 			} else {
2430
 			} else {
2337
-				fmt.Println(err)
2431
+				c.ServeSuccessJSON(map[string]interface{}{
2432
+					"status": "-1",
2433
+				})
2434
+
2338
 			}
2435
 			}
2339
-			c.ServeSuccessJSON(map[string]interface{}{
2340
-				"status":         "0",
2341
-				"card_info":      pCardInfo,
2342
-				"busi_card_info": pBusiCardInfo,
2343
-				"result":         dat,
2344
-				"type":           "1",
2345
-			})
2346
-		} else {
2347
-			c.ServeSuccessJSON(map[string]interface{}{
2348
-				"status": "-1",
2349
-			})
2436
+
2350
 
2437
 
2351
 		}
2438
 		}
2439
+
2352
 		break
2440
 		break
2353
 	case "3": //电子社保卡
2441
 	case "3": //电子社保卡
2354
 		_, pBusiCardInfo := c.GetELeInfo(fixmedins_code, operator_id, operator)
2442
 		_, pBusiCardInfo := c.GetELeInfo(fixmedins_code, operator_id, operator)
2486
 	//miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
2574
 	//miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
2487
 	str := make([]byte, 2048)
2575
 	str := make([]byte, 2048)
2488
 	inputData := make(map[string]interface{})
2576
 	inputData := make(map[string]interface{})
2489
-	inputData["IP"] = "10.58.65.240"
2577
+
2578
+	if code == "H32083002114"{
2579
+		inputData["IP"] = "10.58.73.212"
2580
+		inputData["EC_URL"] = "http://10.58.33.207:10086/localcfc/api/hsecfc/localQrCodeQuery"
2581
+
2582
+	}else{
2583
+		inputData["IP"] = "10.58.65.240"
2584
+		inputData["EC_URL"] = "http://10.58.33.207:10086/localcfc/api/hsecfc/localQrCodeQuery"
2585
+	}
2490
 	inputData["PORT"] = "8086"
2586
 	inputData["PORT"] = "8086"
2491
 	inputData["TIMEOUT"] = "180"
2587
 	inputData["TIMEOUT"] = "180"
2492
 	inputData["LOG_PATH"] = "C:\\log\\"
2588
 	inputData["LOG_PATH"] = "C:\\log\\"
2493
 
2589
 
2494
 	//inputData["EC_URL"] = "http://10.58.33.207:10086/localcfc/api/hsecfc/localQrCodeQuery"
2590
 	//inputData["EC_URL"] = "http://10.58.33.207:10086/localcfc/api/hsecfc/localQrCodeQuery"
2495
 
2591
 
2496
-	inputData["EC_URL"] = "http://10.58.33.207:10086/localcfc/api/hsecfc/localQrCodeQuery"
2497
 	inputData["CARD_PASSTYPE"] = "1"
2592
 	inputData["CARD_PASSTYPE"] = "1"
2498
 	inputData["API_NAME"] = "hssServives"
2593
 	inputData["API_NAME"] = "hssServives"
2499
 	inputData["API_VERSION"] = "1.0.0"
2594
 	inputData["API_VERSION"] = "1.0.0"
2521
 	//initFlag = 1
2616
 	//initFlag = 1
2522
 	return
2617
 	return
2523
 }
2618
 }
2619
+func (c *JSybController) GetjsBasBaseInfo() string {
2620
+	DllDef := syscall.MustLoadDLL("SSCardDriver.dll")
2621
+	readCard := DllDef.MustFindProc("iReadCardBas")
2622
+	if readCard == nil {
2623
+		fmt.Println("readcard is nil")
2624
+		readCard = DllDef.MustFindProc("iReadCardBas")
2625
+	}
2626
+
2627
+	//str := make([]byte, 1024)
2628
+	str1 := make([]byte, 1024)
2629
+	ret2, _, _ := readCard.Call(uintptr(3), (uintptr)(unsafe.Pointer(&str1[0])))
2630
+
2631
+	//file, err := os.Open("C:\\Users\\Administrator\\Desktop\\11\\Power-Card\\SSCardDriver\\api.log")
2632
+	//if err != nil {
2633
+	//	fmt.Println("Error opening file:", err)
2634
+	//}
2635
+	//defer file.Close()
2636
+	//
2637
+	//var lastProgram Program
2638
+	//scanner := bufio.NewScanner(file)
2639
+	//inProgram := false
2640
+	//
2641
+	//for scanner.Scan() {
2642
+	//	line := scanner.Text()
2643
+	//	if strings.Contains(line, "<program>") {
2644
+	//		inProgram = true
2645
+	//		programXML := "<program>"
2646
+	//		for scanner.Scan() {
2647
+	//			line = scanner.Text()
2648
+	//			programXML += line
2649
+	//			if strings.Contains(line, "</program>") {
2650
+	//				programXML += "</program>"
2651
+	//				break
2652
+	//			}
2653
+	//		}
2654
+	//		if err := xml.Unmarshal([]byte(programXML), &lastProgram); err == nil {
2655
+	//			// 解析成功,更新最后的 Program
2656
+	//		}
2657
+	//		inProgram = false
2658
+	//	}
2659
+	//}
2660
+	//
2661
+	//	fmt.Println("Error reading file:", inProgram)
2662
+	//
2663
+	//if err := scanner.Err(); err != nil {
2664
+	//	fmt.Println("Error reading file:", err)
2665
+
2666
+	//}
2667
+
2668
+	// 输出最后一次的 Program
2669
+	//fmt.Printf("最后一次的 <program>:\n")
2670
+	//fmt.Printf("<program>\n")
2671
+	//fmt.Printf("  <function_id>%s</function_id>\n", lastProgram.FunctionID)
2672
+	//fmt.Printf("  <cardinfo>%s</cardinfo>\n", lastProgram.CardInfo)
2673
+	//fmt.Printf("  <user>%s</user>\n", lastProgram.User)
2674
+	//fmt.Printf("</program>\n")
2675
+
2676
+	fmt.Println(string(str1))
2677
+	fmt.Println(":", ConvertToString(string(str1), "gbk", "utf-8"))
2678
+
2679
+	if ret2 != 0 {
2680
+		return ""
2681
+	}
2682
+
2683
+	return string(str1)
2684
+}
2685
+
2524
 func (c *JSybController) GetBasBaseInfo() (string, string) {
2686
 func (c *JSybController) GetBasBaseInfo() (string, string) {
2525
 	DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
2687
 	DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
2526
 	readCard := DllDef.MustFindProc("ReadCardBas")
2688
 	readCard := DllDef.MustFindProc("ReadCardBas")

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


+ 10 - 10
main.go View File

58
 func init() {
58
 func init() {
59
 	//service.ConnectNMMSDB()
59
 	//service.ConnectNMMSDB()
60
 	service.ConnectDB()
60
 	service.ConnectDB()
61
-	//org_id, _ := beego.AppConfig.Int64("org_id")
62
-	//miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
63
-	//////CreateLog(miConfig)
64
-	//////UploadLog(miConfig)31
65
-	//if org_id == 10191 {
66
-	//	service.GetFjAuthorizationInfo(miConfig.Code)
67
-	//}
61
+	org_id, _ := beego.AppConfig.Int64("org_id")
62
+	miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
63
+	//CreateLog(miConfig)
64
+	//UploadLog(miConfig)31
65
+	if org_id == 10191 {
66
+		service.GetFjAuthorizationInfo(miConfig.Code)
67
+	}
68
 }
68
 }
69
 func main() {
69
 func main() {
70
 	//service.AutoCreateStock()
70
 	//service.AutoCreateStock()
707
 //
707
 //
708
 func GetblBatchSettleList() {
708
 func GetblBatchSettleList() {
709
 	org_id, _ := beego.AppConfig.Int64("org_id")
709
 	org_id, _ := beego.AppConfig.Int64("org_id")
710
-	org_id = 10028
710
+	org_id = 10610
711
 	var orders []*models.HisOrder
711
 	var orders []*models.HisOrder
712
 	//var orders []*models.HisOrderError
712
 	//var orders []*models.HisOrderError
713
 	orders, _ = service.GetAllHisOrder10138()
713
 	orders, _ = service.GetAllHisOrder10138()
723
 			miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
723
 			miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
724
 			var configTwo []*models.HisXtDiagnoseConfig
724
 			var configTwo []*models.HisXtDiagnoseConfig
725
 			diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
725
 			diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
726
-			curRoles, _ := service.GetAdminUserInfoByID(org_id, 5320)
726
+			curRoles, _ := service.GetAdminUserInfoByID(org_id, 2185)
727
 			for _, item := range diagnosis_idstwo {
727
 			for _, item := range diagnosis_idstwo {
728
 				id, _ := strconv.ParseInt(item, 10, 64)
728
 				id, _ := strconv.ParseInt(item, 10, 64)
729
 				diagnosisConfig, _ := service.FindDiagnoseById(id)
729
 				diagnosisConfig, _ := service.FindDiagnoseById(id)
730
 				configTwo = append(configTwo, &diagnosisConfig)
730
 				configTwo = append(configTwo, &diagnosisConfig)
731
 			}
731
 			}
732
-			patient, _ := service.GetPatientByIDTwo(10028, order.PatientId)
732
+			patient, _ := service.GetPatientByIDTwo(10610, order.PatientId)
733
 
733
 
734
 			sickConfig, _ := service.FindSickById(his.SickType)
734
 			sickConfig, _ := service.FindSickById(his.SickType)
735
 			//if order.MedType == "1111" || order.MedType == "1112" {
735
 			//if order.MedType == "1111" || order.MedType == "1112" {

+ 14 - 14
models/models_3501.go View File

751
 	Enddate        string `json:"enddate" validate:"required"`        // 结束日期
751
 	Enddate        string `json:"enddate" validate:"required"`        // 结束日期
752
 	MedListCodg    string `json:"med_list_codg,omitempty"`            // 医疗目录编码
752
 	MedListCodg    string `json:"med_list_codg,omitempty"`            // 医疗目录编码
753
 	DrugTracCodg   string `json:"drug_trac_codg,omitempty"`           // 药品追溯码
753
 	DrugTracCodg   string `json:"drug_trac_codg,omitempty"`           // 药品追溯码
754
-
754
+	InsuplcAdmdvs  string
755
+	MdtrtareaAdmvs string
755
 	OrgName        string
756
 	OrgName        string
756
 	Opter          string
757
 	Opter          string
757
 	SecretKey      string
758
 	SecretKey      string
758
-	InsuplcAdmdvs  string
759
-	MdtrtareaAdmvs string
759
+
760
 	RequestUrl     string
760
 	RequestUrl     string
761
 	AccessKey      string
761
 	AccessKey      string
762
 	Cainfo         string
762
 	Cainfo         string
773
 	InfRefmsgid string      `json:"inf_refmsgid"`
773
 	InfRefmsgid string      `json:"inf_refmsgid"`
774
 	Infcode     int64       `json:"infcode"`
774
 	Infcode     int64       `json:"infcode"`
775
 	Output      []struct {
775
 	Output      []struct {
776
-		FixmedinsCode  string `json:"fixmedins_code,omitempty"`      // 定点医药机构编号
777
-		MedinsListCodg string `json:"medins_list_codg,omitempty"`    // 医药机构目录编码
778
-		FixmedinsBchno string `json:"fixmedins_bchno,omitempty"`     // 定点医药机构批次流水号
779
-		MedListCodg    string `json:"med_list_codg,omitempty"`       // 医疗目录编码
780
-		MedinsListName string `json:"medins_list_name,omitempty"`    // 医药机构目录名称
781
-		DrugTracCodg   string `json:"drug_trac_codg,omitempty"`      // 药品追溯码
782
-		ValiFlag       string `json:"vali_flag" validate:"required"` // 有效标志
783
-		OpterId        string `json:"opter_id,omitempty"`            // 经办人ID
784
-		CrterName      string `json:"crter_name,omitempty"`          // 创建人姓名
785
-		CrterId        string `json:"crter_id,omitempty"`            // 创建人ID
786
-		OptinsNo       string `json:"optins_no,omitempty"`           // 经办机构编号
776
+		FixmedinsCode  string
777
+		MedinsListCodg string
778
+		FixmedinsBchno string
779
+		MedListCodg    string
780
+		MedinsListName string
781
+		DrugTracCodg   string
782
+		ValiFlag       string
783
+		OpterId        string
784
+		CrterName      string
785
+		CrterId        string
786
+		OptinsNo       string
787
 
787
 
788
 	} `json:"output"`
788
 	} `json:"output"`
789
 	RefmsgTime  string      `json:"refmsg_time"`
789
 	RefmsgTime  string      `json:"refmsg_time"`

+ 12 - 8
service/fj_service.go View File

3106
 	nonce := GetRandomString(32)
3106
 	nonce := GetRandomString(32)
3107
 	//inputMessage := SetInputMessage(nonce, timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs)
3107
 	//inputMessage := SetInputMessage(nonce, timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs)
3108
 
3108
 
3109
-	inputMessage := SetFjInputMessage(nonce, timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Url, struct3505.AppId, struct3505.AppSecret, struct3505.SignKey, struct3505.Enckey)
3109
+	inputMessage := SetFjInputMessage(nonce, timestamp, struct3505.OrgName, struct3505.Opter, struct3505.Code, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Url, struct3505.AppId, struct3505.AppSecret, struct3505.SignKey, struct3505.Enckey)
3110
 
3110
 
3111
 	// 生成输入报文
3111
 	// 生成输入报文
3112
 	//inputMessage := SetJSInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
3112
 	//inputMessage := SetJSInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
3113
 	input := make(map[string]interface{})
3113
 	input := make(map[string]interface{})
3114
 	inputData := make(map[string]interface{})
3114
 	inputData := make(map[string]interface{})
3115
-	druginputData := make(map[string]interface{})
3116
 	//druginputData2 := make(map[string]interface{})
3115
 	//druginputData2 := make(map[string]interface{})
3117
 
3116
 
3118
 	inputMessage["infno"] = "3505"                                  // 交易编码
3117
 	inputMessage["infno"] = "3505"                                  // 交易编码
3119
 	inputData["med_list_codg"] = struct3505.MedListCodg             // 定点医药机构目录编号
3118
 	inputData["med_list_codg"] = struct3505.MedListCodg             // 定点医药机构目录编号
3120
 	inputData["fixmedins_hilist_id"] = struct3505.FixmedinsHilistId // 定点医药机构目录编号
3119
 	inputData["fixmedins_hilist_id"] = struct3505.FixmedinsHilistId // 定点医药机构目录编号
3121
-	inputData["fixmedins_hilist_name"] = struct3505.OrgName         // 定点医药机构目录名称
3120
+	inputData["fixmedins_hilist_name"] = struct3505.FixmedinsHilistName         // 定点医药机构目录名称
3122
 	inputData["fixmedins_bchno"] = struct3505.FixmedinsBchno        // 人员编号 (来自1101接口返回)
3121
 	inputData["fixmedins_bchno"] = struct3505.FixmedinsBchno        // 人员编号 (来自1101接口返回)
3123
 
3122
 
3124
 	inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
3123
 	inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
3159
 	inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
3158
 	inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
3160
 	inputData["memo"] = struct3505.Memo
3159
 	inputData["memo"] = struct3505.Memo
3161
 	inputData["mdtrt_setl_type"] = struct3505.MdtrtSetlType                            // 人员编号 (来自1101接口返回)
3160
 	inputData["mdtrt_setl_type"] = struct3505.MdtrtSetlType                            // 人员编号 (来自1101接口返回)
3162
-	// 人员编号 (来自1101接口返回)
3163
-	//druginputData["drug_trac_codg"] = ""
3164
-	//druginputData2["drugtracinfo"] = druginputData
3165
-	inputData["drug_trac_info"] = druginputData
3166
-
3161
+	feedetail := make([]map[string]interface{}, 0)
3162
+	codes := strings.Split(struct3505.DrugTracCodg, ",")
3163
+	for _, item := range codes {
3164
+		if len(item) > 0 {
3165
+			druginputData := make(map[string]interface{})
3166
+			druginputData["drug_trac_codg"] =  removeNonDigits(item)
3167
+			feedetail = append(feedetail, druginputData)
3168
+		}
3169
+	}
3170
+	inputData["drug_trac_info"] = feedetail
3167
 	input["selinfo"] = inputData
3171
 	input["selinfo"] = inputData
3168
 	inputMessage["input"] = input //交易输入
3172
 	inputMessage["input"] = input //交易输入
3169
 
3173
 

+ 10 - 2
service/gdyb_service.go View File

3449
 	inputData["hi_paymtd"] = struct4101.HiPaymtd              // 医保支付方式  必填
3449
 	inputData["hi_paymtd"] = struct4101.HiPaymtd              // 医保支付方式  必填
3450
 	inputData["hsorg"] = struct4101.Hsorg                     // 医保机构  必填
3450
 	inputData["hsorg"] = struct4101.Hsorg                     // 医保机构  必填
3451
 	inputData["hsorg_opter"] = struct4101.HsorgOpter          // 医保机构经办人  必填
3451
 	inputData["hsorg_opter"] = struct4101.HsorgOpter          // 医保机构经办人  必填
3452
+
3452
 	inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门  必填
3453
 	inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门  必填
3453
 	inputData["medins_fill_psn"] = struct4101.MedinsFillPsn   // 医疗机构填报人  必填
3454
 	inputData["medins_fill_psn"] = struct4101.MedinsFillPsn   // 医疗机构填报人  必填
3454
 	inputData["psn_cashpay"] = struct4101.PsnCashpay          // 医疗机构填报人  必填
3455
 	inputData["psn_cashpay"] = struct4101.PsnCashpay          // 医疗机构填报人  必填
4067
 	inputData["pwcry_afadm_coma_dura"] = "" // 颅脑损伤患者入院后昏迷时长  必填
4068
 	inputData["pwcry_afadm_coma_dura"] = "" // 颅脑损伤患者入院后昏迷时长  必填
4068
 
4069
 
4069
 	inputData["spga_nurscare_days"] = "" // 特级护理天数  必填
4070
 	inputData["spga_nurscare_days"] = "" // 特级护理天数  必填
4071
+	inputData["hsorg"] = struct4101.Hsorg                     // 医保机构  必填
4072
+	inputData["hsorg_opter"] = struct4101.HsorgOpter          // 医保机构经办人  必填
4070
 
4073
 
4071
 	inputData["lv1_nurscare_days"] = ""          // 一级护理天数  必填
4074
 	inputData["lv1_nurscare_days"] = ""          // 一级护理天数  必填
4072
 	inputData["scd_nurscare_days"] = ""          // 二级护理天数  必填
4075
 	inputData["scd_nurscare_days"] = ""          // 二级护理天数  必填
4084
 	//inputData["chfpdr_code"] = struct4101.DoctorCode          // 主诊医师代码  必填
4087
 	//inputData["chfpdr_code"] = struct4101.DoctorCode          // 主诊医师代码  必填
4085
 	inputData["setl_begn_date"] = struct4101.SetlBegnDate     // 结算开始日期  必填
4088
 	inputData["setl_begn_date"] = struct4101.SetlBegnDate     // 结算开始日期  必填
4086
 	inputData["setl_end_date"] = struct4101.SetlEndDate       // 结算结束日期  必填
4089
 	inputData["setl_end_date"] = struct4101.SetlEndDate       // 结算结束日期  必填
4087
-	inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门  必填
4090
+	inputData["medins_fill_dept"] = org_name // 医疗机构填报部门  必填
4088
 	inputData["medins_fill_psn"] = struct4101.MedinsFillPsn   // 医疗机构填报人  必填
4091
 	inputData["medins_fill_psn"] = struct4101.MedinsFillPsn   // 医疗机构填报人  必填
4089
 
4092
 
4090
 	//payinfo := make([]map[string]interface{}, 0) // 基金支付信息
4093
 	//payinfo := make([]map[string]interface{}, 0) // 基金支付信息
6824
 	codes := strings.Split(struct3502.DrugTracCodg, ",")
6827
 	codes := strings.Split(struct3502.DrugTracCodg, ",")
6825
 	for _, item := range codes {
6828
 	for _, item := range codes {
6826
 		if len(item) > 0 {
6829
 		if len(item) > 0 {
6830
+			//druginputData := make(map[string]interface{})
6831
+			//druginputData["drug_trac_codg"] = item
6832
+			//feedetail = append(feedetail, druginputData)
6833
+
6834
+
6827
 			druginputData := make(map[string]interface{})
6835
 			druginputData := make(map[string]interface{})
6828
-			druginputData["drug_trac_codg"] = item
6836
+			druginputData["drug_trac_codg"] =  removeNonDigits(item)
6829
 			feedetail = append(feedetail, druginputData)
6837
 			feedetail = append(feedetail, druginputData)
6830
 		}
6838
 		}
6831
 	}
6839
 	}

+ 10 - 3
service/his_service.go View File

1570
 	return
1570
 	return
1571
 }
1571
 }
1572
 func GetAllHisOrder10138() (his []*models.HisOrder, err error) {
1572
 func GetAllHisOrder10138() (his []*models.HisOrder, err error) {
1573
-	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10028  AND status = 1  AND  order_status = 2 AND  setl_id <> '' AND setl_time >= '2024-11-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1573
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10610  AND status = 1  AND  order_status = 2 AND  setl_id <> '' AND setl_time >= '2024-12-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1574
 	fmt.Println(err)
1574
 	fmt.Println(err)
1575
 	return
1575
 	return
1576
 }
1576
 }
1581
 
1581
 
1582
 func GetAllHisOrder10278() (his []*models.HisOrder, err error) {
1582
 func GetAllHisOrder10278() (his []*models.HisOrder, err error) {
1583
 
1583
 
1584
-	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10278  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2024-11-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1584
+	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10278  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2024-12-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1585
 	fmt.Println(err)
1585
 	fmt.Println(err)
1586
 	return
1586
 	return
1587
 }
1587
 }
1801
 }
1801
 }
1802
 
1802
 
1803
 func GetNewDrugFlowInforTenone(start_system_time int64, end_system_time int64, org_id int64) (flows []*models.DrugFlow, err error) {
1803
 func GetNewDrugFlowInforTenone(start_system_time int64, end_system_time int64, org_id int64) (flows []*models.DrugFlow, err error) {
1804
-	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 {
1804
+	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 and info.is_upload <> 1").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 {
1805
 		return db.Where("status = 1 and drug_code <> ''").Preload("BaseDrugLib", "status=1")
1805
 		return db.Where("status = 1 and drug_code <> ''").Preload("BaseDrugLib", "status=1")
1806
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1806
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1807
 	return
1807
 	return
2187
 	err = db.Find(&advice).Error
2187
 	err = db.Find(&advice).Error
2188
 	return advice, err
2188
 	return advice, err
2189
 }
2189
 }
2190
+
2191
+
2192
+func FinddelHisAdviceDocAdvice(id int64) (advice []*models.HisDoctorAdviceInfo, err error) {
2193
+	db := XTReadDB().Model(&advice).Where("status= 1 and id = ? and is_upload = 1", id)
2194
+	err = db.Find(&advice).Error
2195
+	return advice, err
2196
+}

+ 171 - 12
service/jsyb_service.go View File

1
 package service
1
 package service
2
 
2
 
3
 import (
3
 import (
4
+	"bytes"
5
+	"crypto/hmac"
6
+	"crypto/sha1"
7
+	"encoding/base64"
8
+	"net/url"
4
 	//"bytes"
9
 	//"bytes"
5
 	"encoding/json"
10
 	"encoding/json"
6
 	"fmt"
11
 	"fmt"
7
 	"gdyb/models"
12
 	"gdyb/models"
8
 	"gdyb/utils/csbhttp"
13
 	"gdyb/utils/csbhttp"
9
-	//"io/ioutil"
14
+	"io/ioutil"
10
 	"net"
15
 	"net"
11
 	"strings"
16
 	"strings"
12
 	"regexp"
17
 	"regexp"
13
-	//"net/http"
18
+	"net/http"
14
 	"strconv"
19
 	"strconv"
15
 	"time"
20
 	"time"
16
 )
21
 )
199
 	return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), inputLog
204
 	return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), inputLog
200
 }
205
 }
201
 
206
 
207
+func generateSignature(param string, secretKey string) (string, error) {
208
+	// 创建 HMAC-SHA1 哈希对象
209
+	hmacSha1 := hmac.New(sha1.New, []byte(secretKey))
210
+
211
+	// 更新数据
212
+	_, err := hmacSha1.Write([]byte(param))
213
+	if err != nil {
214
+		return "", err
215
+	}
216
+
217
+	// 计算哈希值
218
+	signature := hmacSha1.Sum(nil)
219
+
220
+	// 将结果转换为 Base64 编码
221
+	return base64.StdEncoding.EncodeToString(signature), nil
222
+}
223
+
224
+func Jsyb1101ooo(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) {
225
+	timestamp := time.Now().Unix()
226
+	//生成输入报文
227
+	inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
228
+
229
+	input := make(map[string]interface{})
230
+	inputData := make(map[string]interface{})
231
+	inputMessage["infno"] = "1101" // 交易编码
232
+
233
+	if certificates == "3" {
234
+		inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
235
+		inputData["certno"] = certNo        // 证件号码
236
+		inputData["psn_cert_type"] = "99"   // 人员证件类型
237
+
238
+	} else {
239
+		if id_card_type == 1 {
240
+			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
241
+			inputData["card_sn"] = card_sn      // 卡识别码
242
+			inputData["certno"] = id_card_no    // 证件号码
243
+			inputData["psn_cert_type"] = "01"   // 人员证件类型
244
+
245
+		} else {
246
+			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
247
+			inputData["card_sn"] = ""           // 卡识别码
248
+			inputData["certno"] = certNo        // 证件号码
249
+			inputData["psn_cert_type"] = "01"   // 人员证件类型
250
+		}
251
+	}
252
+
253
+	inputData["mdtrt_cert_no"] = certNo  // 就诊凭证编号
254
+	inputData["begntime"] = ""                                // 开始时间
255
+	inputData["psn_name"] = ""                                // 人员姓名
256
+	input["data"] = inputData
257
+	inputMessage["input"] = input //交易输入
258
+
259
+	//var inputLog string
260
+	bytesData, _ := json.Marshal(inputMessage)
261
+	reader := bytes.NewReader(bytesData)
262
+
263
+	//inputLog = string(bytesData)
264
+	fmt.Println(string(bytesData))
265
+	if err != nil {
266
+		fmt.Println(err.Error())
267
+		return err.Error(), ""
268
+	}
269
+	request_url = request_url
270
+	fmt.Println(request_url)
271
+
272
+	request, err := http.NewRequest("POST", request_url, reader)
273
+
274
+	// 参数
275
+	_api_access_key := access_key
276
+	_api_name := "hssServives"
277
+	timestampInMilliseconds  := time.Now().Unix()
278
+
279
+	timestamp = timestampInMilliseconds
280
+	_api_timestamp := timestamp
281
+	_api_version := "1.0.0"
282
+	secretKey := secret_key
283
+
284
+	str := fmt.Sprintf("%d", _api_timestamp)
285
+
286
+	// 拼接参数
287
+	param := "_api_access_key=" + url.QueryEscape(_api_access_key) +
288
+		"&_api_name=" + url.QueryEscape(_api_name) +
289
+		"&_api_timestamp=" + url.QueryEscape(str) +
290
+		"&_api_version=" + url.QueryEscape(_api_version)
291
+	secret_key = strings.Replace(secret_key, "+", "%2B", -1)
292
+	fmt.Println("h8Z+d10iYI4B+kry0wgYSt5bFBs=")
293
+	secret_key  = "h8Z+d10iYI4B+kry0wgYSt5bFBs="
294
+	// 生成签名
295
+	signature, _ := generateSignature(param, secretKey)
296
+
297
+	fmt.Println("ak:")
298
+	fmt.Println(_api_access_key)
299
+	fmt.Println("sk:")
300
+	fmt.Println(secret_key)
301
+
302
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
303
+	request.Header.Set("_api_timestamp", str)
304
+	request.Header.Set("_api_name", _api_name)
305
+	request.Header.Set("_api_version",_api_version)
306
+	request.Header.Set("_api_access_key", _api_access_key)
307
+	request.Header.Set("_api_signature", signature)
308
+
309
+	fmt.Println(request)
310
+	fmt.Println(param)
311
+
312
+	if err != nil {
313
+		fmt.Println(err.Error())
314
+		return err.Error(), ""
315
+	}
316
+
317
+
318
+	client := http.Client{}
319
+	resp, err := client.Do(request)
320
+	if err != nil {
321
+		fmt.Println(err.Error())
322
+		return err.Error(), ""
323
+	}
324
+	respBytes, err := ioutil.ReadAll(resp.Body)
325
+	if err != nil {
326
+		fmt.Println(err.Error())
327
+		return err.Error(), ""
328
+	}
329
+	str2 := string(respBytes)
330
+	fmt.Println(str2)
331
+	return str2, string(bytesData)
332
+
333
+
334
+
335
+
336
+
337
+
338
+	//return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), inputLog
339
+}
340
+
202
 func Jsyb1101B(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, request_url string, access_key string, Token string, cainfo string, id_card_no string) (string, string) {
341
 func Jsyb1101B(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, request_url string, access_key string, Token string, cainfo string, id_card_no string) (string, string) {
203
 	timestamp := time.Now().Unix()
342
 	timestamp := time.Now().Unix()
204
 	//生成输入报文
343
 	//生成输入报文
282
 	inputData["begntime"] = timeFormatOne // 开始时间
421
 	inputData["begntime"] = timeFormatOne // 开始时间
283
 
422
 
284
 	if id_card_type == 1 {
423
 	if id_card_type == 1 {
285
-		inputData["mdtrt_cert_type"] = "03"                       // 就诊凭证类型
286
-		inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
424
+		if mdtrtarea_admvs == "320830"{
425
+			inputData["mdtrt_cert_type"] = "03"                       // 就诊凭证类型
426
+			inputData["mdtrt_cert_no"] = certNo + "|" + verify_number  // 就诊凭证编号
427
+		}else{
428
+			inputData["mdtrt_cert_type"] = "03"                       // 就诊凭证类型
429
+			inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
430
+
431
+		}
432
+
287
 	} else if id_card_type == 3 {
433
 	} else if id_card_type == 3 {
288
 		inputData["mdtrt_cert_type"] = "04"        // 就诊凭证类型
434
 		inputData["mdtrt_cert_type"] = "04"        // 就诊凭证类型
289
 		inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
435
 		inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
354
 	return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), requestLog
500
 	return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), requestLog
355
 }
501
 }
356
 
502
 
503
+
357
 // 门诊就诊信息上传
504
 // 门诊就诊信息上传
358
-func Jsyb2203(psnNo string, mdtrtId string, doctor string, department string, org_name string, med_type string, doctor_id string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string, dept string, config []*models.HisXtDiagnoseConfig, request_url string, access_key string, begin_time string, cainfo string) (string, string, int64) {
505
+func Jsyb2203(psnNo string, mdtrtId string, doctor string, department string, org_name string, med_type string, doctor_id string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string, dept string, config []*models.HisXtDiagnoseConfig, request_url string, access_key string, begin_time string, cainfo string,doc_name string) (string, string, int64) {
359
 	// 生成签名
506
 	// 生成签名
360
 	timestamp := time.Now().Unix()
507
 	timestamp := time.Now().Unix()
361
 	tempTime := time.Unix(timestamp, 0)
508
 	tempTime := time.Unix(timestamp, 0)
389
 		diseinfo_sun["diag_name"] = item.ClassName   // 诊断名称
536
 		diseinfo_sun["diag_name"] = item.ClassName   // 诊断名称
390
 		diseinfo_sun["diag_dept"] = department       // 诊断科室
537
 		diseinfo_sun["diag_dept"] = department       // 诊断科室
391
 		diseinfo_sun["dise_dor_no"] = doctor_id      // 诊断医生编码
538
 		diseinfo_sun["dise_dor_no"] = doctor_id      // 诊断医生编码
392
-		diseinfo_sun["dise_dor_name"] = doctor       // 诊断医生姓名
539
+		diseinfo_sun["dise_dor_name"] = doc_name       // 诊断医生姓名
393
 		diseinfo_sun["diag_time"] = timeFormatOne    // 诊断时间
540
 		diseinfo_sun["diag_time"] = timeFormatOne    // 诊断时间
394
 		diseinfo_sun["vali_flag"] = "1"              // 有效标志
541
 		diseinfo_sun["vali_flag"] = "1"              // 有效标志
395
 		diseinfo = append(diseinfo, diseinfo_sun)
542
 		diseinfo = append(diseinfo, diseinfo_sun)
674
 func Jsyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string, request_url string, access_key string, cainfo string) (string, string) {
821
 func Jsyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string, request_url string, access_key string, cainfo string) (string, string) {
675
 
822
 
676
 	timestamp := time.Now().Unix()
823
 	timestamp := time.Now().Unix()
677
-
678
 	// 生成输入报文
824
 	// 生成输入报文
679
 	inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
825
 	inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
680
 	input := make(map[string]interface{})
826
 	input := make(map[string]interface{})
682
 	inputMessage["infno"] = "2205" // 交易编码
828
 	inputMessage["infno"] = "2205" // 交易编码
683
 
829
 
684
 	inputData["mdtrt_id"] = mdtrtId  // 就诊 ID(来自2201接口返回)
830
 	inputData["mdtrt_id"] = mdtrtId  // 就诊 ID(来自2201接口返回)
685
-	inputData["chrg_bchno"] = "0000" // 收费批次号(来自2204生成的)
831
+	inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
686
 
832
 
687
 	inputData["psn_no"] = psnNo   // 人员编号 (来自1101接口返回)
833
 	inputData["psn_no"] = psnNo   // 人员编号 (来自1101接口返回)
688
 	inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
834
 	inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
792
 		inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
938
 		inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
793
 	} else {
939
 	} else {
794
 		if id_card_type == 1 {
940
 		if id_card_type == 1 {
795
-			inputData["mdtrt_cert_type"] = "03"                       // 就诊凭证类型
796
-			inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
941
+			if mdtrtarea_admvs == "320830"{
942
+
943
+				inputData["mdtrt_cert_type"] = "03"                       // 就诊凭证类型
944
+				inputData["mdtrt_cert_no"] =  certNo + "|" + verify_number  // 就诊凭证编号
945
+
946
+			}else{
947
+				inputData["mdtrt_cert_type"] = "03"                       // 就诊凭证类型
948
+				inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
949
+
950
+			}
951
+
797
 		} else if id_card_type == 3 {
952
 		} else if id_card_type == 3 {
798
 			inputData["mdtrt_cert_type"] = "04"        // 就诊凭证类型
953
 			inputData["mdtrt_cert_type"] = "04"        // 就诊凭证类型
799
 			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
954
 			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
976
 	//设置 调用的服务名和版本
1131
 	//设置 调用的服务名和版本
977
 	csbHP.SetApi("hssServives")
1132
 	csbHP.SetApi("hssServives")
978
 	csbHP.SetVersion("1.0.0")
1133
 	csbHP.SetVersion("1.0.0")
979
-
1134
+	timestampInMilliseconds := time.Now().UnixNano() / 1e6
1135
+	timestamp = timestampInMilliseconds
980
 	//添加附加的http请求头 (可以定义多条)
1136
 	//添加附加的http请求头 (可以定义多条)
981
 	//key := "_api_access_key=" + ak + "&_api_name=" + "hssServives" + "&_api_timestamp=" + strconv.FormatInt(timestamp, 10) + "&_api_version=" + "1.0.0"
1137
 	//key := "_api_access_key=" + ak + "&_api_name=" + "hssServives" + "&_api_timestamp=" + strconv.FormatInt(timestamp, 10) + "&_api_version=" + "1.0.0"
982
 	csbHP.AddHeader("_api_timestamp", strconv.FormatInt(timestamp, 10))
1138
 	csbHP.AddHeader("_api_timestamp", strconv.FormatInt(timestamp, 10))
1041
 	if fixmedins_code == "H32090403023" {
1197
 	if fixmedins_code == "H32090403023" {
1042
 		inputMessage["opter"] = "葛美琴"      // 经办人
1198
 		inputMessage["opter"] = "葛美琴"      // 经办人
1043
 		inputMessage["opter_name"] = "葛美琴" // 经办人姓名
1199
 		inputMessage["opter_name"] = "葛美琴" // 经办人姓名
1044
-	} else {
1200
+	} else if  fixmedins_code == "H32092103007"{
1045
 		inputMessage["opter"] = "孙欣欣"      // 经办人
1201
 		inputMessage["opter"] = "孙欣欣"      // 经办人
1046
 		inputMessage["opter_name"] = "孙欣欣" // 经办人姓名
1202
 		inputMessage["opter_name"] = "孙欣欣" // 经办人姓名
1203
+	} else {
1204
+		inputMessage["opter"] =   doctor    // 经办人
1205
+		inputMessage["opter_name"] = doctor // 经办人姓名
1047
 	}
1206
 	}
1048
 	inputMessage["inf_time"] = timeFormatOne        // 交易时间
1207
 	inputMessage["inf_time"] = timeFormatOne        // 交易时间
1049
 	inputMessage["fixmedins_code"] = fixmedins_code // 定点医药机构编号
1208
 	inputMessage["fixmedins_code"] = fixmedins_code // 定点医药机构编号