2 Коммиты 3d12e49373 ... e69475b9d7

Автор SHA1 Сообщение Дата
  test_user e69475b9d7 更新 3 недель назад
  test_user 4245a734d9 更新 1 месяц назад

+ 95 - 34
controllers/ah/ahyb_controller.go Просмотреть файл

@@ -44,6 +44,23 @@ type Response struct {
44 44
 	State     struct{} `json:"state"`
45 45
 }
46 46
 
47
+
48
+type Body3513 struct {
49
+	ErrMsg      string                 `json:"err_msg"`
50
+	InfRefMsgID string                 `json:"inf_refmsgid"`
51
+	InfCode     int                    `json:"infcode"`
52
+	Output      []map[string]interface{} `json:"output"`
53
+}
54
+
55
+type Response1513 struct {
56
+	Body3513      Body3513     `json:"body"`
57
+	Code      int      `json:"code"`
58
+	CSBCode   int      `json:"csbCode"`
59
+	Message   string   `json:"message"`
60
+	RequestID string   `json:"requestId"`
61
+	State     struct{} `json:"state"`
62
+}
63
+
47 64
 func AHybRegistRouters() {
48 65
 	beego.Router("/ahyb/1101", &AHybController{}, "get:PostOne")
49 66
 	beego.Router("/ahyb/2201", &AHybController{}, "get:PostTwo")
@@ -473,22 +490,34 @@ func (c *AHybController) Get3511() {
473 490
 		utils.ErrorLog("解析失败:%v", err)
474 491
 		return
475 492
 	}
476
-
477
-	result, request_log := service.Jsyb3511(struct3511)
478
-	saveJsLog(result, request_log, "3511", "库存查询", struct3511.OrgName)
479
-	var dat2 map[string]interface{}
480
-	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
481
-	} else {
493
+	result, inputLog := service.AHyb3511(struct3511, struct3511.RequestUrl)
494
+	saveJsLog(result, inputLog, "3511", "3511-查询", struct3511.OrgName)
495
+	var response Response1513
496
+	if err := json.Unmarshal([]byte(result), &response); err != nil {
497
+		fmt.Println("Error decoding JSON:", err)
498
+		return
482 499
 	}
483
-	var dat map[string]interface{}
484
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
500
+
501
+	if response.Code == 200 {
502
+		var dat2 map[string]interface{}
503
+		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
504
+		} else {
505
+
506
+		}
507
+		c.ServeSuccessJSON(map[string]interface{}{
508
+			"pre":    response.Body3513,
509
+			"log":    dat2,
510
+			"status": "1",
511
+			"msg":    "",
512
+		})
513
+
485 514
 	} else {
515
+		c.ServeSuccessJSON(map[string]interface{}{
516
+			"status": "0",
517
+			"msg":    response.Message,
518
+		})
486 519
 
487 520
 	}
488
-	c.ServeSuccessJSON(map[string]interface{}{
489
-		"pre":         dat,
490
-		"request_log": dat2,
491
-	})
492 521
 
493 522
 }
494 523
 func (c *AHybController) Get3512() {
@@ -506,30 +535,47 @@ func (c *AHybController) Get3512() {
506 535
 		return
507 536
 	}
508 537
 
509
-	result, request_log := service.Jsyb3512(struct3512)
510
-	saveJsLog(result, request_log, "3512", "3512查询", struct3512.OrgName)
511
-	var dat2 map[string]interface{}
512
-	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
513
-	} else {
538
+	result, inputLog := service.AHyb3512(struct3512, struct3512.RequestUrl)
539
+	saveJsLog(result, inputLog, "3512", "3512-查询", struct3512.OrgName)
540
+	var response Response1513
541
+	if err := json.Unmarshal([]byte(result), &response); err != nil {
542
+		fmt.Println("Error decoding JSON:", err)
543
+		return
514 544
 	}
515
-	var dat map[string]interface{}
516
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
545
+
546
+	if response.Code == 200 {
547
+		var dat2 map[string]interface{}
548
+		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
549
+		} else {
550
+
551
+		}
552
+		c.ServeSuccessJSON(map[string]interface{}{
553
+			"pre":    response.Body3513,
554
+			"log":    dat2,
555
+			"status": "1",
556
+			"msg":    "",
557
+		})
558
+
517 559
 	} else {
560
+		c.ServeSuccessJSON(map[string]interface{}{
561
+			"status": "0",
562
+			"msg":    response.Message,
563
+		})
518 564
 
519 565
 	}
520
-	c.ServeSuccessJSON(map[string]interface{}{
521
-		"pre":         dat,
522
-		"request_log": dat2,
523
-	})
524 566
 
525 567
 }
526 568
 func (c *AHybController) Get3513() {
527 569
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
570
+	utils.ErrorLog("解析失败:%v", body)
571
+	utils.ErrorLog("解析失败:%v", string(body))
572
+
528 573
 	var respJSON map[string]interface{}
529 574
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
530 575
 		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
531 576
 		return
532 577
 	}
578
+	utils.ErrorLog("解析失败:%v", "3333333")
533 579
 
534 580
 	userJSONBytes, _ := json.Marshal(respJSON["struct_3513s"])
535 581
 	var struct3513 models.Struct3513
@@ -537,22 +583,37 @@ func (c *AHybController) Get3513() {
537 583
 		utils.ErrorLog("解析失败:%v", err)
538 584
 		return
539 585
 	}
586
+	utils.ErrorLog("解析失败:%v", "1111122222")
540 587
 
541
-	result, request_log := service.Jsyb3513(struct3513)
542
-	saveJsLog(result, request_log, "3513", "库存盘点", struct3513.OrgName)
543
-	var dat2 map[string]interface{}
544
-	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
545
-	} else {
588
+	result, inputLog := service.AHyb3513(struct3513, struct3513.RequestUrl)
589
+	saveJsLog(result, inputLog, "3513", "3513-查询", struct3513.OrgName)
590
+	var response Response1513
591
+	if err := json.Unmarshal([]byte(result), &response); err != nil {
592
+		fmt.Println("Error decoding JSON:", err)
593
+		return
546 594
 	}
547
-	var dat map[string]interface{}
548
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
595
+
596
+	if response.Code == 200 {
597
+		var dat2 map[string]interface{}
598
+		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
599
+		} else {
600
+
601
+		}
602
+		c.ServeSuccessJSON(map[string]interface{}{
603
+			"pre":    response.Body3513.Output,
604
+			"log":    dat2,
605
+			"status": "1",
606
+			"msg":    "",
607
+		})
608
+
549 609
 	} else {
610
+		c.ServeSuccessJSON(map[string]interface{}{
611
+			"status": "0",
612
+			"msg":    response.Message,
613
+		})
550 614
 
551 615
 	}
552
-	c.ServeSuccessJSON(map[string]interface{}{
553
-		"pre":         dat,
554
-		"request_log": dat2,
555
-	})
616
+
556 617
 
557 618
 }
558 619
 func (c *AHybController) Readcardcharge() {

+ 324 - 160
controllers/sg/his_api_controller.go Просмотреть файл

@@ -34,6 +34,7 @@ import (
34 34
 	"syscall"
35 35
 	"time"
36 36
 	"unsafe"
37
+	"github.com/go-ole/go-ole"
37 38
 )
38 39
 
39 40
 type HisApiController struct {
@@ -871,21 +872,31 @@ func (c *HisApiController) Get3511() {
871 872
 			})
872 873
 		}
873 874
 
874
-	} else {
875
-
876
-		result1, result2, _ := service.FJyb3511(struct3508)
877
-		saveLog(result1, result2, "3511", "3511")
878
-
875
+	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "340") {
879 876
 		var res models.Result3511
880
-		var respJSON2 map[string]interface{}
881
-		if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
877
+		//安徽
878
+		data := make(map[string]interface{})
879
+		data["struct_3511s"] = struct3508
880
+		client := &http.Client{}
881
+		bytesData, _ := json.Marshal(data)
882
+		var req *http.Request
883
+		req, _ = http.NewRequest("POST", miConfig.SecretKey+"ahyb/3511", bytes.NewReader(bytesData))
884
+		resp, _ := client.Do(req)
885
+		defer resp.Body.Close()
886
+		body, ioErr := ioutil.ReadAll(resp.Body)
887
+		if ioErr != nil {
888
+			utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
889
+		}
890
+		var respJSON map[string]interface{}
891
+		if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
882 892
 			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
883 893
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
884 894
 			return
885 895
 		}
886
-		userJSONBytes2, _ := json.Marshal(respJSON2)
887
-		if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
888
-			utils.ErrorLog("解析失败:%v", err)
896
+		respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
897
+		result, _ := json.Marshal(respJSON)
898
+		if err := json.Unmarshal([]byte(result), &res); err != nil {
899
+			//utils.ErrorLog("解析失败:%v", err)
889 900
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
890 901
 			return
891 902
 		}
@@ -899,44 +910,13 @@ func (c *HisApiController) Get3511() {
899 910
 				"info": res.Output,
900 911
 			})
901 912
 		}
902
-	}
903
-
904
-}
905
-func (c *HisApiController) Get3512() {
906
-	admin_user_id, _ := c.GetInt64("admin_user_id")
907
-	drug_id, _ := c.GetInt64("id")
908
-	start_time := c.GetString("start_time")
909
-	end_time := c.GetString("end_time")
910
-
911
-	adminUser := c.GetAdminUserInfo()
912
-	curRoles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
913
-	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
914
-	drug, _ := service.GetDrugByID(drug_id)
915 913
 
916
-	var struct3508 models.Struct3512
917
-	struct3508.FixmedinsCode = miConfig.Code
914
+	}else {
918 915
 
919
-	struct3508.OrgName = miConfig.OrgName
920
-	struct3508.AccessKey = miConfig.AccessKey
921
-	struct3508.Opter = curRoles.UserName
922
-	struct3508.RequestUrl = miConfig.Url
923
-	struct3508.Url = miConfig.Url
924
-	struct3508.AppId = miConfig.Cainfo
925
-	struct3508.AppSecret = miConfig.AppSecret
926
-	struct3508.Enckey = miConfig.EncKey
927
-	struct3508.SignKey = miConfig.SignKey
928
-	struct3508.SecretKey = miConfig.SecretKey
929
-	struct3508.MedListCodg = drug.MedicalInsuranceNumber
930
-	struct3508.Begndate = start_time
931
-	struct3508.Enddate = end_time
932
-	struct3508.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
933
-	struct3508.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
934
-
935
-	if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") { //广东
936
-		result1, result2 := service.Gdyb3512(struct3508, struct3508.SecretKey)
937
-		saveLog(result1, result2, "3512", "3512")
916
+		result1, result2, _ := service.FJyb3511(struct3508)
917
+		saveLog(result1, result2, "3511", "3511")
938 918
 
939
-		var res models.Result3512
919
+		var res models.Result3511
940 920
 		var respJSON2 map[string]interface{}
941 921
 		if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
942 922
 			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
@@ -959,37 +939,118 @@ func (c *HisApiController) Get3512() {
959 939
 				"info": res.Output,
960 940
 			})
961 941
 		}
942
+	}
962 943
 
963
-	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "350") {
944
+}
945
+func (c *HisApiController) Get3512() {
946
+	admin_user_id, _ := c.GetInt64("admin_user_id")
947
+	drug_id, _ := c.GetInt64("id")
948
+	start_time := c.GetString("start_time")
949
+	end_time := c.GetString("end_time")
964 950
 
965
-		result1, result2, _ := service.FJyb3512(struct3508)
966
-		saveLog(result1, result2, "3512", "3512")
951
+	adminUser := c.GetAdminUserInfo()
952
+	curRoles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
953
+	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
954
+	drug, _ := service.GetDrugByIDTwo(drug_id,adminUser.CurrentOrgId)
955
+
956
+	var infos models.Output2
957
+	for _, item := range drug{
958
+		var struct3508 models.Struct3512
959
+		struct3508.FixmedinsCode = miConfig.Code
960
+
961
+		struct3508.OrgName = miConfig.OrgName
962
+		struct3508.AccessKey = miConfig.AccessKey
963
+		struct3508.Opter = curRoles.UserName
964
+		struct3508.RequestUrl = miConfig.Url
965
+		struct3508.Url = miConfig.Url
966
+		struct3508.AppId = miConfig.Cainfo
967
+		struct3508.AppSecret = miConfig.AppSecret
968
+		struct3508.Enckey = miConfig.EncKey
969
+		struct3508.SignKey = miConfig.SignKey
970
+		struct3508.SecretKey = miConfig.SecretKey
971
+		struct3508.MedListCodg = item.MedicalInsuranceNumber
972
+		struct3508.Begndate = start_time
973
+		struct3508.Enddate = end_time
974
+		struct3508.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
975
+		struct3508.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
976
+
977
+		if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") { //广东
978
+			result1, result2 := service.Gdyb3512(struct3508, struct3508.SecretKey)
979
+			saveLog(result1, result2, "3512", "3512")
980
+
981
+			var res models.Result3512
982
+			var respJSON2 map[string]interface{}
983
+			if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
984
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
985
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
986
+				return
987
+			}
988
+			userJSONBytes2, _ := json.Marshal(respJSON2)
989
+			if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
990
+				utils.ErrorLog("解析失败:%v", err)
991
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
992
+				return
993
+			}
967 994
 
