Ver código fonte

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

csx 1 ano atrás
pai
commit
699235c33c
6 arquivos alterados com 65 adições e 19 exclusões
  1. 2 2
      conf/app.conf
  2. 19 3
      controllers/sg/his_api_controller.go
  3. 6 6
      main.go
  4. 16 0
      models/his_models.go
  5. 4 3
      models/yb_models.go
  6. 18 5
      service/gdyb_service.go

+ 2 - 2
conf/app.conf Ver arquivo

@@ -45,7 +45,7 @@ appsecret="61ee2e6268497d5aa9de0b0187c39aea"
45 45
 
46 46
 
47 47
 [prod]
48
-org_id = 10217
48
+org_id = 10318
49 49
 mobile_token_expiration_second = 86400
50 50
 httpdomain = https://api.xt.kuyicloud.com
51 51
 sso_domain = https://sso.kuyicloud.com
@@ -72,7 +72,7 @@ gdyb_url = "http://19.15.78.136:20001/ebus/gdyb_inf/poc/hsa/hgs/gzzq/"
72 72
 # gdyb_paasid = "zq_prd_yjyy"
73 73
 # gdyb_paasid = "sztest_hosp"
74 74
 #广州
75
-# gdyb_paasid = "gdyb_inf"
75
+gdyb_paasid = "gdyb_inf"
76 76
 
77 77
 
78 78
 readmysqlhost = shengws1.mysql.rds.aliyuncs.com

+ 19 - 3
controllers/sg/his_api_controller.go Ver arquivo

@@ -90,8 +90,7 @@ func (c *HisApiController) Get9001() {
90 90
 	adminUser := c.GetAdminUserInfo()
91 91
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
92 92
 	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, 185)
93
-	result, _ := service.Gdyb9001(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 1669)
94
-
93
+	result, inputLog := service.Gdyb9001(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 1669)
95 94
 	var dat map[string]interface{}
96 95
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
97 96
 		fmt.Println(dat)
@@ -105,7 +104,24 @@ func (c *HisApiController) Get9001() {
105 104
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
106 105
 		return
107 106
 	}
108
-
107
+	if res.Infcode == 0 {
108
+		sign := models.HisSignIn{
109
+			UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
110
+			SignNo:    res.Output.Result.SignNo,
111
+			SignTime:  res.Output.Result.SignTime,
112
+			Ctime:     time.Now().Unix(),
113
+			Mtime:     time.Now().Unix(),
114
+			Status:    1,
115
+			InputLog:  inputLog,
116
+			OutputLog: result,
117
+		}
118
+		err := service.CreateSignIn(&sign)
119
+		if err == nil {
120
+			c.ServeSuccessJSON(map[string]interface{}{
121
+				"msg": "签到成功",
122
+			})
123
+		}
124
+	}
109 125
 }
