test_user 1 year ago
parent
commit
c3b1930c23

+ 2 - 2
controllers/js/jsyb_controller.go View File

@@ -1088,14 +1088,14 @@ func (c *JSybController) TestGetBasBaseInit(code string, secret_key string, ak s
1088 1088
 	//miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
1089 1089
 	str := make([]byte, 2048)
1090 1090
 	inputData := make(map[string]interface{})
1091
-	inputData["IP"] = "10.72.3.87"
1091
+	inputData["IP"] = "10.58.65.240"
1092 1092
 	inputData["PORT"] = "8086"
1093 1093
 	inputData["TIMEOUT"] = "180"
1094 1094
 	inputData["LOG_PATH"] = "C:\\log\\"
1095 1095
 
1096 1096
 	//inputData["EC_URL"] = "http://10.58.33.207:10086/localcfc/api/hsecfc/localQrCodeQuery"
1097 1097
 
1098
-	inputData["EC_URL"] = "http://10.72.3.127:10086/localcfc/api/hsecfc/localQrCodeQuery"
1098
+	inputData["EC_URL"] = "http://10.58.33.207:10086/localcfc/api/hsecfc/localQrCodeQuery"
1099 1099
 	inputData["CARD_PASSTYPE"] = "1"
1100 1100
 	inputData["API_NAME"] = "hssServives"
1101 1101
 	inputData["API_VERSION"] = "1.0.0"

+ 76 - 0
controllers/nm/nm_controller.go View File

@@ -53,6 +53,9 @@ func NmybRegistRouters() {
53 53
 	beego.Router("/api/token", &NmController{}, "get:GetToken")
54 54
 	beego.Router("/api/eleinfo", &NmController{}, "get:GetNewELeInfo")
55 55
 
56
+	beego.Router("/nmyb/4102", &NmController{}, "get:Post4102")
57
+	beego.Router("/nmyb/4103", &NmController{}, "get:Post4103")
58
+
56 59
 }
57 60
 func (c *NmController) GetNewELeInfo() {
58 61
 	token := c.GetString("token")
@@ -347,6 +350,79 @@ func (c *NmController) Post5203() {
347 350
 		"pre": dat,
348 351
 	})
349 352
 }
353
+func (c *NmController) Post4102() {
354
+	org_name := c.GetString("org_name")
355
+	doctor := c.GetString("doctor")
356
+	fixmedins_code := c.GetString("fixmedins_code")
357
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
358
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
359
+	secret_key := c.GetString("secret_key")
360
+	psn_no := c.GetString("psn_no")
361
+	mdtrt_id := c.GetString("mdtrt_id")
362
+	setl_id := c.GetString("setl_id")
363
+	stas_type := c.GetString("stas_type")
364
+
365
+	bp := models.BaseParams{
366
+		SecretKey:      secret_key,
367
+		FixmedinsCode:  fixmedins_code,
368
+		InsuplcAdmdvs:  insuplc_admdvs,
369
+		MdtrtareaAdmvs: mdtrtarea_admvs,
370
+		OrgName:        org_name,
371
+		Doctor:         doctor,
372
+	}
373
+	bps := models.BusinessParams{
374
+		PsnNo:    psn_no,
375
+		MdtrtId:  mdtrt_id,
376
+		SetlId:   setl_id,
377
+		StasType: stas_type,
378
+	}
379
+	result := service.ZHyb4102(bp, bps)
380
+	saveJsLog(result, "", "4102", "确认结算清单", org_name)
381
+	var dat map[string]interface{}
382
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
383
+
384
+	} else {
385
+
386
+	}
387
+	c.ServeSuccessJSON(map[string]interface{}{
388
+		"pre": dat,
389
+	})
390
+}
391
+func (c *NmController) Post4103() {
392
+	org_name := c.GetString("org_name")
393
+	doctor := c.GetString("doctor")
394
+	fixmedins_code := c.GetString("fixmedins_code")
395
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
396
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
397
+	secret_key := c.GetString("secret_key")
398
+	psn_no := c.GetString("psn_no")
399
+	mdtrt_id := c.GetString("mdtrt_id")
400
+	setl_id := c.GetString("setl_id")
401
+	bp := models.BaseParams{
402
+		SecretKey:      secret_key,
403
+		FixmedinsCode:  fixmedins_code,
404
+		InsuplcAdmdvs:  insuplc_admdvs,
405
+		MdtrtareaAdmvs: mdtrtarea_admvs,
406
+		OrgName:        org_name,
407
+		Doctor:         doctor,
408
+	}
409
+	bps := models.BusinessParams{
410
+		PsnNo:   psn_no,
411
+		MdtrtId: mdtrt_id,
412
+		SetlId:  setl_id,
413
+	}
414
+	result := service.ZHyb4103(bp, bps)
415
+	saveJsLog(result, "", "4103", "查询结算清单", org_name)
416
+	var dat map[string]interface{}
417
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
418
+
419
+	} else {
420
+
421
+	}
422
+	c.ServeSuccessJSON(map[string]interface{}{
423
+		"pre": dat,
424
+	})
425
+}
350 426
 
351 427
 func (c *NmController) Post1101() {
352 428
 	certNo := c.GetString("cert_no")

+ 144 - 129
controllers/sg/his_api_controller.go View File

@@ -617,66 +617,6 @@ func (c *HisApiController) ReadEleToken() {
617 617
 			})
618 618
 		}
619 619
 
