Browse Source

user and health profile

Rick.Lan 2 months ago
parent
commit
26c67f2b45

+ 70 - 17
controllers/api_base_controller.go View File

24
 
24
 
25
 	beego.Router("/xcx/api/user/login", &LoginApiController{}, "Post:WxXcxLogin")
25
 	beego.Router("/xcx/api/user/login", &LoginApiController{}, "Post:WxXcxLogin")
26
 
26
 
27
-	beego.Router("/xcx/api/user/getphonenumber", &LoginApiController{}, "Post:GetPhoneNumber")
27
+	beego.Router("/xcx/api/user/updatephonebycode", &UserApiController{}, "Post:UpdatePhoneByCode")
28
+
29
+	beego.Router("/xcx/api/user/getuserinfo", &UserApiController{}, "Get:GetUserInfo")
30
+
31
+	beego.Router("/xcx/api/user/savehealthprofile", &UserApiController{}, "Post:SaveHealthProfile")
32
+
33
+	beego.Router("/xcx/api/user/saveuserinfo", &UserApiController{}, "Post:SaveUserInfo")
34
+
35
+	beego.Router("/xcx/api/user/gethealthprofile", &UserApiController{}, "Get:GetHealthProfile")
36
+
37
+	beego.Router("/xcx/api/sysdic/getillness", &SysDicApiController{}, "Get:GetIllness")
38
+
39
+	beego.Router("/xcx/api/sysdic/getrenalstatus", &SysDicApiController{}, "Get:GetRenalStatus")
40
+
28
 }
41
 }
29
 
42
 
30
 type BaseApiController struct {
43
 type BaseApiController struct {
36
 
49
 
37
 type BaseApiAuthController struct {
50
 type BaseApiAuthController struct {
38
 	BaseApiController
51
 	BaseApiController
52
+	CurrentUser models.XcxUser
53
+	sessionKey  string
39
 }
54
 }
40
 
55
 
41
 func (c *BaseApiAuthController) Prepare() {
56
 func (c *BaseApiAuthController) Prepare() {
43
 	// JWT Token通常放在请求头中,例如Authorization: Bearer <token>
58
 	// JWT Token通常放在请求头中,例如Authorization: Bearer <token>
44
 	authHeader := c.Ctx.Input.Header("Authorization")
59
 	authHeader := c.Ctx.Input.Header("Authorization")
45
 	if authHeader == "" {
60
 	if authHeader == "" {
46
-		c.ServeFailJsonSendAndStop(http.StatusUnauthorized, "缺少认证信息")
61
+		c.ServeFailJsonSendAndStop(http.StatusUnauthorized, enums.ErrorCodeNotLogin, "缺少认证信息")
47
 		return
62
 		return
48
 	}
63
 	}
49
 	tokenString := authHeader
64
 	tokenString := authHeader
62
 
77
 
63
 	if err != nil || !token.Valid {
78
 	if err != nil || !token.Valid {
64
 		utils.ErrorLog("Token验证失败: %v", err)
79
 		utils.ErrorLog("Token验证失败: %v", err)
65
-		c.ServeFailJsonSendAndStop(http.StatusUnauthorized, "无效的Token")
80
+		c.ServeFailJsonSendAndStop(http.StatusUnauthorized, enums.ErrorCodeNotLogin, "无效的Token")
66
 		return
81
 		return
67
 	}
82
 	}
68
 
83
 
69
 	// 假设JWT中包含了用户ID
84
 	// 假设JWT中包含了用户ID
70
-	claims, ok := token.Claims.(jwt.MapClaims)
85
+	claims, ok := token.Claims.(CustomClaims)
71
 	if !ok {
86
 	if !ok {
72
-		c.ServeFailJsonSendAndStop(http.StatusUnauthorized, "无法解析Token中的信息")
87
+		c.ServeFailJsonSendAndStop(http.StatusUnauthorized, enums.ErrorCodeNotLogin, "无法解析Token中的信息")
73
 		return
88
 		return
74
 	}
89
 	}
75
 
90
 
76
-	userId, ok := claims["sessionkey"].(string)
77
-	if !ok {
78
-		c.ServeFailJsonSendAndStop(http.StatusUnauthorized, "无法获取会话ID")
91
+	key := claims.UserID
92
+	c.sessionKey = key
93
+	redisCli := service.RedisClient()
94
+	defer redisCli.Close()
95
+	uJson, err := redisCli.Get(key).Bytes()
96
+
97
+	if err != nil {
98
+		c.ServeFailJsonSendAndStop(http.StatusUnauthorized, enums.ErrorCodeNotLogin, fmt.Sprintf("redis err:%v", err))
79
 		return
99
 		return
80
 	}
100
 	}
81
 
101
 
82
-	c.SetSession("userId", userId)
102
+	user := &models.XcxUser{}
103
+	err = json.Unmarshal(uJson, user)
104
+	if err != nil {
105
+		c.ServeFailJsonSendAndStop(http.StatusUnauthorized, enums.ErrorCodeNotLogin, fmt.Sprintf("json err:%v", err))
106
+		return
107
+	}
108
+	//c.Ctx.Input.SetData("user", user)
109
+	c.CurrentUser = *user
110
+	//c.SetSession("user", user)
83
 }
111
 }
84
 
112
 
85
 type CustomClaims struct {
113
 type CustomClaims struct {
127
 	c.Data["json"] = enums.MakeDynamicFailResponseJSON(msg)
155
 	c.Data["json"] = enums.MakeDynamicFailResponseJSON(msg)
128
 	c.ServeJSON()
156
 	c.ServeJSON()
129
 }
157
 }
130
-func (c *BaseApiController) ServeFailJsonSendAndStop(code int, msg string) {
131
-	c.Ctx.Output.SetStatus(code)
132
-	c.ServeFailJsonSend(code, msg)
158
+func (c *BaseApiController) ServeFailJsonSendAndStop(httpStatus int, errCode int, msg string) {
159
+	c.Ctx.Output.SetStatus(httpStatus)
160
+	c.ServeFailJsonSend(errCode, msg)
133
 	c.StopRun()
161
 	c.StopRun()
134
 }
162
 }
135
 
163
 
136
-func (c *BaseApiController) Login(u models.XcxUser) (string, error) {
164
+func (c *BaseApiController) login(u models.XcxUser) (string, error) {
137
 
165
 
138
 	key := uuid.New().String()
166
 	key := uuid.New().String()
139
-
140
 	expire, _ := beego.AppConfig.Int("xsrfexpire")
167
 	expire, _ := beego.AppConfig.Int("xsrfexpire")
141
 
168
 
142
 	if expire == 0 {
169
 	if expire == 0 {
143
 		expire = 7200
170
 		expire = 7200
144
 	}
171
 	}
145
-
146
 	uJson, _ := json.Marshal(u)
172
 	uJson, _ := json.Marshal(u)
147
-
173
+	redisCli := service.RedisClient()
174
+	defer redisCli.Close()
148
 	service.RedisClient().Set(key, uJson, time.Second*time.Duration(expire))
175
 	service.RedisClient().Set(key, uJson, time.Second*time.Duration(expire))
149
-
150
 	// 创建一个我们自己的声明
176
 	// 创建一个我们自己的声明
151
 	claims := CustomClaims{
177
 	claims := CustomClaims{
152
 		UserID: key,
178
 		UserID: key,
162
 	// 使用密钥签名并获得完整的编码后的字符串形式的Token
188
 	// 使用密钥签名并获得完整的编码后的字符串形式的Token
163
 	return token.SignedString([]byte(beego.AppConfig.String("xsrfkey")))
189
 	return token.SignedString([]byte(beego.AppConfig.String("xsrfkey")))
164
 }
190
 }
191
+func (c *BaseApiAuthController) updateCurrentUser(updateAction func(*models.XcxUser)) error {
192
+	u := &c.CurrentUser
193
+	updateAction(u)
194
+	err := service.NewXcxUserService().UpdateUser(u)
195
+	if err != nil {
196
+		//c.ServeFailJsonSendAndStop(http.StatusOK, enums.ErrorCodeDBUpdate, "更新用户信息失败")
197
+		return err
198
+	}
199
+
200
+	redisCli := service.RedisClient()
201
+	defer redisCli.Close()
202
+	uJson, _ := json.Marshal(u)
203
+	expire, _ := beego.AppConfig.Int("xsrfexpire")
204
+
205
+	if expire == 0 {
206
+		expire = 7200
207
+	}
208
+	err = redisCli.Set(c.sessionKey, uJson, time.Second*time.Duration(expire)).Err()
209
+	if err != nil {
210
+		return err
211
+	}
212
+
213
+	c.CurrentUser = *u
214
+
215
+	return nil
216
+
217
+}

+ 2 - 18
controllers/login_api_controllor.go View File

26
 	if err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody); err != nil || dataBody.Code == "" {
26
 	if err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody); err != nil || dataBody.Code == "" {
27
 
27
 
28
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamFormatWrong)
28
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamFormatWrong)
29
+		return
29
 	}
30
 	}
30
 
31
 
31
 	wxcli := service.GetWxSdk().NewAuth()
32
 	wxcli := service.GetWxSdk().NewAuth()
50
 		return
51
 		return
51
 	}
52
 	}
52
 	u.SessionKey = resp.SessionKey
53
 	u.SessionKey = resp.SessionKey
