Parcourir la source

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

csx il y a 2 ans
Parent
révision
657c84617f

+ 5 - 5
conf/app.conf Voir le fichier

@@ -45,7 +45,7 @@ appsecret="61ee2e6268497d5aa9de0b0187c39aea"
45 45
 
46 46
 
47 47
 [prod]
48
-org_id = 10106
48
+org_id = 10138
49 49
 mobile_token_expiration_second = 86400
50 50
 httpdomain = https://api.xt.kuyicloud.com
51 51
 sso_domain = https://sso.kuyicloud.com
@@ -53,14 +53,14 @@ call_domain = https://hf.sgjyun.com
53 53
 front_end_domain = "https://xt.kuyicloud.com/#"
54 54
 #url  = "http://192.168.1.228:17001/szsi-portal/transData"
55 55
 #url = "http://192.168.1.88:6666/szsi-portal/transData"
56
-gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
57
-# gdyb_url="http://igb.hsa.gdgov.cn/ebus/sz_prd/hsa/hgs/"
56
+# gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
57
+gdyb_url="http://igb.hsa.gdgov.cn/ebus/sz_prd/hsa/hgs/"
58 58
 #内蒙古
59 59
 # gdyb_url = "http://10.38.23.105:8090/uif-hsaf-med-api/api/medical/service/"
60 60
 # gdyb_paasid = "sg03_prd"
61
-gdyb_paasid = "jm_sc_yjyy"
61
+# gdyb_paasid = "jm_sc_yjyy"
62 62
 # gdyb_paasid="zh_prd_yrojyy"
63
-# gdyb_paasid = "sz_prd_yjyy"
63
+gdyb_paasid = "sz_prd_yjyy"
64 64
 # gdyb_paasid = "zq_prd_yjyy"
65 65
 
66 66
 

+ 125 - 28
controllers/js/jsyb_controller.go Voir le fichier

@@ -608,6 +608,24 @@ func (c *JSybController) Get3201() {
608 608
 	})
609 609
 }
610 610
 
