Browse Source

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

csx 4 years ago
parent
commit
0b0fb969c9

+ 9 - 4
conf/app.conf View File

148
 readmysqlport = 3306
148
 readmysqlport = 3306
149
 readmysqluser = root
149
 readmysqluser = root
150
 readmysqlpass = 1Q2W3e4r!@#$
150
 readmysqlpass = 1Q2W3e4r!@#$
151
-readmysqlname = sgj_xt
151
+readmysqlname = test_xt
152
 
152
 
153
 writemysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
153
 writemysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
154
 writemysqlport = 3306
154
 writemysqlport = 3306
155
 writemysqluser = root
155
 writemysqluser = root
156
 writemysqlpass = 1Q2W3e4r!@#$
156
 writemysqlpass = 1Q2W3e4r!@#$
157
-writemysqlname = sgj_xt
157
+writemysqlname = test_xt
158
 
158
 
159
 readuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
159
 readuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
160
 readuserport = 3306
160
 readuserport = 3306
161
 readuseruser = root
161
 readuseruser = root
162
 readuserpass = 1Q2W3e4r!@#$
162
 readuserpass = 1Q2W3e4r!@#$
163
-readusername = sgj_users
163
+readusername = test_users
164
 
164
 
165
 writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
165
 writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
166
 writeuserport = 3306
166
 writeuserport = 3306
167
 writeuseruser = root
167
 writeuseruser = root
168
 writeuserpass = 1Q2W3e4r!@#$
168
 writeuserpass = 1Q2W3e4r!@#$
169
-writeusername = sgj_users
169
+writeusername = test_users
170
 
170
 
171
 
171
 
172
 readmiddlehost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
172
 readmiddlehost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
208
 writesgjpatientmysqlname = sgj_patient
208
 writesgjpatientmysqlname = sgj_patient
209
 
209
 
210
 
210
 
211
+
212
+
213
+
214
+
215
+
211
 #redishost = 120.77.235.13
216
 #redishost = 120.77.235.13
212
 #redishost = 112.74.16.180
217
 #redishost = 112.74.16.180
213
 redishost = localhost
218
 redishost = localhost

+ 115 - 0
conf/接口.txt View File

1
+
2
+//新增临时
3
+/m/api/dialysis/dialysisPrescription?mode=1
4
+修改临处
5
+/m/api/dialysis/dialysisPrescription?mode=2
6
+修改他人临处
7
+/m/api/dialysis/dialysisPrescription?mode=3
8
+
9
+
10
+新增接诊评估
11
+/m/api/dialysis/acceptsAssessment?mode=1
12
+修改接诊评估
13
+/m/api/dialysis/acceptsAssessment?mode=2
14
+修改他人接诊评估
15
+/m/api/dialysis/acceptsAssessment?mode=3
16
+
17
+新增透前评估
18
+/m/api/assessmentbefore/commit?mode=1
19
+修改透前评估
20
+/m/api/assessmentbefore/commit?mode=2
21
+修改他人透前评估
22
+/m/api/assessmentbefore/commit?mode=3
23
+
24
+执行上机
25
+/m/api/dialysis/start?mode=1
26
+修改执行上机
27
+/m/api/startOrder/edit?mode=2
28
+修改他人执行上机
29
+/m/api/startOrder/edit?mode=3
30
+
31
+新增透析监测
32
+/m/api/monitor/add?mode=1
33
+修改透析监测
34
+/m/api/monitor/edit?mode=2
35
+修改他人透析监测
36
+/m/api/monitor/edit?mode=3
37
+删除透析监测
38
+/m/api/monitor/delete?mode=4
39
+删除他人透析监测
40
+/m/api/monitor/delete?mode=5
41
+
42
+执行下机
43
+/m/api/dialysis/finish?mode=1
44
+修改执行下机
45
+/m/api/finishOrder/edit?mode=2
46
+修改他人执行下机
47
+/m/api/finishOrder/edit?mode=3
48
+
49
+新增透后评估
50
+/m/api/dialysis/assessmentAfterDislysis?mode=1
51
+修改透后评估
52
+/m/api/dialysis/assessmentAfterDislysis?mode=2
53
+修改他人透后评估
54
+/m/api/dialysis/assessmentAfterDislysis?mode=3
55
+
56
+新增治疗小结
57
+/m/api/dialysis/treatmentSummary?mode=1
58
+修改治疗小结
59
+/m/api/dialysis/treatmentSummary?mode=2
60
+修改他人治疗小结
61
+/m/api/dialysis/treatmentSummary?mode=3
62
+
63
+新增透析临时医嘱
64
+/m/api/advice/creategroup?mode=1
65
+修改透析临时医嘱
66
+/m/api/advice/edit?mode=2
67
+修改他人透析临时医嘱
68
+/m/api/advice/edit?mode=3
69
+删除透析临时医嘱
70
+/m/api/newadvice/delete?mode=4
71
+删除他人透析临时医嘱
72
+/m/api/newadvice/delete?mode=5
73
+执行透析临时医嘱
74
+/m/api/advice/exec?mode=6
75
+核对透析临时医嘱
76
+/m/api/advice/check?mode=7
77
+修改已执行医嘱
78
+/m/api/advice/exec/modify?mode=8
79
+
80
+
81
+移动端 : /m/api/permission/get      get 请求
82
+参数1: create_url
83
+参数2:modify_url
84
+
85
+参数3:modify_other_url
86
+
87
+参数4:del_url
88
+
89
+参数5:del_other_url
90
+
91
+参数6:exce_url
92
+
93
+参数7:check_url
94
+
95
+参数8:modify_exce_url
96
+参数9:module
97
+
98
+返回值1:is_has_create
99
+返回值2:is_has_modify
100
+
101
+返回值3:is_has_modify_other
102
+
103
+返回值4:is_has_del
104
+
105
+返回值5:is_has_del_other
106
+
107
+返回值6:is_has_exce
108
+
109
+返回值7:is_has_check
110
+
111
+返回值8:is_has_modify_exce
112
+
113
+返回值9:module
114
+
115
+

+ 38 - 47
controllers/new_mobile_api_controllers/mobile_regist_controller.go View File

517
 	fmt.Print("patients", patients)
517
 	fmt.Print("patients", patients)
