Browse Source

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

XMLWAN 5 years ago
parent
commit
b6c1bc34bc

+ 2 - 2
conf/app.conf View File

163
 readuseruser = root
163
 readuseruser = root
164
 readuserpass = 1Q2W3e4r!@#$
164
 readuserpass = 1Q2W3e4r!@#$
165
 readusername = test_users
165
 readusername = test_users
166
-//readusername = sgj_users
166
+//readusername = test_users
167
 
167
 
168
 writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
168
 writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
169
 writeuserport = 3306
169
 writeuserport = 3306
170
 writeuseruser = root
170
 writeuseruser = root
171
 writeuserpass = 1Q2W3e4r!@#$
171
 writeuserpass = 1Q2W3e4r!@#$
172
 writeusername = test_users
172
 writeusername = test_users
173
-//writeusername = sgj_users
173
+//writeusername = test_users
174
 
174
 
175
 
175
 
176
 readmiddlehost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
176
 readmiddlehost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com

+ 60 - 60
controllers/base_api_controller.go View File

2
 
2
 
3
 import (
3
 import (
4
 	"XT_New/enums"
4
 	"XT_New/enums"
5
-	//"XT_New/models"
5
+	"XT_New/models"
6
 	"XT_New/service"
6
 	"XT_New/service"
7
 	"fmt"
7
 	"fmt"
8
 	"strconv"
8
 	"strconv"
65
 func (this *BaseAuthAPIController) Prepare() {
65
 func (this *BaseAuthAPIController) Prepare() {
66
 	this.BaseAPIController.Prepare()
66
 	this.BaseAPIController.Prepare()
67
 	if this.GetAdminUserInfo() == nil {
67
 	if this.GetAdminUserInfo() == nil {
68
-		//var userAdmin models.AdminUser
69
-		//userAdmin.Id = 400
70
-		//userAdmin.Mobile = "13535547901"
71
-		//
72
-		////userAdmin.Id = 597
73
-		////userAdmin.Mobile = "19874122664"
74
-		//userAdmin.IsSuperAdmin = false
75
-		//userAdmin.Status = 1
76
-		//userAdmin.CreateTime = 1530786071
77
-		//userAdmin.ModifyTime = 1530786071
78
-		//var subscibe models.ServeSubscibe
79
-		//subscibe.ID = 1
80
-		//subscibe.OrgId = 12
81
-		//subscibe.PeriodStart = 1538035409
82
-		//subscibe.PeriodEnd = 1569571409
83
-		//subscibe.State = 1
84
-		//subscibe.Status = 1
85
-		//subscibe.CreatedTime = 1538035409
86
-		//subscibe.UpdatedTime = 1538035409
87
-		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
88
-		//subscibes[4] = &subscibe
89
-		//var adminUserInfo service.AdminUserInfo
90
-		//adminUserInfo.CurrentOrgId = 12
91
-		//adminUserInfo.CurrentAppId = 18
92
-		//adminUserInfo.AdminUser = &userAdmin
93
-		//adminUserInfo.Subscibes = subscibes
94
-		//this.SetSession("admin_user_info", &adminUserInfo)
95
-
96
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
97
-		this.StopRun()
68
+		var userAdmin models.AdminUser
69
+		userAdmin.Id = 400
70
+		userAdmin.Mobile = "13535547901"
71
+
72
+		//userAdmin.Id = 597
73
+		//userAdmin.Mobile = "19874122664"
74
+		userAdmin.IsSuperAdmin = false
75
+		userAdmin.Status = 1
76
+		userAdmin.CreateTime = 1530786071
77
+		userAdmin.ModifyTime = 1530786071
78
+		var subscibe models.ServeSubscibe
79
+		subscibe.ID = 1
80
+		subscibe.OrgId = 12
81
+		subscibe.PeriodStart = 1538035409
82
+		subscibe.PeriodEnd = 1569571409
83
+		subscibe.State = 1
84
+		subscibe.Status = 1
85
+		subscibe.CreatedTime = 1538035409
86
+		subscibe.UpdatedTime = 1538035409
87
+		subscibes := make(map[int64]*models.ServeSubscibe, 0)
88
+		subscibes[4] = &subscibe
89
+		var adminUserInfo service.AdminUserInfo
90
+		adminUserInfo.CurrentOrgId = 12
91
+		adminUserInfo.CurrentAppId = 18
92
+		adminUserInfo.AdminUser = &userAdmin
93
+		adminUserInfo.Subscibes = subscibes
94
+		this.SetSession("admin_user_info", &adminUserInfo)
95
+
96
+		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
97
+		//this.StopRun()
98
 	}
98
 	}
99
 
99
 
100
 	adminUserInfo := this.GetAdminUserInfo()
100
 	adminUserInfo := this.GetAdminUserInfo()
316
 func (this *BaseServeAPIController) Prepare() {
316
 func (this *BaseServeAPIController) Prepare() {
317
 	this.BaseAPIController.Prepare()
317
 	this.BaseAPIController.Prepare()
318
 	if this.GetAdminUserInfo() == nil {
318
 	if this.GetAdminUserInfo() == nil {
319
-		//var userAdmin models.AdminUser
320
-		//userAdmin.Id = 400
321
-		//userAdmin.Mobile = "13535547901"
322
-		////userAdmin.Id = 597
323
-		////userAdmin.Mobile = "19874122664"
324
-		//userAdmin.IsSuperAdmin = false
325
-		//userAdmin.Status = 1
326
-		//userAdmin.CreateTime = 1530786071
327
-		//userAdmin.ModifyTime = 1530786071
328
-		//var subscibe models.ServeSubscibe
329
-		//subscibe.ID = 1
330
-		//subscibe.OrgId = 12
331
-		//subscibe.PeriodStart = 1538035409
332
-		//subscibe.PeriodEnd = 1569571409
333
-		//subscibe.State = 1
334
-		//subscibe.Status = 1
335
-		//subscibe.CreatedTime = 1538035409
336
-		//subscibe.UpdatedTime = 1538035409
337
-		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
338
-		//subscibes[4] = &subscibe
339
-		//var adminUserInfo service.AdminUserInfo
340
-		//adminUserInfo.CurrentOrgId = 12
341
-		//adminUserInfo.CurrentAppId = 18
342
-		//adminUserInfo.AdminUser = &userAdmin
343
-		//adminUserInfo.Subscibes = subscibes
344
-		//this.SetSession("admin_user_info", &adminUserInfo)
345
-
346
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
347
-		this.StopRun()
319
+		var userAdmin models.AdminUser
320
+		userAdmin.Id = 400
321
+		userAdmin.Mobile = "13535547901"
322
+		//userAdmin.Id = 597
323
+		//userAdmin.Mobile = "19874122664"
324
+		userAdmin.IsSuperAdmin = false
325
+		userAdmin.Status = 1
326
+		userAdmin.CreateTime = 1530786071
327
+		userAdmin.ModifyTime = 1530786071
328
+		var subscibe models.ServeSubscibe
329
+		subscibe.ID = 1
330
+		subscibe.OrgId = 12
331
+		subscibe.PeriodStart = 1538035409
332
+		subscibe.PeriodEnd = 1569571409
333
+		subscibe.State = 1
334
+		subscibe.Status = 1
335
+		subscibe.CreatedTime = 1538035409
336
+		subscibe.UpdatedTime = 1538035409
337
+		subscibes := make(map[int64]*models.ServeSubscibe, 0)
338
+		subscibes[4] = &subscibe
339
+		var adminUserInfo service.AdminUserInfo
340
+		adminUserInfo.CurrentOrgId = 12
341
+		adminUserInfo.CurrentAppId = 18
342
+		adminUserInfo.AdminUser = &userAdmin
343
+		adminUserInfo.Subscibes = subscibes
344
+		this.SetSession("admin_user_info", &adminUserInfo)
345
+
346
+		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
347
+		//this.StopRun()
348
 	}
348
 	}
349
 
349
 
350
 	//if adminUserInfo.AppRole != nil {
350
 	//if adminUserInfo.AppRole != nil {

+ 18 - 32
controllers/dialysis_api_controller.go View File

3070
 	}
3070
 	}
3071
 
3071
 
3072
 	if assessment.ID > 0 {
3072
 	if assessment.ID > 0 {
3073
-		//if appRole.UserType == 3 {
3074
-		//	if assessment.Creater != adminUserInfo.AdminUser.Id && assessment.Creater != 0 {
3075
-		//		headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
3076
-		//		if getPermissionErr != nil {
3077
-		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3078
-		//			return
3079
-		//		} else if headNursePermission == nil {
3080
-		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
3081
-		//			return
3082
-		//		}
3083
-		//	}
3084
-		//}
3073
+
3085
 		if appRole.UserType == 2 || appRole.UserType == 1 {
3074
 		if appRole.UserType == 2 || appRole.UserType == 1 {
3086
 			assessment.AssessmentDoctor = adminUserInfo.AdminUser.Id
3075
 			assessment.AssessmentDoctor = adminUserInfo.AdminUser.Id
3087
 			assessment.AssessmentTime = time.Now().Unix()
3076
 			assessment.AssessmentTime = time.Now().Unix()
3088
-
3089
-		}
3090
-		if assessment.Creater == 0 {
3091
-			assessment.Modifier = adminUserInfo.AdminUser.Id
3092
-			assessment.Creater = adminUserInfo.AdminUser.Id
3093
-
3094
 		} else {
3077
 		} else {
3095
-			assessment.Modifier = adminUserInfo.AdminUser.Id
3096
-			assessment.Creater = assessment.Creater
3097
-
3078
+			if assessment.Creater == 0 {
3079
+				assessment.Modifier = adminUserInfo.AdminUser.Id
3080
+				assessment.Creater = adminUserInfo.AdminUser.Id
3081
+			} else {
3082
+				assessment.Modifier = adminUserInfo.AdminUser.Id
3083
+			}
3098
 		}
3084
 		}
3099
 
3085
 
3100
 		assessment.UpdatedTime = time.Now().Unix()
3086
 		assessment.UpdatedTime = time.Now().Unix()
3103
 		if appRole.UserType == 2 || appRole.UserType == 1 {
3089
 		if appRole.UserType == 2 || appRole.UserType == 1 {
3104
 			assessment.AssessmentDoctor = adminUserInfo.AdminUser.Id
3090
 			assessment.AssessmentDoctor = adminUserInfo.AdminUser.Id
3105
 			assessment.AssessmentTime = time.Now().Unix()
3091
 			assessment.AssessmentTime = time.Now().Unix()
3106
-
3092
+		} else {
3093
+			assessment.Creater = adminUserInfo.AdminUser.Id
3107
 		}
3094
 		}
3108
-		assessment.Creater = adminUserInfo.AdminUser.Id
3109
 		assessment.CreatedTime = time.Now().Unix()
3095
 		assessment.CreatedTime = time.Now().Unix()
3110
 		assessment.UpdatedTime = time.Now().Unix()
3096
 		assessment.UpdatedTime = time.Now().Unix()
3111
 		assessment.UserOrgId = adminUserInfo.CurrentOrgId
3097
 		assessment.UserOrgId = adminUserInfo.CurrentOrgId
3253
 		if appRole.UserType == 2 || appRole.UserType == 1 {
3239
 		if appRole.UserType == 2 || appRole.UserType == 1 {
3254
 			assessmentBeforeDislysis.AssessmentDoctor = adminUserInfo.AdminUser.Id
3240
 			assessmentBeforeDislysis.AssessmentDoctor = adminUserInfo.AdminUser.Id
3255
 			assessmentBeforeDislysis.AssessmentTime = time.Now().Unix()
3241
 			assessmentBeforeDislysis.AssessmentTime = time.Now().Unix()
3256
-		}
3242
+		} else {
3243
+			assessmentBeforeDislysis.Creater = adminUserInfo.AdminUser.Id
3257
 
3244
 
3258
-		assessmentBeforeDislysis.Creater = adminUserInfo.AdminUser.Id
3245
+		}
3259
 
3246
 
3260
 		err := service.AddSigleAssessmentBeforeDislysisRecord(&assessmentBeforeDislysis)
3247
 		err := service.AddSigleAssessmentBeforeDislysisRecord(&assessmentBeforeDislysis)
3261
 		if err == nil {
3248
 		if err == nil {
3284
 		if appRole.UserType == 2 || appRole.UserType == 1 {
3271
 		if appRole.UserType == 2 || appRole.UserType == 1 {
3285
 			assessmentBeforeDislysis.AssessmentDoctor = adminUserInfo.AdminUser.Id
3272
 			assessmentBeforeDislysis.AssessmentDoctor = adminUserInfo.AdminUser.Id
3286
 			assessmentBeforeDislysis.AssessmentTime = time.Now().Unix()
3273
 			assessmentBeforeDislysis.AssessmentTime = time.Now().Unix()
3287
-		}
3288
-
3289
-		if evaluation.Creater == 0 {
3290
-			assessmentBeforeDislysis.Modifier = adminUserInfo.AdminUser.Id
3291
-			assessmentBeforeDislysis.Creater = adminUserInfo.AdminUser.Id
3292
 		} else {
3274
 		} else {
3293
-			assessmentBeforeDislysis.Modifier = adminUserInfo.AdminUser.Id
3294
-			assessmentBeforeDislysis.Creater = evaluation.Creater
3275
+			if evaluation.Creater == 0 {
3276
+				assessmentBeforeDislysis.Modifier = adminUserInfo.AdminUser.Id
3277
+				assessmentBeforeDislysis.Creater = adminUserInfo.AdminUser.Id
3278
+			} else {
3279
+				assessmentBeforeDislysis.Modifier = adminUserInfo.AdminUser.Id
3280
+			}
3295
 		}
3281
 		}
3296
 
3282
 
3297
 		assessmentBeforeDislysis.UpdatedTime = time.Now().Unix()
3283
 		assessmentBeforeDislysis.UpdatedTime = time.Now().Unix()

+ 16 - 29
controllers/mobile_api_controllers/dialysis_api_controller.go View File

872
 		IsEat:                        is_eat,
872
 		IsEat:                        is_eat,
873
 	}
873
 	}
874
 
874
 
875
-	//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
875
+	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
876
 
876
 
877
 	_, assessmentAfter := service.FindAssessmentAfterDislysisByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
877
 	_, assessmentAfter := service.FindAssessmentAfterDislysisByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
878
 	if assessmentAfter.ID == 0 { //新增
878
 	if assessmentAfter.ID == 0 { //新增
879
-		//if appRole.UserType == 2 || appRole.UserType == 1 {
880
-		assessmentAfterDislysis.AssessmentDoctor = adminUserInfo.AdminUser.Id
881
-		assessmentAfterDislysis.AssessmentTime = time.Now().Unix()
879
+		if appRole.UserType == 2 || appRole.UserType == 1 {
880
+			assessmentAfterDislysis.AssessmentDoctor = adminUserInfo.AdminUser.Id
881
+			assessmentAfterDislysis.AssessmentTime = time.Now().Unix()
882
 
882
 
883
-		//} else {
884
-		assessmentAfterDislysis.Creater = adminUserInfo.AdminUser.Id
883
+		} else {
884
+			assessmentAfterDislysis.Creater = adminUserInfo.AdminUser.Id
885
 
885
 
886
-		//}
886
+		}
887
 
887
 
888
 		err := service.AddSigleAssessmentAfterDislysisRecord(&assessmentAfterDislysis)
888
 		err := service.AddSigleAssessmentAfterDislysisRecord(&assessmentAfterDislysis)
889
 		if err == nil {
889
 		if err == nil {
892
 			})
892
 			})
893
 		}
893
 		}
894
 	} else { //修改
894
 	} else { //修改
895
-		//if appRole.UserType == 3 {
896
-		//	if assessmentAfter.Creater != adminUserInfo.AdminUser.Id && assessmentAfter.Creater != 0 {
897
-		//		headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
898
-		//		if getPermissionErr != nil {
899
-		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
900
-		//			return
901
-		//		} else if headNursePermission == nil {
902
-		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
903
-		//			return
904
-		//		}
905
-		//	}
906
-		//}
907
 
895
 
908
-		//TODO 根据角色判断
909
-		//if appRole.UserType == 2 || appRole.UserType == 1 {
910
-		assessmentAfterDislysis.AssessmentDoctor = adminUserInfo.AdminUser.Id
911
-		assessmentAfterDislysis.AssessmentTime = time.Now().Unix()
912
-		//} else {
913
-		assessmentAfterDislysis.Modifier = adminUserInfo.AdminUser.Id
914
-		if assessmentAfterDislysis.Creater == 0 {
915
-			assessmentAfterDislysis.Creater = adminUserInfo.AdminUser.Id
896
+		if appRole.UserType == 2 || appRole.UserType == 1 {
897
+			assessmentAfterDislysis.AssessmentDoctor = adminUserInfo.AdminUser.Id
898
+			assessmentAfterDislysis.AssessmentTime = time.Now().Unix()
899
+		} else {
900
+			assessmentAfterDislysis.Modifier = adminUserInfo.AdminUser.Id
901
+			if assessmentAfterDislysis.Creater == 0 {
902
+				assessmentAfterDislysis.Creater = adminUserInfo.AdminUser.Id
903
+			}
916
 		}
904
 		}
917
-		//}
918
 
905
 
919
 		assessmentAfterDislysis.CreatedTime = assessmentAfter.CreatedTime
906
 		assessmentAfterDislysis.CreatedTime = assessmentAfter.CreatedTime
920
 		assessmentAfterDislysis.ID = assessmentAfter.ID
907
 		assessmentAfterDislysis.ID = assessmentAfter.ID
2248
 
2235
 
2249
 		prescription.CreatedTime = dialysisPrescription.CreatedTime
2236
 		prescription.CreatedTime = dialysisPrescription.CreatedTime
2250
 		prescription.Modifier = adminUserInfo.AdminUser.Id
2237
 		prescription.Modifier = adminUserInfo.AdminUser.Id
2251
-		prescription.Creater = dialysisPrescription.Creater
2238
+		prescription.Creater = adminUserInfo.AdminUser.Id
2252
 
2239
 
2253
 		prescription.PrescriptionDoctor = adminUserInfo.AdminUser.Id
2240
 		prescription.PrescriptionDoctor = adminUserInfo.AdminUser.Id
2254
 		prescription.ID = dialysisPrescription.ID
2241
 		prescription.ID = dialysisPrescription.ID

+ 15 - 32
controllers/mobile_api_controllers/patient_api_controller.go View File

843
 		return
843
 		return
844
 	}
844
 	}
845
 	//templateInfo,_ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
845
 	//templateInfo,_ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
846
-	//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
846
+	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
847
 	var evaluation models.PredialysisEvaluation
847
 	var evaluation models.PredialysisEvaluation
848
 	if theEvaluation != nil {
848
 	if theEvaluation != nil {
849
-		//if appRole.UserType == 2 || appRole.UserType == 1 {
850
-
851
 		evaluation = *theEvaluation
849
 		evaluation = *theEvaluation
852
-
853
-		//} else {
854
-		//	if theEvaluation.Creater != adminUserInfo.AdminUser.Id && theEvaluation.Creater != 0 {
855
-		//		headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
856
-		//		if getPermissionErr != nil {
857
-		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
858
-		//			return
859
-		//		} else if headNursePermission == nil {
860
-		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
861
-		//			return
862
-		//		}
863
-		//	} else {
864
-		//		evaluation = *theEvaluation
865
-		//	}
866
-		//}
867
 	}
850
 	}
868
 
851
 
869
 	code := predialysisEvaluationFormData(&evaluation, c.Ctx.Input.RequestBody)
852
 	code := predialysisEvaluationFormData(&evaluation, c.Ctx.Input.RequestBody)
879
 		evaluation.AssessmentDate = theAssessmentDateTime
862
 		evaluation.AssessmentDate = theAssessmentDateTime
880
 		evaluation.PatientId = id
863
 		evaluation.PatientId = id
881
 		evaluation.UserOrgId = adminUserInfo.Org.Id
864
 		evaluation.UserOrgId = adminUserInfo.Org.Id
882
-		//if appRole.UserType == 2 || appRole.UserType == 1 {
883
-		//	evaluation.AssessmentDoctor = adminUserInfo.AdminUser.Id
884
-		//	evaluation.AssessmentTime = time.Now().Unix()
885
-		//} else {
886
-		evaluation.Creater = adminUserInfo.AdminUser.Id
887
-		//}
865
+		if appRole.UserType == 2 || appRole.UserType == 1 {
866
+			evaluation.AssessmentDoctor = adminUserInfo.AdminUser.Id
867
+			evaluation.AssessmentTime = time.Now().Unix()
868
+		} else {
869
+			evaluation.Creater = adminUserInfo.AdminUser.Id
870
+		}
888
 	} else {
871
 	} else {
889
 		evaluation.UpdatedTime = time.Now().Unix()
872
 		evaluation.UpdatedTime = time.Now().Unix()
890
 		evaluation.Evaluator = adminUserInfo.AdminUser.Id
873
 		evaluation.Evaluator = adminUserInfo.AdminUser.Id
891
-		//if appRole.UserType == 2 || appRole.UserType == 1 {
892
-		//	evaluation.AssessmentDoctor = adminUserInfo.AdminUser.Id
893
-		//	evaluation.AssessmentTime = time.Now().Unix()
894
-		//} else {
895
-		evaluation.Modifier = adminUserInfo.AdminUser.Id
896
-		if evaluation.Creater == 0 {
897
-			evaluation.Creater = adminUserInfo.AdminUser.Id
874
+		if appRole.UserType == 2 || appRole.UserType == 1 {
875
+			evaluation.AssessmentDoctor = adminUserInfo.AdminUser.Id
876
+			evaluation.AssessmentTime = time.Now().Unix()
877
+		} else {
878
+			evaluation.Modifier = adminUserInfo.AdminUser.Id
879
+			if evaluation.Creater == 0 {
880
+				evaluation.Creater = adminUserInfo.AdminUser.Id
881
+			}
898
 		}
882
 		}
899
-		//}
900
 	}
883
 	}
