Bladeren bron

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

csx 3 jaren geleden
bovenliggende
commit
2f399588bf
3 gewijzigde bestanden met toevoegingen van 348 en 46 verwijderingen
  1. 58 0
      controllers/js/jsyb_controller.go
  2. 226 46
      controllers/sg/his_api_controller.go
  3. 64 0
      service/jsyb_service.go

+ 58 - 0
controllers/js/jsyb_controller.go Bestand weergeven

@@ -33,9 +33,46 @@ func JSybRegistRouters() {
33 33
 	beego.Router("/jsyb/2207", &JSybController{}, "get:PostEight")
34 34
 	beego.Router("/jsyb/2208", &JSybController{}, "get:PostNine")
35 35
 	beego.Router("/jsyb/5203", &JSybController{}, "get:PostTen")
36
+	beego.Router("/jsyb/5301", &JSybController{}, "get:Get5301")
37
+
38
+	//beego.Router("/jsyb/2503", &JSybController{}, "get:Get2503")
39
+
36 40
 	beego.Router("/jsyb/readcard", &JSybController{}, "get:ReadCard")
37 41
 
38 42
 }
43
+func (c *JSybController) Get5301() {
44
+	psn_no := c.GetString("psn_no")
45
+	org_name := c.GetString("org_name")
46
+	doctor := c.GetString("doctor")
47
+	fixmedins_code := c.GetString("fixmedins_code")
48
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
49
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
50
+	secret_key := c.GetString("secret_key")
51
+	url := c.GetString("url")
52
+	ak := c.GetString("ak")
53
+
54
+	result, inputLog := service.Jsyb5301(psn_no, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, url, ak)
55
+	fmt.Println(result)
56
+	fmt.Println(inputLog)
57
+	var dat map[string]interface{}
58
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
59
+
60
+	} else {
61
+
62
+	}
63
+
64
+	var dat2 map[string]interface{}
65
+	if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
66
+
67
+	} else {
68
+
69
+	}
70
+
71
+	c.ServeSuccessJSON(map[string]interface{}{
72
+		"pre": dat,
73
+		"log": dat2,
74
+	})
75
+}
39 76
 
40 77
 func (c *JSybController) PostOne() {
41 78
 	certNo := c.GetString("cert_no")
@@ -478,6 +515,27 @@ func (c *JSybController) PostTen() {
478 515
 	})
479 516
 }
480 517
 
