Browse Source

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

csx 3 years ago
parent
commit
007366fbfd
4 changed files with 137 additions and 43 deletions
  1. 109 22
      controllers/sg/his_api_controller.go
  2. 1 1
      models/gdyb_models.go
  3. 2 1
      routers/router.go
  4. 25 19
      service/gdyb_service.go

+ 109 - 22
controllers/sg/his_api_controller.go View File

@@ -3639,14 +3639,59 @@ func (c *HisApiController) GetUploadDiag() {
3639 3639
 
3640 3640
 }
3641 3641
 
3642
+type QueryResult struct {
3643
+	Name           string
3644
+	Code           string
3645
+	List_type_code string
3646
+}
3647
+
3642 3648
 func (c *HisApiController) GetCheckCode() {
3643
-	name := c.GetString("name")
3644
-	codg := c.GetString("codg")
3645
-	list_type_code := c.GetString("list_type_code")
3646
-	admin_user_id, _ := c.GetInt64("admin_user_id")
3649
+	ids_str := c.GetString("ids")
3650
+	record_type, _ := c.GetInt64("record_type") //1.药品 2.耗材  3.项目
3651
+
3652
+	ids_arr := strings.Split(ids_str, ",")
3653
+	var queryResult []QueryResult
3654
+	ids := make([]int64, 0)
3655
+	for _, item := range ids_arr {
3656
+		id, _ := strconv.ParseInt(item, 10, 64)
3657
+		ids = append(ids, id)
3658
+	}
3659
+	if record_type == 1 {
3660
+		drugs, _ := service.GetBatchDrugList(ids)
3661
+		for _, item := range drugs {
3662
+			result := QueryResult{
3663
+				Name:           item.DrugName,
3664
+				Code:           item.MedicalInsuranceNumber,
3665
+				List_type_code: item.MedicalInsuranceNumber,
3666
+			}
3667
+			queryResult = append(queryResult, result)
3668
+		}
3647 3669
 
3648
-	adminUser := c.GetAdminUserInfo()
3670
+	} else if record_type == 2 {
3671
+		goods, _ := service.GetBatchGoodInformationList(ids)
3672
+
3673
+		for _, item := range goods {
3674
+			result := QueryResult{
3675
+				Name:           item.GoodName,
3676
+				Code:           item.MedicalInsuranceNumber,
3677
+				List_type_code: item.MedicalInsuranceNumber,
3678
+			}
3679
+			queryResult = append(queryResult, result)
3680
+		}
3681
+	} else if record_type == 3 {
3682
+		projects, _ := service.GetBathchMyPorjecgList(ids)
3683
+		for _, item := range projects {
3684
+			result := QueryResult{
3685
+				Name:           item.ProjectName,
3686
+				Code:           item.MedicalCode,
3687
+				List_type_code: item.MedicalCode,
3688
+			}
3689
+			queryResult = append(queryResult, result)
3690
+		}
3691
+	}
3649 3692
 
3693
+	admin_user_id, _ := c.GetInt64("admin_user_id")
3694
+	adminUser := c.GetAdminUserInfo()
3650 3695
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
3651 3696
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
3652 3697
 
@@ -3668,22 +3713,61 @@ func (c *HisApiController) GetCheckCode() {
3668 3713
 	}
3669 3714
 
3670 3715
 	if config.IsOpen == 1 {
3671
-		result := service.Gdyb3301(baseParams, name, codg, list_type_code, "", "")
3672
-		var dat map[string]interface{}
3673
-		if err := json.Unmarshal([]byte(result), &dat); err == nil {
3674
-			fmt.Println(dat)
3675
-		} else {
3676
-			fmt.Println(err)
3716
+		for _, item := range queryResult {
3717
+			result := service.Gdyb3301(baseParams, item.Name, item.Code, item.List_type_code, "2021-04-26", "")
3718
+			var dat map[string]interface{}
3719
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
3720
+				fmt.Println(dat)
3721
+			} else {
3722
+				fmt.Println(err)
3723
+			}
3677 3724
 		}
3678
-
3679 3725
 	}
3680
-
3681 3726
 }