518
 	for _, it := range patients {
518
 	for _, it := range patients {
519
 		patientsNew := models.XtPatientsNew{
519
 		patientsNew := models.XtPatientsNew{
520
-			UserOrgId:                    org.Id,
521
-			CreatedTime:                  time.Now().Unix(),
522
-			UpdatedTime:                  time.Now().Unix(),
523
-			Status:                       1,
524
-			BloodId:                      it.ID,
525
-			BloodPatients:                1,
526
-			Name:                         it.Name,
527
-			Avatar:                       it.Avatar,
528
-			PatientType:                  it.PatientType,
529
-			DialysisNo:                   it.DialysisNo,
530
-			Source:                       it.Source,
531
-			Lapseto:                      it.Lapseto,
532
-			Gender:                       it.Gender,
533
-			Nation:                       it.Nation,
534
-			NativePlace:                  it.NativePlace,
535
-			MaritalStatus:                it.MaritalStatus,
536
-			IdCardNo:                     it.IdCardNo,
537
-			Birthday:                     it.Birthday,
538
-			ReimbursementWayId:           it.ReimbursementWayId,
539
-			HealthCareNo:                 it.HealthCareNo,
540
-			Phone:                        it.Phone,
541
-			HomeAddress:                  it.HomeAddress,
542
-			WorkUnit:                     it.WorkUnit,
543
-			UnitAddress:                  it.UnitAddress,
544
-			Children:                     it.Children,
545
-			IsHospitalFirstDialysis:      it.IsHospitalFirstDialysis,
546
-			FirstDialysisDate:            it.FirstDialysisDate,
547
-			FirstDialysisHospital:        it.FirstDialysisHospital,
548
-			PreHospitalDialysisFrequency: it.PreHospitalDialysisFrequency,
549
-			PreHospitalDialysisTimes:     it.PreHospitalDialysisTimes,
550
-			HospitalFirstDialysisDate:    it.HospitalFirstDialysisDate,
551
-			TotalDialysis:                it.TotalDialysis,
552
-			Diagnose:                     it.Diagnose,
553
-			Remark:                       it.Remark,
554
-			RegistrarsId:                 it.RegistrarsId,
555
-			BindingState:                 it.BindingState,
556
-			PatientComplains:             it.PatientComplains,
557
-			PresentHistory:               it.PresentHistory,
558
-			PastHistory:                  it.PastHistory,
559
-			Temperature:                  it.Temperature,
560
-			Pulse:                        it.Pulse,
561
-			Respiratory:                  it.Respiratory,
562
-			Age:                          it.Age,
563
-			IsOpenRemind:                 it.IsOpenRemind,
564
-			TellPhone:                    it.TellPhone,
565
-			FirstTreatmentDate:           it.FirstTreatmentDate,
566
-			ContactName:                  it.ContactName,
520
+			UserOrgId:               org.Id,
521
+			CreatedTime:             time.Now().Unix(),
522
+			UpdatedTime:             time.Now().Unix(),
523
+			Status:                  1,
524
+			BloodId:                 it.ID,
525
+			BloodPatients:           1,
526
+			Name:                    it.Name,
527
+			Avatar:                  it.Avatar,
528
+			PatientType:             it.PatientType,
529
+			Source:                  it.Source,
530
+			Lapseto:                 it.Lapseto,
531
+			Gender:                  it.Gender,
532
+			Nation:                  it.Nation,
533
+			NativePlace:             it.NativePlace,
534
+			MaritalStatus:           it.MaritalStatus,
535
+			IdCardNo:                it.IdCardNo,
536
+			Birthday:                it.Birthday,
537
+			ReimbursementWayId:      it.ReimbursementWayId,
538
+			HealthCareNo:            it.HealthCareNo,
539
+			Phone:                   it.Phone,
540
+			HomeAddress:             it.HomeAddress,
541
+			WorkUnit:                it.WorkUnit,
542
+			UnitAddress:             it.UnitAddress,
543
+			Children:                it.Children,
544
+			IsHospitalFirstDialysis: it.IsHospitalFirstDialysis,
545
+			FirstDialysisDate:       it.FirstDialysisDate,
546
+			BindingState:            it.BindingState,
547
+			PatientComplains:        it.PatientComplains,
548
+			PresentHistory:          it.PresentHistory,
549
+			PastHistory:             it.PastHistory,
550
+			Temperature:             it.Temperature,
551
+			Pulse:                   it.Pulse,
552
+			Respiratory:             it.Respiratory,
553
+			Age:                     it.Age,
554
+			IsOpenRemind:            it.IsOpenRemind,
555
+			TellPhone:               it.TellPhone,
556
+			FirstTreatmentDate:      it.FirstTreatmentDate,
557
+			ContactName:             it.ContactName,
567
 		}
558
 		}
568
 		service.CreateVMOrgNewPatient(&patientsNew)
559
 		service.CreateVMOrgNewPatient(&patientsNew)
569
 	}
560
 	}

+ 1 - 0
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go View File

1986
 
1986
 
1987
 	this.DelSession("mobile_admin_user_info")
1987
 	this.DelSession("mobile_admin_user_info")
1988
 	this.Ctx.SetCookie("token_cookie", "")
1988
 	this.Ctx.SetCookie("token_cookie", "")
1989
+	this.Ctx.SetCookie("logout_cookie", "1")
1989
 	id, _ := this.GetInt64("id")
1990
 	id, _ := this.GetInt64("id")
1990
 	fmt.Println("id------------------------------------------", id)
1991
 	fmt.Println("id------------------------------------------", id)
1991
 	loginLog := models.SgjUserAdminLoginLog{
1992
 	loginLog := models.SgjUserAdminLoginLog{

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

8
       "is_system": 1,
8
       "is_system": 1,
9
       "number": 9999,
9
       "number": 9999,
10
       "purview_ids": "49,71,72,70,74,75,73,127,128,48,52,110,94,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,77,78,79,80,76,156,157,158,159,155,82,83,108,149,154,190,81,101,100,102,161,160,162,163,165,170,169,171,172,173,174,177,175,178,180,179,181,186,185,187,188,189,192,81,82,83,104,106,107,108,149,154,190,191",
10
       "purview_ids": "49,71,72,70,74,75,73,127,128,48,52,110,94,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,77,78,79,80,76,156,157,158,159,155,82,83,108,149,154,190,81,101,100,102,161,160,162,163,165,170,169,171,172,173,174,177,175,178,180,179,181,186,185,187,188,189,192,81,82,83,104,106,107,108,149,154,190,191",
11
-      "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20024,20025,20026,20027,20028,20029,20030,20031,20032,20033,20034,20035,20036,20037,20038,20039,20040,20041,20042,20043,20044,20045"
11
+      "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20010,20011,20012,20024,20025,20026,20027,20028,20030,20034,20035,20036,20038,20039,20040,20041,20042,20043,20044,20045,20046,20047,20048,20049,20050,20054"
12
     },
12
     },
