XMLWAN 4 anni fa
parent
commit
cb3c5bf140

+ 1 - 1
conf/app.conf Vedi File

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

+ 2 - 1
controllers/dialysis_api_controller.go Vedi File

@@ -2885,7 +2885,8 @@ func (c *DialysisApiController) PostReceiveTreatmentAsses() {
2885 2885
 	psychological_assessment_other := c.GetString("psychological_assessment_other")
2886 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 2890
 	precaution_other := c.GetString("precaution_other")
2890 2891
 	psychological_other := c.GetString("psychological_other")
2891 2892
 	admission_number := c.GetString("admission_number")

+ 2 - 1
controllers/mobile_api_controllers/dialysis_api_controller.go Vedi File

@@ -637,7 +637,8 @@ func (c *DialysisAPIController) PostAcceptsAssessment() {
637 637
 	score := c.GetString("score")
638 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 642
 	precaution_other := c.GetString("precaution_other")
642 643
 	psychological_other := c.GetString("psychological_other")
643 644
 

+ 29 - 4
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Vedi File

@@ -1803,6 +1803,7 @@ func (this *NewDialysisApiController) GetRoleName() {
1803 1803
 	//跟剧机构ID获取APPID
1804 1804
 	app, _ := service.GetAppId(orgid)
1805 1805
 	name, err := service.GetRoleName(id, orgid, app.Id)
1806
+
1806 1807
 	//获取管理员
1807 1808
 	admin, err := service.GetAdmin(id)
1808 1809
 	positionName, err := service.GetPositionName(id, orgid, app.Id)
@@ -2503,7 +2504,6 @@ func (this *NewDialysisApiController) SumitForm() {
2503 2504
 }
2504 2505
 
2505 2506
 func (this *NewDialysisApiController) GetMobile() {
2506
-	fmt.Println("--------------触发了没有")
2507 2507
 	adminInfo := this.GetMobileAdminUserInfo()
2508 2508
 	id := adminInfo.AdminUser.Id
2509 2509
 
@@ -2521,13 +2521,38 @@ func (this *NewDialysisApiController) GetRolePosition() {
2521 2521
 
2522 2522
 	adminInfo := this.GetMobileAdminUserInfo()
2523 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 2551
 	if err != nil {
2527 2552
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2528 2553
 		return
2529 2554
 	}
2530 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 Vedi File

@@ -153,4 +153,6 @@ func NewMobileAPIControllersRegisterRouters() {
153 153
 	beego.Router("/m/api/patient/sumitform", &NewDialysisApiController{}, "Get:SumitForm")
154 154
 	beego.Router("/m/api/patient/getroleposition", &NewDialysisApiController{}, "Get:GetRolePosition")
155 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 Vedi File

@@ -782,7 +782,7 @@ type ReceiveTreatmentAsses struct {
782 782
 	PsychologicalAssessmentOther string `gorm:"column:psychological_assessment_other" json:"psychological_assessment_other"`
783 783
 	Score                        string `gorm:"column:score" json:"score"`
784 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 786
 	PrecautionOther              string `gorm:"column:precaution_other" json:"precaution_other"`
787 787
 	PsychologicalOther           string `gorm:"column:psychological_other" json:"psychological_other"`
788 788
 	IsPrecaution                 int64  `gorm:"column:is_precaution" json:"is_precaution"`
@@ -824,6 +824,10 @@ type SgjUserAdminRole struct {
824 824
 	Sex           int64  `gorm:"column:sex" json:"sex" form:"sex"`
825 825
 	Birthday      int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
826 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 833
 func (SgjUserAdminRole) TableName() string {

+ 14 - 0
service/manage_service.go Vedi File

@@ -1087,6 +1087,12 @@ func CreateTable(table *models.KyActivityTable) error {
1087 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 1096
 func GetRolePosition(id int64) (models.SgjUserRole, error) {
1091 1097
 	role := models.SgjUserRole{}
1092 1098
 	err := UserReadDB().Where("id = ? And status =1", id).Find(&role).Error
@@ -1098,3 +1104,11 @@ func GetMobile(id int64) (models.SgjUserAdmin, error) {
1098 1104
 	err := UserReadDB().Where("id=? and status = 1", id).Find(&admin).Error
1099 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
+}