张保健 1 year ago
parent
commit
a19d515953

+ 2 - 2
controllers/dialysis_api_controller.go View File

@@ -1348,7 +1348,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1348 1348
 	remark := c.GetString("remark")
1349 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 1352
 	emergency_treatment, _ := c.GetInt64("emergency_treatment", 0)
1353 1353
 	emergency_treatment_other := c.GetString("emergency_treatment_other")
1354 1354
 	ductus_arantii := c.GetString("ductus_arantii")
@@ -1372,7 +1372,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1372 1372
 	ductus_arantii_other := c.GetString("ductus_arantii_other")
1373 1373
 	machine_type := c.GetString("machine_type")
1374 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 1376
 	phinholing := c.GetString("pinholing")
1377 1377
 
1378 1378
 	catheter_suture := c.GetString("catheter_suture")

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

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

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

@@ -88,7 +88,7 @@ func (this *DialysisAPIController) Scheduals() {
88 88
 
89 89
 	// cur_date := time.Now().Format("2006-01-02")
90 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 93
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
94 94
 		scheduals, err := service.MobileGetDialysisScheduals(orgID, date.Unix(), schedualType)
@@ -102,7 +102,7 @@ func (this *DialysisAPIController) Scheduals() {
102 102
 				//缓存数据
103 103
 				scheduals_json, err := json.Marshal(scheduals)
104 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,7 +148,7 @@ func (this *DialysisAPIController) WaitingScheduals() {
148 148
 	// cur_date := time.Now().Format("2006-01-02")
149 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 153
 	if len(wait_scheduals) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
154 154
 		scheduals, err := service.MobileGetWaitingScheduals(orgID, date.Unix())
@@ -165,7 +165,7 @@ func (this *DialysisAPIController) WaitingScheduals() {
165 165
 				//缓存数据
166 166
 				wait_scheduals_json, err := json.Marshal(scheduals)
167 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,7 +3293,7 @@ func (this *DialysisAPIController) GetDialysisSchedule() {
3293 3293
 		//缓存数据
3294 3294
 		scheduals_json, err := json.Marshal(scheduals)
3295 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 3299
 	this.ServeSuccessJSON(map[string]interface{}{

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

@@ -125,7 +125,7 @@ func (this *MobileBaseAPIAuthController) Prepare() {
125 125
 
126 126
 			//redis key值
127 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 130
 			var userRolePurviews string
131 131
 			var userRolePurviewsArr []string
@@ -149,7 +149,7 @@ func (this *MobileBaseAPIAuthController) Prepare() {
149 149
 				//缓存数据
150 150
 				purview_json, err := json.Marshal(userRolePurviewsArr)
151 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 154
 			} else {
155 155
 				var dat []string

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

@@ -2043,8 +2043,8 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
2043 2043
 
2044 2044
 	if dataBody["dialysis_count"] != nil && reflect.TypeOf(dataBody["dialysis_count"]).String() == "string" {
2045 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 2050
 	if dataBody["is_infect"] != nil && reflect.TypeOf(dataBody["is_infect"]).String() == "string" {
@@ -2085,7 +2085,7 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
2085 2085
 	}
2086 2086
 
2087 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 2089
 		evaluation.HumorExcessiveSymptom = humor_excessive_symptom
2090 2090
 	}
2091 2091
 

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

@@ -14,7 +14,7 @@ func (c *QiNiuApiController) GetQNUpToken() {
14 14
 	redisClient := service.RedisClient()
15 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 18
 	if err != nil {
19 19
 		defer fmt.Println(err)
20 20
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGetQiniuUpToken)

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

@@ -40,7 +40,7 @@ func (this *ForgetPwdController) ModifyPassword() {
40 40
 		// 修改成功后验证码就要使其失效
41 41
 		redisClient := service.RedisClient()
42 42
 		defer redisClient.Close()
43
-		redisClient.Del("code_msg_" + mobile)
43
+		redisClient.Del(redisClient.Context(),"code_msg_" + mobile)
44 44
 
45 45
 		ip := utils.GetIP(this.Ctx.Request)
46 46
 		ssoDomain := beego.AppConfig.String("sso_domain")
@@ -252,7 +252,7 @@ func (this *ForgetPwdController) checkParams(mobile string, code string, passwor
252 252
 	}
253 253
 	redisClient := service.RedisClient()
254 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 256
 	if cache_code != code {
257 257
 		return &enums.SGJError{Code: enums.ErrorCodeVerificationCodeWrong}
258 258
 	}

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

@@ -634,7 +634,7 @@ func (this *HomeController) ModifyPsw() {
634 634
 		// 修改成功后验证码就要使其失效
635 635
 		redisClient := service.RedisClient()
636 636
 		defer redisClient.Close()
637
-		redisClient.Del("code_msg_" + mobile)
637
+		redisClient.Del(redisClient.Context(),"code_msg_" + mobile)
638 638
 		this.ServeSuccessJSON(map[string]interface{}{
639 639
 			"admin": adminUser,
640 640
 		})
@@ -657,7 +657,7 @@ func (this *HomeController) checkParam(mobile string, code string, password stri
657 657
 	}
658 658
 	redisClient := service.RedisClient()
659 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 661
 	if cache_code != code {
662 662
 		return &enums.SGJError{Code: enums.ErrorCodeVerificationCodeWrong}
663 663
 	}

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

@@ -74,7 +74,7 @@ func (this *MobileRegistController) RegistSubmit() {
74 74
 
75 75
 		redisClient := service.RedisClient()
76 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 78
 		if cache_code != code {
79 79
 			//this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeVerificationCodeWrong)
80 80
 			//this.ServeJSON()
@@ -90,7 +90,7 @@ func (this *MobileRegistController) RegistSubmit() {
90 90
 			this.Ctx.SetCookie("mobile", mobile)
91 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 95
 			this.Data["json"] = enums.MakeSuccessResponseJSON(map[string]interface{}{
96 96
 				"result": true,

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

@@ -20,9 +20,9 @@ func (this *NewDialysisApiController) GetCodeInit() {
20 20
 	req := this.Ctx.Request
21 21
 	addr := utils.GetIP(req)
22 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 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 27
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
28 28
 	aespass := utils.AESEncrypt(addr)

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

@@ -136,9 +136,9 @@ func (this *NewLoginApiController) GetCodeInit() {
136 136
 	req := this.Ctx.Request
137 137
 	addr := utils.GetIP(req)
138 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 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 143
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
144 144
 	aespass := utils.AESEncrypt(addr)
@@ -378,7 +378,7 @@ func (this *NewLoginApiController) LoginByCs() {
378 378
 
379 379
 		redisClient := service.RedisClient()
380 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 383
 		if err != nil {
384 384
 			this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeAccountOrVerCodeWrong)
@@ -486,7 +486,7 @@ func (this *NewLoginApiController) LoginByCs() {
486 486
 						TemplateInfo: &templateInfo,
487 487
 					}
488 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 491
 					mobile = mobile + "-" + strconv.FormatInt(org.Id, 10) + "-" + strconv.FormatInt(appRole.Id, 10)
492 492
 					token := utils.GenerateLoginToken(mobile)

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

@@ -568,7 +568,7 @@ func (this *NewRoleApiController) EditFunctionPermission() {
568 568
 	users := service.GetAllUserRole(adminUser.Org.Id)
569 569
 	for _, item := range users {
570 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 574
 	if err != nil {

+ 1 - 1
controllers/patient_api_controller.go View File

@@ -413,7 +413,7 @@ func (c *PatientApiController) CreatePatient() {
413 413
 
414 414
 	redis := service.RedisClient()
415 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 418
 	c.ServeSuccessJSON(map[string]interface{}{
419 419
 		"msg": "ok",

+ 1 - 1
controllers/qiniiu_api_controller.go View File

@@ -21,7 +21,7 @@ func (c *QiNiuApiController) GetQNUpToken() {
21 21
 	redisClient := service.RedisClient()
22 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 25
 	fmt.Print("token------------------------------------", token)
26 26
 	if err != nil {
27 27
 		defer fmt.Println(err)

+ 3 - 3
controllers/role_controller.go View File

@@ -750,7 +750,7 @@ func (this *RoleAPIController) EditPurview() {
750 750
 	users := service.GetAllUserRole(adminUserInfo.CurrentOrgId)
751 751
 	for _, item := range users {
752 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 756
 	err := service.SaveRolePurviewIds(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, roleId, purviewIds)
@@ -898,7 +898,7 @@ func (this *RoleAPIController) AddAdminInitData() {
898 898
 
899 899
 	redisClient := service.RedisClient()
900 900
 	defer redisClient.Close()
901
-	qntoken, _ := redisClient.Get("qn_token").Result()
901
+	qntoken, _ := redisClient.Get(redisClient.Context(),"qn_token").Result()
902 902
 
903 903
 	this.ServeSuccessJSON(map[string]interface{}{
904 904
 		"roles":           roles,
@@ -1108,7 +1108,7 @@ func (this *RoleAPIController) EditAdminInitData() {
1108 1108
 
1109 1109
 	redisClient := service.RedisClient()
1110 1110
 	defer redisClient.Close()
1111
-	qntoken, _ := redisClient.Get("qn_token").Result()
1111
+	qntoken, _ := redisClient.Get(redisClient.Context(),"qn_token").Result()
1112 1112
 
1113 1113
 	this.ServeSuccessJSON(map[string]interface{}{
1114 1114
 		"admin":           appRole,

+ 1 - 1
controllers/schedule_api_controller.go View File

@@ -370,7 +370,7 @@ func (c *ScheduleApiController) CreateSchedule() {
370 370
 	err = service.CreateSchedule(&schedule)
371 371
 
372 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 375
 	fmt.Println(err)
376 376
 	if err != nil {

+ 2 - 2
controllers/verify_login_controller.go View File

@@ -408,7 +408,7 @@ func (this *PersonAPIController) ModifyPwd() {
408 408
 
409 409
 	redisClient := service.RedisClient()
410 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 412
 	if err != nil {
413 413
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAccountOrVerCodeWrong)
414 414
 		return
@@ -425,7 +425,7 @@ func (this *PersonAPIController) ModifyPwd() {
425 425
 	}
426 426
 
427 427
 	// 清除验证码
428
-	redisClient.Del("xt_modify_pwd_" + mobile)
428
+	redisClient.Del(redisClient.Context(),"xt_modify_pwd_" + mobile)
429 429
 	this.ServeSuccessJSON(map[string]interface{}{
430 430
 		"msg": "密码已修改",
431 431
 	})

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

@@ -19,7 +19,7 @@ func XcxApiControllersRegisterRouters() {
19 19
 	//获取验证码
20 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 24
 	beego.Router("/xcx/api/mobile/login", &XcxApiController{}, "Get:GetLoginInfor")
25 25
 
@@ -80,9 +80,9 @@ func (this *XcxApiController) GetCodeInit() {
80 80
 	req := this.Ctx.Request
81 81
 	addr := utils.GetIP(req)
82 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 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 87
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
88 88
 	aespass := utils.AESEncrypt(addr)
@@ -94,6 +94,83 @@ func (this *XcxApiController) GetCodeInit() {
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 174
 func (this *XcxApiController) GetUserRegister() {
98 175
 
99 176
 	//用户绑定
@@ -230,7 +307,7 @@ func (this *XcxApiController) GetUserRegister() {
230 307
 	} else {
231 308
 		redisClient := service.RedisClient()
232 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 311
 		fmt.Println("cache_code9999999293323232322323", cache_code)
235 312
 		if cache_code != code {
236 313
 			this.ServeSuccessJSON(map[string]interface{}{
@@ -240,7 +317,7 @@ func (this *XcxApiController) GetUserRegister() {
240 317
 		} else {
241 318
 			this.Ctx.SetCookie("mobile", mobile)
242 319
 			// 注册成功后验证码就要使其失效
243
-			redisClient.Del("code_msg_" + mobile)
320
+			redisClient.Del(redisClient.Context(),"code_msg_" + mobile)
244 321
 			patient, errcodes := service.GetMobilePatient(mobile, id_card_no)
245 322
 			fmt.Println("errcodes2323232232", errcodes)
246 323
 			if errcodes == nil {

+ 0 - 5
main.go View File

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

+ 2 - 2
models/dialysis.go View File

@@ -287,7 +287,7 @@ type PredialysisEvaluation struct {
287 287
 	DuctusArantii                  string  `gorm:"column:ductus_arantii" json:"ductus_arantii"`
288 288
 	EmergencyTreatment             int64   `gorm:"column:emergency_treatment" json:"emergency_treatment"`
289 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 291
 	AssessmentDoctor               int64   `gorm:"column:assessment_doctor" json:"assessment_doctor"`
292 292
 	AssessmentTime                 int64   `gorm:"column:assessment_time" json:"assessment_time"`
293 293
 	MachineType                    string  `gorm:"column:machine_type" json:"machine_type"`
@@ -301,7 +301,7 @@ type PredialysisEvaluation struct {
301 301
 	LastPostDialysisOther          string  `gorm:"column:last_post_dialysis_other" json:"last_post_dialysis_other"`
302 302
 	SymptomBeforeDialysisOther     string  `gorm:"column:symptom_before_dialysis_other" json:"symptom_before_dialysis_other"`
303 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 305
 	Phinholing                     string  `gorm:"column:pinholing" json:"pinholing" form:"pinholing"`
306 306
 	CatheterSuture                 string  `gorm:"column:catheter_suture" json:"catheter_suture" form:"catheter_suture"`
307 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,6 +18,7 @@ func init() {
18 18
 	//spec := "0 55 23 * * ?" // 每天23点55执行一次
19 19
 	//spec := "0 0 0 ? * Sun"
20 20
 	createStockCronJob.AddFunc(spec, func() {
21
+		utils.InfoLog("开启自动更新耗材库存定时任务1111111111111")
21 22
 		AutoCreateStockJob()
22 23
 	})
23 24
 }

+ 5 - 5
service/new_sms_service.go View File

@@ -50,12 +50,12 @@ func SendVerificationCodeSMS(mobile string, aespass string) error {
50 50
 		redisClient := RedisClient()
51 51
 		defer redisClient.Close()
52 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 56
 		bytesPass, _ := base64.StdEncoding.DecodeString(aespass)
57 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 60
 	return err
61 61
 }
@@ -73,7 +73,7 @@ func newCheckVerificationCodeSMSLimit(aespass string, mobile string) error {
73 73
 	}
74 74
 
75 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 77
 	if err != nil {
78 78
 		return &SMSServiceError{Err: "缺少关键参数"}
79 79
 	}
@@ -82,7 +82,7 @@ func newCheckVerificationCodeSMSLimit(aespass string, mobile string) error {
82 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 86
 	moblie_count_int, _ := strconv.Atoi(moblie_count)
87 87
 	if moblie_max, _ := beego.AppConfig.Int("moblie_max_send_count"); moblie_count_int >= moblie_max {
88 88
 		return &SMSServiceError{Err: "当前手机号发送短信超过限制"}

+ 1 - 1
service/redis.go View File

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

+ 3 - 3
service/sms_service.go View File

@@ -40,8 +40,8 @@ func SMSSendVerificationCode(mobile string) error {
40 40
 		redisClient := RedisClient()
41 41
 		defer redisClient.Close()
42 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 46
 	return err
47 47
 }
@@ -68,7 +68,7 @@ func checkVerificationCodeSMSLimit(mobile string) error {
68 68
 	defer redisClient.Close()
69 69
 
70 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 72
 	moblie_count_int, _ := strconv.Atoi(moblie_count)
73 73
 	if moblie_max := 5; moblie_count_int >= moblie_max {
74 74
 		return &SMSServiceError{Err: "当前手机号发送短信超过限制"}

+ 16 - 1
service/xcx_mobile_api_service.go View File

@@ -11,7 +11,6 @@ import (
11 11
 	"github.com/jinzhu/gorm"
12 12
 	"net/http"
13 13
 	"time"
14
-	"net/http"
15 14
 )
16 15
 
17 16
 func GetXcxMobileInformation(mobile string) (*models.XcxAdminUserRole, error) {
@@ -145,6 +144,22 @@ func GetMobilePatient(mobile string, idcard string) (*models.XcxPatients, 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 163
 func GetTemplateMode(orgid int64) (models.XcxGobalTemplate, error) {
149 164
 
150 165
 	template := models.XcxGobalTemplate{}