Bladeren bron

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

XMLWAN 5 jaren geleden
bovenliggende
commit
348dbdc14d

+ 3 - 4
conf/app.conf Bestand weergeven

122
 
122
 
123
 
123
 
124
 
124
 
125
+
125
 niprocart =  63
126
 niprocart =  63
126
 jms = 58
127
 jms = 58
127
 fistula_needle_set = 65
128
 fistula_needle_set = 65
148
 readmysqlport = 3306
149
 readmysqlport = 3306
149
 readmysqluser = root
150
 readmysqluser = root
150
 readmysqlpass = 1Q2W3e4r!@#$
151
 readmysqlpass = 1Q2W3e4r!@#$
151
-//readmysqlname = test_xt
152
 readmysqlname = sgj_xt
152
 readmysqlname = sgj_xt
153
 
153
 
154
 writemysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
154
 writemysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
155
 writemysqlport = 3306
155
 writemysqlport = 3306
156
 writemysqluser = root
156
 writemysqluser = root
157
 writemysqlpass = 1Q2W3e4r!@#$
157
 writemysqlpass = 1Q2W3e4r!@#$
158
-//writemysqlname = test_xt
159
 writemysqlname = sgj_xt
158
 writemysqlname = sgj_xt
160
 
159
 
161
 readuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
160
 readuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
163
 readuseruser = root
162
 readuseruser = root
164
 readuserpass = 1Q2W3e4r!@#$
163
 readuserpass = 1Q2W3e4r!@#$
165
 readusername = sgj_users
164
 readusername = sgj_users
166
-//readusername = test_users
165
+
167
 
166
 
168
 writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
167
 writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
169
 writeuserport = 3306
168
 writeuserport = 3306
170
 writeuseruser = root
169
 writeuseruser = root
171
 writeuserpass = 1Q2W3e4r!@#$
170
 writeuserpass = 1Q2W3e4r!@#$
172
 writeusername = sgj_users
171
 writeusername = sgj_users
173
-//writeusername = test_users
172
+
174
 
173
 
175
 
174
 
176
 readmiddlehost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
175
 readmiddlehost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com

+ 59 - 60
controllers/base_api_controller.go Bestand weergeven

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

+ 11 - 1
controllers/dialysis_api_controller.go Bestand weergeven

1369
 			}
1369
 			}
1370
 		}
1370
 		}
1371
 
1371
 
1372
-		prescription.Creater = adminUserInfo.AdminUser.Id
1372
+		if appRole.UserType == 2 || appRole.UserType == 1 {
1373
+			prescription_doctor := adminUserInfo.AdminUser.Id
1374
+			prescription.PrescriptionDoctor = prescription_doctor
1375
+		}
1376
+		if dialysisPrescription.Creater == 0 { //体重称
1377
+			prescription.Creater = adminUserInfo.AdminUser.Id
1378
+
1379
+		} else {
1380
+			prescription.Creater = dialysisPrescription.Creater
1381
+		}
1382
+
1373
 		prescription.CreatedTime = dialysisPrescription.CreatedTime
1383
 		prescription.CreatedTime = dialysisPrescription.CreatedTime
1374
 		prescription.UpdatedTime = time.Now().Unix()
1384
 		prescription.UpdatedTime = time.Now().Unix()
1375
 		prescription.Modifier = adminUserInfo.AdminUser.Id
1385
 		prescription.Modifier = adminUserInfo.AdminUser.Id

+ 16 - 7
controllers/mobile_api_controllers/dialysis_api_controller.go Bestand weergeven

1017
 	//}
1017
 	//}
1018
 
1018
 
1019
 	//TODO 需要根据角色去判断
1019
 	//TODO 需要根据角色去判断
1020
-	if appRole.UserType == 2 || appRole.UserType == 1 {
1021
-		prescription_doctor = appRole.AdminUserId
1022
-	} else {
1023
-		prescription_doctor = 0
1024
-	}
1025
 
1020
 
