test_user 1 个月前
父节点
当前提交
0f1366a979
共有 4 个文件被更改,包括 57 次插入118 次删除
  1. 50 114
      controllers/sg/his_api_controller.go
  2. 1 0
      controllers/zh/zh_his_api_controller.go
  3. 1 1
      main.go
  4. 5 3
      service/gdyb_service.go

+ 50 - 114
controllers/sg/his_api_controller.go 查看文件

@@ -34,6 +34,8 @@ import (
34 34
 	"syscall"
35 35
 	"time"
36 36
 	"unsafe"
37
+	"github.com/go-ole/go-ole"
38
+
37 39
 )
38 40
 
39 41
 type HisApiController struct {
@@ -674,7 +676,7 @@ func (c *HisApiController) FJ3501AND3502() {
674 676
 	//库盘
675 677
 	var errs []string
676 678
 	for _, drug := range drugs {
677
-		if drug.IsPc == 0 && drug.IsBg == 0 {
679
+		if drug.IsPc == 0 {
678 680
 			var res2 ResultSix
679 681
 			var res3 ResultSix
680 682
 
@@ -1058,108 +1060,7 @@ func (c *HisApiController) FJ3501AND3502() {
1058 1060
 			}
1059 1061
 		}
1060 1062
 		//变更
1061
-		if drug.IsPc == 1 && drug.IsBg == 0 {
1062
-			var res3 ResultSix
1063
-			bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(drug.ID, 10) + "-" + "3502"
1064
-
1065
-			var struct3502 models.Struct3502
1066
-			struct3502.MedListCodg = drug.BaseDrugLib.MedicalInsuranceNumber
1067
-			struct3502.FixmedinsHilistId = drug.BaseDrugLib.MedicalInsuranceNumber
1068
-			struct3502.FixmedinsHilistName = drug.BaseDrugLib.DrugName
1069
-			struct3502.FixmedinsCode = miConfig.Code
1070
-			struct3502.Code = miConfig.Code
1071
-
1072
-			struct3502.Opter = roles.UserName
1073
-			struct3502.RxFlag = "0"
1074
-			struct3502.InvChgTime = time.Now().Format("2006-01-02")
1075
-			struct3502.OrgName = miConfig.OrgName
1076
-			struct3502.AccessKey = miConfig.AccessKey
1077
-			struct3502.RequestUrl = miConfig.Url
1078
-			struct3502.SecretKey = miConfig.SecretKey
1079
-			struct3502.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
1080
-			struct3502.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
1081
-			struct3502.InvChgType = "108"
1082
-			struct3502.DrugTracCodg = drug.DrugCode
1083
-
1084
-			struct3502.Url = miConfig.Url
1085
-			struct3502.AppId = miConfig.Cainfo
1086
-			struct3502.AppSecret = miConfig.AppSecret
1087
-			struct3502.Enckey = miConfig.EncKey
1088
-			struct3502.SignKey = miConfig.SignKey
1089
-			struct3502.SecretKey = miConfig.SecretKey
1090
-
1091
-			struct3502.FixmedinsBchno = bg_number
1092
-			struct3502.Cnt = strconv.FormatInt(drug.WarehousingCount, 10)
1093
-			struct3502.Pric = fmt.Sprintf("%.2f", drug.BaseDrugLib.RetailPrice)
1094
-
1095
-			if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "350") {
1096
-				result1, result2, _ := service.FJyb3502(struct3502)
1097
-				saveLog(result1, result2, "3502", "3502")
1098
-				var respJSON3 map[string]interface{}
1099
-				if err := json.Unmarshal([]byte(string(result1)), &respJSON3); err != nil {
1100
-					utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1101
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1102
-					return
1103
-				}
1104
-				userJSONBytes3, _ := json.Marshal(respJSON3)
1105
-				if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
1106
-					utils.ErrorLog("解析失败:%v", err)
1107
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1108
-					return
1109
-				}
1110
-			} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "320") {
1111
-				data := make(map[string]interface{})
1112
-				data["struct_3502s"] = struct3502
1113
-				client := &http.Client{}
1114
-				bytesData, _ := json.Marshal(data)
1115
-				var req *http.Request
1116
-				if miConfig.MdtrtareaAdmvs == "320921" {
1117
-					req, _ = http.NewRequest("POST", "http://192.168.2.3:9532/"+"jsyb/3502", bytes.NewReader(bytesData))
1118
-				} else {
1119
-					req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3502", bytes.NewReader(bytesData))
1120
-				}
1121
-				resp, _ := client.Do(req)
1122
-				defer resp.Body.Close()
1123
-				body, ioErr := ioutil.ReadAll(resp.Body)
1124
-				if ioErr != nil {
1125
-					utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
1126
-				}
1127
-				var respJSON map[string]interface{}
1128
-				if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
1129
-					utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1130
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1131
-					return
1132
-				}
1133
-				var resSix10265 ResultSix10265 //1101结果
1134
-				respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
1135
-				result, _ := json.Marshal(respJSON)
1136
-				if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
1137
-					utils.ErrorLog("解析失败:%v", err)
1138
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1139
-					return
1140
-				}
1141
-				res3.InfRefmsgid = resSix10265.InfRefmsgid
1142
-				res3.Output = resSix10265.Output
1143
-				res3.ErrMsg = resSix10265.ErrMsg
1144
-				res3.Cainfo = resSix10265.Cainfo
1145
-				res3.WarnMsg = resSix10265.WarnMsg
1146
-				infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
1147
-				res3.Infcode = infocode
1148
-			} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "150") {
1149
-
1150
-			} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "340") {
1151
-
1152
-			} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "420") {
1153 1063
 
1154
-			}
1155
-			if res3.Infcode == -1 {
1156
-				errs = append(errs, "变更"+drug.BaseDrugLib.DrugName+",出错:"+res3.ErrMsg)
1157
-			} else {
1158
-				drug.IsBg = 1
1159
-				drug.BgBchno = bg_number
1160
-				service.SaveW(drug)
1161
-			}
1162
-		}
1163 1064
 	}
