陈少旭 il y a 3 semaines
Parent
révision
19c045dcff
2 fichiers modifiés avec 83 ajouts et 43 suppressions
  1. 50 29
      controllers/ah/ahyb_controller.go
  2. 33 14
      controllers/sg/his_api_controller.go

+ 50 - 29
controllers/ah/ahyb_controller.go Voir le fichier

@@ -64,15 +64,25 @@ func AHybRegistRouters() {
64 64
 	beego.Router("/ahyb/2406", &AHybController{}, "post:Get2406")
65 65
 	beego.Router("/ahyb/readcardcharge", &AHybController{}, "get:Readcardcharge")
66 66
 
67
-
68
-
67
+	beego.Router("/ahyb/3501", &AHybController{}, "post:Get3501")
68
+	beego.Router("/ahyb/3502", &AHybController{}, "post:Get3502")
69
+	beego.Router("/ahyb/3503", &AHybController{}, "post:Get3503")
70
+	beego.Router("/ahyb/3504", &AHybController{}, "post:Get3504")
71
+	beego.Router("/ahyb/3505", &AHybController{}, "post:Get3505")
72
+	beego.Router("/ahyb/3506", &AHybController{}, "post:Get3506")
73
+	beego.Router("/ahyb/3507", &AHybController{}, "post:Get3507")
74
+	beego.Router("/ahyb/3508", &AHybController{}, "post:Get3508")
75
+	beego.Router("/ahyb/3509", &AHybController{}, "post:Get3509")
76
+	beego.Router("/ahyb/3510", &AHybController{}, "post:Get3510")
77
+	beego.Router("/ahyb/3511", &AHybController{}, "post:Get3511")
78
+	beego.Router("/ahyb/3512", &AHybController{}, "post:Get3512")
79
+	beego.Router("/ahyb/3513", &AHybController{}, "post:Get3513")
69 80
 
70 81
 	beego.Router("/ahyb/2406", &AHybController{}, "post:Get2406")
71 82
 	beego.Router("/ahyb/2406", &AHybController{}, "post:Get2406")
72 83
 
73
-
74 84
 }
75
-func (c *JSybController) Get3501() {
85
+func (c *AHybController) Get3501() {
76 86
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
77 87
 	var respJSON map[string]interface{}
78 88
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
@@ -104,7 +114,7 @@ func (c *JSybController) Get3501() {
104 114
 	})
105 115
 
106 116
 }
107
-func (c *JSybController) Get3502() {
117
+func (c *AHybController) Get3502() {
108 118
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
109 119
 	var respJSON map[string]interface{}
110 120
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
@@ -136,7 +146,7 @@ func (c *JSybController) Get3502() {
136 146
 	})
137 147
 
138 148
 }
139
-func (c *JSybController) Get3503() {
149
+func (c *AHybController) Get3503() {
140 150
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
141 151
 	var respJSON map[string]interface{}
142 152
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
@@ -169,7 +179,7 @@ func (c *JSybController) Get3503() {
169 179
 	})
170 180
 
171 181
 }
172
-func (c *JSybController) Get3504() {
182
+func (c *AHybController) Get3504() {
173 183
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
174 184
 	var respJSON map[string]interface{}
175 185
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
@@ -201,7 +211,7 @@ func (c *JSybController) Get3504() {
201 211
 	})
202 212
 
203 213
 }
204
-func (c *JSybController) Get3505() {
214
+func (c *AHybController) Get3505() {
205 215
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
206 216
 	var respJSON map[string]interface{}
207 217
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
@@ -215,25 +225,36 @@ func (c *JSybController) Get3505() {
215 225
 		utils.ErrorLog("解析失败:%v", err)
216 226
 		return
217 227
 	}
218
-
219
-	result, request_log := service.Jsyb3505(struct3505)
220
-	saveJsLog(result, request_log, "3505", "销售", struct3505.OrgName)
221
-	var dat2 map[string]interface{}
222
-	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
223
-	} else {
228
+	result, inputLog := service.AHyb3505(struct3505, struct3505.SecretKey, struct3505.RequestUrl)
229
+	saveJsLog(result, inputLog, "3505", "销售上传", struct3505.OrgName)
230
+	var response Response
231
+	if err := json.Unmarshal([]byte(result), &response); err != nil {
232
+		fmt.Println("Error decoding JSON:", err)
233
+		return
224 234
 	}
225
-	var dat map[string]interface{}
226
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
235
+
236
+	if response.Code == 200 {
237
+		var dat2 map[string]interface{}
238
+		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
239
+		} else {
240
+
241
+		}
242
+		c.ServeSuccessJSON(map[string]interface{}{
243
+			"pre":    response.Body,
244
+			"log":    dat2,
245
+			"status": "1",
246
+			"msg":    "",
247
+		})
248
+
227 249
 	} else {
250
+		c.ServeSuccessJSON(map[string]interface{}{
251
+			"status": "0",
252
+			"msg":    response.Message,
253
+		})
228 254
 
229 255
 	}
230
-	c.ServeSuccessJSON(map[string]interface{}{
231
-		"pre":         dat,
232
-		"request_log": dat2,
233
-	})
234
-
235 256
 }