1026
 	prescription := models.DialysisPrescription{
1021
 	prescription := models.DialysisPrescription{
1027
 
1022
 
1091
 		//if mode_id > 0 {
1086
 		//if mode_id > 0 {
1092
 		//	//service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id)
1087
 		//	//service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id)
1093
 		//}
1088
 		//}
1089
+		if appRole.UserType == 2 || appRole.UserType == 1 {
1090
+			prescription_doctor = adminUserInfo.AdminUser.Id
1091
+		} else {
1092
+			prescription_doctor = 0
1093
+		}
1094
+
1094
 		prescription.Creater = adminUserInfo.AdminUser.Id
1095
 		prescription.Creater = adminUserInfo.AdminUser.Id
1095
 		err := service.AddSigleRecord(&prescription)
1096
 		err := service.AddSigleRecord(&prescription)
1096
 
1097
 
2235
 
2236
 
2236
 		prescription.CreatedTime = dialysisPrescription.CreatedTime
2237
 		prescription.CreatedTime = dialysisPrescription.CreatedTime
2237
 		prescription.Modifier = adminUserInfo.AdminUser.Id
2238
 		prescription.Modifier = adminUserInfo.AdminUser.Id
2238
-		prescription.Creater = adminUserInfo.AdminUser.Id
2239
+		if appRole.UserType == 2 || appRole.UserType == 1 {
2240
+			prescription_doctor := adminUserInfo.AdminUser.Id
2241
+			prescription.PrescriptionDoctor = prescription_doctor
2242
+		}
2243
+		if dialysisPrescription.Creater == 0 { //体重称
2244
+			prescription.Creater = adminUserInfo.AdminUser.Id
2245
+
2246
+		} else {
2247
+			prescription.Creater = dialysisPrescription.Creater
2248
+		}
2239
 
2249
 
2240
-		prescription.PrescriptionDoctor = adminUserInfo.AdminUser.Id
2241
 		prescription.ID = dialysisPrescription.ID
2250
 		prescription.ID = dialysisPrescription.ID
2242
 		err := service.UpDateDialysisPrescription(&prescription)
2251
 		err := service.UpDateDialysisPrescription(&prescription)
2243
 		if err == nil {
2252
 		if err == nil {

+ 18 - 10
controllers/mobile_api_controllers/mobile_api_base_controller.go Bestand weergeven

49
 
49
 
50
 func (this *MobileBaseAPIAuthController) Prepare() {
50
 func (this *MobileBaseAPIAuthController) Prepare() {
51
 	token := this.Ctx.GetCookie("token_cookie")
51
 	token := this.Ctx.GetCookie("token_cookie")
52
-	//logout_cookie := this.Ctx.GetCookie("logout_cookie")
52
+	logout_cookie := this.Ctx.GetCookie("logout_cookie")
53
 
53
 
54
 	//if len(token) == 0{
54
 	//if len(token) == 0{
55
 	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
55
 	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
58
 	this.MobileBaseAPIController.Prepare()
58
 	this.MobileBaseAPIController.Prepare()
59
 	adminUserInfo := this.GetMobileAdminUserInfo()
59
 	adminUserInfo := this.GetMobileAdminUserInfo()
60
 
60
 
61
-	if adminUserInfo == nil {
62
-		this.DelSession("mobile_admin_user_info")
63
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
64
-		this.StopRun()
65
-	}
66
-
61
+	fmt.Println(token)
67
 	if len(token) == 0 {
62
 	if len(token) == 0 {
68
-
69
 		this.DelSession("mobile_admin_user_info")
63
 		this.DelSession("mobile_admin_user_info")
70
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeLoginTimeout)
71
-		this.StopRun()
64
+		fmt.Println(logout_cookie)
65
+		if len(logout_cookie) == 1 {
66
+			this.Ctx.SetCookie("logout_cookie", "2")
67
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeLogOut)
68
+			this.StopRun()
69
+		} else {
70
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeLoginTimeout)
71
+			this.StopRun()
72
+		}
73
+
74
+	} else {
75
+		if adminUserInfo == nil {
76
+			this.DelSession("mobile_admin_user_info")
77
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
78
+			this.StopRun()
79
+		}
72
 	}
80
 	}
73
 
81
 
74
 	//if this.Ctx.Request.Method != "GET" {
82
 	//if this.Ctx.Request.Method != "GET" {

+ 13 - 20
controllers/mobile_api_controllers/patient_api_controller.go Bestand weergeven

609
 	advice.ExecutionStaff = execution_staff
609
 	advice.ExecutionStaff = execution_staff
610
 	advice.ExecutionTime = theTime.Unix()
610
 	advice.ExecutionTime = theTime.Unix()
611
 	advice.ExecutionState = 1
611
 	advice.ExecutionState = 1
612
+	advice.Modifier = adminUserInfo.AdminUser.Id
612
 
613
 
613
 	c.ServeSuccessJSON(map[string]interface{}{
614
 	c.ServeSuccessJSON(map[string]interface{}{
614
 		"msg":    "ok",
615
 		"msg":    "ok",
2185
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
2186
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
2186
 		return
2187
 		return
2187
 	}
2188
 	}
2188
-	//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
2189
-
2190
-	//if appRole.UserType == 3{
2191
-	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdvicePermissionDeniedModify)
2192
-	//	return
2193
-	//}
2194
-	//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
2195
-
2196
-	//if appRole.UserType == 3 {
2197
-	//	headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
2198
-	//	if getPermissionErr != nil {
2199
-	//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2200
-	//		return
2201
-	//	} else if headNursePermission == nil {
2202
-	//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
2203
-	//		return
2204
-	//	}
2205
-	//}
2206
-	//TODO根据路由做权限
2207
 
2189
 
2208
 	group_no, _ := c.GetInt64("group_no")
2190
 	group_no, _ := c.GetInt64("group_no")
2209
 	if group_no <= 0 {
2191
 	if group_no <= 0 {
2233
 		return
2215
 		return
2234
 	}
2216
 	}
2235
 
2217
 
2218
+	if dataBody["start_time"] == nil || reflect.TypeOf(dataBody["start_time"]).String() != "string" {
2219
+		utils.ErrorLog("start_time")
2220
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2221
+		return
2222
+	}
2223
+
2224
+	startTime2, _ := dataBody["start_time"].(string)
2225
+	time_arr := strings.Split(startTime2, " ")
2226
+	if len(time_arr) > 0 {
2227
+		startTime2 = time_arr[0]
2228
+	}
2236
 	if dataBody["advice_date"] == nil || reflect.TypeOf(dataBody["advice_date"]).String() != "string" {
2229
 	if dataBody["advice_date"] == nil || reflect.TypeOf(dataBody["advice_date"]).String() != "string" {
2237
 		utils.ErrorLog("advice_date")
2230
 		utils.ErrorLog("advice_date")
2238
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2231
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2239
 		return
2232
 		return
2240
 	}
2233
 	}
2241
-	adviceDate, _ := dataBody["advice_date"].(string)
2234
+	adviceDate := startTime2
2242
 	if len(adviceDate) == 0 {
2235
 	if len(adviceDate) == 0 {
2243
 		utils.ErrorLog("len(adviceDate) == 0")
2236
 		utils.ErrorLog("len(adviceDate) == 0")
2244
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2237
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)

+ 2 - 2
controllers/new_mobile_api_controllers/home_api_controller.go Bestand weergeven

371
 		InitRoleAndPurviews(org)
371
 		InitRoleAndPurviews(org)
372
 		//初始化设备管理
372
 		//初始化设备管理
373
 		InitEquitMentInformation(org)
373
 		InitEquitMentInformation(org)
374
-		//初始化显示配置
375
-		//InitShowConfig(org)
374
+		//初始化显示配置和打印模版
375
+		InitShowConfig(org)
376
 
376
 
377
 		if len(orgs) == 0 {
377
 		if len(orgs) == 0 {
378
 			ip := utils.GetIP(this.Ctx.Request)
378
 			ip := utils.GetIP(this.Ctx.Request)

+ 10 - 2
controllers/new_mobile_api_controllers/mobile_regist_controller.go Bestand weergeven

239
 		InitRoleAndPurviews(org)
239
 		InitRoleAndPurviews(org)
240
 		//初始化设备管理org
240
 		//初始化设备管理org
241
 		InitEquitMentInformation(org)
241
 		InitEquitMentInformation(org)
242
-		//初始化显示配置
243
-		//InitShowConfig(org)
242
+		//初始化显示配置和打印模版
243
+		InitShowConfig(org)
244
 
244
 
245
 		//创建完机构后进行登录验证操作
245
 		//创建完机构后进行登录验证操作
246
 		ip := utils.GetIP(this.Ctx.Request)
246
 		ip := utils.GetIP(this.Ctx.Request)
1174
 
1174
 
1175
 func InitShowConfig(org *models.Org) {
1175
 func InitShowConfig(org *models.Org) {
1176
 	service.BatchInsertFiledSystemConfig(org.Id)
1176
 	service.BatchInsertFiledSystemConfig(org.Id)
1177
+	template := &models.VMGobalTemplate{
1178
+		Status:     1,
1179
+		Ctime:      time.Now().Unix(),
1180
+		Mtime:      time.Now().Unix(),
1181
+		OrgId:      org.Id,
1182
+		TemplateId: 2,
1183
+	}
1184
+	service.CreateVMPrintTemplate(template)
1177
 }
1185
 }

+ 0 - 2
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Bestand weergeven

2023
 }
2023
 }
2024
 
2024
 
2025
 func (this *NewDialysisApiController) LoginOut() {
2025
 func (this *NewDialysisApiController) LoginOut() {
2026
-
2027
-	this.DelSession("mobile_admin_user_info")
2028
 	this.Ctx.SetCookie("logout_cookie", "1")
2026
 	this.Ctx.SetCookie("logout_cookie", "1")
2029
 	this.Ctx.SetCookie("token_cookie", "")
2027
 	this.Ctx.SetCookie("token_cookie", "")
2030
 	id, _ := this.GetInt64("id")
2028
 	id, _ := this.GetInt64("id")

+ 2 - 2
controllers/new_mobile_api_controllers/patient.json Bestand weergeven

15
       "nation": "汉",
15
       "nation": "汉",
16
       "native_place": "广东深圳",
16
       "native_place": "广东深圳",
17
       "marital_status": 1,
17
       "marital_status": 1,
18
-      "id_card_no": "431230199808081111",
18
+      "id_card_no": "999999190001019999",
19
       "birthday": -312537600,
19
       "birthday": -312537600,
20
       "reimbursement_way_id": 7,
20
       "reimbursement_way_id": 7,
21
       "health_care_type": 0,
21
       "health_care_type": 0,
95
       "nation": "汉",
95
       "nation": "汉",
96
       "native_place": "广东深圳",
96
       "native_place": "广东深圳",
97
       "marital_status": 1,
97
       "marital_status": 1,
98
-      "id_card_no": "4312301999090952222",
98
+      "id_card_no": "999999190001018888",
99
       "birthday": -312537600,
99
       "birthday": -312537600,
100
       "reimbursement_way_id": 7,
100
       "reimbursement_way_id": 7,
101
       "health_care_type": 0,
101
       "health_care_type": 0,

+ 5 - 16
controllers/new_mobile_api_controllers/role.json Bestand weergeven

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,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",
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,83,94",
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
     {
19
       "number": 9998,
19
       "number": 9998,
20
       "purview_ids": "71,72,70,74,75,73,48,52,110,77,78,79,80,197,76,93,121,122,124,125,120,127,128,193,194,196,192,101,100,102,49",
20
       "purview_ids": "71,72,70,74,75,73,48,52,110,77,78,79,80,197,76,93,121,122,124,125,120,127,128,193,194,196,192,101,100,102,49",
21
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028,20029,20030"
21
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028,20029,20030"
22
-
23
-
24
     },
22
     },
25
     {
23
     {
26
       "role_name": "护士",
24
       "role_name": "护士",
29
       "status": 1,
27
       "status": 1,
30
       "is_system": 3,
28
       "is_system": 3,
31
       "number": 9997,
29
       "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",
30
+      "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,83,94",
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"
31
       "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
-    {
32
+    },{
36
       "role_name": "库存",
33
       "role_name": "库存",
37
       "role_introduction": "库存角色负责透析耗材的日常管理,对耗材的入库、出库、退库的登记操作",
34
       "role_introduction": "库存角色负责透析耗材的日常管理,对耗材的入库、出库、退库的登记操作",
38
       "is_super_admin": false,
35
       "is_super_admin": false,
39
       "status": 1,
36
       "status": 1,
40
       "is_system": 0,
37
       "is_system": 0,
41
       "number": 9996,
38
       "number": 9996,
42
-      "purview_ids": "111,112,113,114,115,116,117,118,119,129,84",
39
+      "purview_ids": "111,112,113,114,115,116,117,118,119,129,84,83,94",
43
       "func_ids": ""
40
       "func_ids": ""
44
-
45
-
46
-
47
     },{
41
     },{
48
       "role_name": "运营",
42
       "role_name": "运营",
49
       "role_introduction": "运营角色能够在SCRM中管理微网站、使用营销工具、做会员管理和分销商品经营的操作",
43
       "role_introduction": "运营角色能够在SCRM中管理微网站、使用营销工具、做会员管理和分销商品经营的操作",
53
       "number": 9995,
47
       "number": 9995,
54
       "purview_ids": "48,110,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201",
48
       "purview_ids": "48,110,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201",
55
       "func_ids": ""
49
       "func_ids": ""
56
-
57
-
58
-
59
     },{
50
     },{
60
       "role_name": "技师",
51
       "role_name": "技师",
61
       "role_introduction": "技师角色能够进行设备的管理,日常维护维修记录等",
52
       "role_introduction": "技师角色能够进行设备的管理,日常维护维修记录等",
65
       "number": 9994,
56
       "number": 9994,
66
       "purview_ids": "77,78,79,80,197,76",
57
       "purview_ids": "77,78,79,80,197,76",
67
       "func_ids": ""
58
       "func_ids": ""
68
-
69
-
70
     },
59
     },
71
     {
60
     {
72
       "role_name": "院长",
61
       "role_name": "院长",
75
       "status": 1,
64
       "status": 1,
76
       "is_system": 0,
65
       "is_system": 0,
77
       "number": 9993,
66
       "number": 9993,
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",
67
+      "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,83,94",
79
       "func_ids": ""
68
       "func_ids": ""
80
 
69
 
81
 
70
 

+ 99 - 94
controllers/patient_api_controller.go Bestand weergeven

243
 	//获取老表的最后一条数据
243
 	//获取老表的最后一条数据
244
 	patients, err := service.GetLastPatientData(adminUserInfo.CurrentOrgId)
244
 	patients, err := service.GetLastPatientData(adminUserInfo.CurrentOrgId)
245
 	patientsNew := models.XtPatientsNew{
245
 	patientsNew := models.XtPatientsNew{
246
-		UserOrgId:                    adminUserInfo.CurrentOrgId,
247
-		UserId:                       0,
248
-		Avatar:                       patients.Avatar,
249
-		PatientType:                  patients.PatientType,
250
-		DialysisNo:                   patients.DialysisNo,
251
-		AdmissionNumber:              patients.AdmissionNumber,
252
-		Source:                       patients.Source,
253
-		Lapseto:                      patients.Lapseto,
254
-		PartitionId:                  patients.PartitionId,
255
-		BedId:                        patients.BedId,
256
-		Name:                         patients.Name,
257
-		Alias:                        patients.Alias,
258
-		Gender:                       patients.Gender,
259
-		MaritalStatus:                patients.MaritalStatus,
260
-		IdCardNo:                     patients.IdCardNo,
261
-		Birthday:                     patients.Birthday,
262
-		ReimbursementWayId:           patients.ReimbursementWayId,
263
-		HealthCareType:               patients.HealthCareType,
264
-		HealthCareNo:                 patients.HealthCareNo,
265
-		HealthCareDueDate:            patients.HealthCareDueDate,
266
-		Height:                       patients.Height,
267
-		BloodType:                    patients.BloodType,
268
-		Rh:                           patients.Rh,
246
+		UserOrgId:          adminUserInfo.CurrentOrgId,
247
+		UserId:             0,
248
+		Avatar:             patients.Avatar,
249
+		PatientType:        patients.PatientType,
250
+		DialysisNo:         patients.DialysisNo,
251
+		AdmissionNumber:    patients.AdmissionNumber,
252
+		Source:             patients.Source,
253
+		Lapseto:            patients.Lapseto,
254
+		PartitionId:        patients.PartitionId,
255
+		BedId:              patients.BedId,
256
+		Name:               patients.Name,
257
+		Alias:              patients.Alias,
258
+		Gender:             patients.Gender,
259
+		MaritalStatus:      patients.MaritalStatus,
260
+		IdCardNo:           patients.IdCardNo,
261
+		Birthday:           patients.Birthday,
262
+		ReimbursementWayId: patients.ReimbursementWayId,
263
+		HealthCareType:     patients.HealthCareType,
264
+		HealthCareNo:       patients.HealthCareNo,
265
+		HealthCareDueDate:  patients.HealthCareDueDate,
266
+		Height:             patients.Height,
267
+		BloodType:          patients.BloodType,
268
+		Rh:                 patients.Rh,
269
 		HealthCareDueAlertDate:       patients.HealthCareDueAlertDate,
269
 		HealthCareDueAlertDate:       patients.HealthCareDueAlertDate,
270
 		EducationLevel:               patients.EducationLevel,
270
 		EducationLevel:               patients.EducationLevel,
271
 		Profession:                   patients.Profession,
271
 		Profession:                   patients.Profession,
311
 		Nation:                       patients.Nation,
311
 		Nation:                       patients.Nation,
312
 		NativePlace:                  patients.NativePlace,
312
 		NativePlace:                  patients.NativePlace,
313
 		Age:                          patients.Age,
313
 		Age:                          patients.Age,
314
-		InfectiousNextRecordTime:     patients.InfectiousNextRecordTime,
315
-		IsInfectious:                 patients.IsInfectious,
316
-		RemindCycle:                  patients.RemindCycle,
317
-		ResponseResult:               patients.ResponseResult,
318
-		IsOpenRemind:                 patients.IsOpenRemind,
319
-		FirstTreatmentDate:           patients.FirstTreatmentDate,
320
-		DialysisAge:                  patients.DialysisAge,
321
-		ExpenseKind:                  patients.ExpenseKind,
322
-		TellPhone:                    patients.TellPhone,
323
-		ContactName:                  patients.ContactName,
324
-		BloodPatients:                1,
325
-		SlowPatients:                 0,
326
-		MemberPatients:               0,
327
-		EcommerPatients:              "",
328
-		BloodId:                      patients.ID,
329
-		SlowId:                       0,
330
-		MemberId:                     0,
331
-		MemberFistdate:               0,
332
-		MemberPatienttype:            0,
333
-		MemberTreatement:             0,
334
-		EquitmentId:                  "",
314
+		InfectiousNextRecordTime: patients.InfectiousNextRecordTime,
315
+		IsInfectious:             patients.IsInfectious,
316
+		RemindCycle:              patients.RemindCycle,
317
+		ResponseResult:           patients.ResponseResult,
318
+		IsOpenRemind:             patients.IsOpenRemind,
319
+		FirstTreatmentDate:       patients.FirstTreatmentDate,
320
+		DialysisAge:              patients.DialysisAge,
321
+		ExpenseKind:              patients.ExpenseKind,
322
+		TellPhone:                patients.TellPhone,
323
+		ContactName:              patients.ContactName,
324
+		BloodPatients:            1,
325
+		SlowPatients:             0,
326
+		MemberPatients:           0,
327
+		EcommerPatients:          "",
328
+		BloodId:                  patients.ID,
329
+		SlowId:                   0,
330
+		MemberId:                 0,
331
+		MemberFistdate:           0,
332
+		MemberPatienttype:        0,
333
+		MemberTreatement:         0,
334
+		EquitmentId:              "",
335
 	}
335
 	}
336
 
336
 
337
 	err = service.CreatePatientsNew(&patientsNew)
337
 	err = service.CreatePatientsNew(&patientsNew)
459
 	}
459
 	}
460
 	fmt.Println("病人--------------------------------------------------------------", patient.Name, patient.Age)
460
 	fmt.Println("病人--------------------------------------------------------------", patient.Name, patient.Age)
461
 	patientsNew := models.XtPatientsNew{
461
 	patientsNew := models.XtPatientsNew{
462
-		UserOrgId:                 patient.UserOrgId,
463
-		UserId:                    patient.UserId,
464
-		Avatar:                    patient.Avatar,
465
-		PatientType:               patient.PatientType,
466
-		DialysisNo:                patient.DialysisNo,
467
-		AdmissionNumber:           patient.AdmissionNumber,
468
-		Source:                    patient.Source,
469
-		Lapseto:                   patient.Lapseto,
470
-		PartitionId:               patient.PartitionId,
471
-		BedId:                     patient.BedId,
472
-		Name:                      patient.Name,
473
-		Alias:                     patient.Alias,
474
-		Gender:                    patient.Gender,
475
-		MaritalStatus:             patient.MaritalStatus,
476
-		IdCardNo:                  patient.IdCardNo,
477
-		Birthday:                  patient.Birthday,
478
-		ReimbursementWayId:        patient.ReimbursementWayId,
479
-		HealthCareType:            patient.HealthCareType,
480
-		HealthCareNo:              patient.HealthCareNo,
481
-		HealthCareDueDate:         patient.HealthCareDueDate,
482
-		Height:                    patient.Height,
483
-		BloodType:                 patient.BloodType,
484
-		Rh:                        patient.Rh,
462
+		UserOrgId:          patient.UserOrgId,
463
+		UserId:             patient.UserId,
464
+		Avatar:             patient.Avatar,
465
+		PatientType:        patient.PatientType,
466
+		DialysisNo:         patient.DialysisNo,
467
+		AdmissionNumber:    patient.AdmissionNumber,
468
+		Source:             patient.Source,
469
+		Lapseto:            patient.Lapseto,
470
+		PartitionId:        patient.PartitionId,
471
+		BedId:              patient.BedId,
472
+		Name:               patient.Name,
473
+		Alias:              patient.Alias,
474
+		Gender:             patient.Gender,
475
+		MaritalStatus:      patient.MaritalStatus,
476
+		IdCardNo:           patient.IdCardNo,
477
+		Birthday:           patient.Birthday,
478
+		ReimbursementWayId: patient.ReimbursementWayId,
479
+		HealthCareType:     patient.HealthCareType,
480
+		HealthCareNo:       patient.HealthCareNo,
481
+		HealthCareDueDate:  patient.HealthCareDueDate,
482
+		Height:             patient.Height,
483
+		BloodType:          patient.BloodType,
484
+		Rh:                 patient.Rh,
485
 		HealthCareDueAlertDate:    patient.HealthCareDueAlertDate,
485
 		HealthCareDueAlertDate:    patient.HealthCareDueAlertDate,
486
 		EducationLevel:            patient.EducationLevel,
486
 		EducationLevel:            patient.EducationLevel,
487
 		Profession:                patient.Profession,
487
 		Profession:                patient.Profession,
523
 		Nation:                    patient.Nation,
523
 		Nation:                    patient.Nation,
524
 		NativePlace:               patient.NativePlace,
524
 		NativePlace:               patient.NativePlace,
525
 		Age:                       patient.Age,
525
 		Age:                       patient.Age,
526
-		InfectiousNextRecordTime:  patient.InfectiousNextRecordTime,
527
-		IsInfectious:              patient.IsInfectious,
528
-		RemindCycle:               patient.RemindCycle,
529
-		ResponseResult:            patient.ResponseResult,
530
-		IsOpenRemind:              patient.IsOpenRemind,
531
-		FirstTreatmentDate:        patient.FirstTreatmentDate,
532
-		DialysisAge:               patient.DialysisAge,
533
-		ExpenseKind:               patient.ExpenseKind,
534
-		TellPhone:                 patient.TellPhone,
535
-		ContactName:               patient.ContactName,
536
-		UpdatedTime:               time.Now().Unix(),
526
+		InfectiousNextRecordTime: patient.InfectiousNextRecordTime,
527
+		IsInfectious:             patient.IsInfectious,
528
+		RemindCycle:              patient.RemindCycle,
529
+		ResponseResult:           patient.ResponseResult,
530
+		IsOpenRemind:             patient.IsOpenRemind,
531
+		FirstTreatmentDate:       patient.FirstTreatmentDate,
532
+		DialysisAge:              patient.DialysisAge,
533
+		ExpenseKind:              patient.ExpenseKind,
534
+		TellPhone:                patient.TellPhone,
535
+		ContactName:              patient.ContactName,
536
+		UpdatedTime:              time.Now().Unix(),
537
 	}
537
 	}
538
 	//	//更新病人ID获取新表病人ID
538
 	//	//更新病人ID获取新表病人ID
539
 	err = service.UpdatepatientTwo(&patientsNew, id)
539
 	err = service.UpdatepatientTwo(&patientsNew, id)
1060
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1060
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1061
 		return
1061
 		return
1062
 	}
1062
 	}
1063
-	adviceDate, _ := dataBody["advice_date"].(string)
1063
+
1064
+	if dataBody["start_time"] == nil || reflect.TypeOf(dataBody["start_time"]).String() != "string" {
1065
+		utils.ErrorLog("start_time")
1066
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1067
+		return
1068
+	}
1069
+
1070
+	startTime2, _ := dataBody["start_time"].(string)
1071
+
1072
+	time_arr := strings.Split(startTime2, " ")
1073
+
1074
+	if len(time_arr) > 0 {
1075
+		startTime2 = time_arr[0]
1076
+	}
1077
+
1078
+	if dataBody["advice_date"] == nil || reflect.TypeOf(dataBody["advice_date"]).String() != "string" {
1079
+		utils.ErrorLog("advice_date")
1080
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1081
+		return
1082
+	}
1083
+	adviceDate := startTime2
1064
 	if len(adviceDate) == 0 {
1084
 	if len(adviceDate) == 0 {
1065
 		utils.ErrorLog("len(adviceDate) == 0")
1085
 		utils.ErrorLog("len(adviceDate) == 0")
1066
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1086
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1547
 		return
1567
 		return
1548
 	}
1568
 	}
1549
 
1569
 
1550
-	if advice.ExecutionStaff == 0 {
1551
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceCheckBeforeExce)
1552
-		return
1553
-	}
1554
-
1555
 	if advice.ExecutionStaff >= 0 && advice.ExecutionStaff == adminUserInfo.AdminUser.Id {
1570
 	if advice.ExecutionStaff >= 0 && advice.ExecutionStaff == adminUserInfo.AdminUser.Id {
1556
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeExceAndCheckNotOneUser)
1571
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeExceAndCheckNotOneUser)
1557
 		return
1572
 		return
1561
 
1576
 
1562
 	theTime := time.Now()
1577
 	theTime := time.Now()
1563
 
1578
 
1564
-	//if advice.ExecutionTime > theTime.Unix() {
1565
-	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceExceBeforeStart)
1566
-	//	return
1567
-	//}
1568
-
1569
 	exceAdvice := models.DoctorAdvice{
1579
 	exceAdvice := models.DoctorAdvice{
1570
 		Checker:     checker,
1580
 		Checker:     checker,
1571
 		CheckTime:   theTime.Unix(),
1581
 		CheckTime:   theTime.Unix(),
1614
 		return
1624
 		return
1615
 	}
1625
 	}
1616
 
1626
 
1617
-	if advice.ExecutionStaff == 0 {
1618
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceCheckBeforeExce)
1619
-		return
1620
-	}
1621
-
1622
 	if advice.ExecutionStaff >= 0 && advice.ExecutionStaff == adminUserInfo.AdminUser.Id {
1627
 	if advice.ExecutionStaff >= 0 && advice.ExecutionStaff == adminUserInfo.AdminUser.Id {
1623
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeExceAndCheckNotOneUser)
1628
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeExceAndCheckNotOneUser)
1624
 		return
1629
 		return

+ 43 - 39
controllers/public_api_controller.go Bestand weergeven

165
 func (c *PublicApiController) HandleData() {
165
 func (c *PublicApiController) HandleData() {
166
 	//org_app, _ := service.GetAllAppOrg()
166
 	//org_app, _ := service.GetAllAppOrg()
167
 	//org_role, _ := service.GetAllRole()
167
 	//org_role, _ := service.GetAllRole()
168
-
168
+	//
169
 	//var org_ids []int64
169
 	//var org_ids []int64
170
 
170
 
171
 	//for _, apps := range org_app {
171
 	//for _, apps := range org_app {
489
 	//InitRoleAndPurviews(org_ids)
489
 	//InitRoleAndPurviews(org_ids)
490
 
490
 
491
 	//var org_id int = 0
491
 	//var org_id int = 0
492
-	////管理员
492
+	//管理员
493
 	//app_roles  := service.GetAllUserRoleByUserTypeOne(org_id)
493
 	//app_roles  := service.GetAllUserRoleByUserTypeOne(org_id)
494
 	//for _, item := range app_roles{
494
 	//for _, item := range app_roles{
495
 	//	var ids string
495
 	//	var ids string
500
 	//	}
500
 	//	}
501
 	//	service.UpdateRoleIds(item.Id, ids)
501
 	//	service.UpdateRoleIds(item.Id, ids)
502
 	//}
502
 	//}
503
-	////护士医生
503
+	//护士医生
504
 	//app_roles2  := service.GetAllUserRoleByUserTypeOther()
504
 	//app_roles2  := service.GetAllUserRoleByUserTypeOther()
505
 	//	for _, item := range app_roles2{
505
 	//	for _, item := range app_roles2{
506
 	//		var ids string
506
 	//		var ids string
529
 	roles := LoadRoleConfig("./role.json").Roles
529
 	roles := LoadRoleConfig("./role.json").Roles
530
 	for _, org_id := range org_ids {
530
 	for _, org_id := range org_ids {
531
 		app, _ := service.GetOrgAppB(org_id, 3)
531
 		app, _ := service.GetOrgAppB(org_id, 3)
532
+		role, _ := service.GetSystemRole(org_id)
533
+
532
 		if app == nil || app.Id == 0 {
534
 		if app == nil || app.Id == 0 {
533
 			continue
535
 			continue
534
 		}
536
 		}
535
-		for _, item := range roles {
536
-			role := &models.Role{
537
-				RoleName:     item.RoleName,
538
-				RoleIntro:    item.RoleIntroduction,
539
-				Creator:      0,
540
-				OrgId:        org_id,
541
-				AppId:        app.Id,
542
-				IsSuperAdmin: false,
543
-				Status:       1,
544
-				CreateTime:   time.Now().Unix(),
545
-				ModifyTime:   time.Now().Unix(),
546
-				Number:       item.Number,
547
-				IsSystem:     item.IsSystem,
548
-			}
549
-			err := service.CreateOrgRoleB(role)
550
-			if err == nil {
551
-				purview := &models.RolePurview{
552
-					RoleId:     role.Id,
553
-					OrgId:      org_id,
554
-					AppId:      role.AppId,
555
-					PurviewIds: item.PurviewIds,
556
-					Status:     1,
557
-					CreateTime: time.Now().Unix(),
558
-					ModifyTime: time.Now().Unix(),
537
+		if len(role) == 0 {
538
+			for _, item := range roles {
539
+				role := &models.Role{
540
+					RoleName:     item.RoleName,
541
+					RoleIntro:    item.RoleIntroduction,
542
+					Creator:      0,
543
+					OrgId:        org_id,
544
+					AppId:        app.Id,
545
+					IsSuperAdmin: false,
546
+					Status:       1,
547
+					CreateTime:   time.Now().Unix(),
548
+					ModifyTime:   time.Now().Unix(),
549
+					Number:       item.Number,
550
+					IsSystem:     item.IsSystem,
559
 				}
551
 				}
560
-				func_purview := &models.SgjUserRoleFuncPurview{
561
-					RoleId:     role.Id,
562
-					OrgId:      org_id,
563
-					AppId:      role.AppId,
564
-					PurviewIds: item.FuncIds,
565
-					Status:     1,
566
-					Ctime:      time.Now().Unix(),
567
-					Mtime:      time.Now().Unix(),
552
+				err := service.CreateOrgRoleB(role)
553
+				if err == nil {
554
+					purview := &models.RolePurview{
555
+						RoleId:     role.Id,
556
+						OrgId:      org_id,
557
+						AppId:      role.AppId,
558
+						PurviewIds: item.PurviewIds,
559
+						Status:     1,
560
+						CreateTime: time.Now().Unix(),
561
+						ModifyTime: time.Now().Unix(),
562
+					}
563
+					func_purview := &models.SgjUserRoleFuncPurview{
564
+						RoleId:     role.Id,
565
+						OrgId:      org_id,
566
+						AppId:      role.AppId,
567
+						PurviewIds: item.FuncIds,
568
+						Status:     1,
569
+						Ctime:      time.Now().Unix(),
570
+						Mtime:      time.Now().Unix(),
571
+					}
572
+
573
+					service.CreateRolePurviewB(purview)
574
+					service.CreateFuncRolePurviewB(func_purview)
568
 				}
575
 				}
569
-
570
-				service.CreateRolePurviewB(purview)
571
-				service.CreateFuncRolePurviewB(func_purview)
572
 			}
576
 			}
573
-		}
574
 
577
 
578
+		}
575
 	}
579
 	}
576
 
580
 
577
 }
581
 }

+ 4 - 16
controllers/role.json Bestand weergeven

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,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",
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,83,94",
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
     {
19
       "number": 9998,
19
       "number": 9998,
20
       "purview_ids": "71,72,70,74,75,73,48,52,110,77,78,79,80,197,76,93,121,122,124,125,120,127,128,193,194,196,192,101,100,102,49",
20
       "purview_ids": "71,72,70,74,75,73,48,52,110,77,78,79,80,197,76,93,121,122,124,125,120,127,128,193,194,196,192,101,100,102,49",
21
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028,20029,20030"
21
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028,20029,20030"
22
-
23
-
24
     },
22
     },
25
     {
23
     {
26
       "role_name": "护士",
24
       "role_name": "护士",
29
       "status": 1,
27
       "status": 1,
30
       "is_system": 3,
28
       "is_system": 3,
31
       "number": 9997,
29
       "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",
30
+      "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,83,94",
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"
31
       "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
     },{
32
     },{
35
       "role_name": "库存",
33
       "role_name": "库存",
38
       "status": 1,
36
       "status": 1,
39
       "is_system": 0,
37
       "is_system": 0,
40
       "number": 9996,
38
       "number": 9996,
41
-      "purview_ids": "111,112,113,114,115,116,117,118,119,129,84",
39
+      "purview_ids": "111,112,113,114,115,116,117,118,119,129,84,94",
42
       "func_ids": ""
40
       "func_ids": ""
43
-
44
-
45
-
46
     },{
41
     },{
47
       "role_name": "运营",
42
       "role_name": "运营",
48
       "role_introduction": "运营角色能够在SCRM中管理微网站、使用营销工具、做会员管理和分销商品经营的操作",
43
       "role_introduction": "运营角色能够在SCRM中管理微网站、使用营销工具、做会员管理和分销商品经营的操作",
52
       "number": 9995,
47
       "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",
48
       "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": ""
49
       "func_ids": ""
55
-
56
-
57
-
58
     },{
50
     },{
59
       "role_name": "技师",
51
       "role_name": "技师",
60
       "role_introduction": "技师角色能够进行设备的管理,日常维护维修记录等",
52
       "role_introduction": "技师角色能够进行设备的管理,日常维护维修记录等",
64
       "number": 9994,
56
       "number": 9994,
65
       "purview_ids": "77,78,79,80,197,76",
57
       "purview_ids": "77,78,79,80,197,76",
66
       "func_ids": ""
58
       "func_ids": ""
67
-
68
-
69
     },
59
     },
70
     {
60
     {
71
       "role_name": "院长",
61
       "role_name": "院长",
74
       "status": 1,
64
       "status": 1,
75
       "is_system": 0,
65
       "is_system": 0,
76
       "number": 9993,
66
       "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",
67
+      "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,94",
78
       "func_ids": ""
68
       "func_ids": ""
79
-
80
-
81
     }
69
     }
82
   ]
