陈少旭 4 months ago
parent
commit
e1957c31bf
3 changed files with 170 additions and 23 deletions
  1. 105 7
      controllers/sg/his_api_controller.go
  2. 35 0
      models/models_3501.go
  3. 30 16
      service/fj_service.go

+ 105 - 7
controllers/sg/his_api_controller.go View File

186
 	beego.Router("/api/pc_bg", &HisApiController{}, "get:FJ3501AND3502")
186
 	beego.Router("/api/pc_bg", &HisApiController{}, "get:FJ3501AND3502")
187
 	//删除库盘和变更
187
 	//删除库盘和变更
188
 	beego.Router("/api/delete_pc_bg", &HisApiController{}, "get:DeletePCandBG")
188
 	beego.Router("/api/delete_pc_bg", &HisApiController{}, "get:DeletePCandBG")
189
-	beego.Router("/api/delete_pc_bg", &HisApiController{}, "get:DeleteXSandBG")
189
+	beego.Router("/api/delete_xs_bg", &HisApiController{}, "get:DeleteXSandBG")
190
 	//药品变更
190
 	//药品变更
191
 	beego.Router("/api/changedrug", &HisApiController{}, "get:ChangeDrug")
191
 	beego.Router("/api/changedrug", &HisApiController{}, "get:ChangeDrug")
192
 
192
 
193
 }
193
 }