901
 
884
 
902
 	//新增逻辑
885
 	//新增逻辑

+ 1 - 9
controllers/new_mobile_api_controllers/home_api_controller.go View File

283
 	}
283
 	}
284
 	orgPhone := this.GetString("telephone")
284
 	orgPhone := this.GetString("telephone")
285
 
285
 
286
-	if len(orgPhone) > 0 {
287
-		if utils.PhoneRegexp().MatchString(orgPhone) == false {
288
-			this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
289
-			this.ServeJSON()
290
-			return
291
-		}
292
-	}
293
-
294
 	provinceID := 0
286
 	provinceID := 0
295
 	cityID := 0
287
 	cityID := 0
296
 	districtID := 0
288
 	districtID := 0
377
 		InitRoleAndPurviews(org)
369
 		InitRoleAndPurviews(org)
378
 		//初始化设备管理
370
 		//初始化设备管理
379
 		InitEquitMentInformation(org)
371
 		InitEquitMentInformation(org)
380
-
381
 		//初始化显示配置
372
 		//初始化显示配置
373
+		//InitShowConfig(org)
382
 
374
 
383
 		if len(orgs) == 0 {
375
 		if len(orgs) == 0 {
384
 			ip := utils.GetIP(this.Ctx.Request)
376
 			ip := utils.GetIP(this.Ctx.Request)

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

235
 		InitPatientAndSchedule(org)
235
 		InitPatientAndSchedule(org)
236
 		//初始化透析方案
236
 		//初始化透析方案
237
 		InitSystemPrescrption(org)
237
 		InitSystemPrescrption(org)
238
-		//初始化医嘱模版
239
-		//InitAdviceTemplate(org)
240
 		//初始化角色和权限
238
 		//初始化角色和权限
241
 		InitRoleAndPurviews(org)
239
 		InitRoleAndPurviews(org)
242
 		//初始化设备管理org
240
 		//初始化设备管理org

+ 3 - 3
controllers/new_mobile_api_controllers/role.json View File

7
       "status": 1,
7
       "status": 1,
8
       "is_system": 1,
8
       "is_system": 1,
9
       "number": 9999,
9
       "number": 9999,
10
-      "purview_ids": "71,72,70,74,75,73,48,52,110,49,77,78,79,80,197,76,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,127,128,201,193,194,196,192,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,101,100,102",
10
+      "purview_ids": "71,72,70,74,75,73,48,49,52,110,49,77,78,79,80,197,76,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,127,128,201,193,194,196,192,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,101,100,102",
11
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20039,20055,20056,20040,20041,20042,20043,20054,20044,20045,20046,20047,20048,20049,20050,20051,20052,20053,20013,20014,20015,20016,20017,20018,20019,20020,20021,20022,20023,20024,20025,20026,20027,20028,20029,20030"
11
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20039,20055,20056,20040,20041,20042,20043,20054,20044,20045,20046,20047,20048,20049,20050,20051,20052,20053,20013,20014,20015,20016,20017,20018,20019,20020,20021,20022,20023,20024,20025,20026,20027,20028,20029,20030"
12
     },
12
     },