70
   ]
83
 }
71
 }

+ 27 - 1
controllers/verify_login_controller.go Bestand weergeven

8
 	"fmt"
8
 	"fmt"
9
 	"github.com/astaxie/beego"
9
 	"github.com/astaxie/beego"
10
 	"net/url"
10
 	"net/url"
11
+	"regexp"
11
 	"strconv"
12
 	"strconv"
12
 	"strings"
13
 	"strings"
13
 )
14
 )
186
 						var ids string
187
 						var ids string
187
 						for _, role_id := range role_arr {
188
 						for _, role_id := range role_arr {
188
 							id, _ := strconv.ParseInt(role_id, 10, 64)
189
 							id, _ := strconv.ParseInt(role_id, 10, 64)
190
+							role, _ := service.GetRoleByRoleID(id)
191
+							var system_ids = ""
192
+							if role.RoleName == "子管理员" && role.IsSystem > 0 {
193
+								purviews, _ := service.GetSystemPurview()
194
+								for _, purview := range purviews {
195
+									if len(system_ids) == 0 {
196
+										system_ids = strconv.FormatInt(purview.Id, 10)
197
+									} else {
198
+										system_ids = system_ids + "," + strconv.FormatInt(purview.Id, 10)
199
+									}
200
+								}
201
+							}
189
 							purview_ids, _ := service.GetRolePurviewIds(id)
202
 							purview_ids, _ := service.GetRolePurviewIds(id)
190
 							if len(ids) == 0 {
203
 							if len(ids) == 0 {
191
 								ids = purview_ids
204
 								ids = purview_ids
192
 							} else {
205
 							} else {
193
 								ids = ids + "," + purview_ids
206
 								ids = ids + "," + purview_ids
194
 							}
207
 							}
208
+
209
+							if len(system_ids) > 0 {
210
+								ids = ids + "," + system_ids
211
+							}
195
 						}
212
 						}