3682 3727
 func (c *HisApiController) UnCheckCode() {
3683
-	name := c.GetString("name")
3684
-	codg := c.GetString("codg")
3685
-	list_type_code := c.GetString("list_type_code")
3728
+	ids_str := c.GetString("ids")
3729
+	record_type, _ := c.GetInt64("record_type") //1.药品 2.耗材  3.项目
3686 3730
 	admin_user_id, _ := c.GetInt64("admin_user_id")
3731
+	ids_arr := strings.Split(ids_str, ",")
3732
+	var queryResult []QueryResult
3733
+	ids := make([]int64, 0)
3734
+	for _, item := range ids_arr {
3735
+		id, _ := strconv.ParseInt(item, 10, 64)
3736
+		ids = append(ids, id)
3737
+	}
3738
+	if record_type == 1 {
3739
+		drugs, _ := service.GetBatchDrugList(ids)
3740
+		for _, item := range drugs {
3741
+			result := QueryResult{
3742
+				Name:           item.DrugName,
3743
+				Code:           item.MedicalInsuranceNumber,
3744
+				List_type_code: item.MedicalInsuranceNumber,
3745
+			}
3746
+			queryResult = append(queryResult, result)
3747
+		}
3748
+
3749
+	} else if record_type == 2 {
3750
+		goods, _ := service.GetBatchGoodInformationList(ids)
3751
+
3752
+		for _, item := range goods {
3753
+			result := QueryResult{
3754
+				Name:           item.GoodName,
3755
+				Code:           item.MedicalInsuranceNumber,
3756
+				List_type_code: item.MedicalInsuranceNumber,
3757
+			}
3758
+			queryResult = append(queryResult, result)
3759
+		}
3760
+	} else if record_type == 3 {
3761
+		projects, _ := service.GetBathchMyPorjecgList(ids)
3762
+		for _, item := range projects {
3763
+			result := QueryResult{
3764
+				Name:           item.ProjectName,
3765
+				Code:           item.MedicalCode,
3766
+				List_type_code: item.MedicalCode,
3767
+			}
3768
+			queryResult = append(queryResult, result)
3769
+		}
3770
+	}
3687 3771
 
3688 3772
 	adminUser := c.GetAdminUserInfo()
3689 3773
 
@@ -3708,12 +3792,15 @@ func (c *HisApiController) UnCheckCode() {
3708 3792
 	}
3709 3793
 
3710 3794
 	if config.IsOpen == 1 {
3711
-		result := service.Gdyb3302(baseParams, name, codg, list_type_code)
3712
-		var dat map[string]interface{}
3713
-		if err := json.Unmarshal([]byte(result), &dat); err == nil {
3714
-			fmt.Println(dat)
3715
-		} else {
3716
-			fmt.Println(err)
3795
+		for _, item := range queryResult {
3796
+
3797
+			result := service.Gdyb3302(baseParams, item.Name, item.Code, item.List_type_code)
3798
+			var dat map[string]interface{}
3799
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
3800
+				fmt.Println(dat)
3801
+			} else {
3802
+				fmt.Println(err)
3803
+			}
3717 3804
 		}
3718 3805
 
3719 3806
 	}

+ 1 - 1
models/gdyb_models.go View File

@@ -9,7 +9,7 @@ type GdybPsnRecord struct {
9 9
 	Mtime         int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
10 10
 	Status        int64  `gorm:"column:status" json:"status" form:"status"`
11 11
 	IsCancel      int64  `gorm:"column:is_cancel" json:"is_cancel" form:"is_cancel"`
12
-	TrtDclaDetlSn int64  `gorm:"column:trt_dcla_detl_sn" json:"trt_dcla_detl_sn" form:"trt_dcla_detl_sn"`
12
+	TrtDclaDetlSn string `gorm:"column:trt_dcla_detl_sn" json:"trt_dcla_detl_sn" form:"trt_dcla_detl_sn"`
13 13
 	DoctorId      int64  `gorm:"column:doctor_id" json:"doctor_id" form:"doctor_id"`
14 14
 	DepartmentId  int64  `gorm:"column:department_id" json:"department_id" form:"department_id"`
15 15
 	Insutype      string `gorm:"column:insutype" json:"insutype" form:"insutype"`

+ 2 - 1
routers/router.go View File

@@ -1,7 +1,8 @@
1 1
 package routers
2 2
 
3 3
 import (
4
-	"gdyb/controllers/sz"
4
+	"gdyb/controllers/sg"
5
+	//"gdyb/controllers/sz"
5 6
 	//"gdyb/controllers/sz"
6 7
 	//"gdyb/controllers/sz"
7 8
 	//admin_api "XT_New/controllers/admin_api_controllers"

+ 25 - 19
service/gdyb_service.go View File

@@ -120,8 +120,8 @@ func Gdyb1101(certNo string, org_name string, doctor string, fixmedins_code stri
120 120
 		return err.Error()
121 121
 	}
122 122
 	reader := bytes.NewReader(bytesData)
123
-	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
124
-	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
123
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
124
+	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
125 125
 
126 126
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
127 127
 	request, err := http.NewRequest("POST", url, reader)
@@ -131,7 +131,7 @@ func Gdyb1101(certNo string, org_name string, doctor string, fixmedins_code stri
131 131
 	}
132 132
 
133 133
 	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
134
-	request.Header.Set("x-tif-paasid", "sg03_prd")
134
+	request.Header.Set("x-tif-paasid", "test_hosp")
135 135
 	request.Header.Set("x-tif-signature", signature)
136 136
 	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
137 137
 	request.Header.Set("x-tif-nonce", nonce)
@@ -1416,16 +1416,16 @@ func Gdyb3301(baseParams *models.BaseParams, name string, codg string, list_type
1416 1416
 		return err.Error()
1417 1417
 	}
1418 1418
 	reader := bytes.NewReader(bytesData)
1419
-	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3301"
1420
-
1421
-	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/5203"
1419
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3301"
1420
+	//
1421
+	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3301"
1422 1422
 	request, err := http.NewRequest("POST", url, reader)
1423 1423
 	if err != nil {
1424 1424
 		fmt.Println(err.Error())
1425 1425
 		return err.Error()
1426 1426
 	}
1427 1427
 	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1428
-	request.Header.Set("x-tif-paasid", "sg03_prd")
1428
+	request.Header.Set("x-tif-paasid", "test_hosp")
1429 1429
 	request.Header.Set("x-tif-signature", signature)
1430 1430
 	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1431 1431
 	request.Header.Set("x-tif-nonce", nonce)
@@ -1471,16 +1471,16 @@ func Gdyb3302(baseParams *models.BaseParams, name string, codg string, list_type
1471 1471
 		return err.Error()
1472 1472
 	}
1473 1473
 	reader := bytes.NewReader(bytesData)
1474
-	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3302"
1474
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3302"
1475 1475
 
1476
-	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/5203"
1476
+	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3302"
1477 1477
 	request, err := http.NewRequest("POST", url, reader)
1478 1478
 	if err != nil {
1479 1479
 		fmt.Println(err.Error())
1480 1480
 		return err.Error()
1481 1481
 	}
1482 1482
 	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1483
-	request.Header.Set("x-tif-paasid", "sg03_prd")
1483
+	request.Header.Set("x-tif-paasid", "test_hosp")
1484 1484
 	request.Header.Set("x-tif-signature", signature)
1485 1485
 	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1486 1486
 	request.Header.Set("x-tif-nonce", nonce)
@@ -1534,14 +1534,16 @@ func Gdyb2505(psnNo string, doctor string, org_name string, fixmedins_code strin
1534 1534
 		return err.Error()
1535 1535
 	}
1536 1536
 	reader := bytes.NewReader(bytesData)
1537
-	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2505"
1537
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2505"
1538
+	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2505"
1539
+
1538 1540
 	request, err := http.NewRequest("POST", url, reader)
1539 1541
 	if err != nil {
1540 1542
 		fmt.Println(err.Error())
1541 1543
 		return err.Error()
1542 1544
 	}
1543 1545
 	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1544
-	request.Header.Set("x-tif-paasid", "sg03_prd")
1546
+	request.Header.Set("x-tif-paasid", "test_hosp")
1545 1547
 	request.Header.Set("x-tif-signature", signature)
1546 1548
 	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1547 1549
 	request.Header.Set("x-tif-nonce", nonce)
@@ -1583,8 +1585,8 @@ func Gdyb2506(psnNo string, doctor string, org_name string, fixmedins_code strin
1583 1585
 	}
1584 1586
 	reader := bytes.NewReader(bytesData)
1585 1587
 
1586
-	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2506"
1587
-	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
1588
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2506"
1589
+	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2506"
1588 1590
 
1589 1591
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
1590 1592
 	request, err := http.NewRequest("POST", url, reader)
@@ -1594,7 +1596,7 @@ func Gdyb2506(psnNo string, doctor string, org_name string, fixmedins_code strin
1594 1596
 	}
1595 1597
 
1596 1598
 	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1597
-	request.Header.Set("x-tif-paasid", "sg03_prd")
1599
+	request.Header.Set("x-tif-paasid", "test_hosp")
1598 1600
 	request.Header.Set("x-tif-signature", signature)
1599 1601
 	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1600 1602
 	request.Header.Set("x-tif-nonce", nonce)
@@ -1653,7 +1655,9 @@ func Gdyb2503(psnNo string, insutype string, org_name string, doctor string, fix
1653 1655
 		return err.Error()
1654 1656
 	}
1655 1657
 	reader := bytes.NewReader(bytesData)
1656
-	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2503"
1658
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2503"
1659
+	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2503"
1660
+
1657 1661
 	request, err := http.NewRequest("POST", url, reader)
1658 1662
 	if err != nil {
1659 1663
 		fmt.Println(err.Error())
@@ -1661,7 +1665,7 @@ func Gdyb2503(psnNo string, insutype string, org_name string, doctor string, fix
1661 1665
 	}
1662 1666
 
1663 1667
 	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1664
-	request.Header.Set("x-tif-paasid", "sg03_prd")
1668
+	request.Header.Set("x-tif-paasid", "test_hosp")
1665 1669
 	request.Header.Set("x-tif-signature", signature)
1666 1670
 	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1667 1671
 	request.Header.Set("x-tif-nonce", nonce)
@@ -1703,14 +1707,16 @@ func Gdyb2504(psnNo string, org_name string, doctor string, fixmedins_code strin
1703 1707
 		return err.Error()
1704 1708
 	}
1705 1709
 	reader := bytes.NewReader(bytesData)
1706
-	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2504"
1710
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2504"
1711
+	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2504"
1712
+
1707 1713
 	request, err := http.NewRequest("POST", url, reader)
1708 1714
 	if err != nil {
1709 1715
 		fmt.Println(err.Error())
1710 1716
 		return err.Error()
1711 1717
 	}
1712 1718
 	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1713
-	request.Header.Set("x-tif-paasid", "sg03_prd")
1719
+	request.Header.Set("x-tif-paasid", "test_hosp")
1714 1720
 	request.Header.Set("x-tif-signature", signature)
1715 1721
 	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1716 1722
 	request.Header.Set("x-tif-nonce", nonce)