13
     {
13
     {
30
       "is_system": 3,
30
       "is_system": 3,
31
       "number": 9997,
31
       "number": 9997,
32
       "purview_ids": "71,72,70,74,75,73,127,128,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,77,78,79,80,197,76",
32
       "purview_ids": "71,72,70,74,75,73,127,128,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,77,78,79,80,197,76",
33
-      "func_ids": "20007,20008,20009,20010,20011,20051,20053,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028,20029"
33
+      "func_ids": "20007,20008,20009,20010,20011,20051,20053,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028,20029,20055,20056,20052,20012"
34
     },
34
     },
35
     {
35
     {
36
       "role_name": "库存",
36
       "role_name": "库存",
75
       "status": 1,
75
       "status": 1,
76
       "is_system": 0,
76
       "is_system": 0,
77
       "number": 9993,
77
       "number": 9993,
78
-      "purview_ids": "71,72,70,74,75,73,48,52,110,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,77,78,79,80,197,76,101,100,102,127,128,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201",
78
+      "purview_ids": "71,72,70,74,75,73,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,77,78,79,80,197,76,101,100,102,127,128,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201",
79
       "func_ids": ""
79
       "func_ids": ""
80
 
80
 
81
 
81
 

+ 20 - 21
controllers/public_api_controller.go View File

468
 	//			continue
468
 	//			continue
469
 	//		}
469
 	//		}
470
 	//
470
 	//
471
-	//
472
 	//		app.OrgId = apps.OrgId
471
 	//		app.OrgId = apps.OrgId
473
 	//		app.Creator = int(org.Creator)
472
 	//		app.Creator = int(org.Creator)
474
 	//		app.Pid = xt_temp_org_app.Id
473
 	//		app.Pid = xt_temp_org_app.Id
503
 	//}
502
 	//}
504
 	////护士医生
503
 	////护士医生
505
 	//app_roles2  := service.GetAllUserRoleByUserTypeOther()
504
 	//app_roles2  := service.GetAllUserRoleByUserTypeOther()
506
-	//	//for _, item := range app_roles2{
507
-	//	//	var ids string
508
-	//	//	if len(item.RoleIds) == 0{
509
-	//	//		ids = strconv.FormatInt( item.RoleId,10)
510
-	//	//	}else{
511
-	//	//		ids = item.RoleIds + ","+strconv.FormatInt( item.RoleId,10)
512
-	//	//	}
513
-	//	//	if item.UserType == 2{
514
-	//	//		role := service.FindRoleByUserTypeOne(item.OrgId)
515
-	//	//		ids = ids +"," + strconv.FormatInt(role.Id,10)
516
-	//	//
517
-	//	//	} else if item.UserType == 3{
518
-	//	//		role := service.FindRoleByUserTypeTwo(item.OrgId)
519
-	//	//		ids = ids +"," + strconv.FormatInt(role.Id,10)
520
-	//	//	}
521
-	//	//	service.UpdateRoleIds(item.Id, ids)
522
-	//	//}
523
-	c.ServeSuccessJSON(map[string]interface{}{
524
-		"msg": "ok",
525
-	})
505
+	//	for _, item := range app_roles2{
506
+	//		var ids string
507
+	//		if len(item.RoleIds) == 0{
508
+	//			ids = strconv.FormatInt( item.RoleId,10)
509
+	//		}else{
510
+	//			ids = item.RoleIds + ","+strconv.FormatInt( item.RoleId,10)
511
+	//		}
512
+	//		if item.UserType == 2{
513
+	//			role := service.FindRoleByUserTypeOne(item.OrgId)
514
+	//			ids = ids +"," + strconv.FormatInt(role.Id,10)
515
+	//
516
+	//		} else if item.UserType == 3{
517
+	//			role := service.FindRoleByUserTypeTwo(item.OrgId)
518
+	//			ids = ids +"," + strconv.FormatInt(role.Id,10)
519
+	//		}
520
+	//		service.UpdateRoleIds(item.Id, ids)
521
+	//	}
522
+	//c.ServeSuccessJSON(map[string]interface{}{
523
+	//	"msg": "ok",
524
+	//})
526
 
525
 
527
 }
526
 }