968
-		var res models.Result3512
969
-		var respJSON2 map[string]interface{}
970
-		if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
971
-			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
972
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
973
-			return
974
-		}
975
-		userJSONBytes2, _ := json.Marshal(respJSON2)
976
-		if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
977
-			utils.ErrorLog("解析失败:%v", err)
978
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
979
-			return
980
-		}
981
-		if res.Infcode == -1 {
982
-			c.ServeSuccessJSON(map[string]interface{}{
983
-				"failed_code": -10,
984
-				"msg":         res.ErrMsg,
985
-			})
986
-		} else {
987
-			c.ServeSuccessJSON(map[string]interface{}{
988
-				"info": res.Output,
989
-			})
990
-		}
995
+			infos = append(infos, res.Output...)
996
+
997
+
998
+		} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "350") {
991 999
 
1000
+			result1, result2, _ := service.FJyb3512(struct3508)
1001
+			saveLog(result1, result2, "3512", "3512")
1002
+
1003
+			var res models.Result3512
1004
+			var respJSON2 map[string]interface{}
1005
+			if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
1006
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1007
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1008
+				return
1009
+			}
1010
+			userJSONBytes2, _ := json.Marshal(respJSON2)
1011
+			if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
1012
+				utils.ErrorLog("解析失败:%v", err)
1013
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1014
+				return
1015
+			}
1016
+			infos = append(infos, res.Output...)
1017
+
1018
+		}else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "340") {
1019
+			var res models.Result3512
1020
+			//安徽
1021
+			data := make(map[string]interface{})
1022
+			data["struct_3512s"] = struct3508
1023
+			client := &http.Client{}
1024
+			bytesData, _ := json.Marshal(data)
1025
+			var req *http.Request
1026
+			req, _ = http.NewRequest("POST", miConfig.SecretKey+"ahyb/3512", bytes.NewReader(bytesData))
1027
+			resp, _ := client.Do(req)
1028
+			defer resp.Body.Close()
1029
+			body, ioErr := ioutil.ReadAll(resp.Body)
1030
+			if ioErr != nil {
1031
+				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
1032
+			}
1033
+			var respJSON map[string]interface{}
1034
+			if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
1035
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1036
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1037
+				return
1038
+			}
1039
+			respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
1040
+			result, _ := json.Marshal(respJSON)
1041
+			if err := json.Unmarshal([]byte(result), &res); err != nil {
1042
+				//utils.ErrorLog("解析失败:%v", err)
1043
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1044
+				return
1045
+			}
1046
+			infos = append(infos, res.Output...)
1047
+		}
992 1048
 	}
1049
+	c.ServeSuccessJSON(map[string]interface{}{
1050
+			"info": infos,
1051
+	})
1052
+
1053
+
993 1054
 
994 1055
 }
995 1056
 func (c *HisApiController) Get3513() {
@@ -1001,85 +1062,171 @@ func (c *HisApiController) Get3513() {
1001 1062
 	adminUser := c.GetAdminUserInfo()
1002 1063
 	curRoles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
1003 1064
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
1004
-	drug, _ := service.GetDrugByID(drug_id)
1065
+	//drug, _ := service.GetDrugByID(drug_id)
1066
+	drug, _ := service.GetDrugByIDTwo(drug_id,adminUser.CurrentOrgId)
1067
+
1068
+	var infos models.Output3
1069
+	for _, item := range drug {
1070
+
1071
+		var struct3508 models.Struct3513
1072
+		struct3508.FixmedinsCode = miConfig.Code
1073
+
1074
+		struct3508.OrgName = miConfig.OrgName
1075
+		struct3508.AccessKey = miConfig.AccessKey
1076
+		struct3508.Opter = curRoles.UserName
1077
+		struct3508.RequestUrl = miConfig.Url
1078
+		struct3508.Url = miConfig.Url
1079
+		struct3508.AppId = miConfig.Cainfo
1080
+		struct3508.AppSecret = miConfig.AppSecret
1081
+		struct3508.Enckey = miConfig.EncKey
1082
+		struct3508.SignKey = miConfig.SignKey
1083
+		struct3508.SecretKey = miConfig.SecretKey
1084
+		struct3508.MedListCodg = item.MedicalInsuranceNumber
1085
+		struct3508.Begndate = start_time
1086
+		struct3508.Enddate = end_time
1087
+		struct3508.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
1088
+		struct3508.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
1089
+		if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") { //广东
1090
+			result1, result2 := service.Gdyb3513(struct3508, struct3508.SecretKey)
1091
+			saveLog(result1, result2, "3513", "3513")
1092
+
1093
+			var res models.Result3513
1094
+			var respJSON2 map[string]interface{}
1095
+			if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
1096
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1097
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1098
+				return
1099
+			}
1100
+			userJSONBytes2, _ := json.Marshal(respJSON2)
1101
+			if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
1102
+				utils.ErrorLog("解析失败:%v", err)
1103
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1104
+				return
1105
+			}
1106
+			infos = append(infos, res.Output...)
1005 1107
 
1006
-	var struct3508 models.Struct3513
1007
-	struct3508.FixmedinsCode = miConfig.Code
1108
+		} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "350") {
1008 1109
 
1009
-	struct3508.OrgName = miConfig.OrgName
1010
-	struct3508.AccessKey = miConfig.AccessKey
1011
-	struct3508.Opter = curRoles.UserName
1012
-	struct3508.RequestUrl = miConfig.Url
1013
-	struct3508.Url = miConfig.Url
1014
-	struct3508.AppId = miConfig.Cainfo
1015
-	struct3508.AppSecret = miConfig.AppSecret
1016
-	struct3508.Enckey = miConfig.EncKey
1017
-	struct3508.SignKey = miConfig.SignKey
1018
-	struct3508.SecretKey = miConfig.SecretKey
1019
-	struct3508.MedListCodg = drug.MedicalInsuranceNumber
1020
-	struct3508.Begndate = start_time
1021
-	struct3508.Enddate = end_time
1022
-	struct3508.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
1023
-	struct3508.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
1024
-	if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") { //广东
1025
-		result1, result2 := service.Gdyb3513(struct3508, struct3508.SecretKey)
1026
-		saveLog(result1, result2, "3513", "3513")
1110
+			result1, result2, _ := service.FJyb3513(struct3508)
1111
+			saveLog(result1, result2, "3513", "3513")
1027 1112
 
1028
-		var res models.Result3513
1029
-		var respJSON2 map[string]interface{}
1030
-		if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
1031
-			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1032
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1033
-			return
1034
-		}
1035
-		userJSONBytes2, _ := json.Marshal(respJSON2)
1036
-		if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
1037
-			utils.ErrorLog("解析失败:%v", err)
1038
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1039
-			return
1040
-		}
1041
-		if res.Infcode == -1 {
1042
-			c.ServeSuccessJSON(map[string]interface{}{
1043
-				"failed_code": -10,
1044
-				"msg":         res.ErrMsg,
1045
-			})
1046
-		} else {
1047
-			c.ServeSuccessJSON(map[string]interface{}{
1048
-				"info": res.Output,
1049
-			})
1050
-		}
1113
+			var res models.Result3513
1114
+			var respJSON2 map[string]interface{}
1115
+			if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
1116
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1117
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1118
+				return
1119
+			}
1120
+			userJSONBytes2, _ := json.Marshal(respJSON2)
1121
+			if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
1122
+				utils.ErrorLog("解析失败:%v", err)
1123
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1124
+				return
1125
+			}
1126
+			infos = append(infos, res.Output...)
1127
+		} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "340") {
1128
+			var res models.Result3513
1129
+			//安徽
1130
+			data := make(map[string]interface{})
1131
+			data["struct_3513s"] = struct3508
1132
+			client := &http.Client{}
1133
+			bytesData, _ := json.Marshal(data)
1134
+			var req *http.Request
1135
+			req, _ = http.NewRequest("POST", miConfig.SecretKey+"ahyb/3513", bytes.NewReader(bytesData))
1136
+			resp, _ := client.Do(req)
1137
+			defer resp.Body.Close()
1138
+			body, ioErr := ioutil.ReadAll(resp.Body)
1139
+			if ioErr != nil {
1140
+				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
1141
+			}
1142
+			var respJSON map[string]interface{}
1143
+			if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
1144
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1145
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1146
+				return
1147
+			}
1148
+			respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
1149
+			result, _ := json.Marshal(respJSON)
1150
+			if err := json.Unmarshal([]byte(result), &res); err != nil {
1151
+				//utils.ErrorLog("解析失败:%v", err)
1152
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1153
+				return
1154
+			}
1155
+			infos = append(infos, res.Output...)
1051 1156
 
1052
-	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "350") {
1157
+		}else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "361") { //
1158
+			result1, result2 := service.JXyb3513(struct3508, struct3508.SecretKey, struct3508.AccessKey, struct3508.RequestUrl)
1159
+			saveLog(result1, result2, "3513", "3513")
1053 1160
 
1054
-		result1, result2, _ := service.FJyb3513(struct3508)
1055
-		saveLog(result1, result2, "3513", "3513")
1161
+			var res models.Result3513
1162
+			var respJSON2 map[string]interface{}
1163
+			if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
1164
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1165
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1166
+				return
1167
+			}
1168
+			userJSONBytes2, _ := json.Marshal(respJSON2)
1169
+			if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
1170
+				utils.ErrorLog("解析失败:%v", err)
1171
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1172
+				return
1173
+			}
1174
+			infos = append(infos, res.Output...)
1056 1175
 
1057
-		var res models.Result3513
1058
-		var respJSON2 map[string]interface{}
1059
-		if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
1060
-			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1061
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1062
-			return
1063
-		}
1064
-		userJSONBytes2, _ := json.Marshal(respJSON2)
1065
-		if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
1066
-			utils.ErrorLog("解析失败:%v", err)
1067
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1068
-			return
1069
-		}
1070
-		if res.Infcode == -1 {
1071
-			c.ServeSuccessJSON(map[string]interface{}{
1072
-				"failed_code": -10,
1073
-				"msg":         res.ErrMsg,
1074
-			})
1075
-		} else {
1076
-			c.ServeSuccessJSON(map[string]interface{}{
1077
-				"info": res.Output,
1078
-			})
1079 1176
 		}
1177
+	}
1178
+	type Newinfo struct {
1179
+		FixmedinsCode  string
1180
+		MedListCodg    string
1181
+		MedinsListCodg string
1182
+		MedinsListName string
1183
+		FixmedinsBchno string
1184
+		MdtrtId        string
1185
+		MdtrtSetlType  string
1186
+		BkkpSn         string
1187
+		DrugTracCodg   string
1188
+		PsnNo          string
1189
+		PsnCertType    string
1190
+		Certno         string
1191
+		PsnName        string
1192
+		Memo           string
1193
+		TrdnFlag       string
1194
+		UpdtTime       string
1195
+		OpterName      string
1196
+		Rid            string
1197
+		CrteTime       string
1198
+		OptTime        string
1199
+		OpterId        string
1200
+		CrterName      string
1201
+		CrterId        string
1202
+		OptinsNo       string
1203
+	}
1204
+	var Newinfos []Newinfo
1205
+
1206
+	for _, item := range infos {
1207
+		var ni Newinfo
1208
+		patient, _ := service.GetPatientByIDCard(item.Certno, c.GetAdminUserInfo().CurrentOrgId)
1209
+
1210
+		//patient, _ := service.GetPatientByIDCard(item.Certno, c.GetAdminUserInfo().CurrentOrgId)
1080 1211
 
1212
+		numbers := strings.Split(item.FixmedinsBchno,"-")
1213
+
1214
+		flow := service.GetSaleDate(numbers[1])
1215
+		ni.MdtrtId = item.MdtrtId
1216
+		ni.UpdtTime = flow.SaleDate
1217
+		ni.PsnName = patient.Name
1218
+		ni.Certno = item.Certno
1219
+		ni.MedinsListName = item.MedinsListName
1220
+		ni.FixmedinsBchno = item.FixmedinsBchno
1221
+		ni.DrugTracCodg = item.DrugTracCodg
1222
+		ni.MedListCodg = patient.Name
1223
+		Newinfos = append(Newinfos, ni)
1081 1224
 	}
