浏览代码

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

csx 5 年前
父节点
当前提交
a77409f207

+ 1 - 1
conf/app.conf 查看文件

1
 appname = 血透
1
 appname = 血透
2
-httpport = 9529
2
+httpport = 9531
3
 runmode = dev
3
 runmode = dev
4
 
4
 
5
 
5
 

+ 2 - 1
controllers/dialysis_api_controller.go 查看文件

2885
 	psychological_assessment_other := c.GetString("psychological_assessment_other")
2885
 	psychological_assessment_other := c.GetString("psychological_assessment_other")
2886
 	sick_condition_other := c.GetString("sick_condition_other")
2886
 	sick_condition_other := c.GetString("sick_condition_other")
2887
 
2887
 
2888
-	precaution, _ := c.GetInt64("precaution", 0)
2888
+	//precaution, _ := c.GetInt64("precaution", 0)
2889
+	precaution := c.GetString("precaution")
2889
 	precaution_other := c.GetString("precaution_other")
2890
 	precaution_other := c.GetString("precaution_other")
2890
 	psychological_other := c.GetString("psychological_other")
2891
 	psychological_other := c.GetString("psychological_other")
2891
 	admission_number := c.GetString("admission_number")
2892
 	admission_number := c.GetString("admission_number")

+ 2 - 1
controllers/mobile_api_controllers/dialysis_api_controller.go 查看文件

637
 	score := c.GetString("score")
637
 	score := c.GetString("score")
638
 	sick_condition_other := c.GetString("sick_condition_other")
638
 	sick_condition_other := c.GetString("sick_condition_other")
639
 
639
 
640
-	precaution, _ := c.GetInt64("precaution", 0)
640
+	//precaution, _ := c.GetInt64("precaution", 0)
641
+	precaution := c.GetString("precaution")
641
 	precaution_other := c.GetString("precaution_other")
642
 	precaution_other := c.GetString("precaution_other")
642
 	psychological_other := c.GetString("psychological_other")
643
 	psychological_other := c.GetString("psychological_other")
643
 
644
 

+ 30 - 5
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go 查看文件

1803
 	//跟剧机构ID获取APPID
1803
 	//跟剧机构ID获取APPID
1804
 	app, _ := service.GetAppId(orgid)
1804
 	app, _ := service.GetAppId(orgid)
1805
 	name, err := service.GetRoleName(id, orgid, app.Id)
1805
 	name, err := service.GetRoleName(id, orgid, app.Id)
1806
+
1806
 	//获取管理员
1807
 	//获取管理员
1807
 	admin, err := service.GetAdmin(id)
1808
 	admin, err := service.GetAdmin(id)
1808
 	positionName, err := service.GetPositionName(id, orgid, app.Id)
1809
 	positionName, err := service.GetPositionName(id, orgid, app.Id)
1815
 			names = role.RoleName + "," + names
1816
 			names = role.RoleName + "," + names
1816
 		}
1817
 		}
1817
 	}
1818
 	}
1818
-	fmt.Println("role_ids--------------", role_ids)
1819
+	//fmt.Println("role_ids--------------", role_ids)
1819
 	if err != nil {
1820
 	if err != nil {
1820
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1821
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1821
 		return
1822
 		return
2503
 }
2504
 }
2504
 
2505
 
2505
 func (this *NewDialysisApiController) GetMobile() {
2506
 func (this *NewDialysisApiController) GetMobile() {
2506
-	fmt.Println("--------------触发了没有")
2507
 	adminInfo := this.GetMobileAdminUserInfo()
2507
 	adminInfo := this.GetMobileAdminUserInfo()
2508
 	id := adminInfo.AdminUser.Id
2508
 	id := adminInfo.AdminUser.Id
2509
 
2509
 
2521
 
2521
 
2522
 	adminInfo := this.GetMobileAdminUserInfo()
2522
 	adminInfo := this.GetMobileAdminUserInfo()
2523
 	cretor := adminInfo.AdminUser.Id
2523
 	cretor := adminInfo.AdminUser.Id
2524
-	cretorPosition, err := service.GetRolePosition(cretor)
2525
-	fmt.Println("cretorPosition", cretorPosition.RoleName)
2524
+	orgid := adminInfo.Org.Id
2525
+
2526
+	//去查角色
2527
+	role, err := service.GetAdminUserRole(cretor, orgid)
2528
+	fmt.Println("role----------------", role.RoleIds)
2529
+	role_ids := strings.Split(role.RoleIds, ",")
2530
+	var names = ""
2531
+	for _, item := range role_ids {
2532
+		id, _ := strconv.ParseInt(item, 10, 64)
2533
+		role, _ := service.GetRole(id)
2534
+		if len(role.RoleName) != 0 {
2535
+			names = role.RoleName + "," + names
2536
+		}
2537
+	}
2538
+	if err != nil {
2539
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2540
+		return
2541
+	}
2542
+	this.ServeSuccessJSON(map[string]interface{}{
2543
+		"names": names,
2544
+	})
2545
+}
2546
+
2547
+func (this *NewDialysisApiController) GetOrgs() {
2548
+	adminInfo := this.GetMobileAdminUserInfo()
2549
+	fmt.Println("a---------")
2550
+	orgs, err := service.GetOrgs(adminInfo.AdminUser.Id)
2526
 	if err != nil {
2551
 	if err != nil {
2527
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2552
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2528
 		return
2553
 		return
2529
 	}
2554
 	}
2530
 	this.ServeSuccessJSON(map[string]interface{}{
2555
 	this.ServeSuccessJSON(map[string]interface{}{
2531
-		"cretorPosition": cretorPosition,
2556
+		"orgs": orgs,
2532
 	})
2557
 	})
2533
 }
2558
 }