1164 1065
 
1165 1066
 	if len(errs) == 0 {
@@ -19081,7 +18982,7 @@ func (c *HisApiController) TestGetJiangXiBasBaseInit() {
19081 18982
 	Iinit := DllDef.MustFindProc("Init")
19082 18983
 	//miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
19083 18984
 	//http://10.77.211.236/CSB/hsa-fsi-1303
19084
-	ret, _, err := Iinit.Call(StrPtr("http://10.77.224.18:9001/1.0.0/agent-card-init"), StrPtr("360302"))
18985
+	ret, _, err := Iinit.Call(StrPtr("http://10.77.211.236/1.0.0/agent-card-init"), StrPtr("360302"))
19085 18986
 	if ret != 0 {
19086 18987
 		fmt.Println("SSCard的报错原因:", err)
19087 18988
 		fmt.Println("SSCard的运算结果为:", ret)
@@ -27297,10 +27198,33 @@ func (c *HisApiController) GetRegisterInfo() {
27297 27198
 							return
27298 27199
 						}
27299 27200
 					} else {
27201
+
27202
+						psn_info, _ := service.GetPsnByPatientId(id)
27203
+
27204
+						var rf []*ResultFive
27205
+						json.Unmarshal([]byte(psn_info.Insuinfo), &rf)
27206
+						//var insutypes []*ResultFive
27207
+						var insutype string
27208
+						if social_type > 0 {
27209
+							insutype = strconv.FormatInt(social_type, 10)
27210
+						}
27211
+
27212
+						for _, item := range rf {
27213
+						if item.Insutype == insutype{
27214
+							insuplc_admdvs_temp = item.InsuplcAdmdvs
27215
+						}
27216
+
27217
+
27218
+						}
27219
+
27220
+
27221
+
27300 27222
 						result, requestLog = service.Gdyb2201A(psn_info.PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, insuplc_admdvs_temp, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, record_time_two, psn_info.VerifyNumber, admin_user_id)
27301 27223
 						saveLog(result, requestLog, "2201A", "挂号")
27302 27224
 					}
27303 27225
 
27226
+
27227
+
27304 27228
 					if miConfig.Code == "H15049901371" {
27305 27229
 
27306 27230
 						if err := json.Unmarshal([]byte(result), &resThree10265); err != nil {
@@ -29519,6 +29443,14 @@ func (c *HisApiController) GetUploadInfo() {
29519 29443
 									order.ClrType = "9903"
29520 29444
 								}
29521 29445
 							}
29446
+
29447
+							if adminUser.CurrentOrgId == 10721 {
29448
+								if strings.Contains(his.InsuplcAdmdvs, "3406") {
29449
+									order.ClrType = "11"
29450
+								} else {
29451
+									order.ClrType = "9903"
29452
+								}
29453
+							}
29522 29454
 							order.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
29523 29455
 							order.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
29524 29456
 							order.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
@@ -30383,12 +30315,6 @@ func (c *HisApiController) GetUploadInfo() {
30383 30315
 				res.Output.Setlinfo.Certno = ahres.Output.Setlinfo.Certno
30384 30316
 				res.Output.Setlinfo.ClrOptins = ahres.Output.Setlinfo.ClrOptins
30385 30317
 
30386
-				if strings.Contains(his.InsuplcAdmdvs, "3412") {
30387
-					res.Output.Setlinfo.ClrType = "11"
30388
-				} else {
30389
-					res.Output.Setlinfo.ClrType = "9903"
30390
-				}
30391
-
30392 30318
 				res.Output.Setlinfo.ClrWay = ahres.Output.Setlinfo.ClrOptins
30393 30319
 				res.Output.Setlinfo.CvlservFlag = ahres.Output.Setlinfo.ClrOptins
30394 30320
 				res.Output.Setlinfo.CvlservPay = ahres.Output.Setlinfo.CvlservPay
@@ -30435,6 +30361,14 @@ func (c *HisApiController) GetUploadInfo() {
30435 30361
 				res.WarnMsg = ahres.WarnMsg
30436 30362
 				res.Infcode = ahres.Infcode
30437 30363
 
30364
+
30365
+				if strings.Contains(his.InsuplcAdmdvs, "3412") {
30366
+					res.Output.Setlinfo.ClrType = "11"
30367
+				} else {
30368
+					res.Output.Setlinfo.ClrType = "9903"
30369
+				}
30370
+
30371
+
30438 30372
 			} else if miConfig.MdtrtareaAdmvs == "340699" {
30439 30373
 
30440 30374
 				psn_info, _ := service.GetPsnByPatientId(his.PatientId)
@@ -30555,11 +30489,7 @@ func (c *HisApiController) GetUploadInfo() {
30555 30489
 				res.Output.Setlinfo.Certno = ahres.Output.Setlinfo.Certno
30556 30490
 				res.Output.Setlinfo.ClrOptins = ahres.Output.Setlinfo.ClrOptins
30557 30491
 
30558
-				if strings.Contains(his.InsuplcAdmdvs, "3412") {
30559
-					res.Output.Setlinfo.ClrType = "11"
30560
-				} else {
30561
-					res.Output.Setlinfo.ClrType = "9903"
30562
-				}
30492
+
30563 30493
 
30564 30494
 				res.Output.Setlinfo.ClrWay = ahres.Output.Setlinfo.ClrOptins
30565 30495
 				res.Output.Setlinfo.CvlservFlag = ahres.Output.Setlinfo.ClrOptins
@@ -30607,6 +30537,12 @@ func (c *HisApiController) GetUploadInfo() {
30607 30537
 				res.WarnMsg = ahres.WarnMsg
30608 30538
 				res.Infcode = ahres.Infcode
30609 30539
 
30540
+				if strings.Contains(his.InsuplcAdmdvs, "3406") {
30541
+					res.Output.Setlinfo.ClrType = "11"
30542
+				} else {
30543
+					res.Output.Setlinfo.ClrType = "9903"
30544
+				}
30545
+
30610 30546
 			} else if miConfig.MdtrtareaAdmvs == "430800" {
30611 30547
 				psn_info, _ := service.GetPsnByPatientId(his.PatientId)
30612 30548
 				var cert_no string

+ 1 - 0
controllers/zh/zh_his_api_controller.go 查看文件

@@ -1709,6 +1709,7 @@ func (c *ZHHisApiController) GetZHPatientInfo() {
1709 1709
 		if len(insutypes) == 0 {
1710 1710
 			insutype = "310"
1711 1711
 		}
1712
+
1712 1713
 		var InsuplcAdmdvs string
1713 1714
 		for _, item := range res.Output.Iinfo {
1714 1715
 			utils.ErrorLog("解析失败:%v", item.Insutype)

+ 1 - 1
main.go 查看文件

@@ -57,7 +57,7 @@ type ResultEmpty10265 struct {
57 57
 
58 58
 func init() {
59 59
 	//service.ConnectNMMSDB()
60
-	//service.ConnectDB()
60
+	service.ConnectDB()
61 61
 	//org_id, _ := beego.AppConfig.Int64("org_id")
62 62
 	//miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
63 63
 	//////CreateLog(miConfig)

+ 5 - 3
service/gdyb_service.go 查看文件

@@ -7045,9 +7045,11 @@ func Gdyb3502(struct3502 models.Struct3502, secret_key string) (string, string)
7045 7045
 	feedetail := make([]map[string]interface{}, 0)
7046 7046
 	codes := strings.Split(struct3502.DrugTracCodg, ",")
7047 7047
 	for _, item := range codes {
7048
-		druginputData := make(map[string]interface{})
7049
-		druginputData["drug_trac_codg"] = item
7050
-		feedetail = append(feedetail, druginputData)
7048
+		if len(item) > 0 {
7049
+			druginputData := make(map[string]interface{})
7050
+			druginputData["drug_trac_codg"] = item
7051
+			feedetail = append(feedetail, druginputData)
7052
+		}
7051 7053
 	}
7052 7054
 	inputData["drugtracinfo"] = feedetail
7053 7055
 	input["invinfo"] = inputData