528
 
527
 

+ 49 - 2
controllers/role.json View File

7
       "status": 1,
7
       "status": 1,
8
       "is_system": 1,
8
       "is_system": 1,
9
       "number": 9999,
9
       "number": 9999,
10
-      "purview_ids": "71,72,70,74,75,73,48,52,110,49,77,78,79,80,197,76,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,127,128,201,193,194,196,192,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,101,100,102",
10
+      "purview_ids": "71,72,70,74,75,73,48,49,52,110,49,77,78,79,80,197,76,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,127,128,201,193,194,196,192,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,101,100,102",
11
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20039,20055,20056,20040,20041,20042,20043,20054,20044,20045,20046,20047,20048,20049,20050,20051,20052,20053,20013,20014,20015,20016,20017,20018,20019,20020,20021,20022,20023,20024,20025,20026,20027,20028,20029,20030"
11
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20039,20055,20056,20040,20041,20042,20043,20054,20044,20045,20046,20047,20048,20049,20050,20051,20052,20053,20013,20014,20015,20016,20017,20018,20019,20020,20021,20022,20023,20024,20025,20026,20027,20028,20029,20030"
12
     },
12
     },
13
     {
13
     {
30
       "is_system": 3,
30
       "is_system": 3,
31
       "number": 9997,
31
       "number": 9997,
32
       "purview_ids": "71,72,70,74,75,73,127,128,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,77,78,79,80,197,76",
32
       "purview_ids": "71,72,70,74,75,73,127,128,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,77,78,79,80,197,76",
33
-      "func_ids": "20007,20008,20009,20010,20011,20051,20053,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028,20029"
33
+      "func_ids": "20007,20008,20009,20010,20011,20051,20053,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028,20029,20055,20056,20052,20012"
34
+    },{
35
+      "role_name": "库存",
36
+      "role_introduction": "库存角色负责透析耗材的日常管理,对耗材的入库、出库、退库的登记操作",
37
+      "is_super_admin": false,
38
+      "status": 1,
39
+      "is_system": 0,
40
+      "number": 9996,
41
+      "purview_ids": "111,112,113,114,115,116,117,118,119,129,84",
42
+      "func_ids": ""
43
+
44
+
45
+
46
+    },{
47
+      "role_name": "运营",
48
+      "role_introduction": "运营角色能够在SCRM中管理微网站、使用营销工具、做会员管理和分销商品经营的操作",
49
+      "is_super_admin": false,
50
+      "status": 1,
51
+      "is_system": 0,
52
+      "number": 9995,
53
+      "purview_ids": "48,110,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201",
54
+      "func_ids": ""
55
+
56
+
57
+
58
+    },{
59
+      "role_name": "技师",
60
+      "role_introduction": "技师角色能够进行设备的管理,日常维护维修记录等",
61
+      "is_super_admin": false,
62
+      "status": 1,
63
+      "is_system": 0,
64
+      "number": 9994,
65
+      "purview_ids": "77,78,79,80,197,76",
66
+      "func_ids": ""
67
+
68
+
69
+    },
70
+    {
71
+      "role_name": "院长",
72
+      "role_introduction": "院长角色了解血透患者血液透析质量和相关的大数据,以及掌握透析中心整体运营情况",
73
+      "is_super_admin": false,
74
+      "status": 1,
75
+      "is_system": 0,
76
+      "number": 9993,
77
+      "purview_ids": "71,72,70,74,75,73,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,77,78,79,80,197,76,101,100,102,127,128,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201",
78
+      "func_ids": ""
79
+
80
+
34
     }
81
     }