53
-	t, err := c.BaseApiController.Login(*u)
54
+	t, err := c.BaseApiController.login(*u)
54
 	if err != nil {
55
 	if err != nil {
55
 		c.ServeDynamicFailJsonSend(err.Error())
56
 		c.ServeDynamicFailJsonSend(err.Error())
56
 		return
57
 		return
58
 	c.ServeSuccessJSON(models.WxXcxLoginResp{OpenId: u.OpenId, Token: t})
59
 	c.ServeSuccessJSON(models.WxXcxLoginResp{OpenId: u.OpenId, Token: t})
59
 
60
 
60
 }
61
 }
61
-
62
-// @Title GetPhoneNumber
63
-// @Description 获取小程序绑定的手机号码
64
-// @Param	body	body 	models.WxXcxLoginReq	true  "小程序登录请求参数"
65
-// @Success 200	success
66
-// @Failure 500 error
67
-// @router /getphonenumber [post]
68
-func (c *LoginApiController) GetPhoneNumber() {
69
-
70
-	dataBody := models.WxXcxLoginReq{}
71
-	if err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody); err != nil || dataBody.Code == "" {
72
-
73
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamFormatWrong)
74
-	}
75
-	c.ServeSuccessJSON(new(interface{}))
76
-
77
-}

+ 39 - 0
controllers/sysdic_api_controller.go View File

1
+package controllers
2
+
3
+import "sws_xcx/service"
4
+
5
+type SysDicApiController struct {
6
+	BaseApiController
7
+}
8
+
9
+// @Title GetIllness
10
+// @Description 获取病情字典
11
+// @Success 200 {object} models.type DicResp success
12
+// @Failure 500 error
13
+// @router /getillness [get]
14
+func (c *SysDicApiController) GetIllness() {
15
+	s := service.NewSysDicService()
16
+	dics, err := s.GetDicsByType("ILLNESS")
17
+	if err != nil {
18
+		c.ServeDynamicFailJsonSend(err.Error())
19
+		return
20
+	}
21
+
22
+	c.ServeSuccessJSON(s.Transform(dics))
23
+}
24
+
25
+// @Title GetRenalStatus
26
+// @Description 获取肾功能情况列表
27
+// @Success 200 {object} models.type DicResp success
28
+// @Failure 500 error
29
+// @router /getrenalstatus [get]
30
+func (c *SysDicApiController) GetRenalStatus() {
31
+	s := service.NewSysDicService()
32
+	dics, err := s.GetDicsByType("RENAL")
33
+	if err != nil {
34
+		c.ServeDynamicFailJsonSend(err.Error())
35
+		return
36
+	}
37
+
38
+	c.ServeSuccessJSON(s.Transform(dics))
39
+}

+ 183 - 0
controllers/user_api_controller.go View File

1
+package controllers
2
+
3
+import (
4
+	"encoding/json"
5
+	"sws_xcx/enums"
6
+	"sws_xcx/models"
7
+	"sws_xcx/service"
8
+
9
+	"github.com/medivhzhan/weapp/v3/phonenumber"
10
+)
11
+
12
+type UserApiController struct {
13
+	BaseApiAuthController
14
+}
15
+
16
+// @Title GetUserInfo
17
+// @Description 获取个人中心信息
18
+// @Success 200 {object} models.UserInfoResp success
19
+// @Failure 500 error
20
+// @router /getuserinfo [get]
21
+func (c *UserApiController) GetUserInfo() {
22
+
23
+	resp := models.UserInfoResp{
24
+		Id:                      c.CurrentUser.Id,
25
+		Avatar:                  c.CurrentUser.Avatar,
26
+		Email:                   c.CurrentUser.Email,
27
+		NickName:                c.CurrentUser.NickName,
28
+		Phone:                   c.CurrentUser.Phone,
29
+		PrivacyProtocolVersions: c.CurrentUser.PrivacyProtocolVersions,
30
+		UnionId:                 c.CurrentUser.UnionId,
31
+		OpenId:                  c.CurrentUser.OpenId,
32
+		Status:                  c.CurrentUser.Status,
33
+		Source:                  c.CurrentUser.Source,
34
+		Ctime:                   c.CurrentUser.Ctime,
35
+		Mtime:                   c.CurrentUser.Mtime,
36
+	}
37
+
38
+	c.ServeSuccessJSON(resp)
39
+}
40
+
41
+// @Title UpdatePhoneByCode
42
+// @Description 获取小程序绑定的手机号码并更新到用户信息
43
+// @Param	body	body 	models.WxXcxLoginReq	true  "小程序登录请求参数"
44
+// @Success 200 {object} models.XcxUser success
45
+// @Failure 500 error
46
+// @router /updatephonebycode [post]
47
+func (c *UserApiController) UpdatePhoneByCode() {
48
+	dataBody := models.WxXcxLoginReq{}
49
+	if err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody); err != nil || dataBody.Code == "" {
50
+
51
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamFormatWrong)
52
+		return
53
+	}
54
+
55
+	wxcli := service.GetWxSdk().NewPhonenumber()
56
+	resp, err := wxcli.GetPhoneNumber(&phonenumber.GetPhoneNumberRequest{
57
+		Code: dataBody.Code,
58
+	})
59
+	if err != nil {
60
+		c.ServeDynamicFailJsonSend(err.Error())
61
+		return
62
+	}
63
+	if resp.ErrCode != 0 {
64
+		c.ServeDynamicFailJsonSend(resp.ErrMSG)
65
+		return
66
+	}
67
+
68
+	err = c.updateCurrentUser(func(u *models.XcxUser) {
69
+		u.Phone = resp.Data.PhoneNumber
70
+	})
71
+
72
+	if err != nil {
73
+		c.ServeDynamicFailJsonSend(err.Error())
74
+		return
75
+	}
76
+	c.ServeSuccessJSON(c.CurrentUser)
77
+
78
+}
79
+
80
+// @Title SaveUserInfo
81
+// @Description 个人中心保存用户信息和透析病友信息
82
+// @Param	body	body 	models.SaveUserInfoReq	true  "小程序登录请求参数"
83
+// @Success 200  success
84
+// @Failure 500 error
85
+// @router /saveuserinfo [post]
86
+func (c *UserApiController) SaveUserInfo() {
87
+	req := &models.SaveUserInfoReq{}
88
+
89
+	if err := json.Unmarshal(c.Ctx.Input.RequestBody, req); err != nil {
90
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamFormatWrong)
91
+		return
92
+	}
93
+
94
+	err := c.updateCurrentUser(func(u *models.XcxUser) {
95
+		u.Avatar = req.Avatar
96
+		u.Email = req.Email
97
+		u.NickName = req.NickName
98
+		u.Phone = req.Phone
99
+	})
100
+
101
+	if err != nil {
102
+		c.ServeDynamicFailJsonSend(err.Error())
103
+		return
104
+	}
105
+
106
+	err = service.NewUserHealthProfileService().SavePatientInfo(
107
+		c.CurrentUser.Id,
108
+		req.RealName,
109
+		req.IdCard,
110
+		req.InpatientRegPhone)
111
+
112
+	if err != nil {
113
+		c.ServeDynamicFailJsonSend(err.Error())
114
+		return
115
+	}
116
+
117
+	c.ServeSuccessJSON(new(interface{}))
118
+
119
+}
120
+
121
+// @Title SaveHealthProfile
122
+// @Description 保存健康档案
123
+// @Param	body	body 	models.SaveHealthProfileReq	true  "小程序登录请求参数"
124
+// @Success 200  success
125
+// @Failure 500 error
126
+// @router /savehealthprofile [post]
127
+func (c *UserApiController) SaveHealthProfile() {
128
+
129
+	req := &models.SaveHealthProfileReq{}
130
+	if err := json.Unmarshal(c.Ctx.Input.RequestBody, req); err != nil {
131
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamFormatWrong)
132
+		return
133
+	}
134
+	err := service.NewUserHealthProfileService().SaveHealthProfile(c.CurrentUser.Id, *req)
135
+	if err != nil {
136
+		c.ServeDynamicFailJsonSend(err.Error())
137
+		return
138
+	}
139
+	c.ServeSuccessJSON(new(interface{}))
140
+
141
+}
142
+
143
+// @Title GetHealthProfile
144
+// @Description 获取健康档案
145
+// @Success 200 {object} models.HealthProfileResp success
146
+// @Failure 500 error
147
+// @router /gethealthprofile [get]
148
+func (c *UserApiController) GetHealthProfile() {
149
+	p, err := service.NewUserHealthProfileService().GetUserHealthProfileByUserId(c.CurrentUser.Id)
150
+	if err != nil {
151
+		c.ServeDynamicFailJsonSend(err.Error())
152
+		return
153
+	}
154
+
155
+	resp := models.HealthProfileResp{}
156
+	if p != nil {
157
+
158
+		resp.Birthday = p.Birthday
159
+		resp.BloodType = p.BloodType
160
+		resp.CreatineTime = p.CreatineTime
161
+		resp.Creatinine = p.Creatinine
162
+		resp.CreatinineUnit = p.CreatinineUnit
163
+		resp.Ctime = p.Ctime
164
+		resp.Gender = p.Gender
165
+		resp.Height = p.Height
166
+		resp.Id = p.Id
167
+		resp.IllnessState = p.IllnessState
168
+		resp.Mtime = p.Mtime
169
+		resp.RenalFunctionStatus = p.RenalFunctionStatus
170
+		resp.Status = p.Status
171
+		resp.UrineProtein = p.UrineProtein
172
+		resp.UrineProteinTime = p.UrineProteinTime
173
+		resp.UrineProteinUnit = p.UrineProteinUnit
174
+		resp.UrineProtein24h = p.UrineProtein24h
175
+		resp.UrineProtein24hTime = p.UrineProtein24hTime
176
+		resp.UrineProtein24hUnit = p.UrineProtein24hUnit
177
+
178
+		resp.Weight = p.Weight
179
+
180
+	}
181
+
182
+	c.ServeSuccessJSON(resp)
183
+}

