소스 검색

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

XMLWAN 5 년 전
부모
커밋
35c15a5092

+ 2 - 0
controllers/dialysis_record_api_controller.go 파일 보기

493
 			CreatedTime:           time.Now().Unix(),
493
 			CreatedTime:           time.Now().Unix(),
494
 			UpdatedTime:           time.Now().Unix(),
494
 			UpdatedTime:           time.Now().Unix(),
495
 			BloodOxygenSaturation: monitorParam.BloodOxygenSaturation,
495
 			BloodOxygenSaturation: monitorParam.BloodOxygenSaturation,
496
+			Creator:               adminUserInfo.AdminUser.Id,
496
 		}
497
 		}
497
 		createErr := service.CreateMonitor(&monitor)
498
 		createErr := service.CreateMonitor(&monitor)
498
 		if createErr != nil {
499
 		if createErr != nil {
550
 		monitor.Result = monitorParam.Result
551
 		monitor.Result = monitorParam.Result
551
 		monitor.MonitoringNurse = adminUserInfo.AdminUser.Id
552
 		monitor.MonitoringNurse = adminUserInfo.AdminUser.Id
552
 		monitor.UpdatedTime = time.Now().Unix()
553
 		monitor.UpdatedTime = time.Now().Unix()
554
+		monitor.Modify = adminUserInfo.AdminUser.Id
553
 		monitor.BloodOxygenSaturation = monitorParam.BloodOxygenSaturation
555
 		monitor.BloodOxygenSaturation = monitorParam.BloodOxygenSaturation
554
 		updateErr := service.UpdateMonitor(monitor)
556
 		updateErr := service.UpdateMonitor(monitor)
555
 		if updateErr != nil {
557
 		if updateErr != nil {

+ 8 - 1
controllers/mobile_api_controllers/mobile_api_base_controller.go 파일 보기

54
 	this.MobileBaseAPIController.Prepare()
54
 	this.MobileBaseAPIController.Prepare()
55
 	adminUserInfo := this.GetMobileAdminUserInfo()
55
 	adminUserInfo := this.GetMobileAdminUserInfo()
56
 
56
 
57
-	if adminUserInfo == nil || len(token) == 0 {
57
+	if adminUserInfo == nil {
58
+		this.DelSession("mobile_admin_user_info")
58
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
59
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
59
 		this.StopRun()
60
 		this.StopRun()
60
 	}
61
 	}
61
 
62
 
63
+	if len(token) == 0 {
64
+		this.DelSession("mobile_admin_user_info")
65
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeLoginTimeout)
66
+		this.StopRun()
67
+	}
68
+
62
 	//if this.Ctx.Request.Method != "GET" {
69
 	//if this.Ctx.Request.Method != "GET" {
63
 	//	err := service.GetOrgSubscibeState(adminUserInfo.Subscibe)
70
 	//	err := service.GetOrgSubscibeState(adminUserInfo.Subscibe)
64
 	//	if err != nil || adminUserInfo.Subscibe.State == 3 {
71
 	//	if err != nil || adminUserInfo.Subscibe.State == 3 {

+ 0 - 1
controllers/mobile_api_controllers/patient_api_controller.go 파일 보기

288
 	advice.Status = 1
288
 	advice.Status = 1
289
 	advice.UpdatedTime = time.Now().Unix()
289
 	advice.UpdatedTime = time.Now().Unix()
290
 	advice.UserOrgId = adminUserInfo.Org.Id
290
 	advice.UserOrgId = adminUserInfo.Org.Id
291
-	advice.AdviceDoctor = adminUserInfo.AdminUser.Id
292
 	advice.Modifier = adminUserInfo.AdminUser.Id
291
 	advice.Modifier = adminUserInfo.AdminUser.Id
293
 
292
 
294
 	//处理修改医嘱开始时间逻辑(不包括子医嘱)
293
 	//处理修改医嘱开始时间逻辑(不包括子医嘱)

+ 124 - 0
controllers/new_mobile_api_controllers/home_api_controller.go 파일 보기

597
 	}
597
 	}
598
 	return nil
598
 	return nil
599
 }
599
 }