35
   ]
82
   ]
36
 }
83
 }

+ 15 - 15
service/app_version.go View File

21
 
21
 
22
 func GetAllAppOrg() ([]*models.OrgApp, error) {
22
 func GetAllAppOrg() ([]*models.OrgApp, error) {
23
 	var app []*models.OrgApp
23
 	var app []*models.OrgApp
24
-	err := readUserDbT.Model(&models.OrgApp{}).Where("status = 1 AND org_id > 0").Group("org_id").Find(&app).Error
24
+	err := readUserDb.Model(&models.OrgApp{}).Where("status = 1 AND org_id > 0").Group("org_id").Find(&app).Error
25
 	if err == gorm.ErrRecordNotFound {
25
 	if err == gorm.ErrRecordNotFound {
26
 		return nil, nil
26
 		return nil, nil
27
 	}
27
 	}
60
 
60
 
61
 func GetAppByType(orgID int64, app_type int) (*models.OrgApp, error) {
61
 func GetAppByType(orgID int64, app_type int) (*models.OrgApp, error) {
62
 	var apps models.OrgApp
62
 	var apps models.OrgApp
63
-	err := readUserDbT.Where("app_type = ? AND org_id = ? AND status = 1", app_type, orgID).First(&apps).Error
63
+	err := readUserDb.Where("app_type = ? AND org_id = ? AND status = 1", app_type, orgID).First(&apps).Error
64
 	if err != nil {
64
 	if err != nil {
65
 		return nil, err
65
 		return nil, err
66
 	}
66
 	}
68
 }
68
 }
69
 
69
 
70
 func CreateOrgApp(app *models.OrgApp) {
70
 func CreateOrgApp(app *models.OrgApp) {
71
-	writeUserDbT.Create(&app)
71
+	writeUserDb.Create(&app)
72
 
72
 
73
 }
73
 }
74
 
74
 
84
 }
84
 }