+ 1 - 1
main.go View File

9
 
9
 
10
 func main() {
10
 func main() {
11
 	service.ConnectDB()
11
 	service.ConnectDB()
12
-	if beego.BConfig.RunMode == "dev" {
12
+	if beego.BConfig.RunMode == "dev" || beego.BConfig.RunMode == "test" {
13
 		beego.BConfig.WebConfig.DirectoryIndex = true
13
 		beego.BConfig.WebConfig.DirectoryIndex = true
14
 		beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"
14
 		beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"
15
 	}
15
 	}

+ 49 - 5
models/dbmodels.go View File

20
 	Mtime           time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; COMMENT:'更新时间 '"`
20
 	Mtime           time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; COMMENT:'更新时间 '"`
21
 	DeleteFlag      int       `json:"delete_flag" gorm:"type:int(11); COMMENT:'删除标志'"`
21
 	DeleteFlag      int       `json:"delete_flag" gorm:"type:int(11); COMMENT:'删除标志'"`
22
 }
22
 }
23
+
24
+func (CheckItem) TableName() string {
25
+	return "check_item"
26
+}
27
+
23
 type CheckRecord struct {
28
 type CheckRecord struct {
24
 	Id                  int64     `json:"id" gorm:"type:bigint(20); NOT NULL; primary_key; COMMENT:'检测记录ID'"`
29
 	Id                  int64     `json:"id" gorm:"type:bigint(20); NOT NULL; primary_key; COMMENT:'检测记录ID'"`
25
 	CheckType           string    `json:"check_type" gorm:"type:varchar(255); COMMENT:'检测类型(试纸类型)'"`
30
 	CheckType           string    `json:"check_type" gorm:"type:varchar(255); COMMENT:'检测类型(试纸类型)'"`
26
 	PutSources          string    `json:"put_sources" gorm:"type:varchar(255); COMMENT:'上传数据来源'"`
31
 	PutSources          string    `json:"put_sources" gorm:"type:varchar(255); COMMENT:'上传数据来源'"`
27
-	DeviceId            int64     `json:"device_id" gorm:"type:bigint(20); COMMENT:'设备ID'"`
32
+	DeviceId            uint64    `json:"device_id" gorm:"type:bigint(20) unsigned; COMMENT:'设备ID'"`
28
 	DeviceStatus        int       `json:"device_status" gorm:"type:int(2); COMMENT:'设备状态'"`
33
 	DeviceStatus        int       `json:"device_status" gorm:"type:int(2); COMMENT:'设备状态'"`
29
 	MessageId           string    `json:"message_id" gorm:"type:varchar(255); COMMENT:'设备消息id'"`
34
 	MessageId           string    `json:"message_id" gorm:"type:varchar(255); COMMENT:'设备消息id'"`
30
-	UserId              int64     `json:"user_id" gorm:"type:bigint(20); DEFAULT:'0'; COMMENT:'用户ID'"`
35
+	UserId              uint64    `json:"user_id" gorm:"type:bigint(20) unsigned; DEFAULT:'0'; COMMENT:'用户ID'"`
31
 	UserHealthProfileId int64     `json:"user_health_profile_id" gorm:"type:bigint(20); DEFAULT:'0'; COMMENT:'健康档案ID'"`
36
 	UserHealthProfileId int64     `json:"user_health_profile_id" gorm:"type:bigint(20); DEFAULT:'0'; COMMENT:'健康档案ID'"`
32
 	View                int       `json:"view" gorm:"type:int(11); DEFAULT:'0'; COMMENT:'查看:1(已查看) 0(未查看)'"`
37
 	View                int       `json:"view" gorm:"type:int(11); DEFAULT:'0'; COMMENT:'查看:1(已查看) 0(未查看)'"`
33
 	AlertItemIds        string    `json:"alert_item_ids" gorm:"type:varchar(255); COMMENT:'异常项目id (1,2,3)'"`
38
 	AlertItemIds        string    `json:"alert_item_ids" gorm:"type:varchar(255); COMMENT:'异常项目id (1,2,3)'"`
36
 	Mtime               time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; COMMENT:'更新时间'"`
41
 	Mtime               time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; COMMENT:'更新时间'"`
37
 	DeleteFlag          int       `json:"delete_flag" gorm:"type:int(1); DEFAULT:'0'; COMMENT:'删除标志'"`
42
 	DeleteFlag          int       `json:"delete_flag" gorm:"type:int(1); DEFAULT:'0'; COMMENT:'删除标志'"`
38
 }
43
 }
44
+
45
+func (CheckRecord) TableName() string {
46
+	return "check_record"
47
+}
48
+
39
 type CheckRecordItem struct {
49
 type CheckRecordItem struct {
40
 	Id              int64     `json:"id" gorm:"type:bigint(20) auto_increment; NOT NULL; primary_key"`
50
 	Id              int64     `json:"id" gorm:"type:bigint(20) auto_increment; NOT NULL; primary_key"`
41
 	CheckId         int64     `json:"check_id" gorm:"type:bigint(20); NOT NULL; DEFAULT:'0'"`
51
 	CheckId         int64     `json:"check_id" gorm:"type:bigint(20); NOT NULL; DEFAULT:'0'"`
46
 	Mtime           time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"`
56
 	Mtime           time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"`
47
 	DeleteFlag      int       `json:"delete_flag" gorm:"type:int(11); COMMENT:'删除标志'"`
57
 	DeleteFlag      int       `json:"delete_flag" gorm:"type:int(11); COMMENT:'删除标志'"`
48
 }
58
 }
59
+
60
+func (CheckRecordItem) TableName() string {
61
+	return "check_record_item"
62
+}
63
+
49
 type Device struct {
64
 type Device struct {
50
 	Id                   uint64    `json:"id" gorm:"type:bigint(20) unsigned auto_increment; NOT NULL; primary_key; COMMENT:'设备ID'"`
65
 	Id                   uint64    `json:"id" gorm:"type:bigint(20) unsigned auto_increment; NOT NULL; primary_key; COMMENT:'设备ID'"`
51
 	Name                 string    `json:"name" gorm:"type:varchar(255); COMMENT:'设备名称'"`
66
 	Name                 string    `json:"name" gorm:"type:varchar(255); COMMENT:'设备名称'"`
72
 	Mtime                time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; COMMENT:'更新时间 '"`
87
 	Mtime                time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; COMMENT:'更新时间 '"`
73
 	DeleteFlag           int       `json:"delete_flag" gorm:"type:int(11); DEFAULT:'0'; COMMENT:'删除标志'"`
88
 	DeleteFlag           int       `json:"delete_flag" gorm:"type:int(11); DEFAULT:'0'; COMMENT:'删除标志'"`
74
 }
89
 }
90
+
91
+func (Device) TableName() string {
92
+	return "device"
93
+}
94
+
75
 type DeviceMessageLog struct {
95
 type DeviceMessageLog struct {
76
 	Id         uint64    `json:"id" gorm:"type:bigint(20) unsigned auto_increment; NOT NULL; primary_key"`
96
 	Id         uint64    `json:"id" gorm:"type:bigint(20) unsigned auto_increment; NOT NULL; primary_key"`
77
 	MessageId  string    `json:"message_id" gorm:"type:varchar(255)"`
97
 	MessageId  string    `json:"message_id" gorm:"type:varchar(255)"`
81
 	Content    string    `json:"content" gorm:"type:text; COMMENT:'消息内容'"`
101
 	Content    string    `json:"content" gorm:"type:text; COMMENT:'消息内容'"`
82
 	Ctime      time.Time `json:"ctime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP; COMMENT:'创建时间'"`
102
 	Ctime      time.Time `json:"ctime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP; COMMENT:'创建时间'"`
83
 }
103
 }
104
+
105
+func (DeviceMessageLog) TableName() string {
106
+	return "device_message_log"
107
+}
108
+
84
 type DeviceRelate struct {
109
 type DeviceRelate struct {
85
 	Id         int64     `json:"id" gorm:"type:bigint(20) auto_increment; NOT NULL; primary_key; COMMENT:'id'"`
110
 	Id         int64     `json:"id" gorm:"type:bigint(20) auto_increment; NOT NULL; primary_key; COMMENT:'id'"`
86
 	Name       string    `json:"name" gorm:"type:varchar(255); COMMENT:'名称'"`
111
 	Name       string    `json:"name" gorm:"type:varchar(255); COMMENT:'名称'"`
87
-	DeviceId   int64     `json:"device_id" gorm:"type:bigint(20); COMMENT:'设备Id'"`
88
-	UserId     int64     `json:"user_id" gorm:"type:bigint(20); COMMENT:'会员Id'"`
112
+	DeviceId   uint64    `json:"device_id" gorm:"type:bigint(20) unsigned; COMMENT:'设备Id'"`
113
+	UserId     uint64    `json:"user_id" gorm:"type:bigint(20) unsigned; COMMENT:'会员Id'"`
89
 	Ctime      time.Time `json:"ctime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP; COMMENT:'创建时间'"`
114
 	Ctime      time.Time `json:"ctime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP; COMMENT:'创建时间'"`
90
 	Mtime      time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; COMMENT:'更新时间 '"`
115
 	Mtime      time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; COMMENT:'更新时间 '"`
91
 	DeleteFlag int       `json:"delete_flag" gorm:"type:int(11); DEFAULT:'0'; COMMENT:'删除标志(解绑时标记为删除)'"`
116
 	DeleteFlag int       `json:"delete_flag" gorm:"type:int(11); DEFAULT:'0'; COMMENT:'删除标志(解绑时标记为删除)'"`
92
 }
117
 }