194
 func (c *HisApiController) FJ3501AND3502() {
194
 func (c *HisApiController) FJ3501AND3502() {
195
 	ids := c.getString("ids")
195
 	ids := c.getString("ids")
196
+	//ids := c.getint("admin_")
197
+	admin_user_id, _ := c.GetInt64("admin_user_id")
198
+	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
199
+
196
 	id_arr := strings.Split(ids, ",")
200
 	id_arr := strings.Split(ids, ",")
197
 	drugs, _ := service.GetNewDrugWarehouseInfo(id_arr)
201
 	drugs, _ := service.GetNewDrugWarehouseInfo(id_arr)
198
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
202
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
202
 			var struct3501 models.Struct3501
206
 			var struct3501 models.Struct3501
203
 			struct3501.OrgName = miConfig.OrgName
207
 			struct3501.OrgName = miConfig.OrgName
204
 			struct3501.AccessKey = miConfig.AccessKey
208
 			struct3501.AccessKey = miConfig.AccessKey
209
+			struct3501.Opter = roles.UserName
205
 			struct3501.RequestUrl = miConfig.Url
210
 			struct3501.RequestUrl = miConfig.Url
211
+			struct3501.Url = miConfig.Url
212
+			struct3501.AppId = miConfig.Cainfo
213
+			struct3501.AppSecret = miConfig.AppSecret
214
+			struct3501.Enckey = miConfig.EncKey
215
+			struct3501.SignKey = miConfig.SignKey
206
 			struct3501.SecretKey = miConfig.SecretKey
216
 			struct3501.SecretKey = miConfig.SecretKey
207
 			struct3501.MedListCodg = drug.BaseDrugLib.MedicalInsuranceNumber
217
 			struct3501.MedListCodg = drug.BaseDrugLib.MedicalInsuranceNumber
208
 			struct3501.FixmedinsHilistId = miConfig.Code
218
 			struct3501.FixmedinsHilistId = miConfig.Code
213
 			struct3501.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
223
 			struct3501.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
214
 			struct3501.InvCnt = strconv.FormatInt(drug.StockMaxNumber, 10)
224
 			struct3501.InvCnt = strconv.FormatInt(drug.StockMaxNumber, 10)
215
 			struct3501.ExpyEnd = time.Unix(drug.ExpiryDate, 0).Format("2006-01-02 15:04:05")
225
 			struct3501.ExpyEnd = time.Unix(drug.ExpiryDate, 0).Format("2006-01-02 15:04:05")
216
-			//todo 批次号规则需要在咨询下保健
217
-			struct3501.FixmedinsBchno = ""
218
-			struct3501.Memo = ""
226
+			struct3501.FixmedinsBchno = strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(drug.ID, 10) + "-" + "3501"
227
+			struct3501.Memo = "入库"
219
 			result1, result2, result3 := service.FJyb3501(struct3501)
228
 			result1, result2, result3 := service.FJyb3501(struct3501)
220
 			fmt.Println(result1)
229
 			fmt.Println(result1)
221
 			fmt.Println(result2)
230
 			fmt.Println(result2)
227
 			struct3502.FixmedinsHilistName = miConfig.OrgName
236
 			struct3502.FixmedinsHilistName = miConfig.OrgName
228
 			struct3502.FixmedinsCode = miConfig.Code
237
 			struct3502.FixmedinsCode = miConfig.Code
229
 			struct3502.RxFlag = "0"
238
 			struct3502.RxFlag = "0"
230
-			struct3502.InvChgTime = time.Unix(drug.Ctime, 0).Format("2006-01-02 15:04:05")
239
+			struct3502.InvChgTime = time.Now().Format("2006-01-02")
231
 			struct3502.OrgName = miConfig.OrgName
240
 			struct3502.OrgName = miConfig.OrgName
232
 			struct3502.AccessKey = miConfig.AccessKey
241
 			struct3502.AccessKey = miConfig.AccessKey
233
 			struct3502.RequestUrl = miConfig.Url
242
 			struct3502.RequestUrl = miConfig.Url
234
 			struct3502.SecretKey = miConfig.SecretKey
243
 			struct3502.SecretKey = miConfig.SecretKey
235
 			struct3502.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
244
 			struct3502.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
236
 			struct3502.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
245
 			struct3502.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
246
+
247
+			struct3502.Url = miConfig.Url
248
+			struct3502.AppId = miConfig.Cainfo
249
+			struct3502.AppSecret = miConfig.AppSecret
250
+			struct3502.Enckey = miConfig.EncKey
251
+			struct3502.SignKey = miConfig.SignKey
252
+			struct3502.SecretKey = miConfig.SecretKey
253
+
237
 			struct3502.InvChgType = "102"
254
 			struct3502.InvChgType = "102"
238
-			struct3502.FixmedinsBchno = ""
255
+			struct3501.FixmedinsBchno = strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(drug.ID, 10) + "-" + "3502"
239
 			struct3502.Cnt = strconv.FormatInt(drug.WarehousingCount, 10)
256
 			struct3502.Cnt = strconv.FormatInt(drug.WarehousingCount, 10)
240
 			struct3502.Pric = fmt.Sprintf("%.2f", drug.BaseDrugLib.RetailPrice)
257
 			struct3502.Pric = fmt.Sprintf("%.2f", drug.BaseDrugLib.RetailPrice)
241
 			result11, result22, result33 := service.FJyb3502(struct3502)
258
 			result11, result22, result33 := service.FJyb3502(struct3502)
260
 			struct3502.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
277
 			struct3502.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
261
 			struct3502.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
278
 			struct3502.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
262
 			struct3502.InvChgType = "102"
279
 			struct3502.InvChgType = "102"
280
+
281
+			struct3502.Url = miConfig.Url
282
+			struct3502.AppId = miConfig.Cainfo
283
+			struct3502.AppSecret = miConfig.AppSecret
284
+			struct3502.Enckey = miConfig.EncKey
285
+			struct3502.SignKey = miConfig.SignKey
286
+			struct3502.SecretKey = miConfig.SecretKey
287
+
263
 			struct3502.FixmedinsBchno = ""
288
 			struct3502.FixmedinsBchno = ""
264
 			struct3502.Cnt = strconv.FormatInt(drug.WarehousingCount, 10)
289
 			struct3502.Cnt = strconv.FormatInt(drug.WarehousingCount, 10)
265
 			struct3502.Pric = fmt.Sprintf("%.2f", drug.BaseDrugLib.RetailPrice)
290
 			struct3502.Pric = fmt.Sprintf("%.2f", drug.BaseDrugLib.RetailPrice)
270
 		}
295
 		}
271
 	}
296
 	}
272
 }
297
 }