85
 
85
 
86
 func GetAllUserRoleByUserTypeOne(org_id int) (appRole []*models.App_Role) {
86
 func GetAllUserRoleByUserTypeOne(org_id int) (appRole []*models.App_Role) {
87
-	readUserDbT.Model(&models.App_Role{}).Where("status = 1 AND user_type = 1").Find(&appRole)
87
+	readUserDb.Model(&models.App_Role{}).Where("status = 1 AND user_type = 1").Find(&appRole)
88
 	return
88
 	return
89
 }
89
 }
90
 
90
 
92
 	//app, _ := GetOrgApp(int64(org_id), 3)
92
 	//app, _ := GetOrgApp(int64(org_id), 3)
93
 
93
 
94
 	//if org_id == 0 {
94
 	//if org_id == 0 {
95
-	readUserDbT.Model(&models.App_Role{}).Where("status = 1 AND user_type > 1").Find(&appRole)
95
+	readUserDb.Model(&models.App_Role{}).Where("status = 1 AND user_type > 1").Find(&appRole)
96
 	//
96
 	//
97
 	//} else {
97
 	//} else {
98
 	//	readUserDb.Model(&models.App_Role{}).Where("status = 1 AND org_id = ?  AND user_type > 1 AND app_id = ? ", org_id, app.Id).Find(&appRole)
