张保健 2 years ago
parent
commit
a19d515953

+ 2 - 2
controllers/dialysis_api_controller.go View File

1348
 	remark := c.GetString("remark")
1348
 	remark := c.GetString("remark")
1349
 	puncture_method := c.GetString("puncture_method")
1349
 	puncture_method := c.GetString("puncture_method")
1350
 
1350
 
1351
-	dialysis_count, _ := c.GetInt64("dialysis_count", 0)
1351
+	dialysis_count:= c.GetString("dialysis_count")
1352
 	emergency_treatment, _ := c.GetInt64("emergency_treatment", 0)
1352
 	emergency_treatment, _ := c.GetInt64("emergency_treatment", 0)
1353
 	emergency_treatment_other := c.GetString("emergency_treatment_other")
1353
 	emergency_treatment_other := c.GetString("emergency_treatment_other")
1354
 	ductus_arantii := c.GetString("ductus_arantii")
1354
 	ductus_arantii := c.GetString("ductus_arantii")
1372
 	ductus_arantii_other := c.GetString("ductus_arantii_other")
1372
 	ductus_arantii_other := c.GetString("ductus_arantii_other")
1373
 	machine_type := c.GetString("machine_type")
1373
 	machine_type := c.GetString("machine_type")
1374
 	puncture_needle := c.GetString("puncture_needle")
1374
 	puncture_needle := c.GetString("puncture_needle")
1375
-	humor_excessive_symptom, _ := c.GetInt64("humor_excessive_symptom", 0)
1375
+	humor_excessive_symptom := c.GetString("humor_excessive_symptom")
1376
 	phinholing := c.GetString("pinholing")
1376
 	phinholing := c.GetString("pinholing")
1377
 
1377
 
1378
 	catheter_suture := c.GetString("catheter_suture")
1378
 	catheter_suture := c.GetString("catheter_suture")

+ 3 - 3
controllers/mobile_api_controllers/check_weight_api_controller.go View File

717
 	if len(sn) > 0 {
717
 	if len(sn) > 0 {
718
 		redis := service.RedisClient()
718
 		redis := service.RedisClient()
719
 		defer redis.Close()
719
 		defer redis.Close()
720
-		redis.Set(sn, 0, 0)
720
+		redis.Set(redis.Context(),sn, 0, 0)
721
 	}
721
 	}
722
 	serviceTime := time.Now().Unix()
722
 	serviceTime := time.Now().Unix()
723
 	c.ServeSuccessJSON(map[string]interface{}{
723
 	c.ServeSuccessJSON(map[string]interface{}{
734
 	redis := service.RedisClient()
734
 	redis := service.RedisClient()
735
 	defer redis.Close()
735
 	defer redis.Close()
736
 	if len(sn) > 0 {
736
 	if len(sn) > 0 {
737
-		syncTimeStr, _ := redis.Get(sn).Result()
737
+		syncTimeStr, _ := redis.Get(redis.Context(),sn).Result()
738
 		syncTime, _ = strconv.ParseInt(syncTimeStr, 10, 64)
738
 		syncTime, _ = strconv.ParseInt(syncTimeStr, 10, 64)
739
 	}
739
 	}
740
 
740
 
741
 	if ftype == 1 {
741
 	if ftype == 1 {
742
 		timeNow := time.Now().Unix()
742
 		timeNow := time.Now().Unix()
743
-		redis.Set(sn, timeNow, 0)
743
+		redis.Set(redis.Context(),sn, timeNow, 0)
744
 	}
744
 	}
745
 
745
 
746
 	adminUserInfo := c.GetMobileAdminUserInfo()
746
 	adminUserInfo := c.GetMobileAdminUserInfo()

+ 5 - 5
controllers/mobile_api_controllers/dialysis_api_controller.go View File

88
 
88
 
89
 	// cur_date := time.Now().Format("2006-01-02")
89
 	// cur_date := time.Now().Format("2006-01-02")
90
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
90
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
91
-	scheduals_json_str, _ := redis.Get(key).Result()
91
+	scheduals_json_str, _ := redis.Get(redis.Context(),key).Result()
92
 
92
 
93
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
93
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
94
 		scheduals, err := service.MobileGetDialysisScheduals(orgID, date.Unix(), schedualType)
94
 		scheduals, err := service.MobileGetDialysisScheduals(orgID, date.Unix(), schedualType)
102
 				//缓存数据
102
 				//缓存数据
103
 				scheduals_json, err := json.Marshal(scheduals)
103
 				scheduals_json, err := json.Marshal(scheduals)
104
 				if err == nil {
104
 				if err == nil {
105
-					redis.Set(key, scheduals_json, time.Second*60)
105
+					redis.Set(redis.Context(),key, scheduals_json, time.Second*60)
106
 				}
106
 				}
107
 			}
107
 			}
108
 
108
 
148
 	// cur_date := time.Now().Format("2006-01-02")
148
 	// cur_date := time.Now().Format("2006-01-02")
149
 	key := "wait_scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
149
 	key := "wait_scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
150
 
150
 
151
-	wait_scheduals, _ := redis.Get(key).Result()
151
+	wait_scheduals, _ := redis.Get(redis.Context(),key).Result()
152
 
152
 
153
 	if len(wait_scheduals) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
153
 	if len(wait_scheduals) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
154
 		scheduals, err := service.MobileGetWaitingScheduals(orgID, date.Unix())
154
 		scheduals, err := service.MobileGetWaitingScheduals(orgID, date.Unix())
165
 				//缓存数据
165
 				//缓存数据
166
 				wait_scheduals_json, err := json.Marshal(scheduals)
166
 				wait_scheduals_json, err := json.Marshal(scheduals)
167
 				if err == nil {
167
 				if err == nil {
168
-					redis.Set(key, wait_scheduals_json, time.Second*30)
168
+					redis.Set(redis.Context(),key, wait_scheduals_json, time.Second*30)
169
 				}
169
 				}
170
 			}
170
 			}