13
     {
13
     {
14
       "role_name": "医生",
14
       "role_name": "医生",

+ 344 - 291
controllers/public_api_controller.go View File

25
 	beego.Router("/api/app/release", &PublicApiController{}, "Get:AppRelease")
25
 	beego.Router("/api/app/release", &PublicApiController{}, "Get:AppRelease")
26
 	beego.Router("/api/get", &PublicApiController{}, "Get:GetJson")
26
 	beego.Router("/api/get", &PublicApiController{}, "Get:GetJson")
27
 
27
 
28
-	beego.Router("/api/public/handledata", &PublicApiController{}, "Post:HandleData")
28
+	beego.Router("/api/public/handledata", &PublicApiController{}, "get:HandleData")
29
 
29
 
30
 }
30
 }
31
 
31
 
163
 }
163
 }
164
 
164
 
165
 func (c *PublicApiController) HandleData() {
165
 func (c *PublicApiController) HandleData() {
166
-	org_app, _ := service.GetAllAppOrg()
167
-	org_role, _ := service.GetAllRole()
168
-
169
-	var org_ids []int64
170
-
171
-	for _, apps := range org_app {
172
-		xt_org_app, _ := service.GetAppByType(int64(apps.OrgId), 3)
173
-		scrm_org_app, _ := service.GetAppByType(int64(apps.OrgId), 1)
174
-		cdm_org_app, _ := service.GetAppByType(int64(apps.OrgId), 4)
175
-		mall_org_app, _ := service.GetAppByType(int64(apps.OrgId), 5)
176
-		org_app_6, _ := service.GetAppByType(int64(apps.OrgId), 6)
177
-		org_app_7, _ := service.GetAppByType(int64(apps.OrgId), 7)
178
-		org_app_8, _ := service.GetAppByType(int64(apps.OrgId), 8)
179
-		org_app_9, _ := service.GetAppByType(int64(apps.OrgId), 9)
180
-		org_app_10, _ := service.GetAppByType(int64(apps.OrgId), 10)
181
-		org_app_11, _ := service.GetAppByType(int64(apps.OrgId), 11)
182
-		org_app_12, _ := service.GetAppByType(int64(apps.OrgId), 12)
183
-		org_app_13, _ := service.GetAppByType(int64(apps.OrgId), 13)
184
-		org_app_14, _ := service.GetAppByType(int64(apps.OrgId), 14)
185
-		org_app_15, _ := service.GetAppByType(int64(apps.OrgId), 15)
186
-
187
-		var xt_temp_org_app *models.OrgApp
188
-		var mall_temp_org_app *models.OrgApp
189
-
190
-		if xt_org_app == nil || xt_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
191
-
192
-			app, _ := service.GetOrgApp(0, 3)
193
-			org, _ := service.GetOrgById(int64(apps.OrgId))
194
-
195
-			app.Id = 0
196
-			app.OrgId = apps.OrgId
197
-			app.Creator = int(org.Creator)
198
-			app.Number = 0
199
-			app.Status = 1
200
-			app.ModifyTime = time.Now().Unix()
201
-			app.CreateTime = time.Now().Unix()
202
-			service.CreateOrgApp(app)
203
-			xt_temp_org_app = app
204
-		} else {
205
-
206
-			xt_temp_org_app = xt_org_app
207
-
208
-		}
209
-
210
-		if scrm_org_app == nil || scrm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
211
-
212
-			app, _ := service.GetOrgApp(0, 1)
213
-			//org, _ := service.GetOrgById(int64(12))
214
-			org, _ := service.GetOrgById(int64(apps.OrgId))
215
-
216
-			app.OrgId = apps.OrgId
217
-			app.Id = 0
218
-
219
-			app.Creator = int(org.Creator)
220
-			app.Number = 0
221
-			app.Status = 1
222
-			app.ModifyTime = time.Now().Unix()
223
-			app.CreateTime = time.Now().Unix()
224
-			service.CreateOrgApp(app)
225
-
226
-		}
227
-
228
-		if cdm_org_app == nil || cdm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
229
-			app, _ := service.GetOrgApp(0, 4)
230
-			//org, _ := service.GetOrgById(int64(12))
231
-			org, _ := service.GetOrgById(int64(apps.OrgId))
232
-
233
-			app.OrgId = apps.OrgId
234
-			app.Creator = int(org.Creator)
235
-			app.Number = 0
236
-			app.Id = 0
237
-
238
-			app.Status = 1
239
-			app.ModifyTime = time.Now().Unix()
240
-			app.CreateTime = time.Now().Unix()
241
-			service.CreateOrgApp(app)
242
-		}
243
-
244
-		if mall_org_app == nil || mall_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
245
-			app, _ := service.GetOrgApp(0, 5)
246
-			//org, _ := service.GetOrgById(int64(12))
247
-			org, _ := service.GetOrgById(int64(apps.OrgId))
248
-
249
-			app.OrgId = apps.OrgId
250
-			app.Creator = int(org.Creator)
251
-			app.Number = 0
252
-			app.Id = 0
253
-
254
-			app.Status = 1
255
-			app.ModifyTime = time.Now().Unix()
256
-			app.CreateTime = time.Now().Unix()
257
-			service.CreateOrgApp(app)
258
-			mall_temp_org_app = app
259
-		} else {
260
-			mall_temp_org_app = mall_org_app
261
-		}
262
-
263
-		if org_app_6 == nil || org_app_6.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
264
-			app, _ := service.GetOrgApp(0, 6)
265
-			//org, _ := service.GetOrgById(int64(12))
266
-			org, _ := service.GetOrgById(int64(apps.OrgId))
267
-
268
-			app.OrgId = apps.OrgId
269
-			app.Creator = int(org.Creator)
270
-			app.Number = 1
271
-			app.Id = 0
272
-
273
-			app.Status = 1
274
-			app.ModifyTime = time.Now().Unix()
275
-			app.CreateTime = time.Now().Unix()
276
-			app.Pid = xt_temp_org_app.Id
277
-			service.CreateOrgApp(app)
278
-
279
-		}
280
-		if org_app_7 == nil || org_app_7.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
281
-			app, _ := service.GetOrgApp(0, 7)
282
-			//org, _ := service.GetOrgById(int64(12))
283
-			org, _ := service.GetOrgById(int64(apps.OrgId))
284
-
285
-			app.OrgId = apps.OrgId
286
-			app.Creator = int(org.Creator)
287
-			app.Number = 0
288
-			app.Status = 2
289
-			app.Id = 0
290
-
291
-			app.ModifyTime = time.Now().Unix()
292
-			app.CreateTime = time.Now().Unix()
293
-			app.Pid = xt_temp_org_app.Id
294
-
295
-			service.CreateOrgApp(app)
296
-		}
297
-		if org_app_8 == nil || org_app_8.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
298
-			app, _ := service.GetOrgApp(0, 8)
299
-			//org, _ := service.GetOrgById(int64(12))
300
-			org, _ := service.GetOrgById(int64(apps.OrgId))
301
-
302
-			app.OrgId = apps.OrgId
303
-			app.Creator = int(org.Creator)
304
-			app.Number = 3
305
-			app.Id = 0
306
-
307
-			app.Pid = mall_temp_org_app.Id
308
-
309
-			app.Status = 1
310
-			app.ModifyTime = time.Now().Unix()
311
-			app.CreateTime = time.Now().Unix()
312
-			service.CreateOrgApp(app)
313
-		}
314
-		if org_app_9 == nil || org_app_9.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
315
-			app, _ := service.GetOrgApp(0, 9)
316
-			//org, _ := service.GetOrgById(int64(12))
317
-			org, _ := service.GetOrgById(int64(apps.OrgId))
318
-
319
-			app.OrgId = apps.OrgId
320
-			app.Pid = xt_temp_org_app.Id
321
-
322
-			app.Creator = int(org.Creator)
323
-			app.Number = 4
324
-			app.Id = 0
325
-
326
-			app.Status = 1
327
-			app.ModifyTime = time.Now().Unix()
328
-			app.CreateTime = time.Now().Unix()
329
-			service.CreateOrgApp(app)
330
-
331
-		}
332
-		if org_app_10 == nil || org_app_10.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
333
-			app, _ := service.GetOrgApp(0, 10)
334
-			//org, _ := service.GetOrgById(int64(12))
335
-			org, _ := service.GetOrgById(int64(apps.OrgId))
336
-
337
-			app.OrgId = apps.OrgId
338
-			app.Creator = int(org.Creator)
339
-			app.Pid = xt_temp_org_app.Id
340
-
341
-			app.Number = 5
342
-			app.Id = 0
343
-
344
-			app.Status = 1
345
-			app.ModifyTime = time.Now().Unix()
346
-			app.CreateTime = time.Now().Unix()
347
-			service.CreateOrgApp(app)
348
-		}
349
-		if org_app_11 == nil || org_app_11.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
350
-			app, _ := service.GetOrgApp(0, 11)
351
-			//org, _ := service.GetOrgById(int64(12))
352
-			org, _ := service.GetOrgById(int64(apps.OrgId))
353
-
354
-			app.OrgId = app.OrgId
355
-			app.Creator = int(org.Creator)
356
-			app.Pid = xt_temp_org_app.Id
357
-			app.Id = 0
358
-
359
-			app.Number = 6
360
-			app.Status = 1
361
-			app.ModifyTime = time.Now().Unix()
362
-			app.CreateTime = time.Now().Unix()
363
-			service.CreateOrgApp(app)
364
-		}
365
-		if org_app_12 == nil || org_app_12.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
366
-			app, _ := service.GetOrgApp(0, 12)
367
-			//org, _ := service.GetOrgById(int64(12))
368
-			org, _ := service.GetOrgById(int64(apps.OrgId))
369
-
370
-			app.OrgId = apps.OrgId
371
-			app.Creator = int(org.Creator)
372
-			app.Pid = xt_temp_org_app.Id
373
-			app.Number = 7
374
-			app.Status = 1
375
-			app.Id = 0
376
-
377
-			app.ModifyTime = time.Now().Unix()
378
-			app.CreateTime = time.Now().Unix()
379
-			service.CreateOrgApp(app)
380
-		}
381
-		if org_app_13 == nil || org_app_13.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
382
-			app, _ := service.GetOrgApp(0, 13)
383
-			//org, _ := service.GetOrgById(int64(12))
384
-			org, _ := service.GetOrgById(int64(apps.OrgId))
385
-
386
-			app.OrgId = apps.OrgId
387
-			app.Creator = int(org.Creator)
388
-			app.Pid = xt_temp_org_app.Id
389
-			app.Number = 8
390
-			app.Id = 0
391
-			app.Status = 1
392
-			app.ModifyTime = time.Now().Unix()
393
-			app.CreateTime = time.Now().Unix()
394
-			service.CreateOrgApp(app)
395
-		}
396
-		if org_app_14 == nil || org_app_14.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
397
-			app, _ := service.GetOrgApp(0, 14)
398
-			//org, _ := service.GetOrgById(int64(12))
399
-			org, _ := service.GetOrgById(int64(apps.OrgId))
400
-
401
-			app.OrgId = apps.OrgId
402
-			app.Creator = int(org.Creator)
403
-			app.Pid = xt_temp_org_app.Id
404
-			app.Id = 0
405
-			app.Number = 9
406
-			app.Status = 1
407
-			app.ModifyTime = time.Now().Unix()
408
-			app.CreateTime = time.Now().Unix()
409
-			service.CreateOrgApp(app)
410
-		}
411
-
412
-		if org_app_15 == nil || org_app_15.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
413
-			app, _ := service.GetOrgApp(0, 15)
414
-			//org, _ := service.GetOrgById(int64(12))
415
-			org, _ := service.GetOrgById(int64(apps.OrgId))
416
-
417
-			app.OrgId = apps.OrgId
418
-			app.Creator = int(org.Creator)
419
-			app.Pid = xt_temp_org_app.Id
420
-			app.Number = 10
421
-			app.Status = 1
422
-			app.Id = 0
423
-			app.ModifyTime = time.Now().Unix()
424
-			app.CreateTime = time.Now().Unix()
425
-			service.CreateOrgApp(app)
426
-		}
427
-	}
166
+	//org_app, _ := service.GetAllAppOrg()
167
+	//org_role, _ := service.GetAllRole()
168
+
169
+	//var org_ids []int64
170
+
171
+	//for _, apps := range org_app {
172
+	//	xt_org_app, _ := service.GetAppByType(int64(apps.OrgId), 3)
173
+	//	scrm_org_app, _ := service.GetAppByType(int64(apps.OrgId), 1)
174
+	//	cdm_org_app, _ := service.GetAppByType(int64(apps.OrgId), 4)
175
+	//	mall_org_app, _ := service.GetAppByType(int64(apps.OrgId), 5)
176
+	//	org_app_6, _ := service.GetAppByType(int64(apps.OrgId), 6)
177
+	//	org_app_7, _ := service.GetAppByType(int64(apps.OrgId), 7)
178
+	//	org_app_8, _ := service.GetAppByType(int64(apps.OrgId), 8)
179
+	//	org_app_9, _ := service.GetAppByType(int64(apps.OrgId), 9)
180
+	//	org_app_10, _ := service.GetAppByType(int64(apps.OrgId), 10)
181
+	//	org_app_11, _ := service.GetAppByType(int64(apps.OrgId), 11)
182
+	//	org_app_12, _ := service.GetAppByType(int64(apps.OrgId), 12)
183
+	//	org_app_13, _ := service.GetAppByType(int64(apps.OrgId), 13)
184
+	//	org_app_14, _ := service.GetAppByType(int64(apps.OrgId), 14)
185
+	//	org_app_15, _ := service.GetAppByType(int64(apps.OrgId), 15)
186
+	//
187
+	//	var xt_temp_org_app *models.OrgApp
188
+	//	var mall_temp_org_app *models.OrgApp
189
+	//
190
+	//	if xt_org_app == nil || xt_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
191
+	//
192
+	//		app, _ := service.GetOrgAppA(0, 3)
193
+	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
194
+	//		if org == nil || org.Id == 0 {
195
+	//			continue
196
+	//		}
197
+	//
198
+	//		app.Id = 0
199
+	//		app.OrgId = apps.OrgId
200
+	//		app.Creator = int(org.Creator)
201
+	//		app.Number = 0
202
+	//		app.Status = 1
203
+	//		app.ModifyTime = time.Now().Unix()
204
+	//		app.CreateTime = time.Now().Unix()
205
+	//		service.CreateOrgApp(app)
206
+	//		xt_temp_org_app = app
207
+	//	} else {
208
+	//
209
+	//		xt_temp_org_app = xt_org_app
210
+	//
211
+	//	}
212
+	//
213
+	//	if scrm_org_app == nil || scrm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
214
+	//
215
+	//		app, _ := service.GetOrgAppA(0, 1)
216
+	//		//org, _ := service.GetOrgById(int64(12))
217
+	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
218
+	//		if org == nil || org.Id == 0 {
219
+	//			continue
220
+	//		}
221
+	//
222
+	//
223
+	//		app.OrgId = apps.OrgId
224
+	//		app.Id = 0
225
+	//
226
+	//		app.Creator = int(org.Creator)
227
+	//		app.Number = 0
228
+	//		app.Status = 1
229
+	//		app.ModifyTime = time.Now().Unix()
230
+	//		app.CreateTime = time.Now().Unix()
231
+	//		service.CreateOrgApp(app)
232
+	//
233
+	//	}
234
+	//
235
+	//	if cdm_org_app == nil || cdm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
236
+	//		app, _ := service.GetOrgAppA(0, 4)
237
+	//		//org, _ := service.GetOrgById(int64(12))
238
+	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
239
+	//		if org == nil || org.Id == 0 {
240
+	//			continue
241
+	//		}
242
+	//
243
+	//
244
+	//		app.OrgId = apps.OrgId
245
+	//		app.Creator = int(org.Creator)
246
+	//		app.Number = 0
247
+	//		app.Id = 0
248
+	//
249
+	//		app.Status = 1
250
+	//		app.ModifyTime = time.Now().Unix()
251
+	//		app.CreateTime = time.Now().Unix()
252
+	//		service.CreateOrgApp(app)
253
+	//	}
254
+	//
255
+	//	if mall_org_app == nil || mall_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
256
+	//		app, _ := service.GetOrgAppA(0, 5)
257
+	//		//org, _ := service.GetOrgById(int64(12))
258
+	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
259
+	//
260
+	//		if org == nil || org.Id == 0 {
261
+	//			continue
262
+	//		}
263
+	//
264
+	//		app.OrgId = apps.OrgId
265
+	//		app.Creator = int(org.Creator)
266
+	//		app.Number = 0
267
+	//		app.Id = 0
268
+	//
269
+	//		app.Status = 1
270
+	//		app.ModifyTime = time.Now().Unix()
271
+	//		app.CreateTime = time.Now().Unix()
272
+	//		service.CreateOrgApp(app)
273
+	//		mall_temp_org_app = app
274
+	//	} else {
275
+	//		mall_temp_org_app = mall_org_app
276
+	//	}
277
+	//
278
+	//	if org_app_6 == nil || org_app_6.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
279
+	//		app, _ := service.GetOrgAppA(0, 6)
280
+	//		//org, _ := service.GetOrgById(int64(12))
281
+	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
282
+	//		if org == nil || org.Id == 0 {
283
+	//			continue
284
+	//		}
285
+	//
286
+	//
287
+	//		app.OrgId = apps.OrgId
288
+	//		app.Creator = int(org.Creator)
289
+	//		app.Number = 1
290
+	//		app.Id = 0
291
+	//
292
+	//		app.Status = 1
293
+	//		app.ModifyTime = time.Now().Unix()
294
+	//		app.CreateTime = time.Now().Unix()
295
+	//		app.Pid = xt_temp_org_app.Id
296
+	//		service.CreateOrgApp(app)
297
+	//
298
+	//	}
299
+	//	if org_app_7 == nil || org_app_7.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
300
+	//		app, _ := service.GetOrgAppA(0, 7)
301
+	//		//org, _ := service.GetOrgById(int64(12))
302
+	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
303
+	//		if org == nil || org.Id == 0 {
304
+	//			continue
305
+	//		}
306
+	//
307
+	//
308
+	//		app.OrgId = apps.OrgId
309
+	//		app.Creator = int(org.Creator)
310
+	//		app.Number = 2
311
+	//		app.Status = 2
312
+	//		app.Id = 0
313
+	//
314
+	//		app.ModifyTime = time.Now().Unix()
315
+	//		app.CreateTime = time.Now().Unix()
316
+	//		app.Pid = xt_temp_org_app.Id
317
+	//
318
+	//		service.CreateOrgApp(app)
319
+	//	}
320
+	//	if org_app_8 == nil || org_app_8.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
321
+	//		app, _ := service.GetOrgAppA(0, 8)
322
+	//		//org, _ := service.GetOrgById(int64(12))
323
+	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
324
+	//		if org == nil || org.Id == 0 {
325
+	//			continue
326
+	//		}
327
+	//
328
+	//
329
+	//		app.OrgId = apps.OrgId
330
+	//		app.Creator = int(org.Creator)
331
+	//		app.Number = 3
332
+	//		app.Id = 0
333
+	//
334
+	//		app.Pid = mall_temp_org_app.Id
335
+	//
336
+	//		app.Status = 1
337
+	//		app.ModifyTime = time.Now().Unix()
338
+	//		app.CreateTime = time.Now().Unix()
339
+	//		service.CreateOrgApp(app)
340
+	//	}
341
+	//	if org_app_9 == nil || org_app_9.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
342
+	//		app, _ := service.GetOrgAppA(0, 9)
343
+	//		//org, _ := service.GetOrgById(int64(12))
344
+	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
345
+	//		if org == nil || org.Id == 0 {
346
+	//			continue
347
+	//		}
348
+	//
349
+	//
350
+	//		app.OrgId = apps.OrgId
351
+	//		app.Pid = xt_temp_org_app.Id
352
+	//
353
+	//		app.Creator = int(org.Creator)
354
+	//		app.Number = 4
355
+	//		app.Id = 0
356
+	//
357
+	//		app.Status = 1
358
+	//		app.ModifyTime = time.Now().Unix()
359
+	//		app.CreateTime = time.Now().Unix()
360
+	//		service.CreateOrgApp(app)
361
+	//
362
+	//	}
363
+	//	if org_app_10 == nil || org_app_10.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
364
+	//		app, _ := service.GetOrgAppA(0, 10)
365
+	//		//org, _ := service.GetOrgById(int64(12))
366
+	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
367
+	//		if org == nil || org.Id == 0 {
368
+	//			continue
369
+	//		}
370
+	//
371
+	//
372
+	//		app.OrgId = apps.OrgId
373
+	//		app.Creator = int(org.Creator)
374
+	//		app.Pid = xt_temp_org_app.Id
375
+	//
376
+	//		app.Number = 5
377
+	//		app.Id = 0
378
+	//
379
+	//		app.Status = 1
380
+	//		app.ModifyTime = time.Now().Unix()
381
+	//		app.CreateTime = time.Now().Unix()
382
+	//		service.CreateOrgApp(app)
383
+	//	}
384
+	//	if org_app_11 == nil || org_app_11.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
385
+	//		app, _ := service.GetOrgAppA(0, 11)
386
+	//		//org, _ := service.GetOrgById(int64(12))
387
+	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
388
+	//		if org == nil || org.Id == 0 {
389
+	//			continue
390
+	//		}
391
+	//
392
+	//
393
+	//		app.OrgId = apps.OrgId
394
+	//		app.Creator = int(org.Creator)
395
+	//		app.Pid = xt_temp_org_app.Id
396
+	//		app.Id = 0
397
+	//
398
+	//		app.Number = 6
399
+	//		app.Status = 1
400
+	//		app.ModifyTime = time.Now().Unix()
401
+	//		app.CreateTime = time.Now().Unix()
402
+	//		service.CreateOrgApp(app)
403
+	//	}
404
+	//	if org_app_12 == nil || org_app_12.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
405
+	//		app, _ := service.GetOrgAppA(0, 12)
406
+	//		//org, _ := service.GetOrgById(int64(12))
407
+	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
408
+	//		if org == nil || org.Id == 0 {
409
+	//			continue
410
+	//		}
411
+	//
412
+	//
413
+	//		app.OrgId = apps.OrgId
414
+	//		app.Creator = int(org.Creator)
415
+	//		app.Pid = xt_temp_org_app.Id
416
+	//		app.Number = 7
417
+	//		app.Status = 1
418
+	//		app.Id = 0
419
+	//
420
+	//		app.ModifyTime = time.Now().Unix()
421
+	//		app.CreateTime = time.Now().Unix()
422
+	//		service.CreateOrgApp(app)
423
+	//	}
424
+	//	if org_app_13 == nil || org_app_13.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
425
+	//		app, _ := service.GetOrgAppA(0, 13)
426
+	//		//org, _ := service.GetOrgById(int64(12))
427
+	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
428
+	//		if org == nil || org.Id == 0 {
429
+	//			continue
430
+	//		}
431
+	//
432
+	//
433
+	//		app.OrgId = apps.OrgId
434
+	//		app.Creator = int(org.Creator)
435
+	//		app.Pid = xt_temp_org_app.Id
436
+	//		app.Number = 8
437
+	//		app.Id = 0
438
+	//		app.Status = 1
439
+	//		app.ModifyTime = time.Now().Unix()
440
+	//		app.CreateTime = time.Now().Unix()
441
+	//		service.CreateOrgApp(app)
442
+	//	}
443
+	//	if org_app_14 == nil || org_app_14.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
444
+	//		app, _ := service.GetOrgAppA(0, 14)
445
+	//		//org, _ := service.GetOrgById(int64(12))
446
+	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
447
+	//		if org == nil || org.Id == 0 {
448
+	//			continue
449
+	//		}
450
+	//
451
+	//
452
+	//		app.OrgId = apps.OrgId
453
+	//		app.Creator = int(org.Creator)
454
+	//		app.Pid = xt_temp_org_app.Id
455
+	//		app.Id = 0
456
+	//		app.Number = 9
457
+	//		app.Status = 1
458
+	//		app.ModifyTime = time.Now().Unix()
459
+	//		app.CreateTime = time.Now().Unix()
460
+	//		service.CreateOrgApp(app)
461
+	//	}
462
+	//
463
+	//	if org_app_15 == nil || org_app_15.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
464
+	//		app, _ := service.GetOrgAppA(0, 15)
465
+	//		//org, _ := service.GetOrgById(int64(12))
466
+	//		org, _ := service.GetOrgByIdB(int64(apps.OrgId))
467
+	//		if org == nil || org.Id == 0 {
468
+	//			continue
469
+	//		}
470
+	//
471
+	//
472
+	//		app.OrgId = apps.OrgId
473
+	//		app.Creator = int(org.Creator)
474
+	//		app.Pid = xt_temp_org_app.Id
475
+	//		app.Number = 10
476
+	//		app.Status = 1
477
+	//		app.Id = 0
478
+	//		app.ModifyTime = time.Now().Unix()
479
+	//		app.CreateTime = time.Now().Unix()
480
+	//		service.CreateOrgApp(app)
481
+	//	}
482
+	//}
428
 