611
+type ELeData struct {
612
+	Data struct {
613
+		Extra       string `json:"extra"`
614
+		IDNo        string `json:"idNo"`
615
+		IDType      string `json:"idType"`
616
+		EcToken     string `json:"ecToken"`
617
+		InsuOrg     string `json:"insuOrg"`
618
+		UserName    string `json:"userName"`
619
+		EcIndexNo   string `json:"ecIndexNo"`
620
+		Gender      string `json:"gender"`
621
+		Birthday    string `json:"birthday"`
622
+		Nationality string `json:"nationality"`
623
+		Email       string `json:"email"`
624
+	} `json:"data"`
625
+	Code    int    `json:"code"`
626
+	Message string `json:"message"`
627
+}
628
+
611 629
 func (c *JSybController) ReadCard() {
612 630
 	fixmedins_code := c.GetString("fixmedins_code")
613 631
 	secret_key := c.GetString("secret_key")
@@ -618,42 +636,85 @@ func (c *JSybController) ReadCard() {
618 636
 	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
619 637
 	url := c.GetString("url")
620 638
 	cainfo := c.GetString("cainfo")
639
+	id_card_type, _ := c.GetInt64("id_card_type")
640
+	operator_id := c.GetString("operator_id")
641
+	operator := c.GetString("operator")
621 642
 
622 643
 	//result, request := service.Jsyb9001(org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, 1, url, cainfo, ak)
623 644
 	//fmt.Println(request)
624 645
 	//fmt.Println(result)
625 646
 
626 647
 	c.TestGetBasBaseInit(fixmedins_code, secret_key, ak)
627
-	pCardInfo, pBusiCardInfo := c.GetBasBaseInfo()
628
-	pBusiCardInfo = Remove0000(pBusiCardInfo)
629
-	pCardInfo = Remove0000(pCardInfo)
630
-	fmt.Println(":", ConvertToString(pCardInfo, "gbk", "utf-8"))
631
-
632
-	fmt.Println(pBusiCardInfo)
633
-	fmt.Println(pCardInfo)
634
-	bas := strings.Split(pCardInfo, "|")
635
-	basNumber := bas[2]
636
-	id_card_no := bas[1]
637
-	card_sn := bas[3]
638
-
639
-	if len(pCardInfo) > 0 && len(pBusiCardInfo) > 0 {
640
-		result, _ := service.Jsyb1101A(basNumber, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, 1, card_sn, "1", url, ak, pBusiCardInfo, id_card_no, cainfo)
641
-		var dat map[string]interface{}
642
-		if err := json.Unmarshal([]byte(result), &dat); err == nil {
643
-			fmt.Println(dat)
648
+
649
+	switch id_card_type {
650
+	case 1:
651
+		pCardInfo, pBusiCardInfo := c.GetBasBaseInfo()
652
+		pBusiCardInfo = Remove0000(pBusiCardInfo)
653
+		pCardInfo = Remove0000(pCardInfo)
654
+		fmt.Println(":", ConvertToString(pCardInfo, "gbk", "utf-8"))
655
+
656
+		fmt.Println(pBusiCardInfo)
657
+		fmt.Println(pCardInfo)
658
+		bas := strings.Split(pCardInfo, "|")
659
+		basNumber := bas[2]
660
+		id_card_no := bas[1]
661
+		card_sn := bas[3]
662
+
663
+		if len(pCardInfo) > 0 && len(pBusiCardInfo) > 0 {
664
+			result, _ := service.Jsyb1101A(basNumber, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, card_sn, "1", url, ak, pBusiCardInfo, id_card_no, cainfo)
665
+			var dat map[string]interface{}
666
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
667
+				fmt.Println(dat)
668
+			} else {
669
+				fmt.Println(err)
670
+			}
671
+			c.ServeSuccessJSON(map[string]interface{}{
672
+				"status":         "0",
673
+				"card_info":      pCardInfo,
674
+				"busi_card_info": pBusiCardInfo,
675
+				"result":         dat,
676
+				"type":           "1",
677
+			})
644 678
 		} else {
645
-			fmt.Println(err)
679
+			c.ServeSuccessJSON(map[string]interface{}{
680
+				"status": "-1",
681
+			})
682
+
646 683
 		}
647
-		c.ServeSuccessJSON(map[string]interface{}{
648
-			"status":         "0",
649
-			"card_info":      pCardInfo,
650
-			"busi_card_info": pBusiCardInfo,
651
-			"result":         dat,
652
-		})
653
-	} else {
654
-		c.ServeSuccessJSON(map[string]interface{}{
655
-			"status": "-1",
656
-		})
684
+		break
685
+	case 3: //电子凭证
686
+		pCardInfo, pBusiCardInfo := c.GetELeInfo(fixmedins_code, operator_id, operator)
687
+		fmt.Println(pCardInfo)
688
+		fmt.Println(pBusiCardInfo)
689
+		var ele ELeData
690
+		err := json.Unmarshal([]byte(pBusiCardInfo), &ele)
691
+		if err != nil {
692
+			utils.ErrorLog("解析失败:%v", err)
693
+		}
694
+		token := ele.Data.EcToken
695
+		if len(token) > 0 {
696
+			result, _ := service.Jsyb1101B(org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, url, ak, token, cainfo)
697
+			var dat map[string]interface{}
698
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
699
+				fmt.Println(dat)
700
+			} else {
701
+				fmt.Println(err)
702
+			}
703
+			c.ServeSuccessJSON(map[string]interface{}{
704
+				"status":         "0",
705
+				"card_info":      pCardInfo,
706
+				"busi_card_info": pBusiCardInfo,
707
+				"token":          token,
708
+				"result":         dat,
709
+				"type":           "2",
710
+			})
711
+		} else {
712
+			c.ServeSuccessJSON(map[string]interface{}{
713
+				"status": "-1",
714
+			})
715
+
716
+		}
717
+		break
657 718
 
658 719
 	}
659 720
 
@@ -718,6 +779,42 @@ func (c *JSybController) GetBasBaseInfo() (string, string) {
718 779
 	return DeleteExtraSpace(string(pCardInfo)), DeleteExtraSpace(string(pBusiCardInfo))
719 780
 }
720 781
 
782
+func (c *JSybController) GetELeInfo(code string, operator_id string, operator_name string) (string, string) {
783
+	DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
784
+	readCard := DllDef.MustFindProc("EcQuery")
785
+	fmt.Println(readCard)
786
+	fmt.Println("!!!!!")
787
+	//pCardInfo := make([]byte, 8192)
788
+	pBusiCardInfo := make([]byte, 8192)
789
+
790
+	data := make(map[string]interface{})
791
+
792
+	inputData := make(map[string]interface{})
793
+	inputData["orgId"] = code
794
+	inputData["businessType"] = "01101"
795
+	inputData["operatorId"] = operator_id
796
+	inputData["operatorName"] = operator_name
797
+	inputData["officeId"] = "001"
798
+	inputData["officeName"] = "血透室"
799
+
800
+	data["data"] = inputData
801
+	data["transType"] = "ec.query"
802
+	data["orgId"] = code
803
+
804
+	bytesData, _ := json.Marshal(data)
805
+
806
+	ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&bytesData[0])), (uintptr)(unsafe.Pointer(&pBusiCardInfo[0])))
807
+	fmt.Println(ret2)
808
+	fmt.Println(DeleteExtraSpace(string(bytesData)))
809
+	fmt.Println(DeleteExtraSpace(string(pBusiCardInfo)))
810
+	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(bytesData)), "gbk", "utf-8"))
811
+	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pBusiCardInfo)), "gbk", "utf-8"))
812
+	if ret2 != 0 {
813
+		return "", ""
814
+	}
815
+	return DeleteExtraSpace(string(bytesData)), DeleteExtraSpace(string(pBusiCardInfo))
816
+}
817
+
721 818
 func IntPtr(n int) uintptr {
722 819
 	return uintptr(n)
723 820
 }