110 126
 func (c *HisApiController) Check3101() {
111 127
 	patient_id, _ := c.GetInt64("patient_id")

+ 6 - 6
main.go Ver arquivo

@@ -5,7 +5,7 @@ import (
5 5
 	"fmt"
6 6
 	"gdyb/models"
7 7
 	_ "gdyb/routers"
8
-	//"gdyb/service"
8
+	"gdyb/service"
9 9
 	"github.com/astaxie/beego"
10 10
 	"github.com/qiniu/api.v7/auth/qbox"
11 11
 	"github.com/qiniu/api.v7/storage"
@@ -15,11 +15,11 @@ import (
15 15
 )
16 16
 
17 17
 func init() {
18
-	//service.ConnectDB()
19
-	//org_id, _ := beego.AppConfig.Int64("org_id")
20
-	//miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
21
-	//CreateLog(miConfig)
22
-	//UploadLog(miConfig)
18
+	service.ConnectDB()
19
+	org_id, _ := beego.AppConfig.Int64("org_id")
20
+	miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
21
+	CreateLog(miConfig)
22
+	UploadLog(miConfig)
23 23
 
24 24
 	//UploadSettleList(org_id)
25 25
 }

+ 16 - 0
models/his_models.go Ver arquivo

@@ -1429,3 +1429,19 @@ type HisPrescriptionProjectTen struct {
1429 1429
 func (HisPrescriptionProjectTen) TableName() string {
1430 1430
 	return "his_prescription_project"
1431 1431
 }
1432
+
1433
+type HisSignIn struct {
1434
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
1435
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1436
+	SignNo    string `gorm:"column:sign_no" json:"sign_no" form:"sign_no"`
1437
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
1438
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
1439
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
1440
+	SignTime  string `gorm:"column:sign_time" json:"sign_time" form:"sign_time"`
1441
+	InputLog  string `gorm:"column:input_log" json:"input_log" form:"input_log"`
1442
+	OutputLog string `gorm:"column:output_log" json:"output_log" form:"output_log"`
1443
+}
1444
+
1445
+func (HisSignIn) TableName() string {
1446
+	return "his_sign_in"
1447
+}

+ 4 - 3
models/yb_models.go Ver arquivo

@@ -47,9 +47,10 @@ type Result9001 struct {
47 47
 	InfRefmsgid string `json:"inf_refmsgid"`
48 48
 	Infcode     int64  `json:"infcode"`
49 49
 	Output      struct {
50
-		Signinoutb struct {
51
-			SignNo string `json:"sign_no"`
52
-		} `json:"signinoutb"`
50
+		Result struct {
51
+			SignNo   string `json:"sign_no"`
52
+			SignTime string `json:"sign_time"`
53
+		} `json:"result"`
53 54
 	} `json:"output"`
54 55
 	RefmsgTime  string      `json:"refmsg_time"`
55 56
 	RespondTime string      `json:"respond_time"`

+ 18 - 5
service/gdyb_service.go Ver arquivo

@@ -8,6 +8,8 @@ import (
8 8
 	"encoding/json"
9 9
 	"fmt"
10 10
 	"gdyb/models"
11
+	"strings"
12
+
11 13
 	//"gdyb/utils"
12 14
 	"github.com/astaxie/beego"
13 15
 	"github.com/go-ole/go-ole"
@@ -4439,14 +4441,14 @@ func Gdyb9001(org_name string, doctor string, fixmedins_code string, insuplc_adm
4439 4441
 	hour := time.Now().Format("15")
4440 4442
 	min := time.Now().Format("04")
4441 4443
 	sec := time.Now().Format("05")
4442
-
4443
-	inputData["currenttime"] = year + month + day + hour + min + sec
4444
+	custom_time := year + month + day + hour + min + sec
4445
+	inputData["currenttime"] = custom_time
4444 4446
 	var psd string
4445
-	psd = year + month + day + hour + min + sec + "Gzyb$867"
4447
+	psd = custom_time + "Gzyb$867"
4446 4448
 	h := md5.New()
4447 4449
 	h.Write([]byte(psd))
4448
-	inputData["password"] = hex.EncodeToString(h.Sum(nil))
4449
-	input["signIn"] = inputData
4450
+	inputData["password"] = strings.ToUpper(hex.EncodeToString(h.Sum(nil)))
4451
+	input["data"] = inputData
4450 4452
 	inputMessage["input"] = input //交易输入
4451 4453
 	var inputLog string
4452 4454
 	bytesData, err := json.Marshal(inputMessage)
@@ -4479,6 +4481,7 @@ func Gdyb9001(org_name string, doctor string, fixmedins_code string, insuplc_adm
4479 4481
 	} else {
4480 4482
 
4481 4483
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
4484
+
4482 4485
 		request, err := http.NewRequest("POST", url, reader)
4483 4486
 		if err != nil {
4484 4487
 			fmt.Println(err.Error())
@@ -4491,6 +4494,11 @@ func Gdyb9001(org_name string, doctor string, fixmedins_code string, insuplc_adm
4491 4494
 		request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
4492 4495
 		request.Header.Set("x-tif-nonce", nonce)
4493 4496
 
4497
+		fmt.Println(string(bytesData))
4498
+		fmt.Println(gdyb_url)
4499
+		fmt.Println(gdyb_paasid)
4500
+		fmt.Println(request.Header)
4501
+
4494 4502
 		client := http.Client{}
4495 4503
 		resp, err := client.Do(request)
4496 4504
 		if err != nil {
@@ -4745,3 +4753,8 @@ func Gdyb5302(psnNo string, org_name string, doctor string, fixmedins_code strin
4745 4753
 	fmt.Println(str)
4746 4754
 	return str
4747 4755
 }
4756
+
4757
+func CreateSignIn(record *models.HisSignIn) (err error) {
4758
+	err = writeDb.Save(&record).Error
4759
+	return
4760
+}