483
 
429
-	for _, role := range org_role {
430
-		org_ids = append(org_ids, role.OrgId)
431
-	}
484
+	//for _, role := range org_role {
485
+	//	org_ids = append(org_ids, role.OrgId)
486
+	//}
432
 	//
487
 	//
433
 	//
488
 	//
434
 	////创建内置角色
489
 	////创建内置角色
435
-	InitRoleAndPurviews(org_ids)
490
+	//InitRoleAndPurviews(org_ids)
436
 
491
 
437
 	//var org_id int = 0
492
 	//var org_id int = 0
438
 	////管理员
493
 	////管理员
442
 	//	if len(item.RoleIds) == 0{
497
 	//	if len(item.RoleIds) == 0{
443
 	//		ids = strconv.FormatInt( item.RoleId,10)
498
 	//		ids = strconv.FormatInt( item.RoleId,10)
444
 	//	}else{
499
 	//	}else{
445
-	//
446
 	//		ids = item.RoleIds + ","+strconv.FormatInt( item.RoleId,10)
500
 	//		ids = item.RoleIds + ","+strconv.FormatInt( item.RoleId,10)
447
 	//	}
501
 	//	}
448
-	//
449
 	//	service.UpdateRoleIds(item.Id, ids)
502
 	//	service.UpdateRoleIds(item.Id, ids)