+ 2 - 0
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go 查看文件

153
 	beego.Router("/m/api/patient/sumitform", &NewDialysisApiController{}, "Get:SumitForm")
153
 	beego.Router("/m/api/patient/sumitform", &NewDialysisApiController{}, "Get:SumitForm")
154
 	beego.Router("/m/api/patient/getroleposition", &NewDialysisApiController{}, "Get:GetRolePosition")
154
 	beego.Router("/m/api/patient/getroleposition", &NewDialysisApiController{}, "Get:GetRolePosition")
155
 	beego.Router("/m/api/patient/getmobile", &NewDialysisApiController{}, "Get:GetMobile")
155
 	beego.Router("/m/api/patient/getmobile", &NewDialysisApiController{}, "Get:GetMobile")
156
+	beego.Router("/m/api/patient/getorgs", &NewDialysisApiController{}, "Get:GetOrgs")
157
+
156
 }
158
 }

+ 5 - 1
models/dialysis.go 查看文件

782
 	PsychologicalAssessmentOther string `gorm:"column:psychological_assessment_other" json:"psychological_assessment_other"`
782
 	PsychologicalAssessmentOther string `gorm:"column:psychological_assessment_other" json:"psychological_assessment_other"`
783
 	Score                        string `gorm:"column:score" json:"score"`
783
 	Score                        string `gorm:"column:score" json:"score"`
784
 	SickConditionOther           string `gorm:"column:sick_condition_other" json:"sick_condition_other"`
784
 	SickConditionOther           string `gorm:"column:sick_condition_other" json:"sick_condition_other"`
785
-	Precaution                   int64  `gorm:"column:precaution" json:"precaution"`
785
+	Precaution                   string `gorm:"column:precaution" json:"precaution"`
786
 	PrecautionOther              string `gorm:"column:precaution_other" json:"precaution_other"`
786
 	PrecautionOther              string `gorm:"column:precaution_other" json:"precaution_other"`
787
 	PsychologicalOther           string `gorm:"column:psychological_other" json:"psychological_other"`
787
 	PsychologicalOther           string `gorm:"column:psychological_other" json:"psychological_other"`
788
 	IsPrecaution                 int64  `gorm:"column:is_precaution" json:"is_precaution"`
788
 	IsPrecaution                 int64  `gorm:"column:is_precaution" json:"is_precaution"`
824
 	Sex           int64  `gorm:"column:sex" json:"sex" form:"sex"`
824
 	Sex           int64  `gorm:"column:sex" json:"sex" form:"sex"`
825
 	Birthday      int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
825
 	Birthday      int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
826
 	UserTitleName string `gorm:"column:user_title_name" json:"user_title_name" form:"user_title_name"`
826
 	UserTitleName string `gorm:"column:user_title_name" json:"user_title_name" form:"user_title_name"`
827
+	RoleIds       string `gorm:"column:role_ids" json:"role_ids" form:"role_ids"`
828
+	OrgName       string `gorm:"column:org_name" json:"org_name" form:"org_name"`
829
+	OrgLogo       string `gorm:"column:org_logo" json:"org_logo" form:"org_logo"`
830
+	Creator       int64  `gorm:"column:creator" json:"creator" form:"creator"`
827
 }
831
 }
828
 
832
 
829
 func (SgjUserAdminRole) TableName() string {
833
 func (SgjUserAdminRole) TableName() string {

+ 14 - 0
service/manage_service.go 查看文件

1087
 	return err
1087
 	return err
1088
 }
1088
 }
1089
 
1089
 
1090
+func GetAdminUserRole(id int64, orgid int64) (models.SgjUserAdminRole, error) {
1091
+	role := models.SgjUserAdminRole{}
1092
+	err := UserReadDB().Where("admin_user_id = ? and org_id = ? and status = 1", id, orgid).Find(&role).Error
1093
+	return role, err
1094
+}
1095
+
1090
 func GetRolePosition(id int64) (models.SgjUserRole, error) {
1096
 func GetRolePosition(id int64) (models.SgjUserRole, error) {
1091
 	role := models.SgjUserRole{}
1097
 	role := models.SgjUserRole{}
1092
 	err := UserReadDB().Where("id = ? And status =1", id).Find(&role).Error
1098
 	err := UserReadDB().Where("id = ? And status =1", id).Find(&role).Error
1098
 	err := UserReadDB().Where("id=? and status = 1", id).Find(&admin).Error
1104
 	err := UserReadDB().Where("id=? and status = 1", id).Find(&admin).Error
1099
 	return admin, err
1105
 	return admin, err
1100
 }
1106
 }
1107
+
1108
+func GetOrgs(id int64) (roles []*models.SgjUserAdminRole, err error) {
1109
+
1110
+	db := UserReadDB().Table("sgj_user_admin_role as s").Where("s.status = 1")
1111
+	err = db.Group("s.org_id").Select("s.id,s.admin_user_id,s.org_id,s.app_id,s.role_id,s.user_name,s.avatar,s.user_type,s.user_title,s.intro,s.user_title_name,s.role_ids,s.message,s.sex,s.birthday,x.org_name,x.org_logo,x.creator").Where("s.admin_user_id = ?", id).Joins("left join sgj_user_org as x on x.id = s.org_id").Scan(&roles).Error
1112
+
1113
+	return roles, err
1114
+}