Ver código fonte

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

csx 2 anos atrás
pai
commit
699235c33c

+ 2 - 2
conf/app.conf Ver arquivo

45
 
45
 
46
 
46
 
47
 [prod]
47
 [prod]
48
-org_id = 10217
48
+org_id = 10318
49
 mobile_token_expiration_second = 86400
49
 mobile_token_expiration_second = 86400
50
 httpdomain = https://api.xt.kuyicloud.com
50
 httpdomain = https://api.xt.kuyicloud.com
51
 sso_domain = https://sso.kuyicloud.com
51
 sso_domain = https://sso.kuyicloud.com
72
 # gdyb_paasid = "zq_prd_yjyy"
72
 # gdyb_paasid = "zq_prd_yjyy"
73
 # gdyb_paasid = "sztest_hosp"
73
 # gdyb_paasid = "sztest_hosp"
74
 #广州
74
 #广州
75
-# gdyb_paasid = "gdyb_inf"
75
+gdyb_paasid = "gdyb_inf"
76
 
76
 
77
 
77
 
78
 readmysqlhost = shengws1.mysql.rds.aliyuncs.com
78
 readmysqlhost = shengws1.mysql.rds.aliyuncs.com

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

90
 	adminUser := c.GetAdminUserInfo()
90
 	adminUser := c.GetAdminUserInfo()
91
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
91
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
92
 	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, 185)
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
 	var dat map[string]interface{}
94
 	var dat map[string]interface{}
96
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
95
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
97
 		fmt.Println(dat)
96
 		fmt.Println(dat)
105
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
104
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
106
 		return
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
 func (c *HisApiController) Check3101() {
126
 func (c *HisApiController) Check3101() {
111
 	patient_id, _ := c.GetInt64("patient_id")
127
 	patient_id, _ := c.GetInt64("patient_id")

+ 6 - 6
main.go Ver arquivo

5
 	"fmt"
5
 	"fmt"
6
 	"gdyb/models"
6
 	"gdyb/models"
7
 	_ "gdyb/routers"
7
 	_ "gdyb/routers"
8
-	//"gdyb/service"
8
+	"gdyb/service"
9
 	"github.com/astaxie/beego"
9
 	"github.com/astaxie/beego"
10
 	"github.com/qiniu/api.v7/auth/qbox"
10
 	"github.com/qiniu/api.v7/auth/qbox"
11
 	"github.com/qiniu/api.v7/storage"
11
 	"github.com/qiniu/api.v7/storage"
15
 )
15
 )
16
 
16
 
17
 func init() {
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
 	//UploadSettleList(org_id)
24
 	//UploadSettleList(org_id)
25
 }
25
 }

+ 16 - 0
models/his_models.go Ver arquivo

1429
 func (HisPrescriptionProjectTen) TableName() string {
1429
 func (HisPrescriptionProjectTen) TableName() string {
1430
 	return "his_prescription_project"
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
 	InfRefmsgid string `json:"inf_refmsgid"`
47
 	InfRefmsgid string `json:"inf_refmsgid"`
48
 	Infcode     int64  `json:"infcode"`
48
 	Infcode     int64  `json:"infcode"`
49
 	Output      struct {
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
 	} `json:"output"`
54
 	} `json:"output"`
54
 	RefmsgTime  string      `json:"refmsg_time"`
55
 	RefmsgTime  string      `json:"refmsg_time"`
55
 	RespondTime string      `json:"respond_time"`
56
 	RespondTime string      `json:"respond_time"`

+ 18 - 5
service/gdyb_service.go Ver arquivo

8
 	"encoding/json"
8
 	"encoding/json"
9
 	"fmt"
9
 	"fmt"
10
 	"gdyb/models"
10
 	"gdyb/models"
11
+	"strings"
12
+
11
 	//"gdyb/utils"
13
 	//"gdyb/utils"
12
 	"github.com/astaxie/beego"
14
 	"github.com/astaxie/beego"
13
 	"github.com/go-ole/go-ole"
15
 	"github.com/go-ole/go-ole"
4439
 	hour := time.Now().Format("15")
4441
 	hour := time.Now().Format("15")
4440
 	min := time.Now().Format("04")
4442
 	min := time.Now().Format("04")
4441
 	sec := time.Now().Format("05")
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
 	var psd string
4446
 	var psd string
4445
-	psd = year + month + day + hour + min + sec + "Gzyb$867"
4447
+	psd = custom_time + "Gzyb$867"
4446
 	h := md5.New()
4448
 	h := md5.New()
4447
 	h.Write([]byte(psd))
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
 	inputMessage["input"] = input //交易输入
4452
 	inputMessage["input"] = input //交易输入
4451
 	var inputLog string
4453
 	var inputLog string
4452
 	bytesData, err := json.Marshal(inputMessage)
4454
 	bytesData, err := json.Marshal(inputMessage)
4479
 	} else {
4481
 	} else {
4480
 
4482
 
4481
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
4483
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
4484
+
4482
 		request, err := http.NewRequest("POST", url, reader)
4485
 		request, err := http.NewRequest("POST", url, reader)
4483
 		if err != nil {
4486
 		if err != nil {
4484
 			fmt.Println(err.Error())
4487
 			fmt.Println(err.Error())
4491
 		request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
4494
 		request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
4492
 		request.Header.Set("x-tif-nonce", nonce)
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
 		client := http.Client{}
4502
 		client := http.Client{}
4495
 		resp, err := client.Do(request)
4503
 		resp, err := client.Do(request)
4496
 		if err != nil {
4504
 		if err != nil {
4745
 	fmt.Println(str)
4753
 	fmt.Println(str)
4746
 	return str
4754
 	return str
4747
 }
4755
 }
4756
+
4757
+func CreateSignIn(record *models.HisSignIn) (err error) {
4758
+	err = writeDb.Save(&record).Error
4759
+	return
4760
+}