陈少旭 4 ay önce
ebeveyn
işleme
8b3f6b11fd

+ 381 - 42
controllers/sg/his_api_controller.go Dosyayı Görüntüle

@@ -12,9 +12,7 @@ import (
12 12
 	//"crypto/x509/pkix"
13 13
 	"encoding/json"
14 14
 	"fmt"
15
-	//"github.com/tjfoc/gmsm/sm2"
16
-	//"github.com/tjfoc/gmsm/sm3"
17
-	"github.com/go-ole/go-ole"
15
+
18 16
 	"gdyb/controllers"
19 17
 	"gdyb/enums"
20 18
 	"gdyb/models"
@@ -184,7 +182,349 @@ func HisManagerApiRegistRouters() {
184 182
 
185 183
 	beego.Router("/api/settlelist/get/batch", &HisApiController{}, "get:GetbatchSettleList")
186 184
 
185
+	//库盘和变更
186
+	beego.Router("/api/pc_bg", &HisApiController{}, "get:FJ3501AND3502")
187
+	//删除库盘和变更
188
+	beego.Router("/api/delete_pc_bg", &HisApiController{}, "get:DeletePCandBG")
189
+	beego.Router("/api/delete_pc_bg", &HisApiController{}, "get:DeleteXSandBG")
190
+	//药品变更
191
+	beego.Router("/api/changedrug", &HisApiController{}, "get:ChangeDrug")
192
+
193
+}
194
+func (c *HisApiController) FJ3501AND3502() {
195
+	ids := c.getString("ids")
196
+	id_arr := strings.Split(ids, ",")
197
+	drugs, _ := service.GetNewDrugWarehouseInfo(id_arr)
198
+	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
199
+	//库盘
200
+	for _, drug := range drugs {
201
+		if drug.IsPc == 0 && drug.IsBg == 0 {
202
+			var struct3501 models.Struct3501
203
+			struct3501.OrgName = miConfig.OrgName
204
+			struct3501.AccessKey = miConfig.AccessKey
205
+			struct3501.RequestUrl = miConfig.Url
206
+			struct3501.SecretKey = miConfig.SecretKey
207
+			struct3501.MedListCodg = drug.BaseDrugLib.MedicalInsuranceNumber
208
+			struct3501.FixmedinsHilistId = miConfig.Code
209
+			struct3501.FixmedinsHilistName = miConfig.OrgName
210
+			struct3501.RxFlag = "0"
211
+			struct3501.Invdate = time.Unix(drug.Ctime, 0).Format("2006-01-02 15:04:05")
212
+			struct3501.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
213
+			struct3501.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
214
+			struct3501.InvCnt = strconv.FormatInt(drug.StockMaxNumber, 10)
215
+			struct3501.ExpyEnd = time.Unix(drug.ExpiryDate, 0).Format("2006-01-02 15:04:05")
216
+			//todo 批次号规则需要在咨询下保健
217
+			struct3501.FixmedinsBchno = ""
218
+			struct3501.Memo = ""
219
+			result1, result2, result3 := service.FJyb3501(struct3501)
220
+			fmt.Println(result1)
221
+			fmt.Println(result2)
222
+			fmt.Println(result3)
223
+
224
+			var struct3502 models.Struct3502
225
+			struct3502.MedListCodg = drug.BaseDrugLib.MedicalInsuranceNumber
226
+			struct3502.FixmedinsHilistId = miConfig.Code
227
+			struct3502.FixmedinsHilistName = miConfig.OrgName
228
+			struct3502.FixmedinsCode = miConfig.Code
229
+			struct3502.RxFlag = "0"
230
+			struct3502.InvChgTime = time.Unix(drug.Ctime, 0).Format("2006-01-02 15:04:05")
231
+			struct3502.OrgName = miConfig.OrgName
232
+			struct3502.AccessKey = miConfig.AccessKey
233
+			struct3502.RequestUrl = miConfig.Url
234
+			struct3502.SecretKey = miConfig.SecretKey
235
+			struct3502.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
236
+			struct3502.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
237
+			struct3502.InvChgType = "102"
238
+			struct3502.FixmedinsBchno = ""
239
+			struct3502.Cnt = strconv.FormatInt(drug.WarehousingCount, 10)
240
+			struct3502.Pric = fmt.Sprintf("%.2f", drug.BaseDrugLib.RetailPrice)
241
+			result11, result22, result33 := service.FJyb3502(struct3502)
242
+			fmt.Println(result11)
243
+			fmt.Println(result22)
244
+			fmt.Println(result33)
245
+
246
+		}
247
+		//变更
248
+		if drug.IsPc == 1 && drug.IsBg == 0 {
249
+			var struct3502 models.Struct3502
250
+			struct3502.MedListCodg = drug.BaseDrugLib.MedicalInsuranceNumber
251
+			struct3502.FixmedinsHilistId = miConfig.Code
252
+			struct3502.FixmedinsHilistName = miConfig.OrgName
253
+			struct3502.FixmedinsCode = miConfig.Code
254
+			struct3502.RxFlag = "0"
255
+			struct3502.InvChgTime = time.Unix(drug.Ctime, 0).Format("2006-01-02 15:04:05")
256
+			struct3502.OrgName = miConfig.OrgName
257
+			struct3502.AccessKey = miConfig.AccessKey
258
+			struct3502.RequestUrl = miConfig.Url
259
+			struct3502.SecretKey = miConfig.SecretKey
260
+			struct3502.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
261
+			struct3502.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
262
+			struct3502.InvChgType = "102"
263
+			struct3502.FixmedinsBchno = ""
264
+			struct3502.Cnt = strconv.FormatInt(drug.WarehousingCount, 10)
265
+			struct3502.Pric = fmt.Sprintf("%.2f", drug.BaseDrugLib.RetailPrice)
266
+			result1, result2, result3 := service.FJyb3502(struct3502)
267
+			fmt.Println(result1)
268
+			fmt.Println(result2)
269
+			fmt.Println(result3)
270
+		}
271
+	}
272
+}
273
+func (c *HisApiController) DeletePCandBG() {
274
+	ids := c.getString("ids")
275
+	id_arr := strings.Split(ids, ",")
276
+	drugs, _ := service.GetNewDrugWarehouseInfo(id_arr)
277
+	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
278
+	for _, item := range drugs {
279
+		if item.IsPc == 1 && item.IsBg == 1 {
280
+			var struct3507 models.Struct3507
281
+			struct3507.FixmedinsBchno = ""
282
+			struct3507.InvDataType = "1"
283
+			struct3507.OrgName = miConfig.OrgName
284
+			struct3507.AccessKey = miConfig.AccessKey
285
+			struct3507.RequestUrl = miConfig.Url
286
+			struct3507.SecretKey = miConfig.SecretKey
287
+			struct3507.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
288
+			struct3507.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
289
+			service.FJyb3507(struct3507)
290
+
291
+			var struct3507_2 models.Struct3507
292
+			struct3507_2.OrgName = miConfig.OrgName
293
+			struct3507_2.AccessKey = miConfig.AccessKey
294
+			struct3507_2.RequestUrl = miConfig.Url
295
+			struct3507_2.SecretKey = miConfig.SecretKey
296
+			struct3507_2.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
297
+			struct3507_2.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
298
+			struct3507_2.FixmedinsBchno = ""
299
+			struct3507_2.InvDataType = "2"
300
+			service.FJyb3507(struct3507_2)
301
+		}
302
+		if item.IsPc == 1 && item.IsBg == 0 {
303
+			var struct3507 models.Struct3507
304
+			struct3507.OrgName = miConfig.OrgName
305
+			struct3507.AccessKey = miConfig.AccessKey
306
+			struct3507.RequestUrl = miConfig.Url
307
+			struct3507.SecretKey = miConfig.SecretKey
308
+			struct3507.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
309
+			struct3507.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
310
+			struct3507.FixmedinsBchno = ""
311
+			struct3507.InvDataType = "1"
312
+			service.FJyb3507(struct3507)
313
+		}
314
+
315
+	}
316
+
317
+}
318
+
319
+func (c *HisApiController) DeleteXSandBG() {
320
+	ids := c.getString("ids")
321
+	id_arr := strings.Split(ids, ",")
322
+	drugs, _ := service.GetNewDrugWarehouseInfo(id_arr)
323
+	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
324
+	for _, item := range drugs {
325
+		if item.is == 1 && item.IsBg == 1 {
326
+			var struct3507 models.Struct3507
327
+			struct3507.FixmedinsBchno = ""
328
+			struct3507.InvDataType = "1"
329
+			struct3507.OrgName = miConfig.OrgName
330
+			struct3507.AccessKey = miConfig.AccessKey
331
+			struct3507.RequestUrl = miConfig.Url
332
+			struct3507.SecretKey = miConfig.SecretKey
333
+			struct3507.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
334
+			struct3507.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
335
+			service.FJyb3507(struct3507)
336
+
337
+			var struct3507_2 models.Struct3507
338
+			struct3507_2.OrgName = miConfig.OrgName
339
+			struct3507_2.AccessKey = miConfig.AccessKey
340
+			struct3507_2.RequestUrl = miConfig.Url
341
+			struct3507_2.SecretKey = miConfig.SecretKey
342
+			struct3507_2.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
343
+			struct3507_2.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
344
+			struct3507_2.FixmedinsBchno = ""
345
+			struct3507_2.InvDataType = "2"
346
+			service.FJyb3507(struct3507_2)
347
+		}
348
+		if item.IsPc == 1 && item.IsBg == 0 {
349
+			var struct3507 models.Struct3507
350
+			struct3507.OrgName = miConfig.OrgName
351
+			struct3507.AccessKey = miConfig.AccessKey
352
+			struct3507.RequestUrl = miConfig.Url
353
+			struct3507.SecretKey = miConfig.SecretKey
354
+			struct3507.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
355
+			struct3507.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
356
+			struct3507.FixmedinsBchno = ""
357
+			struct3507.InvDataType = "1"
358
+			service.FJyb3507(struct3507)
359
+		}
360
+
361
+	}
362
+
363
+}
364
+
365
+func (c *HisApiController) ChangeDrug() {
366
+	ids := c.getString("ids")
367
+	id_arr := strings.Split(ids, ",")
368
+	flows, _ := service.GetNewDrugFlowInfo(id_arr)
369
+	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
370
+
371
+	for _, item := range flows {
372
+		if item.ConsumableType == 3 { //3为自动出库 7为自动退库
373
+			prescription := service.GetHisPrescriptionByID(item.HisDoctorAdviceInfo.PrescriptionId)
374
+			if prescription.OrderStatus == 2 { //已经结算
375
+				//判断是否已经销售
376
+				if item.IsSale == 1 { //是否已经销售,1是   0否
377
+					//是否已经变更 1是  0否
378
+					if item.IsChange == 0 { //没变更,进行变更操作
379
+						ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102")
380
+					}
381
+				} else { //没销售,
382
+					//进行商品销售接口
383
+					SaleStock(c.GetAdminUserInfo().CurrentOrgId, prescription, item.HisDoctorAdviceInfo, miConfig, "")
384
+
385
+					if item.IsChange == 0 { //没变更,进行变更操作
386
+						ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102")
387
+					}
388
+				}
389
+			} else { //还没结算
390
+				if item.IsChange == 0 { //没变更,进行变更操作
391
+					ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102")
392
+
393
+				}
394
+			}
395
+		} else if item.ConsumableType == 7 {
396
+			prescription := service.GetHisPrescriptionByID(item.HisDoctorAdviceInfo.PrescriptionId)
397
+			order := service.GetHisOrderByNumber(prescription.BatchNumber)
398
+
399
+			if order.OrderStatus == 2 || order.OrderStatus == 1 { //已经结算
400
+				//判断是否已经销售
401
+				if item.IsSale == 1 { //是否已经销售,1是   0否
402
+					//是否已经变更 1是  0否
403
+					if item.IsChange == 0 { //没变更,进行变更操作
404
+						ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102")
405
+					}
406
+				} else { //没销售,
407
+					//进行商品销售退货接口
408
+					CancleSaleStock(c.GetAdminUserInfo().CurrentOrgId, prescription, item.HisDoctorAdviceInfo, miConfig, "")
409
+					if item.IsChange == 0 { //没变更,进行变更操作
410
+						ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102")
411
+					}
412
+				}
413
+			} else { //还没结算
414
+				if item.IsChange == 0 { //没变更,进行变更操作
415
+					ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102")
416
+
417
+				}
418
+			}
419
+
420
+		} else { //其他方式
421
+			if item.IsChange == 0 { //没变更,进行变更操作
422
+				ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102")
423
+			}
424
+		}
425
+	}
187 426
 }
427
+
428
+func ChangeStock(count int64, drug models.HisDoctorAdviceInfo, miConfig models.MedicalInsuranceOrgConfig, chgType string) {
429
+	var struct3502 models.Struct3502
430
+	struct3502.MedListCodg = drug.BaseDrugLib.MedicalInsuranceNumber
431
+	struct3502.FixmedinsHilistId = miConfig.Code
432
+	struct3502.FixmedinsHilistName = miConfig.OrgName
433
+	struct3502.FixmedinsCode = miConfig.Code
434
+	struct3502.RxFlag = "0"
435
+	struct3502.InvChgTime = time.Unix(drug.CreatedTime, 0).Format("2006-01-02 15:04:05")
436
+	struct3502.OrgName = miConfig.OrgName
437
+	struct3502.AccessKey = miConfig.AccessKey
438
+	struct3502.RequestUrl = miConfig.Url
439
+	struct3502.SecretKey = miConfig.SecretKey
440
+	struct3502.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
441
+	struct3502.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
442
+	struct3502.InvChgType = chgType
443
+	struct3502.FixmedinsBchno = ""
444
+	struct3502.Cnt = strconv.FormatInt(count, 10)
445
+	struct3502.Pric = fmt.Sprintf("%.2f", drug.Price)
446
+	result1, result2, result3 := service.FJyb3502(struct3502)
447
+	fmt.Println(result1)
448
+	fmt.Println(result2)
449
+	fmt.Println(result3)
450
+
451
+}
452
+func SaleStock(org_id int64, pre models.HisPrescription, drug models.HisDoctorAdviceInfo, miConfig models.MedicalInsuranceOrgConfig, chgType string) {
453
+	var struct3505 models.Struct3505
454
+	struct3505.MedListCodg = drug.BaseDrugLib.MedicalInsuranceNumber
455
+	struct3505.FixmedinsHilistId = miConfig.Code
456
+	struct3505.FixmedinsHilistName = miConfig.OrgName
457
+	struct3505.FixmedinsCode = miConfig.Code
458
+	struct3505.FixmedinsBchno = ""
459
+	roles, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
460
+	struct3505.PrscDrName = roles.UserName
461
+	struct3505.PharName = ""
462
+	struct3505.PharPracCertNo = ""
463
+	order := service.GetHisOrderByNumber(pre.BatchNumber)
464
+	struct3505.SetlId = order.SetlId
465
+	struct3505.MdtrtSn = order.MdtrtId
466
+	struct3505.ManuLotnum = ""
467
+	struct3505.ManuDate = ""
468
+	struct3505.ExpyEnd = ""
469
+	struct3505.RxFlag = "0"
470
+	struct3505.TrdnFlag = "1"
471
+	struct3505.RtalDocno = order.Number
472
+	strValue := fmt.Sprintf("%.2f", drug.PrescribingNumber)
473
+	struct3505.SelRetnCnt = strValue
474
+	struct3505.SelRetnTime = time.Unix(drug.CreatedTime, 0).Format("2006-01-02 15:04:05")
475
+	roles_two, _ := service.GetAdminUserInfoByID(org_id, order.Creator)
476
+
477
+	struct3505.SelRetnOpterName = roles_two.UserName
478
+	if order.IsMedicineInsurance == 1 {
479
+		struct3505.MdtrtSetlType = "1"
480
+	} else {
481
+		struct3505.MdtrtSetlType = "2"
482
+	}
483
+	struct3505.OrgName = miConfig.OrgName
484
+	struct3505.AccessKey = miConfig.AccessKey
485
+	struct3505.RequestUrl = miConfig.Url
486
+	struct3505.SecretKey = miConfig.SecretKey
487
+	struct3505.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
488
+	struct3505.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
489
+	result1, result2, result3 := service.FJyb3505(struct3505)
490
+	fmt.Println(result1)
491
+	fmt.Println(result2)
492
+	fmt.Println(result3)
493
+
494
+}
495
+func CancleSaleStock(org_id int64, pre models.HisPrescription, drug models.HisDoctorAdviceInfo, miConfig models.MedicalInsuranceOrgConfig, chgType string) {
496
+	var struct3506 models.Struct3506
497
+	struct3506.MedListCodg = drug.BaseDrugLib.MedicalInsuranceNumber
498
+	struct3506.FixmedinsHilistId = miConfig.Code
499
+	struct3506.FixmedinsHilistName = miConfig.OrgName
500
+	struct3506.FixmedinsCode = miConfig.Code
501
+	struct3506.FixmedinsBchno = ""
502
+	order := service.GetHisOrderByNumber(pre.BatchNumber)
503
+	//roles, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
504
+	struct3506.ManuLotnum = ""
505
+	struct3506.ManuDate = ""
506
+	struct3506.MdtrtSn = order.MdtrtId
507
+	struct3506.ExpyEnd = ""
508
+	struct3506.RxFlag = "0"
509
+	struct3506.TrdnFlag = "1"
510
+	strValue := fmt.Sprintf("%.2f", drug.PrescribingNumber)
511
+	struct3506.SelRetnCnt = strValue
512
+	struct3506.SelRetnTime = time.Unix(drug.CreatedTime, 0).Format("2006-01-02 15:04:05")
513
+	roles_two, _ := service.GetAdminUserInfoByID(org_id, order.Creator)
514
+	struct3506.SelRetnOpterName = roles_two.UserName
515
+	struct3506.OrgName = miConfig.OrgName
516
+	struct3506.AccessKey = miConfig.AccessKey
517
+	struct3506.RequestUrl = miConfig.Url
518
+	struct3506.SecretKey = miConfig.SecretKey
519
+	struct3506.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
520
+	struct3506.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
521
+	result1, result2, result3 := service.FJyb3506(struct3506)
522
+	fmt.Println(result1)
523
+	fmt.Println(result2)
524
+	fmt.Println(result3)
525
+
526
+}
527
+
188 528
 func (c *HisApiController) Get1318() {
189 529
 	adminUser := c.GetAdminUserInfo()
190 530
 	admin_user_id, _ := c.GetInt64("admin_user_id")
@@ -4480,19 +4820,19 @@ func (c *HisApiController) ReadEleToken() {
4480 4820
 					Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
4481 4821
 					infoStr := string(Iinfos)
4482 4822
 					idetinfoStr := string(Idetinfos)
4483
-				  //date,age,_  :=  GetBirthdateAndAge(res.Output.Baseinfo.Certno),
4484
-						b,age, _ := getBirthdateAndAge(res.Output.Baseinfo.Certno)
4823
+					//date,age,_  :=  GetBirthdateAndAge(res.Output.Baseinfo.Certno),
4824
+					b, age, _ := getBirthdateAndAge(res.Output.Baseinfo.Certno)
4485 4825
 
4486 4826
 					psn := &models.HisPsn{
4487
-						PsnNo: res.Output.Baseinfo.PsnNo,
4488
-						PatientId: patient.ID,
4489
-						Certno:    res.Output.Baseinfo.Certno,
4827
+						PsnNo:        res.Output.Baseinfo.PsnNo,
4828
+						PatientId:    patient.ID,
4829
+						Certno:       res.Output.Baseinfo.Certno,
4490 4830
 						Gend:         res.Output.Baseinfo.Gend,
4491 4831
 						Naty:         res.Output.Baseinfo.Naty,
4492 4832
 						PsnCertType:  res.Output.Baseinfo.PsnCertType,
4493 4833
 						PsnName:      res.Output.Baseinfo.PsnName,
4494
-						Age:float64(age),
4495
-						Brdy:b,
4834
+						Age:          float64(age),
4835
+						Brdy:         b,
4496 4836
 						Idetinfo:     idetinfoStr,
4497 4837
 						Insuinfo:     infoStr,
4498 4838
 						UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
@@ -8002,14 +8342,14 @@ func (c *HisApiController) ReadCard() {
8002 8342
 					Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
8003 8343
 					infoStr := string(Iinfos)
8004 8344
 					idetinfoStr := string(Idetinfos)
8005
-					b,age, _ := getBirthdateAndAge(res.Output.Baseinfo.Certno)
8345
+					b, age, _ := getBirthdateAndAge(res.Output.Baseinfo.Certno)
8006 8346
 
8007 8347
 					psn := &models.HisPsn{
8008
-						PsnNo: res.Output.Baseinfo.PsnNo,
8009
-						PatientId: patient.ID,
8010
-						Certno:    res.Output.Baseinfo.Certno,
8348
+						PsnNo:       res.Output.Baseinfo.PsnNo,
8349
+						PatientId:   patient.ID,
8350
+						Certno:      res.Output.Baseinfo.Certno,
8011 8351
 						Brdy:        b,
8012
-						Age:float64(age),
8352
+						Age:         float64(age),
8013 8353
 						Gend:        res.Output.Baseinfo.Gend,
8014 8354
 						Naty:        res.Output.Baseinfo.Naty,
8015 8355
 						PsnCertType: res.Output.Baseinfo.PsnCertType,
@@ -8178,14 +8518,14 @@ func (c *HisApiController) ReadCard() {
8178 8518
 							Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
8179 8519
 							infoStr := string(Iinfos)
8180 8520
 							idetinfoStr := string(Idetinfos)
8181
-							b,age, _ := getBirthdateAndAge(res.Output.Baseinfo.Certno)
8521
+							b, age, _ := getBirthdateAndAge(res.Output.Baseinfo.Certno)
8182 8522
 
8183 8523
 							psn := &models.HisPsn{
8184
-								PsnNo: res.Output.Baseinfo.PsnNo,
8185
-								PatientId: patient.ID,
8186
-								Certno:    res.Output.Baseinfo.Certno,
8524
+								PsnNo:        res.Output.Baseinfo.PsnNo,
8525
+								PatientId:    patient.ID,
8526
+								Certno:       res.Output.Baseinfo.Certno,
8187 8527
 								Brdy:         b,
8188
-								Age:float64(age),
8528
+								Age:          float64(age),
8189 8529
 								Gend:         res.Output.Baseinfo.Gend,
8190 8530
 								Naty:         res.Output.Baseinfo.Naty,
8191 8531
 								PsnCertType:  res.Output.Baseinfo.PsnCertType,
@@ -10016,14 +10356,14 @@ func (c *HisApiController) ReadCard() {
10016 10356
 						Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
10017 10357
 						infoStr := string(Iinfos)
10018 10358
 						idetinfoStr := string(Idetinfos)
10019
-						b,age, _ := getBirthdateAndAge(res.Output.Baseinfo.Certno)
10359
+						b, age, _ := getBirthdateAndAge(res.Output.Baseinfo.Certno)
10020 10360
 
10021 10361
 						psn := &models.HisPsn{
10022 10362
 							PsnNo:     res.Output.Baseinfo.PsnNo,
10023 10363
 							PatientId: patient.ID,
10024 10364
 							Certno:    res.Output.Baseinfo.Certno,
10025
-							Brdy:        b,
10026
-							Age:float64(age),
10365
+							Brdy:      b,
10366
+							Age:       float64(age),
10027 10367
 							//Brdy: res.Output.Baseinfo.Brdy,
10028 10368
 							Gend:         res.Output.Baseinfo.Gend,
10029 10369
 							Naty:         res.Output.Baseinfo.Naty,
@@ -11326,14 +11666,14 @@ func (c *HisApiController) ReadCard() {
11326 11666
 						infoStr := string(Iinfos)
11327 11667
 						idetinfoStr := string(Idetinfos)
11328 11668
 
11329
-						b,age, _ := getBirthdateAndAge(res.Output.Baseinfo.Certno)
11669
+						b, age, _ := getBirthdateAndAge(res.Output.Baseinfo.Certno)
11330 11670
 						psn := &models.HisPsn{
11331
-							PsnNo:     res.Output.Baseinfo.PsnNo,
11332
-							PatientId: patient.ID,
11333
-							Certno:    res.Output.Baseinfo.Certno,
11334
-							Gend:      res.Output.Baseinfo.Gend,
11335
-							Brdy:        b,
11336
-							Age:float64(age),
11671
+							PsnNo:        res.Output.Baseinfo.PsnNo,
11672
+							PatientId:    patient.ID,
11673
+							Certno:       res.Output.Baseinfo.Certno,
11674
+							Gend:         res.Output.Baseinfo.Gend,
11675
+							Brdy:         b,
11676
+							Age:          float64(age),
11337 11677
 							Naty:         res.Output.Baseinfo.Naty,
11338 11678
 							PsnCertType:  res.Output.Baseinfo.PsnCertType,
11339 11679
 							PsnName:      res.Output.Baseinfo.PsnName,
@@ -17173,12 +17513,12 @@ type ResultCFYLJG007 struct {
17173 17513
 	InfRefmsgid string `json:"inf_refmsgid"`
17174 17514
 	Infcode     int64  `json:"infcode"`
17175 17515
 	Output      struct {
17176
-		HiRxno           string        `json:"hi_rxno"`
17177
-		RxStasName       string        `json:"rx_stas_name"`
17178
-		RxUsedStasCodg   string        `json:"rx_used_stas_codg"`
17179
-		Seltdelts        []interface{} `json:"seltdelts"`
17180
-		RxUsedStasName   string        `json:"rx_used_stas_name"`
17181
-		RxStasCodg       string        `json:"rx_stas_codg"`
17516
+		HiRxno         string        `json:"hi_rxno"`
17517
+		RxStasName     string        `json:"rx_stas_name"`
17518
+		RxUsedStasCodg string        `json:"rx_used_stas_codg"`
17519
+		Seltdelts      []interface{} `json:"seltdelts"`
17520
+		RxUsedStasName string        `json:"rx_used_stas_name"`
17521
+		RxStasCodg     string        `json:"rx_stas_codg"`
17182 17522
 	} `json:"output"`
17183 17523
 	RefmsgTime  string      `json:"refmsg_time"`
17184 17524
 	RespondTime string      `json:"respond_time"`
@@ -17311,7 +17651,7 @@ type ResultCFYLJG005 struct {
17311 17651
 			SinDosunt       string  `json:"sin_dosunt"`
17312 17652
 			UsedFrquCodg    string  `json:"used_frqu_codg"`
17313 17653
 			UsedFrquName    string  `json:"used_frqu_name"`
17314
-			DrugTotlcnt     string `json:"drug_totlcnt"`
17654
+			DrugTotlcnt     string  `json:"drug_totlcnt"`
17315 17655
 			DrugTotlcntEmp  string  `json:"drug_totlcnt_emp"`
17316 17656
 			DiseCodg        string  `json:"dise_codg"`
17317 17657
 			HospApprFlag    string  `json:"hosp_appr_flag"`
@@ -21109,8 +21449,8 @@ func (c *HisApiController) GetUploadInfo() {
21109 21449
 							order.Creator = order.Creator
21110 21450
 							order.Modify = roles.AdminUserId
21111 21451
 							order.RequestLog = src_resquest
21112
-						order.FaPiaoNumber =         fapiao_number
21113
-							order.FaPiaoCode =           fapiao_code
21452
+							order.FaPiaoNumber = fapiao_number
21453
+							order.FaPiaoCode = fapiao_code
21114 21454
 							//setlDetail, _ := json.Marshal(res.Output.Setldetail)
21115 21455
 							//detailStr := string(setlDetail)
21116 21456
 							//order.SetlDetail = detailStr
@@ -22189,8 +22529,8 @@ func (c *HisApiController) GetUploadInfo() {
22189 22529
 				order.Modify = roles.AdminUserId
22190 22530
 				order.RequestLog = src_resquest
22191 22531
 				order.Diagnosis = diagnosis_id
22192
-				order.FaPiaoNumber =         fapiao_number
22193
-				order.FaPiaoCode =           fapiao_code
22532
+				order.FaPiaoNumber = fapiao_number
22533
+				order.FaPiaoCode = fapiao_code
22194 22534
 				setlDetail, _ := json.Marshal(res.Output.Setldetail)
22195 22535
 				detailStr := string(setlDetail)
22196 22536
 				order.SetlDetail = detailStr
@@ -33102,7 +33442,6 @@ func RemoveRepeatedPurviewElement2(arr []string) (newArr []string) {
33102 33442
 	return
33103 33443
 }
33104 33444
 
33105
-
33106 33445
 func getBirthdateAndAge(idNumber string) (string, int, error) {
33107 33446
 	if len(idNumber) != 18 {
33108 33447
 		return "", 0, fmt.Errorf("invalid ID number length. It should be 18 digits")

+ 2 - 0
models/models_3501.go Dosyayı Görüntüle

@@ -160,6 +160,7 @@ type Struct3505 struct {
160 160
 	RequestUrl          string
161 161
 	AccessKey           string
162 162
 	Cainfo              string
163
+	MdtrtSetlType       string
163 164
 }
164 165
 type Struct3506 struct {
165 166
 	MedListCodg         string
@@ -192,6 +193,7 @@ type Struct3506 struct {
192 193
 	RequestUrl          string
193 194
 	AccessKey           string
194 195
 	Cainfo              string
196
+	MdtrtSn             string
195 197
 }
196 198
 type Struct3507 struct {
197 199
 	FixmedinsBchno string

+ 64 - 0
models/new_stock_models.go Dosyayı Görüntüle

@@ -260,6 +260,9 @@ type NewDrugWarehouseInfo struct {
260 260
 	StorehouseId              int64  `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
261 261
 	SecondWarehouseInfoId     int64  `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
262 262
 	IsCheck                   int64  `gorm:"column:is_check" json:"is_check" form:"is_check"`
263
+
264
+	IsPc int64 `gorm:"column:is_pc" json:"is_pc" form:"is_pc"`
265
+	IsBg int64 `gorm:"column:is_bg" json:"is_bg" form:"is_bg"`
263 266
 }
264 267
 
265 268
 func (NewDrugWarehouseInfo) TableName() string {
@@ -377,3 +380,64 @@ type NewDrugCancelStockInfo struct {
377 380
 func (NewDrugCancelStockInfo) TableName() string {
378 381
 	return "xt_drug_cancel_stock_info"
379 382
 }
383
+
384
+type DrugFlow struct {
385
+	ID                        int64               `gorm:"column:id" json:"id" form:"id"`
386
+	WarehousingId             int64               `gorm:"column:warehousing_id" json:"warehousing_id" form:"warehousing_id"`
387
+	DrugId                    int64               `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
388
+	Number                    string              `gorm:"column:number" json:"number" form:"number"`
389
+	BatchNumber               string              `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
390
+	Count                     int64               `gorm:"column:count" json:"count" form:"count"`
391
+	UserOrgId                 int64               `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
392
+	PatientId                 int64               `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
393
+	SystemTime                int64               `gorm:"column:system_time" json:"system_time" form:"system_time"`
394
+	ConsumableType            int64               `gorm:"column:consumable_type" json:"consumable_type" form:"consumable_type"`
395
+	IsSys                     int64               `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
396
+	WarehousingOrder          string              `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
397
+	WarehouseOutId            int64               `gorm:"column:warehouse_out_id" json:"warehouse_out_id" form:"warehouse_out_id"`
398
+	WarehouseOutOrderNumber   string              `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
399
+	IsEdit                    int64               `gorm:"column:is_edit" json:"is_edit" form:"is_edit"`
400
+	CancelStockId             int64               `gorm:"column:cancel_stock_id" json:"cancel_stock_id" form:"cancel_stock_id"`
401
+	CancelOrderNumber         string              `gorm:"column:cancel_order_number" json:"cancel_order_number" form:"cancel_order_number"`
402
+	Manufacturer              int64               `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
403
+	Dealer                    int64               `gorm:"column:dealer" json:"dealer" form:"dealer"`
404
+	Creator                   int64               `gorm:"column:creator" json:"creator" form:"creator"`
405
+	UpdateCreator             int64               `gorm:"column:update_creator" json:"update_creator" form:"update_creator"`
406
+	Status                    int64               `gorm:"column:status" json:"status" form:"status"`
407
+	Ctime                     int64               `gorm:"column:ctime" json:"ctime" form:"ctime"`
408
+	Mtime                     int64               `gorm:"column:mtime" json:"mtime" form:"mtime"`
409
+	Price                     float64             `gorm:"column:price" json:"price" form:"price"`
410
+	WarehousingDetailId       int64               `gorm:"column:warehousing_detail_id" json:"warehousing_detail_id" form:"warehousing_detail_id"`
411
+	WarehouseOutDetailId      int64               `gorm:"column:warehouse_out_detail_id" json:"warehouse_out_detail_id" form:"warehouse_out_detail_id"`
412
+	CancelOutDetailId         int64               `gorm:"column:cancel_out_detail_id" json:"cancel_out_detail_id" form:"cancel_out_detail_id"`
413
+	ExpireDate                int64               `gorm:"column:expire_date" json:"expire_date" form:"expire_date"`
414
+	ProductDate               int64               `gorm:"column:product_date" json:"product_date" form:"product_date"`
415
+	MaxUnit                   string              `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
416
+	MinUnit                   string              `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
417
+	StockMaxNumber            int64               `gorm:"column:stock_max_number" json:"stock_max_number" form:"stock_max_number"`
418
+	StockMinNumber            int64               `gorm:"column:stock_min_number" json:"stock_min_number" form:"stock_min_number"`
419
+	LastStockMaxNumber        int64               `gorm:"column:last_stock_max_number" json:"last_stock_max_number" form:"last_stock_max_number"`
420
+	LastStockMinNumber        int64               `gorm:"column:last_stock_min_number" json:"last_stock_min_number" form:"last_stock_min_number"`
421
+	AdviceId                  int64               `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
422
+	HisDoctorAdviceInfo       HisDoctorAdviceInfo `gorm:"ForeignKey:ID;AssociationForeignKey:AdviceId" json:"advice"`
423
+	SupplyWarehouseId         int64               `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
424
+	SupplyCancelOutId         int64               `gorm:"column:supply_cancel_out_id" json:"supply_cancel_out_id" form:"supply_cancel_out_id"`
425
+	SupplyWarehouseDetailInfo int64               `gorm:"column:supply_warehouse_detail_info" json:"supply_warehouse_detail_info" form:"supply_warehouse_detail_info"`
426
+	StorehouseId              int64               `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
427
+	SecondWarehouseInfoId     int64               `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
428
+	AdminUserId               int64               `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
429
+	LastPrice                 float64             `gorm:"column:last_price" json:"last_price" form:"last_price"`
430
+	StockCount                string              `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
431
+	PharmacyId                int64               `gorm:"column:pharmacy_id" json:"pharmacy_id" form:"pharmacy_id"`
432
+	IsRead                    int64               `gorm:"column:is_read" json:"is_read" form:"is_read"`
433
+	IsCheck                   int64               `gorm:"column:is_check" json:"is_check" form:"is_check"`
434
+	OverCount                 int64               `gorm:"column:over_count" json:"over_count" form:"over_count"`
435
+	RetailPrice               float64             `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
436
+	OrderId                   int64               `gorm:"column:order_id" json:"order_id" form:"order_id"`
437
+	IsSale                    int64               `gorm:"column:is_sale" json:"is_sale" form:"is_sale"`
438
+	IsChange                  int64               `gorm:"column:is_change" json:"is_change" form:"is_change"`
439
+}
440
+
441
+func (DrugFlow) TableName() string {
442
+	return "xt_drug_flow"
443
+}

+ 266 - 24
service/fj_service.go Dosyayı Görüntüle

@@ -28,7 +28,6 @@ import (
28 28
 	"os/exec"
29 29
 )
30 30
 
31
-//
32 31
 // 人员基本信息
33 32
 func FJyb1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, id_card_type int64, card_sn string, certificates int64, url string, app_id string, app_secret string, sign_key string, enc_key string, name string, id_card_no string) (string, string, string) {
34 33
 	//生成签名
@@ -235,7 +234,7 @@ func FJyb2201(psnNo string, insutype string, certNo string, org_name string, doc
235 234
 	return output, requestLog, err_msg
236 235
 }
237 236
 
238
-//门诊挂号撤销
237
+// 门诊挂号撤销
239 238
 func FJyb2202(psnNo string, mdtrtId string, ipt_otp_no string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string, url string, app_id string, app_secret string, sign_key string, enc_key string) (string, string, string) {
240 239
 	// 生成签名
241 240
 	nonce := GetRandomString(32)
@@ -341,7 +340,7 @@ func FJyb2203(psnNo string, mdtrtId string, doctor string, department string, or
341 340
 	return output, requestLog, err_msg
342 341
 }
343 342
 
344
-//  门诊费用明细信息上传
343
+// 门诊费用明细信息上传
345 344
 func FJyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescription, chrg_bchno string, org_name string, doctor string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, balance_accounts_type string, opter string, url string, app_id string, app_secret string, sign_key string, enc_key string, dise_code string, doctor_number string) (string, string, string) {
346 345
 	// 生成签名
347 346
 	nonce := GetRandomString(32)
@@ -516,7 +515,7 @@ func FJyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
516 515
 
517 516
 }
518 517
 
519
-//  门诊费用明细信息撤销
518
+// 门诊费用明细信息撤销
520 519
 func FJyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string, url string, app_id string, app_secret string, sign_key string, enc_key string) (string, string, string) {
521 520
 	// 生成签名
522 521
 	nonce := GetRandomString(32)
@@ -551,7 +550,7 @@ func FJyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, d
551 550
 	return output, requestLog, err_msg
552 551
 }
553 552
 
554
-//  门诊预结算
553
+// 门诊预结算
555 554
 func FJyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, url string, app_id string, app_secret string, sign_key string, enc_key string, acct_used_flag string) (string, string, string) {
556 555
 
557 556
 	// 生成签名
@@ -701,7 +700,7 @@ func FJyb2206ForToken(psnNo string, mdtrtId string, chrgBchno string, certNo str
701 700
 	return output, requestLog, err_msg
702 701
 }
703 702
 
704
-//  门诊结算
703
+// 门诊结算
705 704
 func FJyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, acct_used_flag string, url string, app_id string, app_secret string, sign_key string, enc_key string) (string, string, string) {
706 705
 	// 生成签名
707 706
 	nonce := GetRandomString(32)
@@ -851,7 +850,7 @@ func FJyb2207ForToken(psnNo string, mdtrtId string, chrgBchno string, certNo str
851 850
 	return output, requestLog, err_msg
852 851
 }
853 852
 
854
-//  门诊结算撤销
853
+// 门诊结算撤销
855 854
 func FJyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, url string, app_id string, app_secret string, sign_key string, enc_key string) (string, string, string) {
856 855
 	// 生成签名
857 856
 	nonce := GetRandomString(32)
@@ -917,7 +916,7 @@ func FJyb5203(baseParams models.BaseParams, businessParams models.BusinessParams
917 916
 	return output, requestLog, err_msg
918 917
 }
919 918
 
920
-//确认订单
919
+// 确认订单
921 920
 func FJyb6201(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, order models.HisOrder, url string, app_id string, app_secret string, sign_key string, enc_key string) string {
922 921
 	// 生成签名
923 922
 	nonce := GetRandomString(32)
@@ -1006,7 +1005,7 @@ func FJyb6201(org_name string, doctor string, fixmedins_code string, insuplc_adm
1006 1005
 	return str
1007 1006
 }
1008 1007
 
1009
-//  医药机构费用结算对总账 func Gdyb3201( org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
1008
+// 医药机构费用结算对总账 func Gdyb3201( org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
1010 1009
 func FJyb3201(baseParams models.BaseParams, businessParams models.BusinessParams, med string, fund string) (string, string, string) {
1011 1010
 
1012 1011
 	fmt.Println(baseParams)
@@ -1063,8 +1062,8 @@ func FJyb3201(baseParams models.BaseParams, businessParams models.BusinessParams
1063 1062
 
1064 1063
 }
1065 1064
 
1066
-//文件上传
1067
-//文件上传
1065
+// 文件上传
1066
+// 文件上传
1068 1067
 func FJyb9101(baseParams models.BaseParams, file_name string, file_byte []byte) string {
1069 1068
 
1070 1069
 	// 生成签名
@@ -1869,7 +1868,6 @@ func Fjyb4101(struct4101 Struct4101, params models.PublicParams) (string, string
1869 1868
 	inputData["age"] = struct4101.Age                       // 年龄  必填
1870 1869
 	inputData["ntly"] = struct4101.Ntly                     // 国籍  必填
1871 1870
 
1872
-
1873 1871
 	inputData["nwb_age"] = ""                                 // 年龄  必填
1874 1872
 	inputData["naty"] = struct4101.Naty                       // 民族  必填
1875 1873
 	inputData["patn_cert_type"] = struct4101.PatnCertType     // 患者证件类别  必填
@@ -1880,10 +1878,10 @@ func Fjyb4101(struct4101 Struct4101, params models.PublicParams) (string, string
1880 1878
 	inputData["emp_addr"] = ""                                // 单位地址  必填
1881 1879
 	inputData["emp_tel"] = ""                                 // 单位电话  必填
1882 1880
 	inputData["poscode"] = ""                                 // 邮编  必填
1883
-	inputData["coner_name"] = ""           // 联系人姓名  必填
1884
-	inputData["patn_rlts"] = ""              // 与患者关系  必填
1885
-	inputData["coner_addr"] = ""            // 联系人地址  必填
1886
-	inputData["coner_tel"] = ""              // 联系人电话  必填
1881
+	inputData["coner_name"] = ""                              // 联系人姓名  必填
1882
+	inputData["patn_rlts"] = ""                               // 与患者关系  必填
1883
+	inputData["coner_addr"] = ""                              // 联系人地址  必填
1884
+	inputData["coner_tel"] = ""                               // 联系人电话  必填
1887 1885
 	inputData["hi_type"] = struct4101.HiType                  // 医保类型  必填
1888 1886
 	inputData["insuplc"] = struct4101.Insuplc                 // 参保地  必填
1889 1887
 	inputData["sp_psn_type"] = ""                             // 特殊人员类型  必填
@@ -2019,7 +2017,7 @@ func Fjyb4101(struct4101 Struct4101, params models.PublicParams) (string, string
2019 2017
 	return output, requestLog, err_msg
2020 2018
 }
2021 2019
 
2022
-func Fjyb4102(psn_no string,SetlId string, params models.PublicParams,stas_type string) (string, string, string) {
2020
+func Fjyb4102(psn_no string, SetlId string, params models.PublicParams, stas_type string) (string, string, string) {
2023 2021
 	timestamp := time.Now().Unix()
2024 2022
 	inputMessage := SetHnInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
2025 2023
 	// 生成输入报文
@@ -2029,10 +2027,9 @@ func Fjyb4102(psn_no string,SetlId string, params models.PublicParams,stas_type
2029 2027
 	inputData := make(map[string]interface{})
2030 2028
 	inputMessage["infno"] = "4102" // 交易编码
2031 2029
 
2032
-
2033
-	inputData["setl_id"] = SetlId   // 结算 ID  必填
2034
-	inputData["psn_no"] = psn_no     // 结算 ID  必填
2035
-	inputData["stas_type"] = stas_type     // 结算 ID  必填
2030
+	inputData["setl_id"] = SetlId      // 结算 ID  必填
2031
+	inputData["psn_no"] = psn_no       // 结算 ID  必填
2032
+	inputData["stas_type"] = stas_type // 结算 ID  必填
2036 2033
 	input2["stastinfo"] = inputData
2037 2034
 	input["data"] = input2
2038 2035
 	inputMessage["input"] = input //交易输入
@@ -2050,7 +2047,6 @@ func Fjyb4102(psn_no string,SetlId string, params models.PublicParams,stas_type
2050 2047
 	return output, requestLog, err_msg
2051 2048
 }
2052 2049
 
2053
-
2054 2050
 //
2055 2051
 //func Hbyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
2056 2052
 //	// 生成签名
@@ -2428,7 +2424,7 @@ func FJyb2601(psnNo string, omsgid string, oinfno string, org_name string, docto
2428 2424
 	return str
2429 2425
 }
2430 2426
 
2431
-//人员信息版本3
2427
+// 人员信息版本3
2432 2428
 func FJyb1101B(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates int64) string {
2433 2429
 	//生成签名
2434 2430
 	nonce := GetRandomString(32)
@@ -2510,7 +2506,7 @@ func FJyb1101B(certNo string, org_name string, doctor string, fixmedins_code str
2510 2506
 	return str
2511 2507
 }
2512 2508
 
2513
-//人员信息版本4
2509
+// 人员信息版本4
2514 2510
 func FJyb1101C(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates int64) (string, string) {
2515 2511
 	//生成签名
2516 2512
 	nonce := GetRandomString(32)
@@ -3022,3 +3018,249 @@ func ReadEleCardForSettle(code string, user_name string, id int64) (string, stri
3022 3018
 //	err := readDb.Model(&models.HisPsn{}).Where("patient_id = ? AND insuplc_admdvs <> ''",patient_id).Last(&psn).Error
3023 3019
 //	return
3024 3020
 //}
3021
+
3022
+func FJyb3501(struct3501 models.Struct3501) (string, string, string) {
3023
+	timestamp := time.Now().Unix()
3024
+	// 生成输入报文
3025
+	inputMessage := SetJSInputMessage(timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsHilistId, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Cainfo)
3026
+	input := make(map[string]interface{})
3027
+	inputData := make(map[string]interface{})
3028
+	druginputData := make(map[string]interface{})
3029
+	druginputData2 := make(map[string]interface{})
3030
+
3031
+	inputMessage["infno"] = "3501"                                  // 交易编码
3032
+	inputData["med_list_codg"] = struct3501.MedListCodg             // 定点医药机构目录编号
3033
+	inputData["fixmedins_hilist_id"] = struct3501.FixmedinsHilistId // 定点医药机构目录编号
3034
+	inputData["fixmedins_hilist_name"] = struct3501.OrgName         // 定点医药机构目录名称
3035
+	inputData["rx_flag"] = struct3501.RxFlag                        //
3036
+	inputData["invdate"] = struct3501.Invdate                       // 人员编号 (来自1101接口返回)
3037
+	inputData["inv_cnt"] = struct3501.InvCnt                        // 人员编号 (来自1101接口返回)
3038
+	inputData["manu_lotnum"] = struct3501.ManuLotnum                // 人员编号 (来自1101接口返回)
3039
+	inputData["fixmedins_bchno"] = struct3501.FixmedinsBchno        // 人员编号 (来自1101接口返回)
3040
+	inputData["manu_date"] = struct3501.ManuDate                    // 人员编号 (来自1101接口返回)
3041
+	inputData["expy_end"] = struct3501.ExpyEnd                      // 人员编号 (来自1101接口返回)
3042
+	inputData["memo"] = ""                                          // 人员编号 (来自1101接口返回)
3043
+	druginputData["drug_trac_codg"] = ""
3044
+	druginputData2["drugtracinfo"] = druginputData
3045
+	inputData["drug_trac_info"] = druginputData2
3046
+	input["invinfo"] = inputData
3047
+	inputMessage["input"] = input //交易输入
3048
+	bytesData, err := json.Marshal(inputMessage)
3049
+	var requestLog string
3050
+	//bytesData, err := json.Marshal(inputMessage)
3051
+	requestLog = string(bytesData)
3052
+	fmt.Println(string(bytesData))
3053
+	if err != nil {
3054
+		fmt.Println(err.Error())
3055
+		return err.Error(), "", ""
3056
+	}
3057
+
3058
+	enc := mahonia.NewEncoder("gbk")
3059
+	output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
3060
+
3061
+	return output, requestLog, err_msg
3062
+}
3063
+func FJyb3502(struct3502 models.Struct3502) (string, string, string) {
3064
+	timestamp := time.Now().Unix()
3065
+	// 生成输入报文
3066
+	inputMessage := SetJSInputMessage(timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsCode, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, struct3502.Cainfo)
3067
+	input := make(map[string]interface{})
3068
+	inputData := make(map[string]interface{})
3069
+	druginputData := make(map[string]interface{})
3070
+	druginputData2 := make(map[string]interface{})
3071
+
3072
+	inputMessage["infno"] = "3502"                      // 交易编码
3073
+	inputData["med_list_codg"] = struct3502.MedListCodg // 定点医药机构目录编号
3074
+	inputData["inv_chg_type"] = struct3502.InvChgType   // 定点医药机构目录编号
3075
+
3076
+	inputData["fixmedins_hilist_id"] = struct3502.FixmedinsCode // 定点医药机构目录编号
3077
+	inputData["fixmedins_hilist_name"] = struct3502.OrgName     // 定点医药机构目录名称
3078
+	inputData["fixmedins_bchno"] = struct3502.FixmedinsBchno    // 人员编号 (来自1101接口返回)
3079
+	inputData["pric"] = struct3502.Pric                         // 人员编号 (来自1101接口返回)
3080
+	inputData["cnt"] = struct3502.Cnt                           // 人员编号 (来自1101接口返回)
3081
+	inputData["rx_flag"] = struct3502.RxFlag                    //
3082
+
3083
+	inputData["inv_chg_time"] = struct3502.InvChgTime // 人员编号 (来自1101接口返回)
3084
+	inputData["inv_chg_opter_name"] = ""              // 人员编号 (来自1101接口返回)
3085
+	inputData["memo"] = struct3502.Memo               // 人员编号 (来自1101接口返回)
3086
+	inputData["trdn_flag"] = ""                       // 人员编号 (来自1101接口返回)
3087
+
3088
+	druginputData["drug_trac_codg"] = ""
3089
+	druginputData2["drugtracinfo"] = druginputData
3090
+	inputData["drug_trac_info"] = druginputData2
3091
+
3092
+	input["invinfo"] = inputData
3093
+	inputMessage["input"] = input //交易输入
3094
+
3095
+	bytesData, err := json.Marshal(inputMessage)
3096
+	var requestLog string
3097
+	//bytesData, err := json.Marshal(inputMessage)
3098
+	requestLog = string(bytesData)
3099
+	fmt.Println(string(bytesData))
3100
+	if err != nil {
3101
+		fmt.Println(err.Error())
3102
+		return err.Error(), "", ""
3103
+	}
3104
+
3105
+	enc := mahonia.NewEncoder("gbk")
3106
+	output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
3107
+	return output, requestLog, err_msg
3108
+
3109
+}
3110
+func FJyb3505(struct3505 models.Struct3505) (string, string, string) {
3111
+	timestamp := time.Now().Unix()
3112
+	// 生成输入报文
3113
+	inputMessage := SetJSInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
3114
+	input := make(map[string]interface{})
3115
+	inputData := make(map[string]interface{})
3116
+	druginputData := make(map[string]interface{})
3117
+	druginputData2 := make(map[string]interface{})
3118
+
3119
+	inputMessage["infno"] = "3505"                                  // 交易编码
3120
+	inputData["med_list_codg"] = struct3505.MedListCodg             // 定点医药机构目录编号
3121
+	inputData["fixmedins_hilist_id"] = struct3505.FixmedinsHilistId // 定点医药机构目录编号
3122
+	inputData["fixmedins_hilist_name"] = struct3505.OrgName         // 定点医药机构目录名称
3123
+	inputData["fixmedins_bchno"] = struct3505.FixmedinsBchno        // 人员编号 (来自1101接口返回)
3124
+
3125
+	inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
3126
+	inputData["prsc_dr_certno"] = struct3505.PrscDrCertno      // 人员编号 (来自1101接口返回)
3127
+	inputData["prsc_dr_name"] = struct3505.PrscDrName          // 人员编号 (来自1101接口返回)
3128
+	inputData["phar_cert_type"] = struct3505.PharCertType      // 人员编号 (来自1101接口返回)
3129
+	inputData["phar_certno"] = struct3505.PharCertno           // 人员编号 (来自1101接口返回)
3130
+
3131
+	inputData["phar_name"] = struct3505.PharName               // 人员编号 (来自1101接口返回)
3132
+	inputData["phar_prac_cert_no"] = struct3505.PharPracCertNo // 人员编号 (来自1101接口返回)
3133
+	//inputData["hi_feesetl_type"] = struct3505.HiFeesetlType    // 人员编号 (来自1101接口返回)
3134
+	inputData["setl_id"] = struct3505.SetlId            // 人员编号 (来自1101接口返回)
3135
+	inputData["mdtrt_sn"] = struct3505.MdtrtSn          // 人员编号 (来自1101接口返回)
3136
+	inputData["psn_no"] = struct3505.PsnNo              // 人员编号 (来自1101接口返回)
3137
+	inputData["psn_cert_type"] = struct3505.PsnCertType // 人员编号 (来自1101接口返回)
3138
+	inputData["certno"] = struct3505.CertNo             // 人员编号 (来自1101接口返回)
3139
+	inputData["psn_name"] = struct3505.PsnName          // 人员编号 (来自1101接口返回)
3140
+	inputData["manu_lotnum"] = struct3505.ManuLotnum    // 人员编号 (来自1101接口返回)
3141
+	inputData["manu_date"] = struct3505.ManuDate        // 人员编号 (来自1101接口返回)
3142
+	inputData["expy_end"] = struct3505.ExpyEnd          // 人员编号 (来自1101接口返回)
3143
+
3144
+	inputData["rx_flag"] = struct3505.RxFlag     // 人员编号 (来自1101接口返回)
3145
+	inputData["trdn_flag"] = struct3505.TrdnFlag // 人员编号 (来自1101接口返回)
3146
+
3147
+	inputData["finl_trns_pric"] = struct3505.FinlTrnsPric // 人员编号 (来自1101接口返回)
3148
+	inputData["rxno"] = struct3505.Rxno                   // 人员编号 (来自1101接口返回)
3149
+	inputData["rx_circ_flag"] = struct3505.RxCircFlag     // 人员编号 (来自1101接口返回)
3150
+
3151
+	inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
3152
+	inputData["stoout_no"] = struct3505.StooutNo   // 人员编号 (来自1101接口返回)
3153
+
3154
+	inputData["bchno"] = struct3505.Bchno // 人员编号 (来自1101接口返回)
3155
+	//inputData["drug_trac_codg"] = struct3505.DrugTracCodg          // 人员编号 (来自1101接口返回)
3156
+	inputData["drug_prod_barc"] = struct3505.DrugProdBarc          // 人员编号 (来自1101接口返回)
3157
+	inputData["shelf_posi"] = struct3505.ShelfPosi                 // 人员编号 (来自1101接口返回)
3158
+	inputData["sel_retn_cnt"] = struct3505.SelRetnCnt              // 人员编号 (来自1101接口返回)
3159
+	inputData["sel_retn_time"] = struct3505.SelRetnTime            // 人员编号 (来自1101接口返回)
3160
+	inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
3161
+	inputData["memo"] = struct3505.Memo                            // 人员编号 (来自1101接口返回)
3162
+	druginputData["drug_trac_codg"] = ""
3163
+	druginputData2["drugtracinfo"] = druginputData
3164
+	inputData["drug_trac_info"] = druginputData2
3165
+
3166
+	input["selinfo"] = inputData
3167
+	inputMessage["input"] = input //交易输入
3168
+
3169
+	bytesData, err := json.Marshal(inputMessage)
3170
+	var requestLog string
3171
+	//bytesData, err := json.Marshal(inputMessage)
3172
+	requestLog = string(bytesData)
3173
+	fmt.Println(string(bytesData))
3174
+	if err != nil {
3175
+		fmt.Println(err.Error())
3176
+		return err.Error(), "", ""
3177
+	}
3178
+
3179
+	enc := mahonia.NewEncoder("gbk")
3180
+	output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
3181
+	return output, requestLog, err_msg
3182
+
3183
+}
3184
+func FJyb3506(struct3506 models.Struct3506) (string, string, string) {
3185
+	timestamp := time.Now().Unix()
3186
+	// 生成输入报文
3187
+	inputMessage := SetJSInputMessage(timestamp, struct3506.OrgName, struct3506.Opter, struct3506.FixmedinsCode, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs, struct3506.Cainfo)
3188
+	input := make(map[string]interface{})
3189
+	inputData := make(map[string]interface{})
3190
+	druginputData := make(map[string]interface{})
3191
+	druginputData2 := make(map[string]interface{})
3192
+
3193
+	inputMessage["infno"] = "3506"                                  // 交易编码
3194
+	inputData["med_list_codg"] = struct3506.MedListCodg             // 定点医药机构目录编号
3195
+	inputData["fixmedins_hilist_id"] = struct3506.FixmedinsHilistId // 定点医药机构目录编号
3196
+	inputData["fixmedins_hilist_name"] = struct3506.OrgName         // 定点医药机构目录名称
3197
+	inputData["fixmedins_bchno"] = struct3506.FixmedinsBchno        // 人员编号 (来自1101接口返回)
3198
+
3199
+	inputData["setl_id"] = struct3506.SetlId                       // 人员编号 (来自1101接口返回)
3200
+	inputData["psn_no"] = struct3506.PsnNo                         // 人员编号 (来自1101接口返回)
3201
+	inputData["psn_cert_type"] = struct3506.PsnCertType            // 人员编号 (来自1101接口返回)
3202
+	inputData["certno"] = struct3506.Certno                        // 人员编号 (来自1101接口返回)
3203
+	inputData["psn_name"] = struct3506.PsnName                     // 人员编号 (来自1101接口返回)
3204
+	inputData["manu_lotnum"] = struct3506.ManuLotnum               // 人员编号 (来自1101接口返回)
3205
+	inputData["manu_date"] = struct3506.ManuDate                   // 人员编号 (来自1101接口返回)
3206
+	inputData["expy_end"] = struct3506.ExpyEnd                     // 人员编号 (来自1101接口返回)
3207
+	inputData["rx_flag"] = struct3506.RxFlag                       // 人员编号 (来自1101接口返回)
3208
+	inputData["trdn_flag"] = struct3506.TrdnFlag                   // 人员编号 (来自1101接口返回)
3209
+	inputData["finl_trns_pric"] = struct3506.FinlTrnsPric          // 人员编号 (来自1101接口返回)
3210
+	inputData["sel_retn_cnt"] = struct3506.SelRetnCnt              // 人员编号 (来自1101接口返回)
3211
+	inputData["sel_retn_time"] = struct3506.SelRetnTime            // 人员编号 (来自1101接口返回)
3212
+	inputData["sel_retn_opter_name"] = struct3506.SelRetnOpterName // 人员编号 (来自1101接口返回)
3213
+	inputData["memo"] = ""                                         // 人员编号 (来自1101接口返回)
3214
+	inputData["medins_prod_sel_no"] = ""                           // 人员编号 (来自1101接口返回)
3215
+	inputData["mdtrt_sn"] = ""                                     // 人员编号 (来自1101接口返回)
3216
+
3217
+	druginputData["drug_trac_codg"] = ""
3218
+	druginputData2["drugtracinfo"] = druginputData
3219
+	inputData["drug_trac_info"] = druginputData2
3220
+
3221
+	input["selinfo"] = inputData
3222
+	inputMessage["input"] = input //交易输入
3223
+
3224
+	bytesData, err := json.Marshal(inputMessage)
3225
+	var requestLog string
3226
+	//bytesData, err := json.Marshal(inputMessage)
3227
+	requestLog = string(bytesData)
3228
+	fmt.Println(string(bytesData))
3229
+	if err != nil {
3230
+		fmt.Println(err.Error())
3231
+		return err.Error(), "", ""
3232
+	}
3233
+
3234
+	enc := mahonia.NewEncoder("gbk")
3235
+	output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
3236
+	return output, requestLog, err_msg
3237
+
3238
+}
3239
+func FJyb3507(struct3507 models.Struct3507) (string, string, string) {
3240
+	timestamp := time.Now().Unix()
3241
+	// 生成输入报文
3242
+	inputMessage := SetJSInputMessage(timestamp, struct3507.OrgName, struct3507.Opter, struct3507.FixmedinsCode, struct3507.InsuplcAdmdvs, struct3507.MdtrtareaAdmvs, struct3507.Cainfo)
3243
+	input := make(map[string]interface{})
3244
+	inputData := make(map[string]interface{})
3245
+	inputMessage["infno"] = "3507"                          // 交易编码
3246
+	inputData["fixmedins_bchno"] = struct3507.FixmedinsCode // 人员编号 (来自1101接口返回)
3247
+	inputData["inv_data_type"] = struct3507.InvDataType     // 人员编号 (来自1101接口返回)
3248
+
3249
+	input["data"] = inputData
3250
+	inputMessage["input"] = input //交易输入
3251
+
3252
+	bytesData, err := json.Marshal(inputMessage)
3253
+	var requestLog string
3254
+	//bytesData, err := json.Marshal(inputMessage)
3255
+	requestLog = string(bytesData)
3256
+	fmt.Println(string(bytesData))
3257
+	if err != nil {
3258
+		fmt.Println(err.Error())
3259
+		return err.Error(), "", ""
3260
+	}
3261
+
3262
+	enc := mahonia.NewEncoder("gbk")
3263
+	output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
3264
+	return output, requestLog, err_msg
3265
+
3266
+}

+ 22 - 0
service/his_service.go Dosyayı Görüntüle

@@ -1702,3 +1702,25 @@ func GetAllHisOrderTwo10485() (his []*models.HisOrder, err error) {
1702 1702
 	fmt.Println(err)
1703 1703
 	return
1704 1704
 }
1705
+
1706
+func GetNewDrugWarehouseInfo(id_arr []string) (newDrugWarehouse []*models.NewDrugWarehouseInfo, err error) {
1707
+	readDb.Model(&models.NewDrugWarehouseInfo{}).Where("org_id = ? and status = 1 and id in (?) ", 10191, id_arr).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", 10191).Preload("Dealers", "status = 1 AND org_id = ?", 10191).Find(&newDrugWarehouse)
1708
+	return
1709
+}
1710
+
1711
+func GetNewDrugFlowInfo(id_arr []string) (flows []*models.DrugFlow, err error) {
1712
+	err = readDb.Model(&models.DrugFlow{}).Where("org_id = ? and status = 1 and id in (?)", 10191, id_arr).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1713
+		return db.Where("status = 1").Preload("BaseDrugLib", "status=1")
1714
+	}).Find(&flows).Error
1715
+	return
1716
+}
1717
+
1718
+func GetHisPrescriptionByID(id int64) (pre models.HisPrescription) {
1719
+	err = readDb.Model(&models.HisPrescription{}).Where("id = ? and status = 1", id).Find(&pre).Error
1720
+	return
1721
+}
1722
+
1723
+func GetHisOrderByNumber(number string) (order models.HisOrder) {
1724
+	err = readDb.Model(&models.HisOrder{}).Where("number = ? and status = 1", number).First(&order).Error
1725
+	return
1726
+}