450
 	//}
503
 	//}
451
 	////护士医生
504
 	////护士医生
452
-	//app_roles2  := service.GetAllUserRoleByUserTypeOther(org_id)
453
-	//for _, item := range app_roles2{
454
-	//	var ids string
455
-	//	if len(item.RoleIds) == 0{
456
-	//		ids = strconv.FormatInt( item.RoleId,10)
457
-	//	}else{
458
-	//		ids = item.RoleIds + ","+strconv.FormatInt( item.RoleId,10)
459
-	//	}
460
-	//	if item.UserType == 2{
461
-	//		role := service.FindRoleByUserTypeOne(item.OrgId)
462
-	//		ids = ids +"," + strconv.FormatInt(role.Id,10)
463
-	//
464
-	//	} else if item.UserType == 3{
465
-	//		role := service.FindRoleByUserTypeTwo(item.OrgId)
466
-	//		ids = ids +"," + strconv.FormatInt(role.Id,10)
467
-	//	}
468
-	//	service.UpdateRoleIds(item.Id, ids)
469
-	//}
505
+	//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
+	//	//}
470
 	c.ServeSuccessJSON(map[string]interface{}{
523
 	c.ServeSuccessJSON(map[string]interface{}{
471
 		"msg": "ok",
524
 		"msg": "ok",
472
 	})
525
 	})