196
 						if len(ids) != 0 {
213
 						if len(ids) != 0 {
197
-							pruviews, _ = service.GetPurviewById(ids)
214
+							pruviews, _ = service.GetPurviewById(CompressStr(ids))
198
 							for _, item := range pruviews {
215
 							for _, item := range pruviews {
199
 								if item.Module == 3 && item.Parentid > 0 {
216
 								if item.Module == 3 && item.Parentid > 0 {
200
 									fmt.Println(item.Urlfor)
217
 									fmt.Println(item.Urlfor)
361
 		"msg": "密码已修改",
378
 		"msg": "密码已修改",
362
 	})
379
 	})
363
 }
380
 }
381
+
382
+func CompressStr(str string) string {
383
+	if str == "" {
384
+		return ""
385
+	}
386
+	//匹配一个或多个空白符的正则表达式
387
+	reg := regexp.MustCompile("\\s+")
388
+	return reg.ReplaceAllString(str, "")
389
+}

+ 13 - 0
models/vm_models.go Bestand weergeven

317
 func (VMUserRoleAndPurview) TableName() string {
317
 func (VMUserRoleAndPurview) TableName() string {
318
 	return "sgj_user_role"
318
 	return "sgj_user_role"
319
 }
319
 }
320
+
321
+type VMGobalTemplate struct {
322
+	ID         int64 `gorm:"column:id" json:"id" form:"id"`
323
+	OrgId      int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
324
+	TemplateId int64 `gorm:"column:template_id" json:"template_id" form:"template_id"`
325
+	Status     int64 `gorm:"column:status" json:"status" form:"status"`
326
+	Ctime      int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
327
+	Mtime      int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
328
+}
329
+
330
+func (VMGobalTemplate) TableName() string {
331
+	return "xt_gobal_template"
332
+}