236
-func (c *JSybController) Get3506() {
257
+func (c *AHybController) Get3506() {
237 258
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
238 259
 	var respJSON map[string]interface{}
239 260
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
@@ -265,7 +286,7 @@ func (c *JSybController) Get3506() {
265 286
 	})
266 287
 
267 288
 }
268
-func (c *JSybController) Get3507() {
289
+func (c *AHybController) Get3507() {
269 290
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
270 291
 	var respJSON map[string]interface{}
271 292
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
@@ -297,7 +318,7 @@ func (c *JSybController) Get3507() {
297 318
 	})
298 319
 
299 320
 }
300
-func (c *JSybController) Get3508() {
321
+func (c *AHybController) Get3508() {
301 322
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
302 323
 	var respJSON map[string]interface{}
303 324
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
@@ -329,7 +350,7 @@ func (c *JSybController) Get3508() {
329 350
 	})
330 351
 
331 352
 }
332
-func (c *JSybController) Get3509() {
353
+func (c *AHybController) Get3509() {
333 354
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
334 355
 	var respJSON map[string]interface{}
335 356
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
@@ -361,7 +382,7 @@ func (c *JSybController) Get3509() {
361 382
 	})
362 383
 
363 384
 }
364
-func (c *JSybController) Get3510() {
385
+func (c *AHybController) Get3510() {
365 386
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
366 387
 	var respJSON map[string]interface{}
367 388
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
@@ -393,7 +414,7 @@ func (c *JSybController) Get3510() {
393 414
 	})
394 415
 
395 416
 }
396
-func (c *JSybController) Get3511() {
417
+func (c *AHybController) Get3511() {
397 418
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
398 419
 	var respJSON map[string]interface{}
399 420
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
@@ -425,7 +446,7 @@ func (c *JSybController) Get3511() {
425 446
 	})
426 447
 
427 448
 }
428
-func (c *JSybController) Get3512() {
449
+func (c *AHybController) Get3512() {
429 450
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
430 451
 	var respJSON map[string]interface{}
431 452
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
@@ -457,7 +478,7 @@ func (c *JSybController) Get3512() {
457 478
 	})
458 479
 
459 480
 }