476
 func InitRoleAndPurviews(org_ids []int64) {
529
 func InitRoleAndPurviews(org_ids []int64) {
477
 	roles := LoadRoleConfig("./role.json").Roles
530
 	roles := LoadRoleConfig("./role.json").Roles
478
 	for _, org_id := range org_ids {
531
 	for _, org_id := range org_ids {
479
-		app, _ := service.GetOrgApp(org_id, 3)
532
+		app, _ := service.GetOrgAppB(org_id, 3)
480
 		if app == nil || app.Id == 0 {
533
 		if app == nil || app.Id == 0 {
481
 			continue
534
 			continue
482
 		}
535
 		}
494
 				Number:       item.Number,
547
 				Number:       item.Number,
495
 				IsSystem:     item.IsSystem,
548
 				IsSystem:     item.IsSystem,
496
 			}
549
 			}
497
-			err := service.CreateOrgRole(role)
550
+			err := service.CreateOrgRoleB(role)
498
 			if err == nil {
551
 			if err == nil {
499
 				purview := &models.RolePurview{
552
 				purview := &models.RolePurview{
500
 					RoleId:     role.Id,
553
 					RoleId:     role.Id,
515
 					Mtime:      time.Now().Unix(),
568
 					Mtime:      time.Now().Unix(),
516
 				}
569
 				}
517
 
570
 
518
-				service.CreateRolePurview(purview)
519
-				service.CreateFuncRolePurview(func_purview)
571
+				service.CreateRolePurviewB(purview)
572
+				service.CreateFuncRolePurviewB(func_purview)
520
 			}
573
 			}
521
 		}
574
 		}
