csx 3 년 전
부모
커밋
b1511f0920

+ 4 - 8
controllers/base_api_controller.go 파일 보기

@@ -67,11 +67,11 @@ type BaseAuthAPIController struct {
67 67
 func (this *BaseAuthAPIController) Prepare() {
68 68
 	this.BaseAPIController.Prepare()
69 69
 	if this.GetAdminUserInfo() == nil {
70
+
70 71
 		org_id, _ := beego.AppConfig.Int64("org_id")
71 72
 		var userAdmin models.AdminUser
72 73
 		userAdmin.Id = 1448
73 74
 		userAdmin.Mobile = "13318599895"
74
-
75 75
 		//userAdmin.Id = 597
76 76
 		//userAdmin.Mobile = "19874122664"
77 77
 		userAdmin.IsSuperAdmin = false
@@ -93,12 +93,8 @@ func (this *BaseAuthAPIController) Prepare() {
93 93
 		adminUserInfo.CurrentOrgId = org_id
94 94
 		adminUserInfo.CurrentAppId = 8642
95 95
 		adminUserInfo.AdminUser = &userAdmin
96
-
97 96
 		this.SetSession("admin_user_info", &adminUserInfo)
98 97
 
99
-		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
100
-		//this.StopRun()
101
-
102 98
 	}
103 99
 
104 100
 	//if this.Ctx.Request.Method != "GET" {
@@ -184,7 +180,9 @@ type BaseServeAPIController struct {
184 180
 func (this *BaseServeAPIController) Prepare() {
185 181
 	this.BaseAPIController.Prepare()
186 182
 	if this.GetAdminUserInfo() == nil {
187
-		org_id, _ := beego.AppConfig.Int64("org_id")
183
+		//org_id, _ := beego.AppConfig.Int64("org_id")
184
+
185
+		org_id, _ := this.GetInt64("org_id")
188 186
 
189 187
 		var userAdmin models.AdminUser
190 188
 		userAdmin.Id = 1448
@@ -211,8 +209,6 @@ func (this *BaseServeAPIController) Prepare() {
211 209
 		adminUserInfo.CurrentOrgId = org_id
212 210
 		adminUserInfo.AdminUser = &userAdmin
213 211
 		this.SetSession("admin_user_info", &adminUserInfo)
214
-		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
215
-		//this.StopRun()
216 212
 	}
217 213
 
218 214
 	//if adminUserInfo.AppRole != nil {

controllers/gdyb_controller.go → controllers/sg/gdyb_controller.go 파일 보기

@@ -1,8 +1,9 @@
1
-package controllers
1
+package sg
2 2
 
3 3
 import (
4 4
 	"encoding/json"
5 5
 	"fmt"
6
+	"gdyb/controllers"
6 7
 	"gdyb/models"
7 8
 	"gdyb/service"
8 9
 	"gdyb/utils"
@@ -11,7 +12,7 @@ import (
11 12
 )
12 13
 
13 14
 type GdybController struct {
14
-	BaseAuthAPIController
15
+	controllers.BaseAuthAPIController
15 16
 }
16 17
 
17 18
 func GdybRegistRouters() {

controllers/his_api_controller.go → controllers/sg/his_api_controller.go 파일 보기

@@ -1,10 +1,11 @@
1
-package controllers
1
+package sg
2 2
 
3 3
 import (
4 4
 	"archive/zip"
5 5
 	"bytes"
6 6
 	"encoding/json"
7 7
 	"fmt"
8
+	"gdyb/controllers"
8 9
 	"gdyb/enums"
9 10
 	"gdyb/models"
10 11
 	"gdyb/service"
@@ -26,18 +27,14 @@ import (
26 27
 )
27 28
 
28 29
 type HisApiController struct {
29
-	BaseAuthAPIController
30
+	controllers.BaseAuthAPIController
30 31
 }
31 32
 
32 33
 func HisManagerApiRegistRouters() {
33 34
 	beego.Router("/api/register/get", &HisApiController{}, "get:GetRegisterInfo")
34 35
 	beego.Router("/api/diag/upload", &HisApiController{}, "get:GetUploadDiag")
35 36
 	beego.Router("/api/upload/get", &HisApiController{}, "get:GetUploadInfo")
36
-
37 37
 	beego.Router("/api/settle/get", &HisApiController{}, "get:GetSettleInfo")
38
-
39
-	//beego.Router("/api/upload/get", &HisApiController{}, "get:Sel")
40
-
41 38
 	beego.Router("/api/settle/query", &HisApiController{}, "get:GetSettleAccounts")
42 39
 	beego.Router("/api/checkaccount/get", &HisApiController{}, "get:GetCheckAccount")
43 40
 	beego.Router("/api/checkdetailaccount/get", &HisApiController{}, "get:GetCheckDetailAccount")
@@ -47,9 +44,7 @@ func HisManagerApiRegistRouters() {
47 44
 	beego.Router("/api/refunddetail/post", &HisApiController{}, "get:RefundDetail")
48 45
 	beego.Router("/api/treatment/check", &HisApiController{}, "get:CheckTreatment")
49 46
 	beego.Router("/api/record/put", &HisApiController{}, "get:PutRecord")
50
-
51 47
 	beego.Router("/api/patient/info", &HisApiController{}, "get:GetHisPatientInfo")
52
-
53 48
 	beego.Router("/api/org/info", &HisApiController{}, "get:GetOrgInfo")
54 49
 
55 50
 }
@@ -81,7 +76,6 @@ func (c *HisApiController) GetHisPatientInfo() {
81 76
 	}
82 77
 
83 78
 	if config.IsOpen == 1 {
84
-
85 79
 		api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + appRole.UserName + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
86 80
 		resp, requestErr := http.Get(api)
87 81
 		if requestErr != nil {
@@ -1085,7 +1079,6 @@ func (c *HisApiController) GetUploadInfo() {
1085 1079
 	//private_price, _ := c.GetFloat("private_price")
1086 1080
 	settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
1087 1081
 	admin_user_id, _ := c.GetInt64("admin_user_id")
1088
-
1089 1082
 	timeLayout := "2006-01-02"
1090 1083
 	loc, _ := time.LoadLocation("Local")
1091 1084
 	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
@@ -1409,47 +1402,14 @@ func (c *HisApiController) GetUploadInfo() {
1409 1402
 					//err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
1410 1403
 					err = service.UpDateOrder(order)
1411 1404
 
1412
-					//订单确认
1413
-					result := service.Gdyb6201(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, order)
1414
-
1415
-					var dat map[string]interface{}
1416
-					if err := json.Unmarshal([]byte(result), &dat); err == nil {
1417
-						userJSONBytes, _ := json.Marshal(dat)
1418
-						var res ResultTwelve
1419
-						if err := json.Unmarshal(userJSONBytes, &res); err != nil {
1420
-							utils.ErrorLog("解析失败:%v", err)
1421
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1422
-							return
1423
-						}
1424
-						if res.Infcode == 0 {
1425
-							if err == nil {
1426
-								c.ServeSuccessJSON(map[string]interface{}{
1427
-									"msg": "预结算成功",
1428
-								})
1429
-							} else {
1430
-								c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePreSettleFaildParamWrong)
1431
-								return
1432
-							}
1433
-
1434
-						} else {
1435
-							adminUser := c.GetAdminUserInfo()
1436
-							errlog := &models.HisOrderError{
1437
-								UserOrgId:  adminUser.CurrentOrgId,
1438
-								Ctime:      time.Now().Unix(),
1439
-								Mtime:      time.Now().Unix(),
1440
-								ErrMsg:     res.ErrMsg,
1441
-								Status:     1,
1442
-								PatientId:  id,
1443
-								RecordTime: recordDateTime,
1444
-								Stage:      8,
1445
-							}
1446
-							service.CreateErrMsgLog(errlog)
1447
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
1448
-						}
1405
+					if err == nil {
1406
+						c.ServeSuccessJSON(map[string]interface{}{
1407
+							"msg": "预结算成功",
1408
+						})
1449 1409
 					} else {
1450
-						fmt.Println(err)
1410
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePreSettleFaildParamWrong)
1411
+						return
1451 1412
 					}
1452
-
1453 1413
 				}
1454 1414
 			} else {
1455 1415
 				adminUser := c.GetAdminUserInfo()
@@ -1547,11 +1507,6 @@ func (c *HisApiController) GetSettleInfo() {
1547 1507
 	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
1548 1508
 
1549 1509
 	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
1550
-	timestamp := time.Now().Unix()
1551
-	tempTime := time.Unix(timestamp, 0)
1552
-	timeFormat := tempTime.Format("20060102150405")
1553
-	chrgBchno := rand.Intn(100000) + 10000
1554
-	chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
1555 1510
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
1556 1511
 	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
1557 1512
 	strconv.FormatInt(his.PatientId, 10)
@@ -1584,10 +1539,10 @@ func (c *HisApiController) GetSettleInfo() {
1584 1539
 		allTotal := fmt.Sprintf("%.2f", total)
1585 1540
 		var rf []*ResultFive
1586 1541
 		json.Unmarshal([]byte(his.Iinfo), &rf)
1587
-		psn_no := his.PsnNo
1588
-		mdtrt_id := his.Number
1589
-		chrg_bchno := chrg_bchno
1590
-		cert_no := his.Certno
1542
+		psn_no := order_src.PsnNo
1543
+		mdtrt_id := order_src.MdtrtId
1544
+		chrg_bchno := order_src.Number
1545
+		cert_no := order_src.Certno
1591 1546
 		insutype := rf[0].Insutype
1592 1547
 
1593 1548
 		if his.IdCardType == 1 {

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1574 - 0
controllers/sz/sz_his_api_controller.go


+ 16 - 0
models/sz_his_models.go 파일 보기

@@ -0,0 +1,16 @@
1
+package models
2
+
3
+type CustomDetail struct {
4
+	PrescriptionNumber string
5
+	OrderType          string
6
+	ChargeSerialNumber string
7
+	Code               string
8
+	CodeName           string
9
+	Flag               string
10
+	CustomCode         string
11
+	CustomCodeName     string
12
+	Price              float64
13
+	Count              float64
14
+	ChargeOrderDate    string
15
+	DoctorCode         string
16
+}

+ 6 - 3
routers/router.go 파일 보기

@@ -1,7 +1,9 @@
1 1
 package routers
2 2
 
3 3
 import (
4
-	"gdyb/controllers"
4
+	"gdyb/controllers/sg"
5
+	"gdyb/controllers/sz"
6
+
5 7
 	//admin_api "XT_New/controllers/admin_api_controllers"
6 8
 	"github.com/astaxie/beego"
7 9
 	"github.com/astaxie/beego/plugins/cors"
@@ -18,7 +20,8 @@ func init() {
18 20
 		AllowCredentials: true,
19 21
 	}))
20 22
 
23
+	sg.HisManagerApiRegistRouters()
24
+	sg.GdybRegistRouters()
25
+	sz.SZHisManagerApiRegistRouters()
21 26
 
22
-	controllers.HisManagerApiRegistRouters()
23
-	controllers.GdybRegistRouters()
24 27
 }

+ 344 - 0
service/sz_his_service.go 파일 보기

@@ -0,0 +1,344 @@
1
+package service
2
+
3
+import (
4
+	"bytes"
5
+	"encoding/json"
6
+	"fmt"
7
+	"gdyb/models"
8
+	"io/ioutil"
9
+	"math/rand"
10
+	"net/http"
11
+	"time"
12
+	_ "unsafe"
13
+)
14
+
15
+func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_code string) string {
16
+	// 生成输入报文
17
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code)
18
+	inputData := make(map[string]interface{})
19
+	inputMessage["transType"] = "MZ002" // 交易编码
20
+
21
+	inputData["akc190"] = inputMessage["serialNumber"]
22
+	inputData["aaz500"] = "%GAAFSAKSXSUKKWDKHDAD?;07734724145330238292?"
23
+	inputData["bzz269"] = "000000"
24
+	inputData["aka130"] = "11"
25
+	inputData["akf001"] = dept_code
26
+	inputData["bkc368"] = "2"
27
+	inputData["akc264"] = 0.00
28
+	inputData["bke384"] = inputMessage["serialNumber"]
29
+	inputMessage["transBody"] = inputData
30
+	bytesData, err := json.Marshal(inputMessage)
31
+	fmt.Println(string(bytesData))
32
+	if err != nil {
33
+		fmt.Println(err.Error())
34
+		return err.Error()
35
+	}
36
+	reader := bytes.NewReader(bytesData)
37
+	url := "http://192.168.1.99:10000"
38
+	request, err := http.NewRequest("POST", url, reader)
39
+	if err != nil {
40
+		fmt.Println(err.Error())
41
+		return err.Error()
42
+	}
43
+
44
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
45
+
46
+	client := http.Client{}
47
+	resp, err := client.Do(request)
48
+	if err != nil {
49
+		fmt.Println(err.Error())
50
+		return err.Error()
51
+	}
52
+	respBytes, err := ioutil.ReadAll(resp.Body)
53
+	if err != nil {
54
+		fmt.Println(err.Error())
55
+		return err.Error()
56
+	}
57
+	fmt.Println(string(respBytes))
58
+	str := string(respBytes)
59
+	return str
60
+}
61
+func SzybFY001(doctor string, doctor_code string, fixmedins_code string, dept_code string, datas []*models.CustomDetail) string {
62
+	// 生成输入报文
63
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code)
64
+	inputData := make(map[string]interface{})
65
+	inputMessage["transType"] = "FY002" // 交易编码
66
+
67
+	inputData["akc190"] = inputMessage["serialNumber"]
68
+	inputData["bke384"] = inputMessage["serialNumber"]
69
+	inputData["listsize"] = len(datas)
70
+
71
+	feedetail := make([]map[string]interface{}, 0)
72
+
73
+	for _, item := range datas {
74
+		feedetailInfo := make(map[string]interface{})
75
+		feedetailInfo["aae072"] = item.PrescriptionNumber
76
+		feedetailInfo["bkc369"] = item.OrderType
77
+		feedetailInfo["bkf500"] = item.ChargeSerialNumber
78
+		feedetailInfo["ake001"] = item.Code
79
+		feedetailInfo["ake002"] = item.CodeName
80
+		feedetailInfo["aka064"] = 0
81
+		feedetailInfo["ake005"] = item.Code
82
+		feedetailInfo["ake006"] = item.CodeName
83
+		feedetailInfo["akc225"] = item.Price
84
+		feedetailInfo["akc226"] = item.Count
85
+		feedetailInfo["aka067"] = "元"
86
+		feedetailInfo["akc271"] = item.ChargeOrderDate
87
+		feedetailInfo["bkc320"] = item.DoctorCode
88
+		feedetail = append(feedetail, feedetailInfo)
89
+	}
90
+	inputData["inputlist"] = feedetail
91
+	inputMessage["transBody"] = inputData
92
+	bytesData, err := json.Marshal(inputMessage)
93
+	fmt.Println(string(bytesData))
94
+	if err != nil {
95
+		fmt.Println(err.Error())
96
+		return err.Error()
97
+	}
98
+	reader := bytes.NewReader(bytesData)
99
+	url := "http://192.168.1.99:10000"
100
+	request, err := http.NewRequest("POST", url, reader)
101
+	if err != nil {
102
+		fmt.Println(err.Error())
103
+		return err.Error()
104
+	}
105
+
106
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
107
+
108
+	client := http.Client{}
109
+	resp, err := client.Do(request)
110
+	if err != nil {
111
+		fmt.Println(err.Error())
112
+		return err.Error()
113
+	}
114
+	respBytes, err := ioutil.ReadAll(resp.Body)
115
+	if err != nil {
116
+		fmt.Println(err.Error())
117
+		return err.Error()
118
+	}
119
+	fmt.Println(string(respBytes))
120
+	str := string(respBytes)
121
+	return str
122
+}
123
+func SzybFY002(doctor string, doctor_code string, fixmedins_code string, datas []*models.CustomDetail) string {
124
+	// 生成输入报文
125
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code)
126
+	inputData := make(map[string]interface{})
127
+	inputMessage["transType"] = "FY002" // 交易编码
128
+
129
+	inputData["akc190"] = inputMessage["serialNumber"]
130
+	inputData["bke384"] = inputMessage["serialNumber"]
131
+	inputData["listsize"] = len(datas)
132
+
133
+	feedetail := make([]map[string]interface{}, 0)
134
+
135
+	for _, item := range datas {
136
+		feedetailInfo := make(map[string]interface{})
137
+		feedetailInfo["aae072"] = item.PrescriptionNumber
138
+		feedetailInfo["bkf500"] = item.ChargeSerialNumber
139
+		feedetail = append(feedetail, feedetailInfo)
140
+	}
141
+	inputData["inputlist"] = feedetail
142
+	inputMessage["transBody"] = inputData
143
+
144
+	bytesData, err := json.Marshal(inputMessage)
145
+	fmt.Println(string(bytesData))
146
+	if err != nil {
147
+		fmt.Println(err.Error())
148
+		return err.Error()
149
+	}
150
+	reader := bytes.NewReader(bytesData)
151
+	url := "http://192.168.1.99:10000"
152
+	request, err := http.NewRequest("POST", url, reader)
153
+	if err != nil {
154
+		fmt.Println(err.Error())
155
+		return err.Error()
156
+	}
157
+
158
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
159
+
160
+	client := http.Client{}
161
+	resp, err := client.Do(request)
162
+	if err != nil {
163
+		fmt.Println(err.Error())
164
+		return err.Error()
165
+	}
166
+	respBytes, err := ioutil.ReadAll(resp.Body)
167
+	if err != nil {
168
+		fmt.Println(err.Error())
169
+		return err.Error()
170
+	}
171
+	fmt.Println(string(respBytes))
172
+	str := string(respBytes)
173
+	return str
174
+}
175
+func SzybFY004(doctor string, doctor_code string, fixmedins_code string, dept_code string, total float64, number string) string {
176
+	// 生成输入报文
177
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code)
178
+	inputData := make(map[string]interface{})
179
+	inputMessage["transType"] = "FY001" // 交易编码
180
+
181
+	inputData["akc190"] = inputMessage["serialNumber"]
182
+
183
+	inputData["aka130"] = "11"
184
+	inputData["bkc320"] = doctor_code
185
+	inputData["ckc350"] = doctor
186
+	inputData["aka030"] = "12"
187
+	inputData["akc264"] = total
188
+	inputData["ckc601"] = "0"
189
+	inputData["bke384"] = number
190
+	inputMessage["transBody"] = inputData
191
+	bytesData, err := json.Marshal(inputMessage)
192
+	fmt.Println(string(bytesData))
193
+	if err != nil {
194
+		fmt.Println(err.Error())
195
+		return err.Error()
196
+	}
197
+	reader := bytes.NewReader(bytesData)
198
+	url := "http://192.168.1.99:10000"
199
+	request, err := http.NewRequest("POST", url, reader)
200
+	if err != nil {
201
+		fmt.Println(err.Error())
202
+		return err.Error()
203
+	}
204
+
205
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
206
+
207
+	client := http.Client{}
208
+	resp, err := client.Do(request)
209
+	if err != nil {
210
+		fmt.Println(err.Error())
211
+		return err.Error()
212
+	}
213
+	respBytes, err := ioutil.ReadAll(resp.Body)
214
+	if err != nil {
215
+		fmt.Println(err.Error())
216
+		return err.Error()
217
+	}
218
+	fmt.Println(string(respBytes))
219
+	str := string(respBytes)
220
+	return str
221
+}
222
+func SzybFY005(doctor string, doctor_code string, fixmedins_code string, dept_code string, total float64, number string) string {
223
+	// 生成输入报文
224
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code)
225
+	inputData := make(map[string]interface{})
226
+	inputMessage["transType"] = "FY005" // 交易编码
227
+
228
+	inputData["aaz500"] = "%GAAFSAKSXSUKKWDKHDAD?;07734724145330238292?"
229
+	inputData["bzz269"] = "000000"
230
+	inputData["akc190"] = inputMessage["serialNumber"]
231
+
232
+	inputData["aka130"] = "11"
233
+	inputData["bkc320"] = doctor_code
234
+	inputData["ckc350"] = doctor
235
+	inputData["aka030"] = "12"
236
+	inputData["akc264"] = total
237
+	inputData["ckc601"] = "0"
238
+	inputData["bke384"] = number
239
+
240
+	inputMessage["transBody"] = inputData
241
+
242
+	bytesData, err := json.Marshal(inputMessage)
243
+	fmt.Println(string(bytesData))
244
+	if err != nil {
245
+		fmt.Println(err.Error())
246
+		return err.Error()
247
+	}
248
+	reader := bytes.NewReader(bytesData)
249
+	url := "http://192.168.1.99:10000"
250
+	request, err := http.NewRequest("POST", url, reader)
251
+	if err != nil {
252
+		fmt.Println(err.Error())
253
+		return err.Error()
254
+	}
255
+
256
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
257
+
258
+	client := http.Client{}
259
+	resp, err := client.Do(request)
260
+	if err != nil {
261
+		fmt.Println(err.Error())
262
+		return err.Error()
263
+	}
264
+	respBytes, err := ioutil.ReadAll(resp.Body)
265
+	if err != nil {
266
+		fmt.Println(err.Error())
267
+		return err.Error()
268
+	}
269
+	fmt.Println(string(respBytes))
270
+	str := string(respBytes)
271
+	return str
272
+}
273
+func SzybJY002(doctor string, doctor_code string, fixmedins_code string, dept_code string, number string) string {
274
+	// 生成输入报文
275
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code)
276
+	inputData := make(map[string]interface{})
277
+	inputMessage["transType"] = "JY002" // 交易编码
278
+
279
+	inputData["akc190"] = inputMessage["serialNumber"]
280
+	inputData["bke384"] = number
281
+
282
+	inputMessage["transBody"] = inputData
283
+	bytesData, err := json.Marshal(inputMessage)
284
+	fmt.Println(string(bytesData))
285
+	if err != nil {
286
+		fmt.Println(err.Error())
287
+		return err.Error()
288
+	}
289
+	reader := bytes.NewReader(bytesData)
290
+	url := "http://192.168.1.99:10000"
291
+	request, err := http.NewRequest("POST", url, reader)
292
+	if err != nil {
293
+		fmt.Println(err.Error())
294
+		return err.Error()
295
+	}
296
+
297
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
298
+
299
+	client := http.Client{}
300
+	resp, err := client.Do(request)
301
+	if err != nil {
302
+		fmt.Println(err.Error())
303
+		return err.Error()
304
+	}
305
+	respBytes, err := ioutil.ReadAll(resp.Body)
306
+	if err != nil {
307
+		fmt.Println(err.Error())
308
+		return err.Error()
309
+	}
310
+	fmt.Println(string(respBytes))
311
+	str := string(respBytes)
312
+	return str
313
+}
314
+
315
+// 生成基础报文
316
+func SetSZInputMessage(doctor string, doctor_code string, fixmedins_code string) map[string]interface{} {
317
+	month := time.Unix(1557042972, 0).Format("1")
318
+	year := time.Now().Format("2006")
319
+	month = time.Now().Format("01")
320
+	day := time.Now().Format("02")
321
+	// 生成输入报文
322
+	inputMessage := make(map[string]interface{})
323
+	inputMessage["cardArea"] = "440300" // 发卡地行政区划代码
324
+	inputMessage["extendDeviceId"] = ""
325
+	inputMessage["extendSerialNumber"] = ""
326
+	inputMessage["extendUserId"] = ""
327
+	inputMessage["hospitalCode"] = fixmedins_code // 协议机构编码
328
+	inputMessage["operatorCode"] = doctor_code    // 操作员编码
329
+	inputMessage["operatorName"] = doctor         // 操作员名字
330
+	inputMessage["operatorPass"] = ""             // 定点协议机构操作人员编码
331
+	inputMessage["serialNumber"] = fixmedins_code + year + month + day +
332
+		fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
333
+	inputMessage["transChannel"] = "10"                         // 交易渠道
334
+	inputMessage["transReturnCode"] = ""                        // 交易返回码
335
+	inputMessage["transReturnMessage"] = ""                     // 交易返回信息
336
+	inputMessage["transTime"] = msToTime(time.Now().UnixNano()) // 经办人姓名
337
+	inputMessage["transVersion"] = "V0.3"                       // 定点医药机构编号
338
+	inputMessage["verifyCode"] = "000000|ABC243DDESF"           //定点医药机构名称
339
+	return inputMessage
340
+}
341
+func msToTime(ms int64) string {
342
+	tm := time.Unix(0, ms*int64(time.Millisecond))
343
+	return tm.Format("2006-02-01 15:04:05.000")
344
+}