600
+
601
+func (this *HomeController) GetFuncPermission() {
602
+	adminUserInfo := this.GetMobileAdminUserInfo()
603
+	user_id := adminUserInfo.AdminUser.Id
604
+	app_id := adminUserInfo.App.Id
605
+	org_id := adminUserInfo.Org.Id
606
+	create_url := this.GetString("create_url")
607
+	modify_url := this.GetString("modify_url")
608
+	modify_other_url := this.GetString("modify_other_url")
609
+	del_url := this.GetString("del_url")
610
+	del_other_url := this.GetString("del_other_url")
611
+	exce_url := this.GetString("exce_url")
612
+	check_url := this.GetString("check_url")
613
+	modify_exce_url := this.GetString("modify_exce_url")
614
+	module, _ := this.GetInt64("module", 0)
615
+
616
+	app_role, _ := service.GetAppRole(org_id, app_id, user_id)
617
+	var is_has_create bool
618
+	var is_has_modify bool
619
+	var is_has_modify_other bool
620
+	var is_has_del bool
621
+	var is_has_del_other bool
622
+	var is_has_exce bool
623
+	var is_has_check bool
624
+	var is_has_modify_exce bool
625
+
626
+	if adminUserInfo.AdminUser.Id != adminUserInfo.Org.Creator {
627
+
628
+		if app_role != nil {
629
+			if len(app_role.RoleIds) > 0 {
630
+				roles := strings.Split(app_role.RoleIds, ",")
631
+				var userRolePurviews string
632
+				for _, item := range roles {
633
+					role_id, _ := strconv.ParseInt(item, 10, 64)
634
+					purviews, _ := service.GetRoleFuncPurviewIds(role_id)
635
+					if len(userRolePurviews) == 0 {
636
+						userRolePurviews = purviews
637
+					} else {
638
+						userRolePurviews = userRolePurviews + "," + purviews
639
+					}
640
+				}
641
+				userRolePurviewsArr := RemoveRepeatedPurviewElement2(strings.Split(userRolePurviews, ","))
642
+				funcPurviews, _ := service.FindAllFuncPurview(userRolePurviewsArr)
643
+				for _, item := range funcPurviews {
644
+					//for _, url := range strings.Split(item.Urlfor,","){
645
+					if strings.Split(item.Urlfor, ",")[0] == create_url {
646
+						is_has_create = true
647
+					}
648
+					if strings.Split(item.Urlfor, ",")[0] == modify_url {
649
+						is_has_modify = true
650
+					}
651
+					if strings.Split(item.Urlfor, ",")[0] == modify_other_url {
652
+						is_has_modify_other = true
653
+					}
654
+					if strings.Split(item.Urlfor, ",")[0] == del_url {
655
+						is_has_del = true
656
+					}
657
+					if strings.Split(item.Urlfor, ",")[0] == del_other_url {
658
+						is_has_del_other = true
659
+					}
660
+					if strings.Split(item.Urlfor, ",")[0] == exce_url {
661
+						is_has_exce = true
662
+					}
663
+					if strings.Split(item.Urlfor, ",")[0] == check_url {
664
+						is_has_check = true
665
+					}
666
+					if strings.Split(item.Urlfor, ",")[0] == modify_exce_url {
667
+						is_has_modify_exce = true
668
+					}
669
+
670
+				}
671
+			} else {
672
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRole)
673
+				return
674
+			}
675
+			this.ServeSuccessJSON(map[string]interface{}{
676
+				"is_has_create":       is_has_create,
677
+				"is_has_modify":       is_has_modify,
678
+				"is_has_modify_other": is_has_modify_other,
679
+				"is_has_del":          is_has_del,
680
+				"is_has_del_other":    is_has_del_other,
681
+				"is_has_exce":         is_has_exce,
682
+				"is_has_check":        is_has_check,
683
+				"is_has_modify_exce":  is_has_modify_exce,
684
+				"module":              module,
685
+			})
686
+		} else {
687
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdminUserIsExit)
688
+			return
689
+
690
+		}
691
+
692
+	} else {
693
+		this.ServeSuccessJSON(map[string]interface{}{
694
+			"is_has_create":       true,
695
+			"is_has_modify":       true,
696
+			"is_has_modify_other": true,
697
+			"is_has_del":          true,
698
+			"is_has_del_other":    true,
699
+			"is_has_exce":         true,
700
+			"is_has_check":        true,
701
+			"is_has_modify_exce":  true,
702
+			"module":              true,
703
+		})
704
+
705
+	}
706
+
707
+}
708
+func RemoveRepeatedPurviewElement2(arr []string) (newArr []string) {
709
+	newArr = make([]string, 0)
710
+	for i := 0; i < len(arr); i++ {
711
+		repeat := false
712
+		for j := i + 1; j < len(arr); j++ {
713
+			if arr[i] == arr[j] {
714
+				repeat = true
715
+				break
716
+			}
717
+		}
718
+		if !repeat {
719
+			newArr = append(newArr, arr[i])
720
+		}
721
+	}
722
+	return
723
+}