522
 
575
 

+ 1 - 2
controllers/role.json View File

8
       "is_system": 1,
8
       "is_system": 1,
9
       "number": 9999,
9
       "number": 9999,
10
       "purview_ids": "49,71,72,70,74,75,73,127,128,48,52,110,94,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,77,78,79,80,76,156,157,158,159,155,82,83,108,149,154,190,81,101,100,102,161,160,162,163,165,170,169,171,172,173,174,177,175,178,180,179,181,186,185,187,188,189,192,81,82,83,104,106,107,108,149,154,190,191",
10
       "purview_ids": "49,71,72,70,74,75,73,127,128,48,52,110,94,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,77,78,79,80,76,156,157,158,159,155,82,83,108,149,154,190,81,101,100,102,161,160,162,163,165,170,169,171,172,173,174,177,175,178,180,179,181,186,185,187,188,189,192,81,82,83,104,106,107,108,149,154,190,191",
11
-      "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20024,20025,20026,20027,20028,20029,20030,20031,20032,20033,20034,20035,20036,20037,20038,20039,20040,20041,20042,20043,20044,20045"
11
+      "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20010,20011,20012,20024,20025,20026,20027,20028,20030,20034,20035,20036,20038,20039,20040,20041,20042,20043,20044,20045,20046,20047,20048,20049,20050,20054"
12
     },
12
     },
13
     {
13
     {
14
       "role_name": "医生",
14
       "role_name": "医生",
31
       "number": 9997,
31
       "number": 9997,
32
       "purview_ids": "49,74,75,73,48,52,110,93,121,122,124,125,120",
32
       "purview_ids": "49,74,75,73,48,52,110,93,121,122,124,125,120",
33
       "func_ids": "20007,20008,20010,20011,20012,20013,20014,20016,20017,20019,20021,20022,20024,20025,20027,20028"
33
       "func_ids": "20007,20008,20010,20011,20012,20013,20014,20016,20017,20019,20021,20022,20024,20025,20027,20028"
34
-
35
     }
34
     }
36
   ]
35
   ]
37
 }
36
 }

+ 7 - 0
controllers/verify_login_controller.go View File

166
 			if len(curAppUrlfors) == 0 {
166
 			if len(curAppUrlfors) == 0 {
167
 				if adminUser.Id == curOrg.Creator { //超级管理员
167
 				if adminUser.Id == curOrg.Creator { //超级管理员
168
 					urlfors, _, _ := service.GetSuperAdminUsersPurviewTreeAndUrlfors(3)
168
 					urlfors, _, _ := service.GetSuperAdminUsersPurviewTreeAndUrlfors(3)
169
+					//urlfors, _, _ := service.GetSuperAdminUsersPurviewTreeAndUrlfors(4)
170
+					//urlfors, _, _ := service.GetSuperAdminUsersPurviewTreeAndUrlfors(5)
171
+					//urlfors, _, _ := service.GetSuperAdminUsersPurviewTreeAndUrlfors(6)
172
+
169
 					curAppUrlfors = urlfors
173
 					curAppUrlfors = urlfors
170
 				} else {
174
 				} else {
171
 					appRole, _ := service.FindAdminUserIDA(appRole.Id)
175
 					appRole, _ := service.FindAdminUserIDA(appRole.Id)
193
 
197
 
194
 							curAppUrlfors = append(curAppUrlfors, "")
198
 							curAppUrlfors = append(curAppUrlfors, "")
195
 						}
199
 						}
200
+					} else {
201
+						curAppUrlfors = append(curAppUrlfors, "")
202
+
196
 					}
203
 					}
197
 				}
204
 				}
198
 			}
205
 			}

+ 63 - 28
service/app_version.go View File

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

+ 35 - 0
service/db.go View File

37
 
37
 
38
 var readSgjPatientDb *gorm.DB
38
 var readSgjPatientDb *gorm.DB
39
 var writeSgjPatientDb *gorm.DB
39
 var writeSgjPatientDb *gorm.DB
40
+
41
+var readUserDbT *gorm.DB
42
+var writeUserDbT *gorm.DB
43
+
40
 var err error
44
 var err error
41
 
45
 