98
 	//	readUserDb.Model(&models.App_Role{}).Where("status = 1 AND org_id = ?  AND user_type > 1 AND app_id = ? ", org_id, app.Id).Find(&appRole)
102
 }
102
 }
103
 
103
 
104
 func FindRoleByUserTypeOne(org_id int64) (role models.Role) {
104
 func FindRoleByUserTypeOne(org_id int64) (role models.Role) {
105
-	readUserDbT.Model(&models.Role{}).Where("status = 1 AND org_id = ? AND is_system = 2 AND role_name = '医生'", org_id).First(&role)
105
+	readUserDb.Model(&models.Role{}).Where("status = 1 AND org_id = ? AND is_system = 2 AND role_name = '医生'", org_id).First(&role)
106
 	return
106
 	return
107
 }
107
 }
108
 
108
 
109
 func FindRoleByUserTypeTwo(org_id int64) (role models.Role) {
109
 func FindRoleByUserTypeTwo(org_id int64) (role models.Role) {
110
-	readUserDbT.Model(&models.Role{}).Where("status = 1 AND org_id = ? AND is_system = 3 AND role_name = '护士'", org_id).First(&role)
110
+	readUserDb.Model(&models.Role{}).Where("status = 1 AND org_id = ? AND is_system = 3 AND role_name = '护士'", org_id).First(&role)
111
 	return
111
 	return
112
 }
112
 }