+ 2 - 0
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go 파일 보기

60
 
60
 
61
 	beego.Router("/m/api/func_role/get", &NewRoleApiController{}, "get:GetFuncRolePurviews")
61
 	beego.Router("/m/api/func_role/get", &NewRoleApiController{}, "get:GetFuncRolePurviews")
62
 
62
 
63
+	beego.Router("/m/api/permission/get", &HomeController{}, "get:GetFuncPermission")
64
+
63
 	beego.Router("/m/api/patient/getbloodpatientinfo", &NewDialysisApiController{}, "Get:GetBloodPatientInfo")
65
 	beego.Router("/m/api/patient/getbloodpatientinfo", &NewDialysisApiController{}, "Get:GetBloodPatientInfo")
64
 	beego.Router("/m/api/patient/getslowpatientinfo", &NewDialysisApiController{}, "Get:GetSlowPatientInfo")
66
 	beego.Router("/m/api/patient/getslowpatientinfo", &NewDialysisApiController{}, "Get:GetSlowPatientInfo")
65
 	beego.Router("/m/api/patient/getmemberpatientinfo", &NewDialysisApiController{}, "Get:GetMemberpatientInfo")
67
 	beego.Router("/m/api/patient/getmemberpatientinfo", &NewDialysisApiController{}, "Get:GetMemberpatientInfo")

+ 0 - 3
controllers/patient_api_controller.go 파일 보기

798
 	}
798
 	}
799
 
799
 
800
 	solution.UpdatedTime = time.Now().Unix()
800
 	solution.UpdatedTime = time.Now().Unix()
801
-	solution.Doctor = adminUserInfo.AdminUser.Id
802
-	solution.RegistrarsId = adminUserInfo.AdminUser.Id
803
 
801
 
804
 	err := service.UpdatePatientDialysisSolution(&solution)
802
 	err := service.UpdatePatientDialysisSolution(&solution)
805
 	if err != nil {
803
 	if err != nil {
1724
 	}
1722
 	}
1725
 
1723
 
1726
 	advice.UpdatedTime = time.Now().Unix()
1724
 	advice.UpdatedTime = time.Now().Unix()
1727
-	advice.AdviceDoctor = adminUserInfo.AdminUser.Id
1728
 	advice.Modifier = adminUserInfo.AdminUser.Id
1725
 	advice.Modifier = adminUserInfo.AdminUser.Id
1729
 
1726
 
1730
 	err := service.UpdateDoctorAdvice(&advice)
1727
 	err := service.UpdateDoctorAdvice(&advice)

+ 8 - 0
enums/error_code.go 파일 보기

188
 
188
 
189
 	ErrorCodeForbidden       = 20035
189
 	ErrorCodeForbidden       = 20035
190
 	ErrorCodeRoleNameIsExist = 20036
190
 	ErrorCodeRoleNameIsExist = 20036
191
+
192
+	ErrorCodeRole = 20037
193
+
194
+	ErrorCodeAdminUserIsExit = 20038
191
 )
195
 )
192
 
196
 
193
 var ErrCodeMsgs = map[int]string{
197
 var ErrCodeMsgs = map[int]string{
375
 	ErrorCodeForbidden: "你已经被管理员禁用,无法使用该系统",
379
 	ErrorCodeForbidden: "你已经被管理员禁用,无法使用该系统",
376
 
380
 
377
 	ErrorCodeRoleNameIsExist: "该角色已经不存在",
381
 	ErrorCodeRoleNameIsExist: "该角色已经不存在",
382
+
383
+	ErrorCodeRole: "尚未配置角色,无访问权限",
384
+
385
+	ErrorCodeAdminUserIsExit: "用户不存在",
378
 }
386
 }
379
 
387
 
380
 type SGJError struct {
388
 type SGJError struct {

+ 6 - 0
service/role_service.go 파일 보기

748
 	readUserDb.Model(&models.Role{}).Where("status = 1 AND role_name = ? AND org_id = ?", name, org_id).Count(&total)
748
 	readUserDb.Model(&models.Role{}).Where("status = 1 AND role_name = ? AND org_id = ?", name, org_id).Count(&total)
749
 	return
749
 	return
750
 }
750
 }
751
+
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
754
+	return
755
+
756
+}