陈少旭 пре 4 месеци
родитељ
комит
b6eaaf3ca5
3 измењених фајлова са 298 додато и 139 уклоњено
  1. 277 122
      controllers/sg/his_api_controller.go
  2. 4 5
      models/new_stock_models.go
  3. 17 12
      service/fj_service.go

+ 277 - 122
controllers/sg/his_api_controller.go Прегледај датотеку

@@ -24,6 +24,7 @@ import (
24 24
 	"github.com/jinzhu/gorm"
25 25
 	"github.com/shopspring/decimal"
26 26
 
27
+	"github.com/go-ole/go-ole/oleutil"
27 28
 	"io"
28 29
 	"io/ioutil"
29 30
 	//"math"
@@ -38,8 +39,6 @@ import (
38 39
 	"syscall"
39 40
 	"time"
40 41
 	"unsafe"
41
-	"github.com/go-ole/go-ole"
42
-	"github.com/go-ole/go-ole/oleutil"
43 42
 )
44 43
 
45 44
 type HisApiController struct {
@@ -200,8 +199,12 @@ func (c *HisApiController) FJ3501AND3502() {
200 199
 	drugs, _ := service.GetNewDrugWarehouseInfo(id_arr)
201 200
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
202 201
 	//库盘
202
+	var errs []string
203 203
 	for _, drug := range drugs {
204 204
 		if drug.IsPc == 0 && drug.IsBg == 0 {
205
+			var res2 ResultSix
206
+			var res3 ResultSix
207
+
205 208
 			number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(drug.ID, 10) + "-" + "3501"
206 209
 			var struct3501 models.Struct3501
207 210
 			struct3501.OrgName = miConfig.OrgName
@@ -230,51 +233,89 @@ func (c *HisApiController) FJ3501AND3502() {
230 233
 			memo["pric"] = drug.Price
231 234
 			bytesData, _ := json.Marshal(memo)
232 235
 			struct3501.Memo = string(bytesData)
233
-			result1, result2, result3 := service.FJyb3501(struct3501)
236
+			result1, result2, _ := service.FJyb3501(struct3501)
234 237
 			saveLog(result1, result2, "3501", "3501")
235 238
 			//saveLog(result, requestLog, "2201", "挂号")
236 239
 
237
-			fmt.Println(result1)
238
-			fmt.Println(result2)
239
-			fmt.Println(result3)
240
-
241
-			var struct3502 models.Struct3502
242
-			struct3502.MedListCodg = drug.BaseDrugLib.MedicalInsuranceNumber
243
-			struct3502.FixmedinsHilistId = miConfig.Code
244
-			struct3502.FixmedinsHilistName = miConfig.OrgName
245
-			struct3502.FixmedinsCode = miConfig.Code
246
-			struct3502.RxFlag = "0"
247
-			struct3502.InvChgTime = time.Now().Format("2006-01-02")
248
-			struct3502.OrgName = miConfig.OrgName
249
-			struct3501.Opter = roles.UserName
250
-			struct3502.AccessKey = miConfig.AccessKey
251
-			struct3502.RequestUrl = miConfig.Url
252
-			struct3502.SecretKey = miConfig.SecretKey
253
-			struct3502.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
254
-			struct3502.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
255
-
256
-			struct3502.Url = miConfig.Url
257
-			struct3502.AppId = miConfig.Cainfo
258
-			struct3502.AppSecret = miConfig.AppSecret
259
-			struct3502.Enckey = miConfig.EncKey
260
-			struct3502.SignKey = miConfig.SignKey
261
-			struct3502.SecretKey = miConfig.SecretKey
262
-
263
-			struct3502.Memo = ""
264
-			struct3502.InvChgType = "108"
265
-			struct3502.FixmedinsBchno = number
266
-			struct3502.Cnt = strconv.FormatInt(drug.WarehousingCount, 10)
267
-			struct3502.Pric = fmt.Sprintf("%.2f", drug.BaseDrugLib.RetailPrice)
268
-			result11, result22, result33 := service.FJyb3502(struct3502)
269
-			fmt.Println(result11)
270
-			fmt.Println(result22)
271
-			fmt.Println(result33)
272
-			saveLog(result11, result22, "3502", "3502")
240
+			var respJSON2 map[string]interface{}
241
+			if err := json.Unmarshal([]byte(string(result1)), &respJSON2); err != nil {
242
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
243
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
244
+				return
245
+			}
246
+			userJSONBytes2, _ := json.Marshal(respJSON2)
247
+			if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
248
+				utils.ErrorLog("解析失败:%v", err)
249
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
250
+				return
251
+			}
273 252
 
253
+			if res2.Infcode != -1 {
254
+				drug.IsPc = 1
255
+				drug.Bchno = number
256
+				drug.PcDate = time.Now().Format("2006-01-02")
257
+				err := service.SaveW(drug)
258
+				if err == nil {
259
+					var struct3502 models.Struct3502
260
+					struct3502.MedListCodg = drug.BaseDrugLib.MedicalInsuranceNumber
261
+					struct3502.FixmedinsHilistId = miConfig.Code
262
+					struct3502.FixmedinsHilistName = miConfig.OrgName
263
+					struct3502.FixmedinsCode = miConfig.Code
264
+					struct3502.RxFlag = "0"
265
+					struct3502.InvChgTime = time.Now().Format("2006-01-02")
266
+					struct3502.OrgName = miConfig.OrgName
267
+					struct3501.Opter = roles.UserName
268
+					struct3502.AccessKey = miConfig.AccessKey
269
+					struct3502.RequestUrl = miConfig.Url
270
+					struct3502.SecretKey = miConfig.SecretKey
271
+					struct3502.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
272
+					struct3502.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
273
+					struct3502.Url = miConfig.Url
274
+					struct3502.AppId = miConfig.Cainfo
275
+					struct3502.AppSecret = miConfig.AppSecret
276
+					struct3502.Enckey = miConfig.EncKey
277
+					struct3502.SignKey = miConfig.SignKey
278
+					struct3502.SecretKey = miConfig.SecretKey
279
+					struct3502.Memo = ""
280
+					struct3502.InvChgType = "108"
281
+					struct3502.FixmedinsBchno = drug.Bchno
282
+					struct3502.Cnt = strconv.FormatInt(drug.WarehousingCount, 10)
283
+					struct3502.Pric = fmt.Sprintf("%.2f", drug.BaseDrugLib.RetailPrice)
284
+					result11, result22, _ := service.FJyb3502(struct3502)
285
+					saveLog(result11, result22, "3502", "3502")
286
+
287
+					var respJSON3 map[string]interface{}
288
+					if err := json.Unmarshal([]byte(string(result11)), &respJSON3); err != nil {
289
+						utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
290
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
291
+						return
292
+					}
293
+					userJSONBytes3, _ := json.Marshal(respJSON3)
294
+					if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
295
+						utils.ErrorLog("解析失败:%v", err)
296
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
297
+						return
298
+					}
299
+					if res3.Infcode == -1 {
300
+						errs = append(errs, "变更"+drug.BaseDrugLib.DrugName+",出错:"+res3.ErrMsg)
301
+						c.ServeSuccessJSON(map[string]interface{}{
302
+							"failed_code": -10,
303
+							"msg":         res3.ErrMsg,
304
+						})
305
+					} else {
306
+						drug.IsBg = 1
307
+						service.SaveW(drug)
308
+					}
309
+				}
310
+			} else {
311
+				errs = append(errs, "盘存"+drug.BaseDrugLib.DrugName+",出错:"+res2.ErrMsg)
312
+			}
274 313
 
275 314
 		}
276 315
 		//变更
277 316
 		if drug.IsPc == 1 && drug.IsBg == 0 {
317
+			var res3 ResultSix
318
+
278 319
 			var struct3502 models.Struct3502
279 320
 			struct3502.MedListCodg = drug.BaseDrugLib.MedicalInsuranceNumber
280 321
 			struct3502.FixmedinsHilistId = miConfig.Code
@@ -301,13 +342,41 @@ func (c *HisApiController) FJ3501AND3502() {
301 342
 			struct3502.FixmedinsBchno = drug.Bchno
302 343
 			struct3502.Cnt = strconv.FormatInt(drug.WarehousingCount, 10)
303 344
 			struct3502.Pric = fmt.Sprintf("%.2f", drug.BaseDrugLib.RetailPrice)
304
-			result1, result2, result3 := service.FJyb3502(struct3502)
345
+			result1, result2, _ := service.FJyb3502(struct3502)
305 346
 			saveLog(result1, result2, "3502", "3502")
306
-			fmt.Println(result1)
307
-			fmt.Println(result2)
308
-			fmt.Println(result3)
347
+			var respJSON3 map[string]interface{}
348
+			if err := json.Unmarshal([]byte(string(result1)), &respJSON3); err != nil {
349
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
350
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
351
+				return
352
+			}
353
+			userJSONBytes3, _ := json.Marshal(respJSON3)
354
+			if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
355
+				utils.ErrorLog("解析失败:%v", err)
356
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
357
+				return
358
+			}
359
+			if res3.Infcode == -1 {
360
+				errs = append(errs, "变更"+drug.BaseDrugLib.DrugName+",出错:"+res3.ErrMsg)
361
+			} else {
362
+				drug.IsBg = 1
363
+				//drug.Bchno = number
364
+				//drug.PcDate = time.Now().Format("2006-01-02")
365
+				service.SaveW(drug)
366
+			}
309 367
 		}
310 368
 	}
369
+
370
+	if len(errs) == 0 {
371
+		c.ServeSuccessJSON(map[string]interface{}{
372
+			"msg": "盘存变更成功",
373
+		})
374
+	} else {
375
+		c.ServeSuccessJSON(map[string]interface{}{
376
+			"failed_code": -10,
377
+			"msg":         errs,
378
+		})
379
+	}
311 380
 }
312 381
 func (c *HisApiController) DeletePCandBG() {
313 382
 	ids := c.GetString("ids")
@@ -317,10 +386,14 @@ func (c *HisApiController) DeletePCandBG() {
317 386
 
318 387
 	drugs, _ := service.GetNewDrugWarehouseInfo(id_arr)
319 388
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
389
+	var err []string
320 390
 	for _, item := range drugs {
321 391
 		if item.IsPc == 1 && item.IsBg == 1 {
392
+			var res FJ3507Result
393
+			var res2 FJ3507Result
394
+
322 395
 			var struct3507 models.Struct3507
323
-			struct3507.FixmedinsBchno = ""
396
+			struct3507.FixmedinsBchno = item.Bchno
324 397
 			struct3507.InvDataType = "1"
325 398
 			struct3507.Opter = roles.UserName
326 399
 			struct3507.OrgName = miConfig.OrgName
@@ -329,55 +402,134 @@ func (c *HisApiController) DeletePCandBG() {
329 402
 			struct3507.SecretKey = miConfig.SecretKey
330 403
 			struct3507.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
331 404
 			struct3507.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
332
-
333 405
 			struct3507.Url = miConfig.Url
334 406
 			struct3507.AppId = miConfig.Cainfo
335 407
 			struct3507.AppSecret = miConfig.AppSecret
336 408
 			struct3507.Enckey = miConfig.EncKey
337 409
 			struct3507.SignKey = miConfig.SignKey
338 410
 			struct3507.SecretKey = miConfig.SecretKey
339
-			service.FJyb3507(struct3507)
411
+			result, result1, _ := service.FJyb3507(struct3507)
412
+			saveLog(result, result1, "3507", "3507")
340 413
 
341
-			var struct3507_2 models.Struct3507
342
-			struct3507_2.OrgName = miConfig.OrgName
343
-			struct3507_2.AccessKey = miConfig.AccessKey
344
-			struct3507_2.RequestUrl = miConfig.Url
345
-			struct3507_2.SecretKey = miConfig.SecretKey
346
-			struct3507_2.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
347
-			struct3507_2.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
414
+			var respJSON2 map[string]interface{}
415
+			if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
416
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
417
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
418
+				return
419
+			}
420
+			userJSONBytes2, _ := json.Marshal(respJSON2)
421
+			if err := json.Unmarshal(userJSONBytes2, &res); err != nil {
422
+				utils.ErrorLog("解析失败:%v", err)
423
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
424
+				return
425
+			}
348 426
 
349
-			struct3507_2.Url = miConfig.Url
350
-			struct3507_2.AppId = miConfig.Cainfo
351
-			struct3507_2.AppSecret = miConfig.AppSecret
352
-			struct3507_2.Enckey = miConfig.EncKey
353
-			struct3507_2.SignKey = miConfig.SignKey
354
-			struct3507_2.SecretKey = miConfig.SecretKey
427
+			if res.Infcode != -1 {
428
+				item.IsPc = 0
429
+				err2 := service.SaveW(item)
430
+				if err2 == nil {
431
+					var struct3507_2 models.Struct3507
432
+					struct3507_2.OrgName = miConfig.OrgName
433
+					struct3507_2.AccessKey = miConfig.AccessKey
434
+					struct3507_2.RequestUrl = miConfig.Url
435
+					struct3507_2.Opter = roles.UserName
436
+					struct3507_2.SecretKey = miConfig.SecretKey
437
+					struct3507_2.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
438
+					struct3507_2.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
439
+					struct3507_2.Url = miConfig.Url
440
+					struct3507_2.AppId = miConfig.Cainfo
441
+					struct3507_2.AppSecret = miConfig.AppSecret
442
+					struct3507_2.Enckey = miConfig.EncKey
443
+					struct3507_2.SignKey = miConfig.SignKey
444
+					struct3507_2.SecretKey = miConfig.SecretKey
445
+					struct3507_2.FixmedinsBchno = item.Bchno
446
+					struct3507_2.InvDataType = "2"
447
+					result11, result22, _ := service.FJyb3507(struct3507_2)
448
+					saveLog(result11, result22, "3507", "3507")
449
+
450
+					var respJSON3 map[string]interface{}
451
+					if err := json.Unmarshal([]byte(string(result11)), &respJSON3); err != nil {
452
+						utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
453
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
454
+						return
455
+					}
456
+					userJSONBytes3, _ := json.Marshal(respJSON3)
457
+					if err := json.Unmarshal(userJSONBytes3, &res2); err != nil {
458
+						utils.ErrorLog("解析失败:%v", err)
459
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
460
+						return
461
+					}
462
+					if res2.Infcode != -1 {
463
+						item.IsBg = 0
464
+						item.Bchno = ""
465
+						item.PcDate = ""
466
+						service.SaveW(item)
467
+					} else {
468
+						err = append(err, "删除"+item.BaseDrugLib.DrugName+"变更失败,失败原因:"+res.ErrMsg)
469
+					}
470
+				}
471
+			} else {
472
+				err = append(err, "删除"+item.BaseDrugLib.DrugName+"盘存失败,失败原因:"+res.ErrMsg)
473
+			}
355 474
 
356
-			struct3507_2.FixmedinsBchno = ""
357
-			struct3507_2.InvDataType = "2"
358
-			service.FJyb3507(struct3507_2)
359 475
 		}
360 476
 		if item.IsPc == 1 && item.IsBg == 0 {
477
+
478
+			var res FJ3507Result
361 479
 			var struct3507 models.Struct3507
480
+			struct3507.FixmedinsBchno = item.Bchno
481
+			struct3507.InvDataType = "2"
482
+			struct3507.Opter = roles.UserName
362 483
 			struct3507.OrgName = miConfig.OrgName
363 484
 			struct3507.AccessKey = miConfig.AccessKey
364 485
 			struct3507.RequestUrl = miConfig.Url
365 486
 			struct3507.SecretKey = miConfig.SecretKey
366 487
 			struct3507.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
367 488
 			struct3507.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
368
-
369 489
 			struct3507.Url = miConfig.Url
370 490
 			struct3507.AppId = miConfig.Cainfo
371 491
 			struct3507.AppSecret = miConfig.AppSecret
372 492
 			struct3507.Enckey = miConfig.EncKey
373 493
 			struct3507.SignKey = miConfig.SignKey
374 494
 			struct3507.SecretKey = miConfig.SecretKey
375
-			struct3507.FixmedinsBchno = ""
376
-			struct3507.InvDataType = "1"
377
-			service.FJyb3507(struct3507)
495
+			result, result1, _ := service.FJyb3507(struct3507)
496
+			saveLog(result, result1, "3507", "3507")
497
+
498
+			var respJSON3 map[string]interface{}
499
+			if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
500
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
501
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
502
+				return
503
+			}
504
+			userJSONBytes3, _ := json.Marshal(respJSON3)
505
+			if err := json.Unmarshal(userJSONBytes3, &res); err != nil {
506
+				utils.ErrorLog("解析失败:%v", err)
507
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
508
+				return
509
+			}
510
+			if res.Infcode != -1 {
511
+				item.IsBg = 0
512
+				item.Bchno = ""
513
+				item.PcDate = ""
514
+				service.SaveW(item)
515
+			} else {
516
+				err = append(err, "删除"+item.BaseDrugLib.DrugName+"变更失败,失败原因:"+res.ErrMsg)
517
+			}
378 518
 		}
379 519
 
380 520
 	}
521
+	if len(err) == 0 {
522
+		c.ServeSuccessJSON(map[string]interface{}{
523
+			"msg": "删除盘存变更成功",
524
+		})
525
+
526
+	} else {
527
+		c.ServeSuccessJSON(map[string]interface{}{
528
+			"failed_code": -10,
529
+			"msg":         err,
530
+		})
531
+
532
+	}
381 533
 
382 534
 }
383 535
 
@@ -7606,7 +7758,6 @@ func (c *HisApiController) GetPsnNcdsInfo() {
7606 7758
 	//psn_record, _ := service.GetP(id)
7607 7759
 	psn_info, _ := service.GetPsnByPatientId(patient_id)
7608 7760
 
7609
-
7610 7761
 	//psn_record, _ := service.GetPsnNCDSRecordById(id)
7611 7762
 	//
7612 7763
 	//if psn_record.ID == 0 {
@@ -7845,7 +7996,7 @@ func (c *HisApiController) GetPsnNcdsInfo() {
7845 7996
 			return
7846 7997
 		}
7847 7998
 
7848
-	}  else if miConfig.MdtrtareaAdmvs == "420902" {
7999
+	} else if miConfig.MdtrtareaAdmvs == "420902" {
7849 8000
 		p, _ := service.GetHisPatientById(patient_id)
7850 8001
 
7851 8002
 		api := miConfig.Url + "/hbyb/5301?psn_no=" + p.PsnNo +
@@ -8531,10 +8682,6 @@ func (c *HisApiController) ReadCard() {
8531 8682
 					infoStr := string(Iinfos)
8532 8683
 					idetinfoStr := string(Idetinfos)
8533 8684
 
8534
-
8535
-
8536
-
8537
-
8538 8685
 					var rf []*ResultFive
8539 8686
 					json.Unmarshal([]byte(infoStr), &rf)
8540 8687
 
@@ -8583,29 +8730,22 @@ func (c *HisApiController) ReadCard() {
8583 8730
 						}
8584 8731
 					}
8585 8732
 
8586
-
8587
-
8588
-
8589
-
8590
-
8591 8733
 					psn := &models.HisPsn{
8592 8734
 						PsnNo: res.Output.Baseinfo.PsnNo,
8593 8735
 
8594
-						PatientId: patient.ID,
8595
-						Certno:    res.Output.Baseinfo.Certno,
8596
-						Gend:        res.Output.Baseinfo.Gend,
8597
-						Naty:        res.Output.Baseinfo.Naty,
8598
-						PsnCertType: res.Output.Baseinfo.PsnCertType,
8599
-						PsnName:     res.Output.Baseinfo.PsnName,
8600
-						Idetinfo:    idetinfoStr,
8601
-						Insuinfo:    infoStr,
8602
-						UserOrgId:   c.GetAdminUserInfo().CurrentOrgId,
8736
+						PatientId:     patient.ID,
8737
+						Certno:        res.Output.Baseinfo.Certno,
8738
+						Gend:          res.Output.Baseinfo.Gend,
8739
+						Naty:          res.Output.Baseinfo.Naty,
8740
+						PsnCertType:   res.Output.Baseinfo.PsnCertType,
8741
+						PsnName:       res.Output.Baseinfo.PsnName,
8742
+						Idetinfo:      idetinfoStr,
8743
+						Insuinfo:      infoStr,
8744
+						UserOrgId:     c.GetAdminUserInfo().CurrentOrgId,
8603 8745
 						InsuplcAdmdvs: insuplc_admdvs,
8604
-
8605 8746
 					}
8606 8747
 					service.CreateHisPsn(psn)
8607 8748
 
8608
-
8609 8749
 					for _, item := range rf {
8610 8750
 						if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
8611 8751
 							insutypes = append(insutypes, item)
@@ -10351,13 +10491,13 @@ func (c *HisApiController) ReadCard() {
10351 10491
 						PatientId: patient.ID,
10352 10492
 						Certno:    res.Output.Baseinfo.Certno,
10353 10493
 
10354
-						Gend:        res.Output.Baseinfo.Gend,
10355
-						Naty:        res.Output.Baseinfo.Naty,
10356
-						PsnCertType: res.Output.Baseinfo.PsnCertType,
10357
-						PsnName:     res.Output.Baseinfo.PsnName,
10358
-						Idetinfo:    idetinfoStr,
10359
-						Insuinfo:    infoStr,
10360
-						UserOrgId:   c.GetAdminUserInfo().CurrentOrgId,
10494
+						Gend:          res.Output.Baseinfo.Gend,
10495
+						Naty:          res.Output.Baseinfo.Naty,
10496
+						PsnCertType:   res.Output.Baseinfo.PsnCertType,
10497
+						PsnName:       res.Output.Baseinfo.PsnName,
10498
+						Idetinfo:      idetinfoStr,
10499
+						Insuinfo:      infoStr,
10500
+						UserOrgId:     c.GetAdminUserInfo().CurrentOrgId,
10361 10501
 						InsuplcAdmdvs: insuplc_admdvs,
10362 10502
 					}
10363 10503
 					service.CreateHisPsn(psn)
@@ -11913,16 +12053,16 @@ func (c *HisApiController) ReadCard() {
11913 12053
 						}
11914 12054
 					}
11915 12055
 					psn := &models.HisPsn{
11916
-						PsnNo: res.Output.Baseinfo.PsnNo,
11917
-						PatientId: patient.ID,
11918
-						Certno:    res.Output.Baseinfo.Certno,
11919
-						Gend:        res.Output.Baseinfo.Gend,
11920
-						Naty:        res.Output.Baseinfo.Naty,
11921
-						PsnCertType: res.Output.Baseinfo.PsnCertType,
11922
-						PsnName:     res.Output.Baseinfo.PsnName,
11923
-						Idetinfo:    idetinfoStr,
11924
-						Insuinfo:    infoStr,
11925
-						UserOrgId:   c.GetAdminUserInfo().CurrentOrgId,
12056
+						PsnNo:         res.Output.Baseinfo.PsnNo,
12057
+						PatientId:     patient.ID,
12058
+						Certno:        res.Output.Baseinfo.Certno,
12059
+						Gend:          res.Output.Baseinfo.Gend,
12060
+						Naty:          res.Output.Baseinfo.Naty,
12061
+						PsnCertType:   res.Output.Baseinfo.PsnCertType,
12062
+						PsnName:       res.Output.Baseinfo.PsnName,
12063
+						Idetinfo:      idetinfoStr,
12064
+						Insuinfo:      infoStr,
12065
+						UserOrgId:     c.GetAdminUserInfo().CurrentOrgId,
11926 12066
 						InsuplcAdmdvs: insuplc_admdvs,
11927 12067
 					}
11928 12068
 					service.CreateHisPsn(psn)
@@ -17085,6 +17225,22 @@ type ResultSix struct {
17085 17225
 	Signtype    interface{} `json:"signtype"`
17086 17226
 	WarnMsg     interface{} `json:"warn_msg"`
17087 17227
 }
17228
+
17229
+type FJ3507Result struct {
17230
+	Cainfo      interface{} `json:"cainfo"`
17231
+	ErrMsg      string      `json:"err_msg"`
17232
+	InfRefmsgid string      `json:"inf_refmsgid"`
17233
+	Infcode     int64       `json:"infcode"`
17234
+	Output      struct {
17235
+		retRslt string `json:"retRslt"`
17236
+		msgRslt string `json:"msgRslt"`
17237
+	} `json:"output"`
17238
+	RefmsgTime  string      `json:"refmsg_time"`
17239
+	RespondTime string      `json:"respond_time"`
17240
+	Signtype    interface{} `json:"signtype"`
17241
+	WarnMsg     interface{} `json:"warn_msg"`
17242
+}
17243
+
17088 17244
 type Result2406 struct {
17089 17245
 	Cainfo      interface{} `json:"cainfo"`
17090 17246
 	ErrMsg      string      `json:"err_msg"`
@@ -19358,7 +19514,7 @@ func (c *HisApiController) GetRegisterInfo() {
19358 19514
 				}
19359 19515
 				infocode = resThree.Infcode
19360 19516
 
19361
-			}  else if miConfig.MdtrtareaAdmvs == "420902" {
19517
+			} else if miConfig.MdtrtareaAdmvs == "420902" {
19362 19518
 				hb_doctor_info, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, patientPrescription.DoctorId)
19363 19519
 				//if strings.Contains(insuplc_admdvs_temp, "4202") {
19364 19520
 				//	insuplc_admdvs_temp =
@@ -19375,10 +19531,9 @@ func (c *HisApiController) GetRegisterInfo() {
19375 19531
 				utils.ErrorLog("解析失败:%v", hb_doctor_info.DoctorNumber)
19376 19532
 				utils.ErrorLog("解析失败:%v", PsnNo)
19377 19533
 
19378
-				utils.ErrorLog("解析失败:%v", department.Number )
19379
-				utils.ErrorLog("解析失败:%v", department.Name )
19380
-				utils.ErrorLog("解析失败:%v",  roles.UserName)
19381
-
19534
+				utils.ErrorLog("解析失败:%v", department.Number)
19535
+				utils.ErrorLog("解析失败:%v", department.Name)
19536
+				utils.ErrorLog("解析失败:%v", roles.UserName)
19382 19537
 
19383 19538
 				api := miConfig.Url + "hbyb/2201?psn_no=" + PsnNo + "&insutype=" + insutype + "&cert_no=" + Certno + "&ipt_otp_no=" + ipt_otp_no +
19384 19539
 					"&org_name=" + miConfig.OrgName + "&doctor=" + hb_doctor_info.UserName + "&fixmedins_code=" + miConfig.Code +
@@ -20445,7 +20600,7 @@ func (c *HisApiController) GetUploadInfo() {
20445 20600
 				return
20446 20601
 			}
20447 20602
 
20448
-		}else if miConfig.MdtrtareaAdmvs == "421182" {
20603
+		} else if miConfig.MdtrtareaAdmvs == "421182" {
20449 20604
 
20450 20605
 			data := make(map[string]interface{})
20451 20606
 			client := &http.Client{}
@@ -20944,7 +21099,7 @@ func (c *HisApiController) GetUploadInfo() {
20944 21099
 						return
20945 21100
 					}
20946 21101
 
20947
-				}  else if miConfig.MdtrtareaAdmvs == "420902" {
21102
+				} else if miConfig.MdtrtareaAdmvs == "420902" {
20948 21103
 
20949 21104
 					bytesData, _ := json.Marshal(data)
20950 21105
 					req, _ := http.NewRequest("POST", miConfig.Url+"hbyb/2204", bytes.NewReader(bytesData))
@@ -20973,7 +21128,7 @@ func (c *HisApiController) GetUploadInfo() {
20973 21128
 						return
20974 21129
 					}
20975 21130
 
20976
-				}else if miConfig.MdtrtareaAdmvs == "421182" {
21131
+				} else if miConfig.MdtrtareaAdmvs == "421182" {
20977 21132
 
20978 21133
 					bytesData, _ := json.Marshal(data)
20979 21134
 					req, _ := http.NewRequest("POST", miConfig.Url+"hbyb/2204", bytes.NewReader(bytesData))
@@ -21585,7 +21740,7 @@ func (c *HisApiController) GetUploadInfo() {
21585 21740
 								reg_type = 110104
21586 21741
 							}
21587 21742
 
21588
-							api := miConfig.Url+ "hbyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
21743
+							api := miConfig.Url + "hbyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
21589 21744
 								his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
21590 21745
 								"&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
21591 21746
 								"&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
@@ -21640,7 +21795,7 @@ func (c *HisApiController) GetUploadInfo() {
21640 21795
 
21641 21796
 							}
21642 21797
 
21643
-						}  else if miConfig.MdtrtareaAdmvs == "421182" {
21798
+						} else if miConfig.MdtrtareaAdmvs == "421182" {
21644 21799
 							if reg_type == 11 && his.Insutype == "390" {
21645 21800
 								reg_type = 110104
21646 21801
 							}
@@ -22605,7 +22760,7 @@ func (c *HisApiController) GetUploadInfo() {
22605 22760
 					return
22606 22761
 				}
22607 22762
 
22608
-			}else if miConfig.MdtrtareaAdmvs == "420902" {
22763
+			} else if miConfig.MdtrtareaAdmvs == "420902" {
22609 22764
 				if reg_type == 11 && his.Insutype == "390" {
22610 22765
 					reg_type = 110104
22611 22766
 				}
@@ -24378,7 +24533,7 @@ func (c *HisApiController) GetPreUploadInfo() {
24378 24533
 					return
24379 24534
 				}
24380 24535
 
24381
-			}else if miConfig.MdtrtareaAdmvs == "420902" {
24536
+			} else if miConfig.MdtrtareaAdmvs == "420902" {
24382 24537
 				bytesData, _ := json.Marshal(data)
24383 24538
 				req, _ := http.NewRequest("POST", miConfig.Url+"hbyb/2204", bytes.NewReader(bytesData))
24384 24539
 				resp, _ := client.Do(req)
@@ -24406,7 +24561,7 @@ func (c *HisApiController) GetPreUploadInfo() {
24406 24561
 					return
24407 24562
 				}
24408 24563
 
24409
-			}  else if miConfig.MdtrtareaAdmvs == "421182" {
24564
+			} else if miConfig.MdtrtareaAdmvs == "421182" {
24410 24565
 				bytesData, _ := json.Marshal(data)
24411 24566
 				req, _ := http.NewRequest("POST", miConfig.Url+"hbyb/2204", bytes.NewReader(bytesData))
24412 24567
 				resp, _ := client.Do(req)
@@ -26299,7 +26454,7 @@ func (c *HisApiController) Refund() {
26299 26454
 				return
26300 26455
 			}
26301 26456
 
26302
-		}  else if miConfig.MdtrtareaAdmvs == "421182" {
26457
+		} else if miConfig.MdtrtareaAdmvs == "421182" {
26303 26458
 			api3 := miConfig.Url + "hbyb/2208?psn_no=" + order.PsnNo +
26304 26459
 				"&mdtrt_id=" + order.MdtrtId + "&setl_id=" + order.SetlId + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
26305 26460
 				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
@@ -28409,7 +28564,7 @@ func (c *HisApiController) GetCheckAccount() {
28409 28564
 				AcctPay:          acct_pay,
28410 28565
 				FixmedinsSetlCnt: fixmedins_setl_cnt,
28411 28566
 			}
28412
-			result, requestLog, err_msg := service.FJyb3201(baseParams, businessParams, fmt.Sprintf("%.4f", medfee_sumamt), fmt.Sprintf("%.4f", fund_pay_sumamt),fmt.Sprintf("%.4f", acct_pay))
28567
+			result, requestLog, err_msg := service.FJyb3201(baseParams, businessParams, fmt.Sprintf("%.4f", medfee_sumamt), fmt.Sprintf("%.4f", fund_pay_sumamt), fmt.Sprintf("%.4f", acct_pay))
28413 28568
 			fmt.Println(requestLog)
28414 28569
 			fmt.Println(result)
28415 28570
 			fmt.Println(err_msg)
@@ -28495,7 +28650,7 @@ func (c *HisApiController) GetCheckAccount() {
28495 28650
 				AcctPay:          acct_pay,
28496 28651
 				FixmedinsSetlCnt: fixmedins_setl_cnt,
28497 28652
 			}
28498
-			result, requestLog, err_msg := service.FJyb3201(baseParams, businessParams, fmt.Sprintf("%.4f", medfee_sumamt), fmt.Sprintf("%.4f", fund_pay_sumamt),fmt.Sprintf("%.4f", acct_pay))
28653
+			result, requestLog, err_msg := service.FJyb3201(baseParams, businessParams, fmt.Sprintf("%.4f", medfee_sumamt), fmt.Sprintf("%.4f", fund_pay_sumamt), fmt.Sprintf("%.4f", acct_pay))
28499 28654
 			fmt.Println(requestLog)
28500 28655
 			fmt.Println(result)
28501 28656
 			fmt.Println(err_msg)
@@ -29844,7 +29999,7 @@ func (c *HisApiController) GetSettleAccounts() {
29844 29999
 				return
29845 30000
 			}
29846 30001
 
29847
-		}else if miConfig.MdtrtareaAdmvs == "421182" {
30002
+		} else if miConfig.MdtrtareaAdmvs == "421182" {
29848 30003
 
29849 30004
 			api := miConfig.Url + "hbyb/5203?psn_no=" + businessParams.PsnNo + "&mdtrt_id=" + businessParams.MdtrtId + "&setl_id=" + businessParams.SetlId +
29850 30005
 				"&org_name=" + miConfig.OrgName + "&doctor=" + baseParams.Doctor + "&fixmedins_code=" + miConfig.Code +

+ 4 - 5
models/new_stock_models.go Прегледај датотеку

@@ -261,11 +261,10 @@ type NewDrugWarehouseInfo struct {
261 261
 	SecondWarehouseInfoId     int64  `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
262 262
 	IsCheck                   int64  `gorm:"column:is_check" json:"is_check" form:"is_check"`
263 263
 
264
-	IsPc int64 `gorm:"column:is_pc" json:"is_pc" form:"is_pc"`
265
-	IsBg int64 `gorm:"column:is_bg" json:"is_bg" form:"is_bg"`
266
-	Bchno string `gorm:"column:bchno" json:"bchno" form:"bchno"`
267
-
268
-
264
+	IsPc   int64  `gorm:"column:is_pc" json:"is_pc" form:"is_pc"`
265
+	IsBg   int64  `gorm:"column:is_bg" json:"is_bg" form:"is_bg"`
266
+	Bchno  string `gorm:"column:bchno" json:"bchno" form:"bchno"`
267
+	PcDate string `gorm:"column:pc_date" json:"pc_date" form:"pc_date"`
269 268
 }
270 269
 
271 270
 func (NewDrugWarehouseInfo) TableName() string {

+ 17 - 12
service/fj_service.go Прегледај датотеку

@@ -1006,7 +1006,7 @@ func FJyb6201(org_name string, doctor string, fixmedins_code string, insuplc_adm
1006 1006
 }
1007 1007
 
1008 1008
 // 医药机构费用结算对总账 func Gdyb3201( org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
1009
-func FJyb3201(baseParams models.BaseParams, businessParams models.BusinessParams, med string, fund string,acct string) (string, string, string) {
1009
+func FJyb3201(baseParams models.BaseParams, businessParams models.BusinessParams, med string, fund string, acct string) (string, string, string) {
1010 1010
 
1011 1011
 	fmt.Println(baseParams)
1012 1012
 	fmt.Println(businessParams)
@@ -1040,7 +1040,7 @@ func FJyb3201(baseParams models.BaseParams, businessParams models.BusinessParams
1040 1040
 	inputData["stmt_enddate"] = businessParams.StmtEnddate            //对帐结束时间
1041 1041
 	inputData["medfee_sumamt"] = med                                  //医疗费总额
1042 1042
 	inputData["fund_pay_sumamt"] = fund                               //基金支付总额
1043
-	inputData["acct_pay"] = acct                    //个人账户支付金额
1043
+	inputData["acct_pay"] = acct                                      //个人账户支付金额
1044 1044
 	inputData["fixmedins_setl_cnt"] = businessParams.FixmedinsSetlCnt //定点医药机构结算笔数
1045 1045
 	inputData["refd_setl_flag"] = "0"                                 // 就诊 ID(来自2201接口返回)
1046 1046
 
@@ -3069,19 +3069,19 @@ func FJyb3502(struct3502 models.Struct3502) (string, string, string) {
3069 3069
 	input := make(map[string]interface{})
3070 3070
 	inputData := make(map[string]interface{})
3071 3071
 	druginputData := make(map[string]interface{})
3072
-	inputMessage["infno"] = "3502"                      // 交易编码
3073
-	inputData["med_list_codg"] = struct3502.MedListCodg // 定点医药机构目录编号
3074
-	inputData["inv_chg_type"] = struct3502.InvChgType   // 定点医药机构目录编号
3072
+	inputMessage["infno"] = "3502"                              // 交易编码
3073
+	inputData["med_list_codg"] = struct3502.MedListCodg         // 定点医药机构目录编号
3074
+	inputData["inv_chg_type"] = struct3502.InvChgType           // 定点医药机构目录编号
3075 3075
 	inputData["fixmedins_hilist_id"] = struct3502.FixmedinsCode // 定点医药机构目录编号
3076 3076
 	inputData["fixmedins_hilist_name"] = struct3502.OrgName     // 定点医药机构目录名称
3077 3077
 	inputData["fixmedins_bchno"] = struct3502.FixmedinsBchno    // 人员编号 (来自1101接口返回)
3078 3078
 	inputData["pric"] = struct3502.Pric                         // 人员编号 (来自1101接口返回)
3079 3079
 	inputData["cnt"] = struct3502.Cnt                           // 人员编号 (来自1101接口返回)
3080 3080
 	inputData["rx_flag"] = struct3502.RxFlag                    //
3081
-	inputData["inv_chg_time"] = struct3502.InvChgTime // 人员编号 (来自1101接口返回)
3082
-	inputData["inv_chg_opter_name"] = ""              // 人员编号 (来自1101接口返回)
3083
-	inputData["memo"] = struct3502.Memo               // 人员编号 (来自1101接口返回)
3084
-	inputData["trdn_flag"] = ""                       // 人员编号 (来自1101接口返回)
3081
+	inputData["inv_chg_time"] = struct3502.InvChgTime           // 人员编号 (来自1101接口返回)
3082
+	inputData["inv_chg_opter_name"] = ""                        // 人员编号 (来自1101接口返回)
3083
+	inputData["memo"] = struct3502.Memo                         // 人员编号 (来自1101接口返回)
3084
+	inputData["trdn_flag"] = ""                                 // 人员编号 (来自1101接口返回)
3085 3085
 	druginputData["drug_trac_codg"] = "12345678912345678901"
3086 3086
 	inputData["drug_trac_info"] = druginputData
3087 3087
 	input["invinfo"] = inputData
@@ -3246,9 +3246,9 @@ func FJyb3507(struct3507 models.Struct3507) (string, string, string) {
3246 3246
 	inputMessage := SetFjInputMessage(nonce, timestamp, struct3507.OrgName, struct3507.Opter, struct3507.FixmedinsCode, struct3507.InsuplcAdmdvs, struct3507.MdtrtareaAdmvs, struct3507.Url, struct3507.AppId, struct3507.AppSecret, struct3507.SignKey, struct3507.Enckey)
3247 3247
 	input := make(map[string]interface{})
3248 3248
 	inputData := make(map[string]interface{})
3249
-	inputMessage["infno"] = "3507"                          // 交易编码
3250
-	inputData["fixmedins_bchno"] = struct3507.FixmedinsCode // 人员编号 (来自1101接口返回)
3251
-	inputData["inv_data_type"] = struct3507.InvDataType     // 人员编号 (来自1101接口返回)
3249
+	inputMessage["infno"] = "3507"                           // 交易编码
3250
+	inputData["fixmedins_bchno"] = struct3507.FixmedinsBchno // 人员编号 (来自1101接口返回)
3251
+	inputData["inv_data_type"] = struct3507.InvDataType      // 人员编号 (来自1101接口返回)
3252 3252
 
3253 3253
 	input["data"] = inputData
3254 3254
 	inputMessage["input"] = input //交易输入
@@ -3268,3 +3268,8 @@ func FJyb3507(struct3507 models.Struct3507) (string, string, string) {
3268 3268
 	return output, requestLog, err_msg
3269 3269
 
3270 3270
 }
3271
+
3272
+func SaveW(w *models.NewDrugWarehouseInfo) (err error) {
3273
+	err = writeDb.Save(&w).Error
3274
+	return
3275
+}