113
 
113
 
114
 func GetAllRole() ([]*models.Role, error) {
114
 func GetAllRole() ([]*models.Role, error) {
115
 	var app []*models.Role
115
 	var app []*models.Role
116
-	err := readUserDbT.Model(&models.Role{}).Where("status = 1 AND org_id > 0").Group("org_id").Find(&app).Error
116
+	err := readUserDb.Model(&models.Role{}).Where("status = 1 AND org_id > 0").Group("org_id").Find(&app).Error
117
 	if err == gorm.ErrRecordNotFound {
117
 	if err == gorm.ErrRecordNotFound {
118
 		return nil, nil
118
 		return nil, nil
119
 	}
119
 	}
124
 }
124
 }
125
 
125
 
126
 func UpdateRoleIds(id int64, ids string) {
126
 func UpdateRoleIds(id int64, ids string) {
127
-	writeUserDbT.Model(&models.App_Role{}).Where("status = 1 AND id = ?", id).Updates(map[string]interface{}{"role_ids": ids, "mtime": time.Now().Unix()})
127
+	writeUserDb.Model(&models.App_Role{}).Where("status = 1 AND id = ?", id).Updates(map[string]interface{}{"role_ids": ids, "mtime": time.Now().Unix()})
128
 
128
 
129
 }
129
 }
130
 
130
 
131
 func GetOrgAppA(orgID int64, app_type int) (*models.OrgApp, error) {
131
 func GetOrgAppA(orgID int64, app_type int) (*models.OrgApp, error) {
132
 	var apps models.OrgApp
132
 	var apps models.OrgApp
133
-	err := readUserDbT.Where("app_type = ? AND org_id = ? AND status = 1", app_type, orgID).First(&apps).Error
133
+	err := readUserDb.Where("app_type = ? AND org_id = ? AND status = 1", app_type, orgID).First(&apps).Error
134
 	if err != nil {
134
 	if err != nil {
135
 		return nil, err
135
 		return nil, err
136
 	}
136
 	}
139
 
139
 
140
 func GetOrgByIdB(orgID int64) (*models.Org, error) {
140
 func GetOrgByIdB(orgID int64) (*models.Org, error) {
141
 	var org models.Org
141
 	var org models.Org
142
-	err := readUserDbT.Model(&models.Org{}).Where("id = ?", orgID).First(&org).Error
142
+	err := readUserDb.Model(&models.Org{}).Where("id = ?", orgID).First(&org).Error
143
 	if err != nil {
143
 	if err != nil {
144
 		if err == gorm.ErrRecordNotFound {
144
 		if err == gorm.ErrRecordNotFound {
145
 			return nil, nil
145
 			return nil, nil
152
 
152
 
153
 func GetOrgAppB(orgID int64, app_type int) (*models.OrgApp, error) {
153
 func GetOrgAppB(orgID int64, app_type int) (*models.OrgApp, error) {
154
 	var apps models.OrgApp
154
 	var apps models.OrgApp
155
-	err := readUserDbT.Where("app_type = ? AND org_id = ? AND status = 1", app_type, orgID).First(&apps).Error
155
+	err := readUserDb.Where("app_type = ? AND org_id = ? AND status = 1", app_type, orgID).First(&apps).Error
156
 	if err != nil {
156
 	if err != nil {
157
 		return nil, err
157
 		return nil, err
158
 	}
158
 	}
160
 }
160
 }
161
 
161
 
162
 func CreateOrgRoleB(role *models.Role) (err error) {
162
 func CreateOrgRoleB(role *models.Role) (err error) {
163
-	err = writeUserDbT.Create(&role).Error
163
+	err = writeUserDb.Create(&role).Error
164
 	return
164
 	return
165
 }
165
 }
166
 
166
 
167
 func CreateRolePurviewB(purview *models.RolePurview) (err error) {
167
 func CreateRolePurviewB(purview *models.RolePurview) (err error) {
168
-	err = writeUserDbT.Create(&purview).Error
168
+	err = writeUserDb.Create(&purview).Error
169
 	return
169
 	return
170
 }
170
 }
171
 
171
 
172
 func CreateFuncRolePurviewB(purview *models.SgjUserRoleFuncPurview) (err error) {
172
 func CreateFuncRolePurviewB(purview *models.SgjUserRoleFuncPurview) (err error) {
173
-	err = writeUserDbT.Create(&purview).Error
173
+	err = writeUserDb.Create(&purview).Error
174
 	return
174
 	return
175
 }
175
 }

+ 1 - 1
service/gobal_config_service.go View File

81
 }
81
 }
82
 
82
 
83
 func FindAllHideFiledConfig(template_id int64) (err error, config []*models.FiledConfig) {
83
 func FindAllHideFiledConfig(template_id int64) (err error, config []*models.FiledConfig) {
84
-	err = readDb.Model(&models.FiledConfig{}).Where("sys_module = 0  AND is_show = 2", template_id).Find(&config).Error
84
+	err = readDb.Model(&models.FiledConfig{}).Where("sys_module = ?  AND is_show = 2", template_id).Find(&config).Error
85
 	return
85
 	return
86
 }
86
 }
87
 
87