620
-	} else if miConfig.MdtrtareaAdmvs == "440305" || miConfig.MdtrtareaAdmvs == "440305" || miConfig.MdtrtareaAdmvs == "441202" {
621
-		if initFlag == 0 {
622
-			c.TestGetBasBaseInit()
623
-		}
624
-		token := c.GetEleBaseInfo()
625
-		token = Remove0000(token)
626
-		if len(token) > 0 {
627
-			result2, requestLog2 := service.Gdyb1101ForEleCert(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, token, "", "")
628
-			saveLog(result2, requestLog2, "1101", "获取人员信息")
629
-			var res ResultTwo
630
-			if err := json.Unmarshal([]byte(result2), &res); err != nil {
631
-				utils.ErrorLog("解析失败:%v", err)
632
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
633
-				return
634
-			}
635
-			if res.Infcode == 0 {
636
-				patient, err := service.GetPatientByNumber(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
637
-				if err == gorm.ErrRecordNotFound {
638
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
639
-					return
640
-				} else if err != nil {
641
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
642
-					return
643
-				} else {
644
-					Iinfos, _ := json.Marshal(res.Output.Iinfo)
645
-					Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
646
-					infoStr := string(Iinfos)
647
-					idetinfoStr := string(Idetinfos)
648
-					psn := &models.HisPsn{
649
-						PsnNo:        res.Output.Baseinfo.PsnNo,
650
-						Age:          res.Output.Baseinfo.Age,
651
-						PatientId:    patient.ID,
652
-						Certno:       res.Output.Baseinfo.Certno,
653
-						Brdy:         res.Output.Baseinfo.Brdy,
654
-						Gend:         res.Output.Baseinfo.Gend,
655
-						Naty:         res.Output.Baseinfo.Naty,
656
-						PsnCertType:  res.Output.Baseinfo.PsnCertType,
657
-						PsnName:      res.Output.Baseinfo.PsnName,
658
-						Idetinfo:     idetinfoStr,
659
-						Insuinfo:     infoStr,
660
-						UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
661
-						CardInfo:     "",
662
-						VerifyNumber: token,
663
-					}
664
-					service.CreateHisPsn(psn)
665
-					c.ServeSuccessJSON(map[string]interface{}{
666
-						"msg": "读取成功",
667
-					})
668
-				}
669
-			} else {
670
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
671
-				return
672
-			}
673
-		} else {
674
-			c.ServeSuccessJSON(map[string]interface{}{
675
-				"failed_code": -10,
676
-				"msg":         "读取失败",
677
-			})
678
-		}
679
-
680 620
 	} else if miConfig.MdtrtareaAdmvs == "350500" {
681 621
 		_, outPutInfo, errMsg := service.ReadEleCardForSettle(miConfig.Code, roles.UserName, roles.AdminUserId)
682 622
 		if len(errMsg) == 0 {
@@ -893,6 +833,66 @@ func (c *HisApiController) ReadEleToken() {
893 833
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
894 834
 			return
895 835
 		}
836
+	} else {
837
+		if initFlag == 0 {
838
+			c.TestGetBasBaseInit()
839
+		}
840
+		token := c.GetEleBaseInfo()
841
+		token = Remove0000(token)
842
+		if len(token) > 0 {
843
+			result2, requestLog2 := service.Gdyb1101ForEleCert(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, token, "", "")
844
+			saveLog(result2, requestLog2, "1101", "获取人员信息")
845
+			var res ResultTwo
846
+			if err := json.Unmarshal([]byte(result2), &res); err != nil {
847
+				utils.ErrorLog("解析失败:%v", err)
848
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
849
+				return
850
+			}
851
+			if res.Infcode == 0 {
852
+				patient, err := service.GetPatientByNumber(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
853
+				if err == gorm.ErrRecordNotFound {
854
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
855
+					return
856
+				} else if err != nil {
857
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
858
+					return
859
+				} else {
860
+					Iinfos, _ := json.Marshal(res.Output.Iinfo)
861
+					Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
862
+					infoStr := string(Iinfos)
863
+					idetinfoStr := string(Idetinfos)
864
+					psn := &models.HisPsn{
865
+						PsnNo:        res.Output.Baseinfo.PsnNo,
866
+						Age:          res.Output.Baseinfo.Age,
867
+						PatientId:    patient.ID,
868
+						Certno:       res.Output.Baseinfo.Certno,
869
+						Brdy:         res.Output.Baseinfo.Brdy,
870
+						Gend:         res.Output.Baseinfo.Gend,
871
+						Naty:         res.Output.Baseinfo.Naty,
872
+						PsnCertType:  res.Output.Baseinfo.PsnCertType,
873
+						PsnName:      res.Output.Baseinfo.PsnName,
874
+						Idetinfo:     idetinfoStr,
875
+						Insuinfo:     infoStr,
876
+						UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
877
+						CardInfo:     "",
878
+						VerifyNumber: token,
879
+					}
880
+					service.CreateHisPsn(psn)
881
+					c.ServeSuccessJSON(map[string]interface{}{
882
+						"msg": "读取成功",
883
+					})
884
+				}
885
+			} else {
886
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
887
+				return
888
+			}
889
+		} else {
890
+			c.ServeSuccessJSON(map[string]interface{}{
891
+				"failed_code": -10,
892
+				"msg":         "读取失败",
893
+			})
894
+		}
895
+
896 896
 	}
897 897
 }
898 898
 func (c *HisApiController) Get9001() {
@@ -2579,8 +2579,10 @@ func (c *HisApiController) ReadCard() {
2579 2579
 			name = Remove0000(name)
2580 2580
 			errmsg = Remove0000(errmsg)
2581 2581
 
2582
+			patient, _ := service.GetPatientByIDCard(id_card_no, miConfig.UserOrgId)
2583
+
2582 2584
 			basStr := cardnum + "|" + cardCode + "|" + id_card_no + "|" + name
2583
-			result, requestLog, errMsgLog := service.FJyb1101(cardnum, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, id_card_type, cardCode, certificates, miConfig.Url, miConfig.Cainfo, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey)
2585
+			result, requestLog, errMsgLog := service.FJyb1101(cardnum, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, id_card_type, cardCode, certificates, miConfig.Url, miConfig.Cainfo, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey, patient.Name)
2584 2586
 			saveLog(result, requestLog, "1101", "获取人员信息")
2585 2587
 			fmt.Println(errMsgLog)
2586 2588
 
@@ -3518,67 +3520,6 @@ func (c *HisApiController) ReadCard() {
3518 3520
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
3519 3521
 				return
3520 3522
 			}
3521
-		} else if miConfig.MdtrtareaAdmvs == "440300" || miConfig.MdtrtareaAdmvs == "440305" {
3522
-
3523
-			if initFlag == 0 {
3524
-				c.TestGetBasBaseInit()
3525
-			}
3526
-			token := c.GetEleBaseInfo()
3527
-
3528
-			token = Remove0000(token)
3529
-
3530
-			result2, requestLog2 := service.Gdyb1101ForEleCert(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, token, "", "")
3531
-			saveLog(result2, requestLog2, "1101", "获取人员信息")
3532
-			//
3533
-			var res ResultTwo
3534
-			if err := json.Unmarshal([]byte(result2), &res); err != nil {
3535
-				utils.ErrorLog("解析失败:%v", err)
3536
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3537
-				return
3538
-			}
3539
-
3540
-			if res.Infcode == 0 {
3541
-				patient, err := service.GetPatientByNumber(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
3542
-				if err == gorm.ErrRecordNotFound {
3543
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
3544
-					return
3545
-				} else if err != nil {
3546
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3547
-					return
3548
-
3549
-				} else {
3550
-					Iinfos, _ := json.Marshal(res.Output.Iinfo)
3551
-					Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
3552
-					infoStr := string(Iinfos)
3553
-					idetinfoStr := string(Idetinfos)
3554
-					psn := &models.HisPsn{
3555
-						PsnNo:        res.Output.Baseinfo.PsnNo,
3556
-						Age:          res.Output.Baseinfo.Age,
3557
-						PatientId:    patient.ID,
3558
-						Certno:       res.Output.Baseinfo.Certno,
3559
-						Brdy:         res.Output.Baseinfo.Brdy,
3560
-						Gend:         res.Output.Baseinfo.Gend,
3561
-						Naty:         res.Output.Baseinfo.Naty,
3562
-						PsnCertType:  res.Output.Baseinfo.PsnCertType,
3563
-						PsnName:      res.Output.Baseinfo.PsnName,
3564
-						Idetinfo:     idetinfoStr,
3565
-						Insuinfo:     infoStr,
3566
-						UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
3567
-						CardInfo:     "",
3568
-						VerifyNumber: token,
3569
-					}
3570
-					service.CreateHisPsn(psn)
3571
-
3572
-					c.ServeSuccessJSON(map[string]interface{}{
3573
-						"patient": patient,
3574
-						"number":  token,
3575
-					})
3576
-				}
3577
-			} else {
3578
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
3579
-				return
3580
-			}
3581
-
3582 3523
 		} else if miConfig.MdtrtareaAdmvs == "430800" {
3583 3524
 
3584 3525
 			if initFlag == 0 {
@@ -4026,6 +3967,67 @@ func (c *HisApiController) ReadCard() {
4026 3967
 				}
4027 3968
 
4028 3969
 			}
3970
+		} else {
3971
+
3972
+			if initFlag == 0 {
3973
+				c.TestGetBasBaseInit()
3974
+			}
3975
+			token := c.GetEleBaseInfo()
3976
+
3977
+			token = Remove0000(token)
3978
+
3979
+			result2, requestLog2 := service.Gdyb1101ForEleCert(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, token, "", "")
3980
+			saveLog(result2, requestLog2, "1101", "获取人员信息")
3981
+			//
3982
+			var res ResultTwo
3983
+			if err := json.Unmarshal([]byte(result2), &res); err != nil {
3984
+				utils.ErrorLog("解析失败:%v", err)
3985
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3986
+				return
3987
+			}
3988
+
3989
+			if res.Infcode == 0 {
3990
+				patient, err := service.GetPatientByNumber(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
3991
+				if err == gorm.ErrRecordNotFound {
3992
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
3993
+					return
3994
+				} else if err != nil {
3995
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3996
+					return
3997
+
3998
+				} else {
3999
+					Iinfos, _ := json.Marshal(res.Output.Iinfo)
4000
+					Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
4001
+					infoStr := string(Iinfos)
4002
+					idetinfoStr := string(Idetinfos)
4003
+					psn := &models.HisPsn{
4004
+						PsnNo:        res.Output.Baseinfo.PsnNo,
4005
+						Age:          res.Output.Baseinfo.Age,
4006
+						PatientId:    patient.ID,
4007
+						Certno:       res.Output.Baseinfo.Certno,
4008
+						Brdy:         res.Output.Baseinfo.Brdy,
4009
+						Gend:         res.Output.Baseinfo.Gend,
4010
+						Naty:         res.Output.Baseinfo.Naty,
4011
+						PsnCertType:  res.Output.Baseinfo.PsnCertType,
4012
+						PsnName:      res.Output.Baseinfo.PsnName,
4013
+						Idetinfo:     idetinfoStr,
4014
+						Insuinfo:     infoStr,
4015
+						UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
4016
+						CardInfo:     "",
4017
+						VerifyNumber: token,
4018
+					}
4019
+					service.CreateHisPsn(psn)
4020
+
4021
+					c.ServeSuccessJSON(map[string]interface{}{
4022
+						"patient": patient,
4023
+						"number":  token,
4024
+					})
4025
+				}
4026
+			} else {
4027
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
4028
+				return
4029
+			}
4030
+
4029 4031
 		}
4030 4032
 		break
4031 4033
 	}
@@ -7641,7 +7643,7 @@ func (c *HisApiController) GetRegisterInfo() {
7641 7643
 				verify_number = psn_info.VerifyNumber
7642 7644
 			} else if id_card_type == 2 {
7643 7645
 
7644
-				result, requestLog, errMsgLog := service.FJyb1101(patient.IdCardNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, id_card_type, patient.IdCardNo, certificates, miConfig.Url, miConfig.Cainfo, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey)
7646
+				result, requestLog, errMsgLog := service.FJyb1101(patient.IdCardNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, id_card_type, patient.IdCardNo, certificates, miConfig.Url, miConfig.Cainfo, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey, "")
7645 7647
 				fmt.Println(errMsgLog)
7646 7648
 				saveLog(result, requestLog, "1101", "人员基本信息获取")
7647 7649
 
@@ -7813,12 +7815,24 @@ func (c *HisApiController) GetRegisterInfo() {
7813 7815
 			var requestLog string
7814 7816
 			if miConfig.UserOrgId == 10138 {
7815 7817
 				if id_card_type != 4 {
7818
+					var insa string
7819
+					if len(patient.InsuplcAdmdvs) > 0 {
7820
+						insa = patient.InsuplcAdmdvs
7821
+					} else {
7822
+						insa = miConfig.InsuplcAdmdvs
7823
+					}
7816 7824
 					//psn_info, _ := service.GetPsnByPatientId(id)
7817 7825
 					//result, requestLog = service.Gdyb1101ForEleCert(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, psn_info.VerifyNumber)
7818
-					result, requestLog = service.Gdyb1101D(patient.IdCardNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", strconv.FormatInt(certificates, 10), name, record_time)
7826
+					result, requestLog = service.Gdyb1101D(patient.IdCardNo, miConfig.OrgName, roles.UserName, miConfig.Code, insa, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", strconv.FormatInt(certificates, 10), name, record_time)
7819 7827
 				}
7820 7828
 			} else {
7821
-				result, requestLog = service.Gdyb1101(patient.IdCardNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", strconv.FormatInt(certificates, 10), name)
7829
+				var insa string
7830
+				if len(patient.InsuplcAdmdvs) > 0 {
7831
+					insa = patient.InsuplcAdmdvs
7832
+				} else {
7833
+					insa = miConfig.InsuplcAdmdvs
7834
+				}
7835
+				result, requestLog = service.Gdyb1101(patient.IdCardNo, miConfig.OrgName, roles.UserName, miConfig.Code, insa, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", strconv.FormatInt(certificates, 10), name)
7822 7836
 			}
7823 7837
 
7824 7838
 			if id_card_type == 4 {
@@ -9598,7 +9612,7 @@ func (c *HisApiController) GetUploadInfo() {
9598 9612
 
9599 9613
 	} else if tempOrder.ID > 0 {
9600 9614
 		if tempOrder.IsPre == 1 {
9601
-			allTotal := fmt.Sprintf("%.4f", tempOrder.MedfeeSumamt)
9615
+			allTotal := fmt.Sprintf("%.2f", tempOrder.MedfeeSumamt)
9602 9616
 			var rf []*ResultFive
9603 9617
 			json.Unmarshal([]byte(his.Iinfo), &rf)
9604 9618
 			chrg_bchno := tempOrder.Number
@@ -11159,7 +11173,7 @@ func (c *HisApiController) GetPreUploadInfo() {
11159 11173
 					res.Infcode = infocode
11160 11174
 
11161 11175
 				} else {
11162
-					result, request_log := service.Gdyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, data["dept"].(string), data["fixmedins_code"].(string), data["dept_code"].(string), data["doctor_id"].(string), miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, data["balance_accounts_type"].(string), patientPrescription.DoctorId, sickConfig.CountryCode)
11176
+					result, request_log := service.Gdyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, data["dept"].(string), data["fixmedins_code"].(string), data["dept_code"].(string), data["doctor_id"].(string), his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, data["balance_accounts_type"].(string), patientPrescription.DoctorId, sickConfig.CountryCode)
11163 11177
 					var dat map[string]interface{}
11164 11178
 					if err := json.Unmarshal([]byte(result), &dat); err == nil {
11165 11179
 						fmt.Println(dat)
@@ -11295,7 +11309,7 @@ func (c *HisApiController) GetPreUploadInfo() {
11295 11309
 					}
11296 11310
 				}
11297 11311
 
11298
-				allTotal := fmt.Sprintf("%.4f", total)
11312
+				allTotal := fmt.Sprintf("%.2f", total)
11299 11313
 				if res.Infcode == 0 {
11300 11314
 					var rf []*ResultFive
11301 11315
 					json.Unmarshal([]byte(his.Iinfo), &rf)
@@ -12809,6 +12823,7 @@ func (c *HisApiController) GetCheckAccount() {
12809 12823
 		acct_pay = acct_pay + item.AcctPay
12810 12824
 		fund_pay_sumamt = fund_pay_sumamt + item.FundPaySumamt
12811 12825
 	}
12826
+
12812 12827
 	var user_name string
12813 12828
 	role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
12814 12829
 	if role.ID == 0 {
@@ -12879,7 +12894,7 @@ func (c *HisApiController) GetCheckAccount() {
12879 12894
 			}
12880 12895
 			api := "http://172.16.13.254:9532/" + "nmyb/3201?" +
12881 12896
 				"insutype=" + insutype +
12882
-				"&clr_type=" + clr_type +
12897
+				"&clr_type=" + "51" +
12883 12898
 				"&setl_optins=" + clr_org +
12884 12899
 				"&stmt_begndate=" + start_time +
12885 12900
 				"&stm_enddate=" + end_time +

+ 184 - 4
controllers/zh/zh_his_api_controller.go View File

@@ -503,6 +503,9 @@ func ZHHisManagerApiRegistRouters() {
503 503
 	beego.Router("/api/token/get", &ZHHisApiController{}, "post:GetToken")
504 504
 	beego.Router("/api/ele/info", &ZHHisApiController{}, "post:GetEleInfo")
505 505
 
506
+	beego.Router("/api/4102", &ZHHisApiController{}, "get:Get4102")
507
+	beego.Router("/api/4103", &ZHHisApiController{}, "get:Get4103")
508
+
506 509
 }
507 510
 
508 511
 func (c *ZHHisApiController) GetEleInfo() {
@@ -1171,14 +1174,11 @@ func (c *ZHHisApiController) ClearSettle() {
1171 1174
 func (c *ZHHisApiController) GetZHPatientInfo() {
1172 1175
 	id_card_no := c.GetString("id_card_no")
1173 1176
 	admin_user_id, _ := c.GetInt64("admin_user_id")
1174
-
1175 1177
 	patient, _ := service.GetPatientByIDCard(id_card_no, c.GetAdminUserInfo().CurrentOrgId)
1176
-
1177 1178
 	if patient.ID == 0 {
1178 1179
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
1179 1180
 		return
1180 1181
 	}
1181
-
1182 1182
 	role, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
1183 1183
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
1184 1184
 	config, _ := service.GetMedicalInsuranceConfig(c.GetAdminUserInfo().CurrentOrgId)
@@ -1189,10 +1189,21 @@ func (c *ZHHisApiController) GetZHPatientInfo() {
1189 1189
 		var result_log string
1190 1190
 
1191 1191
 		if miConfig.MdtrtareaAdmvs == "150499" {
1192
+			var insuplc_admdvs string
1193
+
1194
+			if len(patient.InsuplcAdmdvs) > 0 {
1195
+
1196
+				insuplc_admdvs = patient.InsuplcAdmdvs
1197
+
1198
+			} else {
1199
+				insuplc_admdvs = miConfig.InsuplcAdmdvs
1200
+
1201
+			}
1202
+
1192 1203
 			//请求内网数据
1193 1204
 			api := "http://172.16.13.254:9532/" + "nmyb/1101?cert_no=" + patient.IdCardNo +
1194 1205
 				"&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName + "&fixmedins_code=" + miConfig.Code +
1195
-				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(2, 10) + "&card_sn=" + "" + "&certificates=" + strconv.FormatInt(1, 10) + "&name=" + patient.Name
1206
+				"&insuplc_admdvs=" + insuplc_admdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(2, 10) + "&card_sn=" + "" + "&certificates=" + strconv.FormatInt(1, 10) + "&name=" + patient.Name
1196 1207
 
1197 1208
 			resp, requestErr := http.Get(api)
1198 1209
 			if requestErr != nil {
@@ -1988,6 +1999,175 @@ func (this *ZHHisApiController) GetZHOutHospitalCheck() {
1988 1999
 	}
1989 2000
 
1990 2001
 }
2002
+func (c *ZHHisApiController) Get4102() {
2003
+	order_id, _ := c.GetInt64("order_id")
2004
+	admin_user_id, _ := c.GetInt64("admin_user_id")
2005
+	stas_type := c.GetString("stas_type")
2006
+	adminUser := c.GetAdminUserInfo()
2007
+	order, _ := service.GetHisOrderByID(order_id)
2008
+	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
2009
+	var user_name string
2010
+	role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
2011
+	if role.ID == 0 {
2012
+		user_name = "管理员"
2013
+	} else {
2014
+		user_name = role.UserName
2015
+	}
2016
+	baseParams := models.BaseParams{
2017
+		SecretKey:      miConfig.SecretKey,
2018
+		FixmedinsCode:  miConfig.Code,
2019
+		InsuplcAdmdvs:  miConfig.InsuplcAdmdvs,
2020
+		MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
2021
+		OrgName:        miConfig.OrgName,
2022
+		Doctor:         user_name,
2023
+		RequestUrl:     miConfig.Url,
2024
+		AccessKey:      miConfig.AccessKey,
2025
+	}
2026
+
2027
+	businessParams := models.BusinessParams{
2028
+		PsnNo:    order.PsnNo,
2029
+		MdtrtId:  order.MdtrtId,
2030
+		SetlId:   order.SetlId,
2031
+		StasType: stas_type,
2032
+	}
2033
+
2034
+	api := "http://172.16.13.254:9532/" + "nmyb/4102?psn_no=" + businessParams.PsnNo + "&mdtrt_id=" + businessParams.MdtrtId + "&setl_id=" + businessParams.SetlId +
2035
+		"&org_name=" + miConfig.OrgName + "&doctor=" + baseParams.Doctor + "&fixmedins_code=" + miConfig.Code +
2036
+		"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&stas_type=" + stas_type
2037
+	resp, requestErr := http.Get(api)
2038
+	if requestErr != nil {
2039
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2040
+		return
2041
+	}
2042
+	body, ioErr := ioutil.ReadAll(resp.Body)
2043
+	if ioErr != nil {
2044
+		utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
2045
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2046
+		return
2047
+	}
2048
+	var respJSON map[string]interface{}
2049
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
2050
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
2051
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2052
+		return
2053
+	}
2054
+
2055
+	respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
2056
+	result, _ := json.Marshal(respJSON)
2057
+	fmt.Println("log")
2058
+	fmt.Println(string(result))
2059
+
2060
+	var res2 ResultSix
2061
+	var resEmpty10265 ResultEmpty10265
2062
+
2063
+	if err := json.Unmarshal(result, &resEmpty10265); err != nil {
2064
+		utils.ErrorLog("解析失败:%v", err)
2065
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2066
+		return
2067
+	}
2068
+	Infcode, _ := strconv.ParseInt(resEmpty10265.Infcode, 10, 64)
2069
+	res2.Infcode = Infcode
2070
+	res2.RespondTime = resEmpty10265.RespondTime
2071
+	res2.ErrMsg = resEmpty10265.ErrMsg
2072
+	res2.Output = resEmpty10265.Output
2073
+	res2.WarnMsg = resEmpty10265.WarnMsg
2074
+
2075
+	if res2.Infcode == 0 {
2076
+		c.ServeSuccessJSON(map[string]interface{}{
2077
+			"msg": "确认成功",
2078
+		})
2079
+
2080
+	} else {
2081
+		c.ServeSuccessJSON(map[string]interface{}{
2082
+			"failed_code": -10,
2083
+			"msg":         res2.ErrMsg,
2084
+		})
2085
+
2086
+	}
2087
+
2088
+}
2089
+func (c *ZHHisApiController) Get4103() {
2090
+	order_id, _ := c.GetInt64("order_id")
2091
+	admin_user_id, _ := c.GetInt64("admin_user_id")
2092
+	stas_type := c.GetString("stas_type")
2093
+	adminUser := c.GetAdminUserInfo()
2094
+	order, _ := service.GetHisOrderByID(order_id)
2095
+	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
2096
+	var user_name string
2097
+	role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
2098
+	if role.ID == 0 {
2099
+		user_name = "管理员"
2100
+	} else {
2101
+		user_name = role.UserName
2102
+	}
2103
+	baseParams := models.BaseParams{
2104
+		SecretKey:      miConfig.SecretKey,
2105
+		FixmedinsCode:  miConfig.Code,
2106
+		InsuplcAdmdvs:  miConfig.InsuplcAdmdvs,
2107
+		MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
2108
+		OrgName:        miConfig.OrgName,
2109
+		Doctor:         user_name,
2110
+		RequestUrl:     miConfig.Url,
2111
+		AccessKey:      miConfig.AccessKey,
2112
+	}
2113
+
2114
+	businessParams := models.BusinessParams{
2115
+		PsnNo:    order.PsnNo,
2116
+		MdtrtId:  order.MdtrtId,
2117
+		SetlId:   order.SetlId,
2118
+		StasType: stas_type,
2119
+	}
2120
+
2121
+	api := "http://172.16.13.254:9532/" + "nmyb/4103?psn_no=" + businessParams.PsnNo + "&mdtrt_id=" + businessParams.MdtrtId + "&setl_id=" + businessParams.SetlId +
2122
+		"&org_name=" + miConfig.OrgName + "&doctor=" + baseParams.Doctor + "&fixmedins_code=" + miConfig.Code +
2123
+		"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&stas_type=" + stas_type
2124
+	resp, requestErr := http.Get(api)
2125
+	if requestErr != nil {
2126
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2127
+		return
2128
+	}
2129
+	body, ioErr := ioutil.ReadAll(resp.Body)
2130
+	if ioErr != nil {
2131
+		utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
2132
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2133
+		return
2134
+	}
2135
+	var respJSON map[string]interface{}
2136
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
2137
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
2138
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2139
+		return
2140
+	}
2141
+	respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
2142
+	result, _ := json.Marshal(respJSON)
2143
+	fmt.Println("log")
2144
+	fmt.Println(string(result))
2145
+	var res2 ResultSix
2146
+	var resEmpty10265 ResultEmpty10265
2147
+
2148
+	if err := json.Unmarshal(result, &resEmpty10265); err != nil {
2149
+		utils.ErrorLog("解析失败:%v", err)
2150
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2151
+		return
2152
+	}
2153
+	Infcode, _ := strconv.ParseInt(resEmpty10265.Infcode, 10, 64)
2154
+	res2.Infcode = Infcode
2155
+	res2.RespondTime = resEmpty10265.RespondTime
2156
+	res2.ErrMsg = resEmpty10265.ErrMsg
2157
+	res2.Output = resEmpty10265.Output
2158
+	res2.WarnMsg = resEmpty10265.WarnMsg
2159
+	if res2.Infcode == 0 {
2160
+		c.ServeSuccessJSON(map[string]interface{}{
2161
+			"msg": string(result),
2162
+		})
2163
+	} else {
2164
+		c.ServeSuccessJSON(map[string]interface{}{
2165
+			"failed_code": -10,
2166
+			"msg":         res2.ErrMsg,
2167
+		})
2168
+	}
2169
+}
2170
+
1991 2171
 func (c *ZHHisApiController) GetSettleInfo() {
1992 2172
 	order_id, _ := c.GetInt64("order_id")
1993 2173
 	patient_id, _ := c.GetInt64("patient_id")

+ 4 - 2
main.go View File

@@ -27,8 +27,8 @@ func init() {
27 27
 	service.ConnectDB()
28 28
 	org_id, _ := beego.AppConfig.Int64("org_id")
29 29
 	miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
30
-	//CreateLog(miConfig)
31
-	//UploadLog(miConfig)
30
+	////CreateLog(miConfig)
31
+	////UploadLog(miConfig)
32 32
 	if org_id == 10191 {
33 33
 		service.GetFjAuthorizationInfo(miConfig.Code)
34 34
 	}
@@ -36,6 +36,8 @@ func init() {
36 36
 }
37 37
 func main() {
38 38
 	//service.AutoCreateStock()
39
+	//service.AutoGdybCreateStock()
40
+
39 41
 	//service.AutoUploadData
40 42
 	//GetBatchSettleList()
41 43
 	beego.Run()

+ 1 - 0
models/his_models.go View File

@@ -1036,6 +1036,7 @@ type BusinessParams struct {
1036 1036
 	PsnNo            string
1037 1037
 	MdtrtId          string
1038 1038
 	SetlId           string
1039
+	StasType         string
1039 1040
 }
1040 1041
 
1041 1042
 type BusinessParamsTwo struct {

+ 44 - 0
models/models_3501.go View File

@@ -100,6 +100,7 @@ type Struct3504 struct {
100 100
 	PurcInvoCodg        string
101 101
 	PurcInvoNo          string
102 102
 	RxFlag              string
103
+	PurcRetnStoin       string
103 104
 	PurcRetnStoinTime   string
104 105
 	PurcRetnOpterName   string
105 106
 	Memo                string
@@ -254,3 +255,46 @@ type XtDrugInventory struct {
254 255
 func (XtDrugInventory) TableName() string {
255 256
 	return "xt_drug_inventory"
256 257
 }
258
+
259
+type XtStockInventoryTwo struct {
260
+	ID                int64           `gorm:"column:id" json:"id" form:"id"`
261
+	GoodName          string          `gorm:"column:good_name" json:"good_name" form:"good_name"`
262
+	SpecificationName string          `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
263
+	WarehousingUnit   string          `gorm:"column:warehousing_unit" json:"warehousing_unit" form:"warehousing_unit"`
264
+	Count             int64           `gorm:"column:count" json:"count" form:"count"`
265
+	BuyPrice          float64         `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
266
+	PackingPrice      float64         `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
267
+	NewPrice          float64         `gorm:"column:new_price" json:"new_price" form:"new_price"`
268
+	Manufacturer      string          `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
269
+	Dealer            string          `gorm:"column:dealer" json:"dealer" form:"dealer"`
270
+	Remark            string          `gorm:"column:remark" json:"remark" form:"remark"`
271
+	GoodId            int64           `gorm:"column:good_id" json:"good_id" form:"good_id"`
272
+	UserOrgId         int64           `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
273
+	Ctime             int64           `gorm:"column:ctime" json:"ctime" form:"ctime"`
274
+	Mtime             int64           `gorm:"column:mtime" json:"mtime" form:"mtime"`
275
+	Status            int64           `gorm:"column:status" json:"status" form:"status"`
276
+	WarehousingOrder  string          `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
277
+	LicenseNumber     string          `gorm:"column:license_number" json:"license_number" form:"license_number"`
278
+	StartTime         int64           `gorm:"column:start_time" json:"start_time" form:"start_time"`
279
+	Creater           int64           `gorm:"column:creater" json:"creater" form:"creater"`
280
+	Checker           int64           `gorm:"column:checker" json:"checker" form:"checker"`
281
+	CheckerStatus     int64           `gorm:"column:checker_status" json:"checker_status" form:"checker_status"`
282
+	CheckerTime       int64           `gorm:"column:checker_time" json:"checker_time" form:"checker_time"`
283
+	Total             int64           `gorm:"column:total" json:"total" form:"total"`
284
+	Number            string          `gorm:"column:number" json:"number" form:"number"`
285
+	WarehousingInfoId int64           `gorm:"column:warehousing_info_id" json:"warehousing_info_id" form:"warehousing_info_id"`
286
+	ExpireDate        int64           `gorm:"column:expire_date" json:"expire_date" form:"expire_date"`
287
+	ProductDate       int64           `gorm:"column:product_date" json:"product_date" form:"product_date"`
288
+	GoodOriginPlace   string          `gorm:"column:good_origin_place" json:"good_origin_place" form:"good_origin_place"`
289
+	Type              int64           `gorm:"column:type" json:"type" form:"type"`
290
+	InventoryType     int64           `gorm:"column:inventory_type" json:"inventory_type" form:"inventory_type"`
291
+	LastStockCount    int64           `gorm:"column:last_stock_count" json:"last_stock_count" form:"last_stock_count"`
292
+	StockCount        int64           `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
293
+	StorehouseId      int64           `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
294
+	GoodInfo          GoodInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId" `
295
+	WarehousingInfo   WarehousingInfo `gorm:"ForeignKey:ID;AssociationForeignKey:WarehousingInfoId" json:"xt_warehouse_info"`
296
+}
297
+
298
+func (XtStockInventoryTwo) TableName() string {
299
+	return "xt_stock_inventory"
300
+}

File diff suppressed because it is too large
+ 608 - 301
service/auto_create_week_schedules_service.go


+ 3 - 3
service/fj_service.go View File

@@ -30,7 +30,7 @@ import (
30 30
 
31 31
 //
32 32
 // 人员基本信息
33
-func FJyb1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, id_card_type int64, card_sn string, certificates int64, url string, app_id string, app_secret string, sign_key string, enc_key string) (string, string, string) {
33
+func FJyb1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, id_card_type int64, card_sn string, certificates int64, url string, app_id string, app_secret string, sign_key string, enc_key string, name string) (string, string, string) {
34 34
 	//生成签名
35 35
 	nonce := GetRandomString(32)
36 36
 	timestamp := time.Now().Unix()
@@ -69,8 +69,8 @@ func FJyb1101(certNo string, org_name string, doctor string, fixmedins_code stri
69 69
 	}
70 70
 	inputData["certno"] = certNo // 证件号码
71 71
 
72
-	inputData["begntime"] = "" // 开始时间
73
-	inputData["psn_name"] = "" // 人员姓名
72
+	inputData["begntime"] = ""   // 开始时间
73
+	inputData["psn_name"] = name // 人员姓名
74 74
 	input["data"] = inputData
75 75
 	inputMessage["input"] = input //交易输入
76 76
 

+ 510 - 1
service/gdyb_service.go View File

@@ -4591,6 +4591,7 @@ func GetMac() string {
4591 4591
 // 人员基本信息
4592 4592
 func Gdyb1101D(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, psn_name string, record_date string) (string, string) {
4593 4593
 	//生成签名
4594
+	fmt.Println("DDDDD")
4594 4595
 	nonce := GetRandomString(32)
4595 4596
 	timestamp := time.Now().Unix()
4596 4597
 	signature := setSignature(timestamp, nonce, secret_key)
@@ -4619,7 +4620,7 @@ func Gdyb1101D(certNo string, org_name string, doctor string, fixmedins_code str
4619 4620
 				inputData["psn_cert_type"] = "01"   // 人员证件类型
4620 4621
 
4621 4622
 			} else {
4622
-				inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
4623
+				inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
4623 4624
 				inputData["card_sn"] = ""           // 卡识别码
4624 4625
 				inputData["certno"] = certNo        // 证件号码
4625 4626
 				inputData["psn_cert_type"] = "01"   // 人员证件类型
@@ -4806,3 +4807,511 @@ func GetSignInInfo(code string) string {
4806 4807
 	err = readDb.Model(&models.HisSignIn{}).Where("fixmedins_code = ? AND status = 1", code).Last(&sign).Error
4807 4808
 	return sign.SignNo
4808 4809
 }
4810
+
4811
+func Gdyb3501(struct3501 models.Struct3501, secret_key string) string {
4812
+	// 生成签名
4813
+	nonce := GetRandomString(32)
4814
+	timestamp := time.Now().Unix()
4815
+	signature := setSignature(timestamp, nonce, secret_key)
4816
+
4817
+	// 生成输入报文
4818
+	inputMessage := SetJSInputMessage(timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsHilistId, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Cainfo)
4819
+	input := make(map[string]interface{})
4820
+	inputData := make(map[string]interface{})
4821
+	inputMessage["infno"] = "3501"                                  // 交易编码
4822
+	inputData["med_list_codg"] = struct3501.MedListCodg             // 定点医药机构目录编号
4823
+	inputData["fixmedins_hilist_id"] = struct3501.FixmedinsHilistId // 定点医药机构目录编号
4824
+	inputData["fixmedins_hilist_name"] = struct3501.OrgName         // 定点医药机构目录名称
4825
+	inputData["rx_flag"] = struct3501.RxFlag                        //
4826
+	inputData["invdate"] = struct3501.Invdate                       // 人员编号 (来自1101接口返回)
4827
+	inputData["inv_cnt"] = struct3501.InvCnt                        // 人员编号 (来自1101接口返回)
4828
+	inputData["manu_lotnum"] = struct3501.ManuLotnum                // 人员编号 (来自1101接口返回)
4829
+	inputData["fixmedins_bchno"] = struct3501.FixmedinsBchno        // 人员编号 (来自1101接口返回)
4830
+	inputData["manu_date"] = struct3501.ManuDate                    // 人员编号 (来自1101接口返回)
4831
+	inputData["expy_end"] = struct3501.ExpyEnd                      // 人员编号 (来自1101接口返回)
4832
+	inputData["memo"] = ""                                          // 人员编号 (来自1101接口返回)
4833
+	input["invinfo"] = inputData
4834
+	inputMessage["input"] = input //交易输入
4835
+
4836
+	bytesData, err := json.Marshal(inputMessage)
4837
+	fmt.Println(string(bytesData))
4838
+	if err != nil {
4839
+		fmt.Println(err.Error())
4840
+		return err.Error()
4841
+	}
4842
+	reader := bytes.NewReader(bytesData)
4843
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
4844
+	gdyb_url := beego.AppConfig.String("gdyb_url")
4845
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
4846
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
4847
+	url := gdyb_url + "3501"
4848
+	request, err := http.NewRequest("POST", url, reader)
4849
+	if err != nil {
4850
+		fmt.Println(err.Error())
4851
+		return err.Error()
4852
+	}
4853
+
4854
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
4855
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
4856
+	request.Header.Set("x-tif-signature", signature)
4857
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
4858
+	request.Header.Set("x-tif-nonce", nonce)
4859
+
4860
+	client := http.Client{}
4861
+	resp, err := client.Do(request)
4862
+	if err != nil {
4863
+		fmt.Println(err.Error())
4864
+		return err.Error()
4865
+	}
4866
+	respBytes, err := ioutil.ReadAll(resp.Body)
4867
+	if err != nil {
4868
+		fmt.Println(err.Error())
4869
+		return err.Error()
4870
+	}
4871
+	str := string(respBytes)
4872
+	fmt.Println(str)
4873
+	return str
4874
+}
4875
+func Gdyb3502(struct3502 models.Struct3502, secret_key string) string {
4876
+	// 生成签名
4877
+	nonce := GetRandomString(32)
4878
+	timestamp := time.Now().Unix()
4879
+	signature := setSignature(timestamp, nonce, secret_key)
4880
+
4881
+	// 生成输入报文
4882
+	inputMessage := SetJSInputMessage(timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsCode, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, struct3502.Cainfo)
4883
+	input := make(map[string]interface{})
4884
+	inputData := make(map[string]interface{})
4885
+	inputMessage["infno"] = "3502"                      // 交易编码
4886
+	inputData["med_list_codg"] = struct3502.MedListCodg // 定点医药机构目录编号
4887
+	inputData["inv_chg_type"] = struct3502.InvChgType   // 定点医药机构目录编号
4888
+
4889
+	inputData["fixmedins_hilist_id"] = struct3502.FixmedinsCode // 定点医药机构目录编号
4890
+	inputData["fixmedins_hilist_name"] = struct3502.OrgName     // 定点医药机构目录名称
4891
+	inputData["fixmedins_bchno"] = struct3502.FixmedinsBchno    // 人员编号 (来自1101接口返回)
4892
+	inputData["pric"] = struct3502.Pric                         // 人员编号 (来自1101接口返回)
4893
+	inputData["cnt"] = struct3502.Cnt                           // 人员编号 (来自1101接口返回)
4894
+	inputData["rx_flag"] = struct3502.RxFlag                    //
4895
+
4896
+	inputData["inv_chg_time"] = struct3502.InvChgTime // 人员编号 (来自1101接口返回)
4897
+	inputData["inv_chg_opter_name"] = ""              // 人员编号 (来自1101接口返回)
4898
+	inputData["memo"] = struct3502.Memo               // 人员编号 (来自1101接口返回)
4899
+	inputData["trdn_flag"] = ""                       // 人员编号 (来自1101接口返回)
4900
+
4901
+	input["invinfo"] = inputData
4902
+	inputMessage["input"] = input //交易输入
4903
+
4904
+	bytesData, err := json.Marshal(inputMessage)
4905
+	fmt.Println(string(bytesData))
4906
+	if err != nil {
4907
+		fmt.Println(err.Error())
4908
+		return err.Error()
4909
+	}
4910
+	reader := bytes.NewReader(bytesData)
4911
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
4912
+	gdyb_url := beego.AppConfig.String("gdyb_url")
4913
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
4914
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
4915
+	url := gdyb_url + "3502"
4916
+	request, err := http.NewRequest("POST", url, reader)
4917
+	if err != nil {
4918
+		fmt.Println(err.Error())
4919
+		return err.Error()
4920
+	}
4921
+
4922
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
4923
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
4924
+	request.Header.Set("x-tif-signature", signature)
4925
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
4926
+	request.Header.Set("x-tif-nonce", nonce)
4927
+
4928
+	client := http.Client{}
4929
+	resp, err := client.Do(request)
4930
+	if err != nil {
4931
+		fmt.Println(err.Error())
4932
+		return err.Error()
4933
+	}
4934
+	respBytes, err := ioutil.ReadAll(resp.Body)
4935
+	if err != nil {
4936
+		fmt.Println(err.Error())
4937
+		return err.Error()
4938
+	}
4939
+	str := string(respBytes)
4940
+	fmt.Println(str)
4941
+	return str
4942
+}
4943
+func Gdyb3503(struct3503 models.Struct3503, secret_key string) string {
4944
+	// 生成签名
4945
+	nonce := GetRandomString(32)
4946
+	timestamp := time.Now().Unix()
4947
+	signature := setSignature(timestamp, nonce, secret_key)
4948
+
4949
+	// 生成输入报文
4950
+	inputMessage := SetJSInputMessage(timestamp, struct3503.OrgName, struct3503.Opter, struct3503.FixmedinsHilistId, struct3503.InsuplcAdmdvs, struct3503.MdtrtareaAdmvs, struct3503.Cainfo)
4951
+
4952
+	input := make(map[string]interface{})
4953
+
4954
+	inputMessage["infno"] = "3503"
4955
+
4956
+	item := struct3503
4957
+	feedetailInfo := make(map[string]interface{})
4958
+	feedetailInfo["med_list_codg"] = item.MedListCodg
4959
+	feedetailInfo["fixmedins_hilist_id"] = item.FixmedinsHilistId
4960
+	feedetailInfo["fixmedins_hilist_name"] = item.FixmedinsHilistName
4961
+	feedetailInfo["dynt_no"] = ""
4962
+	feedetailInfo["fixmedins_bchno"] = item.FixmedinsBchno         // 人员编号 (来自1101接口返回)
4963
+	feedetailInfo["spler_name"] = item.SplerName                   // 人员编号 (来自1101接口返回)
4964
+	feedetailInfo["spler_pmtno"] = ""                              // 人员编号 (来自1101接口返回)
4965
+	feedetailInfo["manu_lotnum"] = item.ManuLotnum                 // 人员编号 (来自1101接口返回)
4966
+	feedetailInfo["prodentp_name"] = item.ProdentpName             // 人员编号 (来自1101接口返回)
4967
+	feedetailInfo["aprvno"] = item.Aprvno                          // 人员编号 (来自1101接口返回)
4968
+	feedetailInfo["manu_date"] = item.ManuDate                     // 人员编号 (来自1101接口返回)
4969
+	feedetailInfo["expy_end"] = item.ExpyEnd                       // 人员编号 (来自1101接口返回)
4970
+	feedetailInfo["finl_trns_pric"] = item.FinlTrnsPric            // 人员编号 (来自1101接口返回)
4971
+	feedetailInfo["purc_retn_cnt"] = item.PurcRetnCnt              // 人员编号 (来自1101接口返回)
4972
+	feedetailInfo["purc_invo_codg"] = item.PurcInvoCodg            // 人员编号 (来自1101接口返回)
4973
+	feedetailInfo["purc_invo_no"] = item.PurcInvoNo                // 人员编号 (来自1101接口返回)
4974
+	feedetailInfo["rx_flag"] = item.RxFlag                         // 人员编号 (来自1101接口返回)
4975
+	feedetailInfo["purc_retn_stoin_time"] = item.PurcRetnStoinTime // 人员编号 (来自1101接口返回)
4976
+	feedetailInfo["purc_retn_opter_name"] = item.PurcRetnOpterName // 人员编号 (来自1101接口返回)
4977
+	feedetailInfo["prod_geay_flag"] = ""                           // 人员编号 (来自1101接口返回)
4978
+	feedetailInfo["memo"] = ""                                     // 人员编号 (来自1101接口返回)
4979
+	input["purcinfo"] = feedetailInfo
4980
+	inputMessage["input"] = input //交易输入
4981
+
4982
+	bytesData, err := json.Marshal(inputMessage)
4983
+	fmt.Println(string(bytesData))
4984
+	if err != nil {
4985
+		fmt.Println(err.Error())
4986
+		return err.Error()
4987
+	}
4988
+	reader := bytes.NewReader(bytesData)
4989
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
4990
+	gdyb_url := beego.AppConfig.String("gdyb_url")
4991
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
4992
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
4993
+	url := gdyb_url + "3503"
4994
+	request, err := http.NewRequest("POST", url, reader)
4995
+	if err != nil {
4996
+		fmt.Println(err.Error())
4997
+		return err.Error()
4998
+	}
4999
+
5000
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
5001
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
5002
+	request.Header.Set("x-tif-signature", signature)
5003
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
5004
+	request.Header.Set("x-tif-nonce", nonce)
5005
+
5006
+	client := http.Client{}
5007
+	resp, err := client.Do(request)
5008
+	if err != nil {
5009
+		fmt.Println(err.Error())
5010
+		return err.Error()
5011
+	}
5012
+	respBytes, err := ioutil.ReadAll(resp.Body)
5013
+	if err != nil {
5014
+		fmt.Println(err.Error())
5015
+		return err.Error()
5016
+	}
5017
+	str := string(respBytes)
5018
+	fmt.Println(str)
5019
+	return str
5020
+}
5021
+func Gdyb3504(struct3504 models.Struct3504, secret_key string) string {
5022
+	// 生成签名
5023
+	nonce := GetRandomString(32)
5024
+	timestamp := time.Now().Unix()
5025
+	signature := setSignature(timestamp, nonce, secret_key)
5026
+
5027
+	// 生成输入报文
5028
+	inputMessage := SetJSInputMessage(timestamp, struct3504.OrgName, struct3504.Opter, struct3504.FixmedinsCode, struct3504.InsuplcAdmdvs, struct3504.MdtrtareaAdmvs, struct3504.Cainfo)
5029
+	input := make(map[string]interface{})
5030
+	inputData := make(map[string]interface{})
5031
+	inputMessage["infno"] = "3504"                                      // 交易编码
5032
+	inputData["med_list_codg"] = struct3504.MedListCodg                 // 定点医药机构目录编号
5033
+	inputData["fixmedins_hilist_id"] = struct3504.FixmedinsHilistId     // 定点医药机构目录编号
5034
+	inputData["fixmedins_hilist_name"] = struct3504.FixmedinsHilistName // 定点医药机构目录名称
5035
+	inputData["fixmedins_bchno"] = struct3504.FixmedinsBchno            // 人员编号 (来自1101接口返回)
5036
+	inputData["spler_name"] = struct3504.SplerName                      // 人员编号 (来自1101接口返回)
5037
+	inputData["spler_pmtno"] = ""                                       // 人员编号 (来自1101接口返回)
5038
+
5039
+	inputData["manu_date"] = struct3504.ManuDate          // 人员编号 (来自1101接口返回)
5040
+	inputData["expy_end"] = struct3504.ExpyEnd            // 人员编号 (来自1101接口返回)
5041
+	inputData["finl_trns_pric"] = struct3504.FinlTrnsPric // 人员编号 (来自1101接口返回)
5042
+	inputData["purc_retn_cnt"] = struct3504.PurcRetnCnt   // 人员编号 (来自1101接口返回)
5043
+	inputData["purc_invo_codg"] = struct3504.PurcInvoCodg // 人员编号 (来自1101接口返回)
5044
+	inputData["purc_invo_no"] = struct3504.PurcInvoNo     // 人员编号 (来自1101接口返回)
5045
+	inputData["rx_flag"] = struct3504.RxFlag
5046
+	inputData["purc_retn_stoin_time"] = struct3504.PurcRetnStoin
5047
+	inputData["purc_retn_opter_name"] = struct3504.PurcRetnStoin
5048
+	inputData["memo"] = ""                // 人员编号 (来自1101接口返回)
5049
+	inputData["medins_prod_purc_no"] = "" // 人员编号 (来自1101接口返回)
5050
+	input["purcinfo"] = inputData
5051
+	inputMessage["input"] = input //交易输入
5052
+
5053
+	bytesData, err := json.Marshal(inputMessage)
5054
+	fmt.Println(string(bytesData))
5055
+	if err != nil {
5056
+		fmt.Println(err.Error())
5057
+		return err.Error()
5058
+	}
5059
+	reader := bytes.NewReader(bytesData)
5060
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
5061
+	gdyb_url := beego.AppConfig.String("gdyb_url")
5062
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
5063
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
5064
+	url := gdyb_url + "3504"
5065
+	request, err := http.NewRequest("POST", url, reader)
5066
+	if err != nil {
5067
+		fmt.Println(err.Error())
5068
+		return err.Error()
5069
+	}
5070
+
5071
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
5072
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
5073
+	request.Header.Set("x-tif-signature", signature)
5074
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
5075
+	request.Header.Set("x-tif-nonce", nonce)
5076
+
5077
+	client := http.Client{}
5078
+	resp, err := client.Do(request)
5079
+	if err != nil {
5080
+		fmt.Println(err.Error())
5081
+		return err.Error()
5082
+	}
5083
+	respBytes, err := ioutil.ReadAll(resp.Body)
5084
+	if err != nil {
5085
+		fmt.Println(err.Error())
5086
+		return err.Error()
5087
+	}
5088
+	str := string(respBytes)
5089
+	fmt.Println(str)
5090
+	return str
5091
+}
5092
+func Gdyb3505(struct3505 models.Struct3505, secret_key string) string {
5093
+	// 生成签名
5094
+	nonce := GetRandomString(32)
5095
+	timestamp := time.Now().Unix()
5096
+	signature := setSignature(timestamp, nonce, secret_key)
5097
+
5098
+	// 生成输入报文
5099
+	inputMessage := SetJSInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
5100
+	input := make(map[string]interface{})
5101
+	inputData := make(map[string]interface{})
5102
+	inputMessage["infno"] = "3505"                                  // 交易编码
5103
+	inputData["med_list_codg"] = struct3505.MedListCodg             // 定点医药机构目录编号
5104
+	inputData["fixmedins_hilist_id"] = struct3505.FixmedinsHilistId // 定点医药机构目录编号
5105
+	inputData["fixmedins_hilist_name"] = struct3505.OrgName         // 定点医药机构目录名称
5106
+	inputData["fixmedins_bchno"] = struct3505.FixmedinsBchno        // 人员编号 (来自1101接口返回)
5107
+
5108
+	inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
5109
+	inputData["prsc_dr_certno"] = struct3505.PrscDrCertno      // 人员编号 (来自1101接口返回)
5110
+	inputData["prsc_dr_name"] = struct3505.PrscDrName          // 人员编号 (来自1101接口返回)
5111
+	inputData["phar_cert_type"] = struct3505.PharCertType      // 人员编号 (来自1101接口返回)
5112
+	inputData["phar_certno"] = struct3505.PharCertno           // 人员编号 (来自1101接口返回)
5113
+
5114
+	inputData["phar_name"] = struct3505.PharName               // 人员编号 (来自1101接口返回)
5115
+	inputData["phar_prac_cert_no"] = struct3505.PharPracCertNo // 人员编号 (来自1101接口返回)
5116
+	inputData["hi_feesetl_type"] = struct3505.HiFeesetlType    // 人员编号 (来自1101接口返回)
5117
+	inputData["setl_id"] = struct3505.SetlId                   // 人员编号 (来自1101接口返回)
5118
+	inputData["mdtrt_sn"] = struct3505.MdtrtSn                 // 人员编号 (来自1101接口返回)
5119
+	inputData["psn_no"] = struct3505.PsnNo                     // 人员编号 (来自1101接口返回)
5120
+	inputData["psn_cert_type"] = struct3505.PsnCertType        // 人员编号 (来自1101接口返回)
5121
+	inputData["certno"] = struct3505.CertNo                    // 人员编号 (来自1101接口返回)
5122
+	inputData["psn_name"] = struct3505.PsnName                 // 人员编号 (来自1101接口返回)
5123
+	inputData["manu_lotnum"] = struct3505.ManuLotnum           // 人员编号 (来自1101接口返回)
5124
+	inputData["manu_date"] = struct3505.ManuDate               // 人员编号 (来自1101接口返回)
5125
+	inputData["expy_end"] = struct3505.ExpyEnd                 // 人员编号 (来自1101接口返回)
5126
+
5127
+	inputData["rx_flag"] = struct3505.RxFlag     // 人员编号 (来自1101接口返回)
5128
+	inputData["trdn_flag"] = struct3505.TrdnFlag // 人员编号 (来自1101接口返回)
5129
+
5130
+	inputData["finl_trns_pric"] = struct3505.FinlTrnsPric // 人员编号 (来自1101接口返回)
5131
+	inputData["rxno"] = struct3505.Rxno                   // 人员编号 (来自1101接口返回)
5132
+	inputData["rx_circ_flag"] = struct3505.RxCircFlag     // 人员编号 (来自1101接口返回)
5133
+
5134
+	inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
5135
+	inputData["stoout_no"] = struct3505.StooutNo   // 人员编号 (来自1101接口返回)
5136
+
5137
+	inputData["bchno"] = struct3505.Bchno                          // 人员编号 (来自1101接口返回)
5138
+	inputData["drug_trac_codg"] = struct3505.DrugTracCodg          // 人员编号 (来自1101接口返回)
5139
+	inputData["drug_prod_barc"] = struct3505.DrugProdBarc          // 人员编号 (来自1101接口返回)
5140
+	inputData["shelf_posi"] = struct3505.ShelfPosi                 // 人员编号 (来自1101接口返回)
5141
+	inputData["sel_retn_cnt"] = struct3505.SelRetnCnt              // 人员编号 (来自1101接口返回)
5142
+	inputData["sel_retn_time"] = struct3505.SelRetnTime            // 人员编号 (来自1101接口返回)
5143
+	inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
5144
+	inputData["memo"] = struct3505.Memo                            // 人员编号 (来自1101接口返回)
5145
+	input["selinfo"] = inputData
5146
+	inputMessage["input"] = input //交易输入
5147
+
5148
+	bytesData, err := json.Marshal(inputMessage)
5149
+	fmt.Println(string(bytesData))
5150
+	if err != nil {
5151
+		fmt.Println(err.Error())
5152
+		return err.Error()
5153
+	}
5154
+	reader := bytes.NewReader(bytesData)
5155
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
5156
+	gdyb_url := beego.AppConfig.String("gdyb_url")
5157
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
5158
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
5159
+	url := gdyb_url + "3505"
5160
+	request, err := http.NewRequest("POST", url, reader)
5161
+	if err != nil {
5162
+		fmt.Println(err.Error())
5163
+		return err.Error()
5164
+	}
5165
+
5166
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
5167
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
5168
+	request.Header.Set("x-tif-signature", signature)
5169
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
5170
+	request.Header.Set("x-tif-nonce", nonce)
5171
+
5172
+	client := http.Client{}
5173
+	resp, err := client.Do(request)
5174
+	if err != nil {
5175
+		fmt.Println(err.Error())
5176
+		return err.Error()
5177
+	}
5178
+	respBytes, err := ioutil.ReadAll(resp.Body)
5179
+	if err != nil {
5180
+		fmt.Println(err.Error())
5181
+		return err.Error()
5182
+	}
5183
+	str := string(respBytes)
5184
+	fmt.Println(str)
5185
+	return str
5186
+}
5187
+func Gdyb3506(struct3506 models.Struct3506, secret_key string) string {
5188
+	// 生成签名
5189
+	nonce := GetRandomString(32)
5190
+	timestamp := time.Now().Unix()
5191
+	signature := setSignature(timestamp, nonce, secret_key)
5192
+
5193
+	// 生成输入报文
5194
+	inputMessage := SetJSInputMessage(timestamp, struct3506.OrgName, struct3506.Opter, struct3506.FixmedinsCode, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs, struct3506.Cainfo)
5195
+	input := make(map[string]interface{})
5196
+	inputData := make(map[string]interface{})
5197
+	inputMessage["infno"] = "3506"                                  // 交易编码
5198
+	inputData["med_list_codg"] = struct3506.MedListCodg             // 定点医药机构目录编号
5199
+	inputData["fixmedins_hilist_id"] = struct3506.FixmedinsHilistId // 定点医药机构目录编号
5200
+	inputData["fixmedins_hilist_name"] = struct3506.OrgName         // 定点医药机构目录名称
5201
+	inputData["fixmedins_bchno"] = struct3506.FixmedinsBchno        // 人员编号 (来自1101接口返回)
5202
+
5203
+	inputData["setl_id"] = struct3506.SetlId                       // 人员编号 (来自1101接口返回)
5204
+	inputData["psn_no"] = struct3506.PsnNo                         // 人员编号 (来自1101接口返回)
5205
+	inputData["psn_cert_type"] = struct3506.PsnCertType            // 人员编号 (来自1101接口返回)
5206
+	inputData["certno"] = struct3506.Certno                        // 人员编号 (来自1101接口返回)
5207
+	inputData["psn_name"] = struct3506.PsnName                     // 人员编号 (来自1101接口返回)
5208
+	inputData["manu_lotnum"] = struct3506.ManuLotnum               // 人员编号 (来自1101接口返回)
5209
+	inputData["manu_date"] = struct3506.ManuDate                   // 人员编号 (来自1101接口返回)
5210
+	inputData["expy_end"] = struct3506.ExpyEnd                     // 人员编号 (来自1101接口返回)
5211
+	inputData["rx_flag"] = struct3506.RxFlag                       // 人员编号 (来自1101接口返回)
5212
+	inputData["trdn_flag"] = struct3506.TrdnFlag                   // 人员编号 (来自1101接口返回)
5213
+	inputData["finl_trns_pric"] = struct3506.FinlTrnsPric          // 人员编号 (来自1101接口返回)
5214
+	inputData["sel_retn_cnt"] = struct3506.SelRetnCnt              // 人员编号 (来自1101接口返回)
5215
+	inputData["sel_retn_time"] = struct3506.SelRetnTime            // 人员编号 (来自1101接口返回)
5216
+	inputData["sel_retn_opter_name"] = struct3506.SelRetnOpterName // 人员编号 (来自1101接口返回)
5217
+	inputData["memo"] = ""                                         // 人员编号 (来自1101接口返回)
5218
+	inputData["medins_prod_sel_no"] = ""                           // 人员编号 (来自1101接口返回)
5219
+
5220
+	input["selinfo"] = inputData
5221
+	inputMessage["input"] = input //交易输入
5222
+
5223
+	bytesData, err := json.Marshal(inputMessage)
5224
+	fmt.Println(string(bytesData))
5225
+	if err != nil {
5226
+		fmt.Println(err.Error())
5227
+		return err.Error()
5228
+	}
5229
+	reader := bytes.NewReader(bytesData)
5230
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
5231
+	gdyb_url := beego.AppConfig.String("gdyb_url")
5232
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
5233
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
5234
+	url := gdyb_url + "3506"
5235
+	request, err := http.NewRequest("POST", url, reader)
5236
+	if err != nil {
5237
+		fmt.Println(err.Error())
5238
+		return err.Error()
5239
+	}
5240
+
5241
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
5242
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
5243
+	request.Header.Set("x-tif-signature", signature)
5244
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
5245
+	request.Header.Set("x-tif-nonce", nonce)
5246
+
5247
+	client := http.Client{}
5248
+	resp, err := client.Do(request)
5249
+	if err != nil {
5250
+		fmt.Println(err.Error())
5251
+		return err.Error()
5252
+	}
5253
+	respBytes, err := ioutil.ReadAll(resp.Body)
5254
+	if err != nil {
5255
+		fmt.Println(err.Error())
5256
+		return err.Error()
5257
+	}
5258
+	str := string(respBytes)
5259
+	fmt.Println(str)
5260
+	return str
5261
+}
5262
+func Gdyb3507(struct3507 models.Struct3507, secret_key string) string {
5263
+	// 生成签名
5264
+	nonce := GetRandomString(32)
5265
+	timestamp := time.Now().Unix()
5266
+	signature := setSignature(timestamp, nonce, secret_key)
5267
+
5268
+	// 生成输入报文
5269
+	inputMessage := SetJSInputMessage(timestamp, struct3507.OrgName, struct3507.Opter, struct3507.FixmedinsCode, struct3507.InsuplcAdmdvs, struct3507.MdtrtareaAdmvs, struct3507.Cainfo)
5270
+	input := make(map[string]interface{})
5271
+	inputData := make(map[string]interface{})
5272
+	inputMessage["infno"] = "3507"                          // 交易编码
5273
+	inputData["fixmedins_bchno"] = struct3507.FixmedinsCode // 人员编号 (来自1101接口返回)
5274
+	inputData["inv_data_type"] = struct3507.InvDataType     // 人员编号 (来自1101接口返回)
5275
+
5276
+	input["data"] = inputData
5277
+	inputMessage["input"] = input //交易输入
5278
+
5279
+	bytesData, err := json.Marshal(inputMessage)
5280
+	fmt.Println(string(bytesData))
5281
+	if err != nil {
5282
+		fmt.Println(err.Error())
5283
+		return err.Error()
5284
+	}
5285
+	reader := bytes.NewReader(bytesData)
5286
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
5287
+	gdyb_url := beego.AppConfig.String("gdyb_url")
5288
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
5289
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
5290
+	url := gdyb_url + "3507"
5291
+	request, err := http.NewRequest("POST", url, reader)
5292
+	if err != nil {
5293
+		fmt.Println(err.Error())
5294
+		return err.Error()
5295
+	}
5296
+
5297
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
5298
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
5299
+	request.Header.Set("x-tif-signature", signature)
5300
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
5301
+	request.Header.Set("x-tif-nonce", nonce)
5302
+
5303
+	client := http.Client{}
5304
+	resp, err := client.Do(request)
5305
+	if err != nil {
5306
+		fmt.Println(err.Error())
5307
+		return err.Error()
5308
+	}
5309
+	respBytes, err := ioutil.ReadAll(resp.Body)
5310
+	if err != nil {
5311
+		fmt.Println(err.Error())
5312
+		return err.Error()
5313
+	}
5314
+	str := string(respBytes)
5315
+	fmt.Println(str)
5316
+	return str
5317
+}

+ 1 - 0
service/his_service.go View File

@@ -154,6 +154,7 @@ type Patients struct {
154 154
 	IsExcelExport                int64   `gorm:"column:is_excel_export" json:"is_excel_export" form:"is_excel_export"`
155 155
 	SchRemark                    string  `gorm:"column:sch_remark" json:"sch_remark" form:"sch_remark"`
156 156
 	OutReason                    string  `gorm:"column:out_reason" json:"out_reason" form:"out_reason"`
157
+	InsuplcAdmdvs                string  `gorm:"column:insuplc_admdvs" json:"insuplc_admdvs" form:"insuplc_admdvs"`
157 158
 }
158 159
 
159 160
 func (Patients) TableName() string {

+ 11 - 11
service/hn_service.go View File

@@ -1158,17 +1158,17 @@ func Hnyb3201(fixmedins_setl_cnt int64, acct_pay float64, fund_pay_sumamt float6
1158 1158
 	inputMessage := SetHnInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
1159 1159
 	input := make(map[string]interface{})
1160 1160
 	inputData := make(map[string]interface{})
1161
-	inputMessage["infno"] = "3201"                       // 交易编码
1162
-	inputData["insutype"] = insutype                     // 险种
1163
-	inputData["clr_type"] = clr_type                     // 就诊 ID(来自2201接口返回)
1164
-	inputData["setl_optins"] = setl_optins               // 结算经办机构
1165
-	inputData["stmt_begndate"] = stmt_begndate           // 对帐开始时间
1166
-	inputData["stmt_enddate"] = stmt_enddate             //对帐结束时间
1167
-	inputData["medfee_sumamt"] = medfee_sumamt           //医疗费总额
1168
-	inputData["fund_pay_sumamt"] = fund_pay_sumamt       //基金支付总额
1169
-	inputData["acct_pay"] = acct_pay                     //个人账户支付金额
1170
-	inputData["fixmedins_setl_cnt"] = fixmedins_setl_cnt //定点医药机构结算笔数
1171
-	inputData["refd_setl_flag"] = 0                      //
1161
+	inputMessage["infno"] = "3201"                                      // 交易编码
1162
+	inputData["insutype"] = insutype                                    // 险种
1163
+	inputData["clr_type"] = clr_type                                    // 就诊 ID(来自2201接口返回)
1164
+	inputData["setl_optins"] = setl_optins                              // 结算经办机构
1165
+	inputData["stmt_begndate"] = stmt_begndate                          // 对帐开始时间
1166
+	inputData["stmt_enddate"] = stmt_enddate                            //对帐结束时间
1167
+	inputData["medfee_sumamt"] = fmt.Sprintf("%.2f", medfee_sumamt)     //医疗费总额
1168
+	inputData["fund_pay_sumamt"] = fmt.Sprintf("%.2f", fund_pay_sumamt) //基金支付总额
1169
+	inputData["acct_pay"] = fmt.Sprintf("%.2f", acct_pay)               //个人账户支付金额
1170
+	inputData["fixmedins_setl_cnt"] = fixmedins_setl_cnt                //定点医药机构结算笔数
1171
+	inputData["refd_setl_flag"] = 0                                     //
1172 1172
 
1173 1173
 	input["data"] = inputData
1174 1174
 	inputMessage["input"] = input //交易输入

+ 0 - 2
service/jsyb_service.go View File

@@ -1790,7 +1790,6 @@ func Jsyb3502(struct3502 models.Struct3502) (string, string) {
1790 1790
 	return HttpRequest(struct3502.RequestUrl, struct3502.AccessKey, struct3502.SecretKey, timestamp, string(bytesData)), string(bytesData)
1791 1791
 
1792 1792
 }
1793
-
1794 1793
 func Jsyb3503(struct3503 models.Struct3503) (string, string) {
1795 1794
 	timestamp := time.Now().Unix()
1796 1795
 	// 生成输入报文
@@ -1980,7 +1979,6 @@ func Jsyb3506(struct3506 models.Struct3506) (string, string) {
1980 1979
 	return HttpRequest(struct3506.RequestUrl, struct3506.AccessKey, struct3506.SecretKey, timestamp, string(bytesData)), string(bytesData)
1981 1980
 
1982 1981
 }
1983
-
1984 1982
 func Jsyb3507(struct3507 models.Struct3507) (string, string) {
1985 1983
 	timestamp := time.Now().Unix()
1986 1984
 	// 生成输入报文

+ 139 - 1
service/zh_his_service.go View File

@@ -784,7 +784,8 @@ func ZHGdyb2301A(psnNo string, mdtrtId string, hisPrescription []*models.NewCust
784 784
 		feedetailInfo["feedetl_sn"] = item.FeedetlSn
785 785
 		feedetailInfo["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
786 786
 		feedetailInfo["psn_no"] = psnNo     // 人员编号 (来自1101接口返回)
787
-		feedetailInfo["med_type"] = ""
787
+		feedetailInfo["med_type"] = med_type
788
+
788 789
 		feedetailInfo["fee_ocur_time"] = item.FeeOcurTime            // 费用发生时间
789 790
 		feedetailInfo["med_list_codg"] = item.MedListCodg            // 医疗目录编码
790 791
 		feedetailInfo["medins_list_codg"] = fixmedins_code           // 医药机构目录编码
@@ -1502,3 +1503,140 @@ func ZHyb5203(baseParams models.BaseParams, businessParams models.BusinessParams
1502 1503
 	fmt.Println(str)
1503 1504
 	return str
1504 1505
 }
1506
+
1507
+func ZHyb4102(baseParams models.BaseParams, businessParams models.BusinessParams) string {
1508
+	// 生成签名
1509
+	nonce := GetRandomString(32)
1510
+	timestamp := time.Now().Unix()
1511
+	signature := setSignature(timestamp, nonce, baseParams.SecretKey)
1512
+	fmt.Println("~~~~~~2")
1513
+
1514
+	// 生成输入报文
1515
+	inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
1516
+	input := make(map[string]interface{})
1517
+	inputData := make(map[string]interface{})
1518
+	inputMessage["infno"] = "4102" // 交易编码
1519
+
1520
+	inputDataDetail := make(map[string]interface{})
1521
+	inputDataDetails := make([]map[string]interface{}, 0)
1522
+
1523
+	inputDataDetail["psn_no"] = businessParams.PsnNo
1524
+	inputDataDetail["setl_id"] = businessParams.SetlId
1525
+	inputDataDetail["stas_type"] = businessParams.StasType
1526
+	inputDataDetails = append(inputDataDetails, inputDataDetail)
1527
+	inputData["stastinfo"] = inputDataDetails
1528
+	input["data"] = inputData
1529
+	inputMessage["input"] = input //交易输入
1530
+	bytesData, err := json.Marshal(inputMessage)
1531
+	fmt.Println(string(bytesData))
1532
+	fmt.Println(string(bytesData))
1533
+	if err != nil {
1534
+		fmt.Println(err.Error())
1535
+		return err.Error()
1536
+	}
1537
+	reader := bytes.NewReader(bytesData)
1538
+	gdyb_url := beego.AppConfig.String("gdyb_url")
1539
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
1540
+
1541
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
1542
+	//url := gdyb_url + "5203"
1543
+	var url string
1544
+	if baseParams.FixmedinsCode == "H15049901371" {
1545
+		url = gdyb_url
1546
+	} else {
1547
+		url = gdyb_url + "4102"
1548
+	}
1549
+
1550
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5203"
1551
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/5203"
1552
+
1553
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/5203"
1554
+	request, err := http.NewRequest("POST", url, reader)
1555
+	if err != nil {
1556
+		fmt.Println(err.Error())
1557
+		return err.Error()
1558
+	}
1559
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1560
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
1561
+	request.Header.Set("x-tif-signature", signature)
1562
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1563
+	request.Header.Set("x-tif-nonce", nonce)
1564
+	client := http.Client{}
1565
+	resp, err := client.Do(request)
1566
+	if err != nil {
1567
+		fmt.Println(err.Error())
1568
+		return err.Error()
1569
+	}
1570
+	respBytes, err := ioutil.ReadAll(resp.Body)
1571
+	if err != nil {
1572
+		fmt.Println(err.Error())
1573
+		return err.Error()
1574
+	}
1575
+	str := string(respBytes)
1576
+	fmt.Println(str)
1577
+	return str
1578
+}
1579
+func ZHyb4103(baseParams models.BaseParams, businessParams models.BusinessParams) string {
1580
+	// 生成签名
1581
+	nonce := GetRandomString(32)
1582
+	timestamp := time.Now().Unix()
1583
+	signature := setSignature(timestamp, nonce, baseParams.SecretKey)
1584
+
1585
+	// 生成输入报文
1586
+	inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
1587
+	input := make(map[string]interface{})
1588
+	inputData := make(map[string]interface{})
1589
+	inputMessage["infno"] = "4103" // 交易编码
1590
+	inputData["psn_no"] = businessParams.PsnNo
1591
+	inputData["setl_id"] = businessParams.SetlId
1592
+	input["data"] = inputData
1593
+	inputMessage["input"] = input //交易输入
1594
+	bytesData, err := json.Marshal(inputMessage)
1595
+	fmt.Println(string(bytesData))
1596
+	fmt.Println(string(bytesData))
1597
+	if err != nil {
1598
+		fmt.Println(err.Error())
1599
+		return err.Error()
1600
+	}
1601
+	reader := bytes.NewReader(bytesData)
1602
+	gdyb_url := beego.AppConfig.String("gdyb_url")
1603
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
1604
+
1605
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
1606
+	//url := gdyb_url + "5203"
1607
+	var url string
1608
+	if baseParams.FixmedinsCode == "H15049901371" {
1609
+		url = gdyb_url
1610
+	} else {
1611
+		url = gdyb_url + "4103"
1612
+	}
1613
+
1614
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5203"
1615
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/5203"
1616
+
1617
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/5203"
1618
+	request, err := http.NewRequest("POST", url, reader)
1619
+	if err != nil {
1620
+		fmt.Println(err.Error())
1621
+		return err.Error()
1622
+	}
1623
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1624
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
1625
+	request.Header.Set("x-tif-signature", signature)
1626
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1627
+	request.Header.Set("x-tif-nonce", nonce)
1628
+	client := http.Client{}
1629
+	resp, err := client.Do(request)
1630
+	if err != nil {
1631
+		fmt.Println(err.Error())
1632
+		return err.Error()
1633
+	}
1634
+	respBytes, err := ioutil.ReadAll(resp.Body)
1635
+	if err != nil {
1636
+		fmt.Println(err.Error())
1637
+		return err.Error()
1638
+	}
1639
+	str := string(respBytes)
1640
+	fmt.Println(str)
1641
+	return str
1642
+}