118
+
119
+func (DeviceRelate) TableName() string {
120
+	return "device_relate"
121
+}
122
+
93
 type SysDictionary struct {
123
 type SysDictionary struct {
94
 	Id         int       `json:"id" gorm:"type:int(11) auto_increment; NOT NULL; primary_key"`
124
 	Id         int       `json:"id" gorm:"type:int(11) auto_increment; NOT NULL; primary_key"`
95
 	NameEn     string    `json:"name_en" gorm:"type:varchar(255)"`
125
 	NameEn     string    `json:"name_en" gorm:"type:varchar(255)"`
99
 	Ctime      time.Time `json:"ctime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP"`
129
 	Ctime      time.Time `json:"ctime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP"`
100
 	DeleteFlag int       `json:"delete_flag" gorm:"type:int(11); NOT NULL; DEFAULT:'0'; COMMENT:'删除标志'"`
130
 	DeleteFlag int       `json:"delete_flag" gorm:"type:int(11); NOT NULL; DEFAULT:'0'; COMMENT:'删除标志'"`
101
 }
131
 }
132
+
133
+func (SysDictionary) TableName() string {
134
+	return "sys_dictionary"
135
+}
136
+
102
 type UserHealthProfile struct {
137
 type UserHealthProfile struct {
103
 	Id                  uint64    `json:"id" gorm:"type:bigint(20) unsigned auto_increment; NOT NULL; primary_key; COMMENT:'Primary Key ID'"`
138
 	Id                  uint64    `json:"id" gorm:"type:bigint(20) unsigned auto_increment; NOT NULL; primary_key; COMMENT:'Primary Key ID'"`
104
-	UserId              int64     `json:"user_id" gorm:"type:bigint(20); NOT NULL; COMMENT:'用户ID'"`
139
+	UserId              uint64    `json:"user_id" gorm:"type:bigint(20) unsigned; NOT NULL; COMMENT:'用户ID'"`
105
 	RealName            string    `json:"real_name" gorm:"type:varchar(64); COMMENT:'真实姓名'"`
140
 	RealName            string    `json:"real_name" gorm:"type:varchar(64); COMMENT:'真实姓名'"`
106
 	IdCard              string    `json:"id_card" gorm:"type:varchar(64); COMMENT:'身份证号'"`
141
 	IdCard              string    `json:"id_card" gorm:"type:varchar(64); COMMENT:'身份证号'"`
107
 	InpatientRegPhone   string    `json:"inpatient_reg_phone" gorm:"type:varchar(32); COMMENT:'住院登记手机号'"`
142
 	InpatientRegPhone   string    `json:"inpatient_reg_phone" gorm:"type:varchar(32); COMMENT:'住院登记手机号'"`
125
 	Ctime               time.Time `json:"ctime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP; COMMENT:'创建时间'"`
160
 	Ctime               time.Time `json:"ctime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP; COMMENT:'创建时间'"`
126
 	Mtime               time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; COMMENT:'更新时间 '"`
161
 	Mtime               time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; COMMENT:'更新时间 '"`
127
 }
162
 }
163
+
164
+func (UserHealthProfile) TableName() string {
165
+	return "user_health_profile"
166
+}
167
+
128
 type XcxUser struct {
168
 type XcxUser struct {
129
 	Id                      uint64    `json:"id" gorm:"type:bigint(20) unsigned auto_increment; NOT NULL; primary_key; COMMENT:'Primary Key ID'"`
169
 	Id                      uint64    `json:"id" gorm:"type:bigint(20) unsigned auto_increment; NOT NULL; primary_key; COMMENT:'Primary Key ID'"`
130
 	Phone                   string    `json:"phone" gorm:"type:varchar(32); COMMENT:'手机号码'"`
170
 	Phone                   string    `json:"phone" gorm:"type:varchar(32); COMMENT:'手机号码'"`
142
 
182
 
143
 	SessionKey string `json:"session_key" gorm:"-"`
183
 	SessionKey string `json:"session_key" gorm:"-"`
144
 }
184
 }
185
+
186
+func (XcxUser) TableName() string {
187
+	return "xcx_user"
188
+}

+ 87 - 0
models/httpmodels.go View File

1
 package models
1
 package models
2
 
2
 
3
+import "time"
4
+
3
 type WxXcxLoginReq struct {
5
 type WxXcxLoginReq struct {
4
 	Code string `json:"code"`
6
 	Code string `json:"code"`
5
 }
7
 }
8
 	Token  string `json:"token"`
10
 	Token  string `json:"token"`
9
 	OpenId string `json:"openid"`
11
 	OpenId string `json:"openid"`
10
 }
12
 }