298
+
273
 func (c *HisApiController) DeletePCandBG() {
299
 func (c *HisApiController) DeletePCandBG() {
274
 	ids := c.getString("ids")
300
 	ids := c.getString("ids")
275
 	id_arr := strings.Split(ids, ",")
301
 	id_arr := strings.Split(ids, ",")
302
+	admin_user_id, _ := c.GetInt64("admin_user_id")
303
+	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
304
+
276
 	drugs, _ := service.GetNewDrugWarehouseInfo(id_arr)
305
 	drugs, _ := service.GetNewDrugWarehouseInfo(id_arr)
277
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
306
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
278
 	for _, item := range drugs {
307
 	for _, item := range drugs {
280
 			var struct3507 models.Struct3507
309
 			var struct3507 models.Struct3507
281
 			struct3507.FixmedinsBchno = ""
310
 			struct3507.FixmedinsBchno = ""
282
 			struct3507.InvDataType = "1"
311
 			struct3507.InvDataType = "1"
312
+			struct3507.Opter = roles.UserName
283
 			struct3507.OrgName = miConfig.OrgName
313
 			struct3507.OrgName = miConfig.OrgName
284
 			struct3507.AccessKey = miConfig.AccessKey
314
 			struct3507.AccessKey = miConfig.AccessKey
285
 			struct3507.RequestUrl = miConfig.Url
315
 			struct3507.RequestUrl = miConfig.Url
286
 			struct3507.SecretKey = miConfig.SecretKey
316
 			struct3507.SecretKey = miConfig.SecretKey
287
 			struct3507.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
317
 			struct3507.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
288
 			struct3507.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
318
 			struct3507.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
319
+
320
+			struct3507.Url = miConfig.Url
321
+			struct3507.AppId = miConfig.Cainfo
322
+			struct3507.AppSecret = miConfig.AppSecret
323
+			struct3507.Enckey = miConfig.EncKey
324
+			struct3507.SignKey = miConfig.SignKey
325
+			struct3507.SecretKey = miConfig.SecretKey
289
 			service.FJyb3507(struct3507)
326
 			service.FJyb3507(struct3507)
290
 
327
 
291
 			var struct3507_2 models.Struct3507
328
 			var struct3507_2 models.Struct3507
295
 			struct3507_2.SecretKey = miConfig.SecretKey
332
 			struct3507_2.SecretKey = miConfig.SecretKey
296
 			struct3507_2.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
333
 			struct3507_2.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
297
 			struct3507_2.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
334
 			struct3507_2.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
335
+
336
+			struct3507_2.Url = miConfig.Url
337
+			struct3507_2.AppId = miConfig.Cainfo
338
+			struct3507_2.AppSecret = miConfig.AppSecret
339
+			struct3507_2.Enckey = miConfig.EncKey
340
+			struct3507_2.SignKey = miConfig.SignKey
341
+			struct3507_2.SecretKey = miConfig.SecretKey
342
+
298
 			struct3507_2.FixmedinsBchno = ""
343
 			struct3507_2.FixmedinsBchno = ""
299
 			struct3507_2.InvDataType = "2"
344
 			struct3507_2.InvDataType = "2"
300
 			service.FJyb3507(struct3507_2)
345
 			service.FJyb3507(struct3507_2)
307
 			struct3507.SecretKey = miConfig.SecretKey
352
 			struct3507.SecretKey = miConfig.SecretKey
308
 			struct3507.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
353
 			struct3507.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
309
 			struct3507.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
354
 			struct3507.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
355
+
356
+			struct3507.Url = miConfig.Url
357
+			struct3507.AppId = miConfig.Cainfo
358
+			struct3507.AppSecret = miConfig.AppSecret
359
+			struct3507.Enckey = miConfig.EncKey
360
+			struct3507.SignKey = miConfig.SignKey
361
+			struct3507.SecretKey = miConfig.SecretKey
310
 			struct3507.FixmedinsBchno = ""
362
 			struct3507.FixmedinsBchno = ""
311
 			struct3507.InvDataType = "1"
363
 			struct3507.InvDataType = "1"
312
 			service.FJyb3507(struct3507)
364
 			service.FJyb3507(struct3507)
319
 func (c *HisApiController) DeleteXSandBG() {
371
 func (c *HisApiController) DeleteXSandBG() {
320
 	ids := c.getString("ids")
372
 	ids := c.getString("ids")
321
 	id_arr := strings.Split(ids, ",")
373
 	id_arr := strings.Split(ids, ",")
374
+	admin_user_id, _ := c.GetInt64("admin_user_id")
375
+	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
376
+
322
 	drugs, _ := service.GetNewDrugWarehouseInfo(id_arr)
377
 	drugs, _ := service.GetNewDrugWarehouseInfo(id_arr)
323
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
378
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
324
 	for _, item := range drugs {
379
 	for _, item := range drugs {
325
-		if item.is == 1 && item.IsBg == 1 {
380
+		if item.IsPc == 1 && item.IsBg == 1 {
326
 			var struct3507 models.Struct3507
381
 			var struct3507 models.Struct3507
327
 			struct3507.FixmedinsBchno = ""
382
 			struct3507.FixmedinsBchno = ""
328
 			struct3507.InvDataType = "1"
383
 			struct3507.InvDataType = "1"
332
 			struct3507.SecretKey = miConfig.SecretKey
387
 			struct3507.SecretKey = miConfig.SecretKey
333
 			struct3507.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
388
 			struct3507.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
334
 			struct3507.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
389
 			struct3507.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
390
+
391
+			struct3507.Url = miConfig.Url
392
+			struct3507.AppId = miConfig.Cainfo
393
+			struct3507.AppSecret = miConfig.AppSecret
394
+			struct3507.Enckey = miConfig.EncKey
395
+			struct3507.SignKey = miConfig.SignKey
396
+			struct3507.SecretKey = miConfig.SecretKey
397
+			struct3507.FixmedinsBchno = ""
398
+			struct3507.InvDataType = "1"
399
+
335
 			service.FJyb3507(struct3507)
400
 			service.FJyb3507(struct3507)
336
 
401
 
337
 			var struct3507_2 models.Struct3507
402
 			var struct3507_2 models.Struct3507
343
 			struct3507_2.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
408
 			struct3507_2.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
344
 			struct3507_2.FixmedinsBchno = ""
409
 			struct3507_2.FixmedinsBchno = ""
345
 			struct3507_2.InvDataType = "2"
410
 			struct3507_2.InvDataType = "2"
411
+
412
+			struct3507_2.Url = miConfig.Url
413
+			struct3507_2.AppId = miConfig.Cainfo
414
+			struct3507_2.AppSecret = miConfig.AppSecret
415
+			struct3507_2.Enckey = miConfig.EncKey
416
+			struct3507_2.SignKey = miConfig.SignKey
417
+			struct3507_2.SecretKey = miConfig.SecretKey
418
+			struct3507_2.FixmedinsBchno = ""
419
+			struct3507_2.InvDataType = "1"
346
 			service.FJyb3507(struct3507_2)
420
 			service.FJyb3507(struct3507_2)
347
 		}
421
 		}
348
 		if item.IsPc == 1 && item.IsBg == 0 {
422
 		if item.IsPc == 1 && item.IsBg == 0 {
439
 	struct3502.SecretKey = miConfig.SecretKey
513
 	struct3502.SecretKey = miConfig.SecretKey
440
 	struct3502.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
514
 	struct3502.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
441
 	struct3502.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
515
 	struct3502.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
516
+
517
+	struct3502.Url = miConfig.Url
518
+	struct3502.AppId = miConfig.Cainfo
519
+	struct3502.AppSecret = miConfig.AppSecret
520
+	struct3502.Enckey = miConfig.EncKey
521
+	struct3502.SignKey = miConfig.SignKey
522
+	struct3502.SecretKey = miConfig.SecretKey
523
+
442
 	struct3502.InvChgType = chgType
524
 	struct3502.InvChgType = chgType
443
 	struct3502.FixmedinsBchno = ""
525
 	struct3502.FixmedinsBchno = ""
444
 	struct3502.Cnt = strconv.FormatInt(count, 10)
526
 	struct3502.Cnt = strconv.FormatInt(count, 10)
468
 	struct3505.ExpyEnd = ""
550
 	struct3505.ExpyEnd = ""
469
 	struct3505.RxFlag = "0"
551
 	struct3505.RxFlag = "0"
470
 	struct3505.TrdnFlag = "1"
552
 	struct3505.TrdnFlag = "1"
553
+
554
+	struct3505.Url = miConfig.Url
555
+	struct3505.AppId = miConfig.Cainfo
556
+	struct3505.AppSecret = miConfig.AppSecret
557
+	struct3505.Enckey = miConfig.EncKey
558
+	struct3505.SignKey = miConfig.SignKey
559
+	struct3505.SecretKey = miConfig.SecretKey
560
+
471
 	struct3505.RtalDocno = order.Number
561
 	struct3505.RtalDocno = order.Number
472
 	strValue := fmt.Sprintf("%.2f", drug.PrescribingNumber)
562
 	strValue := fmt.Sprintf("%.2f", drug.PrescribingNumber)
473
 	struct3505.SelRetnCnt = strValue
563
 	struct3505.SelRetnCnt = strValue
518
 	struct3506.SecretKey = miConfig.SecretKey
608
 	struct3506.SecretKey = miConfig.SecretKey
519
 	struct3506.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
609
 	struct3506.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
520
 	struct3506.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
610
 	struct3506.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
611
+
612
+	struct3506.Url = miConfig.Url
613
+	struct3506.AppId = miConfig.Cainfo
614
+	struct3506.AppSecret = miConfig.AppSecret
615
+	struct3506.Enckey = miConfig.EncKey
616
+	struct3506.SignKey = miConfig.SignKey
617
+	struct3506.SecretKey = miConfig.SecretKey
618
+
521
 	result1, result2, result3 := service.FJyb3506(struct3506)
619
 	result1, result2, result3 := service.FJyb3506(struct3506)
522
 	fmt.Println(result1)
620
 	fmt.Println(result1)
523
 	fmt.Println(result2)
621
 	fmt.Println(result2)

+ 35 - 0
models/models_3501.go View File

27
 	PurcRetnCnt         string
27
 	PurcRetnCnt         string
28
 	PurcRetnStoinTime   string
28
 	PurcRetnStoinTime   string
29
 	PurcRetnOpterName   string
29
 	PurcRetnOpterName   string
30
+	Url                 string
31
+	AppId               string
32
+	AppSecret           string
33
+	SignKey             string
34
+	Enckey              string
30
 }
35
 }
31
 type Struct3502 struct {
36
 type Struct3502 struct {
32
 	MedListCodg         string
37
 	MedListCodg         string
53
 	RequestUrl          string
58
 	RequestUrl          string
54
 	AccessKey           string
59
 	AccessKey           string
55
 	Cainfo              string
60
 	Cainfo              string
61
+	Url                 string
62
+	AppId               string
63
+	AppSecret           string
64
+	SignKey             string
65
+	Enckey              string
56
 }
66
 }
57
 type Struct3503 struct {
67
 type Struct3503 struct {
58
 	MedListCodg         string
68
 	MedListCodg         string
85
 	RequestUrl          string
95
 	RequestUrl          string
86
 	AccessKey           string
96
 	AccessKey           string
87
 	Cainfo              string
97
 	Cainfo              string
98
+	Url                 string
99
+	AppId               string
100
+	AppSecret           string
101
+	SignKey             string
102
+	Enckey              string
88
 }
103
 }
89
 type Struct3504 struct {
104
 type Struct3504 struct {
90
 	MedListCodg         string
105
 	MedListCodg         string
113
 	RequestUrl          string
128
 	RequestUrl          string
114
 	AccessKey           string
129
 	AccessKey           string
115
 	Cainfo              string
130
 	Cainfo              string
131
+	Url                 string
132
+	AppId               string
133
+	AppSecret           string
134
+	SignKey             string
135
+	Enckey              string
116
 }
136
 }
117
 type Struct3505 struct {
137
 type Struct3505 struct {
118
 	MedListCodg         string
138
 	MedListCodg         string
161
 	AccessKey           string
181
 	AccessKey           string
162
 	Cainfo              string
182
 	Cainfo              string
163
 	MdtrtSetlType       string
183
 	MdtrtSetlType       string
184
+	Url                 string
185
+	AppId               string
186
+	AppSecret           string
187
+	SignKey             string
188
+	Enckey              string
164
 }
189
 }
165
 type Struct3506 struct {
190
 type Struct3506 struct {
166
 	MedListCodg         string
191
 	MedListCodg         string
194
 	AccessKey           string
219
 	AccessKey           string
195
 	Cainfo              string
220
 	Cainfo              string
196
 	MdtrtSn             string
221
 	MdtrtSn             string
222
+	Url                 string
223
+	AppId               string
224
+	AppSecret           string
225
+	SignKey             string
226
+	Enckey              string
197
 }
227
 }
198
 type Struct3507 struct {
228
 type Struct3507 struct {
199
 	FixmedinsBchno string
229
 	FixmedinsBchno string
207
 	RequestUrl     string
237
 	RequestUrl     string
208
 	AccessKey      string
238
 	AccessKey      string
209
 	Cainfo         string
239
 	Cainfo         string
240
+	Url            string
241
+	AppId          string
242
+	AppSecret      string
243
+	SignKey        string
244
+	Enckey         string
210
 }
245
 }
211
 
246
 
212
 type XtDrugInventory struct {
247
 type XtDrugInventory struct {

+ 30 - 16
service/fj_service.go View File

3013
 
3013
 
3014
 }
3014
 }
3015
 
3015
 
3016
-//
3017
-//func GetLastPsnByInsOrg(patient_id int64) (psn models.HisPsn, err error){
3018
-//	err := readDb.Model(&models.HisPsn{}).Where("patient_id = ? AND insuplc_admdvs <> ''",patient_id).Last(&psn).Error
3019
-//	return
3020
-//}
3021
-
3022
 func FJyb3501(struct3501 models.Struct3501) (string, string, string) {
3016
 func FJyb3501(struct3501 models.Struct3501) (string, string, string) {
3023
 	timestamp := time.Now().Unix()
3017
 	timestamp := time.Now().Unix()
3018
+	nonce := GetRandomString(32)
3019
+
3024
 	// 生成输入报文
3020
 	// 生成输入报文
3025
-	inputMessage := SetJSInputMessage(timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsHilistId, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Cainfo)
3021
+	//SetFjInputMessage
3022
+	inputMessage := SetFjInputMessage(nonce, timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsHilistId, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Url, struct3501.AppId, struct3501.AppSecret, struct3501.SignKey, struct3501.Enckey)
3026
 	input := make(map[string]interface{})
3023
 	input := make(map[string]interface{})
3027
 	inputData := make(map[string]interface{})
3024
 	inputData := make(map[string]interface{})
3028
 	druginputData := make(map[string]interface{})
3025
 	druginputData := make(map[string]interface{})
3029
-	druginputData2 := make(map[string]interface{})
3026
+	//druginputData2 := make(map[string]interface{})
3030
 
3027
 
3031
 	inputMessage["infno"] = "3501"                                  // 交易编码
3028
 	inputMessage["infno"] = "3501"                                  // 交易编码
3032
 	inputData["med_list_codg"] = struct3501.MedListCodg             // 定点医药机构目录编号
3029
 	inputData["med_list_codg"] = struct3501.MedListCodg             // 定点医药机构目录编号
3040
 	inputData["manu_date"] = struct3501.ManuDate                    // 人员编号 (来自1101接口返回)
3037
 	inputData["manu_date"] = struct3501.ManuDate                    // 人员编号 (来自1101接口返回)
3041
 	inputData["expy_end"] = struct3501.ExpyEnd                      // 人员编号 (来自1101接口返回)
3038
 	inputData["expy_end"] = struct3501.ExpyEnd                      // 人员编号 (来自1101接口返回)
3042
 	inputData["memo"] = ""                                          // 人员编号 (来自1101接口返回)
3039
 	inputData["memo"] = ""                                          // 人员编号 (来自1101接口返回)
3043
-	druginputData["drug_trac_codg"] = ""
3044
-	druginputData2["drugtracinfo"] = druginputData
3045
-	inputData["drug_trac_info"] = druginputData2
3040
+	druginputData["drug_trac_codg"] = "123"
3041
+	//druginputData2["drugtracinfo"] = druginputData
3042
+	inputData["drug_trac_info"] = druginputData
3046
 	input["invinfo"] = inputData
3043
 	input["invinfo"] = inputData
3047
 	inputMessage["input"] = input //交易输入
3044
 	inputMessage["input"] = input //交易输入
3048
 	bytesData, err := json.Marshal(inputMessage)
3045
 	bytesData, err := json.Marshal(inputMessage)
3060
 
3057
 
3061
 	return output, requestLog, err_msg
3058
 	return output, requestLog, err_msg
3062
 }
3059
 }
3060
+
3063
 func FJyb3502(struct3502 models.Struct3502) (string, string, string) {
3061
 func FJyb3502(struct3502 models.Struct3502) (string, string, string) {
3064
 	timestamp := time.Now().Unix()
3062
 	timestamp := time.Now().Unix()
3063
+	nonce := GetRandomString(32)
3064
+	inputMessage := SetFjInputMessage(nonce, timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsHilistId, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, struct3502.Url, struct3502.AppId, struct3502.AppSecret, struct3502.SignKey, struct3502.Enckey)
3065
+
3066
+	//inputMessage := SetInputMessag/**/e(nonce, timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsHilistId, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs)
3067
+
3065
 	// 生成输入报文
3068
 	// 生成输入报文
3066
-	inputMessage := SetJSInputMessage(timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsCode, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, struct3502.Cainfo)
3069
+	//inputMessage := SetJSInputMessage(timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsCode, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, struct3502.Cainfo)
3067
 	input := make(map[string]interface{})
3070
 	input := make(map[string]interface{})
3068
 	inputData := make(map[string]interface{})
3071
 	inputData := make(map[string]interface{})
3069
 	druginputData := make(map[string]interface{})
3072
 	druginputData := make(map[string]interface{})
3107
 	return output, requestLog, err_msg
3110
 	return output, requestLog, err_msg
3108
 
3111
 
3109
 }
3112
 }
3113
+
3110
 func FJyb3505(struct3505 models.Struct3505) (string, string, string) {
3114
 func FJyb3505(struct3505 models.Struct3505) (string, string, string) {
3111
 	timestamp := time.Now().Unix()
3115
 	timestamp := time.Now().Unix()
3116
+	nonce := GetRandomString(32)
3117
+	//inputMessage := SetInputMessage(nonce, timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs)
3118
+
3119
+	inputMessage := SetFjInputMessage(nonce, timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Url, struct3505.AppId, struct3505.AppSecret, struct3505.SignKey, struct3505.Enckey)
3120
+
3112
 	// 生成输入报文
3121
 	// 生成输入报文
3113
-	inputMessage := SetJSInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
3122
+	//inputMessage := SetJSInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
3114
 	input := make(map[string]interface{})
3123
 	input := make(map[string]interface{})
3115
 	inputData := make(map[string]interface{})
3124
 	inputData := make(map[string]interface{})
3116
 	druginputData := make(map[string]interface{})
3125
 	druginputData := make(map[string]interface{})
3181
 	return output, requestLog, err_msg
3190
 	return output, requestLog, err_msg
3182
 
3191
 
3183
 }
3192
 }
3193
+
3184
 func FJyb3506(struct3506 models.Struct3506) (string, string, string) {
3194
 func FJyb3506(struct3506 models.Struct3506) (string, string, string) {
3185
 	timestamp := time.Now().Unix()
3195
 	timestamp := time.Now().Unix()
3196
+	nonce := GetRandomString(32)
3197
+	//inputMessage := SetInputMessage(nonce, timestamp, struct3506.OrgName, struct3506.Opter, struct3506.FixmedinsHilistId, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs)
3198
+	inputMessage := SetFjInputMessage(nonce, timestamp, struct3506.OrgName, struct3506.Opter, struct3506.FixmedinsHilistId, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs, struct3506.Url, struct3506.AppId, struct3506.AppSecret, struct3506.SignKey, struct3506.Enckey)
3199
+
3186
 	// 生成输入报文
3200
 	// 生成输入报文
3187
-	inputMessage := SetJSInputMessage(timestamp, struct3506.OrgName, struct3506.Opter, struct3506.FixmedinsCode, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs, struct3506.Cainfo)
3188
 	input := make(map[string]interface{})
3201
 	input := make(map[string]interface{})
3189
 	inputData := make(map[string]interface{})
3202
 	inputData := make(map[string]interface{})
3190
 	druginputData := make(map[string]interface{})
3203
 	druginputData := make(map[string]interface{})
3236
 	return output, requestLog, err_msg
3249
 	return output, requestLog, err_msg
3237
 
3250
 
3238
 }
3251
 }
3252
+
3239
 func FJyb3507(struct3507 models.Struct3507) (string, string, string) {
3253
 func FJyb3507(struct3507 models.Struct3507) (string, string, string) {
3240
 	timestamp := time.Now().Unix()
3254
 	timestamp := time.Now().Unix()
3241
-	// 生成输入报文
3242
-	inputMessage := SetJSInputMessage(timestamp, struct3507.OrgName, struct3507.Opter, struct3507.FixmedinsCode, struct3507.InsuplcAdmdvs, struct3507.MdtrtareaAdmvs, struct3507.Cainfo)
3255
+	nonce := GetRandomString(32)
3256
+	inputMessage := SetFjInputMessage(nonce, timestamp, struct3507.OrgName, struct3507.Opter, struct3507.FixmedinsCode, struct3507.InsuplcAdmdvs, struct3507.MdtrtareaAdmvs, struct3507.Url, struct3507.AppId, struct3507.AppSecret, struct3507.SignKey, struct3507.Enckey)
3243
 	input := make(map[string]interface{})
3257
 	input := make(map[string]interface{})
3244
 	inputData := make(map[string]interface{})
3258
 	inputData := make(map[string]interface{})
3245
 	inputMessage["infno"] = "3507"                          // 交易编码
3259
 	inputMessage["infno"] = "3507"                          // 交易编码