518
+func (c *JSybController) Get2503() {
519
+	psnNo := c.GetString("psn_no")
520
+	insutype := c.GetString("insutype")
521
+	sick_code := c.GetString("sick_code")
522
+	sick_name := c.GetString("sick_name")
523
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
524
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
525
+	secret_key := c.GetString("secret_key")
526
+	access_key := c.GetString("access_key")
527
+	fixmedins_code := c.GetString("fixmedins_code")
528
+	org_name := c.GetString("org_name")
529
+	check_time := c.GetString("check_time")
530
+	doctor_id := c.GetString("doctor_id")
531
+	doctor := c.GetString("doctor")
532
+	start_time := c.GetString("start_time")
533
+	end_time := c.GetString("end_time")
534
+	url := c.GetString("url")
535
+	service.Jsyb2503(psnNo, insutype, org_name, doctor, fixmedins_code, doctor_id, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_name, sick_code, start_time, end_time, check_time, url, access_key)
536
+
537
+}
538
+
481 539
 func (c *JSybController) ReadCard() {
482 540
 	fixmedins_code := c.GetString("fixmedins_code")
483 541
 	secret_key := c.GetString("secret_key")

+ 226 - 46
controllers/sg/his_api_controller.go Bestand weergeven

@@ -77,6 +77,8 @@ func HisManagerApiRegistRouters() {
77 77
 }
78 78
 func (c *HisApiController) GetPsnNcdsInfo() {
79 79
 	admin_user_id, _ := c.GetInt64("admin_user_id")
80
+	patient_id, _ := c.GetInt64("patient_id")
81
+
80 82
 	id, _ := c.GetInt64("id")
81 83
 	adminUser := c.GetAdminUserInfo()
82 84
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
@@ -102,25 +104,66 @@ func (c *HisApiController) GetPsnNcdsInfo() {
102 104
 	var res Result5301
103 105
 	var res10265 Result5301For10265
104 106
 
105
-	if miConfig.Code == "H15049901371" {
106
-		if err := json.Unmarshal(userJSONBytes, &res10265); err != nil {
107
+	if miConfig.MdtrtareaAdmvs == "32091" {
108
+		psn_info, _ := service.GetPsnByPatientId(patient_id)
109
+		api := "http://192.168.3.111:9532/" + "jsyb/5301?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.ChannelNumber + "&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName +
110
+			"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&psn_no=" + psn_info.PsnNo
111
+
112
+		resp, requestErr := http.Get(api)
113
+		if requestErr != nil {
114
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
115
+			return
116
+		}
117
+
118
+		body, ioErr := ioutil.ReadAll(resp.Body)
119
+		if ioErr != nil {
120
+			utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
121
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
122
+			return
123
+		}
124
+		var respJSON map[string]interface{}
125
+		if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
126
+			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
127
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
128
+			return
129
+		}
130
+		respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
131
+		result, _ := json.Marshal(respJSON)
132
+		if err := json.Unmarshal([]byte(result), &res10265); err != nil {
107 133
 			utils.ErrorLog("解析失败:%v", err)
108 134
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
109 135
 			return
110 136
 		}
111
-		res.InfRefmsgid = res10265.InfRefmsgid
112
-		res.Output = res10265.Output
113 137
 		res.ErrMsg = res10265.ErrMsg
138
+		res.Output = res10265.Output
139
+		res.InfRefmsgid = res10265.InfRefmsgid
114 140
 		infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
115 141
 		res.Infcode = infocode
142
+
116 143
 	} else {
117
-		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
118
-			utils.ErrorLog("解析失败:%v", err)
119
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
120
-			return
144
+
145
+		if miConfig.Code == "H15049901371" {
146
+			if err := json.Unmarshal(userJSONBytes, &res10265); err != nil {
147
+				utils.ErrorLog("解析失败:%v", err)
148
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
149
+				return
150
+			}
151
+			res.InfRefmsgid = res10265.InfRefmsgid
152
+			res.Output = res10265.Output
153
+			res.ErrMsg = res10265.ErrMsg
154
+			infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
155
+			res.Infcode = infocode
156
+		} else {
157
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
158
+				utils.ErrorLog("解析失败:%v", err)
159
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
160
+				return
161
+			}
162
+
121 163
 		}
122 164
 
123 165
 	}
166
+
124 167
 	if res.Infcode == 0 {
125 168
 		c.ServeSuccessJSON(map[string]interface{}{
126 169
 			"result": res.Output.Result,
@@ -3527,6 +3570,25 @@ func (c *HisApiController) GetUploadInfo() {
3527 3570
 
3528 3571
 		} else if miConfig.MdtrtareaAdmvs == "320921" {
3529 3572
 
3573
+			//江苏地区国家医保医疗类别
3574
+			//职工透析:医疗类别选特殊情况门诊9933
3575
+			//居民血透门慢: 医疗类别选门诊慢病1402
3576
+			var med_type string
3577
+			if his.Insutype == "310" {
3578
+				if reg_type == 14 {
3579
+					med_type = "9933"
3580
+				} else if reg_type == 11 {
3581
+					med_type = "11"
3582
+
3583
+				}
3584
+			} else if his.Insutype == "390" {
3585
+				if reg_type == 14 {
3586
+					med_type = "1402"
3587
+				} else if reg_type == 11 {
3588
+					med_type = "11"
3589
+				}
3590
+			}
3591
+
3530 3592
 			data := make(map[string]interface{})
3531 3593
 			client := &http.Client{}
3532 3594
 			data["psn_no"] = his.PsnNo
@@ -3534,7 +3596,7 @@ func (c *HisApiController) GetUploadInfo() {
3534 3596
 			data["doctor"] = roles.UserName
3535 3597
 			data["department"] = department.Name
3536 3598
 			data["org_name"] = miConfig.OrgName
3537
-			data["med_type"] = strconv.FormatInt(reg_type, 10)
3599
+			data["med_type"] = med_type
3538 3600
 			data["doctor_id"] = strconv.FormatInt(doctor_info.AdminUserId, 10)
3539 3601
 			data["fixmedins_code"] = miConfig.Code
3540 3602
 			data["insuplc_admdvs"] = miConfig.InsuplcAdmdvs
@@ -4136,6 +4198,24 @@ func (c *HisApiController) GetUploadInfo() {
4136 4198
 								cert_no = bas[1]
4137 4199
 							}
4138 4200
 
4201
+							//江苏地区国家医保医疗类别
4202
+							//职工透析:医疗类别选特殊情况门诊9933
4203
+							//居民血透门慢: 医疗类别选门诊慢病1402
4204
+							var med_type string
4205
+							if his.Insutype == "310" {
4206
+								if reg_type == 14 {
4207
+									med_type = "9933"
4208
+								} else if reg_type == 11 {
4209
+									med_type = "11"
4210
+
4211
+								}
4212
+							} else if his.Insutype == "390" {
4213
+								if reg_type == 14 {
4214
+									med_type = "1402"
4215
+								} else if reg_type == 11 {
4216
+									med_type = "11"
4217
+								}
4218
+							}
4139 4219
 							//psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
4140 4220
 
4141 4221
 							api := "http://192.168.3.111:9532/" + "jsyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
@@ -4144,7 +4224,7 @@ func (c *HisApiController) GetUploadInfo() {
4144 4224
 								"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
4145 4225
 								"&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
4146 4226
 								"&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
4147
-								"&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&acct_used_flag=" + acct_used_flag + "&url=" + miConfig.Url + "&ak=" + miConfig.ChannelNumber + "&verify_number=" + psn_info.VerifyNumber
4227
+								"&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + med_type + "&acct_used_flag=" + acct_used_flag + "&url=" + miConfig.Url + "&ak=" + miConfig.ChannelNumber + "&verify_number=" + psn_info.VerifyNumber
4148 4228
 
4149 4229
 							resp, requestErr := http.Get(api)
4150 4230
 							if requestErr != nil {
@@ -4500,13 +4580,32 @@ func (c *HisApiController) GetUploadInfo() {
4500 4580
 					cert_no = bas[1]
4501 4581
 				}
4502 4582
 
4583
+				//江苏地区国家医保医疗类别
4584
+				//职工透析:医疗类别选特殊情况门诊9933
4585
+				//居民血透门慢: 医疗类别选门诊慢病1402
4586
+				var med_type string
4587
+				if his.Insutype == "310" {
4588
+					if reg_type == 14 {
4589
+						med_type = "9933"
4590
+					} else if reg_type == 11 {
4591
+						med_type = "11"
4592
+
4593
+					}
4594
+				} else if his.Insutype == "390" {
4595
+					if reg_type == 14 {
4596
+						med_type = "1402"
4597
+					} else if reg_type == 11 {
4598
+						med_type = "11"
4599
+					}
4600
+				}
4601
+
4503 4602
 				api := "http://192.168.3.111:9532/" + "jsyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
4504 4603
 					his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
4505 4604
 					"&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
4506 4605
 					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
4507 4606
 					"&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
4508 4607
 					"&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
4509
-					"&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&acct_used_flag=" + acct_used_flag + "&url=" + miConfig.Url + "&ak=" + miConfig.ChannelNumber + "&verify_number=" + psn_info.VerifyNumber
4608
+					"&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + med_type + "&acct_used_flag=" + acct_used_flag + "&url=" + miConfig.Url + "&ak=" + miConfig.ChannelNumber + "&verify_number=" + psn_info.VerifyNumber
4510 4609
 
4511 4610
 				resp, requestErr := http.Get(api)
4512 4611
 				if requestErr != nil {
@@ -5336,6 +5435,25 @@ func (c *HisApiController) GetPreUploadInfo() {
5336 5435
 		}
5337 5436
 
5338 5437
 	} else if miConfig.InsuplcAdmdvs == "320921" {
5438
+		//江苏地区国家医保医疗类别
5439
+		//职工透析:医疗类别选特殊情况门诊9933
5440
+		//居民血透门慢: 医疗类别选门诊慢病1402
5441
+		var med_type string
5442
+		if his.Insutype == "310" {
5443
+			if reg_type == 14 {
5444
+				med_type = "9933"
5445
+			} else if reg_type == 11 {
5446
+				med_type = "11"
5447
+
5448
+			}
5449
+		} else if his.Insutype == "390" {
5450
+			if reg_type == 14 {
5451
+				med_type = "1402"
5452
+			} else if reg_type == 11 {
5453
+				med_type = "11"
5454
+			}
5455
+		}
5456
+
5339 5457
 		data := make(map[string]interface{})
5340 5458
 		client := &http.Client{}
5341 5459
 		data["psn_no"] = his.PsnNo
@@ -5343,7 +5461,7 @@ func (c *HisApiController) GetPreUploadInfo() {
5343 5461
 		data["doctor"] = roles.UserName
5344 5462
 		data["department"] = department.Name
5345 5463
 		data["org_name"] = miConfig.OrgName
5346
-		data["med_type"] = strconv.FormatInt(reg_type, 10)
5464
+		data["med_type"] = med_type
5347 5465
 		data["doctor_id"] = strconv.FormatInt(doctor_info.AdminUserId, 10)
5348 5466
 		data["fixmedins_code"] = miConfig.Code
5349 5467
 		data["insuplc_admdvs"] = miConfig.InsuplcAdmdvs
@@ -5885,13 +6003,32 @@ func (c *HisApiController) GetPreUploadInfo() {
5885 6003
 						} else {
5886 6004
 							cert_no = bas[1]
5887 6005
 						}
6006
+						//江苏地区国家医保医疗类别
6007
+						//职工透析:医疗类别选特殊情况门诊9933
6008
+						//居民血透门慢: 医疗类别选门诊慢病1402
6009
+						var med_type string
6010
+						if his.Insutype == "310" {
6011
+							if reg_type == 14 {
6012
+								med_type = "9933"
6013
+							} else if reg_type == 11 {
6014
+								med_type = "11"
6015
+
6016
+							}
6017
+						} else if his.Insutype == "390" {
6018
+							if reg_type == 14 {
6019
+								med_type = "1402"
6020
+							} else if reg_type == 11 {
6021
+								med_type = "11"
6022
+							}
6023
+						}
6024
+
5888 6025
 						api := "http://192.168.3.111:9532/" + "jsyb/2206?psn_no=" + his.PsnNo + "&mdtrt_id=" +
5889 6026
 							his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
5890 6027
 							"&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
5891 6028
 							"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
5892 6029
 							"&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
5893 6030
 							"&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
5894
-							"&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&verify_number=" + psn_info.VerifyNumber + "&url=" + miConfig.Url + "&ak=" + miConfig.ChannelNumber
6031
+							"&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + med_type + "&verify_number=" + psn_info.VerifyNumber + "&url=" + miConfig.Url + "&ak=" + miConfig.ChannelNumber
5895 6032
 						resp, requestErr := http.Get(api)
5896 6033
 						if requestErr != nil {
5897 6034
 							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -8687,11 +8824,37 @@ func (c *HisApiController) PsnPutNCDSOnRecord() {
8687 8824
 	doctor, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, doctor_id)
8688 8825
 
8689 8826
 	role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, doctor_id)
8690
-	result, _ := service.Gdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", "0", patient.Name)
8691 8827
 	var res ResultTwo
8692 8828
 	var res10265 ResultTwo10265
8829
+	if miConfig.MdtrtareaAdmvs == "320921" {
8830
+		psn_info, _ := service.GetPsnByPatientId(patient.ID)
8831
+		api := "http://192.168.3.111:9532/" + "hbyb/1101?cert_no=" + "" +
8832
+			"&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName + "&fixmedins_code=" + miConfig.Code +
8833
+			"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(3, 10) + "&card_sn=" + "" + "&certificates=" + strconv.FormatInt(1, 10) + "&url=" + miConfig.Url + "&ak=" + miConfig.ChannelNumber + "&verify_number=" + psn_info.VerifyNumber
8834
+		resp, requestErr := http.Get(api)
8835
+		if requestErr != nil {
8836
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8837
+			return
8838
+		}
8839
+
8840
+		body, ioErr := ioutil.ReadAll(resp.Body)
8841
+		if ioErr != nil {
8842
+			utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
8843
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8844
+			return
8845
+		}
8846
+		var respJSON map[string]interface{}
8847
+		if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
8848
+			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
8849
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8850
+			return
8851
+		}
8852
+
8853
+		respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
8854
+		result, _ := json.Marshal(respJSON)
8855
+		fmt.Println("log")
8856
+		fmt.Println(string(result))
8693 8857
 
8694
-	if miConfig.Code == "H15049901371" {
8695 8858
 		if err := json.Unmarshal([]byte(result), &res10265); err != nil {
8696 8859
 			utils.ErrorLog("解析失败:%v", err)
8697 8860
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -8704,12 +8867,28 @@ func (c *HisApiController) PsnPutNCDSOnRecord() {
8704 8867
 		res.InfRefmsgid = res10265.InfRefmsgid
8705 8868
 
8706 8869
 	} else {
8707
-		if err := json.Unmarshal([]byte(result), &res); err != nil {
8708
-			utils.ErrorLog("解析失败:%v", err)
8709
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8710
-			return
8870
+		result, _ := service.Gdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", "0", patient.Name)
8871
+		if miConfig.Code == "H15049901371" {
8872
+			if err := json.Unmarshal([]byte(result), &res10265); err != nil {
8873
+				utils.ErrorLog("解析失败:%v", err)
8874
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8875
+				return
8876
+			}
8877
+			res.ErrMsg = res10265.ErrMsg
8878
+			infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
8879
+			res.Infcode = infocode
8880
+			res.Output = res10265.Output
8881
+			res.InfRefmsgid = res10265.InfRefmsgid
8882
+		} else {
8883
+			if err := json.Unmarshal([]byte(result), &res); err != nil {
8884
+				utils.ErrorLog("解析失败:%v", err)
8885
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8886
+				return
8887
+			}
8711 8888
 		}
8889
+
8712 8890
 	}
8891
+
8713 8892
 	Iinfos, _ := json.Marshal(res.Output.Iinfo)
8714 8893
 	infoStr := string(Iinfos)
8715 8894
 	var rf []*ResultFive
@@ -8770,36 +8949,37 @@ func (c *HisApiController) PsnPutNCDSOnRecord() {
8770 8949
 		}
8771 8950
 	}
8772 8951
 	fmt.Println(insuplc_admdvs)
8773
-
8952
+	var res2 ResultThirteen
8953
+	var res10265_2 ResultThirteen10265
8774 8954
 	if config.IsOpen == 1 {
8775
-		result := service.Gdyb2503(psn_no, insutype, miConfig.OrgName, doctor.UserName, miConfig.Code, strconv.FormatInt(doctor.ID, 10), insuplc_admdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sick.ClassName, sick.ContentCode, start_time, end_time, check_time)
8776
-		var dat map[string]interface{}
8777
-		if err := json.Unmarshal([]byte(result), &dat); err == nil {
8778
-			fmt.Println(dat)
8779
-		} else {
8780
-			fmt.Println(err)
8781
-		}
8782
-		userJSONBytes, _ := json.Marshal(dat)
8783
-		var res2 ResultThirteen
8784
-		var res10265 ResultThirteen10265
8785
-
8786
-		if miConfig.Code == "H15049901371" {
8787
-			if err := json.Unmarshal(userJSONBytes, &res10265); err != nil {
8788
-				utils.ErrorLog("解析失败:%v", err)
8789
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8790
-				return
8791
-			}
8792
-			res2.ErrMsg = res10265.ErrMsg
8793
-			infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
8794
-			res2.Infcode = infocode
8795
-			res2.Output = res10265.Output
8796
-			res2.InfRefmsgid = res10265.InfRefmsgid
8955
+		if miConfig.MdtrtareaAdmvs == "320921" {
8797 8956
 
8798 8957
 		} else {
8799
-			if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
8800
-				utils.ErrorLog("解析失败:%v", err)
8801
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8802
-				return
8958
+			result := service.Gdyb2503(psn_no, insutype, miConfig.OrgName, doctor.UserName, miConfig.Code, strconv.FormatInt(doctor.ID, 10), insuplc_admdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sick.ClassName, sick.ContentCode, start_time, end_time, check_time)
8959
+			var dat map[string]interface{}
8960
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
8961
+				fmt.Println(dat)
8962
+			} else {
8963
+				fmt.Println(err)
8964
+			}
8965
+			userJSONBytes, _ := json.Marshal(dat)
8966
+			if miConfig.Code == "H15049901371" {
8967
+				if err := json.Unmarshal(userJSONBytes, &res10265_2); err != nil {
8968
+					utils.ErrorLog("解析失败:%v", err)
8969
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8970
+					return
8971
+				}
8972
+				res2.ErrMsg = res10265_2.ErrMsg
8973
+				infocode, _ := strconv.ParseInt(res10265_2.Infcode, 10, 64)
8974
+				res2.Infcode = infocode
8975
+				res2.Output = res10265_2.Output
8976
+				res2.InfRefmsgid = res10265_2.InfRefmsgid
8977
+			} else {
8978
+				if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
8979
+					utils.ErrorLog("解析失败:%v", err)
8980
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
8981
+					return
8982
+				}
8803 8983
 			}
8804 8984
 		}
8805 8985
 

+ 64 - 0
service/jsyb_service.go Bestand weergeven

@@ -831,3 +831,67 @@ func SetJSInputMessage(timestamp int64, org_name string, doctor string, fixmedin
831 831
 	inputMessage["sign_no"] = "" //交易签到流水号
832 832
 	return inputMessage
833 833
 }
834
+
835
+func Jsyb5301(psnNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, request_url string, access_key string) (string, string) {
836
+	// 生成签名
837
+	//nonce := GetRandomString(32)
838
+	timestamp := time.Now().Unix()
839
+	//signature := setSignature(timestamp, nonce, secret_key)
840
+	//tempTime := time.Unix(timestamp, 0)
841
+	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
842
+
843
+	//timeFormatTwo := tempTime.Format("2006-01-02")
844
+
845
+	// 生成输入报文
846
+	inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
847
+	input := make(map[string]interface{})
848
+	inputData := make(map[string]interface{})
849
+	inputMessage["infno"] = "5301" // 交易编码
850
+	inputData["psn_no"] = psnNo    // 人员编号 (来自1101接口返回)
851
+	input["data"] = inputData
852
+	inputMessage["input"] = input //交易输入
853
+	bytesData, err := json.Marshal(inputMessage)
854
+	fmt.Println(string(bytesData))
855
+	if err != nil {
856
+		fmt.Println(err.Error())
857
+		return err.Error(), ""
858
+	}
859
+
860
+	request_url = request_url + "5301"
861
+	return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
862
+
863
+}
864
+
865
+func Jsyb2503(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, start_time string, end_time string, check_time string, request_url string, access_key string) (string, string) {
866
+	timestamp := time.Now().Unix()
867
+	// 生成输入报文
868
+	inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
869
+	input := make(map[string]interface{})
870
+	inputData := make(map[string]interface{})
871
+	inputMessage["infno"] = "2503"                 // 交易编码
872
+	inputData["psn_no"] = psnNo                    // 人员编号 (来自1101接口返回)
873
+	inputData["insutype"] = insutype               // 险种类型(来自1101接口返回)
874
+	inputData["opsp_dise_code"] = sick_code        // 险种类型(来自1101接口返回)
875
+	inputData["opsp_dise_name"] = sick_name        // 险种类型(来自1101接口返回)
876
+	inputData["insu_optins"] = insuplc_admdvs      // 险种类型(来自1101接口返回)
877
+	inputData["ide_fixmedins_no"] = fixmedins_code // 险种类型(来自1101接口返回)
878
+	inputData["ide_fixmedins_name"] = org_name     // 险种类型(来自1101接口返回)
879
+	inputData["hosp_ide_date"] = check_time        // 险种类型(来自1101接口返回)
880
+	inputData["diag_dr_codg"] = doctor_id          // 开始时间
881
+	inputData["diag_dr_name"] = doctor             // 开始时间
882
+	inputData["begndate"] = start_time             // 医师编码
883
+	inputData["tel"] = ""                          // 医师编码
884
+	inputData["addr"] = ""                         // 医师编码
885
+	inputData["enddate"] = end_time                // 医师编码
886
+
887
+	input["data"] = inputData
888
+	inputMessage["input"] = input //交易输入
889
+	bytesData, err := json.Marshal(inputMessage)
890
+	fmt.Println(string(bytesData))
891
+	if err != nil {
892
+		fmt.Println(err.Error())
893
+		return err.Error(), ""
894
+	}
895
+	request_url = request_url + "2503"
896
+	return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
897
+}