13
+
14
+type SaveUserInfoReq struct {
15
+	Phone string `json:"phone" COMMENT:"手机号码"`
16
+	Email string `json:"email" COMMENT:"邮件"`
17
+	//UnionId                 string `json:"union_id" COMMENT:"unionid"`
18
+	NickName string `json:"nick_name" COMMENT:"昵称"`
19
+	Avatar   string `json:"avatar" COMMENT:"头像"`
20
+	//PrivacyProtocolVersions int    `json:"privacy_protocol_versions" COMMENT:"隐私政策版本"`
21
+
22
+	RealName          string `json:"real_name" gorm:"type:varchar(64); COMMENT:'真实姓名'"`
23
+	IdCard            string `json:"id_card" gorm:"type:varchar(64); COMMENT:'身份证号'"`
24
+	InpatientRegPhone string `json:"inpatient_reg_phone" gorm:"type:varchar(32); COMMENT:'住院登记手机号'"`
25
+}
26
+
27
+type UserInfoResp struct {
28
+	Id                      uint64 `json:"id" COMMENT:"Primary Key ID"`
29
+	Phone                   string `json:"phone" COMMENT:"手机号码"`
30
+	Email                   string `json:"email" COMMENT:"邮件"`
31
+	OpenId                  string `json:"open_id" COMMENT:"OpenID"`
32
+	UnionId                 string `json:"union_id" COMMENT:"unionid"`
33
+	NickName                string `json:"nick_name" COMMENT:"昵称"`
34
+	Avatar                  string `json:"avatar" COMMENT:"头像"`
35
+	Status                  int    `json:"status" COMMENT:"状态(1:有效 0: 无效)"`
36
+	Source                  string `json:"source" COMMENT:"用户来源"`
37
+	PrivacyProtocolVersions int    `json:"privacy_protocol_versions" COMMENT:"隐私政策版本"`
38
+
39
+	RealName          string `json:"real_name" gorm:"type:varchar(64); COMMENT:'真实姓名'"`
40
+	IdCard            string `json:"id_card" gorm:"type:varchar(64); COMMENT:'身份证号'"`
41
+	InpatientRegPhone string `json:"inpatient_reg_phone" gorm:"type:varchar(32); COMMENT:'住院登记手机号'"`
42
+
43
+	Ctime time.Time `json:"ctime" COMMENT:"创建时间"`
44
+	Mtime time.Time `json:"mtime" COMMENT:"更新时间 "`
45
+}
46
+
47
+type SaveHealthProfileReq struct {
48
+	Gender              int       `json:"gender" gorm:"type:int(11); DEFAULT:'0'; COMMENT:'性别(0:未知 1:男 2:女)'"`
49
+	Height              int       `json:"height" gorm:"type:int(11); COMMENT:'身高'"`
50
+	Weight              int       `json:"weight" gorm:"type:int(11); COMMENT:'体重'"`
51
+	BloodType           string    `json:"blood_type" gorm:"type:varchar(32); COMMENT:'血型'"`
52
+	Birthday            time.Time `json:"birthday" gorm:"type:datetime; COMMENT:'生日'"`
53
+	IllnessState        string    `json:"illness_state" gorm:"type:varchar(255); COMMENT:'病情'"`
54
+	RenalFunctionStatus int       `json:"renal_function_status" gorm:"type:int(11); COMMENT:'肾功能情况(0:未透析,1: 血液透析,2:腹膜透析,3:肾脏移植)'"`
55
+	Creatinine          int       `json:"creatinine" gorm:"type:int(11); NOT NULL; DEFAULT:'0'; COMMENT:'血肌酐'"`
56
+	CreatinineUnit      string    `json:"creatinine_unit" gorm:"type:varchar(32); COMMENT:'肌酐单位(umol/L,mg/dl)'"`
57
+	CreatineTime        time.Time `json:"creatine_time" gorm:"type:datetime; COMMENT:'肌酐检测时间'"`
58
+	UrineProtein24hUnit string    `json:"urine_protein_24h_unit" gorm:"type:varchar(32); COMMENT:'24小时尿蛋白单位(g/24h,mg/24h)'"`
59
+	UrineProtein24h     int       `json:"urine_protein_24h" gorm:"type:int(11); NOT NULL; DEFAULT:'0'; COMMENT:'24小时尿蛋白'"`
60
+	UrineProtein24hTime time.Time `json:"urine_protein_24h_time" gorm:"type:datetime; COMMENT:'24小时尿蛋白检测时间'"`
61
+	UrineProtein        int       `json:"urine_protein" gorm:"type:int(11); NOT NULL; DEFAULT:'0'; COMMENT:'尿蛋白'"`
62
+	UrineProteinUnit    string    `json:"urine_protein_unit" gorm:"type:varchar(32); COMMENT:'尿蛋白单位(g,mg)'"`
63
+	UrineProteinTime    time.Time `json:"urine_protein_time" gorm:"type:datetime; COMMENT:'尿蛋白检测时间'"`
64
+}
65
+
66
+type HealthProfileResp struct {
67
+	Id uint64 `json:"id" gorm:"type:bigint(20) unsigned auto_increment; NOT NULL; primary_key; COMMENT:'Primary Key ID'"`
68
+	//UserId              int64     `json:"user_id" gorm:"type:bigint(20); NOT NULL; COMMENT:'用户ID'"`
69
+	//RealName            string    `json:"real_name" gorm:"type:varchar(64); COMMENT:'真实姓名'"`
70
+	//IdCard              string    `json:"id_card" gorm:"type:varchar(64); COMMENT:'身份证号'"`
71
+	//InpatientRegPhone   string    `json:"inpatient_reg_phone" gorm:"type:varchar(32); COMMENT:'住院登记手机号'"`
72
+	Gender              int       `json:"gender" gorm:"type:int(11); DEFAULT:'0'; COMMENT:'性别(0:未知 1:男 2:女)'"`
73
+	Height              int       `json:"height" gorm:"type:int(11); COMMENT:'身高'"`
74
+	Weight              int       `json:"weight" gorm:"type:int(11); COMMENT:'体重'"`
75
+	BloodType           string    `json:"blood_type" gorm:"type:varchar(32); COMMENT:'血型'"`
76
+	Birthday            time.Time `json:"birthday" gorm:"type:datetime; COMMENT:'生日'"`
77
+	IllnessState        string    `json:"illness_state" gorm:"type:varchar(255); COMMENT:'病情'"`
78
+	RenalFunctionStatus int       `json:"renal_function_status" gorm:"type:int(11); COMMENT:'肾功能情况(0:未透析,1: 血液透析,2:腹膜透析,3:肾脏移植)'"`
79
+	Creatinine          int       `json:"creatinine" gorm:"type:int(11); NOT NULL; DEFAULT:'0'; COMMENT:'血肌酐'"`
80
+	CreatinineUnit      string    `json:"creatinine_unit" gorm:"type:varchar(32); COMMENT:'肌酐单位(umol/L,mg/dl)'"`
81
+	CreatineTime        time.Time `json:"creatine_time" gorm:"type:datetime; COMMENT:'肌酐检测时间'"`
82
+	UrineProtein24hUnit string    `json:"urine_protein_24h_unit" gorm:"type:varchar(32); COMMENT:'24小时尿蛋白单位(g/24h,mg/24h)'"`
83
+	UrineProtein24h     int       `json:"urine_protein_24h" gorm:"type:int(11); NOT NULL; DEFAULT:'0'; COMMENT:'24小时尿蛋白'"`
84
+	UrineProtein24hTime time.Time `json:"urine_protein_24h_time" gorm:"type:datetime; COMMENT:'24小时尿蛋白检测时间'"`
85
+	UrineProtein        int       `json:"urine_protein" gorm:"type:int(11); NOT NULL; DEFAULT:'0'; COMMENT:'尿蛋白'"`
86
+	UrineProteinUnit    string    `json:"urine_protein_unit" gorm:"type:varchar(32); COMMENT:'尿蛋白单位(g,mg)'"`
87
+	UrineProteinTime    time.Time `json:"urine_protein_time" gorm:"type:datetime; COMMENT:'尿蛋白检测时间'"`
88
+	Status              int       `json:"status" gorm:"type:int(11); DEFAULT:'1'; COMMENT:'状态(1:有效 0:无效 )'"`
89
+	Ctime               time.Time `json:"ctime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP; COMMENT:'创建时间'"`
90
+	Mtime               time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; COMMENT:'更新时间 '"`
91
+}
92
+
93
+type DicResp struct {
94
+	Type  string `json:"type"`
95
+	Name  string `json:"name"`
96
+	Value int    `json:"value"`
97
+}

+ 5 - 1
routers/router.go View File

27
 			beego.NSNamespace("/api/user",
27
 			beego.NSNamespace("/api/user",
28
 				beego.NSInclude(
28
 				beego.NSInclude(
29
 					&controllers.LoginApiController{},
29
 					&controllers.LoginApiController{},
30
-					&controllers.DeviceApiController{},
30
+					&controllers.UserApiController{},
31
 				),
31
 				),
32
 			),
32
 			),
33
 			beego.NSNamespace("/api/device",
33
 			beego.NSNamespace("/api/device",
34
 				beego.NSInclude(
34
 				beego.NSInclude(
35
 					&controllers.MessageApiControllor{},
35
 					&controllers.MessageApiControllor{},
36
 				)),
36
 				)),
37
+			beego.NSNamespace("/api/sysdic",
38
+				beego.NSInclude(
39
+					&controllers.SysDicApiController{},
40
+				)),
37
 		)
41
 		)
38
 	beego.AddNamespace(ns)
42
 	beego.AddNamespace(ns)
39
 	controllers.ApiControllersRegisterRouters()
43
 	controllers.ApiControllersRegisterRouters()

+ 41 - 0
service/sysdicservice.go View File

1
+package service
2
+
3
+import (
4
+	"strconv"
5
+	"sws_xcx/models"
6
+
7
+	"github.com/jinzhu/gorm"
8
+)
9
+
10
+type SysDicService struct {
11
+	rdb *gorm.DB
12
+	wdb *gorm.DB
13
+}
14
+
15
+func NewSysDicService() *SysDicService {
16
+	dic := &models.SysDictionary{}
17
+	return &SysDicService{
18
+
19
+		rdb: ReadDB().Model(dic),
20
+		wdb: WriteDB().Model(dic),
21
+	}
22
+}
23
+
24
+func (s *SysDicService) GetDicsByType(t string) ([]*models.SysDictionary, error) {
25
+	var dics []*models.SysDictionary
26
+	err := s.rdb.Where("name_en = ? and parent_id>0", t).Scan(&dics).Error
27
+	return dics, err
28
+}
29
+
30
+func (s *SysDicService) Transform(dics []*models.SysDictionary) []*models.DicResp {
31
+	var resps []*models.DicResp
32
+	for _, dic := range dics {
33
+		var resp models.DicResp
34
+		resp.Type = dic.NameEn
35
+		resp.Name = dic.NameCh
36
+		t, _ := strconv.Atoi(dic.Type)
37
+		resp.Value = t
38
+		resps = append(resps, &resp)
39
+	}
40
+	return resps
41
+}

+ 84 - 0
service/userhealthprofileservice.go View File

1
+package service
2
+
3
+import (
4
+	"sws_xcx/models"
5
+
6
+	"github.com/jinzhu/gorm"
7
+)
8
+
9
+type HealthProfileService struct {
10
+	rdb *gorm.DB
11
+	wdb *gorm.DB
12
+}
13
+
14
+func NewUserHealthProfileService() *HealthProfileService {
15
+
16
+	p := &models.UserHealthProfile{}
17
+	return &HealthProfileService{
18
+		rdb: readDb.Model(p),
19
+		wdb: writeDb.Model(p),
20
+	}
21
+}
22
+
23
+func (s *HealthProfileService) GetUserHealthProfileByUserId(userId uint64) (*models.UserHealthProfile, error) {
24
+	p := &models.UserHealthProfile{}
25
+	err := s.rdb.Find(p, "user_id = ?", userId).Error
26
+	return p, err
27
+}
28
+
29
+func (s *HealthProfileService) Get(id uint64) (models.UserHealthProfile, error) {
30
+	p := &models.UserHealthProfile{}
31
+	err := s.rdb.First(p, id).Error
32
+	return *p, err
33
+}
34
+
35
+func (s *HealthProfileService) SavePatientInfo(userId uint64, realName string, idCard string, regPhone string) error {
36
+	p, err := s.GetUserHealthProfileByUserId(userId)
37
+	if err != nil {
38
+		return err
39
+	}
40
+
41
+	if p == nil {
42
+		p = &models.UserHealthProfile{}
43
+	}
44
+
45
+	p.UserId = userId
46
+	p.RealName = realName
47
+	p.InpatientRegPhone = regPhone
48
+	return s.wdb.Save(p).Error
49
+}
50
+
51
+func (s *HealthProfileService) SaveHealthProfile(userId uint64, req models.SaveHealthProfileReq) error {
52
+	p, err := s.GetUserHealthProfileByUserId(userId)
53
+	if err != nil {
54
+		return err
55
+	}
56
+
57
+	if p == nil {
58
+		p = &models.UserHealthProfile{}
59
+	}
60
+
61
+	p.UserId = userId
62
+	p.Birthday = req.Birthday
63
+	p.BloodType = req.BloodType
64
+	p.CreatineTime = req.CreatineTime
65
+	p.Creatinine = req.Creatinine
66
+	p.CreatinineUnit = req.CreatinineUnit
67
+	p.Gender = req.Gender
68
+	p.Height = req.Height
69
+	p.IllnessState = req.IllnessState
70
+	p.RenalFunctionStatus = req.RenalFunctionStatus
71
+	p.UrineProtein = req.UrineProtein
72
+	p.UrineProtein24h = req.UrineProtein24h
73
+	p.UrineProtein24hTime = req.UrineProtein24hTime
74
+	p.UrineProtein24hUnit = req.UrineProtein24hUnit
75
+	p.UrineProteinTime = req.UrineProteinTime
76
+	p.UrineProteinUnit = req.UrineProteinUnit
77
+	p.Weight = req.Weight
78
+
79
+	return s.wdb.Save(p).Error
80
+}
81
+
82
+func (s *HealthProfileService) Save(p *models.UserHealthProfile) error {
83
+	return s.wdb.Save(p).Error
84
+}

