Bladeren bron

Merge branch 'master' of http://git.shengws.com/csx/gdyb

csx 3 jaren geleden
bovenliggende
commit
af50281ff9

+ 6 - 2
controllers/sg/gdyb_controller.go Bestand weergeven

@@ -162,8 +162,12 @@ func (c *GdybController) PostFour() {
162 162
 	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
163 163
 	secret_key := c.GetString("secret_key")
164 164
 
165
-	result := service.Gdyb2203(psnNo, mdtrtId, doctor, department, diag, org_name, med_type, doctor_id, fixmedins_code, diag_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_code, sick_name)
166
-
165
+	var result string
166
+	if c.GetAdminUserInfo().CurrentOrgId == 10106 {
167
+		result = service.Gdyb2203A(psnNo, mdtrtId, doctor, department, diag, org_name, med_type, doctor_id, fixmedins_code, diag_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_code, sick_name)
168
+	} else {
169
+		result = service.Gdyb2203(psnNo, mdtrtId, doctor, department, diag, org_name, med_type, doctor_id, fixmedins_code, diag_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_code, sick_name)
170
+	}
167 171
 	var dat map[string]interface{}
168 172
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
169 173
 

+ 453 - 91
controllers/sg/his_api_controller.go Bestand weergeven

@@ -56,6 +56,14 @@ func HisManagerApiRegistRouters() {
56 56
 	beego.Router("/api/310", &HisApiController{}, "get:Check310")
57 57
 	beego.Router("/api/390", &HisApiController{}, "get:Check390")
58 58
 
59
+	//备案撤销相关接口
60
+	beego.Router("/api/checkcode/get", &HisApiController{}, "get:GetCheckCode")
61
+	beego.Router("/api/uncheckcode/get", &HisApiController{}, "get:UnCheckCode")
62
+	beego.Router("/api/psn/putonrecord", &HisApiController{}, "get:PsnPutOnRecord")
63
+	beego.Router("/api/psn/unputonrecord", &HisApiController{}, "get:PsnUnPutOnRecord")
64
+	beego.Router("/api/psn/ncds/putonrecord", &HisApiController{}, "get:PsnPutNCDSOnRecord")
65
+	beego.Router("/api/psn/ncds/unputonrecord", &HisApiController{}, "get:PsnPutUnNCDSOnRecord")
66
+
59 67
 }
60 68
 
61 69
 //func (c *HisApiController) TestPay() {
@@ -203,7 +211,6 @@ func (c *HisApiController) GetHisPatientInfo() {
203 211
 		Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
204 212
 		infoStr := string(Iinfos)
205 213
 		idetinfoStr := string(Idetinfos)
206
-
207 214
 		if res.Infcode == 0 {
208 215
 			his := models.VMHisPatient{
209 216
 				Status:      1,
@@ -231,7 +238,6 @@ func (c *HisApiController) GetHisPatientInfo() {
231 238
 			return
232 239
 		}
233 240
 	}
234
-
235 241
 }
236 242
 
237 243
 //func (c *HisApiController) Sscard() {
@@ -811,6 +817,33 @@ type ResultTwelve struct {
811 817
 	WarnMsg     interface{} `json:"warn_msg"`
812 818
 }
813 819
 
820
+type ResultThirteen struct {
821
+	ErrMsg      string `json:"err_msg"`
822
+	InfRefmsgid string `json:"inf_refmsgid"`
823
+	Infcode     int64  `json:"infcode"`
824
+	Output      struct {
825
+		Result struct {
826
+			TrtDclaDetlSn string `json:"trt_dcla_detl_sn"`
827
+		} `json:"result"`
828
+	} `json:"output"`
829
+	RefmsgTime  string      `json:"refmsg_time"`
830
+	RespondTime string      `json:"respond_time"`
831
+	Signtype    interface{} `json:"signtype"`
832
+	WarnInfo    interface{} `json:"warn_info"`
833
+}
834
+
835
+type ResultFourteen struct {
836
+	ErrMsg      string `json:"err_msg"`
837
+	InfRefmsgid string `json:"inf_refmsgid"`
838
+	Infcode     int64  `json:"infcode"`
839
+	Output      struct {
840
+	} `json:"output"`
841
+	RefmsgTime  string      `json:"refmsg_time"`
842
+	RespondTime string      `json:"respond_time"`
843
+	Signtype    interface{} `json:"signtype"`
844
+	WarnInfo    interface{} `json:"warn_info"`
845
+}
846
+
814 847
 type Custom struct {
815 848
 	DetItemFeeSumamt string
816 849
 	Cut              string
@@ -2738,9 +2771,7 @@ func (c *HisApiController) GetCheckAccount() {
2738 2771
 	startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
2739 2772
 	endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
2740 2773
 	orders, _ := service.GetOrderByTime(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, clr_type)
2741
-
2742 2774
 	orders_two, _ := service.GetOrderByTimeThree(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, clr_type)
2743
-
2744 2775
 	fixmedins_setl_cnt := int64(len(orders_two))
2745 2776
 
2746 2777
 	//撤销的算2条数据为一笔
@@ -2764,7 +2795,6 @@ func (c *HisApiController) GetCheckAccount() {
2764 2795
 	} else {
2765 2796
 		user_name = role.UserName
2766 2797
 	}
2767
-
2768 2798
 	if config.IsOpen == 1 {
2769 2799
 		api := "http://127.0.0.1:9532/" + "gdyb/ten?" +
2770 2800
 			"insutype=" + insutype +
@@ -2802,46 +2832,48 @@ func (c *HisApiController) GetCheckAccount() {
2802 2832
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2803 2833
 			return
2804 2834
 		}
2805
-
2806 2835
 		respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
2807 2836
 		userJSONBytes, _ := json.Marshal(respJSON)
2808
-
2809 2837
 		var res ResultEight
2810 2838
 		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
2811 2839
 			utils.ErrorLog("解析失败:%v", err)
2812 2840
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2813 2841
 			return
2814 2842
 		}
2815
-
2816 2843
 		if res.Infcode == 0 {
2817
-			micc := &models.MedicalInsuranceCostCompare{
2818
-				StartTime: startime.Unix(),
2819
-				EndTime:   endtime.Unix(),
2820
-				Insutype:  insutype,
2821
-				CheckType: 1,
2822
-				Num:       fixmedins_setl_cnt,
2823
-				Mtime:     time.Now().Unix(),
2824
-				Status:    1,
2825
-				UserOrgId: adminUser.CurrentOrgId,
2826
-				CostTotal: medfee_sumamt,
2827
-				FuncTotal: fund_pay_sumamt,
2828
-				PsnPay:    acct_pay,
2829
-				Creator:   admin_user_id,
2830
-				Ctime:     time.Now().Unix(),
2831
-			}
2832
-
2833
-			err := service.CreateMedicalInsuranceCostCompareRecord(micc)
2844
+			if res.Output.Stmtinfo.StmtRslt == "0" {
2845
+				micc := &models.MedicalInsuranceCostCompare{
2846
+					StartTime: startime.Unix(),
2847
+					EndTime:   endtime.Unix(),
2848
+					Insutype:  insutype,
2849
+					CheckType: 1,
2850
+					Num:       fixmedins_setl_cnt,
2851
+					Mtime:     time.Now().Unix(),
2852
+					Status:    1,
2853
+					UserOrgId: adminUser.CurrentOrgId,
2854
+					CostTotal: medfee_sumamt,
2855
+					FuncTotal: fund_pay_sumamt,
2856
+					PsnPay:    acct_pay,
2857
+					Creator:   admin_user_id,
2858
+					Ctime:     time.Now().Unix(),
2859
+				}
2860
+				err := service.CreateMedicalInsuranceCostCompareRecord(micc)
2861
+				if err == nil {
2862
+					c.ServeSuccessJSON(map[string]interface{}{
2863
+						"stmt_rslt":      res.Output.Stmtinfo.StmtRslt,
2864
+						"stmt_rslt_dscr": res.Output.Stmtinfo.StmtRsltDscr,
2865
+					})
2834 2866
 
2835
-			if err == nil {
2867
+				} else {
2868
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2869
+				}
2870
+			} else {
2836 2871
 				c.ServeSuccessJSON(map[string]interface{}{
2837
-					"stmt_rslt":      res.Output.Stmtinfo.StmtRslt,
2838
-					"stmt_rslt_dscr": res.Output.Stmtinfo.StmtRsltDscr,
2872
+					"code": -10,
2873
+					"msg":  res.ErrMsg,
2839 2874
 				})
2840 2875
 
2841
-			} else {
2842
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2843 2876
 			}
2844
-
2845 2877
 		} else {
2846 2878
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2847 2879
 		}
@@ -3347,46 +3379,6 @@ func (c *HisApiController) GetSettleAccounts() {
3347 3379
 
3348 3380
 }
3349 3381
 
3350
-func (c *HisApiController) GetCode() {
3351
-
3352
-	name := c.GetString("name")
3353
-	codg := c.GetString("codg")
3354
-
3355
-	adminUser := c.GetAdminUserInfo()
3356
-
3357
-	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
3358
-	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
3359
-
3360
-	var user_name string
3361
-	role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, adminUser.AdminUser.Id)
3362
-	if role.ID == 0 {
3363
-		user_name = "xxx"
3364
-	} else {
3365
-		user_name = role.UserName
3366
-	}
3367
-
3368
-	baseParams := &models.BaseParams{
3369
-		SecretKey:      miConfig.SecretKey,
3370
-		FixmedinsCode:  miConfig.Code,
3371
-		InsuplcAdmdvs:  miConfig.InsuplcAdmdvs,
3372
-		MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
3373
-		OrgName:        miConfig.OrgName,
3374
-		Doctor:         user_name,
3375
-	}
3376
-
3377
-	if config.IsOpen == 1 {
3378
-		result := service.Gdyb3301(baseParams, name, codg)
3379
-		var dat map[string]interface{}
3380
-		if err := json.Unmarshal([]byte(result), &dat); err == nil {
3381
-			fmt.Println(dat)
3382
-		} else {
3383
-			fmt.Println(err)
3384
-		}
3385
-
3386
-	}
3387
-
3388
-}
3389
-
3390 3382
 func (c *HisApiController) CheckTreatment() {
3391 3383
 	patient_id, _ := c.GetInt64("patient_id", 0)
3392 3384
 	record_time := c.GetString("record_time")
@@ -3647,6 +3639,396 @@ func (c *HisApiController) GetUploadDiag() {
3647 3639
 
3648 3640
 }
3649 3641
 
3642
+func (c *HisApiController) GetCheckCode() {
3643
+	name := c.GetString("name")
3644
+	codg := c.GetString("codg")
3645
+	list_type_code := c.GetString("list_type_code")
3646
+	admin_user_id, _ := c.GetInt64("admin_user_id")
3647
+
3648
+	adminUser := c.GetAdminUserInfo()
3649
+
3650
+	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
3651
+	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
3652
+
3653
+	var user_name string
3654
+	role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
3655
+	if role.ID == 0 {
3656
+		user_name = "xxx"
3657
+	} else {
3658
+		user_name = role.UserName
3659
+	}
3660
+
3661
+	baseParams := &models.BaseParams{
3662
+		SecretKey:      miConfig.SecretKey,
3663
+		FixmedinsCode:  miConfig.Code,
3664
+		InsuplcAdmdvs:  miConfig.InsuplcAdmdvs,
3665
+		MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
3666
+		OrgName:        miConfig.OrgName,
3667
+		Doctor:         user_name,
3668
+	}
3669
+
3670
+	if config.IsOpen == 1 {
3671
+		result := service.Gdyb3301(baseParams, name, codg, list_type_code)
3672
+		var dat map[string]interface{}
3673
+		if err := json.Unmarshal([]byte(result), &dat); err == nil {
3674
+			fmt.Println(dat)
3675
+		} else {
3676
+			fmt.Println(err)
3677
+		}
3678
+
3679
+	}
3680
+
3681
+}
3682
+func (c *HisApiController) UnCheckCode() {
3683
+	name := c.GetString("name")
3684
+	codg := c.GetString("codg")
3685
+	list_type_code := c.GetString("list_type_code")
3686
+	admin_user_id, _ := c.GetInt64("admin_user_id")
3687
+
3688
+	adminUser := c.GetAdminUserInfo()
3689
+
3690
+	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
3691
+	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
3692
+
3693
+	var user_name string
3694
+	role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
3695
+	if role.ID == 0 {
3696
+		user_name = "xxx"
3697
+	} else {
3698
+		user_name = role.UserName
3699
+	}
3700
+
3701
+	baseParams := &models.BaseParams{
3702
+		SecretKey:      miConfig.SecretKey,
3703
+		FixmedinsCode:  miConfig.Code,
3704
+		InsuplcAdmdvs:  miConfig.InsuplcAdmdvs,
3705
+		MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
3706
+		OrgName:        miConfig.OrgName,
3707
+		Doctor:         user_name,
3708
+	}
3709
+
3710
+	if config.IsOpen == 1 {
3711
+		result := service.Gdyb3302(baseParams, name, codg, list_type_code)
3712
+		var dat map[string]interface{}
3713
+		if err := json.Unmarshal([]byte(result), &dat); err == nil {
3714
+			fmt.Println(dat)
3715
+		} else {
3716
+			fmt.Println(err)
3717
+		}
3718
+
3719
+	}
3720
+
3721
+}
3722
+func (c *HisApiController) PsnPutOnRecord() {
3723
+	record_type, _ := c.GetInt64("type")
3724
+	patient_id, _ := c.GetInt64("patient_id")
3725
+	admin_user_id, _ := c.GetInt64("admin_user_id")
3726
+	start_time := c.GetString("start_time")
3727
+	end_time := c.GetString("end_time")
3728
+
3729
+	adminUser := c.GetAdminUserInfo()
3730
+	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
3731
+	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
3732
+
3733
+	var patients []*models.Patients
3734
+	if record_type == 1 { //全部备案
3735
+
3736
+		patient, _ := service.GetAllPatient(adminUser.CurrentOrgId)
3737
+		patients = append(patients, patient...)
3738
+
3739
+	} else { //单个备案
3740
+		patient, _ := service.GetPatientByID(adminUser.CurrentOrgId, patient_id)
3741
+		patients = append(patients, patient)
3742
+
3743
+	}
3744
+
3745
+	var user_name string
3746
+	role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
3747
+	if role.ID == 0 {
3748
+		user_name = "xxx"
3749
+	} else {
3750
+		user_name = role.UserName
3751
+	}
3752
+
3753
+	if config.IsOpen == 1 {
3754
+		for _, item := range patients {
3755
+			api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + item.IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + user_name + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
3756
+			resp, requestErr := http.Get(api)
3757
+			if requestErr != nil {
3758
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3759
+				return
3760
+			}
3761
+			defer resp.Body.Close()
3762
+			body, ioErr := ioutil.ReadAll(resp.Body)
3763
+			if ioErr != nil {
3764
+				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
3765
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3766
+				return
3767
+			}
3768
+			var respJSON map[string]interface{}
3769
+
3770
+			if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
3771
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3772
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3773
+				return
3774
+			}
3775
+
3776
+			userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
3777
+			userJSONBytes, _ := json.Marshal(userJSON)
3778
+			var res ResultTwo
3779
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
3780
+				utils.ErrorLog("解析失败:%v", err)
3781
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3782
+				return
3783
+			}
3784
+
3785
+			if res.Infcode == 0 {
3786
+				result := service.Gdyb2505(res.Output.Baseinfo.PsnNo, user_name, miConfig.OrgName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, start_time, end_time)
3787
+				var dat map[string]interface{}
3788
+				if err := json.Unmarshal([]byte(result), &dat); err == nil {
3789
+					fmt.Println(dat)
3790
+				} else {
3791
+					fmt.Println(err)
3792
+				}
3793
+
3794
+				userJSONBytes, _ := json.Marshal(dat)
3795
+
3796
+				var res2 ResultThirteen
3797
+				if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
3798
+					utils.ErrorLog("解析失败:%v", err)
3799
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3800
+					return
3801
+				}
3802
+				if res2.Infcode == 0 {
3803
+					psnResult := &models.GdybPsnRecord{
3804
+						UserOrgId:     adminUser.CurrentOrgId,
3805
+						PatientId:     item.ID,
3806
+						PsnNo:         res.Output.Baseinfo.PsnNo,
3807
+						Ctime:         time.Now().Unix(),
3808
+						Mtime:         time.Now().Unix(),
3809
+						Status:        1,
3810
+						IsCancel:      1,
3811
+						TrtDclaDetlSn: res2.Output.Result.TrtDclaDetlSn,
3812
+					}
3813
+					service.CreatePsnRecord(psnResult)
3814
+
3815
+				} else {
3816
+					c.ServeSuccessJSON(map[string]interface{}{
3817
+						"failed_code": -10,
3818
+						"msg":         res2.ErrMsg,
3819
+					})
3820
+					return
3821
+				}
3822
+
3823
+			}
3824
+
3825
+		}
3826
+	}
3827
+
3828
+}
3829
+func (c *HisApiController) PsnUnPutOnRecord() {
3830
+	id, _ := c.GetInt64("id")
3831
+	//record_type, _ := c.GetInt64("type")
3832
+	admin_user_id, _ := c.GetInt64("admin_user_id")
3833
+
3834
+	adminUser := c.GetAdminUserInfo()
3835
+	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
3836
+	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
3837
+
3838
+	var user_name string
3839
+	role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
3840
+	if role.ID == 0 {
3841
+		user_name = "xxx"
3842
+	} else {
3843
+		user_name = role.UserName
3844
+	}
3845
+
3846
+	psn_record, _ := service.GetPsnRecordById(id)
3847
+	if psn_record.ID == 0 {
3848
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorPsnRecordNoExistWrong)
3849
+		return
3850
+	}
3851
+	if config.IsOpen == 1 {
3852
+		result := service.Gdyb2506(psn_record.PsnNo, user_name, miConfig.OrgName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, psn_record.TrtDclaDetlSn)
3853
+		var dat map[string]interface{}
3854
+		if err := json.Unmarshal([]byte(result), &dat); err == nil {
3855
+			fmt.Println(dat)
3856
+		} else {
3857
+			fmt.Println(err)
3858
+		}
3859
+
3860
+		userJSONBytes, _ := json.Marshal(dat)
3861
+		var res ResultFourteen
3862
+		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
3863
+			utils.ErrorLog("解析失败:%v", err)
3864
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3865
+			return
3866
+		}
3867
+		if res.Infcode == 0 {
3868
+			psn_record.IsCancel = 2
3869
+			service.CreatePsnRecord(&psn_record)
3870
+		} else {
3871
+			c.ServeSuccessJSON(map[string]interface{}{
3872
+				"failed_code": -10,
3873
+				"msg":         res.ErrMsg,
3874
+			})
3875
+			return
3876
+		}
3877
+	}
3878
+
3879
+}
3880
+func (c *HisApiController) PsnPutNCDSOnRecord() {
3881
+	record_type, _ := c.GetInt64("type")
3882
+	patient_id, _ := c.GetInt64("patient_id")
3883
+	admin_user_id, _ := c.GetInt64("admin_user_id")
3884
+	adminUser := c.GetAdminUserInfo()
3885
+	var patients []*models.Patients
3886
+	if record_type == 1 { //全部备案
3887
+		patient, _ := service.GetAllPatient(adminUser.CurrentOrgId)
3888
+		patients = append(patients, patient...)
3889
+	} else { //单个备案
3890
+		patient, _ := service.GetPatientByID(adminUser.CurrentOrgId, patient_id)
3891
+		patients = append(patients, patient)
3892
+	}
3893
+	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
3894
+	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
3895
+	var user_name string
3896
+	role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
3897
+	if role.ID == 0 {
3898
+		user_name = "xxx"
3899
+	} else {
3900
+		user_name = role.UserName
3901
+	}
3902
+
3903
+	if config.IsOpen == 1 {
3904
+		for _, item := range patients {
3905
+			api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + item.IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + user_name + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
3906
+			resp, requestErr := http.Get(api)
3907
+			if requestErr != nil {
3908
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3909
+				return
3910
+			}
3911
+			defer resp.Body.Close()
3912
+			body, ioErr := ioutil.ReadAll(resp.Body)
3913
+			if ioErr != nil {
3914
+				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
3915
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3916
+				return
3917
+			}
3918
+			var respJSON map[string]interface{}
3919
+
3920
+			if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
3921
+				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3922
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3923
+				return
3924
+			}
3925
+
3926
+			userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
3927
+			userJSONBytes, _ := json.Marshal(userJSON)
3928
+			var res ResultTwo
3929
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
3930
+				utils.ErrorLog("解析失败:%v", err)
3931
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3932
+				return
3933
+			}
3934
+
3935
+			if res.Infcode == 0 {
3936
+				result := service.Gdyb2503(res.Output.Baseinfo.PsnNo, res.Output.Iinfo[0].Insutype, miConfig.OrgName, user_name, miConfig.Code, strconv.FormatInt(admin_user_id, 10), miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, "慢性肾功能不全(血透治疗)", "M07803")
3937
+				var dat map[string]interface{}
3938
+				if err := json.Unmarshal([]byte(result), &dat); err == nil {
3939
+					fmt.Println(dat)
3940
+				} else {
3941
+					fmt.Println(err)
3942
+				}
3943
+
3944
+				userJSONBytes, _ := json.Marshal(dat)
3945
+
3946
+				var res2 ResultThirteen
3947
+				if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
3948
+					utils.ErrorLog("解析失败:%v", err)
3949
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3950
+					return
3951
+				}
3952
+
3953
+				//patient, _ := service.GetPatientByIDCard(item.IdCardNo, adminUser.CurrentOrgId)
3954
+
3955
+				if res2.Infcode == 0 {
3956
+					psnResult := &models.GdybPsnNcdsRecord{
3957
+						UserOrgId:     adminUser.CurrentOrgId,
3958
+						PatientId:     item.ID,
3959
+						PsnNo:         res.Output.Baseinfo.PsnNo,
3960
+						Ctime:         time.Now().Unix(),
3961
+						Mtime:         time.Now().Unix(),
3962
+						Status:        1,
3963
+						IsCancel:      1,
3964
+						TrtDclaDetlSn: res2.Output.Result.TrtDclaDetlSn,
3965
+					}
3966
+					service.CreatePsnNCDSRecord(psnResult)
3967
+
3968
+				} else {
3969
+					c.ServeSuccessJSON(map[string]interface{}{
3970
+						"failed_code": -10,
3971
+						"msg":         res2.ErrMsg,
3972
+					})
3973
+					return
3974
+				}
3975
+			}
3976
+
3977
+		}
3978
+
3979
+	}
3980
+
3981
+}
3982
+func (c *HisApiController) PsnPutUnNCDSOnRecord() {
3983
+	id, _ := c.GetInt64("id")
3984
+	admin_user_id, _ := c.GetInt64("admin_user_id")
3985
+	adminUser := c.GetAdminUserInfo()
3986
+	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
3987
+	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
3988
+
3989
+	var user_name string
3990
+	role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
3991
+	if role.ID == 0 {
3992
+		user_name = "xxx"
3993
+	} else {
3994
+		user_name = role.UserName
3995
+	}
3996
+
3997
+	psn_record, _ := service.GetPsnNCDSRecordById(id)
3998
+	if psn_record.ID == 0 {
3999
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorPsnRecordNoExistWrong)
4000
+		return
4001
+	}
4002
+	if config.IsOpen == 1 {
4003
+		result := service.Gdyb2504(psn_record.PsnNo, miConfig.OrgName, user_name, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, psn_record.TrtDclaDetlSn)
4004
+		var dat map[string]interface{}
4005
+		if err := json.Unmarshal([]byte(result), &dat); err == nil {
4006
+			fmt.Println(dat)
4007
+		} else {
4008
+			fmt.Println(err)
4009
+		}
4010
+
4011
+		userJSONBytes, _ := json.Marshal(dat)
4012
+		var res ResultFourteen
4013
+		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
4014
+			utils.ErrorLog("解析失败:%v", err)
4015
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4016
+			return
4017
+		}
4018
+		if res.Infcode == 0 {
4019
+			psn_record.IsCancel = 2
4020
+			service.CreatePsnNCDSRecord(&psn_record)
4021
+		} else {
4022
+			c.ServeSuccessJSON(map[string]interface{}{
4023
+				"failed_code": -10,
4024
+				"msg":         res.ErrMsg,
4025
+			})
4026
+			return
4027
+		}
4028
+	}
4029
+
4030
+}
4031
+
3650 4032
 func PathExists(path string) (bool, error) {
3651 4033
 	_, err := os.Stat(path)
3652 4034
 	if err == nil {
@@ -3760,23 +4142,3 @@ func RemoveRepeatedCode(arr []string) (newArr []string) {
3760 4142
 	}
3761 4143
 	return
3762 4144
 }
3763
-
3764
-//func ShowMessage1(caption, text string, style uintptr) (result int) {
3765
-//	user32, _ := syscall.LoadLibrary("SSCard.dll")
3766
-//	messageBox, _ := syscall.GetProcAddress(user32, "MessageBoxW")
3767
-//	defer syscall.FreeLibrary(user32)
3768
-//
3769
-//	ret, _, _ := syscall.Syscall9(messageBox,
3770
-//		4,
3771
-//		0,
3772
-//		StrPtr(text),
3773
-//		StrPtr(caption),
3774
-//		style,
3775
-//		0, 0, 0, 0, 0)
3776
-//	result = int(ret)
3777
-//	return
3778
-//}
3779
-
3780
-//func StrPtr3(s string) uintptr {
3781
-//	return uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(s)))
3782
-//}

+ 129 - 12
controllers/sz/sz_his_api_controller.go Bestand weergeven

@@ -264,6 +264,63 @@ type ResultFour struct {
264 264
 	Aae501             string `json:"aae501"`
265 265
 }
266 266
 
267
+type ResultMZ001 struct {
268
+	Transtime          string `json:"transTime"`
269
+	Transtype          string `json:"transType"`
270
+	Transreturncode    string `json:"transReturnCode"`
271
+	Transreturnmessage string `json:"transReturnMessage"`
272
+	Transversion       string `json:"transVersion"`
273
+	Serialnumber       string `json:"serialNumber"`
274
+	Cardarea           string `json:"cardArea"`
275
+	Hospitalcode       string `json:"hospitalCode"`
276
+	Operatorcode       string `json:"operatorCode"`
277
+	Operatorname       string `json:"operatorName"`
278
+	Operatorpass       string `json:"operatorPass"`
279
+	Transbody          struct {
280
+		Aaz515      string  `json:"aaz515"`
281
+		Aaz500      string  `json:"aaz500"`
282
+		Aac001      float64 `json:"aac001"`
283
+		Aac999      string  `json:"aac999"`
284
+		Aac002      string  `json:"aac002"`
285
+		Aac058      string  `json:"aac058"`
286
+		Aac147      string  `json:"aac147"`
287
+		Aac003      string  `json:"aac003"`
288
+		Aac004      string  `json:"aac004"`
289
+		Aac006      float64 `json:"aac006"`
290
+		Bae093      float64 `json:"bae093"`
291
+		Cac215      string  `json:"cac215"`
292
+		Aac066      string  `json:"aac066"`
293
+		Aac008      string  `json:"aac008"`
294
+		Bke404      string  `json:"bke404"`
295
+		Aae240      float64 `json:"aae240"`
296
+		Bkc346      string  `json:"bkc346"`
297
+		Ckc601      string  `json:"ckc601"`
298
+		Caz574      string  `json:"caz574"`
299
+		Caz654      string  `json:"caz654"`
300
+		Ckc403      string  `json:"ckc403"`
301
+		Ckc362      string  `json:"ckc362"`
302
+		Ckc363      string  `json:"ckc363"`
303
+		Outputlist1 []struct {
304
+			Aab001 float64 `json:"aab001"`
305
+			Aab999 string  `json:"aab999"`
306
+			Aab004 string  `json:"aab004"`
307
+			Aab019 string  `json:"aab019"`
308
+			Aae140 string  `json:"aae140"`
309
+			Aae030 float64 `json:"aae030"`
310
+			Aae031 string  `json:"aae031"`
311
+			Bcc334 string  `json:"bcc334"`
312
+			Aac031 string  `json:"aac031"`
313
+		} `json:"outputlist1"`
314
+	} `json:"transBody"`
315
+	Verifycode         string `json:"verifyCode"`
316
+	Extenddeviceid     string `json:"extendDeviceId"`
317
+	Transchannel       string `json:"transChannel"`
318
+	Extenduserid       string `json:"extendUserId"`
319
+	Extendserialnumber string `json:"extendSerialNumber"`
320
+	Caz055             string `json:"caz055"`
321
+	Aae501             string `json:"aae501"`
322
+}
323
+
267 324
 type SZHisApiController struct {
268 325
 	controllers.BaseAuthAPIController
269 326
 }
@@ -273,6 +330,8 @@ func SZHisManagerApiRegistRouters() {
273 330
 	beego.Router("/sz/api/register/get", &SZHisApiController{}, "get:GetRegisterInfo")
274 331
 	//上传明细,预结算
275 332
 	//beego.Router("/sz/api/upload/get", &SZHisApiController{}, "get:GetUploadInfo")
333
+	//获取个人信息
334
+	//beego.Router("/sz/api/info/get", &SZHisApiController{}, /**/"get:GetInfo")
276 335
 
277 336
 	//结算
278 337
 	beego.Router("/sz/api/settle/get", &SZHisApiController{}, "get:GetSettleInfo")
@@ -866,6 +925,7 @@ func (c *SZHisApiController) GetRegisterInfo() {
866 925
 			fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
867 926
 		mz_number := miConfig.Code + year + month + day +
868 927
 			fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000))
928
+
869 929
 		//1.判断读卡类型
870 930
 		//2.读卡 获取交易验证码,医疗证号,发卡地区行政区划代码
871 931
 		yiliao_number, id_card_number, verifyCode, version_code, health_card_no, _, ret4 := ReadBasCardGetNumber("MZ002" + "|" + number + "|" + miConfig.Code + "|")
@@ -884,8 +944,26 @@ func (c *SZHisApiController) GetRegisterInfo() {
884 944
 		fmt.Println(patient_id)
885 945
 
886 946
 		if tempPatient.ID == patient_id {
947
+			temp_mz_number := miConfig.Code + year + month + day +
948
+				fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000))
949
+			tempVerifyCode, tempVersionCode := ReadCardGetCode("XX001" + "|" + temp_mz_number + "|" + miConfig.Code)
950
+			result001 := service.SzybXX001(opera_name, opera_code, miConfig.Code, yiliao_number, tempVerifyCode, temp_mz_number, tempVersionCode)
951
+
887 952
 			if ret4 == 0 { //本地卡流程
888 953
 				if is_yidi == 1 {
954
+
955
+					//var dat2 map[string]interface{}
956
+					//if err := json.Unmarshal([]byte(result001), &dat2); err == nil {
957
+					//	fmt.Println(dat2)
958
+					//} else {
959
+					//	fmt.Println(err)
960
+					//}
961
+					//userJSONBytes2, _ := json.Marshal(dat2)
962
+					//var res2 ResultMZ001
963
+					//if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
964
+					//	utils.ErrorLog("解析失败:%v", err)
965
+					//}
966
+
889 967
 					//本地就医流程
890 968
 					//挂号
891 969
 					resp_result := service.SzybMZ002(opera_name, opera_code, miConfig.Code, dept_code, yiliao_number, verifyCode, number, mz_number, version_code, custom_code, custom_project_name, allPrice, medical_care)
@@ -932,6 +1010,7 @@ func (c *SZHisApiController) GetRegisterInfo() {
932 1010
 							MzNumber:               number,
933 1011
 							Number:                 mz_number,
934 1012
 							PsnNo:                  health_card_no,
1013
+							PatientInfo:            result001,
935 1014
 						}
936 1015
 						service.CreateHisPatientTwo(&his)
937 1016
 						c.ServeSuccessJSON(map[string]interface{}{
@@ -999,6 +1078,7 @@ func (c *SZHisApiController) GetRegisterInfo() {
999 1078
 							MzNumber:               number,
1000 1079
 							Number:                 mz_number,
1001 1080
 							PsnNo:                  health_card_no,
1081
+							PatientInfo:            result001,
1002 1082
 						}
1003 1083
 						service.CreateHisPatientTwo(&his)
1004 1084
 						c.ServeSuccessJSON(map[string]interface{}{
@@ -1065,6 +1145,7 @@ func (c *SZHisApiController) GetRegisterInfo() {
1065 1145
 							MzNumber:               number,
1066 1146
 							Number:                 mz_number,
1067 1147
 							PsnNo:                  health_card_no,
1148
+							PatientInfo:            result001,
1068 1149
 						}
1069 1150
 						service.CreateHisPatientTwo(&his)
1070 1151
 						c.ServeSuccessJSON(map[string]interface{}{
@@ -1127,6 +1208,7 @@ func (c *SZHisApiController) GetRegisterInfo() {
1127 1208
 							MzNumber:               number,
1128 1209
 							Number:                 mz_number,
1129 1210
 							PsnNo:                  health_card_no,
1211
+							PatientInfo:            result001,
1130 1212
 						}
1131 1213
 						service.CreateHisPatientTwo(&his)
1132 1214
 						c.ServeSuccessJSON(map[string]interface{}{
@@ -1152,6 +1234,23 @@ func (c *SZHisApiController) GetRegisterInfo() {
1152 1234
 	}
1153 1235
 }
1154 1236
 
1237
+//func (c *SZHisApiController) GetInfo() {
1238
+//	adminInfo := c.GetAdminUserInfo()
1239
+//	miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
1240
+//	month := time.Unix(1557042972, 0).Format("1")
1241
+//	year := time.Now().Format("2006")
1242
+//	month = time.Now().Format("01")
1243
+//	day := time.Now().Format("02")
1244
+//	//流水号
1245
+//	number := miConfig.Code + year + month + day +
1246
+//		fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
1247
+//	//1.判断读卡类型
1248
+//	//2.读卡 获取交易验证码,医疗证号,发卡地区行政区划代码
1249
+//	yiliao_number, _, verifyCode, version_code, _, _, _ := ReadBasCardGetNumber("XX001" + "|" + number + "|" + miConfig.Code + "|")
1250
+//	fmt.Println(result)
1251
+//
1252
+//}
1253
+
1155 1254
 func (c *SZHisApiController) RefundNumber() {
1156 1255
 	record_time := c.GetString("record_time")
1157 1256
 	patient_id, _ := c.GetInt64("patient_id")
@@ -2886,6 +2985,7 @@ func (c *SZHisApiController) GetSettleAccounts() {
2886 2985
 		return
2887 2986
 	}
2888 2987
 	recordDateTime := theTime.Unix()
2988
+	fmt.Println(recordDateTime)
2889 2989
 	var order models.HisOrder
2890 2990
 	order, _ = service.GetHisOrderByID(order_id)
2891 2991
 
@@ -2934,10 +3034,11 @@ func (c *SZHisApiController) GetSettleAccounts() {
2934 3034
 	//departments, _ := service.Get(patientPrescription.Departments)
2935 3035
 
2936 3036
 	departments, _ := service.GetDepartMentDetail(patientPrescription.Departments)
2937
-
2938 3037
 	if order.ID == 0 {
2939
-		order, _ = service.GetHisOrderThree(recordDateTime, patient_id, adminUser.CurrentOrgId)
3038
+		//order, _ = service.GetHisOrderThree(recordDateTime, patient_id, adminUser.CurrentOrgId)
2940 3039
 
3040
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
3041
+		return
2941 3042
 	}
2942 3043
 	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
2943 3044
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
@@ -2982,17 +3083,33 @@ func (c *SZHisApiController) GetSettleAccounts() {
2982 3083
 			return
2983 3084
 		}
2984 3085
 		if res.Transreturncode == "00000000" {
3086
+
3087
+			var dat2 map[string]interface{}
3088
+			if err := json.Unmarshal([]byte(his.PatientInfo), &dat2); err == nil {
3089
+				fmt.Println(dat2)
3090
+			} else {
3091
+				fmt.Println(err)
3092
+			}
3093
+			userJSONBytes2, _ := json.Marshal(dat2)
3094
+			var res2 ResultMZ001
3095
+			if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
3096
+				utils.ErrorLog("解析失败:%v", err)
3097
+			}
3098
+
2985 3099
 			c.ServeSuccessJSON(map[string]interface{}{
2986
-				"result":         res,
2987
-				"org_name":       miConfig.OrgName,
2988
-				"org_code":       miConfig.Code,
2989
-				"patient_name":   patient.Name,
2990
-				"doctor_code":    adminRole_two.DoctorCode,
2991
-				"doctor_name":    doctor_name,
2992
-				"health_card_no": order.PsnNo,
2993
-				"order_number":   order.Number,
2994
-				"department":     departments.Name,
2995
-				"yiliao_leibie":  yiliao_leibie,
3100
+				"result":             res,
3101
+				"org_name":           miConfig.OrgName,
3102
+				"org_code":           miConfig.Code,
3103
+				"patient_name":       patient.Name,
3104
+				"doctor_code":        adminRole_two.DoctorCode,
3105
+				"doctor_name":        doctor_name,
3106
+				"health_card_no":     order.PsnNo,
3107
+				"health_card_no_two": res2.Transbody.Aaz500,
3108
+				"order_number":       order.Number,
3109
+				"department":         departments.Name,
3110
+				"yiliao_leibie":      yiliao_leibie,
3111
+				"before_money":       res2.Transbody.Aae240,
3112
+				"after_money":        res.Transbody.Cke298,
2996 3113
 			})
2997 3114
 		} else {
2998 3115
 			c.ServeSuccessJSON(map[string]interface{}{

+ 4 - 0
enums/error_code.go Bestand weergeven

@@ -247,6 +247,8 @@ const ( // ErrorCode
247 247
 	ErrorNoReadCardException = 30005
248 248
 
249 249
 	ErrorCodeParamSickTypeWrong = 30006
250
+
251
+	ErrorPsnRecordNoExistWrong = 30007
250 252
 )
251 253
 
252 254
 var ErrCodeMsgs = map[int]string{
@@ -476,6 +478,8 @@ var ErrCodeMsgs = map[int]string{
476 478
 	ErrorNoReadCardException: "无法读取除社保卡以外的卡",
477 479
 
478 480
 	ErrorCodeParamSickTypeWrong: "医生所开处方的疾病类型不能为空",
481
+
482
+	ErrorPsnRecordNoExistWrong: "人员备案信息不存在",
479 483
 }
480 484
 
481 485
 type SGJError struct {

+ 33 - 0
models/gdyb_models.go Bestand weergeven

@@ -0,0 +1,33 @@
1
+package models
2
+
3
+type GdybPsnRecord struct {
4
+	ID            int64  `gorm:"column:id" json:"id" form:"id"`
5
+	UserOrgId     int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
6
+	PatientId     int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
7
+	PsnNo         string `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
8
+	Ctime         int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
9
+	Mtime         int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
10
+	Status        int64  `gorm:"column:status" json:"status" form:"status"`
11
+	IsCancel      int64  `gorm:"column:is_cancel" json:"is_cancel" form:"is_cancel"`
12
+	TrtDclaDetlSn string `gorm:"column:trt_dcla_detl_sn" json:"trt_dcla_detl_sn" form:"trt_dcla_detl_sn"`
13
+}
14
+
15
+func (GdybPsnRecord) TableName() string {
16
+	return "gdyb_psn_record"
17
+}
18
+
19
+type GdybPsnNcdsRecord struct {
20
+	ID            int64  `gorm:"column:id" json:"id" form:"id"`
21
+	UserOrgId     int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
22
+	PatientId     int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
23
+	PsnNo         string `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
24
+	Ctime         int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
25
+	Mtime         int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
26
+	Status        int64  `gorm:"column:status" json:"status" form:"status"`
27
+	IsCancel      int64  `gorm:"column:is_cancel" json:"is_cancel" form:"is_cancel"`
28
+	TrtDclaDetlSn string `gorm:"column:trt_dcla_detl_sn" json:"trt_dcla_detl_sn" form:"trt_dcla_detl_sn"`
29
+}
30
+
31
+func (GdybPsnNcdsRecord) TableName() string {
32
+	return "gdyb_psn_ncds_record"
33
+}

+ 3 - 0
models/his_models.go Bestand weergeven

@@ -119,6 +119,7 @@ type HisPatient struct {
119 119
 	SocialType             int64   `gorm:"column:social_type" json:"social_type" form:"social_type"`
120 120
 	YiliaoNumber           string  `gorm:"column:yiliao_number" json:"yiliao_number" form:"yiliao_number"`
121 121
 	MzNumber               string  `gorm:"column:mz_number" json:"mz_number" form:"mz_number"`
122
+	PatientInfo            string  `gorm:"column:patient_info" json:"patient_info" form:"patient_info"`
122 123
 }
123 124
 
124 125
 func (HisPatient) TableName() string {
@@ -577,6 +578,7 @@ type XtHisPatient struct {
577 578
 	SocialType             int64   `gorm:"column:social_type" json:"social_type" form:"social_type"`
578 579
 	YiliaoNumber           string  `gorm:"column:yiliao_number" json:"yiliao_number" form:"yiliao_number"`
579 580
 	MzNumber               string  `gorm:"column:mz_number" json:"mz_number" form:"mz_number"`
581
+	PatientInfo            string  `gorm:"column:patient_info" json:"patient_info" form:"patient_info"`
580 582
 }
581 583
 
582 584
 func (XtHisPatient) TableName() string {
@@ -767,6 +769,7 @@ type VMHisPatient struct {
767 769
 	IdCardType             int64   `gorm:"column:id_card_type" json:"id_card_type" form:"id_card_type"`
768 770
 	YiliaoNumber           string  `gorm:"column:yiliao_number" json:"yiliao_number" form:"yiliao_number"`
769 771
 	MzNumber               string  `gorm:"column:mz_number" json:"mz_number" form:"mz_number"`
772
+	PatientInfo            string  `gorm:"column:patient_info" json:"patient_info" form:"patient_info"`
770 773
 }
771 774
 
772 775
 func (VMHisPatient) TableName() string {

+ 349 - 7
service/gdyb_service.go Bestand weergeven

@@ -370,6 +370,91 @@ func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, di
370 370
 	return str
371 371
 }
372 372
 
373
+// 门诊就诊信息上传
374
+func Gdyb2203A(psnNo string, mdtrtId string, doctor string, department string, diag string, org_name string, med_type string, doctor_id int64, fixmedins_code string, diag_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string) string {
375
+	// 生成签名
376
+	nonce := GetRandomString(32)
377
+	timestamp := time.Now().Unix()
378
+	signature := setSignature(timestamp, nonce, secret_key)
379
+	tempTime := time.Unix(timestamp, 0)
380
+	timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
381
+
382
+	// 生成输入报文
383
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
384
+	input := make(map[string]interface{})
385
+	inputData := make(map[string]interface{})
386
+	diseinfo := make([]map[string]interface{}, 0)
387
+
388
+	inputMessage["infno"] = "2203A"       // 交易编码
389
+	inputData["mdtrt_id"] = mdtrtId       // 就诊 ID(来自2201接口返回)
390
+	inputData["psn_no"] = psnNo           // 人员编号 (来自1101接口返回)
391
+	inputData["med_type"] = med_type      // 医疗类别 16门诊特殊病
392
+	inputData["begntime"] = timeFormatOne // 开始时间
393
+	inputData["main_cond_dscr"] = ""      // 主要病情描述
394
+	inputData["dise_codg"] = sick_code    // 病种编码
395
+	inputData["dise_name"] = sick_name    // 病种名称
396
+	inputData["birctrl_type"] = ""        // 计划生育手术类别
397
+	inputData["birctrl_matn_date"] = ""   // 计划生育手术或生育日期
398
+
399
+	inputData["matn_type"] = "" // 生育类别
400
+	inputData["geso_val"] = ""  // 孕周数
401
+
402
+	diseinfo_sun := make(map[string]interface{})
403
+	diseinfo_sun["diag_type"] = "1"           // 诊断类别
404
+	diseinfo_sun["diag_srt_no"] = "1"         // 诊断排序号
405
+	diseinfo_sun["diag_code"] = diag_code     // 诊断代码
406
+	diseinfo_sun["diag_name"] = diag          // 诊断名称
407
+	diseinfo_sun["diag_dept"] = department    // 诊断科室
408
+	diseinfo_sun["dise_dor_no"] = doctor_id   // 诊断医生编码
409
+	diseinfo_sun["dise_dor_name"] = doctor    // 诊断医生姓名
410
+	diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
411
+	diseinfo_sun["vali_flag"] = "1"           // 有效标志
412
+
413
+	diseinfo = append(diseinfo, diseinfo_sun)
414
+	input["diseinfo"] = diseinfo
415
+	input["mdtrtinfo"] = inputData
416
+	inputMessage["input"] = input //交易输入
417
+
418
+	bytesData, err := json.Marshal(inputMessage)
419
+	fmt.Println(string(bytesData))
420
+	if err != nil {
421
+		fmt.Println(err.Error())
422
+		return err.Error()
423
+	}
424
+	reader := bytes.NewReader(bytesData)
425
+
426
+	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2203A"
427
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
428
+
429
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
430
+	request, err := http.NewRequest("POST", url, reader)
431
+	if err != nil {
432
+		fmt.Println(err.Error())
433
+		return err.Error()
434
+	}
435
+
436
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
437
+	request.Header.Set("x-tif-paasid", "sg03_prd")
438
+	request.Header.Set("x-tif-signature", signature)
439
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
440
+	request.Header.Set("x-tif-nonce", nonce)
441
+
442
+	client := http.Client{}
443
+	resp, err := client.Do(request)
444
+	if err != nil {
445
+		fmt.Println(err.Error())
446
+		return err.Error()
447
+	}
448
+	respBytes, err := ioutil.ReadAll(resp.Body)
449
+	if err != nil {
450
+		fmt.Println(err.Error())
451
+		return err.Error()
452
+	}
453
+	str := string(respBytes)
454
+	fmt.Println(str)
455
+	return str
456
+}
457
+
373 458
 type Custom struct {
374 459
 	DetItemFeeSumamt string
375 460
 	Cut              string
@@ -1242,7 +1327,7 @@ func Gdyb5203(baseParams models.BaseParams, businessParams models.BusinessParams
1242 1327
 	return str
1243 1328
 }
1244 1329
 
1245
-func Gdyb3301(baseParams *models.BaseParams, name string, codg string) string {
1330
+func Gdyb3301(baseParams *models.BaseParams, name string, codg string, list_type_code string) string {
1246 1331
 	// 生成签名
1247 1332
 	nonce := GetRandomString(32)
1248 1333
 	timestamp := time.Now().Unix()
@@ -1253,14 +1338,12 @@ func Gdyb3301(baseParams *models.BaseParams, name string, codg string) string {
1253 1338
 	input := make(map[string]interface{})
1254 1339
 	inputData := make(map[string]interface{})
1255 1340
 	inputMessage["infno"] = "3301" // 交易编码
1256
-
1257 1341
 	inputData["fixmedins_hilist_id"] = baseParams.FixmedinsCode
1258
-
1259
-	inputData["fixmedins_hilist_name"] = name
1260
-	inputData["list_type"] = "西药"
1342
+	inputData["fixmedins_hilist_name"] = baseParams.OrgName
1343
+	inputData["list_type"] = list_type_code
1261 1344
 	inputData["med_list_codg"] = codg
1262 1345
 	inputData["begndate"] = "2021-01-01"
1263
-	inputData["enddate"] = "2021-01-07"
1346
+	inputData["enddate"] = "2099-01-07"
1264 1347
 
1265 1348
 	inputData["aprvno"] = ""
1266 1349
 	inputData["dosform"] = ""
@@ -1308,7 +1391,61 @@ func Gdyb3301(baseParams *models.BaseParams, name string, codg string) string {
1308 1391
 	fmt.Println(str)
1309 1392
 	return str
1310 1393
 }
1394
+func Gdyb3302(baseParams *models.BaseParams, name string, codg string, list_type_code string) string {
1395
+	// 生成签名
1396
+	nonce := GetRandomString(32)
1397
+	timestamp := time.Now().Unix()
1398
+	signature := setSignature(timestamp, nonce, baseParams.SecretKey)
1311 1399
 
1400
+	// 生成输入报文
1401
+	inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
1402
+	input := make(map[string]interface{})
1403
+	inputData := make(map[string]interface{})
1404
+	inputMessage["infno"] = "3302" // 交易编码
1405
+	inputData["fixmedins_hilist_id"] = baseParams.FixmedinsCode
1406
+	inputData["fixmedins_hilist_name"] = baseParams.OrgName
1407
+	inputData["list_type"] = list_type_code
1408
+	inputData["med_list_codg"] = codg
1409
+	inputData["begndate"] = "2021-01-01"
1410
+	inputData["enddate"] = "2099-01-07"
1411
+
1412
+	input["catalogcompin"] = inputData
1413
+	inputMessage["input"] = input //交易输入
1414
+	bytesData, err := json.Marshal(inputMessage)
1415
+	fmt.Println(string(bytesData))
1416
+	if err != nil {
1417
+		fmt.Println(err.Error())
1418
+		return err.Error()
1419
+	}
1420
+	reader := bytes.NewReader(bytesData)
1421
+	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3301"
1422
+
1423
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/5203"
1424
+	request, err := http.NewRequest("POST", url, reader)
1425
+	if err != nil {
1426
+		fmt.Println(err.Error())
1427
+		return err.Error()
1428
+	}
1429
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1430
+	request.Header.Set("x-tif-paasid", "sg03_prd")
1431
+	request.Header.Set("x-tif-signature", signature)
1432
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1433
+	request.Header.Set("x-tif-nonce", nonce)
1434
+	client := http.Client{}
1435
+	resp, err := client.Do(request)
1436
+	if err != nil {
1437
+		fmt.Println(err.Error())
1438
+		return err.Error()
1439
+	}
1440
+	respBytes, err := ioutil.ReadAll(resp.Body)
1441
+	if err != nil {
1442
+		fmt.Println(err.Error())
1443
+		return err.Error()
1444
+	}
1445
+	str := string(respBytes)
1446
+	fmt.Println(str)
1447
+	return str
1448
+}
1312 1449
 func Gdyb2001(baseParams models.BaseParams, psn_no string, insutype string, med_type string) string {
1313 1450
 	// 生成签名
1314 1451
 	nonce := GetRandomString(32)
@@ -1362,6 +1499,136 @@ func Gdyb2001(baseParams models.BaseParams, psn_no string, insutype string, med_
1362 1499
 	return str
1363 1500
 }
1364 1501
 
1502
+func Gdyb2505(psnNo string, doctor string, org_name string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, start_time string, end_time string) string {
1503
+	// 生成签名
1504
+	nonce := GetRandomString(32)
1505
+	timestamp := time.Now().Unix()
1506
+	signature := setSignature(timestamp, nonce, secret_key)
1507
+
1508
+	// 生成输入报文
1509
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
1510
+	input := make(map[string]interface{})
1511
+	inputData := make(map[string]interface{})
1512
+
1513
+	inputMessage["infno"] = "2505"
1514
+	inputData["psn_no"] = psnNo
1515
+	inputData["tel"] = ""
1516
+	inputData["addr"] = ""
1517
+	inputData["biz_appy_type"] = "03"
1518
+	inputData["begndate"] = start_time
1519
+	inputData["enddate"] = end_time
1520
+	inputData["agnter_name"] = ""
1521
+	inputData["agnter_cert_type"] = ""
1522
+	inputData["agnter_certno"] = ""
1523
+
1524
+	inputData["agnter_tel"] = ""
1525
+	inputData["agnter_addr"] = ""
1526
+	inputData["agnter_rlts"] = ""
1527
+	inputData["fix_srt_no"] = ""
1528
+
1529
+	inputData["fixmedins_code"] = fixmedins_code
1530
+	inputData["fixmedins_name"] = org_name
1531
+	inputData["memo"] = ""
1532
+
1533
+	input["data"] = inputData
1534
+	inputMessage["input"] = input //交易输入
1535
+
1536
+	bytesData, err := json.Marshal(inputMessage)
1537
+	fmt.Println(string(bytesData))
1538
+	if err != nil {
1539
+		fmt.Println(err.Error())
1540
+		return err.Error()
1541
+	}
1542
+	reader := bytes.NewReader(bytesData)
1543
+
1544
+	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2505"
1545
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
1546
+
1547
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
1548
+	request, err := http.NewRequest("POST", url, reader)
1549
+	if err != nil {
1550
+		fmt.Println(err.Error())
1551
+		return err.Error()
1552
+	}
1553
+
1554
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1555
+	request.Header.Set("x-tif-paasid", "sg03_prd")
1556
+	request.Header.Set("x-tif-signature", signature)
1557
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1558
+	request.Header.Set("x-tif-nonce", nonce)
1559
+
1560
+	client := http.Client{}
1561
+	resp, err := client.Do(request)
1562
+	if err != nil {
1563
+		fmt.Println(err.Error())
1564
+		return err.Error()
1565
+	}
1566
+	respBytes, err := ioutil.ReadAll(resp.Body)
1567
+	if err != nil {
1568
+		fmt.Println(err.Error())
1569
+		return err.Error()
1570
+	}
1571
+	str := string(respBytes)
1572
+	fmt.Println(str)
1573
+	return str
1574
+}
1575
+func Gdyb2506(psnNo string, doctor string, org_name string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, trt_dcla_detl_sn string) string {
1576
+	// 生成签名
1577
+	nonce := GetRandomString(32)
1578
+	timestamp := time.Now().Unix()
1579
+	signature := setSignature(timestamp, nonce, secret_key)
1580
+
1581
+	// 生成输入报文
1582
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
1583
+	input := make(map[string]interface{})
1584
+	inputData := make(map[string]interface{})
1585
+
1586
+	inputMessage["infno"] = "2506"
1587
+	inputData["psn_no"] = psnNo
1588
+	inputData["trt_dcla_detl_sn"] = trt_dcla_detl_sn
1589
+	inputData["memo"] = ""
1590
+	input["data"] = inputData
1591
+	inputMessage["input"] = input //交易输入
1592
+	bytesData, err := json.Marshal(inputMessage)
1593
+	fmt.Println(string(bytesData))
1594
+	if err != nil {
1595
+		fmt.Println(err.Error())
1596
+		return err.Error()
1597
+	}
1598
+	reader := bytes.NewReader(bytesData)
1599
+
1600
+	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2506"
1601
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
1602
+
1603
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
1604
+	request, err := http.NewRequest("POST", url, reader)
1605
+	if err != nil {
1606
+		fmt.Println(err.Error())
1607
+		return err.Error()
1608
+	}
1609
+
1610
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1611
+	request.Header.Set("x-tif-paasid", "sg03_prd")
1612
+	request.Header.Set("x-tif-signature", signature)
1613
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1614
+	request.Header.Set("x-tif-nonce", nonce)
1615
+
1616
+	client := http.Client{}
1617
+	resp, err := client.Do(request)
1618
+	if err != nil {
1619
+		fmt.Println(err.Error())
1620
+		return err.Error()
1621
+	}
1622
+	respBytes, err := ioutil.ReadAll(resp.Body)
1623
+	if err != nil {
1624
+		fmt.Println(err.Error())
1625
+		return err.Error()
1626
+	}
1627
+	str := string(respBytes)
1628
+	fmt.Println(str)
1629
+	return str
1630
+}
1631
+
1365 1632
 //func Gdyb2503(psnNo string, doctor string, department string, diag string, org_name string, med_type string, doctor_id int64, fixmedins_code string, diag_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string) string {
1366 1633
 //	// 生成签名
1367 1634
 //	nonce := GetRandomString(32)
@@ -1460,7 +1727,7 @@ func Gdyb2503(psnNo string, insutype string, org_name string, doctor string, fix
1460 1727
 	inputData["insutype"] = insutype               // 险种类型(来自1101接口返回)
1461 1728
 	inputData["opsp_dise_code"] = sick_code        // 险种类型(来自1101接口返回)
1462 1729
 	inputData["opsp_dise_name"] = sick_name        // 险种类型(来自1101接口返回)
1463
-	inputData["insu_optins"] = "440229"            // 险种类型(来自1101接口返回)
1730
+	inputData["insu_optins"] = insuplc_admdvs      // 险种类型(来自1101接口返回)
1464 1731
 	inputData["ide_fixmedins_no"] = fixmedins_code // 险种类型(来自1101接口返回)
1465 1732
 	inputData["ide_fixmedins_name"] = org_name     // 险种类型(来自1101接口返回)
1466 1733
 	inputData["hosp_ide_date"] = timeFormatTwo     // 险种类型(来自1101接口返回)
@@ -1509,6 +1776,56 @@ func Gdyb2503(psnNo string, insutype string, org_name string, doctor string, fix
1509 1776
 	return str
1510 1777
 }
1511 1778
 
1779
+func Gdyb2504(psnNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, trt_dcla_detl_sn string) string {
1780
+	// 生成签名
1781
+	nonce := GetRandomString(32)
1782
+	timestamp := time.Now().Unix()
1783
+	signature := setSignature(timestamp, nonce, secret_key)
1784
+
1785
+	// 生成输入报文
1786
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
1787
+	input := make(map[string]interface{})
1788
+	inputData := make(map[string]interface{})
1789
+	inputMessage["infno"] = "2504"                   // 交易编码
1790
+	inputData["psn_no"] = psnNo                      // 人员编号 (来自1101接口返回)
1791
+	inputData["trt_dcla_detl_sn"] = trt_dcla_detl_sn // 人员编号 (来自1101接口返回)
1792
+	input["data"] = inputData
1793
+	inputMessage["input"] = input //交易输入
1794
+	bytesData, err := json.Marshal(inputMessage)
1795
+	fmt.Println(string(bytesData))
1796
+	if err != nil {
1797
+		fmt.Println(err.Error())
1798
+		return err.Error()
1799
+	}
1800
+	reader := bytes.NewReader(bytesData)
1801
+	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2504"
1802
+	request, err := http.NewRequest("POST", url, reader)
1803
+	if err != nil {
1804
+		fmt.Println(err.Error())
1805
+		return err.Error()
1806
+	}
1807
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1808
+	request.Header.Set("x-tif-paasid", "sg03_prd")
1809
+	request.Header.Set("x-tif-signature", signature)
1810
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1811
+	request.Header.Set("x-tif-nonce", nonce)
1812
+
1813
+	client := http.Client{}
1814
+	resp, err := client.Do(request)
1815
+	if err != nil {
1816
+		fmt.Println(err.Error())
1817
+		return err.Error()
1818
+	}
1819
+	respBytes, err := ioutil.ReadAll(resp.Body)
1820
+	if err != nil {
1821
+		fmt.Println(err.Error())
1822
+		return err.Error()
1823
+	}
1824
+	str := string(respBytes)
1825
+	fmt.Println(str)
1826
+	return str
1827
+}
1828
+
1512 1829
 func Gdyb5301(psnNo string, insutype string, org_name string, doctor string, fixmedins_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_name string, sick_code string) string {
1513 1830
 	// 生成签名
1514 1831
 	nonce := GetRandomString(32)
@@ -1999,3 +2316,28 @@ func CreateMedicalInsuranceCostCompareRecord(record *models.MedicalInsuranceCost
1999 2316
 //	str := string(respBytes)
2000 2317
 //	return str
2001 2318
 //}
2319
+
2320
+func CreatePsnRecord(record *models.GdybPsnRecord) {
2321
+	writeDb.Save(&record)
2322
+	return
2323
+}
2324
+
2325
+func GetPsnRecordById(id int64) (record models.GdybPsnRecord, err error) {
2326
+	err = readDb.Model(&models.GdybPsnRecord{}).Where("id = ?").First(&record).Error
2327
+	return
2328
+}
2329
+
2330
+func CreatePsnNCDSRecord(record *models.GdybPsnNcdsRecord) {
2331
+	writeDb.Save(&record)
2332
+	return
2333
+}
2334
+
2335
+func GetPsnNCDSRecordById(id int64) (record models.GdybPsnNcdsRecord, err error) {
2336
+	err = readDb.Model(&models.GdybPsnNcdsRecord{}).Where("id = ?").First(&record).Error
2337
+	return
2338
+}
2339
+
2340
+func GetPatientsByIds(ids []string, current_org_id int64) (patients []*models.Patients, err error) {
2341
+	err = readDb.Model(&models.Patients{}).Where("id IN (?) AND user_org_id = ?", ids, current_org_id).Find(&patients).Error
2342
+	return
2343
+}

+ 6 - 0
service/his_service.go Bestand weergeven

@@ -18,6 +18,7 @@ type HisPatient struct {
18 18
 	HisPrescription []*HisPrescription `gorm:"ForeignKey:PatientId,RecordDate;AssociationForeignKey:ID,RecordDate" json:"prescription"`
19 19
 	PatientId       int64              `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
20 20
 	Number          string             `gorm:"column:number" json:"number" form:"number"`
21
+	PatientInfo     string             `gorm:"column:patient_info" json:"patient_info" form:"patient_info"`
21 22
 }
22 23
 
23 24
 func (HisPatient) TableName() string {
@@ -1096,3 +1097,8 @@ func GetBatchDoctorList(idss []int64) (role []*models.SgjUserAdminRole, err erro
1096 1097
 	return role, err
1097 1098
 
1098 1099
 }
1100
+
1101
+func GetAllPatient(org_id int64) (patients []*models.Patients, err error) {
1102
+	err = readDb.Model(&models.Patients{}).Where("user_org_id = ? AND status = 1 AND lapseto = 1", org_id).Find(&patients).Error
1103
+	return
1104
+}

+ 44 - 0
service/sz_his_service.go Bestand weergeven

@@ -13,6 +13,50 @@ import (
13 13
 	_ "unsafe"
14 14
 )
15 15
 
16
+func SzybXX001(doctor string, doctor_code string, fixmedins_code string, account string, verify_code string, serial_number string, version_code string) string {
17
+	// 生成输入报文
18
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number)
19
+	inputData := make(map[string]interface{})
20
+	inputMessage["transType"] = "XX001"         // 交易编码
21
+	inputMessage["transVersion"] = version_code // 交易编码
22
+
23
+	inputData["aaz500"] = account
24
+	inputData["bzz269"] = "000000"
25
+	inputData["bke384"] = inputMessage["serialNumber"]
26
+	inputMessage["transBody"] = inputData
27
+	bytesData, err := json.Marshal(inputMessage)
28
+	fmt.Println(string(bytesData))
29
+	if err != nil {
30
+		fmt.Println(err.Error())
31
+		return err.Error()
32
+	}
33
+	reader := bytes.NewReader(bytesData)
34
+	//url := "http://192.168.1.228:17001/szsi-portal/transData"
35
+	url := "http://192.168.1.88:6666/szsi-portal/transData"
36
+
37
+	request, err := http.NewRequest("POST", url, reader)
38
+	if err != nil {
39
+		fmt.Println(err.Error())
40
+		return err.Error()
41
+	}
42
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
43
+	client := http.Client{}
44
+	resp, err := client.Do(request)
45
+	if err != nil {
46
+		fmt.Println(err.Error())
47
+		return err.Error()
48
+	}
49
+	respBytes, err := ioutil.ReadAll(resp.Body)
50
+	if err != nil {
51
+		fmt.Println(err.Error())
52
+		return err.Error()
53
+	}
54
+	fmt.Println(string(respBytes))
55
+	str := string(respBytes)
56
+	return str
57
+
58
+}
59
+
16 60
 func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_code string, account string, verify_code string, serial_number string, mz_number string, version_code string, custom_code string, project_name string, price float64, medical_care int64) string {
17 61
 	// 生成输入报文
18 62
 	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number)