171
 
171
 
3293
 		//缓存数据
3293
 		//缓存数据
3294
 		scheduals_json, err := json.Marshal(scheduals)
3294
 		scheduals_json, err := json.Marshal(scheduals)
3295
 		if err == nil {
3295
 		if err == nil {
3296
-			redis.Set(key, scheduals_json, time.Second*30)
3296
+			redis.Set(redis.Context(),key, scheduals_json, time.Second*30)
3297
 		}
3297
 		}
3298
 	}
3298
 	}
3299
 	this.ServeSuccessJSON(map[string]interface{}{
3299
 	this.ServeSuccessJSON(map[string]interface{}{

+ 2 - 2
controllers/mobile_api_controllers/mobile_api_base_controller.go View File

125
 
125
 
126
 			//redis key值
126
 			//redis key值
127
 			key := "purviews_" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + strconv.FormatInt(adminUserInfo.AdminUser.Id, 10)
127
 			key := "purviews_" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + strconv.FormatInt(adminUserInfo.AdminUser.Id, 10)
128
-			purviews_json_str, _ := redis.Get(key).Result()
128
+			purviews_json_str, _ := redis.Get(redis.Context(),key).Result()
129
 			//获取该用户下所有角色的权限总集
129
 			//获取该用户下所有角色的权限总集
130
 			var userRolePurviews string
130
 			var userRolePurviews string
131
 			var userRolePurviewsArr []string
131
 			var userRolePurviewsArr []string
149
 				//缓存数据
149
 				//缓存数据
150
 				purview_json, err := json.Marshal(userRolePurviewsArr)
150
 				purview_json, err := json.Marshal(userRolePurviewsArr)
151
 				if err == nil {
151
 				if err == nil {
152
-					redis.Set(key, purview_json, time.Minute*60*60*24)
152
+					redis.Set(redis.Context(),key, purview_json, time.Minute*60*60*24)
153
 				}
153
 				}
154
 			} else {
154
 			} else {
155
 				var dat []string
155
 				var dat []string

+ 3 - 3
controllers/mobile_api_controllers/patient_api_controller.go View File

2043
 
2043
 
2044
 	if dataBody["dialysis_count"] != nil && reflect.TypeOf(dataBody["dialysis_count"]).String() == "string" {
2044
 	if dataBody["dialysis_count"] != nil && reflect.TypeOf(dataBody["dialysis_count"]).String() == "string" {
2045
 		dialysis_count, _ := dataBody["dialysis_count"].(string)
2045
 		dialysis_count, _ := dataBody["dialysis_count"].(string)
2046
-		count, _ := strconv.ParseInt(dialysis_count, 10, 64)
2047
-		evaluation.DialysisCount = count
2046
+		// count, _ := strconv.ParseInt(dialysis_count, 10, 64)
2047
+		evaluation.DialysisCount = dialysis_count
2048
 	}
2048
 	}
2049
 
2049
 
2050
 	if dataBody["is_infect"] != nil && reflect.TypeOf(dataBody["is_infect"]).String() == "string" {
2050
 	if dataBody["is_infect"] != nil && reflect.TypeOf(dataBody["is_infect"]).String() == "string" {
2085
 	}
2085
 	}
2086
 
2086
 
2087
 	if dataBody["humor_excessive_symptom"] != nil && reflect.TypeOf(dataBody["humor_excessive_symptom"]).String() == "float64" {
2087
 	if dataBody["humor_excessive_symptom"] != nil && reflect.TypeOf(dataBody["humor_excessive_symptom"]).String() == "float64" {
2088
-		humor_excessive_symptom := int64(dataBody["humor_excessive_symptom"].(float64))
2088
+		humor_excessive_symptom := dataBody["humor_excessive_symptom"].(string)
2089
 		evaluation.HumorExcessiveSymptom = humor_excessive_symptom
2089
 		evaluation.HumorExcessiveSymptom = humor_excessive_symptom
2090
 	}
2090
 	}
2091
 
2091
 

+ 1 - 1
controllers/mobile_api_controllers/qiniiu_api_controller.go View File

14
 	redisClient := service.RedisClient()
14
 	redisClient := service.RedisClient()
15
 	defer redisClient.Close()
15
 	defer redisClient.Close()
16
 
16
 
17
-	token, err := redisClient.Get("qn_token").Result()
17
+	token, err := redisClient.Get(redisClient.Context(),"qn_token").Result()
18
 	if err != nil {
18
 	if err != nil {
19
 		defer fmt.Println(err)
19
 		defer fmt.Println(err)
20
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGetQiniuUpToken)
20
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGetQiniuUpToken)

+ 2 - 2
controllers/new_mobile_api_controllers/forget_password_controller.go View File

40
 		// 修改成功后验证码就要使其失效
40
 		// 修改成功后验证码就要使其失效
41
 		redisClient := service.RedisClient()
41
 		redisClient := service.RedisClient()
42
 		defer redisClient.Close()
42
 		defer redisClient.Close()
43
-		redisClient.Del("code_msg_" + mobile)
43
+		redisClient.Del(redisClient.Context(),"code_msg_" + mobile)
44
 
44
 
45
 		ip := utils.GetIP(this.Ctx.Request)
45
 		ip := utils.GetIP(this.Ctx.Request)
46
 		ssoDomain := beego.AppConfig.String("sso_domain")
46
 		ssoDomain := beego.AppConfig.String("sso_domain")
252
 	}
252
 	}
253
 	redisClient := service.RedisClient()
253
 	redisClient := service.RedisClient()
254
 	defer redisClient.Close()
254
 	defer redisClient.Close()
255
-	cache_code, _ := redisClient.Get("code_msg_" + mobile).Result()
255
+	cache_code, _ := redisClient.Get(redisClient.Context(),"code_msg_" + mobile).Result()
256
 	if cache_code != code {
256
 	if cache_code != code {
257
 		return &enums.SGJError{Code: enums.ErrorCodeVerificationCodeWrong}
257
 		return &enums.SGJError{Code: enums.ErrorCodeVerificationCodeWrong}
258
 	}
258
 	}

+ 2 - 2
controllers/new_mobile_api_controllers/home_api_controller.go View File

634
 		// 修改成功后验证码就要使其失效
634
 		// 修改成功后验证码就要使其失效
635
 		redisClient := service.RedisClient()
635
 		redisClient := service.RedisClient()
636
 		defer redisClient.Close()
636
 		defer redisClient.Close()
637
-		redisClient.Del("code_msg_" + mobile)
637
+		redisClient.Del(redisClient.Context(),"code_msg_" + mobile)
638
 		this.ServeSuccessJSON(map[string]interface{}{
638
 		this.ServeSuccessJSON(map[string]interface{}{
639
 			"admin": adminUser,
639
 			"admin": adminUser,
640
 		})
640
 		})
657
 	}
657
 	}