+ 11 - 2
service/userservice.go View File

16
 	return &XcxUserService{rdb: readDb.Model(u), wdb: writeDb.Model(u)}
16
 	return &XcxUserService{rdb: readDb.Model(u), wdb: writeDb.Model(u)}
17
 }
17
 }
18
 
18
 
19
+func (s *XcxUserService) GetUser(id uint64) (*models.XcxUser, error) {
20
+
21
+	user := &models.XcxUser{}
22
+	db := readDb.Where("id=?", id).First(user)
23
+
24
+	return user, db.Error
25
+
26
+}
27
+
19
 func (s *XcxUserService) GetOrCreate(openId string, unionId string) (*models.XcxUser, error) {
28
 func (s *XcxUserService) GetOrCreate(openId string, unionId string) (*models.XcxUser, error) {
20
 
29
 
21
 	user := &models.XcxUser{OpenId: openId, UnionId: unionId}
30
 	user := &models.XcxUser{OpenId: openId, UnionId: unionId}
22
-	db := readDb.Model(user).Where("open_id = ?", openId).Or("union_id = ?", unionId).FirstOrCreate(user)
31
+	db := writeDb.Where("open_id = ?", openId).Or("union_id = ?", unionId).FirstOrCreate(user)
23
 
32
 
24
 	return user, db.Error
33
 	return user, db.Error
25
 
34
 
27
 
36
 
28
 func (s *XcxUserService) UpdateUser(user *models.XcxUser) error {
37
 func (s *XcxUserService) UpdateUser(user *models.XcxUser) error {
29
 
38
 
30
-	db := writeDb.Model(user).Where("id = ?", user.Id).Update(user)
39
+	db := writeDb.Where("id = ?", user.Id).Update(user)
31
 
40
 
32
 	return db.Error
41
 	return db.Error
33
 
42
 

+ 1 - 1
service/wxapp.go View File

10
 func init() {
10
 func init() {
11
 
11
 
12
 	appid := beego.AppConfig.String("appid")
12
 	appid := beego.AppConfig.String("appid")
13
-	securet := beego.AppConfig.String("appsecuret")
13
+	securet := beego.AppConfig.String("appsecret")
14
 
14
 
15
 	wxsdk = weapp.NewClient(appid, securet)
15
 	wxsdk = weapp.NewClient(appid, securet)
16
 }
16
 }

+ 434 - 8
swagger/swagger.json View File

11
     },
11
     },
12
     "basePath": "/xcx",
12
     "basePath": "/xcx",
13
     "paths": {
13
     "paths": {
14
-        "/api/user/getphonenumber": {
14
+        "/api/sysdic/getillness": {
15
+            "get": {
16
+                "tags": [
17
+                    "api/sysdic"
18
+                ],
19
+                "description": "获取病情字典\n\u003cbr\u003e",
20
+                "operationId": "SysDicApiController.GetIllness",
21
+                "responses": {
22
+                    "200": {
23
+                        "description": "DicResp success",
24
+                        "schema": {
25
+                            "$ref": "#/definitions/models.type"
26
+                        }
27
+                    },
28
+                    "500": {
29
+                        "description": "error"
30
+                    }
31
+                }
32
+            }
33
+        },
34
+        "/api/sysdic/getrenalstatus": {
35
+            "get": {
36
+                "tags": [
37
+                    "api/sysdic"
38
+                ],
39
+                "description": "获取肾功能情况列表\n\u003cbr\u003e",
40
+                "operationId": "SysDicApiController.GetRenalStatus",
41
+                "responses": {
42
+                    "200": {
43
+                        "description": "DicResp success",
44
+                        "schema": {
45
+                            "$ref": "#/definitions/models.type"
46
+                        }
47
+                    },
48
+                    "500": {
49
+                        "description": "error"
50
+                    }
51
+                }
52
+            }
53
+        },
54
+        "/api/user/gethealthprofile": {
55
+            "get": {
56
+                "tags": [
57
+                    "api/user"
58
+                ],
59
+                "description": "获取健康档案\n\u003cbr\u003e",
60
+                "operationId": "UserApiController.GetHealthProfile",
61
+                "responses": {
62
+                    "200": {
63
+                        "description": "success",
64
+                        "schema": {
65
+                            "$ref": "#/definitions/models.HealthProfileResp"
66
+                        }
67
+                    },
68
+                    "500": {
69
+                        "description": "error"
70
+                    }
71
+                }
72
+            }
73
+        },
74
+        "/api/user/getuserinfo": {
75
+            "get": {
76
+                "tags": [
77
+                    "api/user"
78
+                ],
79
+                "description": "获取个人中心信息\n\u003cbr\u003e",
80
+                "operationId": "UserApiController.GetUserInfo",
81
+                "responses": {
82
+                    "200": {
83
+                        "description": "success",
84
+                        "schema": {
85
+                            "$ref": "#/definitions/models.UserInfoResp"
86
+                        }
87
+                    },
88
+                    "500": {
89
+                        "description": "error"
90
+                    }
91
+                }
92
+            }
93
+        },
94
+        "/api/user/login": {
15
             "post": {
95
             "post": {
16
                 "tags": [
96
                 "tags": [
17
                     "api/user"
97
                     "api/user"
18
                 ],
98
                 ],
19
-                "description": "获取小程序绑定的手机号码\n\u003cbr\u003e",
20
-                "operationId": "LoginApiController.GetPhoneNumber",
99
+                "description": "微信小程序登录\n\u003cbr\u003e",
100
+                "operationId": "LoginApiController.WxXcxLogin",
21
                 "parameters": [
101
                 "parameters": [
22
                     {
102
                     {
23
                         "in": "body",
103
                         "in": "body",
29
                         }
109
                         }
30
                     }
110
                     }
31
                 ],
111
                 ],
112
+                "responses": {
113
+                    "200": {
114
+                        "description": "",
115
+                        "schema": {
116
+                            "$ref": "#/definitions/models.WxXcxLoginResp"
117
+                        }
118
+                    },
119
+                    "500": {
120
+                        "description": "error"
121
+                    }
122
+                }
123
+            }
124
+        },
125
+        "/api/user/savehealthprofile": {
126
+            "post": {
127
+                "tags": [
128
+                    "api/user"
129
+                ],
130
+                "description": "保存健康档案\n\u003cbr\u003e",
131
+                "operationId": "UserApiController.SaveHealthProfile",
132
+                "parameters": [
133
+                    {
134
+                        "in": "body",
135
+                        "name": "body",
136
+                        "description": "小程序登录请求参数",
137
+                        "required": true,
138
+                        "schema": {
139
+                            "$ref": "#/definitions/models.SaveHealthProfileReq"
140
+                        }
141
+                    }
142
+                ],
32
                 "responses": {
143
                 "responses": {
33
                     "200": {
144
                     "200": {
34
                         "description": "success"
145
                         "description": "success"
39
                 }
150
                 }
40
             }
151
             }
41
         },
152
         },
42
-        "/api/user/login": {
153
+        "/api/user/saveuserinfo": {
43
             "post": {
154
             "post": {
44
                 "tags": [
155
                 "tags": [
45
                     "api/user"
156
                     "api/user"
46
                 ],
157
                 ],
47
-                "description": "微信小程序登录\n\u003cbr\u003e",
48
-                "operationId": "LoginApiController.WxXcxLogin",
158
+                "description": "个人中心保存用户信息和透析病友信息\n\u003cbr\u003e",
159
+                "operationId": "UserApiController.SaveUserInfo",
160
+                "parameters": [
161
+                    {
162
+                        "in": "body",
163
+                        "name": "body",
164
+                        "description": "小程序登录请求参数",
165
+                        "required": true,
166
+                        "schema": {
167
+                            "$ref": "#/definitions/models.SaveUserInfoReq"
168
+                        }
169
+                    }
170
+                ],
171
+                "responses": {
172
+                    "200": {
173
+                        "description": "success"
174
+                    },
175
+                    "500": {
176
+                        "description": "error"
177
+                    }
178
+                }
179
+            }
180
+        },
181
+        "/api/user/updatephonebycode": {
182
+            "post": {
183
+                "tags": [
184
+                    "api/user"
185
+                ],
186
+                "description": "获取小程序绑定的手机号码并更新到用户信息\n\u003cbr\u003e",
187
+                "operationId": "UserApiController.UpdatePhoneByCode",
49
                 "parameters": [
188
                 "parameters": [
50
                     {
189
                     {
51
                         "in": "body",
190
                         "in": "body",
59
                 ],
198
                 ],
60
                 "responses": {
199
                 "responses": {
61
                     "200": {
200
                     "200": {
62
-                        "description": "",
201
+                        "description": "success",
63
                         "schema": {
202
                         "schema": {
64
-                            "$ref": "#/definitions/models.WxXcxLoginResp"
203
+                            "$ref": "#/definitions/models.XcxUser"
65
                         }
204
                         }
66
                     },
205
                     },
67
                     "500": {
206
                     "500": {
72
         }
211
         }
73
     },
212
     },
74
     "definitions": {
213
     "definitions": {
214
+        "models.HealthProfileResp": {
215
+            "title": "HealthProfileResp",
216
+            "type": "object",
217
+            "properties": {
218
+                "birthday": {
219
+                    "type": "string",
220
+                    "format": "datetime"
221
+                },
222
+                "blood_type": {
223
+                    "type": "string"
224
+                },
225
+                "creatine_time": {
226
+                    "type": "string",
227
+                    "format": "datetime"
228
+                },
229
+                "creatinine": {
230
+                    "type": "integer",
231
+                    "format": "int64"
232
+                },
233
+                "creatinine_unit": {
234
+                    "type": "string"
235
+                },
236
+                "ctime": {
237
+                    "type": "string",
238
+                    "format": "datetime"
239
+                },
240
+                "gender": {
241
+                    "type": "integer",
242
+                    "format": "int64"
243
+                },
244
+                "height": {
245
+                    "type": "integer",
246
+                    "format": "int64"
247
+                },
248
+                "id": {
249
+                    "type": "integer",
250
+                    "format": "int64"
251
+                },
252
+                "illness_state": {
253
+                    "type": "string"
254
+                },
255
+                "mtime": {
256
+                    "type": "string",
257
+                    "format": "datetime"
258
+                },
259
+                "renal_function_status": {
260
+                    "type": "integer",
261
+                    "format": "int64"
262
+                },
263
+                "status": {
264
+                    "type": "integer",
265
+                    "format": "int64"
266
+                },
267
+                "urine_protein": {
268
+                    "type": "integer",
269
+                    "format": "int64"
270
+                },
271
+                "urine_protein_24h": {
272
+                    "type": "integer",
273
+                    "format": "int64"
274
+                },
275
+                "urine_protein_24h_time": {
276
+                    "type": "string",
277
+                    "format": "datetime"
278
+                },
279
+                "urine_protein_24h_unit": {
280
+                    "type": "string"
281
+                },
282
+                "urine_protein_time": {
283
+                    "type": "string",
284
+                    "format": "datetime"
285
+                },
286
+                "urine_protein_unit": {
287
+                    "type": "string"
288
+                },
289
+                "weight": {
290
+                    "type": "integer",
291
+                    "format": "int64"
292
+                }
293
+            }
294
+        },
295
+        "models.SaveHealthProfileReq": {
296
+            "title": "SaveHealthProfileReq",
297
+            "type": "object",
298
+            "properties": {
299
+                "birthday": {
300
+                    "type": "string",
301
+                    "format": "datetime"
302
+                },
303
+                "blood_type": {
304
+                    "type": "string"
305
+                },
306
+                "creatine_time": {
307
+                    "type": "string",
308
+                    "format": "datetime"
309
+                },
310
+                "creatinine": {
311
+                    "type": "integer",
312
+                    "format": "int64"
313
+                },
314
+                "creatinine_unit": {
315
+                    "type": "string"
316
+                },
317
+                "gender": {
318
+                    "type": "integer",
319
+                    "format": "int64"
320
+                },
321
+                "height": {
322
+                    "type": "integer",
323
+                    "format": "int64"
324
+                },
325
+                "illness_state": {
326
+                    "type": "string"
327
+                },
328
+                "renal_function_status": {
329
+                    "type": "integer",
330
+                    "format": "int64"
331
+                },
332
+                "urine_protein": {
333
+                    "type": "integer",
334
+                    "format": "int64"
335
+                },
336
+                "urine_protein_24h": {
337
+                    "type": "integer",
338
+                    "format": "int64"
339
+                },
340
+                "urine_protein_24h_time": {
341
+                    "type": "string",
342
+                    "format": "datetime"
343
+                },
344
+                "urine_protein_24h_unit": {
345
+                    "type": "string"
346
+                },
347
+                "urine_protein_time": {
348
+                    "type": "string",
349
+                    "format": "datetime"
350
+                },
351
+                "urine_protein_unit": {
352
+                    "type": "string"
353
+                },
354
+                "weight": {
355
+                    "type": "integer",
356
+                    "format": "int64"
357
+                }
358
+            }
359
+        },
360
+        "models.SaveUserInfoReq": {
361
+            "title": "SaveUserInfoReq",
362
+            "type": "object",
363
+            "properties": {
364
+                "avatar": {
365
+                    "type": "string"
366
+                },
367
+                "email": {
368
+                    "type": "string"
369
+                },
370
+                "id_card": {
371
+                    "type": "string"
372
+                },
373
+                "inpatient_reg_phone": {
374
+                    "type": "string"
375
+                },
376
+                "nick_name": {
377
+                    "type": "string"
378
+                },
379
+                "phone": {
380
+                    "type": "string"
381
+                },
382
+                "real_name": {
383
+                    "type": "string"
384
+                }
385
+            }
386
+        },
387
+        "models.UserInfoResp": {
388
+            "title": "UserInfoResp",
389
+            "type": "object",
390
+            "properties": {
391
+                "avatar": {
392
+                    "type": "string"
393
+                },
394
+                "ctime": {
395
+                    "type": "string",
396
+                    "format": "datetime"
397
+                },
398
+                "email": {
399
+                    "type": "string"
400
+                },
401
+                "id": {
402
+                    "type": "integer",
403
+                    "format": "int64"
404
+                },
405
+                "id_card": {
406
+                    "type": "string"
407
+                },
408
+                "inpatient_reg_phone": {
409
+                    "type": "string"
410
+                },
411
+                "mtime": {
412
+                    "type": "string",
413
+                    "format": "datetime"
414
+                },
415
+                "nick_name": {
416
+                    "type": "string"
417
+                },
418
+                "open_id": {
419
+                    "type": "string"
420
+                },
421
+                "phone": {
422
+                    "type": "string"
423
+                },
424
+                "privacy_protocol_versions": {
425
+                    "type": "integer",
426
+                    "format": "int64"
427
+                },
428
+                "real_name": {
429
+                    "type": "string"
430
+                },
431
+                "source": {
432
+                    "type": "string"
433
+                },
434
+                "status": {
435
+                    "type": "integer",
436
+                    "format": "int64"
437
+                },
438
+                "union_id": {
439
+                    "type": "string"
440
+                }
441
+            }
442
+        },
75
         "models.WxXcxLoginReq": {
443
         "models.WxXcxLoginReq": {
76
             "title": "WxXcxLoginReq",
444
             "title": "WxXcxLoginReq",
77
             "type": "object",
445
             "type": "object",
92
                     "type": "string"
460
                     "type": "string"
93
                 }
461
                 }
94
             }
462
             }
463
+        },
464
+        "models.XcxUser": {
465
+            "title": "XcxUser",
466
+            "type": "object",
467
+            "properties": {
468
+                "avatar": {
469
+                    "type": "string"
470
+                },
471
+                "ctime": {
472
+                    "type": "string",
473
+                    "format": "datetime"
474
+                },
475
+                "email": {
476
+                    "type": "string"
477
+                },
478
+                "id": {
479
+                    "type": "integer",
480
+                    "format": "int64"
481
+                },
482
+                "mtime": {
483
+                    "type": "string",
484
+                    "format": "datetime"
485
+                },
486
+                "nick_name": {
487
+                    "type": "string"
488
+                },
489
+                "open_id": {
490
+                    "type": "string"
491
+                },
492
+                "phone": {
493
+                    "type": "string"
494
+                },
495
+                "privacy_protocol_versions": {
496
+                    "type": "integer",
497
+                    "format": "int64"
498
+                },
499
+                "role_type": {
500
+                    "type": "integer",
501
+                    "format": "int64"
502
+                },
503
+                "session_key": {
504
+                    "type": "string"
505
+                },
506
+                "source": {
507
+                    "type": "string"
508
+                },
509
+                "status": {
510
+                    "type": "integer",
511
+                    "format": "int64"
512
+                },
513
+                "union_id": {
514
+                    "type": "string"
515
+                }
516
+            }
517
+        },
518
+        "models.type": {
519
+            "title": "type",
520
+            "type": "object"
95
         }
521
         }
96
     }
522
     }
97
 }
523
 }

+ 314 - 8
swagger/swagger.yml View File

8
     name: 领透科技
8
     name: 领透科技
9
 basePath: /xcx
9
 basePath: /xcx
10
 paths:
10
 paths:
11
-  /api/user/getphonenumber:
11
+  /api/sysdic/getillness:
12
+    get:
13
+      tags:
14
+      - api/sysdic
15
+      description: |-
16
+        获取病情字典
17
+        <br>
18
+      operationId: SysDicApiController.GetIllness
19
+      responses:
20
+        "200":
21
+          description: DicResp success
22
+          schema:
23
+            $ref: '#/definitions/models.type'
24
+        "500":
25
+          description: error
26
+  /api/sysdic/getrenalstatus:
27
+    get:
28
+      tags:
29
+      - api/sysdic
30
+      description: |-
31
+        获取肾功能情况列表
32
+        <br>
33
+      operationId: SysDicApiController.GetRenalStatus
34
+      responses:
35
+        "200":
36
+          description: DicResp success
37
+          schema:
38
+            $ref: '#/definitions/models.type'
39
+        "500":
40
+          description: error
41
+  /api/user/gethealthprofile:
42
+    get:
43
+      tags:
44
+      - api/user
45
+      description: |-
46
+        获取健康档案
47
+        <br>
48
+      operationId: UserApiController.GetHealthProfile
49
+      responses:
50
+        "200":
51
+          description: success
52
+          schema:
53
+            $ref: '#/definitions/models.HealthProfileResp'
54
+        "500":
55
+          description: error
56
+  /api/user/getuserinfo:
57
+    get:
58
+      tags:
59
+      - api/user
60
+      description: |-
61
+        获取个人中心信息
62
+        <br>
63
+      operationId: UserApiController.GetUserInfo
64
+      responses:
65
+        "200":
66
+          description: success
67
+          schema:
68
+            $ref: '#/definitions/models.UserInfoResp'
69
+        "500":
70
+          description: error
71
+  /api/user/login:
12
     post:
72
     post:
13
       tags:
73
       tags:
14
       - api/user
74
       - api/user
15
       description: |-
75
       description: |-
16
-        获取小程序绑定的手机号码
76
+        微信小程序登录
17
         <br>
77
         <br>
18
-      operationId: LoginApiController.GetPhoneNumber
78
+      operationId: LoginApiController.WxXcxLogin
19
       parameters:
79
       parameters:
20
       - in: body
80
       - in: body
21
         name: body
81
         name: body
23
         required: true
83
         required: true
24
         schema:
84
         schema:
25
           $ref: '#/definitions/models.WxXcxLoginReq'
85
           $ref: '#/definitions/models.WxXcxLoginReq'
86
+      responses:
87
+        "200":
88
+          description: ""
89
+          schema:
90
+            $ref: '#/definitions/models.WxXcxLoginResp'
91
+        "500":
92
+          description: error
93
+  /api/user/savehealthprofile:
94
+    post:
95
+      tags:
96
+      - api/user
97
+      description: |-
98
+        保存健康档案
99
+        <br>
100
+      operationId: UserApiController.SaveHealthProfile
101
+      parameters:
102
+      - in: body
103
+        name: body
104
+        description: 小程序登录请求参数
105
+        required: true
106
+        schema:
107
+          $ref: '#/definitions/models.SaveHealthProfileReq'
26
       responses:
108
       responses:
27
         "200":
109
         "200":
28
           description: success
110
           description: success
29
         "500":
111
         "500":
30
           description: error
112
           description: error
31
-  /api/user/login:
113
+  /api/user/saveuserinfo:
32
     post:
114
     post:
33
       tags:
115
       tags:
34
       - api/user
116
       - api/user
35
       description: |-
117
       description: |-
36
-        微信小程序登录
118
+        个人中心保存用户信息和透析病友信息
37
         <br>
119
         <br>
38
-      operationId: LoginApiController.WxXcxLogin
120
+      operationId: UserApiController.SaveUserInfo
121
+      parameters:
122
+      - in: body
123
+        name: body
124
+        description: 小程序登录请求参数
125
+        required: true
126
+        schema:
127
+          $ref: '#/definitions/models.SaveUserInfoReq'
128
+      responses:
129
+        "200":
130
+          description: success
131
+        "500":
132
+          description: error
133
+  /api/user/updatephonebycode:
134
+    post:
135
+      tags:
136
+      - api/user
137
+      description: |-
138
+        获取小程序绑定的手机号码并更新到用户信息
139
+        <br>
140
+      operationId: UserApiController.UpdatePhoneByCode
39
       parameters:
141
       parameters:
40
       - in: body
142
       - in: body
41
         name: body
143
         name: body
45
           $ref: '#/definitions/models.WxXcxLoginReq'
147
           $ref: '#/definitions/models.WxXcxLoginReq'
46
       responses:
148
       responses:
47
         "200":
149
         "200":
48
-          description: ""
150
+          description: success
49
           schema:
151
           schema:
50
-            $ref: '#/definitions/models.WxXcxLoginResp'
152
+            $ref: '#/definitions/models.XcxUser'
51
         "500":
153
         "500":
52
           description: error
154
           description: error
53
 definitions:
155
 definitions:
156
+  models.HealthProfileResp:
157
+    title: HealthProfileResp
158
+    type: object
159
+    properties:
160
+      birthday:
161
+        type: string
162
+        format: datetime
163
+      blood_type:
164
+        type: string
165
+      creatine_time:
166
+        type: string
167
+        format: datetime
168
+      creatinine:
169
+        type: integer
170
+        format: int64
171
+      creatinine_unit:
172
+        type: string
173
+      ctime:
174
+        type: string
175
+        format: datetime
176
+      gender:
177
+        type: integer
178
+        format: int64
179
+      height:
180
+        type: integer
181
+        format: int64
182
+      id:
183
+        type: integer
184
+        format: int64
185
+      illness_state:
186
+        type: string
187
+      mtime:
188
+        type: string
189
+        format: datetime
190
+      renal_function_status:
191
+        type: integer
192
+        format: int64
193
+      status:
194
+        type: integer
195
+        format: int64
196
+      urine_protein:
197
+        type: integer
198
+        format: int64
199
+      urine_protein_24h:
200
+        type: integer
201
+        format: int64
202
+      urine_protein_24h_time:
203
+        type: string
204
+        format: datetime
205
+      urine_protein_24h_unit:
206
+        type: string
207
+      urine_protein_time:
208
+        type: string
209
+        format: datetime
210
+      urine_protein_unit:
211
+        type: string
212
+      weight:
213
+        type: integer
214
+        format: int64
215
+  models.SaveHealthProfileReq:
216
+    title: SaveHealthProfileReq
217
+    type: object
218
+    properties:
219
+      birthday:
220
+        type: string
221
+        format: datetime
222
+      blood_type:
223
+        type: string
224
+      creatine_time:
225
+        type: string
226
+        format: datetime
227
+      creatinine:
228
+        type: integer
229
+        format: int64
230
+      creatinine_unit:
231
+        type: string
232
+      gender:
233
+        type: integer
234
+        format: int64
235
+      height:
236
+        type: integer
237
+        format: int64
238
+      illness_state:
239
+        type: string
240
+      renal_function_status:
241
+        type: integer
242
+        format: int64
243
+      urine_protein:
244
+        type: integer
245
+        format: int64
246
+      urine_protein_24h:
247
+        type: integer
248
+        format: int64
249
+      urine_protein_24h_time:
250
+        type: string
251
+        format: datetime
252
+      urine_protein_24h_unit:
253
+        type: string
254
+      urine_protein_time:
255
+        type: string
256
+        format: datetime
257
+      urine_protein_unit:
258
+        type: string
259
+      weight:
260
+        type: integer
261
+        format: int64
262
+  models.SaveUserInfoReq:
263
+    title: SaveUserInfoReq
264
+    type: object
265
+    properties:
266
+      avatar:
267
+        type: string
268
+      email:
269
+        type: string
270
+      id_card:
271
+        type: string
272
+      inpatient_reg_phone:
273
+        type: string
274
+      nick_name:
275
+        type: string
276
+      phone:
277
+        type: string
278
+      real_name:
279
+        type: string
280
+  models.UserInfoResp:
281
+    title: UserInfoResp
282
+    type: object
283
+    properties:
284
+      avatar:
285
+        type: string
286
+      ctime:
287
+        type: string
288
+        format: datetime
289
+      email:
290
+        type: string
291
+      id:
292
+        type: integer
293
+        format: int64
294
+      id_card:
295
+        type: string
296
+      inpatient_reg_phone:
297
+        type: string
298
+      mtime:
299
+        type: string
300
+        format: datetime
301
+      nick_name:
302
+        type: string
303
+      open_id:
304
+        type: string
305
+      phone:
306
+        type: string
307
+      privacy_protocol_versions:
308
+        type: integer
309
+        format: int64
310
+      real_name:
311
+        type: string
312
+      source:
313
+        type: string
314
+      status:
315
+        type: integer
316
+        format: int64
317
+      union_id:
318
+        type: string
54
   models.WxXcxLoginReq:
319
   models.WxXcxLoginReq:
55
     title: WxXcxLoginReq
320
     title: WxXcxLoginReq
56
     type: object
321
     type: object
65
         type: string
330
         type: string
66
       token:
331
       token:
67
         type: string
332
         type: string
333
+  models.XcxUser:
334
+    title: XcxUser
335
+    type: object
336
+    properties:
337
+      avatar:
338
+        type: string
339
+      ctime:
340
+        type: string
341
+        format: datetime
342
+      email:
343
+        type: string
344
+      id:
345
+        type: integer
346
+        format: int64
347
+      mtime:
348
+        type: string
349
+        format: datetime
350
+      nick_name:
351
+        type: string
352
+      open_id:
353
+        type: string
354
+      phone:
355
+        type: string
356
+      privacy_protocol_versions:
357
+        type: integer
358
+        format: int64
359
+      role_type:
360
+        type: integer
361
+        format: int64
362
+      session_key:
363
+        type: string
364
+      source:
365
+        type: string
366
+      status:
367
+        type: integer
368
+        format: int64
369
+      union_id:
370
+        type: string
371
+  models.type:
372
+    title: type
373
+    type: object