+ 9 - 0
service/app_version.go Bestand weergeven

173
 	err = writeUserDb.Create(&purview).Error
173
 	err = writeUserDb.Create(&purview).Error
174
 	return
174
 	return
175
 }
175
 }
176
+
177
+func GetSystemRole(orgID int64) ([]*models.Role, error) {
178
+	var roles []*models.Role
179
+	err := readUserDb.Where(" org_id = ? AND status = 1 AND is_system > 1", orgID).First(&roles).Error
180
+	if err != nil {
181
+		return nil, err
182
+	}
183
+	return roles, nil
184
+}

+ 1 - 0
service/patient_service.go Bestand weergeven

972
 	err := writeDb.Model(&models.DoctorAdvice{}).Where("user_org_id = ? AND status = 1 AND execution_state <> 1 AND check_state <> 1 AND groupno = ? AND admin_user_id = ?", orgID, groupNO, admin_user_id).Updates(map[string]interface{}{
972
 	err := writeDb.Model(&models.DoctorAdvice{}).Where("user_org_id = ? AND status = 1 AND execution_state <> 1 AND check_state <> 1 AND groupno = ? AND admin_user_id = ?", orgID, groupNO, admin_user_id).Updates(map[string]interface{}{
973
 		"start_time":   startTime,
973
 		"start_time":   startTime,
974
 		"updated_time": now,
974
 		"updated_time": now,
975
+		"modifier":     admin_user_id,
975
 	}).Error
976
 	}).Error
976
 	return err
977
 	return err
977
 }
978
 }

+ 5 - 0
service/role_service.go Bestand weergeven

754
 	return
754
 	return
755
 
755
 
756
 }
756
 }
757
+
758
+func GetSystemPurview() (purview []*models.Purview, err error) {
759
+	err = readUserDb.Model(&models.Purview{}).Where("status = 1 AND module = 3 AND super_admin_exclusive = 1").Find(&purview).Error
760
+	return
761
+}

+ 5 - 0
service/vm_service.go Bestand weergeven

76
 	XTWriteDB().Model(&models.VmDeviceTreatmentmode{}).Create(&treatmentmode)
76
 	XTWriteDB().Model(&models.VmDeviceTreatmentmode{}).Create(&treatmentmode)
77
 
77
 
78
 }
78
 }
79
+
80
+func CreateVMPrintTemplate(template *models.VMGobalTemplate) (err error) {
81
+	err = writeDb.Model(&models.VMGobalTemplate{}).Create(template).Error
82
+	return
83
+}