658
 	redisClient := service.RedisClient()
658
 	redisClient := service.RedisClient()
659
 	defer redisClient.Close()
659
 	defer redisClient.Close()
660
-	cache_code, _ := redisClient.Get("code_msg_" + mobile).Result()
660
+	cache_code, _ := redisClient.Get(redisClient.Context(),"code_msg_" + mobile).Result()
661
 	if cache_code != code {
661
 	if cache_code != code {
662
 		return &enums.SGJError{Code: enums.ErrorCodeVerificationCodeWrong}
662
 		return &enums.SGJError{Code: enums.ErrorCodeVerificationCodeWrong}
663
 	}
663
 	}

+ 2 - 2
controllers/new_mobile_api_controllers/mobile_regist_controller.go View File

74
 
74
 
75
 		redisClient := service.RedisClient()
75
 		redisClient := service.RedisClient()
76
 		defer redisClient.Close()
76
 		defer redisClient.Close()
77
-		cache_code, _ := redisClient.Get("code_msg_" + mobile).Result()
77
+		cache_code, _ := redisClient.Get(redisClient.Context(),"code_msg_" + mobile).Result()
78
 		if cache_code != code {
78
 		if cache_code != code {
79
 			//this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeVerificationCodeWrong)
79
 			//this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeVerificationCodeWrong)
80
 			//this.ServeJSON()
80
 			//this.ServeJSON()
90
 			this.Ctx.SetCookie("mobile", mobile)
90
 			this.Ctx.SetCookie("mobile", mobile)
91
 			this.SetSession("mobile_admin_user", admin)
91
 			this.SetSession("mobile_admin_user", admin)
92
 			// 注册成功后验证码就要使其失效
92
 			// 注册成功后验证码就要使其失效
93
-			redisClient.Del("code_msg_" + mobile)
93
+			redisClient.Del(redisClient.Context(),"code_msg_" + mobile)
94
 
94
 
95
 			this.Data["json"] = enums.MakeSuccessResponseJSON(map[string]interface{}{
95
 			this.Data["json"] = enums.MakeSuccessResponseJSON(map[string]interface{}{
96
 				"result": true,
96
 				"result": true,

+ 2 - 2
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go View File

20
 	req := this.Ctx.Request
20
 	req := this.Ctx.Request
21
 	addr := utils.GetIP(req)
21
 	addr := utils.GetIP(req)
22
 	cur_time := time.Now().Format("2006-01-02")
22
 	cur_time := time.Now().Format("2006-01-02")
23
-	_, err := redisClient.Get("ip:host_" + cur_time + "_" + addr).Result()
23
+	_, err := redisClient.Get(redisClient.Context(),"ip:host_" + cur_time + "_" + addr).Result()
24
 	if err != nil {
24
 	if err != nil {
25
-		redisClient.Set("ip:host_"+cur_time+"_"+addr, 0, time.Second*24*60*60)
25
+		redisClient.Set(redisClient.Context(),"ip:host_"+cur_time+"_"+addr, 0, time.Second*24*60*60)
26
 	}
26
 	}
27
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
27
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
28
 	aespass := utils.AESEncrypt(addr)
28
 	aespass := utils.AESEncrypt(addr)

+ 4 - 4
controllers/new_mobile_api_controllers/new_login_api_controller.go View File

136
 	req := this.Ctx.Request
136
 	req := this.Ctx.Request
137
 	addr := utils.GetIP(req)
137
 	addr := utils.GetIP(req)
138
 	cur_time := time.Now().Format("2006-01-02")
138
 	cur_time := time.Now().Format("2006-01-02")
139
-	_, err := redisClient.Get("ip:host_" + cur_time + "_" + addr).Result()
139
+	_, err := redisClient.Get(redisClient.Context(),"ip:host_" + cur_time + "_" + addr).Result()
140
 	if err != nil {
140
 	if err != nil {
141
-		redisClient.Set("ip:host_"+cur_time+"_"+addr, 0, time.Second*24*60*60)
141
+		redisClient.Set(redisClient.Context(),"ip:host_"+cur_time+"_"+addr, 0, time.Second*24*60*60)
142
 	}
142
 	}
143
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
143
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
144
 	aespass := utils.AESEncrypt(addr)
144
 	aespass := utils.AESEncrypt(addr)
378
 
378
 
379
 		redisClient := service.RedisClient()
379
 		redisClient := service.RedisClient()
380
 		defer redisClient.Close()
380
 		defer redisClient.Close()
381
-		cachedCode, err := redisClient.Get("code_msg_" + mobile).Result()
381
+		cachedCode, err := redisClient.Get(redisClient.Context(),"code_msg_" + mobile).Result()
382
 
382
 
383
 		if err != nil {
383
 		if err != nil {
384
 			this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeAccountOrVerCodeWrong)
384
 			this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeAccountOrVerCodeWrong)
486
 						TemplateInfo: &templateInfo,
486
 						TemplateInfo: &templateInfo,
487
 					}
487
 					}
488
 					this.SetSession("mobile_admin_user_info", mobileAdminUserInfo)
488
 					this.SetSession("mobile_admin_user_info", mobileAdminUserInfo)
489
-					redisClient.Del("code_msg_" + mobile)
489
+					redisClient.Del(redisClient.Context(),"code_msg_" + mobile)
490
 
490
 
491
 					mobile = mobile + "-" + strconv.FormatInt(org.Id, 10) + "-" + strconv.FormatInt(appRole.Id, 10)
491
 					mobile = mobile + "-" + strconv.FormatInt(org.Id, 10) + "-" + strconv.FormatInt(appRole.Id, 10)
492
 					token := utils.GenerateLoginToken(mobile)
492
 					token := utils.GenerateLoginToken(mobile)

+ 1 - 1
controllers/new_mobile_api_controllers/new_role_api_controller.go View File

568
 	users := service.GetAllUserRole(adminUser.Org.Id)
568
 	users := service.GetAllUserRole(adminUser.Org.Id)
569
 	for _, item := range users {
569
 	for _, item := range users {
570
 		key := "purviews_" + strconv.FormatInt(adminUser.Org.Id, 10) + strconv.FormatInt(item.AdminUserId, 10)
570
 		key := "purviews_" + strconv.FormatInt(adminUser.Org.Id, 10) + strconv.FormatInt(item.AdminUserId, 10)
571
-		redis.Set(key, "", time.Second)
571
+		redis.Set(redis.Context(),key, "", time.Second)
572
 	}
572
 	}
573
 
573
 
574
 	if err != nil {
574
 	if err != nil {

+ 1 - 1
controllers/patient_api_controller.go View File

413
 
413
 
414
 	redis := service.RedisClient()
414
 	redis := service.RedisClient()
415
 	defer redis.Close()
415
 	defer redis.Close()
416
-	redis.SAdd("sgj_patient:new_user_set", patient.UserId)
416
+	redis.SAdd(redis.Context(),"sgj_patient:new_user_set", patient.UserId)
417
 
417
 
418
 	c.ServeSuccessJSON(map[string]interface{}{
418
 	c.ServeSuccessJSON(map[string]interface{}{
419
 		"msg": "ok",
419
 		"msg": "ok",

+ 1 - 1
controllers/qiniiu_api_controller.go View File

21
 	redisClient := service.RedisClient()
21
 	redisClient := service.RedisClient()
22
 	defer redisClient.Close()
22
 	defer redisClient.Close()
23
 
23
 
24
-	token, err := redisClient.Get("qn_token").Result()
24
+	token, err := redisClient.Get(redisClient.Context(),"qn_token").Result()
25
 	fmt.Print("token------------------------------------", token)
25
 	fmt.Print("token------------------------------------", token)
26
 	if err != nil {
26
 	if err != nil {
27
 		defer fmt.Println(err)
27
 		defer fmt.Println(err)

+ 3 - 3
controllers/role_controller.go View File

750
 	users := service.GetAllUserRole(adminUserInfo.CurrentOrgId)
750
 	users := service.GetAllUserRole(adminUserInfo.CurrentOrgId)
751
 	for _, item := range users {
751
 	for _, item := range users {
752
 		key := "purviews_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + strconv.FormatInt(item.AdminUserId, 10)
752
 		key := "purviews_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + strconv.FormatInt(item.AdminUserId, 10)
753
-		redis.Set(key, "", time.Second)
753
+		redis.Set(redis.Context(),key, "", time.Second)
754
 	}
754
 	}
755
 
755
 
756
 	err := service.SaveRolePurviewIds(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, roleId, purviewIds)
756
 	err := service.SaveRolePurviewIds(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, roleId, purviewIds)
898
 
898
 
899
 	redisClient := service.RedisClient()
899
 	redisClient := service.RedisClient()
900
 	defer redisClient.Close()
900
 	defer redisClient.Close()
901
-	qntoken, _ := redisClient.Get("qn_token").Result()
901
+	qntoken, _ := redisClient.Get(redisClient.Context(),"qn_token").Result()
902
 
902
 
903
 	this.ServeSuccessJSON(map[string]interface{}{
903
 	this.ServeSuccessJSON(map[string]interface{}{
904
 		"roles":           roles,
904
 		"roles":           roles,
1108
 
1108
 
1109
 	redisClient := service.RedisClient()
1109
 	redisClient := service.RedisClient()
1110
 	defer redisClient.Close()
1110
 	defer redisClient.Close()
1111
-	qntoken, _ := redisClient.Get("qn_token").Result()
1111
+	qntoken, _ := redisClient.Get(redisClient.Context(),"qn_token").Result()
1112
 
1112
 
1113
 	this.ServeSuccessJSON(map[string]interface{}{
1113
 	this.ServeSuccessJSON(map[string]interface{}{
1114
 		"admin":           appRole,
1114
 		"admin":           appRole,

+ 1 - 1
controllers/schedule_api_controller.go View File

370
 	err = service.CreateSchedule(&schedule)
370
 	err = service.CreateSchedule(&schedule)
371
 
371
 
372
 	key := "scheduals_" + scheduleDate + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
372
 	key := "scheduals_" + scheduleDate + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
373
-	redis.Set(key, "", time.Second)
373
+	redis.Set(redis.Context(),key, "", time.Second)
374
 
374
 
375
 	fmt.Println(err)
375
 	fmt.Println(err)
376
 	if err != nil {
376
 	if err != nil {

+ 2 - 2
controllers/verify_login_controller.go View File

408
 
408
 
409
 	redisClient := service.RedisClient()
409
 	redisClient := service.RedisClient()
410
 	defer redisClient.Close()
410
 	defer redisClient.Close()
411
-	cachedCode, err := redisClient.Get("xt_modify_pwd_" + mobile).Result()
411
+	cachedCode, err := redisClient.Get(redisClient.Context(),"xt_modify_pwd_" + mobile).Result()
412
 	if err != nil {
412
 	if err != nil {
413
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAccountOrVerCodeWrong)
413
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAccountOrVerCodeWrong)
414
 		return
414
 		return
425
 	}
425
 	}
426
 
426
 
427
 	// 清除验证码
427
 	// 清除验证码
428
-	redisClient.Del("xt_modify_pwd_" + mobile)
428
+	redisClient.Del(redisClient.Context(),"xt_modify_pwd_" + mobile)
429
 	this.ServeSuccessJSON(map[string]interface{}{
429
 	this.ServeSuccessJSON(map[string]interface{}{
430
 		"msg": "密码已修改",
430
 		"msg": "密码已修改",
431
 	})
431
 	})

+ 82 - 5
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go View File

19
 	//获取验证码
19
 	//获取验证码
20
 	beego.Router("/xcx/api/mobile/code", &XcxApiController{}, "Get:GetCodeInfo")
20
 	beego.Router("/xcx/api/mobile/code", &XcxApiController{}, "Get:GetCodeInfo")
21
 	//用户绑定
21
 	//用户绑定
22
-	beego.Router("/xcx/api/mobile/register", &XcxApiController{}, "Get:GetUserRegister")
22
+	beego.Router("/xcx/api/mobile/register", &XcxApiController{}, "Get:GetUserNameRegister")
23
 	//登录
23
 	//登录
24
 	beego.Router("/xcx/api/mobile/login", &XcxApiController{}, "Get:GetLoginInfor")
24
 	beego.Router("/xcx/api/mobile/login", &XcxApiController{}, "Get:GetLoginInfor")
25
 
25
 
80
 	req := this.Ctx.Request
80
 	req := this.Ctx.Request
81
 	addr := utils.GetIP(req)
81
 	addr := utils.GetIP(req)
82
 	cur_time := time.Now().Format("2006-01-02")
82
 	cur_time := time.Now().Format("2006-01-02")
83
-	_, err := redisClient.Get("ip:host_" + cur_time + "_" + addr).Result()
83
+	_, err := redisClient.Get(redisClient.Context(),"ip:host_" + cur_time + "_" + addr).Result()
84
 	if err != nil {
84
 	if err != nil {
85
-		redisClient.Set("ip:host_"+cur_time+"_"+addr, 0, time.Second*24*60*60)
85
+		redisClient.Set(redisClient.Context(),"ip:host_"+cur_time+"_"+addr, 0, time.Second*24*60*60)
86
 	}
86
 	}
87
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
87
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
88
 	aespass := utils.AESEncrypt(addr)
88
 	aespass := utils.AESEncrypt(addr)
94
 
94
 
95
 }
95
 }
96
 
96
 
97
+func (this *XcxApiController) GetUserNameRegister() {
98
+	name := this.GetString("name")
99
+	id_card_no := this.GetString("id_card_no")
100
+	mobile := this.GetString("mobile")
101
+	patient, errcodes := service.GetNamePatient(name, id_card_no)
102
+	if errcodes == nil {
103
+		role := models.XcxAdminUserRole{
104
+			PatientName: name,
105
+			IdCardNo:    id_card_no,
106
+			Mobile:      mobile,
107
+			Code:        "000000",
108
+			PatientId:   patient.ID,
109
+			UserOrgId:   patient.UserOrgId,
110
+			Status:      1,
111
+			Ctime:       time.Now().Unix(),
112
+			Mtime:       0,
113
+			Appid:       "",
114
+			Appsecret:   "",
115
+			SessionKey:  "",
116
+		}
117
+		err := service.CreateXcxAdminUser(role)
118
+		if err == nil {
119
+			mobilePatient, _ := service.GetNamePatient(name, id_card_no)
120
+			template_id, _ := service.GetTemplateMode(mobilePatient.UserOrgId)
121
+				//处方
122
+			prescripition_config, _ := service.GetPrescripionFieldConfig(mobilePatient.UserOrgId)
123
+
124
+				//接诊评估
125
+			receive_treatement_config, _ := service.GetReceiveTreatmentAssess(mobilePatient.UserOrgId)
126
+
127
+				//透前评估
128
+			dialysis_befor, _ := service.GetDialysisBefor(mobilePatient.UserOrgId)
129
+
130
+				//透析上机
131
+			dialysis_order, _ := service.GetDialysisOrderConfig(mobilePatient.UserOrgId)
132
+
133
+				//透析监测
134
+			monitor_record, _ := service.GetMonitorRecordConfig(mobilePatient.UserOrgId)
135
+
136
+				//透后评估
137
+			dialysis_after, _ := service.GetDialysisAfeterConfig(mobilePatient.UserOrgId)
138
+
139
+			treate_ment, _ := service.GetTreatMentConfig(mobilePatient.UserOrgId)
140
+			var configList interface{}
141
+			configList, _ = service.GetConfigList(mobilePatient.UserOrgId)
142
+			this.ServeSuccessJSON(map[string]interface{}{
143
+					"role":                      role,
144
+					"is_bind":                   true,
145
+					"patient":                   mobilePatient,
146
+					"template_id":               template_id,
147
+					"user_org_id":               mobilePatient.UserOrgId,
148
+					"prescripition_config":      prescripition_config,
149
+					"receive_treatement_config": receive_treatement_config,
150
+					"dialysis_befor":            dialysis_befor,
151
+					"dialysis_order":            dialysis_order,
152
+					"monitor_record":            monitor_record,
153
+					"dialysis_after":            dialysis_after,
154
+					"treate_ment":               treate_ment,
155
+					"configList":                configList,
156
+					"result":                    false,
157
+			})
158
+		} else {
159
+			this.ServeSuccessJSON(map[string]interface{}{
160
+				"is_bind": false,
161
+				"msg":     "绑定失败",
162
+				"result":  false,
163
+			})
164
+		}
165
+	} else {
166
+		this.ServeSuccessJSON(map[string]interface{}{
167
+			"is_bind": false,
168
+			"msg":     "绑定失败",
169
+			"result":  false,
170
+		})
171
+	}
172
+}
173
+
97
 func (this *XcxApiController) GetUserRegister() {
174
 func (this *XcxApiController) GetUserRegister() {
98
 
175
 
99
 	//用户绑定
176
 	//用户绑定
230
 	} else {
307
 	} else {
231
 		redisClient := service.RedisClient()
308
 		redisClient := service.RedisClient()
232
 		defer redisClient.Close()
309
 		defer redisClient.Close()
233
-		cache_code, _ := redisClient.Get("code_msg_" + mobile).Result()
310
+		cache_code, _ := redisClient.Get(redisClient.Context(),"code_msg_" + mobile).Result()
234
 		fmt.Println("cache_code9999999293323232322323", cache_code)
311
 		fmt.Println("cache_code9999999293323232322323", cache_code)
235
 		if cache_code != code {
312
 		if cache_code != code {
236
 			this.ServeSuccessJSON(map[string]interface{}{
313
 			this.ServeSuccessJSON(map[string]interface{}{
240
 		} else {
317
 		} else {
241
 			this.Ctx.SetCookie("mobile", mobile)
318
 			this.Ctx.SetCookie("mobile", mobile)
242
 			// 注册成功后验证码就要使其失效
319
 			// 注册成功后验证码就要使其失效
243
-			redisClient.Del("code_msg_" + mobile)
320
+			redisClient.Del(redisClient.Context(),"code_msg_" + mobile)
244
 			patient, errcodes := service.GetMobilePatient(mobile, id_card_no)
321
 			patient, errcodes := service.GetMobilePatient(mobile, id_card_no)
245
 			fmt.Println("errcodes2323232232", errcodes)
322
 			fmt.Println("errcodes2323232232", errcodes)
246
 			if errcodes == nil {
323
 			if errcodes == nil {

+ 0 - 5
main.go View File

11
 }
11
 }
12
 
12
 
13
 func main() {
13
 func main() {
14
-	//service.BeginAutoCreateWeekSchedulesJob()
15
-	//service.BeginAutoCreateWeekDisinfectionJob()
16
-	//service.BeginAutoCreatePlanJob()
17
-	//service.AutoClearSchedules()
18
-	//service.BeginAutoCreateStaffScheduleJob()
19
 	beego.BConfig.WebConfig.Session.SessionGCMaxLifetime = 60
14
 	beego.BConfig.WebConfig.Session.SessionGCMaxLifetime = 60
20
 	beego.Run()
15
 	beego.Run()
21
 }
16
 }

+ 2 - 2
models/dialysis.go View File

287
 	DuctusArantii                  string  `gorm:"column:ductus_arantii" json:"ductus_arantii"`
287
 	DuctusArantii                  string  `gorm:"column:ductus_arantii" json:"ductus_arantii"`
288
 	EmergencyTreatment             int64   `gorm:"column:emergency_treatment" json:"emergency_treatment"`
288
 	EmergencyTreatment             int64   `gorm:"column:emergency_treatment" json:"emergency_treatment"`
289
 	EmergencyTreatmentOther        string  `gorm:"column:emergency_treatment_other" json:"emergency_treatment_other"`
289
 	EmergencyTreatmentOther        string  `gorm:"column:emergency_treatment_other" json:"emergency_treatment_other"`
290
-	DialysisCount                  int64   `gorm:"column:dialysis_count" json:"dialysis_count"`
290
+	DialysisCount                  string   `gorm:"column:dialysis_count" json:"dialysis_count"`
291
 	AssessmentDoctor               int64   `gorm:"column:assessment_doctor" json:"assessment_doctor"`
291
 	AssessmentDoctor               int64   `gorm:"column:assessment_doctor" json:"assessment_doctor"`
292
 	AssessmentTime                 int64   `gorm:"column:assessment_time" json:"assessment_time"`
292
 	AssessmentTime                 int64   `gorm:"column:assessment_time" json:"assessment_time"`
293
 	MachineType                    string  `gorm:"column:machine_type" json:"machine_type"`
293
 	MachineType                    string  `gorm:"column:machine_type" json:"machine_type"`
301
 	LastPostDialysisOther          string  `gorm:"column:last_post_dialysis_other" json:"last_post_dialysis_other"`
301
 	LastPostDialysisOther          string  `gorm:"column:last_post_dialysis_other" json:"last_post_dialysis_other"`
302
 	SymptomBeforeDialysisOther     string  `gorm:"column:symptom_before_dialysis_other" json:"symptom_before_dialysis_other"`
302
 	SymptomBeforeDialysisOther     string  `gorm:"column:symptom_before_dialysis_other" json:"symptom_before_dialysis_other"`
303
 	DialysisInterphaseOther        string  `gorm:"column:dialysis_interphase_other" json:"dialysis_interphase_other"`
303
 	DialysisInterphaseOther        string  `gorm:"column:dialysis_interphase_other" json:"dialysis_interphase_other"`
304
-	HumorExcessiveSymptom          int64   `gorm:"column:humor_excessive_symptom" json:"humor_excessive_symptom"`
304
+	HumorExcessiveSymptom          string   `gorm:"column:humor_excessive_symptom" json:"humor_excessive_symptom"`
305
 	Phinholing                     string  `gorm:"column:pinholing" json:"pinholing" form:"pinholing"`
305
 	Phinholing                     string  `gorm:"column:pinholing" json:"pinholing" form:"pinholing"`
306
 	CatheterSuture                 string  `gorm:"column:catheter_suture" json:"catheter_suture" form:"catheter_suture"`
306
 	CatheterSuture                 string  `gorm:"column:catheter_suture" json:"catheter_suture" form:"catheter_suture"`
307
 	CatheterSutureOther            string  `gorm:"column:catheter_suture_other" json:"catheter_suture_other" form:"catheter_suture_other"`
307
 	CatheterSutureOther            string  `gorm:"column:catheter_suture_other" json:"catheter_suture_other" form:"catheter_suture_other"`

+ 1 - 0
service/auto_create_stock.go View File

18
 	//spec := "0 55 23 * * ?" // 每天23点55执行一次
18
 	//spec := "0 55 23 * * ?" // 每天23点55执行一次
19
 	//spec := "0 0 0 ? * Sun"
19
 	//spec := "0 0 0 ? * Sun"
20
 	createStockCronJob.AddFunc(spec, func() {
20
 	createStockCronJob.AddFunc(spec, func() {
21
+		utils.InfoLog("开启自动更新耗材库存定时任务1111111111111")
21
 		AutoCreateStockJob()
22
 		AutoCreateStockJob()
22
 	})
23
 	})
23
 }
24
 }

+ 5 - 5
service/new_sms_service.go View File

50
 		redisClient := RedisClient()
50
 		redisClient := RedisClient()
51
 		defer redisClient.Close()
51
 		defer redisClient.Close()
52
 		cur_date := time.Now().Format("2006-01-02")
52
 		cur_date := time.Now().Format("2006-01-02")
53
-		redisClient.Set("code_msg_"+mobile, code_str, time.Minute*10)
54
-		redisClient.Incr("code_msg_" + mobile + "_" + cur_date).Result()
53
+		redisClient.Set(redisClient.Context(),"code_msg_"+mobile, code_str, time.Minute*10)
54
+		redisClient.Incr(redisClient.Context(),"code_msg_" + mobile + "_" + cur_date).Result()
55
 		// 取出地址信息,因为上面已经验证过,这里就直接解密而不做错误判断了
55
 		// 取出地址信息,因为上面已经验证过,这里就直接解密而不做错误判断了
56
 		bytesPass, _ := base64.StdEncoding.DecodeString(aespass)
56
 		bytesPass, _ := base64.StdEncoding.DecodeString(aespass)
57
 		tpass := utils.AESDecrypt(bytesPass)
57
 		tpass := utils.AESDecrypt(bytesPass)
58
-		redisClient.Incr("ip:host_" + cur_date + "_" + tpass).Result()
58
+		redisClient.Incr(redisClient.Context(),"ip:host_" + cur_date + "_" + tpass).Result()
59
 	}
59
 	}
60
 	return err
60
 	return err
61
 }
61
 }
73
 	}
73
 	}
74
 
74
 
75
 	cur_date := time.Now().Format("2006-01-02")
75
 	cur_date := time.Now().Format("2006-01-02")
76
-	add_redis, err := redisClient.Get("ip:host_" + cur_date + "_" + tpass).Result()
76
+	add_redis, err := redisClient.Get(redisClient.Context(),"ip:host_" + cur_date + "_" + tpass).Result()
77
 	if err != nil {
77
 	if err != nil {
78
 		return &SMSServiceError{Err: "缺少关键参数"}
78
 		return &SMSServiceError{Err: "缺少关键参数"}
79
 	}
79
 	}
82
 		return &SMSServiceError{Err: "当前IP发送短信超过限制"}
82
 		return &SMSServiceError{Err: "当前IP发送短信超过限制"}
83
 	}
83
 	}
84
 
84
 
85
-	moblie_count, _ := redisClient.Get("code_msg_" + mobile + "_" + cur_date).Result()
85
+	moblie_count, _ := redisClient.Get(redisClient.Context(),"code_msg_" + mobile + "_" + cur_date).Result()
86
 	moblie_count_int, _ := strconv.Atoi(moblie_count)
86
 	moblie_count_int, _ := strconv.Atoi(moblie_count)
87
 	if moblie_max, _ := beego.AppConfig.Int("moblie_max_send_count"); moblie_count_int >= moblie_max {
87
 	if moblie_max, _ := beego.AppConfig.Int("moblie_max_send_count"); moblie_count_int >= moblie_max {
88
 		return &SMSServiceError{Err: "当前手机号发送短信超过限制"}
88
 		return &SMSServiceError{Err: "当前手机号发送短信超过限制"}

+ 1 - 1
service/redis.go View File

14
 		Password: beego.AppConfig.String("redispasswrod"), // no password set
14
 		Password: beego.AppConfig.String("redispasswrod"), // no password set
15
 		DB:       0,                                       // use default DB
15
 		DB:       0,                                       // use default DB
16
 	})
16
 	})
17
-	pong, err := client.Ping().Result()
17
+	pong, err := client.Ping(client.Context()).Result() 
18
 	fmt.Println(pong, err)
18
 	fmt.Println(pong, err)
19
 	return client
19
 	return client
20
 }
20
 }

+ 3 - 3
service/sms_service.go View File

40
 		redisClient := RedisClient()
40
 		redisClient := RedisClient()
41
 		defer redisClient.Close()
41
 		defer redisClient.Close()
42
 		cur_date := time.Now().Format("2006-01-02")
42
 		cur_date := time.Now().Format("2006-01-02")
43
-		redisClient.Set("xt_modify_pwd_"+mobile, code_str, time.Minute*10)
44
-		redisClient.Incr("xt_modify_pwd_" + mobile + "_" + cur_date).Result()
43
+		redisClient.Set(redisClient.Context(),"xt_modify_pwd_"+mobile, code_str, time.Minute*10)
44
+		redisClient.Incr(redisClient.Context(),"xt_modify_pwd_" + mobile + "_" + cur_date).Result()
45
 	}
45
 	}
46
 	return err
46
 	return err
47
 }
47
 }
68
 	defer redisClient.Close()
68
 	defer redisClient.Close()
69
 
69
 
70
 	cur_date := time.Now().Format("2006-01-02")
70
 	cur_date := time.Now().Format("2006-01-02")
71
-	moblie_count, _ := redisClient.Get("xt_modify_pwd_" + mobile + "_" + cur_date).Result()
71
+	moblie_count, _ := redisClient.Get(redisClient.Context(),"xt_modify_pwd_" + mobile + "_" + cur_date).Result()
72
 	moblie_count_int, _ := strconv.Atoi(moblie_count)
72
 	moblie_count_int, _ := strconv.Atoi(moblie_count)
73
 	if moblie_max := 5; moblie_count_int >= moblie_max {
73
 	if moblie_max := 5; moblie_count_int >= moblie_max {
74
 		return &SMSServiceError{Err: "当前手机号发送短信超过限制"}
74
 		return &SMSServiceError{Err: "当前手机号发送短信超过限制"}

+ 16 - 1
service/xcx_mobile_api_service.go View File

11
 	"github.com/jinzhu/gorm"
11
 	"github.com/jinzhu/gorm"
12
 	"net/http"
12
 	"net/http"
13
 	"time"
13
 	"time"
14
-	"net/http"
15
 )
14
 )
16
 
15
 
17
 func GetXcxMobileInformation(mobile string) (*models.XcxAdminUserRole, error) {
16
 func GetXcxMobileInformation(mobile string) (*models.XcxAdminUserRole, error) {
145
 
144
 
146
 }
145
 }
147
 
146
 
147
+func GetNamePatient(name string, idcard string) (*models.XcxPatients, error) {
148
+
149
+	patient := models.XcxPatients{}
150
+	err := XTReadDB().Model(&patient).Where("name = ? and id_card_no =?", name, idcard).Find(&patient).Error
151
+	//err := XTReadDB().Model(&patient).Where("id_card_no = ? and status = 1", mobile).Find(&patient).Error
152
+	if err == gorm.ErrRecordNotFound {
153
+		return nil, err
154
+	}
155
+
156
+	if err != nil {
157
+		return nil, err
158
+	}
159
+	return &patient, nil
160
+
161
+}
162
+
148
 func GetTemplateMode(orgid int64) (models.XcxGobalTemplate, error) {
163
 func GetTemplateMode(orgid int64) (models.XcxGobalTemplate, error) {
149
 
164
 
150
 	template := models.XcxGobalTemplate{}
165
 	template := models.XcxGobalTemplate{}