42
 func ConnectDB() {
46
 func ConnectDB() {
100
 	writeSgjPatientPass := beego.AppConfig.String("writesgjpatientmysqlpass")
104
 	writeSgjPatientPass := beego.AppConfig.String("writesgjpatientmysqlpass")
101
 	writeSgjPatientName := beego.AppConfig.String("writesgjpatientmysqlname")
105
 	writeSgjPatientName := beego.AppConfig.String("writesgjpatientmysqlname")
102
 
106
 
107
+	readUserHostT := beego.AppConfig.String("readuserhostTest")
108
+	readUserPortT := beego.AppConfig.String("readuserportTest")
109
+	readUserUserT := beego.AppConfig.String("readuseruserTest")
110
+	readUserPassT := beego.AppConfig.String("readuserpassTest")
111
+	readUserNameT := beego.AppConfig.String("readusernameTest")
112
+
113
+	writeUserHostT := beego.AppConfig.String("writeuserhostTest")
114
+	writeUserPortT := beego.AppConfig.String("writeuserportTest")
115
+	writeUserUserT := beego.AppConfig.String("writeuseruserTest")
116
+	writeUserPassT := beego.AppConfig.String("writeuserpassTest")
117
+	writeUserNameT := beego.AppConfig.String("writeusernameTest")
118
+
103
 	rdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readUser, readPass, readHost, readPort, readName)
119
 	rdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readUser, readPass, readHost, readPort, readName)
104
 	wdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writeUser, writePass, writeHost, writePort, writeName)
120
 	wdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writeUser, writePass, writeHost, writePort, writeName)
105
 
121
 
115
 	rspdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readSgjPatientUser, readSgjPatientPass, readSgjPatientHost, readSgjPatientPort, readSgjPatientName)
131
 	rspdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readSgjPatientUser, readSgjPatientPass, readSgjPatientHost, readSgjPatientPort, readSgjPatientName)
116
 	wspdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writeSgjPatientUser, writeSgjPatientPass, writeSgjPatientHost, writeSgjPatientPort, writeSgjPatientName)
132
 	wspdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writeSgjPatientUser, writeSgjPatientPass, writeSgjPatientHost, writeSgjPatientPort, writeSgjPatientName)
117
 
133
 
134
+	rudsnT := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readUserUserT, readUserPassT, readUserHostT, readUserPortT, readUserNameT)
135
+	wudsnT := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writeUserUserT, writeUserPassT, writeUserHostT, writeUserPortT, writeUserNameT)
136
+
118
 	readDb, err = gorm.Open("mysql", rdsn)
137
 	readDb, err = gorm.Open("mysql", rdsn)
119
 	if err != nil {
138
 	if err != nil {
120
 		//beego.Error(err)
139
 		//beego.Error(err)
131
 	writeDb.DB().SetMaxOpenConns(100)
150
 	writeDb.DB().SetMaxOpenConns(100)
132
 	writeDb.LogMode(true)
151
 	writeDb.LogMode(true)
133
 
152
 
153
+	readUserDbT, err = gorm.Open("mysql", rudsnT)
154
+	if err != nil {
155
+		//beego.Error(err)
156
+	}
157
+	readUserDbT.DB().SetMaxIdleConns(10)
158
+	readUserDbT.DB().SetMaxOpenConns(100)
159
+	readUserDbT.LogMode(true)
160
+
161
+	writeUserDbT, err = gorm.Open("mysql", wudsnT)
162
+	if err != nil {
163
+		//beego.Error(err)
164
+	}
165
+	writeUserDbT.DB().SetMaxIdleConns(10)
166
+	writeUserDbT.DB().SetMaxOpenConns(100)
167
+	writeUserDbT.LogMode(true)
168
+
134
 	readUserDb, err = gorm.Open("mysql", rudsn)
169
 	readUserDb, err = gorm.Open("mysql", rudsn)
135
 	if err != nil {
170
 	if err != nil {
136
 		//beego.Error(err)
171
 		//beego.Error(err)

+ 4 - 4
service/role_service.go View File

401
 
401
 
402
 func GetAllGeneralFuncPurviewVMsProcessed() ([]*PurviewTreeViewModel, error) {
402
 func GetAllGeneralFuncPurviewVMsProcessed() ([]*PurviewTreeViewModel, error) {
403
 	var originPurviews []*models.SgjUserOperatePurview
403
 	var originPurviews []*models.SgjUserOperatePurview
404
-	getPurviewErr := readUserDb.Model(models.SgjUserOperatePurview{}).Where(" status = 1").Order("id asc").Find(&originPurviews).Error
404
+	getPurviewErr := readUserDb.Model(models.SgjUserOperatePurview{}).Where(" status = 1").Order("number asc").Find(&originPurviews).Error
405
 	if getPurviewErr != nil {
405
 	if getPurviewErr != nil {
406
 		return nil, getPurviewErr
406
 		return nil, getPurviewErr
407
 	}
407
 	}
677
 }
677
 }
678
 
678
 
679
 func GetFunctionPurview() (purview []*models.SgjUserOperatePurview, err error) {
679
 func GetFunctionPurview() (purview []*models.SgjUserOperatePurview, err error) {
680
-	err = readUserDb.Model(&models.SgjUserOperatePurview{}).Where("status = 1 ").Find(&purview).Error
680
+	err = readUserDb.Model(&models.SgjUserOperatePurview{}).Where("status = 1 ").Order("number asc").Find(&purview).Error
681
 	return
681
 	return
682
 }
682
 }
683
 
683
 
710
 }
710
 }
711
 
711
 
712
 func GetAllFunctionPurview() (purview []models.SgjUserOperatePurview, err error) {
712
 func GetAllFunctionPurview() (purview []models.SgjUserOperatePurview, err error) {
713
-	err = readUserDb.Model(&models.SgjUserOperatePurview{}).Where("status = 1 ").Find(&purview).Error
713
+	err = readUserDb.Model(&models.SgjUserOperatePurview{}).Where("status = 1 ").Order("number asc").Find(&purview).Error
714
 	return
714
 	return
715
 }
715
 }
716
 
716
 
750
 }
750
 }
751
 
751
 
752
 func FindAllFuncPurview(ids []string) (purview []*models.SgjUserOperatePurview, err error) {
752
 func FindAllFuncPurview(ids []string) (purview []*models.SgjUserOperatePurview, err error) {
753
-	err = readUserDb.Model(&models.SgjUserOperatePurview{}).Where("status = 1 AND id in (?)", ids).Find(&purview).Error
753
+	err = readUserDb.Model(&models.SgjUserOperatePurview{}).Where("status = 1 AND id in (?)", ids).Order("number asc").Find(&purview).Error
754
 	return
754
 	return
755
 
755
 
756
 }
756
 }