460
-func (c *JSybController) Get3513() {
481
+func (c *AHybController) Get3513() {
461 482
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
462 483
 	var respJSON map[string]interface{}
463 484
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {

+ 33 - 14
controllers/sg/his_api_controller.go Voir le fichier

@@ -34,8 +34,6 @@ import (
34 34
 	"syscall"
35 35
 	"time"
36 36
 	"unsafe"
37
-	"github.com/go-ole/go-ole"
38
-
39 37
 )
40 38
 
41 39
 type HisApiController struct {
@@ -4847,6 +4845,8 @@ func (c *HisApiController) ChangeDrugTen() {
4847 4845
 						res.WarnMsg = res3507for10188.WarnMsg
4848 4846
 						infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
4849 4847
 						res.Infcode = infocode
4848
+					} else if c.GetAdminUserInfo().CurrentOrgId == 10480 {
4849
+
4850 4850
 					} else {
4851 4851
 
4852 4852
 						if err := json.Unmarshal(userJSONBytes3, &res); err != nil {
@@ -5534,9 +5534,6 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
5534 5534
 	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "361") {
5535 5535
 		result1, result2 := service.JXyb3505(struct3505, struct3505.SecretKey, struct3505.AccessKey, struct3505.RequestUrl)
5536 5536
 		return result1, result2
5537
-	} else if miConfig.MdtrtareaAdmvs == "341203" {
5538
-		result1, result2 := service.AHyb3505(struct3505, struct3505.SecretKey, struct3505.RequestUrl)
5539
-		return result1, result2
5540 5537
 	} else if miConfig.MdtrtareaAdmvs == "340699" {
5541 5538
 		result1, result2 := service.AHyb3505(struct3505, struct3505.SecretKey, struct3505.RequestUrl)
5542 5539
 		return result1, result2
@@ -5564,6 +5561,35 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
5564 5561
 		result, _ := json.Marshal(respJSON)
5565 5562
 		return string(result), ""
5566 5563
 
5564
+	} else if miConfig.MdtrtareaAdmvs == "341203" {
5565
+		data := make(map[string]interface{})
5566
+		data["struct_3505s"] = struct3505
5567
+		client := &http.Client{}
5568
+		bytesData, _ := json.Marshal(data)
5569
+		var req *http.Request
5570
+
5571
+		req, _ = http.NewRequest("POST", miConfig.SecretKey+"ahyb/3505", bytes.NewReader(bytesData))
5572
+
5573
+		resp, _ := client.Do(req)
5574
+		defer resp.Body.Close()
5575
+		body, ioErr := ioutil.ReadAll(resp.Body)
5576
+		if ioErr != nil {
5577
+			utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
5578
+		}
5579
+		var respJSON map[string]interface{}
5580
+		if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
5581
+			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
5582
+		}
5583
+		status := respJSON["data"].(map[string]interface{})["status"].(string)
5584
+		if status == "0" {
5585
+			err_msg := respJSON["data"].(map[string]interface{})["msg"].(string)
5586
+			utils.ErrorLog("接口返回数据读取失败: %v", err_msg)
5587
+		}
5588
+
5589
+		respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
5590
+		result, _ := json.Marshal(respJSON)
5591
+		return string(result), ""
5592
+
5567 5593
 	} else {
5568 5594
 		data := make(map[string]interface{})
5569 5595
 		data["struct_3505s"] = struct3505
@@ -26962,19 +26988,17 @@ func (c *HisApiController) GetRegisterInfo() {
26962 26988
 
26963 26989
 								fmt.Println(record_time_two)
26964 26990
 
26965
-
26966 26991
 								if his.IdCardType == 2 {
26967 26992
 									IdCardNo = psn_info.Certno
26968 26993
 									psn_info.VerifyNumber = psn_info.Certno
26969 26994
 								} else if his.IdCardType == 4 {
26970 26995
 									IdCardNo = psn_info.Certno
26971
-								}else{
26996
+								} else {
26972 26997
 									bas := strings.Split(psn_info.CardInfo, "|")
26973 26998
 									IdCardNo = bas[2]
26974 26999
 
26975 27000
 								}
26976 27001
 
26977
-
26978 27002
 								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)
26979 27003
 								saveLog(result, requestLog, "2201A", "挂号")
26980 27004
 								if miConfig.Code == "H15049901371" {
@@ -27020,8 +27044,6 @@ func (c *HisApiController) GetRegisterInfo() {
27020 27044
 						//var insutypes []*ResultFive
27021 27045
 						var insutype string
27022 27046
 
27023
-
27024
-
27025 27047
 						var insutypes []*ResultFive
27026 27048
 
27027 27049
 						var is390 int = 0
@@ -27059,9 +27081,6 @@ func (c *HisApiController) GetRegisterInfo() {
27059 27081
 							insutype = "310"
27060 27082
 						}
27061 27083
 
27062
-
27063
-
27064
-
27065 27084
 						if social_type > 0 {
27066 27085
 							insutype = strconv.FormatInt(social_type, 10)
27067 27086
 						}
@@ -33181,7 +33200,7 @@ func (c *HisApiController) GetPreUploadInfo() {
33181 33200
 						if his.IdCardType == 2 {
33182 33201
 							insutype = strconv.FormatInt(his.SocialType, 10)
33183 33202
 
33184
-							result, request_log = service.Jxyb2206(his.PsnNo, his.Number, chrg_bchno, his.IdCardNo,insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, miConfig.Url, miConfig.AccessKey, his.IdCardNo, "")
33203
+							result, request_log = service.Jxyb2206(his.PsnNo, his.Number, chrg_bchno, his.IdCardNo, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, miConfig.Url, miConfig.AccessKey, his.IdCardNo, "")
33185 33204
 
33186 33205
 						} else if his.IdCardType == 1 {
33187 33206
 							psn_info, _ := service.GetPsnByPatientId(his.PatientId)