+ 109 - 50
controllers/sg/his_api_controller.go Voir le fichier

@@ -395,11 +395,11 @@ func (c *HisApiController) ReadCard() {
395 395
 			var api string
396 396
 			if miConfig.MdtrtareaAdmvs == "320921" {
397 397
 				api = "http://192.168.3.111:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
398
-					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo
398
+					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "operator_id=" + strconv.FormatInt(admin_user_id, 10) + "operator=" + roles.UserName
399 399
 
400 400
 			} else {
401 401
 				api = "http://192.168.5.251:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
402
-					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo
402
+					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&id_card_type=" + strconv.FormatInt(id_card_type, 10)
403 403
 			}
404 404
 
405 405
 			resp, requestErr := http.Get(api)
@@ -422,32 +422,59 @@ func (c *HisApiController) ReadCard() {
422 422
 			}
423 423
 			var status string
424 424
 			status = respJSON["data"].(map[string]interface{})["status"].(string)
425
+			card_type := respJSON["data"].(map[string]interface{})["type"].(string)
426
+
427
+			var token string
428
+			var res ResultTwo           //1101结果
429
+			var res10265 ResultTwo10265 //1101结果
430
+			var card_info string        //卡信息
431
+			var busi_card_info string
432
+
433
+			card_info = respJSON["data"].(map[string]interface{})["card_info"].(string)
434
+			busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
425 435
 
426 436
 			if status == "0" { //读卡成功
427
-				var card_info string //卡信息
428
-				var busi_card_info string
429
-				var res ResultTwo           //1101结果
430
-				var res10265 ResultTwo10265 //1101结果
437
+				if card_type == "1" {
431 438
 
432
-				card_info = respJSON["data"].(map[string]interface{})["card_info"].(string)
433
-				busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
439
+					respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
440
+					result, _ := json.Marshal(respJSON)
434 441
 
435
-				fmt.Println(card_info)
436
-				fmt.Println(busi_card_info)
442
+					if err := json.Unmarshal([]byte(result), &res10265); err != nil {
443
+						utils.ErrorLog("解析失败:%v", err)
444
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
445
+						return
446
+					}
447
+					res.ErrMsg = res10265.ErrMsg
448
+					infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
449
+					res.Infcode = infocode
450
+					res.Output = res10265.Output
451
+					res.InfRefmsgid = res10265.InfRefmsgid
437 452
 
438
-				respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
439
-				result, _ := json.Marshal(respJSON)
453
+				} else {
454
+					//var card_info string //卡信息
455
+					//var busi_card_info string
456
+
457
+					token = respJSON["data"].(map[string]interface{})["token"].(string)
458
+					//busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
459
+
460
+					//fmt.Println(card_info)
461
+					//fmt.Println(busi_card_info)
462
+
463
+					respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
464
+					result, _ := json.Marshal(respJSON)
465
+
466
+					if err := json.Unmarshal([]byte(result), &res10265); err != nil {
467
+						utils.ErrorLog("解析失败:%v", err)
468
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
469
+						return
470
+					}
471
+					res.ErrMsg = res10265.ErrMsg
472
+					infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
473
+					res.Infcode = infocode
474
+					res.Output = res10265.Output
475
+					res.InfRefmsgid = res10265.InfRefmsgid
440 476
 
441
-				if err := json.Unmarshal([]byte(result), &res10265); err != nil {
442
-					utils.ErrorLog("解析失败:%v", err)
443
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
444
-					return
445 477
 				}
446
-				res.ErrMsg = res10265.ErrMsg
447
-				infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
448
-				res.Infcode = infocode
449
-				res.Output = res10265.Output
450
-				res.InfRefmsgid = res10265.InfRefmsgid
451 478
 
452 479
 				if res.Infcode == 0 {
453 480
 					patient, err := service.GetPatientByIDCard(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
@@ -460,34 +487,61 @@ func (c *HisApiController) ReadCard() {
460 487
 
461 488
 					} else {
462 489
 
463
-						bas := strings.Split(card_info, "|")
464
-						basNumber := bas[2]
465
-
466
-						Iinfos, _ := json.Marshal(res.Output.Iinfo)
467
-						Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
468
-						infoStr := string(Iinfos)
469
-						idetinfoStr := string(Idetinfos)
470
-						psn := &models.HisPsn{
471
-							PsnNo:        res.Output.Baseinfo.PsnNo,
472
-							Age:          res.Output.Baseinfo.Age,
473
-							PatientId:    patient.ID,
474
-							Certno:       res.Output.Baseinfo.Certno,
475
-							Brdy:         res.Output.Baseinfo.Brdy,
476
-							Gend:         res.Output.Baseinfo.Gend,
477
-							Naty:         res.Output.Baseinfo.Naty,
478
-							PsnCertType:  res.Output.Baseinfo.PsnCertType,
479
-							PsnName:      res.Output.Baseinfo.PsnName,
480
-							Idetinfo:     idetinfoStr,
481
-							Insuinfo:     infoStr,
482
-							UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
483
-							CardInfo:     card_info,
484
-							VerifyNumber: busi_card_info,
490
+						if card_type == "1" {
491
+							bas := strings.Split(card_info, "|")
492
+							basNumber := bas[2]
493
+							Iinfos, _ := json.Marshal(res.Output.Iinfo)
494
+							Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
495
+							infoStr := string(Iinfos)
496
+							idetinfoStr := string(Idetinfos)
497
+							psn := &models.HisPsn{
498
+								PsnNo:        res.Output.Baseinfo.PsnNo,
499
+								Age:          res.Output.Baseinfo.Age,
500
+								PatientId:    patient.ID,
501
+								Certno:       res.Output.Baseinfo.Certno,
502
+								Brdy:         res.Output.Baseinfo.Brdy,
503
+								Gend:         res.Output.Baseinfo.Gend,
504
+								Naty:         res.Output.Baseinfo.Naty,
505
+								PsnCertType:  res.Output.Baseinfo.PsnCertType,
506
+								PsnName:      res.Output.Baseinfo.PsnName,
507
+								Idetinfo:     idetinfoStr,
508
+								Insuinfo:     infoStr,
509
+								UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
510
+								CardInfo:     card_info,
511
+								VerifyNumber: busi_card_info,
512
+							}
513
+							service.CreateHisPsn(psn)
514
+							c.ServeSuccessJSON(map[string]interface{}{
515
+								"patient": patient,
516
+								"number":  basNumber,
517
+							})
518
+						} else {
519
+							Iinfos, _ := json.Marshal(res.Output.Iinfo)
520
+							Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
521
+							infoStr := string(Iinfos)
522
+							idetinfoStr := string(Idetinfos)
523
+							psn := &models.HisPsn{
524
+								PsnNo:        res.Output.Baseinfo.PsnNo,
525
+								Age:          res.Output.Baseinfo.Age,
526
+								PatientId:    patient.ID,
527
+								Certno:       res.Output.Baseinfo.Certno,
528
+								Brdy:         res.Output.Baseinfo.Brdy,
529
+								Gend:         res.Output.Baseinfo.Gend,
530
+								Naty:         res.Output.Baseinfo.Naty,
531
+								PsnCertType:  res.Output.Baseinfo.PsnCertType,
532
+								PsnName:      res.Output.Baseinfo.PsnName,
533
+								Idetinfo:     idetinfoStr,
534
+								Insuinfo:     infoStr,
535
+								UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
536
+								CardInfo:     card_info,
537
+								VerifyNumber: token,
538
+							}
539
+							service.CreateHisPsn(psn)
540
+							c.ServeSuccessJSON(map[string]interface{}{
541
+								"patient": patient,
542
+								"number":  token,
543
+							})
485 544
 						}
486
-						service.CreateHisPsn(psn)
487
-						c.ServeSuccessJSON(map[string]interface{}{
488
-							"patient": patient,
489
-							"number":  basNumber,
490
-						})
491 545
 					}
492 546
 				} else {
493 547
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
@@ -7934,6 +7988,7 @@ func (c *HisApiController) GetCheckAccount() {
7934 7988
 					PsnPay:    acct_pay,
7935 7989
 					Creator:   admin_user_id,
7936 7990
 					Ctime:     time.Now().Unix(),
7991
+					ClrType:   clr_type,
7937 7992
 				}
7938 7993
 				err := service.CreateMedicalInsuranceCostCompareRecord(micc)
7939 7994
 				if err == nil {
@@ -8296,7 +8351,7 @@ func (c *HisApiController) GetSettleAccounts() {
8296 8351
 	orderInfos, _ := service.GetHisOrderInfoByNumber(order.Number)
8297 8352
 	orderInfos_two, _ := service.GetHisOrderInfoByNumberTwo(order.Number)
8298 8353
 	orderInfos = append(orderInfos, orderInfos_two...)
8299
-	//his_hospital, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
8354
+	his_hospital, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
8300 8355
 
8301 8356
 	//diagnosisConfig, _ := service.FindDiagnoseById(his.Diagnosis)
8302 8357
 
@@ -8516,6 +8571,8 @@ func (c *HisApiController) GetSettleAccounts() {
8516 8571
 			res.Infcode = infocode
8517 8572
 
8518 8573
 		} else {
8574
+			//result2 := service.Gdyb1101()
8575
+
8519 8576
 			result2 := service.Gdyb5204(baseParams, businessParams)
8520 8577
 			saveLog(result2, "", "5204", "查询")
8521 8578
 			result := service.Gdyb5203(baseParams, businessParams)
@@ -8638,7 +8695,9 @@ func (c *HisApiController) GetSettleAccounts() {
8638 8695
 				"org_name":                                    miConfig.OrgName,
8639 8696
 				"org_code":                                    miConfig.Code,
8640 8697
 				"order_number":                                order.Number,
8641
-				//"his":                                         his_hospital,
8698
+				"his_hospital":                                his_hospital,
8699
+				"his":                                         his,
8700
+
8642 8701
 				//"check_order_info":                            cus_slice,
8643 8702
 			})
8644 8703
 		}

+ 1 - 0
models/his_models.go Voir le fichier

@@ -1048,6 +1048,7 @@ type MedicalInsuranceCostCompare struct {
1048 1048
 	PsnPay    float64 `gorm:"column:psn_pay" json:"psn_pay" form:"psn_pay"`
1049 1049
 	Creator   int64   `gorm:"column:creator" json:"creator" form:"creator"`
1050 1050
 	Ctime     int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
1051
+	ClrType   string  `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
1051 1052
 }
1052 1053
 
1053 1054
 func (MedicalInsuranceCostCompare) TableName() string {

+ 6 - 2
service/gdyb_service.go Voir le fichier

@@ -786,6 +786,7 @@ type Custom struct {
786 786
 	ProvinceDrugMedListCodg string
787 787
 	ProvinceGoodMedListCodg string
788 788
 	IsUser                  int64
789
+	FeeOcurTime             string
789 790
 }
790 791
 
791 792
 type RequestResult struct {
@@ -848,7 +849,7 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
848 849
 
849 850
 	for _, item := range hisPrescription {
850 851
 		role, _ := GetAdminUserInfoByID(item.UserOrgId, new_doctor_id)
851
-
852
+		tm := time.Unix(item.PreTime, 0)
852 853
 		if item.Type == 1 { //药品
853 854
 			for _, subItem := range item.HisDoctorAdviceInfo {
854 855
 				if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 && subItem.BaseDrugLib.IsUser != 1 {
@@ -864,6 +865,7 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
864 865
 						HospApprFlag:     subItem.HospApprFlag,
865 866
 						DoctorNumber:     role.DoctorNumber,
866 867
 						DoctorName:       role.UserName,
868
+						FeeOcurTime:      tm.Format("2006-01-02 15:04:05"),
867 869
 					}
868 870
 
869 871
 					customs = append(customs, cus)
@@ -887,6 +889,7 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
887 889
 							DoctorNumber:     role.DoctorNumber,
888 890
 							DoctorName:       role.UserName,
889 891
 							HospApprFlag:     -1,
892
+							FeeOcurTime:      tm.Format("2006-01-02 15:04:05"),
890 893
 						}
891 894
 						customs = append(customs, cus)
892 895
 					}
@@ -904,6 +907,7 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
904 907
 							HospApprFlag:     -1,
905 908
 							DoctorNumber:     role.DoctorNumber,
906 909
 							DoctorName:       role.UserName,
910
+							FeeOcurTime:      tm.Format("2006-01-02 15:04:05"),
907 911
 						}
908 912
 						customs = append(customs, cus)
909 913
 					}
@@ -947,7 +951,7 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
947 951
 		feedetailInfo["dise_codg"] = diag_code                       // 病种编码
948 952
 		feedetailInfo["rxno"] = ""                                   // 处方号
949 953
 		feedetailInfo["rx_circ_flag"] = "0"                          // 外购处方标志
950
-		feedetailInfo["fee_ocur_time"] = timeFormatOne               // 费用发生时间
954
+		feedetailInfo["fee_ocur_time"] = item.FeeOcurTime            // 费用发生时间
951 955
 		feedetailInfo["med_list_codg"] = item.MedListCodg            // 医疗目录编码
952 956
 		feedetailInfo["medins_list_codg"] = fixmedins_code           // 医药机构目录编码
953 957
 		feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额

+ 7 - 1
service/hbyb_service.go Voir le fichier

@@ -273,7 +273,10 @@ func Hbyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
273 273
 	var customs []*Custom
274 274
 
275 275
 	for _, item := range hisPrescription {
276
+		tm := time.Unix(item.PreTime, 0)
277
+
276 278
 		if item.Type == 1 { //药品
279
+
277 280
 			for _, subItem := range item.HisDoctorAdviceInfo {
278 281
 				if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 {
279 282
 					//var randNum int
@@ -285,6 +288,7 @@ func Hbyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
285 288
 						Price:            fmt.Sprintf("%.2f", subItem.Price),
286 289
 						MedListCodg:      subItem.BaseDrugLib.MedicalInsuranceNumber,
287 290
 						HospApprFlag:     subItem.BaseDrugLib.HospApprFlag,
291
+						FeeOcurTime:      tm.Format("2006-01-02 15:04:05"),
288 292
 					}
289 293
 
290 294
 					customs = append(customs, cus)
@@ -307,6 +311,7 @@ func Hbyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
307 311
 							Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
308 312
 							MedListCodg:      subItem.HisProject.MedicalCode,
309 313
 							HospApprFlag:     -1,
314
+							FeeOcurTime:      tm.Format("2006-01-02 15:04:05"),
310 315
 						}
311 316
 						customs = append(customs, cus)
312 317
 					}
@@ -322,6 +327,7 @@ func Hbyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
322 327
 							Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
323 328
 							MedListCodg:      subItem.GoodInfo.MedicalInsuranceNumber,
324 329
 							HospApprFlag:     -1,
330
+							FeeOcurTime:      tm.Format("2006-01-02 15:04:05"),
325 331
 						}
326 332
 						customs = append(customs, cus)
327 333
 					}
@@ -362,7 +368,7 @@ func Hbyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
362 368
 		feedetailInfo["dise_codg"] = ""                              // 病种编码
363 369
 		feedetailInfo["rxno"] = ""                                   // 处方号
364 370
 		feedetailInfo["rx_circ_flag"] = "0"                          // 外购处方标志
365
-		feedetailInfo["fee_ocur_time"] = timeFormatOne               // 费用发生时间
371
+		feedetailInfo["fee_ocur_time"] = item.FeeOcurTime            // 费用发生时间
366 372
 		feedetailInfo["med_list_codg"] = item.MedListCodg            // 医疗目录编码
367 373
 		feedetailInfo["medins_list_codg"] = fixmedins_code           // 医药机构目录编码
368 374
 		feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额

+ 49 - 3
service/jsyb_service.go Voir le fichier

@@ -109,6 +109,38 @@ func Jsyb1101A(certNo string, org_name string, doctor string, fixmedins_code str
109 109
 	return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), inputLog
110 110
 }
111 111
 
112
+func Jsyb1101B(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, request_url string, access_key string, Token string, cainfo string) (string, string) {
113
+	timestamp := time.Now().Unix()
114
+	//生成输入报文
115
+	inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
116
+
117
+	input := make(map[string]interface{})
118
+	inputData := make(map[string]interface{})
119
+	inputMessage["infno"] = "1101" // 交易编码
120
+
121
+	inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
122
+	inputData["card_sn"] = ""           // 卡识别码
123
+	inputData["certno"] = ""            // 证件号码
124
+	inputData["psn_cert_type"] = "01"   // 人员证件类型
125
+
126
+	inputData["mdtrt_cert_no"] = Token // 就诊凭证编号
127
+	inputData["begntime"] = ""         // 开始时间
128
+	inputData["psn_name"] = ""         // 人员姓名
129
+	input["data"] = inputData
130
+	inputMessage["input"] = input //交易输入
131
+
132
+	var inputLog string
133
+	bytesData, _ := json.Marshal(inputMessage)
134
+	inputLog = string(bytesData)
135
+	fmt.Println(string(bytesData))
136
+	if err != nil {
137
+		fmt.Println(err.Error())
138
+		return err.Error(), ""
139
+	}
140
+	request_url = request_url + "1101"
141
+	return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), inputLog
142
+}
143
+
112 144
 // 门诊挂号
113 145
 func Jsyb2201(psnNo string, insutype string, certNo string, org_name string, opera string, ipt_otp_no string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, doctor_name string, request_url string, access_key string, verify_number string, cainfo string) (string, string) {
114 146
 	fmt.Println(opera)
@@ -130,9 +162,13 @@ func Jsyb2201(psnNo string, insutype string, certNo string, org_name string, ope
130 162
 	if id_card_type == 1 {
131 163
 		inputData["mdtrt_cert_type"] = "03"                       // 就诊凭证类型
132 164
 		inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
165
+	} else if id_card_type == 4 {
166
+		inputData["mdtrt_cert_type"] = "01"        // 就诊凭证类型
167
+		inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
133 168
 	} else {
134 169
 		inputData["mdtrt_cert_type"] = "02"                       // 就诊凭证类型
135 170
 		inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
171
+
136 172
 	}
137 173
 
138 174
 	inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
@@ -319,10 +355,11 @@ func Jsyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
319 355
 
320 356
 	timestamp2 := time.Now().Unix()
321 357
 
322
-	tempTime := time.Unix(timestamp2, 0)
323
-	timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
358
+	//tempTime := time.Unix(timestamp2, 0)
359
+	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
324 360
 	var customs []*Custom
325 361
 	for _, item := range hisPrescription {
362
+		tm := time.Unix(item.PreTime, 0)
326 363
 
327 364
 		if item.Type == 1 { //药品
328 365
 			for _, subItem := range item.HisDoctorAdviceInfo {
@@ -340,6 +377,7 @@ func Jsyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
340 377
 						DoctorName:              new_doctor_name,
341 378
 						ProvinceDrugMedListCodg: "",
342 379
 						ProvinceGoodMedListCodg: "",
380
+						FeeOcurTime:             tm.Format("2006-01-02 15:04:05"),
343 381
 					}
344 382
 
345 383
 					if subItem.BaseDrugLib.DrugClassify == "2" {
@@ -369,6 +407,7 @@ func Jsyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
369 407
 							HospApprFlag:            -1,
370 408
 							ProvinceDrugMedListCodg: "",
371 409
 							ProvinceGoodMedListCodg: "",
410
+							FeeOcurTime:             tm.Format("2006-01-02 15:04:05"),
372 411
 						}
373 412
 						customs = append(customs, cus)
374 413
 					}
@@ -388,6 +427,7 @@ func Jsyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
388 427
 							DoctorName:              new_doctor_name,
389 428
 							ProvinceDrugMedListCodg: "",
390 429
 							ProvinceGoodMedListCodg: subItem.GoodInfo.ProvincesCode,
430
+							FeeOcurTime:             tm.Format("2006-01-02 15:04:05"),
391 431
 						}
392 432
 						customs = append(customs, cus)
393 433
 					}
@@ -432,7 +472,7 @@ func Jsyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
432 472
 		feedetailInfo["dise_codg"] = diag_code                       // 病种编码
433 473
 		feedetailInfo["rxno"] = ""                                   // 处方号
434 474
 		feedetailInfo["rx_circ_flag"] = "0"                          // 外购处方标志
435
-		feedetailInfo["fee_ocur_time"] = timeFormatOne               // 费用发生时间
475
+		feedetailInfo["fee_ocur_time"] = item.FeeOcurTime            // 费用发生时间
436 476
 		feedetailInfo["med_list_codg"] = item.MedListCodg            // 医疗目录编码
437 477
 		feedetailInfo["medins_list_codg"] = fixmedins_code           // 医药机构目录编码
438 478
 		feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
@@ -547,6 +587,9 @@ func Jsyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
547 587
 		if id_card_type == 1 {
548 588
 			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
549 589
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
590
+		} else if id_card_type == 4 {
591
+			inputData["mdtrt_cert_type"] = "01"        // 就诊凭证类型
592
+			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
550 593
 		} else {
551 594
 			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
552 595
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
@@ -607,6 +650,9 @@ func Jsyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
607 650
 		if id_card_type == 1 {
608 651
 			inputData["mdtrt_cert_type"] = "03"                       // 就诊凭证类型
609 652
 			inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
653
+		} else if id_card_type == 4 {
654
+			inputData["mdtrt_cert_type"] = "01"        // 就诊凭证类型
655
+			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
610 656
 		} else {
611 657
 			inputData["mdtrt_cert_type"] = "02"                       // 就诊凭证类型
612 658
 			inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号