1082 1225
 
1226
+	c.ServeSuccessJSON(map[string]interface{}{
1227
+			"info": Newinfos,
1228
+	})
1229
+
1083 1230
 }
1084 1231
 func (c *HisApiController) Get35081() {
1085 1232
 	admin_user_id, _ := c.GetInt64("admin_user_id")
@@ -1229,6 +1376,15 @@ func (c *HisApiController) FJ3501AND3502() {
1229 1376
 		return
1230 1377
 	}
1231 1378
 
1379
+
1380
+
1381
+
1382
+
1383
+
1384
+
1385
+
1386
+
1387
+
1232 1388
 	//库盘
1233 1389
 
1234 1390
 	for _, drug := range drugs {
@@ -5215,7 +5371,7 @@ func (c *HisApiController) ChangeDrugTen() {
5215 5371
 						return
5216 5372
 					}
5217 5373
 					userJSONBytes3, _ := json.Marshal(respJSON3)
5218
-					if c.GetAdminUserInfo().CurrentOrgId == 10265 || c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
5374
+					if c.GetAdminUserInfo().CurrentOrgId == 10265 || c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 || c.GetAdminUserInfo().CurrentOrgId == 10633 {
5219 5375
 						if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
5220 5376
 							utils.ErrorLog("解析失败:%v", err)
5221 5377
 							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -5872,6 +6028,11 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
5872 6028
 		struct3505.PharName = "易圣"
5873 6029
 		struct3505.PharPracCertNo = "D430726002209"
5874 6030
 	}
6031
+
6032
+	if org_id == 10633 {
6033
+		struct3505.PharName = "王敏"
6034
+		struct3505.PharPracCertNo = "342222199107214042"
6035
+	}
5875 6036
 	order := service.GetHisOrderByNumber(pre.BatchNumber)
5876 6037
 	struct3505.SetlId = order.SetlId
5877 6038
 	struct3505.MdtrtSn = order.MdtrtId
@@ -5895,7 +6056,7 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
5895 6056
 
5896 6057
 	}
5897 6058
 
5898
-	if org_id == 10610 || org_id == 10278 || org_id == 10138 || org_id == 10537 || org_id == 10028 {
6059
+	if org_id == 10610 || org_id == 10278 || org_id == 10138 || org_id == 10537 || org_id == 10028 || org_id == 10191 {
5899 6060
 
5900 6061
 		if drug.HisDoctorAdviceInfo.BaseDrugLib.IsZeroFlag == 1 {
5901 6062
 			struct3505.TrdnFlag = "1"
@@ -13462,7 +13623,7 @@ func Checkgd3101(c *HisApiController, patient_id int64, his_patient_id int64, ad
13462 13623
 		for _, item := range prescriptions {
13463 13624
 			for _, subItem := range item.HisDoctorAdviceInfo {
13464 13625
 				if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 {
13465
-					spec := (subItem.BaseDrugLib.Dose + subItem.BaseDrugLib.DoseUnit) + "*" + strconv.FormatInt(subItem.BaseDrugLib.MinNumber, 10) + subItem.BaseDrugLib.MinUnit + "/" + subItem.BaseDrugLib.MaxUnit
13626
+					spec := (subItem.BaseDrugLib.Dose + subItem.BaseDrugLib.DoseUnit) + "/" + strconv.FormatInt(subItem.BaseDrugLib.MinNumber, 10) + subItem.BaseDrugLib.MinUnit
13466 13627
 
13467 13628
 					var order models.FsiOrderDtos
13468 13629
 					order.RxID = strconv.FormatInt(item.ID, 10)
@@ -13498,8 +13659,8 @@ func Checkgd3101(c *HisApiController, patient_id int64, his_patient_id int64, ad
13498 13659
 			for _, subItem := range item.HisPrescriptionProject {
13499 13660
 				if subItem.Type == 2 && len(subItem.HisProject.MedicalCode) > 0 {
13500 13661
 					var order models.FsiOrderDtos
13501
-					order.RxID = strconv.FormatInt(item.ID, 10)
13502
-					order.Rxno = strconv.FormatInt(item.ID, 10)
13662
+					order.RxID = strconv.FormatInt(subItem.ID, 10)
13663
+					order.Rxno = strconv.FormatInt(subItem.ID, 10)
13503 13664
 					order.LongDrordFlag = "0"
13504 13665
 					order.HilistType = "201"
13505 13666
 					order.ChrgType = "1"
@@ -21480,8 +21641,12 @@ type CustomFundPay struct {
21480 21641
 func (c *HisApiController) GetbatchSettleList() {
21481 21642
 	//order_id, _ := c.GetInt64("order_id")
21482 21643
 	admin_user_id, _ := c.GetInt64("admin_user_id")
21644
+	start_date := c.GetString("start_date")
21645
+	end_date := c.GetString("end_date")
21483 21646
 
21484
-	orders, _ := service.GetAllHisOrderTwo10485()
21647
+
21648
+
21649
+	orders, _ := service.GetAllHisOrderTwo10485(start_date,end_date)
21485 21650
 
21486 21651
 	for _, item := range orders {
21487 21652
 
@@ -28559,7 +28724,7 @@ func (c *HisApiController) GetRegisterInfo() {
28559 28724
 					}
28560 28725
 					var result string
28561 28726
 					var requestLog string
28562
-					if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" || miConfig.Code == "H44030500255" || miConfig.Code == "H44082500483" || miConfig.Code == "H44030702287" || miConfig.Code == "H44030304882" {
28727
+					if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" || miConfig.Code == "H44030500255" || miConfig.Code == "H44082500483" || miConfig.Code == "H44030702287" || miConfig.Code == "H44030304882"  || miConfig.Code == "H44090200998"{
28563 28728
 						var hisPrescription []*models.HisPrescription
28564 28729
 						res3101 := Checkgd3101ForOne(c, patient.ID, his, admin_user_id, "1", record_time, hisPrescription, department)
28565 28730
 						if res3101.Infcode == 0 {
@@ -32220,7 +32385,7 @@ func (c *HisApiController) GetUploadInfo() {
32220 32385
 					}
32221 32386
 					result2, src_resquest = service.Gdyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, med_type, his.IdCardType, tempOrder.FulamtOwnpayAmt, tempOrder.OverlmtSelfPay, tempOrder.PreselfpayAmt, tempOrder.InscpScpAmt, his.IdType, acct_used_flag, "", admin_user_id)
32222 32387
 				} else {
32223
-					if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" || miConfig.Code == "H44030500255" || miConfig.Code == "H44082500483" || miConfig.Code == "H44030702287" || miConfig.Code == "H44030304882" {
32388
+					if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" || miConfig.Code == "H44030500255" || miConfig.Code == "H44082500483" || miConfig.Code == "H44030702287" || miConfig.Code == "H44030304882" ||  miConfig.Code == "H44090200998"{
32224 32389
 						result3101 := Checkgd3102(c, id, his_patient_id, admin_user_id, "7", tempOrder.ID)
32225 32390
 						if result3101.Infcode == 0 {
32226 32391
 							if len(result3101.Output.Result) > 0 {
@@ -34245,7 +34410,7 @@ func (c *HisApiController) GetPreUploadInfo() {
34245 34410
 						res.Infcode = infocode
34246 34411
 
34247 34412
 					} else {
34248
-						if miConfig.Code == "H44030903432" || miConfig.Code == "H44030501364" || miConfig.Code == "H44030500255" || miConfig.Code == "H44082500483" || miConfig.Code == "H44030702287" || miConfig.Code == "H44030304882" {
34413
+						if miConfig.Code == "H44030903432" || miConfig.Code == "H44030501364" || miConfig.Code == "H44030500255" || miConfig.Code == "H44082500483" || miConfig.Code == "H44030702287" || miConfig.Code == "H44030304882" || miConfig.Code == "H44090200998" {
34249 34414
 							result3101 := Checkgd3101(c, id, his_patient_id, admin_user_id, "2", record_time, prescriptions)
34250 34415
 							if result3101.Infcode == 0 {
34251 34416
 								if len(result3101.Output.Result) > 0 {
@@ -34421,7 +34586,8 @@ func (c *HisApiController) GetPreUploadInfo() {
34421 34586
 				for _, item := range prescriptions {
34422 34587
 					if item.Type == 1 { //药品
34423 34588
 						for _, subItem := range item.HisDoctorAdviceInfo {
34424
-							price, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price), 64)
34589
+							price, _ := strconv.ParseFloat(fmt.Sprintf("%.4f", subItem.Price), 64)
34590
+
34425 34591
 							total_one := price * subItem.PrescribingNumber
34426 34592
 							fmt.Println("subItem")
34427 34593
 							fmt.Println(subItem.Price)
@@ -34438,7 +34604,7 @@ func (c *HisApiController) GetPreUploadInfo() {
34438 34604
 
34439 34605
 						for _, subItem := range item.HisPrescriptionProject {
34440 34606
 							cnt, _ := strconv.ParseFloat(subItem.Count, 64)
34441
-							price, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price), 64)
34607
+							price, _ := strconv.ParseFloat(fmt.Sprintf("%.4f", subItem.Price), 64)
34442 34608
 							total_one := price * cnt
34443 34609
 							total = total + total_one
34444 34610
 						}
@@ -35947,7 +36113,7 @@ func (c *HisApiController) GetPreUploadInfo() {
35947 36113
 
35948 36114
 							psn_info, _ := service.GetPsnByPatientId(his.PatientId)
35949 36115
 							allTotal = fmt.Sprintf("%.2f", total_two)
35950
-							if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" || miConfig.Code == "H44030500255" || miConfig.Code == "H44082500483" || miConfig.Code == "H44030702287" || miConfig.Code == "H44030304882" {
36116
+							if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" || miConfig.Code == "H44030500255" || miConfig.Code == "H44082500483" || miConfig.Code == "H44030702287" || miConfig.Code == "H44030304882" || miConfig.Code == "H44090200998" {
35951 36117
 
35952 36118
 								result3101 := Checkgd3102(c, id, his_patient_id, admin_user_id, "6", order.ID)
35953 36119
 								if result3101.Infcode == 0 {
@@ -38997,7 +39163,7 @@ func (c *HisApiController) GetCheckAccount() {
38997 39163
 	var res10188 ResultEightFor10188
38998 39164
 	if config.IsOpen == 1 {
38999 39165
 		if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" || miConfig.MdtrtareaAdmvs == "320830" {
39000
-			api := "http://192.168.2.3:9532/" + "jsyb/3201?" +
39166
+			api :=  miConfig.AppSecret + "jsyb/3201?" +
39001 39167
 				"insutype=" + insutype +
39002 39168
 				"&clr_type=" + clr_type +
39003 39169
 				"&setl_optins=" + clr_org +
@@ -39286,7 +39452,7 @@ func (c *HisApiController) GetCheckAccount() {
39286 39452
 				return
39287 39453
 			}
39288 39454
 
39289
-		} else if miConfig.MdtrtareaAdmvs == "360302" {
39455
+		} else if miConfig.MdtrtareaAdmvs == "360100" {
39290 39456
 
39291 39457
 			//orders_two, _ := service.GetOrderByTimeFive(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, "", clr_type, miConfig.MdtrtareaAdmvs)
39292 39458
 			//fixmedins_setl_cnt := int64(len(orders_two))
@@ -39312,14 +39478,12 @@ func (c *HisApiController) GetCheckAccount() {
39312 39478
 			baseParams.Doctor = role.UserName
39313 39479
 			baseParams.RequestUrl = miConfig.Url
39314 39480
 
39315
-			if clr_type == "9903" {
39316
-				clr_type = "9901"
39317
-			}
39481
+
39318 39482
 
39319 39483
 			businessParams := models.BusinessParams{
39320 39484
 				Insutype:         insutype,
39321 39485
 				ClrType:          clr_type,
39322
-				SetlOptins:       "360302",
39486
+				SetlOptins:       "360102",
39323 39487
 				StmtBegndate:     start_time,
39324 39488
 				StmtEnddate:      end_time,
39325 39489
 				MedfeeSumamt:     0,
@@ -39400,7 +39564,7 @@ func (c *HisApiController) GetCheckAccount() {
39400 39564
 				return
39401 39565
 			}
39402 39566
 
39403
-		} else if miConfig.MdtrtareaAdmvs == "360100" {
39567
+		} else if miConfig.MdtrtareaAdmvs == "360106" {
39404 39568
 
39405 39569
 			//orders_two, _ := service.GetOrderByTimeFive(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, "", clr_type, miConfig.MdtrtareaAdmvs)
39406 39570
 			//fixmedins_setl_cnt := int64(len(orders_two))
@@ -39433,7 +39597,7 @@ func (c *HisApiController) GetCheckAccount() {
39433 39597
 			businessParams := models.BusinessParams{
39434 39598
 				Insutype:         insutype,
39435 39599
 				ClrType:          clr_type,
39436
-				SetlOptins:       "360100",
39600
+				SetlOptins:       "360102",
39437 39601
 				StmtBegndate:     start_time,
39438 39602
 				StmtEnddate:      end_time,
39439 39603
 				MedfeeSumamt:     0,

+ 233 - 5
main.go Просмотреть файл

@@ -77,6 +77,8 @@ func main() {
77 77
 
78 78
 	//深圳百霖
79 79
 	//GetblBatchSettleList()
80
+	//GetblpgBatchSettleList()
81
+
80 82
 	//GetblbrBatchSettleList()
81 83
 	//深圳百霖贝尔
82 84
 	//GetblbrBatchSettleList()
@@ -707,10 +709,231 @@ type ResultSeventeen struct {
707 709
 //
708 710
 func GetblBatchSettleList() {
709 711
 	org_id, _ := beego.AppConfig.Int64("org_id")
710
-	org_id = 10610
712
+	org_id = 9504
711 713
 	var orders []*models.HisOrder
712 714
 	//var orders []*models.HisOrderError
713 715
 	orders, _ = service.GetAllHisOrder10138()
716
+	for _, item := range orders {
717
+		order_id := item.ID
718
+		order, _ := service.GetHisOrderByIDTwo(order_id)
719
+		if order.MedType == "14" {
720
+			his, _ := service.GetHisPatientByNumber(order.MdtrtId)
721
+			var patientPrescription models.HisPrescriptionInfo
722
+			patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
723
+			doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
724
+			department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
725
+			miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
726
+			var configTwo []*models.HisXtDiagnoseConfig
727
+			diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
728
+			curRoles, _ := service.GetAdminUserInfoByID(org_id, 5488)
729
+			for _, item := range diagnosis_idstwo {
730
+				id, _ := strconv.ParseInt(item, 10, 64)
731
+				diagnosisConfig, _ := service.FindDiagnoseById(id)
732
+				configTwo = append(configTwo, &diagnosisConfig)
733
+			}
734
+			patient, _ := service.GetPatientByIDTwo(9504, order.PatientId)
735
+
736
+			sickConfig, _ := service.FindSickById(his.SickType)
737
+			//if order.MedType == "1111" || order.MedType == "1112" {
738
+			//	order.MedType = "11"
739
+			//}
740
+			service.Gdyb2203d(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, "14", doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, curRoles.UserName, configTwo, time.Unix(his.RecordDate, 0).Format("2006-01-02 15:04:05"))
741
+
742
+			depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
743
+			pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
744
+			doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
745
+			if order.ID == 0 {
746
+				return
747
+			}
748
+			if his.BalanceAccountsType == 2 {
749
+				continue
750
+			}
751
+
752
+			ID := strconv.FormatInt(int64(order.ID), 10)
753
+
754
+			struct4101 := service.Struct4101{
755
+				PsnNo:          order.PsnNo,
756
+				MdtrtId:        order.MdtrtId,
757
+				SetlId:         order.SetlId,
758
+				PsnName:        order.PsnName,
759
+				Gend:           order.Gend,
760
+				Brdy:           his.Brdy,
761
+				Age:            his.Age,
762
+				Naty:           order.Naty,
763
+				PatnCertType:   order.PsnCertType,
764
+				Certno:         order.Certno,
765
+				Prfs:           "90",
766
+				ConerName:      "",
767
+				PatnRlts:       "",
768
+				ConerAddr:      "",
769
+				ConerTel:       "",
770
+				HiType:         order.Insutype,
771
+				Insuplc:        his.InsuplcAdmdvs,
772
+				MaindiagFlag:   "1",
773
+				BillCode:       "000"+ID,
774
+				BillNo:         "000"+ID,
775
+				BizSn:          order.Number,
776
+				PsnSelfPay:     order.PsnPartAmt,
777
+				PsnOwnPay:      order.PsnPartAmt,
778
+				AcctPay:        order.AcctPay,
779
+				PsnCashpay:     order.PsnCashPay,
780
+				HiPaymtd:       "1",
781
+				Hsorg:          his.InsuplcAdmdvs,
782
+				HsorgOpter:     his.InsuplcAdmdvs,
783
+				MedinsFillPsn:  curRoles.UserName,
784
+				MedinsFillDept: depart.Name,
785
+				IptMedType:     "2",
786
+				CurAddr:        patient.HomeAddress,
787
+			}
788
+
789
+			struct4101.SetlBegnDate = order.SetlTime
790
+			struct4101.SetlEndDate = order.SetlTime
791
+
792
+			var rf []CustomFundPay
793
+			json.Unmarshal([]byte(order.SetlDetail), &rf)
794
+
795
+			//var tempFunPays []service.CustomStruct
796
+			//var tempFunPay610100 service.CustomStruct
797
+
798
+			//for _, item := range rf {
799
+			//	if item.FundPayType == "610100" {
800
+			//		tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
801
+			//		tempFunPay610100.FundPayType = item.FundPayType
802
+			//	} else {
803
+			//		var tempFunPay service.CustomStruct
804
+			//		tempFunPay.FundPayamt = item.FundPayamt
805
+			//		tempFunPay.FundPayType = item.FundPayType
806
+			//		tempFunPays = append(tempFunPays, tempFunPay)
807
+			//	}
808
+			//}
809
+			//tempFunPays = append(tempFunPays, tempFunPay610100)
810
+			//struct4101.CustomStruct = tempFunPays
811
+
812
+			var tempDiaginfos []service.DiaginfoStructTwo
813
+			var tempOpspdiseinfo2 service.OpspdiseinfoStruct
814
+			var tempOpspdiseinfos []service.OpspdiseinfoStruct
815
+
816
+			diagnosis_ids := strings.Split(his.Diagnosis, ",")
817
+			var config []*models.HisXtDiagnoseConfig
818
+			for _, item := range diagnosis_ids {
819
+				id, _ := strconv.ParseInt(item, 10, 64)
820
+				if id == 24 {
821
+
822
+					diagnosisConfig, _ := service.FindDiagnoseById(id)
823
+					config = append(config, &diagnosisConfig)
824
+				}
825
+
826
+			}
827
+
828
+			for _, item := range diagnosis_ids {
829
+
830
+				id, _ := strconv.ParseInt(item, 10, 64)
831
+				if id != 24 {
832
+					diagnosisConfig, _ := service.FindDiagnoseById(id)
833
+					config = append(config, &diagnosisConfig)
834
+				}
835
+
836
+			}
837
+
838
+			for index, item := range config {
839
+				if index == 0 {
840
+					var tempDiaginfo service.DiaginfoStructTwo
841
+					tempDiaginfo.DiagCode = item.CountryCode
842
+					tempDiaginfo.DiagName = item.CountryContentName
843
+					tempDiaginfo.DiagType = "1"
844
+					tempDiaginfo.MaindiagFlag = "1"
845
+					tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
846
+				} else {
847
+
848
+					var tempDiaginfo service.DiaginfoStructTwo
849
+					tempDiaginfo.DiagCode = item.CountryCode
850
+					tempDiaginfo.DiagName = item.CountryContentName
851
+					tempDiaginfo.DiagType = "1"
852
+					tempDiaginfo.MaindiagFlag = "0"
853
+					tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
854
+				}
855
+			}
856
+			struct4101.Diseinfo = tempDiaginfos
857
+			sickConfigTwo, _ := service.FindSickById(his.SickType)
858
+			tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
859
+			tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
860
+			tempOpspdiseinfo2.OprnOprtCode = ""
861
+			tempOpspdiseinfo2.OprnOprtName = ""
862
+			tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
863
+			struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
864
+			time_arr := strings.Split(order.SetlTime, " ")
865
+			struct4101.AdmTime = time_arr[0]
866
+			struct4101.AdmEndTime = time_arr[0]
867
+			struct4101.DoctorName = doctor.UserName
868
+			struct4101.DoctorCode = doctor.DoctorNumber
869
+
870
+			struct4101.Ntly = "CHN"
871
+			struct4101.AdmCaty = "A03.06"
872
+			var res ResultSeventeen
873
+
874
+			result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
875
+			fmt.Println(result)
876
+			saveLog(result, request, "4101A", "清单上传")
877
+			var dat map[string]interface{}
878
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
879
+				fmt.Println(dat)
880
+			} else {
881
+				fmt.Println(err)
882
+			}
883
+			userJSONBytes, _ := json.Marshal(dat)
884
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
885
+				//utils.ErrorLog("解析失败:%v", err)
886
+				//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
887
+				//adminUser := c.GetAdminUserInfo()
888
+				errlog := &models.HisOrderError{
889
+					UserOrgId: org_id,
890
+					Ctime:     time.Now().Unix(),
891
+					Mtime:     time.Now().Unix(),
892
+					ErrMsg:    res.ErrMsg + "解析失败",
893
+					Status:    1,
894
+					PatientId: order_id,
895
+					Stage:     10138600,
896
+				}
897
+				service.CreateErrMsgLog(errlog)
898
+				continue
899
+			}
900
+
901
+			if res.Infcode != 0 {
902
+				//adminUser := c.GetAdminUserInfo()
903
+				errlog := &models.HisOrderError{
904
+					UserOrgId: org_id,
905
+					Ctime:     time.Now().Unix(),
906
+					Mtime:     time.Now().Unix(),
907
+					ErrMsg:    res.ErrMsg,
908
+					Status:    1,
909
+					PatientId: order_id,
910
+					Stage:     10138600,
911
+				}
912
+				service.CreateErrMsgLog(errlog)
913
+				continue
914
+			} else {
915
+				hisFundSettleListResult := &models.HisFundSettleListResult{
916
+					Number:    res.Output.SetlListId,
917
+					Status:    1,
918
+					Ctime:     time.Now().Unix(),
919
+					Mtime:     time.Now().Unix(),
920
+					UserOrgId: org_id,
921
+					IsUpload:  1,
922
+					OrderId:   order_id,
923
+				}
924
+				service.CreateUploadRecord(hisFundSettleListResult)
925
+				continue
926
+			}
927
+		}
928
+	}
929
+}
930
+
931
+func GetblpgBatchSettleList() {
932
+	org_id, _ := beego.AppConfig.Int64("org_id")
933
+	org_id = 10610
934
+	var orders []*models.HisOrder
935
+	//var orders []*models.HisOrderError
936
+	orders, _ = service.GetAllHisOrder10610()
714 937
 	for _, item := range orders {
715 938
 		order_id := item.ID
716 939
 		order, _ := service.GetHisOrderByIDTwo(order_id)
@@ -746,6 +969,8 @@ func GetblBatchSettleList() {
746 969
 			if his.BalanceAccountsType == 2 {
747 970
 				continue
748 971
 			}
972
+			ID := strconv.FormatInt(int64(order.ID), 10)
973
+
749 974
 			struct4101 := service.Struct4101{
750 975
 				PsnNo:          order.PsnNo,
751 976
 				MdtrtId:        order.MdtrtId,
@@ -765,8 +990,8 @@ func GetblBatchSettleList() {
765 990
 				HiType:         order.Insutype,
766 991
 				Insuplc:        his.InsuplcAdmdvs,
767 992
 				MaindiagFlag:   "1",
768
-				BillCode:       order.SetlId,
769
-				BillNo:         order.SetlId,
993
+				BillCode:      "000" +ID,
994
+				BillNo:        "000" +ID,
770 995
 				BizSn:          order.Number,
771 996
 				PsnSelfPay:     order.PsnPartAmt,
772 997
 				PsnOwnPay:      order.PsnPartAmt,
@@ -963,7 +1188,10 @@ func GetblbrBatchSettleList() {
963 1188
 			}
964 1189
 			if his.BalanceAccountsType == 2 {
965 1190
 				continue
1191
+
966 1192
 			}
1193
+			ID := strconv.FormatInt(int64(order.ID), 10)
1194
+
967 1195
 			struct4101 := service.Struct4101{
968 1196
 				PsnNo:          order.PsnNo,
969 1197
 				MdtrtId:        order.MdtrtId,
@@ -983,8 +1211,8 @@ func GetblbrBatchSettleList() {
983 1211
 				HiType:         order.Insutype,
984 1212
 				Insuplc:        his.InsuplcAdmdvs,
985 1213
 				MaindiagFlag:   "1",
986
-				BillCode:       order.SetlId,
987
-				BillNo:         order.SetlId,
1214
+				BillCode:      "000" +ID,
1215
+				BillNo:        "000" +ID,
988 1216
 				BizSn:          order.Number,
989 1217
 				PsnSelfPay:     order.PsnPartAmt,
990 1218
 				PsnOwnPay:      order.PsnPartAmt,

+ 106 - 98
models/models_3501.go Просмотреть файл

@@ -673,57 +673,61 @@ type Struct3511 struct {
673 673
 	Enckey         string
674 674
 }
675 675
 
676
+
677
+type Output     []struct {
678
+	ExpyEnd          string  `json:"expy_end,omitempty"`                    // 有效期止
679
+	PharCertType     string  `json:"phar_cert_type" validate:"required"`    // 药师证件类型
680
+	SelRetnOpterName string  `json:"sel_retn_opter_name,omitempty"`         // 销售/退货经办人姓名
681
+	MedListCodg      string  `json:"med_list_codg,omitempty"`               // 医疗目录编码
682
+	PoolareaNo       string  `json:"poolarea_no,omitempty"`                 // 统筹区编号
683
+	SetlId           string  `json:"setl_id,omitempty"`                     // 结算ID
684
+	CrteOptinsNo     string  `json:"crte_optins_no,omitempty"`              // 创建机构编号
685
+	MedinsListCodg   string  `json:"medins_list_codg,omitempty"`            // 医药机构目录编码
686
+	Memo             string  `json:"memo,omitempty"`                        // 备注
687
+	UpdtTime         string  `json:"updt_time,omitempty"`                   // 数据更新时间
688
+	HiFeesetlType    string  `json:"hi_feesetl_type" validate:"required"`   // 医保费用结算类型
689
+	ManuDate         string  `json:"manu_date,omitempty"`                   // 生产日期
690
+	OpterName        string  `json:"opter_name,omitempty"`                  // 经办人姓名
691
+	PsnNo            string  `json:"psn_no,omitempty"`                      // 人员编号
692
+	Rid              string  `json:"rid,omitempty"`                         // 数据唯一记录号
693
+	CrteTime         string  `json:"crte_time,omitempty"`                   // 数据创建时间
694
+	PharCertno       string  `json:"phar_certno,omitempty"`                 // 药师证件号码
695
+	ValiFlag         string  `json:"vali_flag" validate:"required"`         // 有效标志
696
+	Certno           string  `json:"certno,omitempty"`                      // 证件号码
697
+	FixmedinsCode    string  `json:"fixmedins_code" validate:"required"`    // 定点医药机构编号
698
+	RxFlag           string  `json:"rx_flag" validate:"required"`           // 处方药标志
699
+	PharPracCertNo   string  `json:"phar_prac_cert_no,omitempty"`           // 药师执业资格证号
700
+	ListSpItemFlag   string  `json:"list_sp_item_flag" validate:"required"` // 目录特项标志
701
+	FixmedinsBchno   string  `json:"fixmedins_bchno,omitempty"`             // 定点医药机构批次流水号
702
+	OptTime          string  `json:"opt_time,omitempty"`                    // 经办时间
703
+	PsnName          string  `json:"psn_name,omitempty"`                    // 人员姓名
704
+	ElecSupnCodg     string  `json:"elec_supn_codg,omitempty"`              // 电子监管编码
705
+	BilgDrName       string  `json:"bilg_dr_name,omitempty"`                // 开单医师姓名
706
+	OpterId          string  `json:"opter_id,omitempty"`                    // 经办人ID
707
+	ManuLotnum       string  `json:"manu_lotnum,omitempty"`                 // 生产批号
708
+	MedinsListName   string  `json:"medins_list_name,omitempty"`            // 医药机构目录名称
709
+	PsnCertType      string  `json:"psn_cert_type" validate:"required"`     // 人员证件类型
710
+	SelRetnTime      string  `json:"sel_retn_time,omitempty"`               // 销售/退货时间
711
+	SelRetnCnt       float64 `json:"sel_retn_cnt,omitempty"`                // 销售/退货数量
712
+	CrterName        string  `json:"crter_name,omitempty"`                  // 创建人姓名
713
+	PharName         string  `json:"phar_name,omitempty"`                   // 药师姓名
714
+	PrscDrCertType   string  `json:"prsc_dr_cert_type" validate:"required"` // 开单医师证件类型
715
+	CrterId          string  `json:"crter_id,omitempty"`                    // 创建人ID
716
+	PrscDrCertno     string  `json:"prsc_dr_certno,omitempty"`              // 开单医师证件号码
717
+	OptinsNo         string  `json:"optins_no,omitempty"`                   // 经办机构编号
718
+	TrdnFlag         string  `json:"trdn_flag" validate:"required"`         // 拆零标志
719
+	FinlTrnsPric     float64 `json:"finl_trns_pric,omitempty"`              // 最终成交单价
720
+	MedinsProdSelNo  string  `json:"medins_prod_sel_no,omitempty"`          // 定点医药机构商品销售流水号
721
+
722
+}
723
+
724
+
676 725
 type Result3511 struct {
677 726
 	Cainfo      interface{} `json:"cainfo"`
678 727
 	ErrMsg      string      `json:"err_msg"`
679 728
 	InfRefmsgid string      `json:"inf_refmsgid"`
680 729
 	Infcode     int64       `json:"infcode"`
681
-	Output      []struct {
682
-		ExpyEnd          string  `json:"expy_end,omitempty"`                    // 有效期止
683
-		PharCertType     string  `json:"phar_cert_type" validate:"required"`    // 药师证件类型
684
-		SelRetnOpterName string  `json:"sel_retn_opter_name,omitempty"`         // 销售/退货经办人姓名
685
-		MedListCodg      string  `json:"med_list_codg,omitempty"`               // 医疗目录编码
686
-		PoolareaNo       string  `json:"poolarea_no,omitempty"`                 // 统筹区编号
687
-		SetlId           string  `json:"setl_id,omitempty"`                     // 结算ID
688
-		CrteOptinsNo     string  `json:"crte_optins_no,omitempty"`              // 创建机构编号
689
-		MedinsListCodg   string  `json:"medins_list_codg,omitempty"`            // 医药机构目录编码
690
-		Memo             string  `json:"memo,omitempty"`                        // 备注
691
-		UpdtTime         string  `json:"updt_time,omitempty"`                   // 数据更新时间
692
-		HiFeesetlType    string  `json:"hi_feesetl_type" validate:"required"`   // 医保费用结算类型
693
-		ManuDate         string  `json:"manu_date,omitempty"`                   // 生产日期
694
-		OpterName        string  `json:"opter_name,omitempty"`                  // 经办人姓名
695
-		PsnNo            string  `json:"psn_no,omitempty"`                      // 人员编号
696
-		Rid              string  `json:"rid,omitempty"`                         // 数据唯一记录号
697
-		CrteTime         string  `json:"crte_time,omitempty"`                   // 数据创建时间
698
-		PharCertno       string  `json:"phar_certno,omitempty"`                 // 药师证件号码
699
-		ValiFlag         string  `json:"vali_flag" validate:"required"`         // 有效标志
700
-		Certno           string  `json:"certno,omitempty"`                      // 证件号码
701
-		FixmedinsCode    string  `json:"fixmedins_code" validate:"required"`    // 定点医药机构编号
702
-		RxFlag           string  `json:"rx_flag" validate:"required"`           // 处方药标志
703
-		PharPracCertNo   string  `json:"phar_prac_cert_no,omitempty"`           // 药师执业资格证号
704
-		ListSpItemFlag   string  `json:"list_sp_item_flag" validate:"required"` // 目录特项标志
705
-		FixmedinsBchno   string  `json:"fixmedins_bchno,omitempty"`             // 定点医药机构批次流水号
706
-		OptTime          string  `json:"opt_time,omitempty"`                    // 经办时间
707
-		PsnName          string  `json:"psn_name,omitempty"`                    // 人员姓名
708
-		ElecSupnCodg     string  `json:"elec_supn_codg,omitempty"`              // 电子监管编码
709
-		BilgDrName       string  `json:"bilg_dr_name,omitempty"`                // 开单医师姓名
710
-		OpterId          string  `json:"opter_id,omitempty"`                    // 经办人ID
711
-		ManuLotnum       string  `json:"manu_lotnum,omitempty"`                 // 生产批号
712
-		MedinsListName   string  `json:"medins_list_name,omitempty"`            // 医药机构目录名称
713
-		PsnCertType      string  `json:"psn_cert_type" validate:"required"`     // 人员证件类型
714
-		SelRetnTime      string  `json:"sel_retn_time,omitempty"`               // 销售/退货时间
715
-		SelRetnCnt       float64 `json:"sel_retn_cnt,omitempty"`                // 销售/退货数量
716
-		CrterName        string  `json:"crter_name,omitempty"`                  // 创建人姓名
717
-		PharName         string  `json:"phar_name,omitempty"`                   // 药师姓名
718
-		PrscDrCertType   string  `json:"prsc_dr_cert_type" validate:"required"` // 开单医师证件类型
719
-		CrterId          string  `json:"crter_id,omitempty"`                    // 创建人ID
720
-		PrscDrCertno     string  `json:"prsc_dr_certno,omitempty"`              // 开单医师证件号码
721
-		OptinsNo         string  `json:"optins_no,omitempty"`                   // 经办机构编号
722
-		TrdnFlag         string  `json:"trdn_flag" validate:"required"`         // 拆零标志
723
-		FinlTrnsPric     float64 `json:"finl_trns_pric,omitempty"`              // 最终成交单价
724
-		MedinsProdSelNo  string  `json:"medins_prod_sel_no,omitempty"`          // 定点医药机构商品销售流水号
725
-
726
-	} `json:"output"`
730
+	Output     Output	`json:"output"`
727 731
 	RefmsgTime  string      `json:"refmsg_time"`
728 732
 	RespondTime string      `json:"respond_time"`
729 733
 	Signtype    interface{} `json:"signtype"`
@@ -754,24 +758,27 @@ type Struct3512 struct {
754 758
 	Enckey     string
755 759
 }
756 760
 
761
+type Output2      []struct {
762
+	FixmedinsCode  string
763
+	MedinsListCodg string
764
+	FixmedinsBchno string
765
+	MedListCodg    string
766
+	MedinsListName string
767
+	DrugTracCodg   string
768
+	ValiFlag       string
769
+	OpterId        string
770
+	CrterName      string
771
+	CrterId        string
772
+	OptinsNo       string
773
+}
774
+
775
+
757 776
 type Result3512 struct {
758 777
 	Cainfo      interface{} `json:"cainfo"`
759 778
 	ErrMsg      string      `json:"err_msg"`
760 779
 	InfRefmsgid string      `json:"inf_refmsgid"`
761 780
 	Infcode     int64       `json:"infcode"`
762
-	Output      []struct {
763
-		FixmedinsCode  string
764
-		MedinsListCodg string
765
-		FixmedinsBchno string
766
-		MedListCodg    string
767
-		MedinsListName string
768
-		DrugTracCodg   string
769
-		ValiFlag       string
770
-		OpterId        string
771
-		CrterName      string
772
-		CrterId        string
773
-		OptinsNo       string
774
-	} `json:"output"`
781
+	Output    Output2 `json:"output"`
775 782
 	RefmsgTime  string      `json:"refmsg_time"`
776 783
 	RespondTime string      `json:"respond_time"`
777 784
 	Signtype    interface{} `json:"signtype"`
@@ -779,19 +786,18 @@ type Result3512 struct {
779 786
 }
780 787
 
781 788
 type Struct3513 struct {
782
-	FixmedinsCode  string `json:"fixmedins_code" validate:"required"` // 定点医药机构编号
783
-	MedinsListCodg string `json:"medins_list_codg,omitempty"`         // 医药机构目录编码
784
-	FixmedinsBchno string `json:"fixmedins_bchno,omitempty"`          // 定点医药机构批次流水号
785
-	Begndate       string `json:"begndate,omitempty"`                 // 开始日期
786
-	Enddate        string `json:"enddate,omitempty"`                  // 结束日期
787
-	MedListCodg    string `json:"med_list_codg,omitempty"`            // 医疗目录编码
788
-	MdtrtID        string `json:"mdtrt_id,omitempty"`                 // 就诊ID
789
-	PsnNo          string `json:"psn_no,omitempty"`                   // 人员编号
790
-	PsnCertType    string `json:"psn_cert_type" validate:"required"`  // 人员证件类型
791
-	Certno         string `json:"certno,omitempty"`                   // 证件号码
792
-	PsnName        string `json:"psn_name,omitempty"`                 // 人员姓名
793
-	DrugTracCodg   string `json:"drug_trac_codg,omitempty"`           // 药品追溯码
794
-
789
+	FixmedinsCode  string
790
+	MedinsListCodg string
791
+	FixmedinsBchno string
792
+	Begndate       string
793
+	Enddate        string
794
+	MedListCodg    string
795
+	MdtrtID        string
796
+	PsnNo          string
797
+	PsnCertType    string
798
+	Certno         string
799
+	PsnName        string
800
+	DrugTracCodg   string
795 801
 	OrgName        string
796 802
 	Opter          string
797 803
 	SecretKey      string
@@ -806,37 +812,39 @@ type Struct3513 struct {
806 812
 	SignKey        string
807 813
 	Enckey         string
808 814
 }
815
+type Output3     []struct {
816
+FixmedinsCode  string
817
+MedListCodg    string
818
+MedinsListCodg string
819
+MedinsListName string
820
+FixmedinsBchno string
821
+MdtrtId        string
822
+MdtrtSetlType  string
823
+BkkpSn         string
824
+DrugTracCodg   string
825
+PsnNo          string
826
+PsnCertType    string
827
+Certno         string
828
+PsnName        string
829
+Memo           string
830
+TrdnFlag       string
831
+UpdtTime       string
832
+OpterName      string
833
+Rid            string
834
+CrteTime       string
835
+OptTime        string
836
+OpterId        string
837
+CrterName      string
838
+CrterId        string
839
+OptinsNo       string
840
+}
841
+
809 842
 type Result3513 struct {
810 843
 	Cainfo      interface{} `json:"cainfo"`
811 844
 	ErrMsg      string      `json:"err_msg"`
812 845
 	InfRefmsgid string      `json:"inf_refmsgid"`
813 846
 	Infcode     int64       `json:"infcode"`
814
-	Output      []struct {
815
-		FixmedinsCode  string `json:"fixmedins_code,omitempty"`            // 定点医药机构编号
816
-		MedListCodg    string `json:"med_list_codg,omitempty"`             // 医疗目录编码
817
-		MedinsListCodg string `json:"medins_list_codg,omitempty"`          // 医药机构目录编码
818
-		MedinsListName string `json:"medins_list_name,omitempty"`          // 医药机构目录名称
819
-		FixmedinsBchno string `json:"fixmedins_bchno,omitempty"`           // 定点医药机构批次流水号
820
-		MdtrtId        string `json:"mdtrt_id,omitempty"`                  // 就诊ID
821
-		MdtrtSetlType  string `json:"mdtrt_setl_type" validate:"required"` // 就诊结算类型
822
-		BkkpSn         string `json:"bkkp_sn,omitempty"`                   // 记账流水号
823
-		DrugTracCodg   string `json:"drug_trac_codg,omitempty"`            // 药品追溯码
824
-		PsnNo          string `json:"psn_no,omitempty"`                    // 人员编号
825
-		PsnCertType    string `json:"psn_cert_type" validate:"required"`   // 人员证件类型
826
-		Certno         string `json:"certno,omitempty"`                    // 证件号码
827
-		PsnName        string `json:"psn_name,omitempty"`                  // 人员姓名
828
-		Memo           string `json:"memo,omitempty"`                      // 备注
829
-		TrdnFlag       string `json:"trdn_flag,omitempty"`                 // 拆零标志
830
-		UpdtTime       string `json:"updt_time,omitempty"`                 // 数据更新时间
831
-		OpterName      string `json:"opter_name,omitempty"`                // 经办人姓名
832
-		Rid            string `json:"rid,omitempty"`                       // 数据唯一记录号
833
-		CrteTime       string `json:"crte_time,omitempty"`                 // 数据创建时间
834
-		OptTime        string `json:"opt_time,omitempty"`                  // 经办时间
835
-		OpterId        string `json:"opter_id,omitempty"`                  // 经办人ID
836
-		CrterName      string `json:"crter_name,omitempty"`                // 创建人姓名
837
-		CrterId        string `json:"crter_id,omitempty"`                  // 创建人ID
838
-		OptinsNo       string `json:"optins_no,omitempty"`                 // 经办机构编号
839
-	} `json:"output"`
847
+	Output     Output3 `json:"output"`
840 848
 	RefmsgTime  string      `json:"refmsg_time"`
841 849
 	RespondTime string      `json:"respond_time"`
842 850
 	Signtype    interface{} `json:"signtype"`

+ 248 - 1
service/ahyb_service.go Просмотреть файл

@@ -3377,7 +3377,7 @@ func AHyb3507(struct3507 models.Struct3507) (string, string) {
3377 3377
 	input := make(map[string]interface{})
3378 3378
 	inputData := make(map[string]interface{})
3379 3379
 	inputMessage["infno"] = "3507"                          // 交易编码
3380
-	inputData["fixmedins_bchno"] = struct3507.FixmedinsCode // 人员编号 (来自1101接口返回)
3380
+	inputData["fixmedins_bchno"] = struct3507.FixmedinsBchno // 人员编号 (来自1101接口返回)
3381 3381
 	inputData["inv_data_type"] = struct3507.InvDataType     // 人员编号 (来自1101接口返回)
3382 3382
 
3383 3383
 	input["data"] = inputData
@@ -3535,6 +3535,253 @@ func AHyb3505(struct3505 models.Struct3505, secret_key string, request_url strin
3535 3535
 	return str, string(bytesData)
3536 3536
 }
3537 3537
 
3538
+
3539
+func AHyb3511(struct3511 models.Struct3511, request_url string) (string, string) {
3540
+	// 生成签名
3541
+	timestamp := time.Now().Unix()
3542
+	inputMessage := SetAHInputMessage(timestamp, struct3511.OrgName, struct3511.Opter, struct3511.FixmedinsCode, struct3511.InsuplcAdmdvs, struct3511.MdtrtareaAdmvs, struct3511.Cainfo)
3543
+	// 生成输入报文
3544
+	input := make(map[string]interface{})
3545
+	inputData := make(map[string]interface{})
3546
+	inputMessage["infno"] = "3511"
3547
+	inputData["fixmedins_code"] = struct3511.FixmedinsCode
3548
+	inputData["medins_list_codg"] = struct3511.MedListCodg
3549
+	inputData["fixmedins_bchno"] = ""
3550
+	inputData["begndate"] = struct3511.Begndate
3551
+	inputData["enddate"] = struct3511.Enddate
3552
+	inputData["medins_prod_inv_no"] = ""
3553
+	inputData["medins_list_name"] = ""
3554
+	inputData["rx_flag"] = ""
3555
+	inputData["list_sp_item_flag"] = ""
3556
+	inputData["trdn_flag"] = ""
3557
+	inputData["invdate"] = ""
3558
+	inputData["manu_lotnum"] = ""
3559
+	inputData["manu_date"] = ""
3560
+	inputData["expy_end"] = ""
3561
+	inputData["memo"] = ""
3562
+	inputData["vali_flag"] = ""
3563
+	inputData["rid"] = ""
3564
+
3565
+	inputData["crter_id"] = ""
3566
+	inputData["crter_name"] = ""
3567
+	inputData["crte_optins_no"] = ""
3568
+	inputData["opter_id"] = ""
3569
+	inputData["opter_name"] = ""
3570
+	inputData["optins_no"] = ""
3571
+	inputData["poolarea_no"] = ""
3572
+
3573
+	inputData["fixmedins_bchno"] = ""
3574
+	inputData["inv_data_type"] = ""
3575
+
3576
+	input["data"] = inputData
3577
+	inputMessage["input"] = input //交易输入
3578
+	argInputMessage := make(map[string]interface{})
3579
+	argInputMessage["arg0"] = inputMessage
3580
+
3581
+	bytesData, err := json.Marshal(inputMessage)
3582
+	fmt.Println(string(bytesData))
3583
+	if err != nil {
3584
+		fmt.Println(err.Error())
3585
+		return err.Error(), ""
3586
+	}
3587
+	reader := bytes.NewReader(bytesData)
3588
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
3589
+	request_url = request_url + "3511"
3590
+
3591
+	request, err := http.NewRequest("POST", request_url, reader)
3592
+	if err != nil {
3593
+		fmt.Println(err.Error())
3594
+		return err.Error(), ""
3595
+	}
3596
+
3597
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
3598
+
3599
+	client := http.Client{}
3600
+	resp, err := client.Do(request)
3601
+	if err != nil {
3602
+		fmt.Println(err.Error())
3603
+		return err.Error(), ""
3604
+	}
3605
+	respBytes, err := ioutil.ReadAll(resp.Body)
3606
+	if err != nil {
3607
+		fmt.Println(err.Error())
3608
+		return err.Error(), ""
3609
+	}
3610
+	str := string(respBytes)
3611
+	fmt.Println(str)
3612
+	return str, string(bytesData)
3613
+}
3614
+func AHyb3512(struct3512 models.Struct3512, request_url string) (string, string) {
3615
+	// 生成签名
3616
+	//nonce := GetRandomString(32)
3617
+	timestamp := time.Now().Unix()
3618
+	//signature := setSignature(timestamp, nonce, secret_key)
3619
+	inputMessage := SetAHInputMessage(timestamp, struct3512.OrgName, struct3512.Opter, struct3512.FixmedinsCode, struct3512.InsuplcAdmdvs, struct3512.MdtrtareaAdmvs, struct3512.Cainfo)
3620
+
3621
+	// 生成输入报文
3622
+	//inputMessage := SetGdInputMessage(timestamp, struct3512.OrgName, struct3512.Opter, struct3512.FixmedinsCode, struct3512.InsuplcAdmdvs, struct3512.MdtrtareaAdmvs, struct3512.Cainfo)
3623
+	input := make(map[string]interface{})
3624
+	inputData := make(map[string]interface{})
3625
+	inputMessage["infno"] = "3512"
3626
+	inputData["fixmedins_code"] = struct3512.FixmedinsCode
3627
+	//inputData["medins_list_codg"] = struct3512.MedinsListCodg
3628
+	inputData["medins_list_codg"] = struct3512.MedListCodg
3629
+	inputData["fixmedins_bchno"] = ""
3630
+	inputData["begndate"] = struct3512.Begndate
3631
+	inputData["enddate"] = struct3512.Enddate
3632
+	inputData["medins_prod_inv_no"] = ""
3633
+	inputData["medins_list_name"] = ""
3634
+	inputData["rx_flag"] = ""
3635
+	inputData["list_sp_item_flag"] = ""
3636
+	inputData["trdn_flag"] = ""
3637
+	inputData["invdate"] = ""
3638
+	inputData["manu_lotnum"] = ""
3639
+	inputData["manu_date"] = ""
3640
+	inputData["expy_end"] = ""
3641
+	inputData["memo"] = ""
3642
+	inputData["vali_flag"] = ""
3643
+	inputData["rid"] = ""
3644
+
3645
+	inputData["crter_id"] = ""
3646
+	inputData["crter_name"] = ""
3647
+	inputData["crte_optins_no"] = ""
3648
+	inputData["opter_id"] = ""
3649
+	inputData["opter_name"] = ""
3650
+	inputData["optins_no"] = ""
3651
+	inputData["poolarea_no"] = ""
3652
+
3653
+	inputData["fixmedins_bchno"] = ""
3654
+	inputData["inv_data_type"] = ""
3655
+
3656
+	input["data"] = inputData
3657
+	inputMessage["input"] = input //交易输入
3658
+	argInputMessage := make(map[string]interface{})
3659
+	argInputMessage["arg0"] = inputMessage
3660
+
3661
+	bytesData, err := json.Marshal(argInputMessage)
3662
+	fmt.Println(string(bytesData))
3663
+	if err != nil {
3664
+		fmt.Println(err.Error())
3665
+		return err.Error(), ""
3666
+	}
3667
+	reader := bytes.NewReader(bytesData)
3668
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
3669
+	//gdyb_url := beego.AppConfig.String("gdyb_url")
3670
+	//gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
3671
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
3672
+	//url := gdyb_url + "3505"
3673
+	request_url = request_url + "3512"
3674
+
3675
+	request, err := http.NewRequest("POST", request_url, reader)
3676
+	if err != nil {
3677
+		fmt.Println(err.Error())
3678
+		return err.Error(), ""
3679
+	}
3680
+
3681
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
3682
+
3683
+	client := http.Client{}
3684
+	resp, err := client.Do(request)
3685
+	if err != nil {
3686
+		fmt.Println(err.Error())
3687
+		return err.Error(), ""
3688
+	}
3689
+	respBytes, err := ioutil.ReadAll(resp.Body)
3690
+	if err != nil {
3691
+		fmt.Println(err.Error())
3692
+		return err.Error(), ""
3693
+	}
3694
+	str := string(respBytes)
3695
+	fmt.Println(str)
3696
+	return str, string(bytesData)
3697
+}
3698
+
3699
+func AHyb3513(struct3513 models.Struct3513, request_url string) (string, string) {
3700
+	// 生成签名
3701
+	//nonce := GetRandomString(32)
3702
+	timestamp := time.Now().Unix()
3703
+	//signature := setSignature(timestamp, nonce, secret_key)
3704
+	inputMessage := SetAHInputMessage(timestamp, struct3513.OrgName, struct3513.Opter, struct3513.FixmedinsCode, struct3513.InsuplcAdmdvs, struct3513.MdtrtareaAdmvs, struct3513.Cainfo)
3705
+
3706
+	// 生成输入报文
3707
+	//inputMessage := SetGdInputMessage(timestamp, struct3512.OrgName, struct3512.Opter, struct3512.FixmedinsCode, struct3512.InsuplcAdmdvs, struct3512.MdtrtareaAdmvs, struct3512.Cainfo)
3708
+	input := make(map[string]interface{})
3709
+	inputData := make(map[string]interface{})
3710
+	inputMessage["infno"] = "3513"
3711
+	inputData["fixmedins_code"] = struct3513.FixmedinsCode
3712
+	//inputData["medins_list_codg"] = struct3512.MedinsListCodg
3713
+	inputData["medins_list_codg"] = struct3513.MedListCodg
3714
+	inputData["fixmedins_bchno"] = ""
3715
+	inputData["begndate"] = struct3513.Begndate
3716
+	inputData["enddate"] = struct3513.Enddate
3717
+	inputData["medins_prod_inv_no"] = ""
3718
+	inputData["medins_list_name"] = ""
3719
+	inputData["rx_flag"] = ""
3720
+	inputData["list_sp_item_flag"] = ""
3721
+	inputData["trdn_flag"] = ""
3722
+	inputData["invdate"] = ""
3723
+	inputData["manu_lotnum"] = ""
3724
+	inputData["manu_date"] = ""
3725
+	inputData["expy_end"] = ""
3726
+	inputData["memo"] = ""
3727
+	inputData["vali_flag"] = ""
3728
+	inputData["rid"] = ""
3729
+
3730
+	inputData["crter_id"] = ""
3731
+	inputData["crter_name"] = ""
3732
+	inputData["crte_optins_no"] = ""
3733
+	inputData["opter_id"] = ""
3734
+	inputData["opter_name"] = ""
3735
+	inputData["optins_no"] = ""
3736
+	inputData["poolarea_no"] = ""
3737
+
3738
+	inputData["fixmedins_bchno"] = ""
3739
+	inputData["inv_data_type"] = ""
3740
+
3741
+	input["data"] = inputData
3742
+	inputMessage["input"] = input //交易输入
3743
+	argInputMessage := make(map[string]interface{})
3744
+	argInputMessage["arg0"] = inputMessage
3745
+
3746
+	bytesData, err := json.Marshal(argInputMessage)
3747
+	fmt.Println(string(bytesData))
3748
+	if err != nil {
3749
+		fmt.Println(err.Error())
3750
+		return err.Error(), ""
3751
+	}
3752
+	reader := bytes.NewReader(bytesData)
3753
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
3754
+	//gdyb_url := beego.AppConfig.String("gdyb_url")
3755
+	//gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
3756
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
3757
+	//url := gdyb_url + "3505"
3758
+	request_url = request_url + "3513"
3759
+
3760
+	request, err := http.NewRequest("POST", request_url, reader)
3761
+	if err != nil {
3762
+		fmt.Println(err.Error())
3763
+		return err.Error(), ""
3764
+	}
3765
+
3766
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
3767
+
3768
+	client := http.Client{}
3769
+	resp, err := client.Do(request)
3770
+	if err != nil {
3771
+		fmt.Println(err.Error())
3772
+		return err.Error(), ""
3773
+	}
3774
+	respBytes, err := ioutil.ReadAll(resp.Body)
3775
+	if err != nil {
3776
+		fmt.Println(err.Error())
3777
+		return err.Error(), ""
3778
+	}
3779
+	str := string(respBytes)
3780
+	fmt.Println(str)
3781
+	return str, string(bytesData)
3782
+}
3783
+
3784
+
3538 3785
 func AHyb5101(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string,  request_url string, cainfo string) (string, string) {
3539 3786
 	fmt.Println(request_url)
3540 3787
 

+ 26 - 16
service/fj_service.go Просмотреть файл

@@ -3019,27 +3019,37 @@ func FJyb3501(struct3501 models.Struct3501) (string, string, string) {
3019 3019
 
3020 3020
 	// 生成输入报文
3021 3021
 	//SetFjInputMessage
3022
-	inputMessage := SetFjInputMessage(nonce, timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsHilistId, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Url, struct3501.AppId, struct3501.AppSecret, struct3501.SignKey, struct3501.Enckey)
3022
+	inputMessage := SetFjInputMessage(nonce, timestamp, struct3501.OrgName, struct3501.Opter, struct3501.Code, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Url, struct3501.AppId, struct3501.AppSecret, struct3501.SignKey, struct3501.Enckey)
3023 3023
 	input := make(map[string]interface{})
3024 3024
 	inputData := make(map[string]interface{})
3025
-	druginputData := make(map[string]interface{})
3025
+	//druginputData := make(map[string]interface{})
3026 3026
 	//druginputData2 := make(map[string]interface{})
3027 3027
 
3028 3028
 	inputMessage["infno"] = "3501"                                  // 交易编码
3029
-	inputData["med_list_codg"] = struct3501.MedListCodg             // 定点医药机构目录编号
3030
-	inputData["fixmedins_hilist_id"] = struct3501.FixmedinsHilistId // 定点医药机构目录编号
3031
-	inputData["fixmedins_hilist_name"] = struct3501.OrgName         // 定点医药机构目录名称
3032
-	inputData["rx_flag"] = struct3501.RxFlag                        //
3033
-	inputData["invdate"] = struct3501.Invdate                       // 人员编号 (来自1101接口返回)
3034
-	inputData["inv_cnt"] = struct3501.InvCnt                        // 人员编号 (来自1101接口返回)
3035
-	inputData["manu_lotnum"] = struct3501.ManuLotnum                // 人员编号 (来自1101接口返回)
3036
-	inputData["fixmedins_bchno"] = struct3501.FixmedinsBchno        // 人员编号 (来自1101接口返回)
3037
-	inputData["manu_date"] = struct3501.ManuDate                    // 人员编号 (来自1101接口返回)
3038
-	inputData["expy_end"] = struct3501.ExpyEnd                      // 人员编号 (来自1101接口返回)
3039
-	inputData["memo"] = struct3501.Memo                             // 人员编号 (来自1101接口返回)
3040
-	druginputData["drug_trac_codg"] = struct3501.DrugTracCodg
3041
-	//druginputData2["drugtracinfo"] = druginputData
3042
-	inputData["drug_trac_info"] = druginputData
3029
+	inputData["med_list_codg"] = struct3501.MedListCodg                 // 定点医药机构目录编号
3030
+	inputData["fixmedins_hilist_id"] = struct3501.FixmedinsHilistId     // 定点医药机构目录编号
3031
+	inputData["fixmedins_hilist_name"] = struct3501.FixmedinsHilistName // 定点医药机构目录名称
3032
+	inputData["rx_flag"] = struct3501.RxFlag                            //
3033
+	inputData["invdate"] = struct3501.Invdate                           // 人员编号 (来自1101接口返回)
3034
+	inputData["inv_cnt"] = struct3501.InvCnt                            // 人员编号 (来自1101接口返回)
3035
+	inputData["manu_lotnum"] = struct3501.ManuLotnum                    // 人员编号 (来自1101接口返回)
3036
+	inputData["fixmedins_bchno"] = struct3501.FixmedinsBchno            // 人员编号 (来自1101接口返回)
3037
+	inputData["manu_date"] = struct3501.ManuDate                        // 人员编号 (来自1101接口返回)
3038
+	inputData["expy_end"] = struct3501.ExpyEnd                          // 人员编号 (来自1101接口返回)
3039
+	inputData["memo"] = ""                              // 人员编号 (来自1101接口返回)
3040
+
3041
+	feedetail := make([]map[string]interface{}, 0)
3042
+
3043
+	codes := strings.Split(struct3501.DrugTracCodg, ",")
3044
+	for _, item := range codes {
3045
+		if len(item) > 0 {
3046
+
3047
+			druginputData := make(map[string]interface{})
3048
+			druginputData["drug_trac_codg"] =  removeNonDigits(item)
3049
+			feedetail = append(feedetail, druginputData)
3050
+		}
3051
+	}
3052
+	inputData["drugtracinfo"] = feedetail
3043 3053
 	input["invinfo"] = inputData
3044 3054
 	inputMessage["input"] = input //交易输入
3045 3055
 	bytesData, err := json.Marshal(inputMessage)

+ 1 - 1
service/gdyb_zifei_service.go Просмотреть файл

@@ -502,7 +502,7 @@ func Gdyb4205(org_name string, doctor string, fixmedins_code string, insuplc_adm
502 502
 		inputData["prd_days"] = ""
503 503
 		inputData["medc_way_dscr"] = ""
504 504
 		inputData["memo"] = item.Memo
505
-		inputData["fulamt_ownpay_amt"] = ""
505
+		inputData["fulamt_ownpay_amt"] =  item.DetItemFeeSumamt
506 506
 		inputData["overlmt_selfpay"] = ""
507 507
 		inputData["preselfpay_amt"] = ""
508 508
 		inputData["inscp_amt"] = ""

+ 38 - 6
service/his_service.go Просмотреть файл

@@ -1570,7 +1570,12 @@ func GetAllHisOrder10106(org_id int64) (his []*models.HisOrder, err error) {
1570 1570
 	return
1571 1571
 }
1572 1572
 func GetAllHisOrder10138() (his []*models.HisOrder, err 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
1573
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 9504  AND status = 1  AND  order_status = 2 AND  setl_id <> '' AND setl_time >= '2025-02-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1574
+	fmt.Println(err)
1575
+	return
1576
+}
1577
+func GetAllHisOrder10610() (his []*models.HisOrder, err error) {
1578
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10610  AND status = 1  AND  order_status = 2 AND  setl_id <> '' AND setl_time >= '2025-01-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1574 1579
 	fmt.Println(err)
1575 1580
 	return
1576 1581
 }
@@ -1581,7 +1586,7 @@ func GetOrderError10138() (order []*models.HisOrderError, err error) {
1581 1586
 
1582 1587
 func GetAllHisOrder10278() (his []*models.HisOrder, err error) {
1583 1588
 
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
1589
+	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10278  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2025-01-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1585 1590
 	fmt.Println(err)
1586 1591
 	return
1587 1592
 }
@@ -1735,8 +1740,11 @@ func UpDatePrescriptionNumber222(user_org_id int64, id int64, number string, pat
1735 1740
 	return
1736 1741
 }
1737 1742
 
1738
-func GetAllHisOrderTwo10485() (his []*models.HisOrder, err error) {
1739
-	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10485  AND status = 1  AND  order_status = 2 AND setl_id <> '' AND  setl_time >= '2024-01-01 00:00:00' ").Order("setl_time asc").Find(&his).Error
1743
+func GetAllHisOrderTwo10485(start, end string) (his []*models.HisOrder, err error) {
1744
+	start = start + " 00:00:00"
1745
+	end = end + " 23:00:00"
1746
+
1747
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10633  AND status = 1  AND  order_status = 2 AND setl_id <> '' AND  setl_time >= ? and setl_time <= ? ",start,end).Order("setl_time asc").Find(&his).Error
1740 1748
 	fmt.Println(err)
1741 1749
 	return
1742 1750
 }
@@ -1806,7 +1814,12 @@ func GetNewDrugFlowInforTenone(start_system_time int64, end_system_time int64, o
1806 1814
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1807 1815
 	return
1808 1816
 }
1809
-
1817
+func GetNewDrugFlowInforTentwo(start_system_time int64, end_system_time int64, org_id int64) (flows []*models.DrugFlow, err error) {
1818
+	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.sale_date = ?", org_id,"2025-03-02").Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1819
+		return db.Where("status = 1 and drug_code <> ''").Preload("BaseDrugLib", "status=1")
1820
+	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1821
+	return
1822
+}
1810 1823
 func GetHisPrescriptionByID(id int64) (pre models.HisPrescription) {
1811 1824
 	err = readDb.Model(&models.HisPrescription{}).Where("id = ? and status = 1", id).Find(&pre).Error
1812 1825
 	return
@@ -1838,7 +1851,26 @@ func SaveDF2(df *models.DrugFlow) (err error) {
1838 1851
 	return
1839 1852
 }
1840 1853
 func GetDrugByID(drug_id int64) (drug models.BaseDrugLib, err error) {
1841
-	err = readDb.Model(&models.BaseDrugLib{}).Where("id = ?", drug_id).First(&drug).Error
1854
+
1855
+		err = readDb.Model(&models.BaseDrugLib{}).Where("id = ?", drug_id).Find(&drug).Error
1856
+
1857
+
1858
+	return
1859
+}
1860
+
1861
+func GetDrugByIDTwo(drug_id int64,org_id int64) (drug []models.BaseDrugLib, err error) {
1862
+	if drug_id == 0{
1863
+		err = readDb.Model(&models.BaseDrugLib{}).Where("org_id = ?", org_id).Find(&drug).Error
1864
+
1865
+	}else{
1866
+		err = readDb.Model(&models.BaseDrugLib{}).Where("id = ?", drug_id).Find(&drug).Error
1867
+
1868
+
1869
+	}
1870
+	return
1871
+}
1872
+func GetSaleDate(id string) (flow models.DrugFlow) {
1873
+	 readDb.Model(&models.DrugFlow{}).Where("id = ?",id).First(&flow)
1842 1874
 	return
1843 1875
 }
1844 1876
 

+ 3 - 1
service/hn_service.go Просмотреть файл

@@ -1984,8 +1984,10 @@ func Hnyb3505(struct3505 models.Struct3505) (string, string) {
1984 1984
 		fmt.Println(err.Error())
1985 1985
 		return err.Error(), ""
1986 1986
 	}
1987
+	timestamp2 := time.Now().UnixNano() / int64(time.Millisecond)
1988
+
1987 1989
 	struct3505.RequestUrl = struct3505.RequestUrl + "3505"
1988
-	return HNHttpRequest(struct3505.RequestUrl, struct3505.AccessKey, struct3505.SecretKey, timestamp, string(bytesData), "3505"), string(bytesData)
1990
+	return HNHttpRequest(struct3505.RequestUrl, struct3505.AccessKey, struct3505.SecretKey, timestamp2, string(bytesData), "3505"), string(bytesData)
1989 1991
 
1990 1992
 }
1991 1993
 

+ 1 - 1
service/jsyb_service.go Просмотреть файл

@@ -1710,7 +1710,7 @@ func Jsyb4101(struct4101 Struct4101, params models.PublicParams) (string, string
1710 1710
 	// 生成输入报文
1711 1711
 	input := make(map[string]interface{})
1712 1712
 	inputData := make(map[string]interface{})
1713
-	inputMessage["infno"] = "4101A" // 交易编码
1713
+	inputMessage["infno"] = "4101" // 交易编码
1714 1714
 	year := time.Now().Format("2006")
1715 1715
 	month := time.Now().Format("01")
1716 1716
 	day := time.Now().Format("02")

+ 58 - 63
service/jx_service.go Просмотреть файл

@@ -1962,6 +1962,62 @@ func JXyb3505(struct3505 models.Struct3505, secret_key string, ak string,request
1962 1962
 }
1963 1963
 
1964 1964
 
1965
+func JXyb3513(struct3513 models.Struct3513, secret_key string, ak string,request_url string) (string, string) {
1966
+	// 生成签名
1967
+	timestamp := time.Now().Unix()
1968
+
1969
+	// 生成输入报文
1970
+	inputMessage := SetGdInputMessage(timestamp, struct3513.OrgName, struct3513.Opter, struct3513.FixmedinsCode, struct3513.InsuplcAdmdvs, struct3513.MdtrtareaAdmvs, struct3513.Cainfo)
1971
+	input := make(map[string]interface{})
1972
+	inputData := make(map[string]interface{})
1973
+	inputMessage["infno"] = "3513"
1974
+	inputData["fixmedins_code"] = struct3513.FixmedinsCode
1975
+	//inputData["medins_list_codg"] = struct3513.MedinsListCodg
1976
+	inputData["medins_list_codg"] = struct3513.MedListCodg
1977
+
1978
+	inputData["fixmedins_bchno"] = ""
1979
+	inputData["begndate"] = struct3513.Begndate
1980
+	inputData["enddate"] = struct3513.Enddate
1981
+	inputData["medins_prod_inv_no"] = ""
1982
+	inputData["med_list_codg"] = ""
1983
+	inputData["medins_list_name"] = ""
1984
+	inputData["rx_flag"] = ""
1985
+	inputData["list_sp_item_flag"] = ""
1986
+	inputData["trdn_flag"] = ""
1987
+	inputData["invdate"] = ""
1988
+	inputData["manu_lotnum"] = ""
1989
+	inputData["manu_date"] = ""
1990
+	inputData["expy_end"] = ""
1991
+	inputData["memo"] = ""
1992
+	inputData["vali_flag"] = ""
1993
+	inputData["rid"] = ""
1994
+
1995
+	inputData["crter_id"] = ""
1996
+	inputData["crter_name"] = ""
1997
+	inputData["crte_optins_no"] = ""
1998
+	inputData["opter_id"] = ""
1999
+	inputData["opter_name"] = ""
2000
+	inputData["optins_no"] = ""
2001
+	inputData["poolarea_no"] = ""
2002
+
2003
+	inputData["fixmedins_bchno"] = ""
2004
+	inputData["inv_data_type"] = ""
2005
+
2006
+	input["data"] = inputData
2007
+	inputMessage["input"] = input //交易输入
2008
+
2009
+	bytesData, err := json.Marshal(inputMessage)
2010
+	requestLog := string(bytesData)
2011
+	if err != nil {
2012
+		fmt.Println(err.Error())
2013
+		return err.Error(), ""
2014
+	}
2015
+	request_url = request_url + "3513"
2016
+	return JXHttpRequest(request_url, ak, secret_key, timestamp, string(bytesData), "3513"), requestLog
2017
+
2018
+}
2019
+
2020
+
1965 2021
 //CBS总线
1966 2022
 func JXHttpRequest(url string, ak string, sk string, timestamp int64, json string, infno string) string {
1967 2023
 	fmt.Println(url)
@@ -2124,7 +2180,7 @@ func Jxyb3201(fixmedins_setl_cnt int64,  stmt_begndate string, stmt_enddate stri
2124 2180
 	inputMessage["infno"] = "3201"                       // 交易编码
2125 2181
 	inputData["insutype"] = insutype                     // 险种
2126 2182
 	inputData["clr_type"] = clr_type                     // 就诊 ID(来自2201接口返回)
2127
-	inputData["setl_optins"] = "360302"               // 结算经办机构
2183
+	inputData["setl_optins"] = "360102"               // 结算经办机构
2128 2184
 	inputData["stmt_begndate"] = stmt_begndate           // 对帐开始时间
2129 2185
 	inputData["stmt_enddate"] = stmt_enddate             //对帐结束时间
2130 2186
 	inputData["medfee_sumamt"] = medfee_sumamt           //医疗费总额
@@ -2932,68 +2988,7 @@ func Jxyb3504(struct3504 models.Struct3504) (string, string) {
2932 2988
 
2933 2989
 }
2934 2990
 
2935
-func Jxyb3505(struct3505 models.Struct3505) (string, string) {
2936
-	timestamp := time.Now().Unix()
2937
-	// 生成输入报文
2938
-	inputMessage := SetJXInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsCode, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
2939
-	input := make(map[string]interface{})
2940
-	inputData := make(map[string]interface{})
2941
-	inputMessage["infno"] = "3505"                              // 交易编码
2942
-	inputData["med_list_codg"] = struct3505.MedListCodg         // 定点医药机构目录编号
2943
-	inputData["fixmedins_hilist_id"] = struct3505.FixmedinsCode // 定点医药机构目录编号
2944
-	inputData["fixmedins_hilist_name"] = struct3505.OrgName     // 定点医药机构目录名称
2945
-	inputData["fixmedins_bchno"] = struct3505.FixmedinsCode     // 人员编号 (来自1101接口返回)
2946
-
2947
-	inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
2948
-	inputData["prsc_dr_certno"] = struct3505.PrscDrCertno      // 人员编号 (来自1101接口返回)
2949
-	inputData["prsc_dr_name"] = struct3505.PrscDrName          // 人员编号 (来自1101接口返回)
2950
-	inputData["phar_cert_type"] = struct3505.PharCertType      // 人员编号 (来自1101接口返回)
2951
-	inputData["phar_certno"] = struct3505.PharCertno           // 人员编号 (来自1101接口返回)
2952
-
2953
-	inputData["phar_name"] = struct3505.PharName               // 人员编号 (来自1101接口返回)
2954
-	inputData["phar_prac_cert_no"] = struct3505.PharPracCertNo // 人员编号 (来自1101接口返回)
2955
-	inputData["hi_feesetl_type"] = struct3505.HiFeesetlType    // 人员编号 (来自1101接口返回)
2956
-	inputData["setl_id"] = struct3505.SetlId                   // 人员编号 (来自1101接口返回)
2957
-	inputData["mdtrt_sn"] = struct3505.MdtrtSn                 // 人员编号 (来自1101接口返回)
2958
-	inputData["psn_no"] = struct3505.PsnNo                     // 人员编号 (来自1101接口返回)
2959
-	inputData["psn_cert_type"] = struct3505.PsnCertType        // 人员编号 (来自1101接口返回)
2960
-	inputData["certno"] = struct3505.CertNo                    // 人员编号 (来自1101接口返回)
2961
-	inputData["psn_name"] = struct3505.PsnName                 // 人员编号 (来自1101接口返回)
2962
-	inputData["manu_lotnum"] = struct3505.ManuLotnum           // 人员编号 (来自1101接口返回)
2963
-	inputData["manu_date"] = struct3505.ManuDate               // 人员编号 (来自1101接口返回)
2964
-	inputData["expy_end"] = struct3505.ExpyEnd                 // 人员编号 (来自1101接口返回)
2965
-
2966
-	inputData["rx_flag"] = struct3505.RxFlag     // 人员编号 (来自1101接口返回)
2967
-	inputData["trdn_flag"] = struct3505.TrdnFlag // 人员编号 (来自1101接口返回)
2968
-
2969
-	inputData["finl_trns_pric"] = struct3505.FinlTrnsPric // 人员编号 (来自1101接口返回)
2970
-	inputData["rxno"] = struct3505.Rxno                   // 人员编号 (来自1101接口返回)
2971
-	inputData["rx_circ_flag"] = struct3505.RxCircFlag     // 人员编号 (来自1101接口返回)
2972
-
2973
-	inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
2974
-	inputData["stoout_no"] = struct3505.StooutNo   // 人员编号 (来自1101接口返回)
2975 2991
 
2976
-	inputData["bchno"] = struct3505.Bchno                          // 人员编号 (来自1101接口返回)
2977
-	inputData["drug_trac_codg"] = struct3505.DrugTracCodg          // 人员编号 (来自1101接口返回)
2978
-	inputData["drug_prod_barc"] = struct3505.DrugProdBarc          // 人员编号 (来自1101接口返回)
2979
-	inputData["shelf_posi"] = struct3505.ShelfPosi                 // 人员编号 (来自1101接口返回)
2980
-	inputData["sel_retn_cnt"] = struct3505.SelRetnCnt              // 人员编号 (来自1101接口返回)
2981
-	inputData["sel_retn_time"] = struct3505.SelRetnTime            // 人员编号 (来自1101接口返回)
2982
-	inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
2983
-	inputData["memo"] = struct3505.Memo                            // 人员编号 (来自1101接口返回)
2984
-	input["selinfo"] = inputData
2985
-	inputMessage["input"] = input //交易输入
2986
-
2987
-	bytesData, err := json.Marshal(inputMessage)
2988
-	fmt.Println(string(bytesData))
2989
-	if err != nil {
2990
-		fmt.Println(err.Error())
2991
-		return err.Error(), ""
2992
-	}
2993
-	struct3505.RequestUrl = struct3505.RequestUrl + "3505"
2994
-	return JXHttpRequest(struct3505.RequestUrl, struct3505.AccessKey, struct3505.SecretKey, timestamp, string(bytesData), "3505"), string(bytesData)
2995
-
2996
-}
2997 2992
 func Jxyb3506(struct3506 models.Struct3506) (string, string) {
2998 2993
 	timestamp := time.Now().Unix()
2999 2994
 	// 生成输入报文
@@ -3044,7 +3039,7 @@ func Jxyb3507(struct3507 models.Struct3507) (string, string) {
3044 3039
 	input := make(map[string]interface{})
3045 3040
 	inputData := make(map[string]interface{})
3046 3041
 	inputMessage["infno"] = "3507"                          // 交易编码
3047
-	inputData["fixmedins_bchno"] = struct3507.FixmedinsCode // 人员编号 (来自1101接口返回)
3042
+	inputData["fixmedins_bchno"] = struct3507.FixmedinsBchno // 人员编号 (来自1101接口返回)
3048 3043
 	inputData["inv_data_type"] = struct3507.InvDataType     // 人员编号 (来自1101接口返回)
3049 3044
 
3050 3045
 	input["data"] = inputData